{"version":3,"sources":["jsdelivr-header.js","/npm/angular-360-no-scope@0.1.2/angular-360-no-scope.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,CCNA,WACY,QAAQ,OAAO,uBAAwB,IAI7C,OAAO,CAAE,sBAAuB,WAAY,SAAS,EAAqB,GAC5E,IAAI,EAAe,EAAoB,SACvC,EAAoB,SAAW,SAA2B,EAAM,GAC9D,OAAO,EAAa,EAexB,SAAwB,GAGtB,IAAI,EAAO,EAAS,SAAS,GAAU,OAAO,CAAE,SAAU,YAAa,WAKvE,SAAS,IAYP,IATA,IAAI,EAAW,UAAW,EAAW,KAAM,EAAS,CAAC,EAGjD,EAAS,UAAU,UAAU,OAAS,GACtC,EAAY,UAAU,UAAU,OAAS,GACzC,EAAS,UAAU,UAAU,OAAS,GAIjC,EAAI,EAAG,EAAI,EAAK,OAAQ,IAAO,EAAO,EAAK,IAAM,EAAS,GAInE,EAAS,UAAU,OAAS,WAC1B,IAAI,EAAO,UAAW,EAAY,EAAK,GAEvC,GAAI,QAAQ,SAAS,GAAY,CAE/B,IAAI,EAAU,EAAO,GACrB,EAAK,GAAK,WAAa,OAAO,EAAQ,EAAW,CACnD,CAEA,OAAO,EAAO,OAAO,MAAM,EAAQ,EACrC,EAGA,QAAQ,QAAQ,CAAC,MAAO,aAAc,UAAU,SAAS,GACvD,EAAS,UAAU,GAAU,WAC3B,EAAO,GAAQ,MAAM,EAAQ,UAC/B,CACF,IAQA,EAAU,OAAO,EAAU,EAAU,EACvC,CASA,OANA,EAAoB,QAAU,EAG9B,EAAoB,UAAY,EAAS,UAGlC,CACT,CA3E8B,CAAe,GAC3C,EAEA,EAAS,UAAU,eAAe,SAAS,GACzC,OAAO,WACL,OAAO,EAAU,MAAM,EAAW,UACpC,CACF,GACF,IAEA,IAAI,EAAW,QAAQ,UAkExB,CApFD","file":"/npm/angular-360-no-scope@0.1.2/angular-360-no-scope.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/angular-360-no-scope@0.1.2/angular-360-no-scope.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function() {\n  var app = angular.module('angular-360-no-scope', []);\n\n  // Decorate both $controllerProvider.register and $controller service fn\n  // Have them wrap the incoming controller definition in the makeController surrogate\n  app.config([ '$controllerProvider', '$provide', function($controllerProvider, $provide) {\n    var realRegister = $controllerProvider.register;\n    $controllerProvider.register = function registerDecorator(name, constructor) {\n      return realRegister(name, makeController(constructor));\n    };\n\n    $provide.decorator('$controller', function($delegate) {\n      return function $controllerDecorator() {\n        return $delegate.apply($delegate, arguments);\n      }\n    });\n  }]);\n\n  var injector = angular.injector();\n\n  // This is the heart of this implementation. This function wraps\n  // a controller inside a surrogate controller function which will\n  // add $watch capability on the controller.\n  function makeController(ctrlImpl) {\n    // Figure out what deps the ctrlImpl requires.\n    // Append the two injectables we require\n    var deps = injector.annotate(ctrlImpl).concat([ '$scope', '$injector', '$parse' ]);\n\n    // This is the surrogate controller which is returned\n    // It wraps the ctrlImpl the app developer defines and adds\n    // the $watch passthrough.\n    function surrogateController() {\n      // When this is invoked later by angular, it will be injected with services/locals\n      // Snag the injected objects\n      var injected = arguments, instance = this, locals = {};;\n\n      // We always inject $scope, $injector, and $parse.  Snag those three things.\n      var $scope = arguments[arguments.length - 3];\n      var $injector = arguments[arguments.length - 2];\n      var $parse = arguments[arguments.length - 1];\n\n      // Recreate a \"locals\" array (in case any locals were injected)\n      // We map the 'deps' and 'injected' arrays back into an assoc-array\n      for (var i = 0; i < deps.length; i++) { locals[deps[i]] = injected[i]; }\n\n      // Add a $scope.$watch passthrough onto the ctrlImpl's prototype (and\n      // therefore onto the surrogate controller's prototype as well)\n      ctrlImpl.prototype.$watch = function() {\n        var args = arguments, watchExpr = args[0];\n\n        if (angular.isString(watchExpr)) {\n          // If watchExpr is a String, set up a $parse fn which evaluates against `instance`\n          var getExpr = $parse(watchExpr);\n          args[0] = function() { return getExpr(instance); }\n        }\n\n        return $scope.$watch.apply($scope, args);\n      }\n\n      // Add some other $scope passthroughs to ctrlImpl prototype; just because.\n      angular.forEach(['$on', '$broadcast', '$emit'], function(fnName) {\n        ctrlImpl.prototype[fnName] = function() {\n          $scope[fnName].apply($scope, arguments);\n        }\n      });\n\n      // This worked in 1.2.x but 1.3.0 introduced invoking controllers 'later'\n      // return instance = $injector.instantiate(ctrlImpl, locals);\n\n      // Finally, return the result of calling \"ctrlImpl(injectedVars...)\" with\n      // `this` bound to the surrogate instance.  This will let the controller code\n      // use 'this' and apply it to the surrogate.\n      $injector.invoke(ctrlImpl, instance, locals);\n    }\n\n    // Annotate the surrogateController surrogate function with required injectables\n    surrogateController.$inject = deps;\n    // Make the surrogate's protoype the ctrlImp's prototype because the surrogate\n    // is what is actually returned and set into the $scope.\n    surrogateController.prototype = ctrlImpl.prototype;\n\n    // return the surrogate fn here\n    return surrogateController;\n  }\n})();\n"]}