/*
Pre-load angular templates
540794
function () {
    return gulp.src(paths.admin.partials)
      .pipe(minifyHtml({
        empty: true,
        spare: true,
        quotes: true
      }))
      .pipe(ngHtml2Js({
        moduleName: function (file) {
          var pathParts = file.path.split('/');
          var folder = pathParts[pathParts.length - 2];
          return folder.replace(/-[a-z]/g, function (match) {
            return match.substr(1).toUpperCase();
          });
        }
      }))
      .pipe(concat('partials.js'))
      .pipe(gulp.dest(paths.admin.build));
  }
11613
function(template) {
      if (template) {
        // make a shadow root
        var root = this.createShadowRoot();
        // stamp template
        // which includes parsing and applying MDV bindings before being
        // inserted (to avoid {{}} in attribute values)
        // e.g. to prevent <img src="images/{{icon}}"> from generating a 404.
        var dom = this.instanceTemplate(template);
        // append to shadow dom
        root.appendChild(dom);
        // perform post-construction initialization tasks on shadow root
        this.shadowRootReady(root, template);
        // return the created shadow root
        return root;
      }
    }
841672
function (template) {
          if (fetchPromises[template]) {
            return fetchPromises[template];
          }

          fetchPromises[template] = $http.get(template, {
            cache: $templateCache
          });

          return fetchPromises[template].then(function (response) {
            return response.data;
          });
        }
822359
function (tplSource, callback) {

            var tmpCfg = this._getReloadCfg();
            if (tplSource) {
                aria.templates.TemplateManager.$onOnce({
                    "unloadTemplate" : {
                        fn : function () {
                            var logicalPath = tmpCfg.classpath.replace(/\./g, "/") + ".tpl";
                            var cacheContent = ariaCoreCache.getItem("files", logicalPath, true);
                            cacheContent.status = 3; // status OK
                            cacheContent.value = tplSource;
                        },
                        scope : this
                    }
                });
            }

            tmpCfg.reload = true;
            tmpCfg.reloadByPassCache = true;

            var disposed = Aria.disposeTemplate(tmpCfg.div); // dispose the old template
            if (!disposed) {
                this.$logError("Could not reload template: " + tmpCfg.classpath);
            } else {
                this._callLoadTemplate(tmpCfg, callback);
            }
        }
805017
function run() {
    var template;
    $ionicTemplateCache._runCount++;

    hasRun = true;
    // ignore if race condition already zeroed out array
    if (toCache.length === 0) return;

    var i = 0;
    while (i < 4 && (template = toCache.pop())) {
      // note that inline templates are ignored by this request
      if (isString(template)) $http.get(template, { cache: $templateCache });
      i++;
    }
    // only preload 3 templates a second
    if (toCache.length) {
      $timeout(run, 1000);
    }
  }
287426
function () {
            var $loadStylesheetPromise,
                $loadMetadataPromise,
                $pageOneContentPromise,
                $pageOneTextPromise;

            if ($assetsPromise) {
                return;
            }

            $loadMetadataPromise = scope.get('metadata');
            $loadMetadataPromise.then(function handleMetadataResponse(metadata) {
                config.metadata = metadata;
            });

            // don't load the stylesheet for IE < 9
            if (browser.ielt9) {
                stylesheetEl = util.insertCSS('');
                config.stylesheet = stylesheetEl.styleSheet;
                $loadStylesheetPromise = $.when('').promise({
                    abort: function () {}
                });
            } else {
                $loadStylesheetPromise = scope.get('stylesheet');
                $loadStylesheetPromise.then(function handleStylesheetResponse(cssText) {
                    stylesheetEl = util.insertCSS(cssText);
                    config.stylesheet = stylesheetEl.sheet;
                });
            }


            // load page 1 assets immediately if necessary
            if (config.autoloadFirstPage &&
                (!config.pageStart || config.pageStart === 1)) {
                if (support.svg && config.useSVG) {
                    $pageOneContentPromise = scope.get('page-svg', 1);
                } else if (config.conversionIsComplete) {
                    // unfortunately, page-1.png is not necessarily available
                    // on View API's document.viewable event, so we can only
                    // prefetch page-1.png if conversion is complete
                    $pageOneContentPromise = scope.get('page-img', 1);
                }
                if (config.enableTextSelection) {
                    $pageOneTextPromise = scope.get('page-text', 1);
                }
            }

            // when both metatadata and stylesheet are done or if either fails...
            $assetsPromise = $.when($loadMetadataPromise, $loadStylesheetPromise)
                .fail(function (error) {
                    if ($assetsPromise) {
                        $assetsPromise.abort();
                    }
                    scope.ready();
                    scope.broadcast('asseterror', error);
                    scope.broadcast('fail', error);
                })
                .then(completeInit)
                .promise({
                    abort: function () {
                        $assetsPromise = null;
                        $loadMetadataPromise.abort();
                        $loadStylesheetPromise.abort();
                        if ($pageOneContentPromise) {
                            $pageOneContentPromise.abort();
                        }
                        if ($pageOneTextPromise) {
                            $pageOneTextPromise.abort();
                        }
                    }
                });
        }
585705
function loadTemplatesFiles (dir, files, options, templates) {
    // require files
    if (!Array.isArray(files)) {
        return Promise.resolve()
    }
    // load template for each file
    return Promise.each(files, file => {
        // get absolute file from dir
        var absFile = dir+'/'+file
        // get express template name by stripping off extension
        file = file.replace(GLOBAL.extRegExp, '')
        // if template has already been defined then do not replace so that
        // first incidence of file in multiple paths is used
        if (templates[file]) {
            return
        }
        // load template
        var promise = templates[file] = loadTemplate(absFile, options)
        // once template is loaded replace promise with template
        .then(template => {
            templates[file] = template
        })
        // wait for template to load
        return promise
    })
}
1230487
function init() {

                    element.wrap('<div class="ng-flat-datepicker-wrapper"></div>');

                    $compile(template)(scope);
                    element.after(template);

                    if (angular.isDefined(ngModel.$modelValue) && moment.isDate(ngModel.$modelValue)) {
                        scope.calendarCursor = ngModel.$modelValue;
                    }
                }
755524
async function preRenderElements (elements, globals) {
  for (let element of elements) {
    await element.preRender(globals)
  }
}
1202206
protected function loadTemplates()
    {
        $templates = $this->templatesObjectBackend->loadObject();
        if (!is_array($templates)) {
            $templates = array();
        }
        
        $this->templates = $templates;
    }
1036311
function preLink(scope, element, attr, ctrls) {
    var selectCtrl = ctrls[0];

    element.addClass('_md');     // private md component indicator for styling

    $mdTheming(element);
    element.on('click', clickListener);
    element.on('keypress', keyListener);

    function keyListener(e) {
      if (e.keyCode == 13 || e.keyCode == 32) {
        clickListener(e);
      }
    }

    function clickListener(ev) {
      var option = $mdUtil.getClosest(ev.target, 'md-option');
      var optionCtrl = option && angular.element(option).data('$mdOptionController');
      if (!option || !optionCtrl) return;
      if (option.hasAttribute('disabled')) {
        ev.stopImmediatePropagation();
        return false;
      }

      var optionHashKey = selectCtrl.hashGetter(optionCtrl.value);
      var isSelected = angular.isDefined(selectCtrl.selected[optionHashKey]);

      scope.$apply(function() {
        if (selectCtrl.isMultiple) {
          if (isSelected) {
            selectCtrl.deselect(optionHashKey);
          } else {
            selectCtrl.select(optionHashKey, optionCtrl.value);
          }
        } else {
          if (!isSelected) {
            selectCtrl.deselect(Object.keys(selectCtrl.selected)[0]);
            selectCtrl.select(optionHashKey, optionCtrl.value);
          }
        }
        selectCtrl.refreshViewValue();
      });
    }
  }
274373
function postload(e){
	if(preinit){
		preinit = false;
		for(var i=0;i<loadfun.length;i++){ loadfun[i]();}
		loadfun = [];
	}
}
210448
function (res, args) {
            var tplcfg = this._tplcfg;
            if (!tplcfg) {
                // the template may be ready after the widget has been disposed
                // do nothing in this case
                // except disposing the module which has just been created
                if (args.autoDispose) {
                    res.moduleCtrlPrivate.$dispose();
                }
                return;
            }

            var tplDiv = this._subTplDiv; // may be null at this time

            tplcfg.tplDiv = tplDiv;

            tplcfg.data = this._cfg.data;

            // if a module controller was created, inject it in template initialization
            if (res.moduleCtrl) {
                tplcfg.moduleCtrl = res.moduleCtrl;
            } else {
                tplcfg.context = this._context;
            }
            if (args.autoDispose) {
                if (tplcfg.toDispose == null) {
                    tplcfg.toDispose = [res.moduleCtrlPrivate];
                } else {
                    tplcfg.toDispose.push(res.moduleCtrlPrivate);
                }
            }
            /*
             * var tplCtxt = new aria.templates.TemplateCtxt(); this.subTplCtxt = tplCtxt;
             */
            var tplCtxt = this.subTplCtxt;
            tplCtxt.parent = this._context;

            res = tplCtxt.initTemplate(tplcfg);
            this._initCtxDone = true;

            if (res) {
                tplCtxt.dataReady(); // data successfully loaded: signal to template through TemplateContext
                // check that tplCtxt was not disposed
                if (tplDiv && tplCtxt._cfg) {
                    // Load the CSS dependencies, the style should be added before the html
                    tplDiv.className = tplDiv.className + " " + tplCtxt.getCSSClassNames(true);
                    tplCtxt.$onOnce({
                        "Ready" : this.__innerTplReadyCb,
                        scope : this
                    });
                    tplCtxt.$refresh();
                }
                // don't clean this object, as the template context will do it. Just break reference
                this.tplcfg = null;

            } else {
                tplCtxt.$dispose();
                this.subTplCtxt = null;
            }

            tplDiv = null;
        }
790511
function () {
            aria.widgets.Template.superclass._init.call(this);

            var tplDiv = ariaUtilsDom.getDomElementChild(this._domElt, 0);
            this._subTplDiv = tplDiv;
            var tplCtxt = this.subTplCtxt;

            if (tplCtxt) {
                tplCtxt.linkToPreviousMarkup(tplDiv);

                this.$callback(this.tplLoadCallback, {
                    success : true,
                    templateCtxt : tplCtxt
                });
                tplCtxt.viewReady();
            }

            // Even if not differed yet, it might still be so if its context is not yet ready
            if (!this.isDiffered) {
                // No template context means a template error, let the normal flow handle this case
                this.isDiffered = tplCtxt && !tplCtxt._ready;

                if (this.isDiffered) {
                    tplCtxt.$on({
                        "Ready" : {
                            fn : this.__differedComplete,
                            scope : this
                        }
                    });
                }
            }
        }
94956
def _load_templates(self, config):
        
        # definition of the template directory
        self.template_dir = self._get_param(
            'resources',
            'templates.dir',
            config
            )
        cherrypy.log.error(
            msg="loading templates from dir '%(dir)s'" %
                {'dir': self.template_dir},
            severity=logging.DEBUG
        )
        # preload templates
        self.temp_lookup = lookup.TemplateLookup(
            directories=self.template_dir, input_encoding='utf-8',
            default_filters=['unicode', 'h']
            )
        # load each template
        self.temp = {}
        for t in ('index.tmpl', 'error.tmpl', 'login.tmpl', '404.tmpl',
                  'searchadmin.tmpl', 'searchuser.tmpl', 'adduser.tmpl',
                  'roles.tmpl', 'groups.tmpl', 'form.tmpl', 'selfmodify.tmpl',
                  'modify.tmpl', 'service_unavailable.tmpl'
                  ):
            self.temp[t] = self.temp_lookup.get_template(t)
241248
function scanTemplateStart(beginIndex) {
  if (isAtEnd()) {
    reportError('Unterminated template literal', beginIndex, index);
    return lastToken = createToken(END_OF_FILE, beginIndex);
  }

  return nextTemplateLiteralTokenShared(NO_SUBSTITUTION_TEMPLATE,
                                        TEMPLATE_HEAD);
}
20314
function renderTemplate(contents, data, filename) {
    if (!templateCache.hasOwnProperty(contents)) {
      var jadeOptions = merge.recursive({}, options.jadeOptions, {filename: filename});
      templateCache[contents] = options.jade.compile(contents, jadeOptions);
    }
    var locals = merge.recursive({}, data, {locals: locals});
    return templateCache[contents](data);
  }