/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v0.10.0 */ !function(e,t,n){"use strict";function o(e,n,o,i,l,a,r,m,c,s){function p(){o.initOptionalProperties(e,s,{searchText:null,selectedItem:null}),a(n),$(),l(function(){C(),f(),g()})}function h(){function e(){var e=X.ul.getBoundingClientRect(),n={};e.right>o.right-d&&(n.left=t.right-e.width+"px"),X.$.ul.css(n)}if(!X)return l(h,0,!1);var t=X.wrap.getBoundingClientRect(),n=X.snap.getBoundingClientRect(),o=X.root.getBoundingClientRect(),i=n.bottom-o.top,a=o.bottom-n.top,r=t.left-o.left,m=t.width,c={left:r+"px",minWidth:m+"px",maxWidth:Math.max(t.right-o.left,o.right-t.left)-d+"px"};i>a&&o.height-t.bottom-d0||(G.hidden=_(),G.hidden||F())}function k(e){switch(e.keyCode){case i.KEY_CODE.DOWN_ARROW:if(G.loading)return;e.preventDefault(),G.index=Math.min(G.index+1,G.matches.length-1),V(),Y();break;case i.KEY_CODE.UP_ARROW:if(G.loading)return;e.preventDefault(),G.index=G.index<0?G.matches.length-1:Math.max(0,G.index-1),V(),Y();break;case i.KEY_CODE.TAB:case i.KEY_CODE.ENTER:if(G.hidden||G.loading||G.index<0||G.matches.length<1)return;e.preventDefault(),B(G.index);break;case i.KEY_CODE.ESCAPE:G.matches=[],G.hidden=!0,G.index=H()}}function N(){return t.isNumber(e.minLength)?e.minLength:1}function S(t){return t&&e.itemText?e.itemText(U(t)):t}function U(e){if(e){var t={};return G.itemName&&(t[G.itemName]=e),t}}function H(){return e.autoselect?0:-1}function _(){return W()?void 0:!0}function q(){return S(G.matches[G.index])}function W(){return t.isDefined(e.searchText)&&e.searchText.length>=N()}function j(e,t,n){Object.defineProperty(G,e,{get:function(){return n},set:function(e){var o=n;n=e,t(e,o)}})}function B(t){e.selectedItem=G.matches[t],G.hidden=!0,G.index=0,G.matches=[],l(function(){X.$.input.controller("ngModel").$setViewValue(S(e.selectedItem)||e.searchText),G.hidden=!0})}function P(){e.searchText="",B(-1);var t=document.createEvent("CustomEvent");t.initCustomEvent("input",!0,!0,{value:e.searchText}),X.input.dispatchEvent(t),X.input.focus()}function K(n){function o(t){ee[l]=t,n===e.searchText&&(G.loading=!1,Z=null,G.matches=t,G.hidden=_(),Y(),h())}var i=e.$parent.$eval(Q),l=n.toLowerCase();t.isArray(i)?o(i):i&&(G.loading=!0,i.success&&i.success(o),i.then&&i.then(o),i.error&&i.error(function(){G.loading=!1}))}function Y(){G.messages=[z(),q()]}function z(){if(ie===G.matches.length)return"";switch(ie=G.matches.length,G.matches.length){case 0:return"There are no matches available.";case 1:return"There is 1 match available.";default:return"There are "+G.matches.length+" matches available."}}function V(){if(X.li[G.index]){var e=X.li[G.index],t=e.offsetTop,n=t+e.offsetHeight,o=X.ul.clientHeight;tX.ul.scrollTop+o&&(X.ul.scrollTop=n-o)}}function F(){var t=e.searchText,n=t.toLowerCase();Z&&Z.cancel&&(Z.cancel(),Z=null),!e.noCache&&ee[n]?(G.matches=ee[n],Y()):K(t),oe&&(G.hidden=_())}var G=this,J=e.itemsExpr.split(/ in /i),Q=J[1],X=null,Z=null,ee={},te=!1,ne=[],oe=!1,ie=0;return j("hidden",b,!0),G.scope=e,G.parent=e.$parent,G.itemName=J[0],G.matches=[],G.loading=!1,G.hidden=!0,G.index=null,G.messages=[],G.id=o.nextUid(),G.isDisabled=null,G.isRequired=null,G.keydown=k,G.blur=O,G.focus=R,G.clear=P,G.select=B,G.listEnter=T,G.listLeave=w,G.mouseUp=E,G.getCurrentDisplayValue=q,G.registerSelectedItemWatcher=L,G.unregisterSelectedItemWatcher=D,p()}function i(e,t){return{controller:"MdAutocompleteCtrl",controllerAs:"$mdAutocompleteCtrl",scope:{inputName:"@mdInputName",inputMinlength:"@mdInputMinlength",inputMaxlength:"@mdInputMaxlength",searchText:"=?mdSearchText",selectedItem:"=?mdSelectedItem",itemsExpr:"@mdItems",itemText:"&mdItemText",placeholder:"@placeholder",noCache:"=?mdNoCache",itemChange:"&?mdSelectedItemChange",textChange:"&?mdSearchTextChange",minLength:"=?mdMinLength",delay:"=?mdDelay",autofocus:"=?mdAutofocus",floatingLabel:"@?mdFloatingLabel",autoselect:"=?mdAutoselect",menuClass:"@?mdMenuClass"},template:function(e,t){function n(){var t=e.find("md-item-template").remove(),n=t.length?t.html():e.html();return t.length||e.empty(),n}function o(){var t=e.find("md-not-found").remove(),n=t.length?t.html():"";return n?'
  • '+n+"
  • ":""}function i(){return t.mdFloatingLabel?'
    '+r+"
    ":' '}var l=o(),a=n(),r=e.html();return' '+i()+'

    {{message}}

    '}}}function l(e,n,o){function i(i){var l=o(n.html())(e),r=t.element("
    ").text(l).html(),m=n.attr("md-highlight-flags")||"",c=e.$watch(i,function(e){var t=a(e,m),o=r.replace(t,'$&');n.html(o)});n.on("$destroy",function(){c()})}function l(e){return e?e.replace(/[\\\^\$\*\+\?\.\(\)\|\{\}\[\]]/g,"\\$&"):e}function a(e,t){var n="";return t.indexOf("^")>=1&&(n+="^"),n+=e,t.indexOf("$")>=1&&(n+="$"),new RegExp(l(n),t.replace(/[\$\^]/g,""))}return this.init=i,i()}function a(){return{terminal:!0,scope:!1,controller:"MdHighlightCtrl",link:function(e,t,n,o){o.init(n.mdHighlightText)}}}function r(e,t){function n(n,o,i){var l=n.$parent.$mdAutocompleteCtrl,a=l.parent.$new(!1,l.parent),r=l.scope.$eval(i.mdAutocompleteListItem);a[r]=n.item,e(o.contents())(a),o.attr({role:"option",id:"item_"+t.nextUid()})}return{terminal:!0,link:n,scope:!1}}function m(e,t){function n(t,n,o){var i=t.$parent.$mdAutocompleteCtrl;e(n.contents())(i.parent),o.hasOwnProperty("mdAutocompleteReplace")&&(n.after(n.contents()),n.remove())}return{restrict:"A",terminal:!0,link:n,scope:!1}}t.module("material.components.autocomplete",["material.core","material.components.icon"]),t.module("material.components.autocomplete").controller("MdAutocompleteCtrl",o);var c=41,u=5.5*c,d=8;o.$inject=["$scope","$element","$mdUtil","$mdConstant","$timeout","$mdTheming","$window","$animate","$rootElement","$attrs"],t.module("material.components.autocomplete").directive("mdAutocomplete",i),i.$inject=["$mdTheming","$mdUtil"],t.module("material.components.autocomplete").controller("MdHighlightCtrl",l),l.$inject=["$scope","$element","$interpolate"],t.module("material.components.autocomplete").directive("mdHighlightText",a),t.module("material.components.autocomplete").directive("mdAutocompleteListItem",r),r.$inject=["$compile","$mdUtil"],t.module("material.components.autocomplete").directive("mdAutocompleteParentScope",m),m.$inject=["$compile","$mdUtil"]}(window,window.angular);