biofriction-wp-theme/node_modules/browser-sync-ui/public/js/app.js.map

1 line
1.7 MiB
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"sources":["webpack:///../node_modules/after/index.js","webpack:///../node_modules/angular-route/angular-route.js","webpack:///../node_modules/angular-route/index.js","webpack:///../node_modules/angular-sanitize/angular-sanitize.js","webpack:///../node_modules/angular-sanitize/index.js","webpack:///../node_modules/angular-touch/angular-touch.js","webpack:///../node_modules/angular-touch/index.js","webpack:///../node_modules/angular/angular.js","webpack:///../node_modules/angular/index.js","webpack:///../node_modules/arraybuffer.slice/index.js","webpack:///../node_modules/backo2/index.js","webpack:///../node_modules/base64-arraybuffer/lib/base64-arraybuffer.js","webpack:///../node_modules/blob/index.js","webpack:///../node_modules/component-bind/index.js","webpack:///../node_modules/component-emitter/index.js","webpack:///../node_modules/component-inherit/index.js","webpack:///../node_modules/debug/src/browser.js","webpack:///../node_modules/debug/src/debug.js","webpack:///../node_modules/engine.io-client/lib/globalThis.browser.js","webpack:///../node_modules/engine.io-client/lib/index.js","webpack:///../node_modules/engine.io-client/lib/socket.js","webpack:///../node_modules/engine.io-client/lib/transport.js","webpack:///../node_modules/engine.io-client/lib/transports/index.js","webpack:///../node_modules/engine.io-client/lib/transports/polling-jsonp.js","webpack:///../node_modules/engine.io-client/lib/transports/polling-xhr.js","webpack:///../node_modules/engine.io-client/lib/transports/polling.js","webpack:///../node_modules/engine.io-client/lib/transports/websocket.js","webpack:///../node_modules/engine.io-client/lib/xmlhttprequest.js","webpack:///../node_modules/engine.io-parser/lib/browser.js","webpack:///../node_modules/engine.io-parser/lib/keys.js","webpack:///../node_modules/engine.io-parser/lib/utf8.js","webpack:///../node_modules/has-binary2/index.js","webpack:///../node_modules/has-cors/index.js","webpack:///../node_modules/indexof/index.js","webpack:///../node_modules/isarray/index.js","webpack:///../node_modules/ms/index.js","webpack:///../node_modules/object-path/index.js","webpack:///../node_modules/parseqs/index.js","webpack:///../node_modules/parseuri/index.js","webpack:///../node_modules/socket.io-client/lib/index.js","webpack:///../node_modules/socket.io-client/lib/manager.js","webpack:///../node_modules/socket.io-client/lib/on.js","webpack:///../node_modules/socket.io-client/lib/socket.js","webpack:///../node_modules/socket.io-client/lib/url.js","webpack:///../node_modules/socket.io-parser/binary.js","webpack:///../node_modules/socket.io-parser/index.js","webpack:///../node_modules/socket.io-parser/is-buffer.js","webpack:///../node_modules/store/store.js","webpack:///../node_modules/to-array/index.js","webpack:///../node_modules/yeast/index.js","webpack:///./angular.js","webpack:///./directives.js","webpack:///./directives/icon.js","webpack:///./directives/link-to.js","webpack:///./directives/new-tab.js","webpack:///./directives/switch.js","webpack:///./filters.js","webpack:///./main/controller.js","webpack:///./module.js","webpack:///./modules/bsClients.js","webpack:///./modules/bsDisconnect.js","webpack:///./modules/bsHistory.js","webpack:///./modules/bsNotify.js","webpack:///./modules/bsSocket.js","webpack:///./modules/bsStore.js","webpack:///./services/Options.js","webpack:///./services/Pages.js","webpack:///./utils.js","webpack:///webpack/bootstrap","webpack:///webpack/runtime/global","webpack:///./app.js"],"names":["noop","module","exports","count","callback","err_cb","bail","proxy","err","result","Error","window","angular","undefined","ngRouteModule","provider","inherit","parent","extra","extend","Object","create","routes","pathRegExp","path","opts","insensitive","caseInsensitiveMatch","ret","originalPath","regexp","keys","replace","_","slash","key","option","optional","star","push","name","RegExp","this","when","route","routeCopy","copy","isUndefined","reloadOnSearch","redirectPath","length","substr","redirectTo","otherwise","params","$get","$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","preparedRoute","preparedRouteIsUpdateOnly","forceReload","$route","reload","fakeLocationEvent","defaultPrevented","preventDefault","$evalAsync","prepareRoute","commitRoute","updateParams","newParams","current","$$route","$routeMinErr","interpolate","search","$on","$locationEvent","match","lastRoute","forEach","on","m","exec","i","len","val","switchRouteMatcher","pathParams","equals","$broadcast","nextRoute","isString","url","then","template","templateUrl","locals","resolve","value","get","invoke","isDefined","isFunction","loadedTemplateUrl","valueOf","all","error","string","split","segment","segmentMatch","join","$$minErr","ngViewFactory","$anchorScroll","$animate","restrict","terminal","priority","transclude","link","scope","$element","attr","ctrl","$transclude","currentScope","currentElement","previousLeaveAnimation","autoScrollExp","autoscroll","onloadExp","onload","cleanupLastView","cancel","$destroy","leave","update","$template","newScope","$new","clone","enter","$eval","$emit","ngViewFillContentFactory","$compile","$controller","html","contents","controller","$scope","controllerAs","data","children","directive","$inject","$sanitizeMinErr","START_TAG_REGEXP","END_TAG_REGEXP","ATTR_REGEXP","BEGIN_TAG_REGEXP","BEGING_END_TAGE_REGEXP","COMMENT_REGEXP","DOCTYPE_REGEXP","CDATA_REGEXP","SURROGATE_PAIR_REGEXP","NON_ALPHANUMERIC_REGEXP","voidElements","makeMap","optionalEndTagBlockElements","optionalEndTagInlineElements","optionalEndTagElements","blockElements","inlineElements","svgElements","specialElements","validElements","uriAttrs","htmlAttrs","svgAttrs","validAttrs","str","lowercaseKeys","obj","items","lowercase","hiddenPre","document","createElement","decodeEntities","innerHTML","textContent","encodeEntities","charCodeAt","htmlSanitizeWriter","buf","uriValidator","ignore","out","bind","start","tag","attrs","unary","lkey","isImage","end","chars","$$sanitizeUri","handler","index","text","stack","last","parseEndTag","indexOf","lastIndexOf","comment","substring","test","parseStartTag","tagName","rest","doubleQuotedValue","singleQuotedValue","unquotedValue","pos","htmlParser","uri","filter","$sanitize","LINKY_URL_REGEXP","MAILTO_REGEXP","target","raw","addText","addLink","ngTouch","makeSwipeDirective","directiveName","direction","eventName","$parse","$swipe","element","startCoords","valid","swipeHandler","pointerTypes","coords","event","deltaY","Math","abs","y","deltaX","x","validSwipe","$apply","triggerHandler","$event","factory","POINTER_EVENTS","move","getCoordinates","originalEvent","touches","e","changedTouches","clientX","clientY","getEvents","eventType","res","pointerType","eventHandlers","totalX","totalY","lastPos","active","events","config","$provide","decorator","$delegate","shift","$timeout","$rootElement","lastPreventedTime","touchCoordinates","lastLabelClickCoordinates","ACTIVE_CLASS_NAME","checkAllowableRegions","x1","y1","x2","y2","splice","onClick","Date","now","nodeName","stopPropagation","blur","onTouchStart","tapElement","startTime","touchStartX","touchStartY","clickHandler","ngClick","tapping","resetState","removeClass","srcElement","nodeType","parentNode","addClass","diff","dist","sqrt","pow","addEventListener","preventGhostClick","disabled","onclick","touchend","minErr","ErrorConstructor","paramPrefix","SKIP_INDEXES","templateArgs","arguments","code","message","shiftedIndex","slice","toDebugString","encodeURIComponent","REGEX_STRING_REGEXP","toLowerCase","hasOwnProperty","prototype","uppercase","toUpperCase","s","ch","String","fromCharCode","msie","jqLite","jQuery","angularModule","toString","getPrototypeOf","ngMinErr","uid","isArrayLike","isWindow","isArray","isNumber","Array","item","iterator","context","call","isPrimitive","isBlankObject","forEachSorted","sort","reverseParams","iteratorFn","nextUid","setHashKey","h","$$hashKey","baseExtend","dst","objs","deep","ii","isObject","j","jj","src","isDate","isRegExp","cloneNode","isElement","merge","toInt","parseInt","identity","$","valueFn","hasCustomToString","documentMode","isScope","$watch","isBlob","isBoolean","isPromiseLike","TYPED_ARRAY_REGEXP","isTypedArray","trim","escapeForRegexp","node","prop","find","nodeName_","arrayRemove","array","source","destination","stackSource","stackDest","copyRecurse","copyElement","needsRecurse","constructor","getTime","lastIndex","type","shallowCopy","charAt","o1","o2","keySet","t1","createMap","csp","rules","ngCspElement","querySelector","ngCspAttribute","getAttribute","noUnsafeEval","noInlineStyle","Function","jq","name_","el","prefix","ngAttrPrefixes","concat","array1","array2","sliceArgs","args","startIndex","self","fn","curryArgs","apply","toJsonReplacer","toJson","pretty","JSON","stringify","fromJson","json","parse","ALL_COLONS","timezoneToOffset","timezone","fallback","requestedTimezoneOffset","isNaN","convertTimezoneToLocal","date","reverse","dateTimezoneOffset","getTimezoneOffset","minutes","setMinutes","getMinutes","addDateMinutes","startingTag","empty","elemHtml","append","NODE_TYPE_TEXT","tryDecodeURIComponent","decodeURIComponent","parseKeyValue","keyValue","splitPoint","toKeyValue","parts","arrayValue","encodeUriQuery","encodeUriSegment","pctEncodeSpaces","bootstrap","modules","strictDi","doBootstrap","injector","unshift","debugInfoEnabled","$compileProvider","createInjector","compile","NG_ENABLE_DEBUG_INFO","NG_DEFER_BOOTSTRAP","resumeBootstrap","extraModules","resumeDeferredBootstrap","reloadWithDebugInfo","location","getTestability","rootElement","SNAKE_CASE_REGEXP","snake_case","separator","letter","skipDestroyOnNextJQueryCleanData","bindJQueryFired","assertArg","arg","reason","assertArgFn","acceptArrayAnnotation","assertNotHasOwnProperty","getter","bindFnToScope","lastInstance","getBlockNodes","nodes","blockNodes","endNode","nextSibling","seen","serializeObject","version","full","major","minor","dot","codeName","JQLite","expando","jqCache","cache","jqId","addEventListenerFn","removeEventListenerFn","removeEventListener","_data","SPECIAL_CHARS_REGEXP","MOZ_HACK_REGEXP","MOUSE_EVENT_MAP","mouseleave","mouseenter","jqLiteMinErr","camelCase","offset","SINGLE_TAG_REGEXP","HTML_REGEXP","TAG_NAME_REGEXP","XHTML_TAG_REGEXP","wrapMap","jqLiteIsTextNode","jqLiteAcceptsData","jqLiteBuildFragment","tmp","wrap","fragment","createDocumentFragment","createTextNode","appendChild","_default","lastChild","childNodes","firstChild","jqLiteWrapNode","wrapper","replaceChild","optgroup","tbody","tfoot","colgroup","caption","thead","th","td","jqLiteContains","Node","contains","compareDocumentPosition","argIsString","parsed","jqLiteAddNodes","jqLiteClone","jqLiteDealoc","onlyDescendants","jqLiteRemoveData","querySelectorAll","descendants","l","jqLiteOff","unsupported","expandoStore","jqLiteExpandoStore","handle","removeHandler","listenerFns","expandoId","ng339","createIfNecessary","jqLiteData","isSimpleSetter","isSimpleGetter","massGetter","jqLiteHasClass","selector","jqLiteRemoveClass","cssClasses","setAttribute","cssClass","jqLiteAddClass","existingClasses","root","elements","jqLiteController","jqLiteInheritedData","documentElement","names","host","jqLiteEmpty","removeChild","jqLiteRemove","keepData","JQLitePrototype","ready","fired","trigger","readyState","setTimeout","eq","BOOLEAN_ATTR","BOOLEAN_ELEMENTS","ALIASED_ATTR","getBooleanAttrName","booleanAttr","defaultHandlerWrapper","specialMouseHandlerWrapper","related","relatedTarget","$$jqLiteProvider","hasClass","classes","hashKey","nextUidFn","objType","HashMap","isolatedUid","put","removeData","hasData","inheritedData","isolateScope","removeAttr","removeAttribute","css","style","lowercasedName","attributes","getNamedItem","specified","getText","$dv","multiple","options","selected","arg1","arg2","nodeCount","min","nodeValue","eventHandler","isDefaultPrevented","eventFns","eventFnsLength","immediatePropagationStopped","originalStopImmediatePropagation","stopImmediatePropagation","isImmediatePropagationStopped","handlerWrapper","specialHandlerWrapper","elem","createEventHandler","types","addHandler","noEventListener","off","one","onFn","replaceWith","replaceNode","insertBefore","contentDocument","child","prepend","wrapNode","remove","detach","after","newElement","toggleClass","condition","className","classCondition","next","nextElementSibling","getElementsByTagName","extraParameters","dummyEvent","eventFnsCopy","handlerArgs","arg3","unbind","$$HashMapProvider","FN_ARGS","FN_ARG_SPLIT","FN_ARG","STRIP_COMMENTS","$injectorMinErr","modulesToLoad","INSTANTIATING","providerSuffix","loadedModules","providerCache","supportObject","service","instantiate","constant","instanceCache","serviceName","decorFn","origProvider","providerInjector","orig$get","origInstance","instanceInjector","createInternalInjector","caller","loadModules","moduleFn","runBlocks","requires","_runBlocks","runInvokeQueue","_invokeQueue","_configBlocks","queue","invokeArgs","delegate","provider_","enforceReturnValue","factoryFn","enforce","getService","$$annotate","Type","instance","returnedValue","annotate","has","$AnchorScrollProvider","autoScrollingEnabled","disableAutoScrolling","$window","scrollTo","scrollIntoView","scroll","yOffset","getComputedStyle","position","getBoundingClientRect","bottom","getYOffset","elemTop","top","scrollBy","hash","elm","list","getElementById","getElementsByName","some","newVal","oldVal","action","win","anonFn","underscore","$animateMinErr","NG_ANIMATE_CLASSNAME","mergeClasses","a","b","prepareAnimateOptions","$$CoreAnimateJsProvider","$$CoreAnimateQueueProvider","postDigestQueue","postDigestElements","$$AnimateRunner","enabled","pin","domOperation","from","to","add","classesAdded","updateData","classesRemoved","$$postDigest","handleCSSClassChanges","addRemoveClassesPostDigest","runner","complete","changed","existing","klass","splitClasses","toAdd","toRemove","status","$AnimateProvider","$$registeredAnimations","register","classNameFilter","expression","$$classNameFilter","reservedRegex","$$animateQueue","domInsert","parentElement","afterElement","afterNode","extractElementNode","previousElementSibling","addclass","setClass","animate","tempClasses","$$AnimateAsyncRunFactoryProvider","$$rAF","waitQueue","waitForTick","passed","$$AnimateRunnerFactoryProvider","$sniffer","$$animateAsyncRun","$document","AnimateRunner","setHost","rafTick","_doneCallbacks","_tick","doc","hidden","timeoutTick","_state","chain","response","runners","onProgress","done","progress","getPromise","promise","reject","resolveHandler","rejectHandler","pause","resume","_resolve","$CoreAnimateCssProvider","initialOptions","$$prepared","cleanupStyles","closed","run","Browser","$log","history","clearTimeout","pendingDeferIds","isMock","outstandingRequestCount","outstandingRequestCallbacks","completeOutstandingRequest","pop","$$completeOutstandingRequest","$$incOutstandingRequestCount","notifyWhenNoOutstandingRequests","cachedState","lastHistoryState","lastBrowserUrl","href","baseElement","pendingLocation","cacheState","state","sameState","sameBase","stripHash","getHash","urlChangeListeners","urlChangeInit","cacheStateAndFireUrlChange","fireUrlChange","lastCachedState","getCurrentState","listener","onUrlChange","$$applicationDestroyed","$$checkUrlChange","baseHref","defer","delay","timeoutId","deferId","$BrowserProvider","$CacheFactoryProvider","caches","cacheFactory","cacheId","size","stats","id","capacity","Number","MAX_VALUE","lruHash","freshEnd","staleEnd","refresh","lruEntry","p","n","removeAll","destroy","info","entry","nextEntry","prevEntry","$TemplateCacheProvider","$cacheFactory","$compileMinErr","$CompileProvider","$$sanitizeUriProvider","hasDirectives","Suffix","COMMENT_DIRECTIVE_REGEXP","CLASS_DIRECTIVE_REGEXP","ALL_OR_NOTHING_ATTRS","REQUIRE_PREFIX_REGEXP","EVENT_HANDLER_ATTR_REGEXP","bindingCache","parseIsolateBindings","isController","LOCAL_REGEXP","bindings","definition","scopeName","mode","collection","attrName","parseDirectiveBindings","bindToController","ident","CNTRL_REG","identifierForController","registerDirective","directiveFactory","assertValidDirectiveName","$exceptionHandler","directives","require","$$moduleName","aHrefSanitizationWhitelist","imgSrcSanitizationWhitelist","$interpolate","Attributes","attributesToCopy","$attr","$$element","safeAddClass","$normalize","directiveNormalize","$addClass","classVal","$removeClass","$updateClass","newClasses","oldClasses","tokenDifference","$set","writeAttr","booleanKey","aliasedKey","observer","trimmedSrcset","pattern","rawUris","nbrUrisWith2parts","floor","innerIdx","lastTuple","$$observers","$observe","listeners","$$inter","startSymbol","endSymbol","denormalizeTemplate","NG_ATTR_BINDING","MULTI_ELEMENT_DIR_RE","$$addBindingInfo","binding","$$addBindingClass","$$addScopeInfo","isolated","noTemplate","dataName","$$addScopeClass","$compileNodes","transcludeFn","maxPriority","ignoreDirective","previousCompileContext","NOT_EMPTY","domNode","compositeLinkFn","compileNodes","namespace","cloneConnectFn","needsNewScope","$parent","$linkNode","parentBoundTranscludeFn","transcludeControllers","futureParentElement","$$boundTransclude","wrapTemplate","controllerName","nodeList","nodeLinkFn","childLinkFn","linkFnFound","nodeLinkFnFound","linkFns","collectDirectives","applyDirectivesToNode","transcludeOnThisElement","templateOnThisElement","childScope","idx","stableNodeList","nodeListLength","createBoundTranscludeFn","previousBoundTranscludeFn","transcludedScope","cloneFn","controllers","containingScope","$$transcluded","attrsMap","addDirective","nName","ngAttrName","isNgAttr","nAttrs","attrStartName","attrEndName","PREFIX_REGEXP","multiElementMatch","directiveIsMultiElement","addAttrInterpolateDirective","animVal","interpolateFn","templateNode","templateNodeParent","hasCompileParent","expressions","addTextInterpolateDirective","byPriority","groupScan","attrStart","attrEnd","depth","hasAttribute","groupElementsLinkFnWrapper","linkFn","compileNode","templateAttrs","jqCollection","originalReplaceDirective","preLinkFns","postLinkFns","directiveValue","terminalPriority","newScopeDirective","controllerDirectives","newIsolateScopeDirective","templateDirective","nonTlbTranscludeDirective","hasTranscludeDirective","hasTemplate","hasElementTranscludeDirective","$compileNode","replaceDirective","childTranscludeFn","$$start","$$end","assertNoDuplicate","$$tlb","createComment","$$isolateScope","$$newScope","removeComments","templateNamespace","newTemplateAttrs","templateDirectives","unprocessedDirectives","markDirectiveScope","mergeTemplateAttributes","compileTemplateUrl","addLinkFns","pre","post","max","cloneAndAnnotateFn","getControllers","elementControllers","inheritType","linkNode","boundTranscludeFn","controllerScope","removeScopeBindingWatches","removeControllerBindingWatches","cloneAttachFn","scopeToChild","controllerKey","$attrs","controllerInstance","setupControllers","$$originalDirective","$$isolateBindings","initializeDirectiveBindings","controllerDirective","$$bindings","identifier","controllerResult","invokeLinkFn","tDirectives","startAttrName","endAttrName","multiElement","srcAttr","dstAttr","tAttrs","afterTemplateNodeLinkFn","afterTemplateChildLinkFn","linkQueue","beforeTemplateCompileNode","origAsyncDirective","derivedSyncDirective","content","tempTemplateAttrs","childBoundTranscludeFn","beforeTemplateLinkNode","linkRootElement","$$destroyed","ignoreChildLinkFn","what","previousDirective","wrapModuleNameIfDefined","moduleName","allOrNothing","trustedContext","attrNormalizedName","HTML","RESOURCE_URL","getTrustedContext","newValue","$$scope","oldValue","elementsToRemove","newNode","firstElementToRemove","removeCount","j2","cleanData","k","kk","annotation","removeWatchCollection","lastValue","parentGet","parentSet","compare","literal","assign","removeWatch","parentValueWatch","parentValue","$stateful","$watchCollection","str1","str2","values","tokens1","tokens2","outer","token","jqNodes","$controllerMinErr","$ControllerProvider","globals","allowGlobals","later","controllerPrototype","addIdentifier","$DocumentProvider","$ExceptionHandlerProvider","exception","cause","$$ForceReflowProvider","body","offsetWidth","CONTENT_TYPE_APPLICATION_JSON","APPLICATION_JSON","JSON_START","JSON_ENDS","JSON_PROTECTION_PREFIX","$httpMinErr","$httpMinErrLegacyFn","method","serializeValue","v","toISOString","$HttpParamSerializerProvider","$HttpParamSerializerJQLikeProvider","serialize","toSerialize","topLevel","defaultHttpResponseTransform","headers","tempData","contentType","jsonStart","parseHeaders","fillInParsed","line","headerVal","headerKey","headersGetter","headersObj","transformData","fns","isSuccess","$HttpProvider","defaults","transformResponse","transformRequest","d","isFormData","common","patch","xsrfCookieName","xsrfHeaderName","paramSerializer","useApplyAsync","useLegacyPromise","useLegacyPromiseExtensions","interceptorFactories","interceptors","$httpBackend","$$cookieReader","defaultCache","reversedInterceptors","$http","requestConfig","defHeaderName","lowercaseDefHeaderName","reqHeaderName","defHeaders","reqHeaders","defaultHeadersIteration","headerContent","processedHeaders","headerFn","header","executeHeaderFns","mergeHeaders","reqData","withCredentials","cachedResp","deferred","serializedParams","buildUrl","pendingRequests","removePendingReq","resolvePromiseWithResult","resolvePromise","xsrfValue","urlIsSameOrigin","headersString","statusText","resolveHttpPromise","$applyAsync","$$phase","timeout","responseType","sendReq","interceptor","request","requestError","responseError","thenFn","rejectFn","success","resp","interceptorFactory","createShortMethods","createShortMethodsWithData","$xhrFactoryProvider","XMLHttpRequest","$HttpBackendProvider","$browser","$xhrFactory","createXhr","$browserDefer","callbacks","rawDocument","callbackId","counter","called","jsonpDone","script","async","jsonpReq","completeRequest","xhr","open","setRequestHeader","responseText","urlResolve","protocol","getAllResponseHeaders","onerror","onabort","send","timeoutRequest","abort","createHttpBackend","$interpolateMinErr","$InterpolateProvider","startSymbolLength","endSymbolLength","escapedStartRegexp","escape","escapedEndRegexp","unescapeText","mustHaveExpression","endIndex","exp","parseFns","textLength","expressionPositions","parseStringifyInterceptor","throwNoconcat","compute","getValue","getTrusted","interr","$$watchDelegate","$watchGroup","oldValues","currValue","$IntervalProvider","$$q","intervals","interval","invokeApply","hasParams","setInterval","clearInterval","iteration","skipApply","$$intervalId","notify","PATH_MATCH","DEFAULT_PORTS","$locationMinErr","encodePath","segments","parseAbsoluteUrl","absoluteUrl","locationObj","parsedUrl","$$protocol","$$host","hostname","$$port","port","parseAppUrl","relativeUrl","prefixed","$$path","pathname","$$search","$$hash","beginsWith","begin","whole","trimEmptyHash","LocationHtml5Url","appBase","appBaseNoFile","basePrefix","$$html5","$$parse","pathUrl","$$compose","$$url","$$absUrl","$$parseLinkUrl","relHref","appUrl","prevAppUrl","rewrittenUrl","LocationHashbangUrl","hashPrefix","withoutHashUrl","withoutBaseUrl","base","firstPathSegmentMatch","windowsFilePathExp","removeWindowsDriveName","LocationHashbangInHtml5Url","locationPrototype","$$replace","absUrl","locationGetter","locationGetterSetter","paramValue","property","preprocess","$LocationProvider","html5Mode","requireBase","rewriteLinks","LocationMode","initialUrl","stripFile","$$state","IGNORE_URI_REGEXP","setBrowserUrlWithFallback","oldUrl","oldState","ctrlKey","metaKey","shiftKey","which","button","absHref","initializing","newUrl","newState","afterLocationChange","$digest","currentReplace","urlOrStateChanged","$LogProvider","debug","debugEnabled","flag","log","consoleLog","warn","formatError","sourceURL","console","logFn","hasApply","Location","$parseMinErr","ensureSafeMemberName","fullExpression","getStringValue","ensureSafeObject","CALL","APPLY","BIND","ensureSafeFunction","ensureSafeAssignContext","OPERATORS","operator","ESCAPE","Lexer","lex","tokens","readString","peek","readNumber","isIdent","readIdent","is","isWhitespace","ch2","ch3","op1","op2","op3","throwError","num","isExpOperator","colStr","number","peekCh","quote","rawString","hex","AST","lexer","ifDefined","plusFn","r","isStateless","$filter","filterName","findConstantAndWatchExpressions","ast","allConstants","argsToWatch","Program","expr","Literal","toWatch","UnaryExpression","argument","BinaryExpression","left","right","LogicalExpression","ConditionalExpression","alternate","consequent","Identifier","MemberExpression","object","computed","CallExpression","callee","AssignmentExpression","ArrayExpression","ObjectExpression","properties","ThisExpression","getInputs","lastExpression","candidate","isAssignable","assignableAST","NGValueParameter","isLiteral","isConstant","ASTCompiler","astBuilder","ASTInterpreter","ExpressionStatement","Property","program","expressionStatement","expect","filterChain","assignment","ternary","logicalOR","consume","logicalAND","equality","relational","additive","multiplicative","primary","arrayDeclaration","constants","parseArguments","baseExpression","peekToken","kind","msg","e1","e2","e3","e4","peekAhead","t","expensiveChecks","nextId","filters","vars","own","inputs","assignable","stage","computing","recurse","return_","generateFunction","watch","fnKey","intoId","watchId","fnString","USE","STRICT","filterPrefix","watchFns","varsPrefix","section","nameId","recursionFn","skipWatchIdCheck","if_","lazyAssign","computedMember","lazyRecurse","plus","not","getHasOwnProperty","nonComputedMember","isPossiblyDangerousMemberName","addEnsureSafeObject","notNull","addEnsureSafeAssignContext","addEnsureSafeMemberName","addEnsureSafeFunction","member","defaultValue","stringEscapeRegex","stringEscapeFn","c","skip","init","input","rhs","lhs","Parser","astCompiler","objectValueOf","getValueOf","$ParseProvider","cacheDefault","cacheExpensive","$parseOptions","$parseOptionsExpensive","runningChecksEnabled","$$runningExpensiveChecks","interceptorFn","parsedExpression","oneTime","cacheKey","parseOptions","constantWatchDelegate","oneTimeLiteralWatchDelegate","oneTimeWatchDelegate","inputsWatchDelegate","expensiveChecksInterceptor","addInterceptor","expensiveCheckFn","expensiveCheckOldValue","expressionInputDirtyCheck","oldValueOfValue","objectEquality","prettyPrintExpression","lastResult","inputExpressions","oldInputValueOf","newInputValue","oldInputValueOfValues","oldInputValues","unwatch","old","isAllDefined","allDefined","watchDelegate","useInputs","$QProvider","qFactory","$$QProvider","nextTick","exceptionHandler","$qMinErr","TypeError","Promise","simpleBind","scheduleProcessQueue","processScheduled","pending","processQueue","Deferred","onFulfilled","onRejected","progressBack","handleCallback","$$reject","$$resolve","resolveFn","callOnce","makePromise","resolved","isResolved","callbackOutput","errback","$Q","Q","resolver","promises","results","$$RAFProvider","requestAnimationFrame","webkitRequestAnimationFrame","cancelAnimationFrame","webkitCancelAnimationFrame","webkitCancelRequestAnimationFrame","rafSupported","raf","timer","supported","$RootScopeProvider","TTL","$rootScopeMinErr","lastDirtyWatch","applyAsyncId","digestTtl","destroyChildScope","cleanUpScope","$$childHead","$$nextSibling","$$prevSibling","$$childTail","$root","$$watchers","Scope","$id","$$listeners","$$listenerCount","$$watchersCount","isolate","$$ChildScope","ChildScope","createChildScopeClass","watchExp","watcher","initWatchVal","incrementWatchersCount","watchExpressions","newValues","deregisterFns","changeReactionScheduled","firstRun","shouldCall","watchGroupAction","unwatchFn","$watchCollectionInterceptor","veryOldValue","trackVeryOldValue","changeDetected","changeDetector","internalArray","internalObject","initRun","oldLength","_value","newLength","newItem","oldItem","watchers","dirty","logIdx","asyncTask","ttl","watchLog","beginPhase","flushApplyAsync","asyncQueue","traverseScopesLoop","clearPhase","decrementListenerCount","applyAsyncQueue","namedListeners","indexOfListener","targetScope","listenerArgs","$$asyncQueue","$$postDigestQueue","$$applyAsyncQueue","phase","$$SanitizeUriProvider","normalizedVal","regex","$sceMinErr","SCE_CONTEXTS","CSS","URL","JS","adjustMatchers","matchers","adjustedMatchers","matcher","adjustMatcher","$SceDelegateProvider","resourceUrlWhitelist","resourceUrlBlacklist","htmlSanitizer","matchUrl","generateHolderType","Base","holderType","trustedValue","$$unwrapTrustedValue","trustedValueHolderBase","byType","trustAs","Constructor","maybeTrusted","allowed","isResourceUrlAllowedByPolicy","$SceProvider","$sceDelegate","sce","isEnabled","parseAs","enumValue","lName","$SnifferProvider","vendorPrefix","eventSupport","android","navigator","userAgent","boxee","vendorRegex","bodyStyle","transitions","animations","webkitTransition","webkitAnimation","pushState","hasEvent","divElm","$TemplateRequestProvider","$templateCache","handleRequestFn","tpl","ignoreRequestError","totalPendingRequests","getTrustedResourceUrl","transformer","httpOptions","$$TestabilityProvider","opt_exactMatch","getElementsByClassName","matches","dataBinding","bindingName","prefixes","$TimeoutProvider","deferreds","$$timeoutId","urlParsingNode","originUrl","requestUrl","$WindowProvider","$$CookieReader","lastCookies","lastCookieString","safeDecodeURIComponent","cookieArray","cookie","currentCookieString","$$CookieReaderProvider","$FilterProvider","suffix","currencyFilter","dateFilter","filterFilter","jsonFilter","limitToFilter","lowercaseFilter","numberFilter","orderByFilter","uppercaseFilter","comparator","predicateFn","matchAgainstAnyProp","getTypeForFilter","shouldMatchPrimitives","actual","expected","deepCompare","createPredicateFn","dontMatchWholeObject","actualType","expectedType","expectedVal","matchAnyProperty","$locale","formats","NUMBER_FORMATS","amount","currencySymbol","fractionSize","CURRENCY_SYM","PATTERNS","maxFrac","formatNumber","GROUP_SEP","DECIMAL_SEP","groupSep","decimalSep","parsedNumber","isInfinity","isFinite","isZero","numStr","formattedText","minFrac","digits","fractionLen","roundAt","digit","carry","reduceRight","roundNumber","numberOfIntegerDigits","zeros","exponent","MAX_DIGITS","integerLen","decimals","reduce","groups","lgSize","gSize","negPre","negSuf","posPre","posSuf","padNumber","neg","dateGetter","dateStrGetter","shortForm","getFirstThursdayOfYear","year","dayOfWeekOnFirst","getDay","weekGetter","datetime","firstThurs","getFullYear","getMonth","getDate","round","eraGetter","ERAS","DATE_FORMATS","yyyy","yy","MMMM","MMM","MM","M","dd","HH","H","hh","mm","ss","sss","EEEE","EEE","getHours","AMPMS","Z","zone","ww","w","G","GG","GGG","GGGG","ERANAMES","DATE_FORMATS_SPLIT","NUMBER_STRING","R_ISO8601_STR","format","DATETIME_FORMATS","tzHour","tzMin","dateSetter","setUTCFullYear","setFullYear","timeSetter","setUTCHours","setHours","ms","parseFloat","jsonStringToDate","spacing","limit","Infinity","sortPredicate","reverseOrder","predicates","map","predicate","descending","processPredicates","compareValues","predicateValues","objectValue","getPredicateValue","v1","v2","ngDirective","htmlAnchorDirective","xlinkHref","ngAttributeAliasDirectives","propName","normalized","defaultLinkFn","ngModel","htmlAttr","ngAttr","ngPattern","nullFormCtrl","$addControl","$$renameControl","control","$name","$removeControl","$setValidity","$setDirty","$setPristine","$setSubmitted","SUBMITTED_CLASS","FormController","form","controls","$error","$$success","$pending","ngForm","$dirty","$pristine","$valid","$invalid","$submitted","$$parentForm","$rollbackViewValue","$commitViewValue","newName","oldName","addSetValidityMethod","set","unset","PRISTINE_CLASS","DIRTY_CLASS","$setUntouched","formDirectiveFactory","isNgForm","formElement","VALID_CLASS","nameAttr","ctrls","handleFormSubmission","setter","getSetter","formDirective","ngFormDirective","ISO_DATE_REGEXP","URL_REGEXP","EMAIL_REGEXP","NUMBER_REGEXP","DATE_REGEXP","DATETIMELOCAL_REGEXP","WEEK_REGEXP","MONTH_REGEXP","TIME_REGEXP","PARTIAL_VALIDATION_TYPES","inputType","baseInputType","stringBasedInputType","createDateInputType","createDateParser","isoWeek","existingDate","week","hours","seconds","milliseconds","addDays","getSeconds","getMilliseconds","NaN","minVal","maxVal","badInputChecker","$$parserName","$parsers","$isEmpty","$formatters","ngModelMinErr","ngMin","$validators","$validate","ngMax","modelValue","viewValue","email","ev","checked","$setViewValue","$render","$viewValue","trueValue","parseConstantExpr","ngTrueValue","falseValue","ngFalseValue","composing","ngTrim","$$hasNativeValidators","deferListener","origValue","keyCode","validity","origBadInput","badInput","origTypeMismatch","typeMismatch","mapping","iso","part","parseDate","previousDate","$options","isValidDate","parseObservedDateValue","parsedDate","parseFn","inputDirective","CONSTANT_VALUE_REGEXP","ngValueDirective","tplAttr","ngValue","ngBindDirective","templateElement","ngBind","ngBindTemplateDirective","ngBindTemplate","ngBindHtmlDirective","tElement","ngBindHtmlGetter","ngBindHtml","ngBindHtmlWatch","getTrustedHtml","ngChangeDirective","$viewChangeListeners","ngChange","classDirective","addClasses","digestClassCounts","classCounts","classesToUpdate","ngClassWatchAction","$index","arrayClasses","arrayDifference","updateClasses","old$index","mod","removeClasses","ngClassDirective","ngClassOddDirective","ngClassEvenDirective","ngCloakDirective","ngControllerDirective","ngEventDirectives","forceAsyncEvents","ngIfDirective","block","previousElements","ngIf","ngIncludeDirective","srcExp","ngInclude","previousElement","changeCounter","cleanupLastIncludeContent","afterAnimation","thisChangeId","ngIncludeFillContentDirective","ngInitDirective","ngInit","ngListDirective","ngList","trimValues","UNTOUCHED_CLASS","TOUCHED_CLASS","PENDING_CLASS","NgModelController","$modelValue","$$rawModelValue","$asyncValidators","$untouched","$touched","parserValid","parsedNgModel","parsedNgModelAssign","ngModelGet","ngModelSet","pendingDebounce","$$setOptions","getterSetter","invokeModelGetter","invokeModelSetter","$$$p","currentValidationRunId","$setTouched","$$lastCommittedViewValue","prevValid","prevModelValue","allowInvalid","$$runValidators","allValid","$$writeModelToScope","doneCallback","validatorPromises","syncValidatorsValid","errorKey","localValidationRunId","setValidity","isValid","validationDone","validator","$$parseAndValidate","writeToModelIfNeeded","updateOnDefault","$$debounceViewValueCommit","debounce","debounceDelay","formatters","ngModelDirective","modelCtrl","formCtrl","updateOn","DEFAULT_REGEXP","ngModelOptionsDirective","that","ngModelOptions","classCache","cachedToggleClass","switchValue","toggleValidationCss","validationErrorKey","INVALID_CLASS","combinedState","createAndSet","isObjectEmpty","unsetAndCleanup","ngNonBindableDirective","ngOptionsMinErr","NG_OPTIONS_REGEXP","ngOptionsDirective","optionTemplate","optGroupTemplate","selectElement","registerOption","ngModelCtrl","emptyOption","selectCtrl","providedEmptyOption","unknownOption","ngOptions","optionsExp","valueName","keyName","selectAs","trackBy","viewValueFn","trackByFn","getTrackByValueFn","getTrackByValue","getLocals","displayFn","groupByFn","disableWhenFn","valuesFn","Option","selectValue","label","group","getOptionValuesKeys","optionValues","optionValuesKeys","itemKey","getWatchables","watchedArray","optionValuesLength","disableWhen","getOptions","optionItems","selectValueMap","optionItem","getOptionFromViewValue","getViewValueFromOption","parseOptionsExpression","removeEmptyOption","removeUnknownOption","writeValue","readValue","selectedValues","selections","selectedOption","updateOptions","updateOptionElement","addOrReuseElement","removeExcessElements","previousValue","groupMap","emptyOption_","unknownOption_","skipEmptyAndUnknownOptions","groupElement","optionElement","currentOptionElement","nextValue","ngPluralizeDirective","BRACE","IS_WHEN","lastCount","numberExp","whenExp","whens","whensExpFns","braceReplacement","watchRemover","updateElementText","newText","attributeName","tmpMatch","whenKey","countIsNaN","pluralCat","whenExpFn","ngRepeatDirective","NG_REMOVED","ngRepeatMinErr","updateScope","valueIdentifier","keyIdentifier","arrayLength","$first","$last","$middle","$odd","$even","getBlockStart","getBlockEnd","ngRepeat","ngRepeatEndComment","aliasAs","trackByExp","trackByExpGetter","trackByIdExpFn","trackByIdArrayFn","trackByIdObjFn","hashFnLocals","lastBlockMap","nextNode","collectionLength","trackById","trackByIdFn","collectionKeys","nextBlockOrder","previousNode","nextBlockMap","blockKey","NG_HIDE_CLASS","NG_HIDE_IN_PROGRESS_CLASS","ngShowDirective","ngShow","ngHideDirective","ngHide","ngStyleDirective","ngStyle","newStyles","oldStyles","ngSwitchDirective","cases","ngSwitchController","watchExpr","ngSwitch","selectedTranscludes","selectedElements","previousLeaveAnimations","selectedScopes","spliceFactory","selectedTransclude","caseElement","selectedScope","anchor","ngSwitchWhenDirective","ngSwitchWhen","ngSwitchDefaultDirective","ngTranscludeDirective","scriptDirective","noopNgModelController","SelectController","optionsMap","renderUnknownOption","unknownVal","hasOption","addOption","removeOption","optionScope","optionAttrs","interpolateValueFn","interpolateTextFn","selectDirective","lastView","lastViewRef","optionDirective","selectCtrlName","styleDirective","requiredDirective","required","patternDirective","patternExp","maxlengthDirective","maxlength","intVal","minlengthDirective","minlength","originalCleanData","jqName","elems","bindJQuery","ensure","configFn","invokeQueue","configBlocks","invokeLater","moduleInstance","invokeLaterAndSetModuleName","animation","insertMethod","recipeName","factoryFunction","setupModuleLoader","textarea","select","ngClass","ngClassEven","ngClassOdd","ngCloak","ngController","ngNonBindable","ngPluralize","ngSwitchDefault","ngTransclude","ngRequired","ngMinlength","ngMaxlength","$animateCss","$$animateJs","$$forceReflow","$interval","$httpParamSerializer","$httpParamSerializerJQLike","$$testability","$$jqLite","$$HashMap","publishExternalAPI","opt_precision","vf","getDecimals","f","getVF","appElement","getNgAttribute","angularInit","$$csp","head","arraybuffer","bytes","byteLength","ArrayBuffer","abv","Uint8Array","buffer","Backoff","factor","jitter","attempts","duration","rand","random","deviation","reset","setMin","setMax","setJitter","encode","base64","decode","encoded1","encoded2","encoded3","encoded4","bufferLength","BlobBuilder","WebKitBlobBuilder","MSBlobBuilder","MozBlobBuilder","blobSupported","Blob","blobSupportsArrayBufferView","blobBuilderSupported","getBlob","mapArrayBufferViews","ary","chunk","byteOffset","BlobBuilderConstructor","bb","BlobConstructor","Emitter","mixin","_callbacks","once","removeListener","removeAllListeners","cb","emit","hasListeners","load","storage","process","env","DEBUG","formatArgs","useColors","humanize","color","lastC","save","namespaces","removeItem","WebkitAppearance","firebug","table","$1","chrome","local","localStorage","localstorage","colors","enable","createDebug","prevTime","curr","prev","coerce","formatter","selectColor","instances","disable","skips","parser","transports","parseuri","parseqs","Socket","secure","query","agent","upgrade","forceJSONP","jsonp","forceBase64","enablesXDR","timestampParam","timestampRequests","transportOptions","writeBuffer","prevBufferLen","policyPort","rememberUpgrade","binaryType","onlyBinaryUpgrades","perMessageDeflate","threshold","pfx","passphrase","cert","ca","ciphers","rejectUnauthorized","forceNode","isReactNative","product","extraHeaders","localAddress","upgrades","pingInterval","pingTimeout","pingIntervalTimer","pingTimeoutTimer","priorWebsocketSuccess","Transport","createTransport","o","EIO","transport","sid","socket","requestTimeout","protocols","setTransport","onDrain","packet","onPacket","onError","onClose","probe","failed","onTransportOpen","upgradeLosesBinary","supportsBinary","upgrading","cleanup","flush","freezeTransport","close","onTransportClose","onclose","onupgrade","onOpen","onHandshake","setPing","filterUpgrades","onHeartbeat","ping","sendPacket","writable","write","compress","waitForUpgrade","cleanupAndClose","desc","filteredUpgrades","description","doOpen","doClose","packets","onData","decodePacket","XHR","JSONP","websocket","polling","xd","xs","isSSL","xdomain","xscheme","Polling","globalThis","JSONPPolling","rNewline","rEscapedNewline","___eio","iframe","doPoll","insertAt","doWrite","area","iframeId","initIframe","submit","attachEvent","onreadystatechange","Request","isBinary","unloadHandler","requests","req","sendXhr","pollXhr","setDisableHeaderCheck","hasXDR","onLoad","getResponseHeader","requestsCount","onSuccess","fromError","XDomainRequest","yeast","hasXHR2","poll","onPause","total","decodePayload","callbackfn","encodePayload","schema","b64","BrowserWebSocket","NodeWebSocket","WebSocket","MozWebSocket","WebSocketImpl","WS","usingBrowserWebSocket","check","ws","supports","binary","addEventListeners","onopen","onmessage","encodePacket","Buffer","hasCORS","base64encoder","hasBinary","sliceBuffer","utf8","isAndroid","isPhantomJS","dontSendBlobs","pong","packetslist","each","eachWithIndex","utf8encode","encodeBase64Packet","contentArray","resultBuffer","encodeArrayBuffer","fr","FileReader","readAsArrayBuffer","encodeBlobAsArrayBuffer","encodeBlob","encodeBase64Object","encoded","strict","b64data","readAsDataURL","typed","basic","btoa","utf8decode","decodeBase64Packet","tryDecode","encodePayloadAsBlob","encodePayloadAsArrayBuffer","setLengthHeader","decodePayloadAsBinary","chr","encodedPackets","totalLength","acc","resultArray","bufferIndex","ab","view","lenStr","binaryIdentifier","lengthAry","blob","bufferTail","buffers","tailArray","msgLength","arr","byteArray","byteCount","byteIndex","stringFromCharCode","ucs2decode","output","checkScalarValue","codePoint","createByte","encodeCodePoint","symbol","readContinuationByte","continuationByte","decodeSymbol","byte1","codePoints","byteString","ucs2encode","withNativeBlob","withNativeFile","File","isBuffer","toJSON","plural","ceil","long","fmtShort","toStr","isEmpty","getKey","intKey","hasShallowProperty","objectPath","getShallowProperty","doNotReplace","currentPath","currentValue","includeInheritedProps","ensureExists","insert","at","coalesce","paths","nextObj","del","withInheritedProps","qs","qry","pairs","pair","re","authority","ipv6uri","pathNames","queryKey","$0","$2","Manager","lookup","managers","io","sameNamespace","nsps","forceNew","multiplex","connect","eio","subs","reconnection","reconnectionAttempts","reconnectionDelay","reconnectionDelayMax","randomizationFactor","backoff","connecting","lastPing","encoding","packetBuffer","_parser","encoder","Encoder","decoder","Decoder","autoConnect","emitAll","nsp","updateSocketIds","generateId","engine","_reconnection","_reconnectionAttempts","_reconnectionDelay","_randomizationFactor","_reconnectionDelayMax","_timeout","maybeReconnectOnOpen","reconnecting","reconnect","skipReconnect","openSub","errorSub","onping","onpong","ondata","ondecoded","onConnecting","processPacketQueue","pack","subsLength","disconnect","onreconnect","attempt","toArray","hasBin","connect_error","connect_timeout","reconnect_attempt","reconnect_failed","reconnect_error","ids","acks","receiveBuffer","sendBuffer","connected","disconnected","flags","subEvents","BINARY_EVENT","EVENT","CONNECT","onpacket","rootNamespaceError","ERROR","onconnect","onevent","ACK","BINARY_ACK","onack","DISCONNECT","ondisconnect","ack","sent","emitBuffered","loc","isBuf","_deconstructPacket","placeholder","_placeholder","newData","_reconstructPacket","deconstructPacket","packetData","attachments","reconstructPacket","removeBlobs","pendingBlobs","bloblessData","_removeBlobs","curKey","containingObject","fileReader","ERROR_PACKET","encodeAsString","payload","tryStringify","reconstructor","BinaryReconstructor","reconPack","deconstruction","encodeAsBinary","tryParse","decodeString","takeBinaryData","finishedReconstruction","binData","withNativeBuffer","withNativeArrayBuffer","isView","store","g","localStorageName","defaultVal","clear","transact","transactionFn","getAll","deserialize","isLocalStorageNameSupported","setItem","getItem","addBehavior","storageOwner","storageContainer","ActiveXObject","frames","withIEStorage","storeFunction","forbiddenCharsRegex","ieKeyFix","XMLDocument","testKey","alphabet","seed","decoded","icon","iconName","pages","Pages","navi","toggle","switchid","title","tagline","utils","ucfirst","localRootUrl","orderObjectBy","browsers","socketId","pagesConfig","Clients","ui","menu","sectionMenu","setActiveSection","$section","reloadAll","heading","scrollAllTo","sendAllTo","toggleMenu","socketEvents","connection","displayUrl","urls","external","transformOptions","transform","evt","clientEvent","proportional","override","highlight","disconnectController","_disconnected","visible","visited","updateStack","updateHistory","getData","notifyController","DEFAULT_STATUS","DEFAULT_HEADING","show","_timer","socketConfig","___browserSync___","socketUrl","session","publicApi","removeEvent","uiEvent","newSession","defineProperty","Store","ns","bs","scheme","localUrl","field","filtered","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","$locationProvider"],"mappings":";qBA2BA,SAASA,KA3BTC,EAAOC,QAEP,SAAeC,EAAOC,EAAUC,GAC5B,IAAIC,GAAO,EAIX,OAHAD,EAASA,GAAUL,EACnBO,EAAMJ,MAAQA,EAEI,IAAVA,EAAeC,IAAaG,EAEpC,SAASA,EAAMC,EAAKC,GAChB,GAAIF,EAAMJ,OAAS,EACf,MAAM,IAAIO,MAAM,iCAElBH,EAAMJ,MAGJK,GACAF,GAAO,EACPF,EAASI,GAETJ,EAAWC,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kBAAmBP,GACnBse,SAAUxZ,GACVyB,cAAexB,GACf5wB,YAAamjC,GACb9W,UAAWoX,GACXxP,kBAAmByP,GACnBkT,QAASmW,GACTqlB,cAAevuC,GACftP,aAAcwX,GACdsmC,UAAW/kC,GACXnG,MAAOpB,GACPusC,qBAAsB3tC,GACtB4tC,2BAA4B3tC,GAC5BmC,aAAcmD,GACdE,YAAaJ,GACbhwC,UAAW23C,GACXvjB,KAAMglB,GACNptC,OAAQw4C,GACRzkD,WAAYupD,GACZppD,GAAI0mD,GACJrT,IAAKuT,GACLzmD,KAAMovD,GACNC,aAAclB,GACdr8B,SAAU69B,GACViB,eAAgB94B,GAChB/3B,iBAAkB4wD,GAClBwnB,cAAe/mB,GACf7iD,SAAUojD,GACV9kC,QAASolC,GACTxgC,MAAO82B,GACP6vB,SAAUlzD,GACVmzD,UAAW1uD,GACXgjB,eAAgB8lB,QAog1BxB6lB,CAAmBx7E,GAEnBA,EAAQX,OAAO,WAAY,GAAI,CAAC,WAAY,SAASgS,GAoBrDA,EAASzL,MAAM,UAAW,CACxB,iBAAoB,CAClB,MAAS,CACP,KACA,MAEF,IAAO,CACL,SACA,SACA,UACA,YACA,WACA,SACA,YAEF,SAAY,CACV,gBACA,eAEF,KAAQ,CACN,KACA,MAEF,eAAkB,EAClB,MAAS,CACP,UACA,WACA,QACA,QACA,MACA,OACA,OACA,SACA,YACA,UACA,WACA,YAEF,SAAY,CACV,MACA,MACA,MACA,MACA,MACA,MACA,OAEF,WAAc,CACZ,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OAEF,gBAAmB,CACjB,UACA,WACA,QACA,QACA,MACA,OACA,OACA,SACA,YACA,UACA,WACA,YAEF,aAAgB,CACd,EACA,GAEF,SAAY,kBACZ,SAAY,YACZ,OAAU,qBACV,WAAc,WACd,WAAc,YACd,MAAS,gBACT,UAAa,SACb,UAAa,UAEf,eAAkB,CAChB,aAAgB,IAChB,YAAe,IACf,UAAa,IACb,SA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AAfjS,WAAyB,OAAOA,WAC3C,IACC,OAAO7lF,MAAQ,IAAImZ,SAAS,cAAb,GACd,MAAO3K,GACR,GAAsB,iBAAXvQ,OAAqB,OAAOA,QALjB,GCAxB,EAAQ,MACR,EAAQ,MACR,EAAQ,MACR,EAAQ,MAEMA,OAAOC,QAGhBX,OAAO,cAAe,CACnB,YACA,YACA,eACA,WACA,WACA,UACA,UACA,UACA,eAEH+R,OAAO,CAAC,oBAMb,SAAgBwuF,GACZA,EAAkBnlD,UAAU,CACxBtoB,SAAS,EACTuoB,aAAa,OAUR,EAAQ,MACR,EAAQ,MACP,EAAQ,MACR,EAAQ,MACT,EAAQ,MACX,EAAQ,MACJ,EAAQ,MACV,EAAQ,MACL,EAAQ,MACV,EAAQ,MACJ,EAAQ,O","file":"js/app.js","sourcesContent":["module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n","/**\n * @license AngularJS v1.4.14\n * (c) 2010-2015 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/**\n * @ngdoc module\n * @name ngRoute\n * @description\n *\n * # ngRoute\n *\n * The `ngRoute` module provides routing and deeplinking services and directives for angular apps.\n *\n * ## Example\n * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.\n *\n *\n * <div doc-module-components=\"ngRoute\"></div>\n */\n /* global -ngRouteModule */\nvar ngRouteModule = angular.module('ngRoute', ['ng']).\n provider('$route', $RouteProvider),\n $routeMinErr = angular.$$minErr('ngRoute');\n\n/**\n * @ngdoc provider\n * @name $routeProvider\n *\n * @description\n *\n * Used for configuring routes.\n *\n * ## Example\n * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.\n *\n * ## Dependencies\n * Requires the {@link ngRoute `ngRoute`} module to be installed.\n */\nfunction $RouteProvider() {\n function inherit(parent, extra) {\n return angular.extend(Object.create(parent), extra);\n }\n\n var routes = {};\n\n /**\n * @ngdoc method\n * @name $routeProvider#when\n *\n * @param {string} path Route path (matched against `$location.path`). If `$location.path`\n * contains redundant trailing slash or is missing one, the route will still match and the\n * `$location.path` will be updated to add or drop the trailing slash to exactly match the\n * route definition.\n *\n * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up\n * to the next slash are matched and stored in `$routeParams` under the given `name`\n * when the route matches.\n * * `path` can contain named groups starting with a colon and ending with a star:\n * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`\n * when the route matches.\n * * `path` can contain optional named groups with a question mark: e.g.`:name?`.\n *\n * For example, routes like `/color/:color/largecode/:largecode*\\/edit` will match\n * `/color/brown/largecode/code/with/slashes/edit` and extract:\n *\n * * `color: brown`\n * * `largecode: code/with/slashes`.\n *\n *\n * @param {Object} route Mapping information to be assigned to `$route.current` on route\n * match.\n *\n * Object properties:\n *\n * - `controller` `{(string|function()=}` Controller fn that should be associated with\n * newly created scope or the name of a {@link angular.Module#controller registered\n * controller} if passed as a string.\n * - `controllerAs` `{string=}` An identifier name for a reference to the controller.\n * If present, the controller will be published to scope under the `controllerAs` name.\n * - `template` `{string=|function()=}` html template as a string or a function that\n * returns an html template as a string which should be used by {@link\n * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.\n * This property takes precedence over `templateUrl`.\n *\n * If `template` is a function, it will be called with the following parameters:\n *\n * - `{Array.<Object>}` - route parameters extracted from the current\n * `$location.path()` by applying the current route\n *\n * - `templateUrl` `{string=|function()=}` path or function that returns a path to an html\n * template that should be used by {@link ngRoute.directive:ngView ngView}.\n *\n * If `templateUrl` is a function, it will be called with the following parameters:\n *\n * - `{Array.<Object>}` - route parameters extracted from the current\n * `$location.path()` by applying the current route\n *\n * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should\n * be injected into the controller. If any of these dependencies are promises, the router\n * will wait for them all to be resolved or one to be rejected before the controller is\n * instantiated.\n * If all the promises are resolved successfully, the values of the resolved promises are\n * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is\n * fired. If any of the promises are rejected the\n * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object\n * is:\n *\n * - `key` `{string}`: a name of a dependency to be injected into the controller.\n * - `factory` - `{string|function}`: If `string` then it is an alias for a service.\n * Otherwise if function, then it is {@link auto.$injector#invoke injected}\n * and the return value is treated as the dependency. If the result is a promise, it is\n * resolved before its value is injected into the controller. Be aware that\n * `ngRoute.$routeParams` will still refer to the previous route within these resolve\n * functions. Use `$route.current.params` to access the new route parameters, instead.\n *\n * - `redirectTo` {(string|function())=} value to update\n * {@link ng.$location $location} path with and trigger route redirection.\n *\n * If `redirectTo` is a function, it will be called with the following parameters:\n *\n * - `{Object.<string>}` - route parameters extracted from the current\n * `$location.path()` by applying the current route templateUrl.\n * - `{string}` - current `$location.path()`\n * - `{Object}` - current `$location.search()`\n *\n * The custom `redirectTo` function is expected to return a string which will be used\n * to update `$location.path()` and `$location.search()`.\n *\n * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`\n * or `$location.hash()` changes.\n *\n * If the option is set to `false` and url in the browser changes, then\n * `$routeUpdate` event is broadcasted on the root scope.\n *\n * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive\n *\n * If the option is set to `true`, then the particular route can be matched without being\n * case sensitive\n *\n * @returns {Object} self\n *\n * @description\n * Adds a new route definition to the `$route` service.\n */\n this.when = function(path, route) {\n //copy original route object to preserve params inherited from proto chain\n var routeCopy = angular.copy(route);\n if (angular.isUndefined(routeCopy.reloadOnSearch)) {\n routeCopy.reloadOnSearch = true;\n }\n if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) {\n routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch;\n }\n routes[path] = angular.extend(\n routeCopy,\n path && pathRegExp(path, routeCopy)\n );\n\n // create redirection for trailing slashes\n if (path) {\n var redirectPath = (path[path.length - 1] == '/')\n ? path.substr(0, path.length - 1)\n : path + '/';\n\n routes[redirectPath] = angular.extend(\n {redirectTo: path},\n pathRegExp(redirectPath, routeCopy)\n );\n }\n\n return this;\n };\n\n /**\n * @ngdoc property\n * @name $routeProvider#caseInsensitiveMatch\n * @description\n *\n * A boolean property indicating if routes defined\n * using this provider should be matched using a case insensitive\n * algorithm. Defaults to `false`.\n */\n this.caseInsensitiveMatch = false;\n\n /**\n * @param path {string} path\n * @param opts {Object} options\n * @return {?Object}\n *\n * @description\n * Normalizes the given path, returning a regular expression\n * and the original path.\n *\n * Inspired by pathRexp in visionmedia/express/lib/utils.js.\n */\n function pathRegExp(path, opts) {\n var insensitive = opts.caseInsensitiveMatch,\n ret = {\n originalPath: path,\n regexp: path\n },\n keys = ret.keys = [];\n\n path = path\n .replace(/([().])/g, '\\\\$1')\n .replace(/(\\/)?:(\\w+)(\\*\\?|[\\?\\*])?/g, function(_, slash, key, option) {\n var optional = (option === '?' || option === '*?') ? '?' : null;\n var star = (option === '*' || option === '*?') ? '*' : null;\n keys.push({ name: key, optional: !!optional });\n slash = slash || '';\n return ''\n + (optional ? '' : slash)\n + '(?:'\n + (optional ? slash : '')\n + (star && '(.+?)' || '([^/]+)')\n + (optional || '')\n + ')'\n + (optional || '');\n })\n .replace(/([\\/$\\*])/g, '\\\\$1');\n\n ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');\n return ret;\n }\n\n /**\n * @ngdoc method\n * @name $routeProvider#otherwise\n *\n * @description\n * Sets route definition that will be used on route change when no other route definition\n * is matched.\n *\n * @param {Object|string} params Mapping information to be assigned to `$route.current`.\n * If called with a string, the value maps to `redirectTo`.\n * @returns {Object} self\n */\n this.otherwise = function(params) {\n if (typeof params === 'string') {\n params = {redirectTo: params};\n }\n this.when(null, params);\n return this;\n };\n\n\n this.$get = ['$rootScope',\n '$location',\n '$routeParams',\n '$q',\n '$injector',\n '$templateRequest',\n '$sce',\n function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) {\n\n /**\n * @ngdoc service\n * @name $route\n * @requires $location\n * @requires $routeParams\n *\n * @property {Object} current Reference to the current route definition.\n * The route definition contains:\n *\n * - `controller`: The controller constructor as define in route definition.\n * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for\n * controller instantiation. The `locals` contain\n * the resolved values of the `resolve` map. Additionally the `locals` also contain:\n *\n * - `$scope` - The current route scope.\n * - `$template` - The current route template HTML.\n *\n * @property {Object} routes Object with all route configuration Objects as its properties.\n *\n * @description\n * `$route` is used for deep-linking URLs to controllers and views (HTML partials).\n * It watches `$location.url()` and tries to map the path to an existing route definition.\n *\n * Requires the {@link ngRoute `ngRoute`} module to be installed.\n *\n * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.\n *\n * The `$route` service is typically used in conjunction with the\n * {@link ngRoute.directive:ngView `ngView`} directive and the\n * {@link ngRoute.$routeParams `$routeParams`} service.\n *\n * @example\n * This example shows how changing the URL hash causes the `$route` to match a route against the\n * URL, and the `ngView` pulls in the partial.\n *\n * <example name=\"$route-service\" module=\"ngRouteExample\"\n * deps=\"angular-route.js\" fixBase=\"true\">\n * <file name=\"index.html\">\n * <div ng-controller=\"MainController\">\n * Choose:\n * <a href=\"Book/Moby\">Moby</a> |\n * <a href=\"Book/Moby/ch/1\">Moby: Ch1</a> |\n * <a href=\"Book/Gatsby\">Gatsby</a> |\n * <a href=\"Book/Gatsby/ch/4?key=value\">Gatsby: Ch4</a> |\n * <a href=\"Book/Scarlet\">Scarlet Letter</a><br/>\n *\n * <div ng-view></div>\n *\n * <hr />\n *\n * <pre>$location.path() = {{$location.path()}}</pre>\n * <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>\n * <pre>$route.current.params = {{$route.current.params}}</pre>\n * <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>\n * <pre>$routeParams = {{$routeParams}}</pre>\n * </div>\n * </file>\n *\n * <file name=\"book.html\">\n * controller: {{name}}<br />\n * Book Id: {{params.bookId}}<br />\n * </file>\n *\n * <file name=\"chapter.html\">\n * controller: {{name}}<br />\n * Book Id: {{params.bookId}}<br />\n * Chapter Id: {{params.chapterId}}\n * </file>\n *\n * <file name=\"script.js\">\n * angular.module('ngRouteExample', ['ngRoute'])\n *\n * .controller('MainController', function($scope, $route, $routeParams, $location) {\n * $scope.$route = $route;\n * $scope.$location = $location;\n * $scope.$routeParams = $routeParams;\n * })\n *\n * .controller('BookController', function($scope, $routeParams) {\n * $scope.name = \"BookController\";\n * $scope.params = $routeParams;\n * })\n *\n * .controller('ChapterController', function($scope, $routeParams) {\n * $scope.name = \"ChapterController\";\n * $scope.params = $routeParams;\n * })\n *\n * .config(function($routeProvider, $locationProvider) {\n * $routeProvider\n * .when('/Book/:bookId', {\n * templateUrl: 'book.html',\n * controller: 'BookController',\n * resolve: {\n * // I will cause a 1 second delay\n * delay: function($q, $timeout) {\n * var delay = $q.defer();\n * $timeout(delay.resolve, 1000);\n * return delay.promise;\n * }\n * }\n * })\n * .when('/Book/:bookId/ch/:chapterId', {\n * templateUrl: 'chapter.html',\n * controller: 'ChapterController'\n * });\n *\n * // configure html5 to get links working on jsfiddle\n * $locationProvider.html5Mode(true);\n * });\n *\n * </file>\n *\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should load and compile correct template', function() {\n * element(by.linkText('Moby: Ch1')).click();\n * var content = element(by.css('[ng-view]')).getText();\n * expect(content).toMatch(/controller\\: ChapterController/);\n * expect(content).toMatch(/Book Id\\: Moby/);\n * expect(content).toMatch(/Chapter Id\\: 1/);\n *\n * element(by.partialLinkText('Scarlet')).click();\n *\n * content = element(by.css('[ng-view]')).getText();\n * expect(content).toMatch(/controller\\: BookController/);\n * expect(content).toMatch(/Book Id\\: Scarlet/);\n * });\n * </file>\n * </example>\n */\n\n /**\n * @ngdoc event\n * @name $route#$routeChangeStart\n * @eventType broadcast on root scope\n * @description\n * Broadcasted before a route change. At this point the route services starts\n * resolving all of the dependencies needed for the route change to occur.\n * Typically this involves fetching the view template as well as any dependencies\n * defined in `resolve` route property. Once all of the dependencies are resolved\n * `$routeChangeSuccess` is fired.\n *\n * The route change (and the `$location` change that triggered it) can be prevented\n * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on}\n * for more details about event object.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {Route} next Future route information.\n * @param {Route} current Current route information.\n */\n\n /**\n * @ngdoc event\n * @name $route#$routeChangeSuccess\n * @eventType broadcast on root scope\n * @description\n * Broadcasted after a route change has happened successfully.\n * The `resolve` dependencies are now available in the `current.locals` property.\n *\n * {@link ngRoute.directive:ngView ngView} listens for the directive\n * to instantiate the controller and render the view.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {Route} current Current route information.\n * @param {Route|Undefined} previous Previous route information, or undefined if current is\n * first route entered.\n */\n\n /**\n * @ngdoc event\n * @name $route#$routeChangeError\n * @eventType broadcast on root scope\n * @description\n * Broadcasted if any of the resolve promises are rejected.\n *\n * @param {Object} angularEvent Synthetic event object\n * @param {Route} current Current route information.\n * @param {Route} previous Previous route information.\n * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.\n */\n\n /**\n * @ngdoc event\n * @name $route#$routeUpdate\n * @eventType broadcast on root scope\n * @description\n * The `reloadOnSearch` property has been set to false, and we are reusing the same\n * instance of the Controller.\n *\n * @param {Object} angularEvent Synthetic event object\n * @param {Route} current Current/previous route information.\n */\n\n var forceReload = false,\n preparedRoute,\n preparedRouteIsUpdateOnly,\n $route = {\n routes: routes,\n\n /**\n * @ngdoc method\n * @name $route#reload\n *\n * @description\n * Causes `$route` service to reload the current route even if\n * {@link ng.$location $location} hasn't changed.\n *\n * As a result of that, {@link ngRoute.directive:ngView ngView}\n * creates new scope and reinstantiates the controller.\n */\n reload: function() {\n forceReload = true;\n\n var fakeLocationEvent = {\n defaultPrevented: false,\n preventDefault: function fakePreventDefault() {\n this.defaultPrevented = true;\n forceReload = false;\n }\n };\n\n $rootScope.$evalAsync(function() {\n prepareRoute(fakeLocationEvent);\n if (!fakeLocationEvent.defaultPrevented) commitRoute();\n });\n },\n\n /**\n * @ngdoc method\n * @name $route#updateParams\n *\n * @description\n * Causes `$route` service to update the current URL, replacing\n * current route parameters with those specified in `newParams`.\n * Provided property names that match the route's path segment\n * definitions will be interpolated into the location's path, while\n * remaining properties will be treated as query params.\n *\n * @param {!Object<string, string>} newParams mapping of URL parameter names to values\n */\n updateParams: function(newParams) {\n if (this.current && this.current.$$route) {\n newParams = angular.extend({}, this.current.params, newParams);\n $location.path(interpolate(this.current.$$route.originalPath, newParams));\n // interpolate modifies newParams, only query params are left\n $location.search(newParams);\n } else {\n throw $routeMinErr('norout', 'Tried updating route when with no current route');\n }\n }\n };\n\n $rootScope.$on('$locationChangeStart', prepareRoute);\n $rootScope.$on('$locationChangeSuccess', commitRoute);\n\n return $route;\n\n /////////////////////////////////////////////////////\n\n /**\n * @param on {string} current url\n * @param route {Object} route regexp to match the url against\n * @return {?Object}\n *\n * @description\n * Check if the route matches the current url.\n *\n * Inspired by match in\n * visionmedia/express/lib/router/router.js.\n */\n function switchRouteMatcher(on, route) {\n var keys = route.keys,\n params = {};\n\n if (!route.regexp) return null;\n\n var m = route.regexp.exec(on);\n if (!m) return null;\n\n for (var i = 1, len = m.length; i < len; ++i) {\n var key = keys[i - 1];\n\n var val = m[i];\n\n if (key && val) {\n params[key.name] = val;\n }\n }\n return params;\n }\n\n function prepareRoute($locationEvent) {\n var lastRoute = $route.current;\n\n preparedRoute = parseRoute();\n preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route\n && angular.equals(preparedRoute.pathParams, lastRoute.pathParams)\n && !preparedRoute.reloadOnSearch && !forceReload;\n\n if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {\n if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {\n if ($locationEvent) {\n $locationEvent.preventDefault();\n }\n }\n }\n }\n\n function commitRoute() {\n var lastRoute = $route.current;\n var nextRoute = preparedRoute;\n\n if (preparedRouteIsUpdateOnly) {\n lastRoute.params = nextRoute.params;\n angular.copy(lastRoute.params, $routeParams);\n $rootScope.$broadcast('$routeUpdate', lastRoute);\n } else if (nextRoute || lastRoute) {\n forceReload = false;\n $route.current = nextRoute;\n if (nextRoute) {\n if (nextRoute.redirectTo) {\n if (angular.isString(nextRoute.redirectTo)) {\n $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)\n .replace();\n } else {\n $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))\n .replace();\n }\n }\n }\n\n $q.when(nextRoute).\n then(function() {\n if (nextRoute) {\n var locals = angular.extend({}, nextRoute.resolve),\n template, templateUrl;\n\n angular.forEach(locals, function(value, key) {\n locals[key] = angular.isString(value) ?\n $injector.get(value) : $injector.invoke(value, null, null, key);\n });\n\n if (angular.isDefined(template = nextRoute.template)) {\n if (angular.isFunction(template)) {\n template = template(nextRoute.params);\n }\n } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) {\n if (angular.isFunction(templateUrl)) {\n templateUrl = templateUrl(nextRoute.params);\n }\n if (angular.isDefined(templateUrl)) {\n nextRoute.loadedTemplateUrl = $sce.valueOf(templateUrl);\n template = $templateRequest(templateUrl);\n }\n }\n if (angular.isDefined(template)) {\n locals['$template'] = template;\n }\n return $q.all(locals);\n }\n }).\n then(function(locals) {\n // after route change\n if (nextRoute == $route.current) {\n if (nextRoute) {\n nextRoute.locals = locals;\n angular.copy(nextRoute.params, $routeParams);\n }\n $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);\n }\n }, function(error) {\n if (nextRoute == $route.current) {\n $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);\n }\n });\n }\n }\n\n\n /**\n * @returns {Object} the current active route, by matching it against the URL\n */\n function parseRoute() {\n // Match a route\n var params, match;\n angular.forEach(routes, function(route, path) {\n if (!match && (params = switchRouteMatcher($location.path(), route))) {\n match = inherit(route, {\n params: angular.extend({}, $location.search(), params),\n pathParams: params});\n match.$$route = route;\n }\n });\n // No route matched; fallback to \"otherwise\" route\n return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});\n }\n\n /**\n * @returns {string} interpolation of the redirect path with the parameters\n */\n function interpolate(string, params) {\n var result = [];\n angular.forEach((string || '').split(':'), function(segment, i) {\n if (i === 0) {\n result.push(segment);\n } else {\n var segmentMatch = segment.match(/(\\w+)(?:[?*])?(.*)/);\n var key = segmentMatch[1];\n result.push(params[key]);\n result.push(segmentMatch[2] || '');\n delete params[key];\n }\n });\n return result.join('');\n }\n }];\n}\n\nngRouteModule.provider('$routeParams', $RouteParamsProvider);\n\n\n/**\n * @ngdoc service\n * @name $routeParams\n * @requires $route\n *\n * @description\n * The `$routeParams` service allows you to retrieve the current set of route parameters.\n *\n * Requires the {@link ngRoute `ngRoute`} module to be installed.\n *\n * The route parameters are a combination of {@link ng.$location `$location`}'s\n * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.\n * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.\n *\n * In case of parameter name collision, `path` params take precedence over `search` params.\n *\n * The service guarantees that the identity of the `$routeParams` object will remain unchanged\n * (but its properties will likely change) even when a route change occurs.\n *\n * Note that the `$routeParams` are only updated *after* a route change completes successfully.\n * This means that you cannot rely on `$routeParams` being correct in route resolve functions.\n * Instead you can use `$route.current.params` to access the new route's parameters.\n *\n * @example\n * ```js\n * // Given:\n * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby\n * // Route: /Chapter/:chapterId/Section/:sectionId\n * //\n * // Then\n * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}\n * ```\n */\nfunction $RouteParamsProvider() {\n this.$get = function() { return {}; };\n}\n\nngRouteModule.directive('ngView', ngViewFactory);\nngRouteModule.directive('ngView', ngViewFillContentFactory);\n\n\n/**\n * @ngdoc directive\n * @name ngView\n * @restrict ECA\n *\n * @description\n * # Overview\n * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by\n * including the rendered template of the current route into the main layout (`index.html`) file.\n * Every time the current route changes, the included view changes with it according to the\n * configuration of the `$route` service.\n *\n * Requires the {@link ngRoute `ngRoute`} module to be installed.\n *\n * @animations\n * enter - animation is used to bring new content into the browser.\n * leave - animation is used to animate existing content away.\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n * @param {string=} onload Expression to evaluate whenever the view updates.\n *\n * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll\n * $anchorScroll} to scroll the viewport after the view is updated.\n *\n * - If the attribute is not set, disable scrolling.\n * - If the attribute is set without value, enable scrolling.\n * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated\n * as an expression yields a truthy value.\n * @example\n <example name=\"ngView-directive\" module=\"ngViewExample\"\n deps=\"angular-route.js;angular-animate.js\"\n animations=\"true\" fixBase=\"true\">\n <file name=\"index.html\">\n <div ng-controller=\"MainCtrl as main\">\n Choose:\n <a href=\"Book/Moby\">Moby</a> |\n <a href=\"Book/Moby/ch/1\">Moby: Ch1</a> |\n <a href=\"Book/Gatsby\">Gatsby</a> |\n <a href=\"Book/Gatsby/ch/4?key=value\">Gatsby: Ch4</a> |\n <a href=\"Book/Scarlet\">Scarlet Letter</a><br/>\n\n <div class=\"view-animate-container\">\n <div ng-view class=\"view-animate\"></div>\n </div>\n <hr />\n\n <pre>$location.path() = {{main.$location.path()}}</pre>\n <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>\n <pre>$route.current.params = {{main.$route.current.params}}</pre>\n <pre>$routeParams = {{main.$routeParams}}</pre>\n </div>\n </file>\n\n <file name=\"book.html\">\n <div>\n controller: {{book.name}}<br />\n Book Id: {{book.params.bookId}}<br />\n </div>\n </file>\n\n <file name=\"chapter.html\">\n <div>\n controller: {{chapter.name}}<br />\n Book Id: {{chapter.params.bookId}}<br />\n Chapter Id: {{chapter.params.chapterId}}\n </div>\n </file>\n\n <file name=\"animations.css\">\n .view-animate-container {\n position:relative;\n height:100px!important;\n background:white;\n border:1px solid black;\n height:40px;\n overflow:hidden;\n }\n\n .view-animate {\n padding:10px;\n }\n\n .view-animate.ng-enter, .view-animate.ng-leave {\n transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;\n\n display:block;\n width:100%;\n border-left:1px solid black;\n\n position:absolute;\n top:0;\n left:0;\n right:0;\n bottom:0;\n padding:10px;\n }\n\n .view-animate.ng-enter {\n left:100%;\n }\n .view-animate.ng-enter.ng-enter-active {\n left:0;\n }\n .view-animate.ng-leave.ng-leave-active {\n left:-100%;\n }\n </file>\n\n <file name=\"script.js\">\n angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])\n .config(['$routeProvider', '$locationProvider',\n function($routeProvider, $locationProvider) {\n $routeProvider\n .when('/Book/:bookId', {\n templateUrl: 'book.html',\n controller: 'BookCtrl',\n controllerAs: 'book'\n })\n .when('/Book/:bookId/ch/:chapterId', {\n templateUrl: 'chapter.html',\n controller: 'ChapterCtrl',\n controllerAs: 'chapter'\n });\n\n $locationProvider.html5Mode(true);\n }])\n .controller('MainCtrl', ['$route', '$routeParams', '$location',\n function($route, $routeParams, $location) {\n this.$route = $route;\n this.$location = $location;\n this.$routeParams = $routeParams;\n }])\n .controller('BookCtrl', ['$routeParams', function($routeParams) {\n this.name = \"BookCtrl\";\n this.params = $routeParams;\n }])\n .controller('ChapterCtrl', ['$routeParams', function($routeParams) {\n this.name = \"ChapterCtrl\";\n this.params = $routeParams;\n }]);\n\n </file>\n\n <file name=\"protractor.js\" type=\"protractor\">\n it('should load and compile correct template', function() {\n element(by.linkText('Moby: Ch1')).click();\n var content = element(by.css('[ng-view]')).getText();\n expect(content).toMatch(/controller\\: ChapterCtrl/);\n expect(content).toMatch(/Book Id\\: Moby/);\n expect(content).toMatch(/Chapter Id\\: 1/);\n\n element(by.partialLinkText('Scarlet')).click();\n\n content = element(by.css('[ng-view]')).getText();\n expect(content).toMatch(/controller\\: BookCtrl/);\n expect(content).toMatch(/Book Id\\: Scarlet/);\n });\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngView#$viewContentLoaded\n * @eventType emit on the current ngView scope\n * @description\n * Emitted every time the ngView content is reloaded.\n */\nngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];\nfunction ngViewFactory($route, $anchorScroll, $animate) {\n return {\n restrict: 'ECA',\n terminal: true,\n priority: 400,\n transclude: 'element',\n link: function(scope, $element, attr, ctrl, $transclude) {\n var currentScope,\n currentElement,\n previousLeaveAnimation,\n autoScrollExp = attr.autoscroll,\n onloadExp = attr.onload || '';\n\n scope.$on('$routeChangeSuccess', update);\n update();\n\n function cleanupLastView() {\n if (previousLeaveAnimation) {\n $animate.cancel(previousLeaveAnimation);\n previousLeaveAnimation = null;\n }\n\n if (currentScope) {\n currentScope.$destroy();\n currentScope = null;\n }\n if (currentElement) {\n previousLeaveAnimation = $animate.leave(currentElement);\n previousLeaveAnimation.then(function() {\n previousLeaveAnimation = null;\n });\n currentElement = null;\n }\n }\n\n function update() {\n var locals = $route.current && $route.current.locals,\n template = locals && locals.$template;\n\n if (angular.isDefined(template)) {\n var newScope = scope.$new();\n var current = $route.current;\n\n // Note: This will also link all children of ng-view that were contained in the original\n // html. If that content contains controllers, ... they could pollute/change the scope.\n // However, using ng-view on an element with additional content does not make sense...\n // Note: We can't remove them in the cloneAttchFn of $transclude as that\n // function is called before linking the content, which would apply child\n // directives to non existing elements.\n var clone = $transclude(newScope, function(clone) {\n $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {\n if (angular.isDefined(autoScrollExp)\n && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n $anchorScroll();\n }\n });\n cleanupLastView();\n });\n\n currentElement = clone;\n currentScope = current.scope = newScope;\n currentScope.$emit('$viewContentLoaded');\n currentScope.$eval(onloadExp);\n } else {\n cleanupLastView();\n }\n }\n }\n };\n}\n\n// This directive is called during the $transclude call of the first `ngView` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngView\n// is called.\nngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];\nfunction ngViewFillContentFactory($compile, $controller, $route) {\n return {\n restrict: 'ECA',\n priority: -400,\n link: function(scope, $element) {\n var current = $route.current,\n locals = current.locals;\n\n $element.html(locals.$template);\n\n var link = $compile($element.contents());\n\n if (current.controller) {\n locals.$scope = scope;\n var controller = $controller(current.controller, locals);\n if (current.controllerAs) {\n scope[current.controllerAs] = controller;\n }\n $element.data('$ngControllerController', controller);\n $element.children().data('$ngControllerController', controller);\n }\n\n link(scope);\n }\n };\n}\n\n\n})(window, window.angular);\n","require('./angular-route');\nmodule.exports = 'ngRoute';\n","/**\n * @license AngularJS v1.4.14\n * (c) 2010-2015 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n * Any commits to this file should be reviewed with security in mind. *\n * Changes to this file can potentially create security vulnerabilities. *\n * An approval from 2 Core members with history of modifying *\n * this file is required. *\n * *\n * Does the change somehow allow for arbitrary javascript to be executed? *\n * Or allows for someone to change the prototype of built-in objects? *\n * Or gives undesired access to variables likes document or window? *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sanitizeMinErr = angular.$$minErr('$sanitize');\n\n/**\n * @ngdoc module\n * @name ngSanitize\n * @description\n *\n * # ngSanitize\n *\n * The `ngSanitize` module provides functionality to sanitize HTML.\n *\n *\n * <div doc-module-components=\"ngSanitize\"></div>\n *\n * See {@link ngSanitize.$sanitize `$sanitize`} for usage.\n */\n\n/*\n * HTML Parser By Misko Hevery (misko@hevery.com)\n * based on: HTML Parser By John Resig (ejohn.org)\n * Original code by Erik Arvidsson, Mozilla Public License\n * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js\n *\n * // Use like so:\n * htmlParser(htmlString, {\n * start: function(tag, attrs, unary) {},\n * end: function(tag) {},\n * chars: function(text) {},\n * comment: function(text) {}\n * });\n *\n */\n\n\n/**\n * @ngdoc service\n * @name $sanitize\n * @kind function\n *\n * @description\n * The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are\n * then serialized back to properly escaped html string. This means that no unsafe input can make\n * it into the returned string, however, since our parser is more strict than a typical browser\n * parser, it's possible that some obscure input, which would be recognized as valid HTML by a\n * browser, won't make it through the sanitizer. The input may also contain SVG markup.\n * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and\n * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.\n *\n * @param {string} html HTML input.\n * @returns {string} Sanitized HTML.\n *\n * @example\n <example module=\"sanitizeExample\" deps=\"angular-sanitize.js\">\n <file name=\"index.html\">\n <script>\n angular.module('sanitizeExample', ['ngSanitize'])\n .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {\n $scope.snippet =\n '<p style=\"color:blue\">an html\\n' +\n '<em onmouseover=\"this.textContent=\\'PWN3D!\\'\">click here</em>\\n' +\n 'snippet</p>';\n $scope.deliberatelyTrustDangerousSnippet = function() {\n return $sce.trustAsHtml($scope.snippet);\n };\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n <table>\n <tr>\n <td>Directive</td>\n <td>How</td>\n <td>Source</td>\n <td>Rendered</td>\n </tr>\n <tr id=\"bind-html-with-sanitize\">\n <td>ng-bind-html</td>\n <td>Automatically uses $sanitize</td>\n <td><pre>&lt;div ng-bind-html=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n <td><div ng-bind-html=\"snippet\"></div></td>\n </tr>\n <tr id=\"bind-html-with-trust\">\n <td>ng-bind-html</td>\n <td>Bypass $sanitize by explicitly trusting the dangerous value</td>\n <td>\n <pre>&lt;div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"&gt;\n&lt;/div&gt;</pre>\n </td>\n <td><div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"></div></td>\n </tr>\n <tr id=\"bind-default\">\n <td>ng-bind</td>\n <td>Automatically escapes</td>\n <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n <td><div ng-bind=\"snippet\"></div></td>\n </tr>\n </table>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should sanitize the html snippet by default', function() {\n expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n toBe('<p>an html\\n<em>click here</em>\\nsnippet</p>');\n });\n\n it('should inline raw snippet if bound to a trusted value', function() {\n expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).\n toBe(\"<p style=\\\"color:blue\\\">an html\\n\" +\n \"<em onmouseover=\\\"this.textContent='PWN3D!'\\\">click here</em>\\n\" +\n \"snippet</p>\");\n });\n\n it('should escape snippet without any filter', function() {\n expect(element(by.css('#bind-default div')).getInnerHtml()).\n toBe(\"&lt;p style=\\\"color:blue\\\"&gt;an html\\n\" +\n \"&lt;em onmouseover=\\\"this.textContent='PWN3D!'\\\"&gt;click here&lt;/em&gt;\\n\" +\n \"snippet&lt;/p&gt;\");\n });\n\n it('should update', function() {\n element(by.model('snippet')).clear();\n element(by.model('snippet')).sendKeys('new <b onclick=\"alert(1)\">text</b>');\n expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n toBe('new <b>text</b>');\n expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(\n 'new <b onclick=\"alert(1)\">text</b>');\n expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(\n \"new &lt;b onclick=\\\"alert(1)\\\"&gt;text&lt;/b&gt;\");\n });\n </file>\n </example>\n */\nfunction $SanitizeProvider() {\n this.$get = ['$$sanitizeUri', function($$sanitizeUri) {\n return function(html) {\n var buf = [];\n htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {\n return !/^unsafe/.test($$sanitizeUri(uri, isImage));\n }));\n return buf.join('');\n };\n }];\n}\n\nfunction sanitizeText(chars) {\n var buf = [];\n var writer = htmlSanitizeWriter(buf, angular.noop);\n writer.chars(chars);\n return buf.join('');\n}\n\n\n// Regular Expressions for parsing tags and attributes\nvar START_TAG_REGEXP =\n /^<((?:[a-zA-Z])[\\w:-]*)((?:\\s+[\\w:-]+(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)\\s*(>?)/,\n END_TAG_REGEXP = /^<\\/\\s*([\\w:-]+)[^>]*>/,\n ATTR_REGEXP = /([\\w:-]+)(?:\\s*=\\s*(?:(?:\"((?:[^\"])*)\")|(?:'((?:[^'])*)')|([^>\\s]+)))?/g,\n BEGIN_TAG_REGEXP = /^</,\n BEGING_END_TAGE_REGEXP = /^<\\//,\n COMMENT_REGEXP = /<!--(.*?)-->/g,\n DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,\n CDATA_REGEXP = /<!\\[CDATA\\[(.*?)]]>/g,\n SURROGATE_PAIR_REGEXP = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n // Match everything outside of normal chars and \" (quote character)\n NON_ALPHANUMERIC_REGEXP = /([^\\#-~| |!])/g;\n\n\n// Good source of info about elements and attributes\n// http://dev.w3.org/html5/spec/Overview.html#semantics\n// http://simon.html5.org/html-elements\n\n// Safe Void Elements - HTML5\n// http://dev.w3.org/html5/spec/Overview.html#void-elements\nvar voidElements = makeMap(\"area,br,col,hr,img,wbr\");\n\n// Elements that you can, intentionally, leave open (and which close themselves)\n// http://dev.w3.org/html5/spec/Overview.html#optional-tags\nvar optionalEndTagBlockElements = makeMap(\"colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr\"),\n optionalEndTagInlineElements = makeMap(\"rp,rt\"),\n optionalEndTagElements = angular.extend({},\n optionalEndTagInlineElements,\n optionalEndTagBlockElements);\n\n// Safe Block Elements - HTML5\nvar blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap(\"address,article,\" +\n \"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,\" +\n \"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul\"));\n\n// Inline Elements - HTML5\nvar inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap(\"a,abbr,acronym,b,\" +\n \"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,\" +\n \"samp,small,span,strike,strong,sub,sup,time,tt,u,var\"));\n\n// SVG Elements\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements\n// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.\n// They can potentially allow for arbitrary javascript to be executed. See #11290\nvar svgElements = makeMap(\"circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,\" +\n \"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,\" +\n \"radialGradient,rect,stop,svg,switch,text,title,tspan,use\");\n\n// Special Elements (can contain anything)\nvar specialElements = makeMap(\"script,style\");\n\nvar validElements = angular.extend({},\n voidElements,\n blockElements,\n inlineElements,\n optionalEndTagElements,\n svgElements);\n\n//Attributes that have href and hence need to be sanitized\nvar uriAttrs = makeMap(\"background,cite,href,longdesc,src,usemap,xlink:href\");\n\nvar htmlAttrs = makeMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +\n 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +\n 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +\n 'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +\n 'valign,value,vspace,width');\n\n// SVG attributes (without \"id\" and \"name\" attributes)\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes\nvar svgAttrs = makeMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +\n 'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +\n 'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +\n 'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +\n 'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +\n 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +\n 'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +\n 'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +\n 'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +\n 'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +\n 'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +\n 'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +\n 'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +\n 'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +\n 'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);\n\nvar validAttrs = angular.extend({},\n uriAttrs,\n svgAttrs,\n htmlAttrs);\n\nfunction makeMap(str, lowercaseKeys) {\n var obj = {}, items = str.split(','), i;\n for (i = 0; i < items.length; i++) {\n obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;\n }\n return obj;\n}\n\n\n/**\n * @example\n * htmlParser(htmlString, {\n * start: function(tag, attrs, unary) {},\n * end: function(tag) {},\n * chars: function(text) {},\n * comment: function(text) {}\n * });\n *\n * @param {string} html string\n * @param {object} handler\n */\nfunction htmlParser(html, handler) {\n if (typeof html !== 'string') {\n if (html === null || typeof html === 'undefined') {\n html = '';\n } else {\n html = '' + html;\n }\n }\n var index, chars, match, stack = [], last = html, text;\n stack.last = function() { return stack[stack.length - 1]; };\n\n while (html) {\n text = '';\n chars = true;\n\n // Make sure we're not in a script or style element\n if (!stack.last() || !specialElements[stack.last()]) {\n\n // Comment\n if (html.indexOf(\"<!--\") === 0) {\n // comments containing -- are not allowed unless they terminate the comment\n index = html.indexOf(\"--\", 4);\n\n if (index >= 0 && html.lastIndexOf(\"-->\", index) === index) {\n if (handler.comment) handler.comment(html.substring(4, index));\n html = html.substring(index + 3);\n chars = false;\n }\n // DOCTYPE\n } else if (DOCTYPE_REGEXP.test(html)) {\n match = html.match(DOCTYPE_REGEXP);\n\n if (match) {\n html = html.replace(match[0], '');\n chars = false;\n }\n // end tag\n } else if (BEGING_END_TAGE_REGEXP.test(html)) {\n match = html.match(END_TAG_REGEXP);\n\n if (match) {\n html = html.substring(match[0].length);\n match[0].replace(END_TAG_REGEXP, parseEndTag);\n chars = false;\n }\n\n // start tag\n } else if (BEGIN_TAG_REGEXP.test(html)) {\n match = html.match(START_TAG_REGEXP);\n\n if (match) {\n // We only have a valid start-tag if there is a '>'.\n if (match[4]) {\n html = html.substring(match[0].length);\n match[0].replace(START_TAG_REGEXP, parseStartTag);\n }\n chars = false;\n } else {\n // no ending tag found --- this piece should be encoded as an entity.\n text += '<';\n html = html.substring(1);\n }\n }\n\n if (chars) {\n index = html.indexOf(\"<\");\n\n text += index < 0 ? html : html.substring(0, index);\n html = index < 0 ? \"\" : html.substring(index);\n\n if (handler.chars) handler.chars(decodeEntities(text));\n }\n\n } else {\n // IE versions 9 and 10 do not understand the regex '[^]', so using a workaround with [\\W\\w].\n html = html.replace(new RegExp(\"([\\\\W\\\\w]*)<\\\\s*\\\\/\\\\s*\" + stack.last() + \"[^>]*>\", 'i'),\n function(all, text) {\n text = text.replace(COMMENT_REGEXP, \"$1\").replace(CDATA_REGEXP, \"$1\");\n\n if (handler.chars) handler.chars(decodeEntities(text));\n\n return \"\";\n });\n\n parseEndTag(\"\", stack.last());\n }\n\n if (html == last) {\n throw $sanitizeMinErr('badparse', \"The sanitizer was unable to parse the following block \" +\n \"of html: {0}\", html);\n }\n last = html;\n }\n\n // Clean up any remaining tags\n parseEndTag();\n\n function parseStartTag(tag, tagName, rest, unary) {\n tagName = angular.lowercase(tagName);\n if (blockElements[tagName]) {\n while (stack.last() && inlineElements[stack.last()]) {\n parseEndTag(\"\", stack.last());\n }\n }\n\n if (optionalEndTagElements[tagName] && stack.last() == tagName) {\n parseEndTag(\"\", tagName);\n }\n\n unary = voidElements[tagName] || !!unary;\n\n if (!unary) {\n stack.push(tagName);\n }\n\n var attrs = {};\n\n rest.replace(ATTR_REGEXP,\n function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {\n var value = doubleQuotedValue\n || singleQuotedValue\n || unquotedValue\n || '';\n\n attrs[name] = decodeEntities(value);\n });\n if (handler.start) handler.start(tagName, attrs, unary);\n }\n\n function parseEndTag(tag, tagName) {\n var pos = 0, i;\n tagName = angular.lowercase(tagName);\n if (tagName) {\n // Find the closest opened tag of the same type\n for (pos = stack.length - 1; pos >= 0; pos--) {\n if (stack[pos] == tagName) break;\n }\n }\n\n if (pos >= 0) {\n // Close all the open elements, up the stack\n for (i = stack.length - 1; i >= pos; i--)\n if (handler.end) handler.end(stack[i]);\n\n // Remove the open elements from the stack\n stack.length = pos;\n }\n }\n}\n\nvar hiddenPre=document.createElement(\"pre\");\n/**\n * decodes all entities into regular string\n * @param value\n * @returns {string} A string with decoded entities.\n */\nfunction decodeEntities(value) {\n if (!value) { return ''; }\n\n hiddenPre.innerHTML = value.replace(/</g,\"&lt;\");\n // innerText depends on styling as it doesn't display hidden elements.\n // Therefore, it's better to use textContent not to cause unnecessary reflows.\n return hiddenPre.textContent;\n}\n\n/**\n * Escapes all potentially dangerous characters, so that the\n * resulting string can be safely inserted into attribute or\n * element text.\n * @param value\n * @returns {string} escaped text\n */\nfunction encodeEntities(value) {\n return value.\n replace(/&/g, '&amp;').\n replace(SURROGATE_PAIR_REGEXP, function(value) {\n var hi = value.charCodeAt(0);\n var low = value.charCodeAt(1);\n return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';\n }).\n replace(NON_ALPHANUMERIC_REGEXP, function(value) {\n return '&#' + value.charCodeAt(0) + ';';\n }).\n replace(/</g, '&lt;').\n replace(/>/g, '&gt;');\n}\n\n/**\n * create an HTML/XML writer which writes to buffer\n * @param {Array} buf use buf.jain('') to get out sanitized html string\n * @returns {object} in the form of {\n * start: function(tag, attrs, unary) {},\n * end: function(tag) {},\n * chars: function(text) {},\n * comment: function(text) {}\n * }\n */\nfunction htmlSanitizeWriter(buf, uriValidator) {\n var ignore = false;\n var out = angular.bind(buf, buf.push);\n return {\n start: function(tag, attrs, unary) {\n tag = angular.lowercase(tag);\n if (!ignore && specialElements[tag]) {\n ignore = tag;\n }\n if (!ignore && validElements[tag] === true) {\n out('<');\n out(tag);\n angular.forEach(attrs, function(value, key) {\n var lkey=angular.lowercase(key);\n var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');\n if (validAttrs[lkey] === true &&\n (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {\n out(' ');\n out(key);\n out('=\"');\n out(encodeEntities(value));\n out('\"');\n }\n });\n out(unary ? '/>' : '>');\n }\n },\n end: function(tag) {\n tag = angular.lowercase(tag);\n if (!ignore && validElements[tag] === true) {\n out('</');\n out(tag);\n out('>');\n }\n if (tag == ignore) {\n ignore = false;\n }\n },\n chars: function(chars) {\n if (!ignore) {\n out(encodeEntities(chars));\n }\n }\n };\n}\n\n\n// define ngSanitize module and register $sanitize service\nangular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);\n\n/* global sanitizeText: false */\n\n/**\n * @ngdoc filter\n * @name linky\n * @kind function\n *\n * @description\n * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and\n * plain email address links.\n *\n * Requires the {@link ngSanitize `ngSanitize`} module to be installed.\n *\n * @param {string} text Input text.\n * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.\n * @returns {string} Html-linkified text.\n *\n * @usage\n <span ng-bind-html=\"linky_expression | linky\"></span>\n *\n * @example\n <example module=\"linkyExample\" deps=\"angular-sanitize.js\">\n <file name=\"index.html\">\n <script>\n angular.module('linkyExample', ['ngSanitize'])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.snippet =\n 'Pretty text with some links:\\n'+\n 'http://angularjs.org/,\\n'+\n 'mailto:us@somewhere.org,\\n'+\n 'another@somewhere.org,\\n'+\n 'and one more: ftp://127.0.0.1/.';\n $scope.snippetWithTarget = 'http://angularjs.org/';\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n <table>\n <tr>\n <td>Filter</td>\n <td>Source</td>\n <td>Rendered</td>\n </tr>\n <tr id=\"linky-filter\">\n <td>linky filter</td>\n <td>\n <pre>&lt;div ng-bind-html=\"snippet | linky\"&gt;<br>&lt;/div&gt;</pre>\n </td>\n <td>\n <div ng-bind-html=\"snippet | linky\"></div>\n </td>\n </tr>\n <tr id=\"linky-target\">\n <td>linky target</td>\n <td>\n <pre>&lt;div ng-bind-html=\"snippetWithTarget | linky:'_blank'\"&gt;<br>&lt;/div&gt;</pre>\n </td>\n <td>\n <div ng-bind-html=\"snippetWithTarget | linky:'_blank'\"></div>\n </td>\n </tr>\n <tr id=\"escaped-html\">\n <td>no filter</td>\n <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br>&lt;/div&gt;</pre></td>\n <td><div ng-bind=\"snippet\"></div></td>\n </tr>\n </table>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should linkify the snippet with urls', function() {\n expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +\n 'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);\n });\n\n it('should not linkify snippet without the linky filter', function() {\n expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).\n toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +\n 'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);\n });\n\n it('should update', function() {\n element(by.model('snippet')).clear();\n element(by.model('snippet')).sendKeys('new http://link.');\n expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n toBe('new http://link.');\n expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);\n expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())\n .toBe('new http://link.');\n });\n\n it('should work with the target property', function() {\n expect(element(by.id('linky-target')).\n element(by.binding(\"snippetWithTarget | linky:'_blank'\")).getText()).\n toBe('http://angularjs.org/');\n expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');\n });\n </file>\n </example>\n */\nangular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {\n var LINKY_URL_REGEXP =\n /((ftp|https?):\\/\\/|(www\\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>\"\\u201d\\u2019]/i,\n MAILTO_REGEXP = /^mailto:/i;\n\n return function(text, target) {\n if (!text) return text;\n var match;\n var raw = text;\n var html = [];\n var url;\n var i;\n while ((match = raw.match(LINKY_URL_REGEXP))) {\n // We can not end in these as they are sometimes found at the end of the sentence\n url = match[0];\n // if we did not match ftp/http/www/mailto then assume mailto\n if (!match[2] && !match[4]) {\n url = (match[3] ? 'http://' : 'mailto:') + url;\n }\n i = match.index;\n addText(raw.substr(0, i));\n addLink(url, match[0].replace(MAILTO_REGEXP, ''));\n raw = raw.substring(i + match[0].length);\n }\n addText(raw);\n return $sanitize(html.join(''));\n\n function addText(text) {\n if (!text) {\n return;\n }\n html.push(sanitizeText(text));\n }\n\n function addLink(url, text) {\n html.push('<a ');\n if (angular.isDefined(target)) {\n html.push('target=\"',\n target,\n '\" ');\n }\n html.push('href=\"',\n url.replace(/\"/g, '&quot;'),\n '\">');\n addText(text);\n html.push('</a>');\n }\n };\n}]);\n\n\n})(window, window.angular);\n","require('./angular-sanitize');\nmodule.exports = 'ngSanitize';\n","/**\n * @license AngularJS v1.4.14\n * (c) 2010-2015 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/**\n * @ngdoc module\n * @name ngTouch\n * @description\n *\n * # ngTouch\n *\n * The `ngTouch` module provides touch events and other helpers for touch-enabled devices.\n * The implementation is based on jQuery Mobile touch event handling\n * ([jquerymobile.com](http://jquerymobile.com/)).\n *\n *\n * See {@link ngTouch.$swipe `$swipe`} for usage.\n *\n * <div doc-module-components=\"ngTouch\"></div>\n *\n */\n\n// define ngTouch module\n/* global -ngTouch */\nvar ngTouch = angular.module('ngTouch', []);\n\nfunction nodeName_(element) {\n return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName));\n}\n\n/* global ngTouch: false */\n\n /**\n * @ngdoc service\n * @name $swipe\n *\n * @description\n * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe\n * behavior, to make implementing swipe-related directives more convenient.\n *\n * Requires the {@link ngTouch `ngTouch`} module to be installed.\n *\n * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`.\n *\n * # Usage\n * The `$swipe` service is an object with a single method: `bind`. `bind` takes an element\n * which is to be watched for swipes, and an object with four handler functions. See the\n * documentation for `bind` below.\n */\n\nngTouch.factory('$swipe', [function() {\n // The total distance in any direction before we make the call on swipe vs. scroll.\n var MOVE_BUFFER_RADIUS = 10;\n\n var POINTER_EVENTS = {\n 'mouse': {\n start: 'mousedown',\n move: 'mousemove',\n end: 'mouseup'\n },\n 'touch': {\n start: 'touchstart',\n move: 'touchmove',\n end: 'touchend',\n cancel: 'touchcancel'\n }\n };\n\n function getCoordinates(event) {\n var originalEvent = event.originalEvent || event;\n var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];\n var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];\n\n return {\n x: e.clientX,\n y: e.clientY\n };\n }\n\n function getEvents(pointerTypes, eventType) {\n var res = [];\n angular.forEach(pointerTypes, function(pointerType) {\n var eventName = POINTER_EVENTS[pointerType][eventType];\n if (eventName) {\n res.push(eventName);\n }\n });\n return res.join(' ');\n }\n\n return {\n /**\n * @ngdoc method\n * @name $swipe#bind\n *\n * @description\n * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an\n * object containing event handlers.\n * The pointer types that should be used can be specified via the optional\n * third argument, which is an array of strings `'mouse'` and `'touch'`. By default,\n * `$swipe` will listen for `mouse` and `touch` events.\n *\n * The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end`\n * receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }` and the raw\n * `event`. `cancel` receives the raw `event` as its single parameter.\n *\n * `start` is called on either `mousedown` or `touchstart`. After this event, `$swipe` is\n * watching for `touchmove` or `mousemove` events. These events are ignored until the total\n * distance moved in either dimension exceeds a small threshold.\n *\n * Once this threshold is exceeded, either the horizontal or vertical delta is greater.\n * - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.\n * - If the vertical distance is greater, this is a scroll, and we let the browser take over.\n * A `cancel` event is sent.\n *\n * `move` is called on `mousemove` and `touchmove` after the above logic has determined that\n * a swipe is in progress.\n *\n * `end` is called when a swipe is successfully completed with a `touchend` or `mouseup`.\n *\n * `cancel` is called either on a `touchcancel` from the browser, or when we begin scrolling\n * as described above.\n *\n */\n bind: function(element, eventHandlers, pointerTypes) {\n // Absolute total movement, used to control swipe vs. scroll.\n var totalX, totalY;\n // Coordinates of the start position.\n var startCoords;\n // Last event's position.\n var lastPos;\n // Whether a swipe is active.\n var active = false;\n\n pointerTypes = pointerTypes || ['mouse', 'touch'];\n element.on(getEvents(pointerTypes, 'start'), function(event) {\n startCoords = getCoordinates(event);\n active = true;\n totalX = 0;\n totalY = 0;\n lastPos = startCoords;\n eventHandlers['start'] && eventHandlers['start'](startCoords, event);\n });\n var events = getEvents(pointerTypes, 'cancel');\n if (events) {\n element.on(events, function(event) {\n active = false;\n eventHandlers['cancel'] && eventHandlers['cancel'](event);\n });\n }\n\n element.on(getEvents(pointerTypes, 'move'), function(event) {\n if (!active) return;\n\n // Android will send a touchcancel if it thinks we're starting to scroll.\n // So when the total distance (+ or - or both) exceeds 10px in either direction,\n // we either:\n // - On totalX > totalY, we send preventDefault() and treat this as a swipe.\n // - On totalY > totalX, we let the browser handle it as a scroll.\n\n if (!startCoords) return;\n var coords = getCoordinates(event);\n\n totalX += Math.abs(coords.x - lastPos.x);\n totalY += Math.abs(coords.y - lastPos.y);\n\n lastPos = coords;\n\n if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {\n return;\n }\n\n // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.\n if (totalY > totalX) {\n // Allow native scrolling to take over.\n active = false;\n eventHandlers['cancel'] && eventHandlers['cancel'](event);\n return;\n } else {\n // Prevent the browser from scrolling.\n event.preventDefault();\n eventHandlers['move'] && eventHandlers['move'](coords, event);\n }\n });\n\n element.on(getEvents(pointerTypes, 'end'), function(event) {\n if (!active) return;\n active = false;\n eventHandlers['end'] && eventHandlers['end'](getCoordinates(event), event);\n });\n }\n };\n}]);\n\n/* global ngTouch: false,\n nodeName_: false\n*/\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * A more powerful replacement for the default ngClick designed to be used on touchscreen\n * devices. Most mobile browsers wait about 300ms after a tap-and-release before sending\n * the click event. This version handles them immediately, and then prevents the\n * following click event from propagating.\n *\n * Requires the {@link ngTouch `ngTouch`} module to be installed.\n *\n * This directive can fall back to using an ordinary click event, and so works on desktop\n * browsers as well as mobile.\n *\n * This directive also sets the CSS class `ng-click-active` while the element is being held\n * down (by a mouse click or touch) so you can restyle the depressed element if you wish.\n *\n * @element ANY\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate\n * upon tap. (Event object is available as `$event`)\n *\n * @example\n <example module=\"ngClickExample\" deps=\"angular-touch.js\">\n <file name=\"index.html\">\n <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n Increment\n </button>\n count: {{ count }}\n </file>\n <file name=\"script.js\">\n angular.module('ngClickExample', ['ngTouch']);\n </file>\n </example>\n */\n\nngTouch.config(['$provide', function($provide) {\n $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {\n // drop the default ngClick directive\n $delegate.shift();\n return $delegate;\n }]);\n}]);\n\nngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',\n function($parse, $timeout, $rootElement) {\n var TAP_DURATION = 750; // Shorter than 750ms is a tap, longer is a taphold or drag.\n var MOVE_TOLERANCE = 12; // 12px seems to work in most mobile browsers.\n var PREVENT_DURATION = 2500; // 2.5 seconds maximum from preventGhostClick call to click\n var CLICKBUSTER_THRESHOLD = 25; // 25 pixels in any dimension is the limit for busting clicks.\n\n var ACTIVE_CLASS_NAME = 'ng-click-active';\n var lastPreventedTime;\n var touchCoordinates;\n var lastLabelClickCoordinates;\n\n\n // TAP EVENTS AND GHOST CLICKS\n //\n // Why tap events?\n // Mobile browsers detect a tap, then wait a moment (usually ~300ms) to see if you're\n // double-tapping, and then fire a click event.\n //\n // This delay sucks and makes mobile apps feel unresponsive.\n // So we detect touchstart, touchcancel and touchend ourselves and determine when\n // the user has tapped on something.\n //\n // What happens when the browser then generates a click event?\n // The browser, of course, also detects the tap and fires a click after a delay. This results in\n // tapping/clicking twice. We do \"clickbusting\" to prevent it.\n //\n // How does it work?\n // We attach global touchstart and click handlers, that run during the capture (early) phase.\n // So the sequence for a tap is:\n // - global touchstart: Sets an \"allowable region\" at the point touched.\n // - element's touchstart: Starts a touch\n // (- touchcancel ends the touch, no click follows)\n // - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold\n // too long) and fires the user's tap handler. The touchend also calls preventGhostClick().\n // - preventGhostClick() removes the allowable region the global touchstart created.\n // - The browser generates a click event.\n // - The global click handler catches the click, and checks whether it was in an allowable region.\n // - If preventGhostClick was called, the region will have been removed, the click is busted.\n // - If the region is still there, the click proceeds normally. Therefore clicks on links and\n // other elements without ngTap on them work normally.\n //\n // This is an ugly, terrible hack!\n // Yeah, tell me about it. The alternatives are using the slow click events, or making our users\n // deal with the ghost clicks, so I consider this the least of evils. Fortunately Angular\n // encapsulates this ugly logic away from the user.\n //\n // Why not just put click handlers on the element?\n // We do that too, just to be sure. If the tap event caused the DOM to change,\n // it is possible another element is now in that position. To take account for these possibly\n // distinct elements, the handlers are global and care only about coordinates.\n\n // Checks if the coordinates are close enough to be within the region.\n function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }\n\n // Checks a list of allowable regions against a click location.\n // Returns true if the click should be allowed.\n // Splices out the allowable region from the list after it has been used.\n function checkAllowableRegions(touchCoordinates, x, y) {\n for (var i = 0; i < touchCoordinates.length; i += 2) {\n if (hit(touchCoordinates[i], touchCoordinates[i + 1], x, y)) {\n touchCoordinates.splice(i, i + 2);\n return true; // allowable region\n }\n }\n return false; // No allowable region; bust it.\n }\n\n // Global click handler that prevents the click if it's in a bustable zone and preventGhostClick\n // was called recently.\n function onClick(event) {\n if (Date.now() - lastPreventedTime > PREVENT_DURATION) {\n return; // Too old.\n }\n\n var touches = event.touches && event.touches.length ? event.touches : [event];\n var x = touches[0].clientX;\n var y = touches[0].clientY;\n // Work around desktop Webkit quirk where clicking a label will fire two clicks (on the label\n // and on the input element). Depending on the exact browser, this second click we don't want\n // to bust has either (0,0), negative coordinates, or coordinates equal to triggering label\n // click event\n if (x < 1 && y < 1) {\n return; // offscreen\n }\n if (lastLabelClickCoordinates &&\n lastLabelClickCoordinates[0] === x && lastLabelClickCoordinates[1] === y) {\n return; // input click triggered by label click\n }\n // reset label click coordinates on first subsequent click\n if (lastLabelClickCoordinates) {\n lastLabelClickCoordinates = null;\n }\n // remember label click coordinates to prevent click busting of trigger click event on input\n if (nodeName_(event.target) === 'label') {\n lastLabelClickCoordinates = [x, y];\n }\n\n // Look for an allowable region containing this click.\n // If we find one, that means it was created by touchstart and not removed by\n // preventGhostClick, so we don't bust it.\n if (checkAllowableRegions(touchCoordinates, x, y)) {\n return;\n }\n\n // If we didn't find an allowable region, bust the click.\n event.stopPropagation();\n event.preventDefault();\n\n // Blur focused form elements\n event.target && event.target.blur && event.target.blur();\n }\n\n\n // Global touchstart handler that creates an allowable region for a click event.\n // This allowable region can be removed by preventGhostClick if we want to bust it.\n function onTouchStart(event) {\n var touches = event.touches && event.touches.length ? event.touches : [event];\n var x = touches[0].clientX;\n var y = touches[0].clientY;\n touchCoordinates.push(x, y);\n\n $timeout(function() {\n // Remove the allowable region.\n for (var i = 0; i < touchCoordinates.length; i += 2) {\n if (touchCoordinates[i] == x && touchCoordinates[i + 1] == y) {\n touchCoordinates.splice(i, i + 2);\n return;\n }\n }\n }, PREVENT_DURATION, false);\n }\n\n // On the first call, attaches some event handlers. Then whenever it gets called, it creates a\n // zone around the touchstart where clicks will get busted.\n function preventGhostClick(x, y) {\n if (!touchCoordinates) {\n $rootElement[0].addEventListener('click', onClick, true);\n $rootElement[0].addEventListener('touchstart', onTouchStart, true);\n touchCoordinates = [];\n }\n\n lastPreventedTime = Date.now();\n\n checkAllowableRegions(touchCoordinates, x, y);\n }\n\n // Actual linking function.\n return function(scope, element, attr) {\n var clickHandler = $parse(attr.ngClick),\n tapping = false,\n tapElement, // Used to blur the element after a tap.\n startTime, // Used to check if the tap was held too long.\n touchStartX,\n touchStartY;\n\n function resetState() {\n tapping = false;\n element.removeClass(ACTIVE_CLASS_NAME);\n }\n\n element.on('touchstart', function(event) {\n tapping = true;\n tapElement = event.target ? event.target : event.srcElement; // IE uses srcElement.\n // Hack for Safari, which can target text nodes instead of containers.\n if (tapElement.nodeType == 3) {\n tapElement = tapElement.parentNode;\n }\n\n element.addClass(ACTIVE_CLASS_NAME);\n\n startTime = Date.now();\n\n // Use jQuery originalEvent\n var originalEvent = event.originalEvent || event;\n var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];\n var e = touches[0];\n touchStartX = e.clientX;\n touchStartY = e.clientY;\n });\n\n element.on('touchcancel', function(event) {\n resetState();\n });\n\n element.on('touchend', function(event) {\n var diff = Date.now() - startTime;\n\n // Use jQuery originalEvent\n var originalEvent = event.originalEvent || event;\n var touches = (originalEvent.changedTouches && originalEvent.changedTouches.length) ?\n originalEvent.changedTouches :\n ((originalEvent.touches && originalEvent.touches.length) ? originalEvent.touches : [originalEvent]);\n var e = touches[0];\n var x = e.clientX;\n var y = e.clientY;\n var dist = Math.sqrt(Math.pow(x - touchStartX, 2) + Math.pow(y - touchStartY, 2));\n\n if (tapping && diff < TAP_DURATION && dist < MOVE_TOLERANCE) {\n // Call preventGhostClick so the clickbuster will catch the corresponding click.\n preventGhostClick(x, y);\n\n // Blur the focused element (the button, probably) before firing the callback.\n // This doesn't work perfectly on Android Chrome, but seems to work elsewhere.\n // I couldn't get anything to work reliably on Android Chrome.\n if (tapElement) {\n tapElement.blur();\n }\n\n if (!angular.isDefined(attr.disabled) || attr.disabled === false) {\n element.triggerHandler('click', [event]);\n }\n }\n\n resetState();\n });\n\n // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click\n // something else nearby.\n element.onclick = function(event) { };\n\n // Actual click handler.\n // There are three different kinds of clicks, only two of which reach this point.\n // - On desktop browsers without touch events, their clicks will always come here.\n // - On mobile browsers, the simulated \"fast\" click will call this.\n // - But the browser's follow-up slow click will be \"busted\" before it reaches this handler.\n // Therefore it's safe to use this directive on both mobile and desktop.\n element.on('click', function(event, touchend) {\n scope.$apply(function() {\n clickHandler(scope, {$event: (touchend || event)});\n });\n });\n\n element.on('mousedown', function(event) {\n element.addClass(ACTIVE_CLASS_NAME);\n });\n\n element.on('mousemove mouseup', function(event) {\n element.removeClass(ACTIVE_CLASS_NAME);\n });\n\n };\n}]);\n\n/* global ngTouch: false */\n\n/**\n * @ngdoc directive\n * @name ngSwipeLeft\n *\n * @description\n * Specify custom behavior when an element is swiped to the left on a touchscreen device.\n * A leftward swipe is a quick, right-to-left slide of the finger.\n * Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag\n * too.\n *\n * To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to\n * the `ng-swipe-left` or `ng-swipe-right` DOM Element.\n *\n * Requires the {@link ngTouch `ngTouch`} module to be installed.\n *\n * @element ANY\n * @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate\n * upon left swipe. (Event object is available as `$event`)\n *\n * @example\n <example module=\"ngSwipeLeftExample\" deps=\"angular-touch.js\">\n <file name=\"index.html\">\n <div ng-show=\"!showActions\" ng-swipe-left=\"showActions = true\">\n Some list content, like an email in the inbox\n </div>\n <div ng-show=\"showActions\" ng-swipe-right=\"showActions = false\">\n <button ng-click=\"reply()\">Reply</button>\n <button ng-click=\"delete()\">Delete</button>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('ngSwipeLeftExample', ['ngTouch']);\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSwipeRight\n *\n * @description\n * Specify custom behavior when an element is swiped to the right on a touchscreen device.\n * A rightward swipe is a quick, left-to-right slide of the finger.\n * Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag\n * too.\n *\n * Requires the {@link ngTouch `ngTouch`} module to be installed.\n *\n * @element ANY\n * @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate\n * upon right swipe. (Event object is available as `$event`)\n *\n * @example\n <example module=\"ngSwipeRightExample\" deps=\"angular-touch.js\">\n <file name=\"index.html\">\n <div ng-show=\"!showActions\" ng-swipe-left=\"showActions = true\">\n Some list content, like an email in the inbox\n </div>\n <div ng-show=\"showActions\" ng-swipe-right=\"showActions = false\">\n <button ng-click=\"reply()\">Reply</button>\n <button ng-click=\"delete()\">Delete</button>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('ngSwipeRightExample', ['ngTouch']);\n </file>\n </example>\n */\n\nfunction makeSwipeDirective(directiveName, direction, eventName) {\n ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {\n // The maximum vertical delta for a swipe should be less than 75px.\n var MAX_VERTICAL_DISTANCE = 75;\n // Vertical distance should not be more than a fraction of the horizontal distance.\n var MAX_VERTICAL_RATIO = 0.3;\n // At least a 30px lateral motion is necessary for a swipe.\n var MIN_HORIZONTAL_DISTANCE = 30;\n\n return function(scope, element, attr) {\n var swipeHandler = $parse(attr[directiveName]);\n\n var startCoords, valid;\n\n function validSwipe(coords) {\n // Check that it's within the coordinates.\n // Absolute vertical distance must be within tolerances.\n // Horizontal distance, we take the current X - the starting X.\n // This is negative for leftward swipes and positive for rightward swipes.\n // After multiplying by the direction (-1 for left, +1 for right), legal swipes\n // (ie. same direction as the directive wants) will have a positive delta and\n // illegal ones a negative delta.\n // Therefore this delta must be positive, and larger than the minimum.\n if (!startCoords) return false;\n var deltaY = Math.abs(coords.y - startCoords.y);\n var deltaX = (coords.x - startCoords.x) * direction;\n return valid && // Short circuit for already-invalidated swipes.\n deltaY < MAX_VERTICAL_DISTANCE &&\n deltaX > 0 &&\n deltaX > MIN_HORIZONTAL_DISTANCE &&\n deltaY / deltaX < MAX_VERTICAL_RATIO;\n }\n\n var pointerTypes = ['touch'];\n if (!angular.isDefined(attr['ngSwipeDisableMouse'])) {\n pointerTypes.push('mouse');\n }\n $swipe.bind(element, {\n 'start': function(coords, event) {\n startCoords = coords;\n valid = true;\n },\n 'cancel': function(event) {\n valid = false;\n },\n 'end': function(coords, event) {\n if (validSwipe(coords)) {\n scope.$apply(function() {\n element.triggerHandler(eventName);\n swipeHandler(scope, {$event: event});\n });\n }\n }\n }, pointerTypes);\n };\n }]);\n}\n\n// Left is negative X-coordinate, right is positive.\nmakeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');\nmakeSwipeDirective('ngSwipeRight', 1, 'swiperight');\n\n\n\n})(window, window.angular);\n","require('./angular-touch');\nmodule.exports = 'ngTouch';\n","/**\n * @license AngularJS v1.4.14\n * (c) 2010-2015 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, document, undefined) {'use strict';\n\n/**\n * @description\n *\n * This object provides a utility for producing rich Error messages within\n * Angular. It can be called as follows:\n *\n * var exampleMinErr = minErr('example');\n * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);\n *\n * The above creates an instance of minErr in the example namespace. The\n * resulting error will have a namespaced error code of example.one. The\n * resulting error will replace {0} with the value of foo, and {1} with the\n * value of bar. The object is not restricted in the number of arguments it can\n * take.\n *\n * If fewer arguments are specified than necessary for interpolation, the extra\n * interpolation markers will be preserved in the final string.\n *\n * Since data will be parsed statically during a build step, some restrictions\n * are applied with respect to how minErr instances are created and called.\n * Instances should have names of the form namespaceMinErr for a minErr created\n * using minErr('namespace') . Error codes, namespaces and template strings\n * should all be static strings, not variables or general expressions.\n *\n * @param {string} module The namespace to use for the new minErr instance.\n * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning\n * error from returned function, for cases when a particular type of error is useful.\n * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance\n */\n\nfunction minErr(module, ErrorConstructor) {\n ErrorConstructor = ErrorConstructor || Error;\n return function() {\n var SKIP_INDEXES = 2;\n\n var templateArgs = arguments,\n code = templateArgs[0],\n message = '[' + (module ? module + ':' : '') + code + '] ',\n template = templateArgs[1],\n paramPrefix, i;\n\n message += template.replace(/\\{\\d+\\}/g, function(match) {\n var index = +match.slice(1, -1),\n shiftedIndex = index + SKIP_INDEXES;\n\n if (shiftedIndex < templateArgs.length) {\n return toDebugString(templateArgs[shiftedIndex]);\n }\n\n return match;\n });\n\n message += '\\nhttp://errors.angularjs.org/1.4.14/' +\n (module ? module + '/' : '') + code;\n\n for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {\n message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +\n encodeURIComponent(toDebugString(templateArgs[i]));\n }\n\n return new ErrorConstructor(message);\n };\n}\n\n/* We need to tell jshint what variables are being exported */\n/* global angular: true,\n msie: true,\n jqLite: true,\n jQuery: true,\n slice: true,\n splice: true,\n push: true,\n toString: true,\n ngMinErr: true,\n angularModule: true,\n uid: true,\n REGEX_STRING_REGEXP: true,\n VALIDITY_STATE_PROPERTY: true,\n\n lowercase: true,\n uppercase: true,\n manualLowercase: true,\n manualUppercase: true,\n nodeName_: true,\n isArrayLike: true,\n forEach: true,\n forEachSorted: true,\n reverseParams: true,\n nextUid: true,\n setHashKey: true,\n extend: true,\n toInt: true,\n inherit: true,\n merge: true,\n noop: true,\n identity: true,\n valueFn: true,\n isUndefined: true,\n isDefined: true,\n isObject: true,\n isBlankObject: true,\n isString: true,\n isNumber: true,\n isDate: true,\n isArray: true,\n isFunction: true,\n isRegExp: true,\n isWindow: true,\n isScope: true,\n isFile: true,\n isFormData: true,\n isBlob: true,\n isBoolean: true,\n isPromiseLike: true,\n trim: true,\n escapeForRegexp: true,\n isElement: true,\n makeMap: true,\n includes: true,\n arrayRemove: true,\n copy: true,\n shallowCopy: true,\n equals: true,\n csp: true,\n jq: true,\n concat: true,\n sliceArgs: true,\n bind: true,\n toJsonReplacer: true,\n toJson: true,\n fromJson: true,\n convertTimezoneToLocal: true,\n timezoneToOffset: true,\n startingTag: true,\n tryDecodeURIComponent: true,\n parseKeyValue: true,\n toKeyValue: true,\n encodeUriSegment: true,\n encodeUriQuery: true,\n angularInit: true,\n bootstrap: true,\n getTestability: true,\n snake_case: true,\n bindJQuery: true,\n assertArg: true,\n assertArgFn: true,\n assertNotHasOwnProperty: true,\n getter: true,\n getBlockNodes: true,\n hasOwnProperty: true,\n createMap: true,\n\n NODE_TYPE_ELEMENT: true,\n NODE_TYPE_ATTRIBUTE: true,\n NODE_TYPE_TEXT: true,\n NODE_TYPE_COMMENT: true,\n NODE_TYPE_DOCUMENT: true,\n NODE_TYPE_DOCUMENT_FRAGMENT: true,\n*/\n\n////////////////////////////////////\n\n/**\n * @ngdoc module\n * @name ng\n * @module ng\n * @description\n *\n * # ng (core module)\n * The ng module is loaded by default when an AngularJS application is started. The module itself\n * contains the essential components for an AngularJS application to function. The table below\n * lists a high level breakdown of each of the services/factories, filters, directives and testing\n * components available within this core module.\n *\n * <div doc-module-components=\"ng\"></div>\n */\n\nvar REGEX_STRING_REGEXP = /^\\/(.+)\\/([a-z]*)$/;\n\n// The name of a form control's ValidityState property.\n// This is used so that it's possible for internal tests to create mock ValidityStates.\nvar VALIDITY_STATE_PROPERTY = 'validity';\n\n/**\n * @ngdoc function\n * @name angular.lowercase\n * @module ng\n * @kind function\n *\n * @description Converts the specified string to lowercase.\n * @param {string} string String to be converted to lowercase.\n * @returns {string} Lowercased string.\n */\nvar lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * @ngdoc function\n * @name angular.uppercase\n * @module ng\n * @kind function\n *\n * @description Converts the specified string to uppercase.\n * @param {string} string String to be converted to uppercase.\n * @returns {string} Uppercased string.\n */\nvar uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};\n\n\nvar manualLowercase = function(s) {\n /* jshint bitwise: false */\n return isString(s)\n ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})\n : s;\n};\nvar manualUppercase = function(s) {\n /* jshint bitwise: false */\n return isString(s)\n ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})\n : s;\n};\n\n\n// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish\n// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods\n// with correct but slower alternatives.\nif ('i' !== 'I'.toLowerCase()) {\n lowercase = manualLowercase;\n uppercase = manualUppercase;\n}\n\n\nvar\n msie, // holds major version number for IE, or NaN if UA is not IE.\n jqLite, // delay binding since jQuery could be loaded after us.\n jQuery, // delay binding\n slice = [].slice,\n splice = [].splice,\n push = [].push,\n toString = Object.prototype.toString,\n getPrototypeOf = Object.getPrototypeOf,\n ngMinErr = minErr('ng'),\n\n /** @name angular */\n angular = window.angular || (window.angular = {}),\n angularModule,\n uid = 0;\n\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nmsie = document.documentMode;\n\n\n/**\n * @private\n * @param {*} obj\n * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,\n * String ...)\n */\nfunction isArrayLike(obj) {\n\n // `null`, `undefined` and `window` are not array-like\n if (obj == null || isWindow(obj)) return false;\n\n // arrays, strings and jQuery/jqLite objects are array like\n // * jqLite is either the jQuery or jqLite constructor function\n // * we have to check the existance of jqLite first as this method is called\n // via the forEach method when constructing the jqLite object in the first place\n if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;\n\n // Support: iOS 8.2 (not reproducible in simulator)\n // \"length\" in obj used to prevent JIT error (gh-11508)\n var length = \"length\" in Object(obj) && obj.length;\n\n // NodeList objects (with `item` method) and\n // other objects with suitable length characteristics are array-like\n return isNumber(length) &&\n (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');\n\n}\n\n/**\n * @ngdoc function\n * @name angular.forEach\n * @module ng\n * @kind function\n *\n * @description\n * Invokes the `iterator` function once for each item in `obj` collection, which can be either an\n * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`\n * is the value of an object property or an array element, `key` is the object property key or\n * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.\n *\n * It is worth noting that `.forEach` does not iterate over inherited properties because it filters\n * using the `hasOwnProperty` method.\n *\n * Unlike ES262's\n * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),\n * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just\n * return the value provided.\n *\n ```js\n var values = {name: 'misko', gender: 'male'};\n var log = [];\n angular.forEach(values, function(value, key) {\n this.push(key + ': ' + value);\n }, log);\n expect(log).toEqual(['name: misko', 'gender: male']);\n ```\n *\n * @param {Object|Array} obj Object to iterate over.\n * @param {Function} iterator Iterator function.\n * @param {Object=} context Object to become context (`this`) for the iterator function.\n * @returns {Object|Array} Reference to `obj`.\n */\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj) || isArrayLike(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else if (isBlankObject(obj)) {\n // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n for (key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n } else if (typeof obj.hasOwnProperty === 'function') {\n // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else {\n // Slow path for objects which do not have a method `hasOwnProperty`\n for (key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction forEachSorted(obj, iterator, context) {\n var keys = Object.keys(obj).sort();\n for (var i = 0; i < keys.length; i++) {\n iterator.call(context, obj[keys[i]], keys[i]);\n }\n return keys;\n}\n\n\n/**\n * when using forEach the params are value, key, but it is often useful to have key, value.\n * @param {function(string, *)} iteratorFn\n * @returns {function(*, string)}\n */\nfunction reverseParams(iteratorFn) {\n return function(value, key) {iteratorFn(key, value);};\n}\n\n/**\n * A consistent way of creating unique IDs in angular.\n *\n * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before\n * we hit number precision issues in JavaScript.\n *\n * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M\n *\n * @returns {number} an unique alpha-numeric string\n */\nfunction nextUid() {\n return ++uid;\n}\n\n\n/**\n * Set or clear the hashkey for an object.\n * @param obj object\n * @param h the hashkey (!truthy to delete the hashkey)\n */\nfunction setHashKey(obj, h) {\n if (h) {\n obj.$$hashKey = h;\n } else {\n delete obj.$$hashKey;\n }\n}\n\n\nfunction baseExtend(dst, objs, deep) {\n var h = dst.$$hashKey;\n\n for (var i = 0, ii = objs.length; i < ii; ++i) {\n var obj = objs[i];\n if (!isObject(obj) && !isFunction(obj)) continue;\n var keys = Object.keys(obj);\n for (var j = 0, jj = keys.length; j < jj; j++) {\n var key = keys[j];\n var src = obj[key];\n\n if (deep && isObject(src)) {\n if (isDate(src)) {\n dst[key] = new Date(src.valueOf());\n } else if (isRegExp(src)) {\n dst[key] = new RegExp(src);\n } else if (src.nodeName) {\n dst[key] = src.cloneNode(true);\n } else if (isElement(src)) {\n dst[key] = src.clone();\n } else {\n if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};\n baseExtend(dst[key], [src], true);\n }\n } else {\n dst[key] = src;\n }\n }\n }\n\n setHashKey(dst, h);\n return dst;\n}\n\n/**\n * @ngdoc function\n * @name angular.extend\n * @module ng\n * @kind function\n *\n * @description\n * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.\n *\n * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use\n * {@link angular.merge} for this.\n *\n * @param {Object} dst Destination object.\n * @param {...Object} src Source object(s).\n * @returns {Object} Reference to `dst`.\n */\nfunction extend(dst) {\n return baseExtend(dst, slice.call(arguments, 1), false);\n}\n\n\n/**\n* @ngdoc function\n* @name angular.merge\n* @module ng\n* @kind function\n*\n* @description\n* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.\n*\n* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source\n* objects, performing a deep copy.\n*\n* @param {Object} dst Destination object.\n* @param {...Object} src Source object(s).\n* @returns {Object} Reference to `dst`.\n*/\nfunction merge(dst) {\n return baseExtend(dst, slice.call(arguments, 1), true);\n}\n\n\n\nfunction toInt(str) {\n return parseInt(str, 10);\n}\n\n\nfunction inherit(parent, extra) {\n return extend(Object.create(parent), extra);\n}\n\n/**\n * @ngdoc function\n * @name angular.noop\n * @module ng\n * @kind function\n *\n * @description\n * A function that performs no operations. This function can be useful when writing code in the\n * functional style.\n ```js\n function foo(callback) {\n var result = calculateResult();\n (callback || angular.noop)(result);\n }\n ```\n */\nfunction noop() {}\nnoop.$inject = [];\n\n\n/**\n * @ngdoc function\n * @name angular.identity\n * @module ng\n * @kind function\n *\n * @description\n * A function that returns its first argument. This function is useful when writing code in the\n * functional style.\n *\n ```js\n function transformer(transformationFn, value) {\n return (transformationFn || angular.identity)(value);\n };\n\n // E.g.\n function getResult(fn, input) {\n return (fn || angular.identity)(input);\n };\n\n getResult(function(n) { return n * 2; }, 21); // returns 42\n getResult(null, 21); // returns 21\n getResult(undefined, 21); // returns 21\n ```\n *\n * @param {*} value to be returned.\n * @returns {*} the value passed in.\n */\nfunction identity($) {return $;}\nidentity.$inject = [];\n\n\nfunction valueFn(value) {return function() {return value;};}\n\nfunction hasCustomToString(obj) {\n return isFunction(obj.toString) && obj.toString !== toString;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isUndefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is undefined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is undefined.\n */\nfunction isUndefined(value) {return typeof value === 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is defined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is defined.\n */\nfunction isDefined(value) {return typeof value !== 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isObject\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not\n * considered to be objects. Note that JavaScript arrays are objects.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Object` but not `null`.\n */\nfunction isObject(value) {\n // http://jsperf.com/isobject4\n return value !== null && typeof value === 'object';\n}\n\n\n/**\n * Determine if a value is an object with a null prototype\n *\n * @returns {boolean} True if `value` is an `Object` with a null prototype\n */\nfunction isBlankObject(value) {\n return value !== null && typeof value === 'object' && !getPrototypeOf(value);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isString\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `String`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `String`.\n */\nfunction isString(value) {return typeof value === 'string';}\n\n\n/**\n * @ngdoc function\n * @name angular.isNumber\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Number`.\n *\n * This includes the \"special\" numbers `NaN`, `+Infinity` and `-Infinity`.\n *\n * If you wish to exclude these then you can use the native\n * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)\n * method.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Number`.\n */\nfunction isNumber(value) {return typeof value === 'number';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDate\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a value is a date.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Date`.\n */\nfunction isDate(value) {\n return toString.call(value) === '[object Date]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isArray\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Array`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Array`.\n */\nvar isArray = Array.isArray;\n\n/**\n * @ngdoc function\n * @name angular.isFunction\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Function`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Function`.\n */\nfunction isFunction(value) {return typeof value === 'function';}\n\n\n/**\n * Determines if a value is a regular expression object.\n *\n * @private\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `RegExp`.\n */\nfunction isRegExp(value) {\n return toString.call(value) === '[object RegExp]';\n}\n\n\n/**\n * Checks if `obj` is a window object.\n *\n * @private\n * @param {*} obj Object to check\n * @returns {boolean} True if `obj` is a window obj.\n */\nfunction isWindow(obj) {\n return obj && obj.window === obj;\n}\n\n\nfunction isScope(obj) {\n return obj && obj.$evalAsync && obj.$watch;\n}\n\n\nfunction isFile(obj) {\n return toString.call(obj) === '[object File]';\n}\n\n\nfunction isFormData(obj) {\n return toString.call(obj) === '[object FormData]';\n}\n\n\nfunction isBlob(obj) {\n return toString.call(obj) === '[object Blob]';\n}\n\n\nfunction isBoolean(value) {\n return typeof value === 'boolean';\n}\n\n\nfunction isPromiseLike(obj) {\n return obj && isFunction(obj.then);\n}\n\n\nvar TYPED_ARRAY_REGEXP = /^\\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\\]$/;\nfunction isTypedArray(value) {\n return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));\n}\n\n\nvar trim = function(value) {\n return isString(value) ? value.trim() : value;\n};\n\n// Copied from:\n// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021\n// Prereq: s is a string.\nvar escapeForRegexp = function(s) {\n return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1').\n replace(/\\x08/g, '\\\\x08');\n};\n\n\n/**\n * @ngdoc function\n * @name angular.isElement\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a DOM element (or wrapped jQuery element).\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).\n */\nfunction isElement(node) {\n return !!(node &&\n (node.nodeName // we are a direct element\n || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API\n}\n\n/**\n * @param str 'key1,key2,...'\n * @returns {object} in the form of {key1:true, key2:true, ...}\n */\nfunction makeMap(str) {\n var obj = {}, items = str.split(','), i;\n for (i = 0; i < items.length; i++) {\n obj[items[i]] = true;\n }\n return obj;\n}\n\n\nfunction nodeName_(element) {\n return lowercase(element.nodeName || (element[0] && element[0].nodeName));\n}\n\nfunction includes(array, obj) {\n return Array.prototype.indexOf.call(array, obj) != -1;\n}\n\nfunction arrayRemove(array, value) {\n var index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n }\n return index;\n}\n\n/**\n * @ngdoc function\n * @name angular.copy\n * @module ng\n * @kind function\n *\n * @description\n * Creates a deep copy of `source`, which should be an object or an array.\n *\n * * If no destination is supplied, a copy of the object or array is created.\n * * If a destination is provided, all of its elements (for arrays) or properties (for objects)\n * are deleted and then all elements/properties from the source are copied to it.\n * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.\n * * If `source` is identical to 'destination' an exception will be thrown.\n *\n * @param {*} source The source that will be used to make a copy.\n * Can be any type, including primitives, `null`, and `undefined`.\n * @param {(Object|Array)=} destination Destination into which the source is copied. If\n * provided, must be of the same type as `source`.\n * @returns {*} The copy or updated `destination`, if `destination` was specified.\n *\n * @example\n <example module=\"copyExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form novalidate class=\"simple-form\">\n Name: <input type=\"text\" ng-model=\"user.name\" /><br />\n E-mail: <input type=\"email\" ng-model=\"user.email\" /><br />\n Gender: <input type=\"radio\" ng-model=\"user.gender\" value=\"male\" />male\n <input type=\"radio\" ng-model=\"user.gender\" value=\"female\" />female<br />\n <button ng-click=\"reset()\">RESET</button>\n <button ng-click=\"update(user)\">SAVE</button>\n </form>\n <pre>form = {{user | json}}</pre>\n <pre>master = {{master | json}}</pre>\n </div>\n\n <script>\n angular.module('copyExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.master= {};\n\n $scope.update = function(user) {\n // Example with 1 argument\n $scope.master= angular.copy(user);\n };\n\n $scope.reset = function() {\n // Example with 2 arguments\n angular.copy($scope.master, $scope.user);\n };\n\n $scope.reset();\n }]);\n </script>\n </file>\n </example>\n */\nfunction copy(source, destination) {\n var stackSource = [];\n var stackDest = [];\n\n if (destination) {\n if (isTypedArray(destination)) {\n throw ngMinErr('cpta', \"Can't copy! TypedArray destination cannot be mutated.\");\n }\n if (source === destination) {\n throw ngMinErr('cpi', \"Can't copy! Source and destination are identical.\");\n }\n\n // Empty the destination object\n if (isArray(destination)) {\n destination.length = 0;\n } else {\n forEach(destination, function(value, key) {\n if (key !== '$$hashKey') {\n delete destination[key];\n }\n });\n }\n\n stackSource.push(source);\n stackDest.push(destination);\n return copyRecurse(source, destination);\n }\n\n return copyElement(source);\n\n function copyRecurse(source, destination) {\n var h = destination.$$hashKey;\n var result, key;\n if (isArray(source)) {\n for (var i = 0, ii = source.length; i < ii; i++) {\n destination.push(copyElement(source[i]));\n }\n } else if (isBlankObject(source)) {\n // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n for (key in source) {\n destination[key] = copyElement(source[key]);\n }\n } else if (source && typeof source.hasOwnProperty === 'function') {\n // Slow path, which must rely on hasOwnProperty\n for (key in source) {\n if (source.hasOwnProperty(key)) {\n destination[key] = copyElement(source[key]);\n }\n }\n } else {\n // Slowest path --- hasOwnProperty can't be called as a method\n for (key in source) {\n if (hasOwnProperty.call(source, key)) {\n destination[key] = copyElement(source[key]);\n }\n }\n }\n setHashKey(destination, h);\n return destination;\n }\n\n function copyElement(source) {\n // Simple values\n if (!isObject(source)) {\n return source;\n }\n\n // Already copied values\n var index = stackSource.indexOf(source);\n if (index !== -1) {\n return stackDest[index];\n }\n\n if (isWindow(source) || isScope(source)) {\n throw ngMinErr('cpws',\n \"Can't copy! Making copies of Window or Scope instances is not supported.\");\n }\n\n var needsRecurse = false;\n var destination;\n\n if (isArray(source)) {\n destination = [];\n needsRecurse = true;\n } else if (isTypedArray(source)) {\n destination = new source.constructor(source);\n } else if (isDate(source)) {\n destination = new Date(source.getTime());\n } else if (isRegExp(source)) {\n destination = new RegExp(source.source, source.toString().match(/[^\\/]*$/)[0]);\n destination.lastIndex = source.lastIndex;\n } else if (isBlob(source)) {\n destination = new source.constructor([source], {type: source.type});\n } else if (isFunction(source.cloneNode)) {\n destination = source.cloneNode(true);\n } else {\n destination = Object.create(getPrototypeOf(source));\n needsRecurse = true;\n }\n\n stackSource.push(source);\n stackDest.push(destination);\n\n return needsRecurse\n ? copyRecurse(source, destination)\n : destination;\n }\n}\n\n/**\n * Creates a shallow copy of an object, an array or a primitive.\n *\n * Assumes that there are no proto properties for objects.\n */\nfunction shallowCopy(src, dst) {\n if (isArray(src)) {\n dst = dst || [];\n\n for (var i = 0, ii = src.length; i < ii; i++) {\n dst[i] = src[i];\n }\n } else if (isObject(src)) {\n dst = dst || {};\n\n for (var key in src) {\n if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n dst[key] = src[key];\n }\n }\n }\n\n return dst || src;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.equals\n * @module ng\n * @kind function\n *\n * @description\n * Determines if two objects or two values are equivalent. Supports value types, regular\n * expressions, arrays and objects.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n * comparing them with `angular.equals`.\n * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)\n * * Both values represent the same regular expression (In JavaScript,\n * /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual\n * representation matches).\n *\n * During a property comparison, properties of `function` type and properties with names\n * that begin with `$` are ignored.\n *\n * Scope and DOMWindow objects are being compared only by identify (`===`).\n *\n * @param {*} o1 Object or value to compare.\n * @param {*} o2 Object or value to compare.\n * @returns {boolean} True if arguments are equal.\n */\nfunction equals(o1, o2) {\n if (o1 === o2) return true;\n if (o1 === null || o2 === null) return false;\n if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n var t1 = typeof o1, t2 = typeof o2, length, key, keySet;\n if (t1 == t2) {\n if (t1 == 'object') {\n if (isArray(o1)) {\n if (!isArray(o2)) return false;\n if ((length = o1.length) == o2.length) {\n for (key = 0; key < length; key++) {\n if (!equals(o1[key], o2[key])) return false;\n }\n return true;\n }\n } else if (isDate(o1)) {\n if (!isDate(o2)) return false;\n return equals(o1.getTime(), o2.getTime());\n } else if (isRegExp(o1)) {\n return isRegExp(o2) ? o1.toString() == o2.toString() : false;\n } else {\n if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||\n isArray(o2) || isDate(o2) || isRegExp(o2)) return false;\n keySet = createMap();\n for (key in o1) {\n if (key.charAt(0) === '$' || isFunction(o1[key])) continue;\n if (!equals(o1[key], o2[key])) return false;\n keySet[key] = true;\n }\n for (key in o2) {\n if (!(key in keySet) &&\n key.charAt(0) !== '$' &&\n isDefined(o2[key]) &&\n !isFunction(o2[key])) return false;\n }\n return true;\n }\n }\n }\n return false;\n}\n\nvar csp = function() {\n if (!isDefined(csp.rules)) {\n\n\n var ngCspElement = (document.querySelector('[ng-csp]') ||\n document.querySelector('[data-ng-csp]'));\n\n if (ngCspElement) {\n var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||\n ngCspElement.getAttribute('data-ng-csp');\n csp.rules = {\n noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),\n noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)\n };\n } else {\n csp.rules = {\n noUnsafeEval: noUnsafeEval(),\n noInlineStyle: false\n };\n }\n }\n\n return csp.rules;\n\n function noUnsafeEval() {\n try {\n /* jshint -W031, -W054 */\n new Function('');\n /* jshint +W031, +W054 */\n return false;\n } catch (e) {\n return true;\n }\n }\n};\n\n/**\n * @ngdoc directive\n * @module ng\n * @name ngJq\n *\n * @element ANY\n * @param {string=} ngJq the name of the library available under `window`\n * to be used for angular.element\n * @description\n * Use this directive to force the angular.element library. This should be\n * used to force either jqLite by leaving ng-jq blank or setting the name of\n * the jquery variable under window (eg. jQuery).\n *\n * Since angular looks for this directive when it is loaded (doesn't wait for the\n * DOMContentLoaded event), it must be placed on an element that comes before the script\n * which loads angular. Also, only the first instance of `ng-jq` will be used and all\n * others ignored.\n *\n * @example\n * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.\n ```html\n <!doctype html>\n <html ng-app ng-jq>\n ...\n ...\n </html>\n ```\n * @example\n * This example shows how to use a jQuery based library of a different name.\n * The library name must be available at the top most 'window'.\n ```html\n <!doctype html>\n <html ng-app ng-jq=\"jQueryLib\">\n ...\n ...\n </html>\n ```\n */\nvar jq = function() {\n if (isDefined(jq.name_)) return jq.name_;\n var el;\n var i, ii = ngAttrPrefixes.length, prefix, name;\n for (i = 0; i < ii; ++i) {\n prefix = ngAttrPrefixes[i];\n if (el = document.querySelector('[' + prefix.replace(':', '\\\\:') + 'jq]')) {\n name = el.getAttribute(prefix + 'jq');\n break;\n }\n }\n\n return (jq.name_ = name);\n};\n\nfunction concat(array1, array2, index) {\n return array1.concat(slice.call(array2, index));\n}\n\nfunction sliceArgs(args, startIndex) {\n return slice.call(args, startIndex || 0);\n}\n\n\n/* jshint -W101 */\n/**\n * @ngdoc function\n * @name angular.bind\n * @module ng\n * @kind function\n *\n * @description\n * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for\n * `fn`). You can supply optional `args` that are prebound to the function. This feature is also\n * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as\n * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).\n *\n * @param {Object} self Context which `fn` should be evaluated in.\n * @param {function()} fn Function to be bound.\n * @param {...*} args Optional arguments to be prebound to the `fn` function call.\n * @returns {function()} Function that wraps the `fn` with all the specified bindings.\n */\n/* jshint +W101 */\nfunction bind(self, fn) {\n var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];\n if (isFunction(fn) && !(fn instanceof RegExp)) {\n return curryArgs.length\n ? function() {\n return arguments.length\n ? fn.apply(self, concat(curryArgs, arguments, 0))\n : fn.apply(self, curryArgs);\n }\n : function() {\n return arguments.length\n ? fn.apply(self, arguments)\n : fn.call(self);\n };\n } else {\n // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)\n return fn;\n }\n}\n\n\nfunction toJsonReplacer(key, value) {\n var val = value;\n\n if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {\n val = undefined;\n } else if (isWindow(value)) {\n val = '$WINDOW';\n } else if (value && document === value) {\n val = '$DOCUMENT';\n } else if (isScope(value)) {\n val = '$SCOPE';\n }\n\n return val;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.toJson\n * @module ng\n * @kind function\n *\n * @description\n * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be\n * stripped since angular uses this notation internally.\n *\n * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.\n * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.\n * If set to an integer, the JSON output will contain that many spaces per indentation.\n * @returns {string|undefined} JSON-ified string representing `obj`.\n */\nfunction toJson(obj, pretty) {\n if (isUndefined(obj)) return undefined;\n if (!isNumber(pretty)) {\n pretty = pretty ? 2 : null;\n }\n return JSON.stringify(obj, toJsonReplacer, pretty);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.fromJson\n * @module ng\n * @kind function\n *\n * @description\n * Deserializes a JSON string.\n *\n * @param {string} json JSON string to deserialize.\n * @returns {Object|Array|string|number} Deserialized JSON string.\n */\nfunction fromJson(json) {\n return isString(json)\n ? JSON.parse(json)\n : json;\n}\n\n\nvar ALL_COLONS = /:/g;\nfunction timezoneToOffset(timezone, fallback) {\n // IE/Edge do not \"understand\" colon (`:`) in timezone\n timezone = timezone.replace(ALL_COLONS, '');\n var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;\n return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;\n}\n\n\nfunction addDateMinutes(date, minutes) {\n date = new Date(date.getTime());\n date.setMinutes(date.getMinutes() + minutes);\n return date;\n}\n\n\nfunction convertTimezoneToLocal(date, timezone, reverse) {\n reverse = reverse ? -1 : 1;\n var dateTimezoneOffset = date.getTimezoneOffset();\n var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));\n}\n\n\n/**\n * @returns {string} Returns the string representation of the element.\n */\nfunction startingTag(element) {\n element = jqLite(element).clone();\n try {\n // turns out IE does not let you set .html() on elements which\n // are not allowed to have children. So we just ignore it.\n element.empty();\n } catch (e) {}\n var elemHtml = jqLite('<div>').append(element).html();\n try {\n return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :\n elemHtml.\n match(/^(<[^>]+>)/)[1].\n replace(/^<([\\w\\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});\n } catch (e) {\n return lowercase(elemHtml);\n }\n\n}\n\n\n/////////////////////////////////////////////////\n\n/**\n * Tries to decode the URI component without throwing an exception.\n *\n * @private\n * @param str value potential URI component to check.\n * @returns {boolean} True if `value` can be decoded\n * with the decodeURIComponent function.\n */\nfunction tryDecodeURIComponent(value) {\n try {\n return decodeURIComponent(value);\n } catch (e) {\n // Ignore any invalid uri component\n }\n}\n\n\n/**\n * Parses an escaped url query string into key-value pairs.\n * @returns {Object.<string,boolean|Array>}\n */\nfunction parseKeyValue(/**string*/keyValue) {\n var obj = {};\n forEach((keyValue || \"\").split('&'), function(keyValue) {\n var splitPoint, key, val;\n if (keyValue) {\n key = keyValue = keyValue.replace(/\\+/g,'%20');\n splitPoint = keyValue.indexOf('=');\n if (splitPoint !== -1) {\n key = keyValue.substring(0, splitPoint);\n val = keyValue.substring(splitPoint + 1);\n }\n key = tryDecodeURIComponent(key);\n if (isDefined(key)) {\n val = isDefined(val) ? tryDecodeURIComponent(val) : true;\n if (!hasOwnProperty.call(obj, key)) {\n obj[key] = val;\n } else if (isArray(obj[key])) {\n obj[key].push(val);\n } else {\n obj[key] = [obj[key],val];\n }\n }\n }\n });\n return obj;\n}\n\nfunction toKeyValue(obj) {\n var parts = [];\n forEach(obj, function(value, key) {\n if (isArray(value)) {\n forEach(value, function(arrayValue) {\n parts.push(encodeUriQuery(key, true) +\n (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));\n });\n } else {\n parts.push(encodeUriQuery(key, true) +\n (value === true ? '' : '=' + encodeUriQuery(value, true)));\n }\n });\n return parts.length ? parts.join('&') : '';\n}\n\n\n/**\n * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path\n * segments:\n * segment = *pchar\n * pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n * pct-encoded = \"%\" HEXDIG HEXDIG\n * unreserved = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n * sub-delims = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n * / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriSegment(val) {\n return encodeUriQuery(val, true).\n replace(/%26/gi, '&').\n replace(/%3D/gi, '=').\n replace(/%2B/gi, '+');\n}\n\n\n/**\n * This method is intended for encoding *key* or *value* parts of query component. We need a custom\n * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be\n * encoded per http://tools.ietf.org/html/rfc3986:\n * query = *( pchar / \"/\" / \"?\" )\n * pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n * unreserved = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n * pct-encoded = \"%\" HEXDIG HEXDIG\n * sub-delims = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n * / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriQuery(val, pctEncodeSpaces) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%3B/gi, ';').\n replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n}\n\nvar ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];\n\nfunction getNgAttribute(element, ngAttr) {\n var attr, i, ii = ngAttrPrefixes.length;\n for (i = 0; i < ii; ++i) {\n attr = ngAttrPrefixes[i] + ngAttr;\n if (isString(attr = element.getAttribute(attr))) {\n return attr;\n }\n }\n return null;\n}\n\n/**\n * @ngdoc directive\n * @name ngApp\n * @module ng\n *\n * @element ANY\n * @param {angular.Module} ngApp an optional application\n * {@link angular.module module} name to load.\n * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be\n * created in \"strict-di\" mode. This means that the application will fail to invoke functions which\n * do not use explicit function annotation (and are thus unsuitable for minification), as described\n * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in\n * tracking down the root of these bugs.\n *\n * @description\n *\n * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive\n * designates the **root element** of the application and is typically placed near the root element\n * of the page - e.g. on the `<body>` or `<html>` tags.\n *\n * Only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`\n * found in the document will be used to define the root element to auto-bootstrap as an\n * application. To run multiple applications in an HTML document you must manually bootstrap them using\n * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other.\n *\n * You can specify an **AngularJS module** to be used as the root module for the application. This\n * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It\n * should contain the application code needed or have dependencies on other modules that will\n * contain the code. See {@link angular.module} for more information.\n *\n * In the example below if the `ngApp` directive were not placed on the `html` element then the\n * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`\n * would not be resolved to `3`.\n *\n * `ngApp` is the easiest, and most common way to bootstrap an application.\n *\n <example module=\"ngAppDemo\">\n <file name=\"index.html\">\n <div ng-controller=\"ngAppDemoController\">\n I can add: {{a}} + {{b}} = {{ a+b }}\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {\n $scope.a = 1;\n $scope.b = 2;\n });\n </file>\n </example>\n *\n * Using `ngStrictDi`, you would see something like this:\n *\n <example ng-app-included=\"true\">\n <file name=\"index.html\">\n <div ng-app=\"ngAppStrictDemo\" ng-strict-di>\n <div ng-controller=\"GoodController1\">\n I can add: {{a}} + {{b}} = {{ a+b }}\n\n <p>This renders because the controller does not fail to\n instantiate, by using explicit annotation style (see\n script.js for details)\n </p>\n </div>\n\n <div ng-controller=\"GoodController2\">\n Name: <input ng-model=\"name\"><br />\n Hello, {{name}}!\n\n <p>This renders because the controller does not fail to\n instantiate, by using explicit annotation style\n (see script.js for details)\n </p>\n </div>\n\n <div ng-controller=\"BadController\">\n I can add: {{a}} + {{b}} = {{ a+b }}\n\n <p>The controller could not be instantiated, due to relying\n on automatic function annotations (which are disabled in\n strict mode). As such, the content of this section is not\n interpolated, and there should be an error in your web console.\n </p>\n </div>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('ngAppStrictDemo', [])\n // BadController will fail to instantiate, due to relying on automatic function annotation,\n // rather than an explicit annotation\n .controller('BadController', function($scope) {\n $scope.a = 1;\n $scope.b = 2;\n })\n // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,\n // due to using explicit annotations using the array style and $inject property, respectively.\n .controller('GoodController1', ['$scope', function($scope) {\n $scope.a = 1;\n $scope.b = 2;\n }])\n .controller('GoodController2', GoodController2);\n function GoodController2($scope) {\n $scope.name = \"World\";\n }\n GoodController2.$inject = ['$scope'];\n </file>\n <file name=\"style.css\">\n div[ng-controller] {\n margin-bottom: 1em;\n -webkit-border-radius: 4px;\n border-radius: 4px;\n border: 1px solid;\n padding: .5em;\n }\n div[ng-controller^=Good] {\n border-color: #d6e9c6;\n background-color: #dff0d8;\n color: #3c763d;\n }\n div[ng-controller^=Bad] {\n border-color: #ebccd1;\n background-color: #f2dede;\n color: #a94442;\n margin-bottom: 0;\n }\n </file>\n </example>\n */\nfunction angularInit(element, bootstrap) {\n var appElement,\n module,\n config = {};\n\n // The element `element` has priority over any other element\n forEach(ngAttrPrefixes, function(prefix) {\n var name = prefix + 'app';\n\n if (!appElement && element.hasAttribute && element.hasAttribute(name)) {\n appElement = element;\n module = element.getAttribute(name);\n }\n });\n forEach(ngAttrPrefixes, function(prefix) {\n var name = prefix + 'app';\n var candidate;\n\n if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\\\:') + ']'))) {\n appElement = candidate;\n module = candidate.getAttribute(name);\n }\n });\n if (appElement) {\n config.strictDi = getNgAttribute(appElement, \"strict-di\") !== null;\n bootstrap(appElement, module ? [module] : [], config);\n }\n}\n\n/**\n * @ngdoc function\n * @name angular.bootstrap\n * @module ng\n * @description\n * Use this function to manually start up angular application.\n *\n * See: {@link guide/bootstrap Bootstrap}\n *\n * Note that Protractor based end-to-end tests cannot use this function to bootstrap manually.\n * They must use {@link ng.directive:ngApp ngApp}.\n *\n * Angular will detect if it has been loaded into the browser more than once and only allow the\n * first loaded script to be bootstrapped and will report a warning to the browser console for\n * each of the subsequent scripts. This prevents strange results in applications, where otherwise\n * multiple instances of Angular try to work on the DOM.\n *\n * ```html\n * <!doctype html>\n * <html>\n * <body>\n * <div ng-controller=\"WelcomeController\">\n * {{greeting}}\n * </div>\n *\n * <script src=\"angular.js\"></script>\n * <script>\n * var app = angular.module('demo', [])\n * .controller('WelcomeController', function($scope) {\n * $scope.greeting = 'Welcome!';\n * });\n * angular.bootstrap(document, ['demo']);\n * </script>\n * </body>\n * </html>\n * ```\n *\n * @param {DOMElement} element DOM element which is the root of angular application.\n * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.\n * Each item in the array should be the name of a predefined module or a (DI annotated)\n * function that will be invoked by the injector as a `config` block.\n * See: {@link angular.module modules}\n * @param {Object=} config an object for defining configuration options for the application. The\n * following keys are supported:\n *\n * * `strictDi` - disable automatic function annotation for the application. This is meant to\n * assist in finding bugs which break minified code. Defaults to `false`.\n *\n * @returns {auto.$injector} Returns the newly created injector for this app.\n */\nfunction bootstrap(element, modules, config) {\n if (!isObject(config)) config = {};\n var defaultConfig = {\n strictDi: false\n };\n config = extend(defaultConfig, config);\n var doBootstrap = function() {\n element = jqLite(element);\n\n if (element.injector()) {\n var tag = (element[0] === document) ? 'document' : startingTag(element);\n //Encode angle brackets to prevent input from being sanitized to empty string #8683\n throw ngMinErr(\n 'btstrpd',\n \"App already bootstrapped with this element '{0}'\",\n tag.replace(/</,'&lt;').replace(/>/,'&gt;'));\n }\n\n modules = modules || [];\n modules.unshift(['$provide', function($provide) {\n $provide.value('$rootElement', element);\n }]);\n\n if (config.debugInfoEnabled) {\n // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.\n modules.push(['$compileProvider', function($compileProvider) {\n $compileProvider.debugInfoEnabled(true);\n }]);\n }\n\n modules.unshift('ng');\n var injector = createInjector(modules, config.strictDi);\n injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',\n function bootstrapApply(scope, element, compile, injector) {\n scope.$apply(function() {\n element.data('$injector', injector);\n compile(element)(scope);\n });\n }]\n );\n return injector;\n };\n\n var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;\n var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;\n\n if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {\n config.debugInfoEnabled = true;\n window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');\n }\n\n if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {\n return doBootstrap();\n }\n\n window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');\n angular.resumeBootstrap = function(extraModules) {\n forEach(extraModules, function(module) {\n modules.push(module);\n });\n return doBootstrap();\n };\n\n if (isFunction(angular.resumeDeferredBootstrap)) {\n angular.resumeDeferredBootstrap();\n }\n}\n\n/**\n * @ngdoc function\n * @name angular.reloadWithDebugInfo\n * @module ng\n * @description\n * Use this function to reload the current application with debug information turned on.\n * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.\n *\n * See {@link ng.$compileProvider#debugInfoEnabled} for more.\n */\nfunction reloadWithDebugInfo() {\n window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;\n window.location.reload();\n}\n\n/**\n * @name angular.getTestability\n * @module ng\n * @description\n * Get the testability service for the instance of Angular on the given\n * element.\n * @param {DOMElement} element DOM element which is the root of angular application.\n */\nfunction getTestability(rootElement) {\n var injector = angular.element(rootElement).injector();\n if (!injector) {\n throw ngMinErr('test',\n 'no injector found for element argument to getTestability');\n }\n return injector.get('$$testability');\n}\n\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nvar bindJQueryFired = false;\nvar skipDestroyOnNextJQueryCleanData;\nfunction bindJQuery() {\n var originalCleanData;\n\n if (bindJQueryFired) {\n return;\n }\n\n // bind to jQuery if present;\n var jqName = jq();\n jQuery = isUndefined(jqName) ? window.jQuery : // use jQuery (if present)\n !jqName ? undefined : // use jqLite\n window[jqName]; // use jQuery specified by `ngJq`\n\n // Use jQuery if it exists with proper functionality, otherwise default to us.\n // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.\n // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older\n // versions. It will not work for sure with jQuery <1.7, though.\n if (jQuery && jQuery.fn.on) {\n jqLite = jQuery;\n extend(jQuery.fn, {\n scope: JQLitePrototype.scope,\n isolateScope: JQLitePrototype.isolateScope,\n controller: JQLitePrototype.controller,\n injector: JQLitePrototype.injector,\n inheritedData: JQLitePrototype.inheritedData\n });\n\n // All nodes removed from the DOM via various jQuery APIs like .remove()\n // are passed through jQuery.cleanData. Monkey-patch this method to fire\n // the $destroy event on all removed nodes.\n originalCleanData = jQuery.cleanData;\n jQuery.cleanData = function(elems) {\n var events;\n if (!skipDestroyOnNextJQueryCleanData) {\n for (var i = 0, elem; (elem = elems[i]) != null; i++) {\n events = jQuery._data(elem, \"events\");\n if (events && events.$destroy) {\n jQuery(elem).triggerHandler('$destroy');\n }\n }\n } else {\n skipDestroyOnNextJQueryCleanData = false;\n }\n originalCleanData(elems);\n };\n } else {\n jqLite = JQLite;\n }\n\n angular.element = jqLite;\n\n // Prevent double-proxying.\n bindJQueryFired = true;\n}\n\n/**\n * throw error if the argument is falsy.\n */\nfunction assertArg(arg, name, reason) {\n if (!arg) {\n throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n }\n return arg;\n}\n\nfunction assertArgFn(arg, name, acceptArrayAnnotation) {\n if (acceptArrayAnnotation && isArray(arg)) {\n arg = arg[arg.length - 1];\n }\n\n assertArg(isFunction(arg), name, 'not a function, got ' +\n (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));\n return arg;\n}\n\n/**\n * throw error if the name given is hasOwnProperty\n * @param {String} name the name to test\n * @param {String} context the context in which the name is used, such as module or directive\n */\nfunction assertNotHasOwnProperty(name, context) {\n if (name === 'hasOwnProperty') {\n throw ngMinErr('badname', \"hasOwnProperty is not a valid {0} name\", context);\n }\n}\n\n/**\n * Return the value accessible from the object by path. Any undefined traversals are ignored\n * @param {Object} obj starting object\n * @param {String} path path to traverse\n * @param {boolean} [bindFnToScope=true]\n * @returns {Object} value as accessible by path\n */\n//TODO(misko): this function needs to be removed\nfunction getter(obj, path, bindFnToScope) {\n if (!path) return obj;\n var keys = path.split('.');\n var key;\n var lastInstance = obj;\n var len = keys.length;\n\n for (var i = 0; i < len; i++) {\n key = keys[i];\n if (obj) {\n obj = (lastInstance = obj)[key];\n }\n }\n if (!bindFnToScope && isFunction(obj)) {\n return bind(lastInstance, obj);\n }\n return obj;\n}\n\n/**\n * Return the DOM siblings between the first and last node in the given array.\n * @param {Array} array like object\n * @returns {Array} the inputted object or a jqLite collection containing the nodes\n */\nfunction getBlockNodes(nodes) {\n // TODO(perf): update `nodes` instead of creating a new object?\n var node = nodes[0];\n var endNode = nodes[nodes.length - 1];\n var blockNodes;\n\n for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {\n if (blockNodes || nodes[i] !== node) {\n if (!blockNodes) {\n blockNodes = jqLite(slice.call(nodes, 0, i));\n }\n blockNodes.push(node);\n }\n }\n\n return blockNodes || nodes;\n}\n\n\n/**\n * Creates a new object without a prototype. This object is useful for lookup without having to\n * guard against prototypically inherited properties via hasOwnProperty.\n *\n * Related micro-benchmarks:\n * - http://jsperf.com/object-create2\n * - http://jsperf.com/proto-map-lookup/2\n * - http://jsperf.com/for-in-vs-object-keys2\n *\n * @returns {Object}\n */\nfunction createMap() {\n return Object.create(null);\n}\n\nvar NODE_TYPE_ELEMENT = 1;\nvar NODE_TYPE_ATTRIBUTE = 2;\nvar NODE_TYPE_TEXT = 3;\nvar NODE_TYPE_COMMENT = 8;\nvar NODE_TYPE_DOCUMENT = 9;\nvar NODE_TYPE_DOCUMENT_FRAGMENT = 11;\n\n/**\n * @ngdoc type\n * @name angular.Module\n * @module ng\n * @description\n *\n * Interface for configuring angular {@link angular.module modules}.\n */\n\nfunction setupModuleLoader(window) {\n\n var $injectorMinErr = minErr('$injector');\n var ngMinErr = minErr('ng');\n\n function ensure(obj, name, factory) {\n return obj[name] || (obj[name] = factory());\n }\n\n var angular = ensure(window, 'angular', Object);\n\n // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap\n angular.$$minErr = angular.$$minErr || minErr;\n\n return ensure(angular, 'module', function() {\n /** @type {Object.<string, angular.Module>} */\n var modules = {};\n\n /**\n * @ngdoc function\n * @name angular.module\n * @module ng\n * @description\n *\n * The `angular.module` is a global place for creating, registering and retrieving Angular\n * modules.\n * All modules (angular core or 3rd party) that should be available to an application must be\n * registered using this mechanism.\n *\n * Passing one argument retrieves an existing {@link angular.Module},\n * whereas passing more than one argument creates a new {@link angular.Module}\n *\n *\n * # Module\n *\n * A module is a collection of services, directives, controllers, filters, and configuration information.\n * `angular.module` is used to configure the {@link auto.$injector $injector}.\n *\n * ```js\n * // Create a new module\n * var myModule = angular.module('myModule', []);\n *\n * // register a new service\n * myModule.value('appName', 'MyCoolApp');\n *\n * // configure existing services inside initialization blocks.\n * myModule.config(['$locationProvider', function($locationProvider) {\n * // Configure existing providers\n * $locationProvider.hashPrefix('!');\n * }]);\n * ```\n *\n * Then you can create an injector and load your modules like this:\n *\n * ```js\n * var injector = angular.injector(['ng', 'myModule'])\n * ```\n *\n * However it's more likely that you'll just use\n * {@link ng.directive:ngApp ngApp} or\n * {@link angular.bootstrap} to simplify this process for you.\n *\n * @param {!string} name The name of the module to create or retrieve.\n * @param {!Array.<string>=} requires If specified then new module is being created. If\n * unspecified then the module is being retrieved for further configuration.\n * @param {Function=} configFn Optional configuration function for the module. Same as\n * {@link angular.Module#config Module#config()}.\n * @returns {angular.Module} new module with the {@link angular.Module} api.\n */\n return function module(name, requires, configFn) {\n var assertNotHasOwnProperty = function(name, context) {\n if (name === 'hasOwnProperty') {\n throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);\n }\n };\n\n assertNotHasOwnProperty(name, 'module');\n if (requires && modules.hasOwnProperty(name)) {\n modules[name] = null;\n }\n return ensure(modules, name, function() {\n if (!requires) {\n throw $injectorMinErr('nomod', \"Module '{0}' is not available! You either misspelled \" +\n \"the module name or forgot to load it. If registering a module ensure that you \" +\n \"specify the dependencies as the second argument.\", name);\n }\n\n /** @type {!Array.<Array.<*>>} */\n var invokeQueue = [];\n\n /** @type {!Array.<Function>} */\n var configBlocks = [];\n\n /** @type {!Array.<Function>} */\n var runBlocks = [];\n\n var config = invokeLater('$injector', 'invoke', 'push', configBlocks);\n\n /** @type {angular.Module} */\n var moduleInstance = {\n // Private state\n _invokeQueue: invokeQueue,\n _configBlocks: configBlocks,\n _runBlocks: runBlocks,\n\n /**\n * @ngdoc property\n * @name angular.Module#requires\n * @module ng\n *\n * @description\n * Holds the list of modules which the injector will load before the current module is\n * loaded.\n */\n requires: requires,\n\n /**\n * @ngdoc property\n * @name angular.Module#name\n * @module ng\n *\n * @description\n * Name of the module.\n */\n name: name,\n\n\n /**\n * @ngdoc method\n * @name angular.Module#provider\n * @module ng\n * @param {string} name service name\n * @param {Function} providerType Construction function for creating new instance of the\n * service.\n * @description\n * See {@link auto.$provide#provider $provide.provider()}.\n */\n provider: invokeLaterAndSetModuleName('$provide', 'provider'),\n\n /**\n * @ngdoc method\n * @name angular.Module#factory\n * @module ng\n * @param {string} name service name\n * @param {Function} providerFunction Function for creating new instance of the service.\n * @description\n * See {@link auto.$provide#factory $provide.factory()}.\n */\n factory: invokeLaterAndSetModuleName('$provide', 'factory'),\n\n /**\n * @ngdoc method\n * @name angular.Module#service\n * @module ng\n * @param {string} name service name\n * @param {Function} constructor A constructor function that will be instantiated.\n * @description\n * See {@link auto.$provide#service $provide.service()}.\n */\n service: invokeLaterAndSetModuleName('$provide', 'service'),\n\n /**\n * @ngdoc method\n * @name angular.Module#value\n * @module ng\n * @param {string} name service name\n * @param {*} object Service instance object.\n * @description\n * See {@link auto.$provide#value $provide.value()}.\n */\n value: invokeLater('$provide', 'value'),\n\n /**\n * @ngdoc method\n * @name angular.Module#constant\n * @module ng\n * @param {string} name constant name\n * @param {*} object Constant value.\n * @description\n * Because the constants are fixed, they get applied before other provide methods.\n * See {@link auto.$provide#constant $provide.constant()}.\n */\n constant: invokeLater('$provide', 'constant', 'unshift'),\n\n /**\n * @ngdoc method\n * @name angular.Module#decorator\n * @module ng\n * @param {string} name The name of the service to decorate.\n * @param {Function} decorFn This function will be invoked when the service needs to be\n * instantiated and should return the decorated service instance.\n * @description\n * See {@link auto.$provide#decorator $provide.decorator()}.\n */\n decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),\n\n /**\n * @ngdoc method\n * @name angular.Module#animation\n * @module ng\n * @param {string} name animation name\n * @param {Function} animationFactory Factory function for creating new instance of an\n * animation.\n * @description\n *\n * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.\n *\n *\n * Defines an animation hook that can be later used with\n * {@link $animate $animate} service and directives that use this service.\n *\n * ```js\n * module.animation('.animation-name', function($inject1, $inject2) {\n * return {\n * eventName : function(element, done) {\n * //code to run the animation\n * //once complete, then run done()\n * return function cancellationFunction(element) {\n * //code to cancel the animation\n * }\n * }\n * }\n * })\n * ```\n *\n * See {@link ng.$animateProvider#register $animateProvider.register()} and\n * {@link ngAnimate ngAnimate module} for more information.\n */\n animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),\n\n /**\n * @ngdoc method\n * @name angular.Module#filter\n * @module ng\n * @param {string} name Filter name - this must be a valid angular expression identifier\n * @param {Function} filterFactory Factory function for creating new instance of filter.\n * @description\n * See {@link ng.$filterProvider#register $filterProvider.register()}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n * (`myapp_subsection_filterx`).\n * </div>\n */\n filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),\n\n /**\n * @ngdoc method\n * @name angular.Module#controller\n * @module ng\n * @param {string|Object} name Controller name, or an object map of controllers where the\n * keys are the names and the values are the constructors.\n * @param {Function} constructor Controller constructor function.\n * @description\n * See {@link ng.$controllerProvider#register $controllerProvider.register()}.\n */\n controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),\n\n /**\n * @ngdoc method\n * @name angular.Module#directive\n * @module ng\n * @param {string|Object} name Directive name, or an object map of directives where the\n * keys are the names and the values are the factories.\n * @param {Function} directiveFactory Factory function for creating new instance of\n * directives.\n * @description\n * See {@link ng.$compileProvider#directive $compileProvider.directive()}.\n */\n directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),\n\n /**\n * @ngdoc method\n * @name angular.Module#config\n * @module ng\n * @param {Function} configFn Execute this function on module load. Useful for service\n * configuration.\n * @description\n * Use this method to register work which needs to be performed on module loading.\n * For more about how to configure services, see\n * {@link providers#provider-recipe Provider Recipe}.\n */\n config: config,\n\n /**\n * @ngdoc method\n * @name angular.Module#run\n * @module ng\n * @param {Function} initializationFn Execute this function after injector creation.\n * Useful for application initialization.\n * @description\n * Use this method to register work which should be performed when the injector is done\n * loading all modules.\n */\n run: function(block) {\n runBlocks.push(block);\n return this;\n }\n };\n\n if (configFn) {\n config(configFn);\n }\n\n return moduleInstance;\n\n /**\n * @param {string} provider\n * @param {string} method\n * @param {String=} insertMethod\n * @returns {angular.Module}\n */\n function invokeLater(provider, method, insertMethod, queue) {\n if (!queue) queue = invokeQueue;\n return function() {\n queue[insertMethod || 'push']([provider, method, arguments]);\n return moduleInstance;\n };\n }\n\n /**\n * @param {string} provider\n * @param {string} method\n * @returns {angular.Module}\n */\n function invokeLaterAndSetModuleName(provider, method) {\n return function(recipeName, factoryFunction) {\n if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;\n invokeQueue.push([provider, method, arguments]);\n return moduleInstance;\n };\n }\n });\n };\n });\n\n}\n\n/* global: toDebugString: true */\n\nfunction serializeObject(obj) {\n var seen = [];\n\n return JSON.stringify(obj, function(key, val) {\n val = toJsonReplacer(key, val);\n if (isObject(val)) {\n\n if (seen.indexOf(val) >= 0) return '...';\n\n seen.push(val);\n }\n return val;\n });\n}\n\nfunction toDebugString(obj) {\n if (typeof obj === 'function') {\n return obj.toString().replace(/ \\{[\\s\\S]*$/, '');\n } else if (isUndefined(obj)) {\n return 'undefined';\n } else if (typeof obj !== 'string') {\n return serializeObject(obj);\n }\n return obj;\n}\n\n/* global angularModule: true,\n version: true,\n\n $CompileProvider,\n\n htmlAnchorDirective,\n inputDirective,\n inputDirective,\n formDirective,\n scriptDirective,\n selectDirective,\n styleDirective,\n optionDirective,\n ngBindDirective,\n ngBindHtmlDirective,\n ngBindTemplateDirective,\n ngClassDirective,\n ngClassEvenDirective,\n ngClassOddDirective,\n ngCloakDirective,\n ngControllerDirective,\n ngFormDirective,\n ngHideDirective,\n ngIfDirective,\n ngIncludeDirective,\n ngIncludeFillContentDirective,\n ngInitDirective,\n ngNonBindableDirective,\n ngPluralizeDirective,\n ngRepeatDirective,\n ngShowDirective,\n ngStyleDirective,\n ngSwitchDirective,\n ngSwitchWhenDirective,\n ngSwitchDefaultDirective,\n ngOptionsDirective,\n ngTranscludeDirective,\n ngModelDirective,\n ngListDirective,\n ngChangeDirective,\n patternDirective,\n patternDirective,\n requiredDirective,\n requiredDirective,\n minlengthDirective,\n minlengthDirective,\n maxlengthDirective,\n maxlengthDirective,\n ngValueDirective,\n ngModelOptionsDirective,\n ngAttributeAliasDirectives,\n ngEventDirectives,\n\n $AnchorScrollProvider,\n $AnimateProvider,\n $CoreAnimateCssProvider,\n $$CoreAnimateJsProvider,\n $$CoreAnimateQueueProvider,\n $$AnimateRunnerFactoryProvider,\n $$AnimateAsyncRunFactoryProvider,\n $BrowserProvider,\n $CacheFactoryProvider,\n $ControllerProvider,\n $DocumentProvider,\n $ExceptionHandlerProvider,\n $FilterProvider,\n $$ForceReflowProvider,\n $InterpolateProvider,\n $IntervalProvider,\n $$HashMapProvider,\n $HttpProvider,\n $HttpParamSerializerProvider,\n $HttpParamSerializerJQLikeProvider,\n $HttpBackendProvider,\n $xhrFactoryProvider,\n $LocationProvider,\n $LogProvider,\n $ParseProvider,\n $RootScopeProvider,\n $QProvider,\n $$QProvider,\n $$SanitizeUriProvider,\n $SceProvider,\n $SceDelegateProvider,\n $SnifferProvider,\n $TemplateCacheProvider,\n $TemplateRequestProvider,\n $$TestabilityProvider,\n $TimeoutProvider,\n $$RAFProvider,\n $WindowProvider,\n $$jqLiteProvider,\n $$CookieReaderProvider\n*/\n\n\n/**\n * @ngdoc object\n * @name angular.version\n * @module ng\n * @description\n * An object that contains information about the current AngularJS version.\n *\n * This object has the following properties:\n *\n * - `full` `{string}` Full version string, such as \"0.9.18\".\n * - `major` `{number}` Major version number, such as \"0\".\n * - `minor` `{number}` Minor version number, such as \"9\".\n * - `dot` `{number}` Dot version number, such as \"18\".\n * - `codeName` `{string}` Code name of the release, such as \"jiggling-armfat\".\n */\nvar version = {\n full: '1.4.14', // all of these placeholder strings will be replaced by grunt's\n major: 1, // package task\n minor: 4,\n dot: 14,\n codeName: 'material-distinction'\n};\n\n\nfunction publishExternalAPI(angular) {\n extend(angular, {\n 'bootstrap': bootstrap,\n 'copy': copy,\n 'extend': extend,\n 'merge': merge,\n 'equals': equals,\n 'element': jqLite,\n 'forEach': forEach,\n 'injector': createInjector,\n 'noop': noop,\n 'bind': bind,\n 'toJson': toJson,\n 'fromJson': fromJson,\n 'identity': identity,\n 'isUndefined': isUndefined,\n 'isDefined': isDefined,\n 'isString': isString,\n 'isFunction': isFunction,\n 'isObject': isObject,\n 'isNumber': isNumber,\n 'isElement': isElement,\n 'isArray': isArray,\n 'version': version,\n 'isDate': isDate,\n 'lowercase': lowercase,\n 'uppercase': uppercase,\n 'callbacks': {counter: 0},\n 'getTestability': getTestability,\n '$$minErr': minErr,\n '$$csp': csp,\n 'reloadWithDebugInfo': reloadWithDebugInfo\n });\n\n angularModule = setupModuleLoader(window);\n\n angularModule('ng', ['ngLocale'], ['$provide',\n function ngModule($provide) {\n // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.\n $provide.provider({\n $$sanitizeUri: $$SanitizeUriProvider\n });\n $provide.provider('$compile', $CompileProvider).\n directive({\n a: htmlAnchorDirective,\n input: inputDirective,\n textarea: inputDirective,\n form: formDirective,\n script: scriptDirective,\n select: selectDirective,\n style: styleDirective,\n option: optionDirective,\n ngBind: ngBindDirective,\n ngBindHtml: ngBindHtmlDirective,\n ngBindTemplate: ngBindTemplateDirective,\n ngClass: ngClassDirective,\n ngClassEven: ngClassEvenDirective,\n ngClassOdd: ngClassOddDirective,\n ngCloak: ngCloakDirective,\n ngController: ngControllerDirective,\n ngForm: ngFormDirective,\n ngHide: ngHideDirective,\n ngIf: ngIfDirective,\n ngInclude: ngIncludeDirective,\n ngInit: ngInitDirective,\n ngNonBindable: ngNonBindableDirective,\n ngPluralize: ngPluralizeDirective,\n ngRepeat: ngRepeatDirective,\n ngShow: ngShowDirective,\n ngStyle: ngStyleDirective,\n ngSwitch: ngSwitchDirective,\n ngSwitchWhen: ngSwitchWhenDirective,\n ngSwitchDefault: ngSwitchDefaultDirective,\n ngOptions: ngOptionsDirective,\n ngTransclude: ngTranscludeDirective,\n ngModel: ngModelDirective,\n ngList: ngListDirective,\n ngChange: ngChangeDirective,\n pattern: patternDirective,\n ngPattern: patternDirective,\n required: requiredDirective,\n ngRequired: requiredDirective,\n minlength: minlengthDirective,\n ngMinlength: minlengthDirective,\n maxlength: maxlengthDirective,\n ngMaxlength: maxlengthDirective,\n ngValue: ngValueDirective,\n ngModelOptions: ngModelOptionsDirective\n }).\n directive({\n ngInclude: ngIncludeFillContentDirective\n }).\n directive(ngAttributeAliasDirectives).\n directive(ngEventDirectives);\n $provide.provider({\n $anchorScroll: $AnchorScrollProvider,\n $animate: $AnimateProvider,\n $animateCss: $CoreAnimateCssProvider,\n $$animateJs: $$CoreAnimateJsProvider,\n $$animateQueue: $$CoreAnimateQueueProvider,\n $$AnimateRunner: $$AnimateRunnerFactoryProvider,\n $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,\n $browser: $BrowserProvider,\n $cacheFactory: $CacheFactoryProvider,\n $controller: $ControllerProvider,\n $document: $DocumentProvider,\n $exceptionHandler: $ExceptionHandlerProvider,\n $filter: $FilterProvider,\n $$forceReflow: $$ForceReflowProvider,\n $interpolate: $InterpolateProvider,\n $interval: $IntervalProvider,\n $http: $HttpProvider,\n $httpParamSerializer: $HttpParamSerializerProvider,\n $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,\n $httpBackend: $HttpBackendProvider,\n $xhrFactory: $xhrFactoryProvider,\n $location: $LocationProvider,\n $log: $LogProvider,\n $parse: $ParseProvider,\n $rootScope: $RootScopeProvider,\n $q: $QProvider,\n $$q: $$QProvider,\n $sce: $SceProvider,\n $sceDelegate: $SceDelegateProvider,\n $sniffer: $SnifferProvider,\n $templateCache: $TemplateCacheProvider,\n $templateRequest: $TemplateRequestProvider,\n $$testability: $$TestabilityProvider,\n $timeout: $TimeoutProvider,\n $window: $WindowProvider,\n $$rAF: $$RAFProvider,\n $$jqLite: $$jqLiteProvider,\n $$HashMap: $$HashMapProvider,\n $$cookieReader: $$CookieReaderProvider\n });\n }\n ]);\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n * Any commits to this file should be reviewed with security in mind. *\n * Changes to this file can potentially create security vulnerabilities. *\n * An approval from 2 Core members with history of modifying *\n * this file is required. *\n * *\n * Does the change somehow allow for arbitrary javascript to be executed? *\n * Or allows for someone to change the prototype of built-in objects? *\n * Or gives undesired access to variables likes document or window? *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* global JQLitePrototype: true,\n addEventListenerFn: true,\n removeEventListenerFn: true,\n BOOLEAN_ATTR: true,\n ALIASED_ATTR: true,\n*/\n\n//////////////////////////////////\n//JQLite\n//////////////////////////////////\n\n/**\n * @ngdoc function\n * @name angular.element\n * @module ng\n * @kind function\n *\n * @description\n * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.\n *\n * If jQuery is available, `angular.element` is an alias for the\n * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`\n * delegates to Angular's built-in subset of jQuery, called \"jQuery lite\" or **jqLite**.\n *\n * jqLite is a tiny, API-compatible subset of jQuery that allows\n * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most\n * commonly needed functionality with the goal of having a very small footprint.\n *\n * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the\n * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a\n * specific version of jQuery if multiple versions exist on the page.\n *\n * <div class=\"alert alert-info\">**Note:** All element references in Angular are always wrapped with jQuery or\n * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>\n *\n * <div class=\"alert alert-warning\">**Note:** Keep in mind that this function will not find elements\n * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`\n * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>\n *\n * ## Angular's jqLite\n * jqLite provides only the following jQuery methods:\n *\n * - [`addClass()`](http://api.jquery.com/addClass/)\n * - [`after()`](http://api.jquery.com/after/)\n * - [`append()`](http://api.jquery.com/append/)\n * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters\n * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData\n * - [`children()`](http://api.jquery.com/children/) - Does not support selectors\n * - [`clone()`](http://api.jquery.com/clone/)\n * - [`contents()`](http://api.jquery.com/contents/)\n * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.\n * As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.\n * - [`data()`](http://api.jquery.com/data/)\n * - [`detach()`](http://api.jquery.com/detach/)\n * - [`empty()`](http://api.jquery.com/empty/)\n * - [`eq()`](http://api.jquery.com/eq/)\n * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name\n * - [`hasClass()`](http://api.jquery.com/hasClass/)\n * - [`html()`](http://api.jquery.com/html/)\n * - [`next()`](http://api.jquery.com/next/) - Does not support selectors\n * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData\n * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter\n * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors\n * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors\n * - [`prepend()`](http://api.jquery.com/prepend/)\n * - [`prop()`](http://api.jquery.com/prop/)\n * - [`ready()`](http://api.jquery.com/ready/)\n * - [`remove()`](http://api.jquery.com/remove/)\n * - [`removeAttr()`](http://api.jquery.com/removeAttr/)\n * - [`removeClass()`](http://api.jquery.com/removeClass/)\n * - [`removeData()`](http://api.jquery.com/removeData/)\n * - [`replaceWith()`](http://api.jquery.com/replaceWith/)\n * - [`text()`](http://api.jquery.com/text/)\n * - [`toggleClass()`](http://api.jquery.com/toggleClass/)\n * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.\n * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter\n * - [`val()`](http://api.jquery.com/val/)\n * - [`wrap()`](http://api.jquery.com/wrap/)\n *\n * ## jQuery/jqLite Extras\n * Angular also provides the following additional methods and events to both jQuery and jqLite:\n *\n * ### Events\n * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event\n * on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM\n * element before it is removed.\n *\n * ### Methods\n * - `controller(name)` - retrieves the controller of the current element or its parent. By default\n * retrieves controller associated with the `ngController` directive. If `name` is provided as\n * camelCase directive name, then the controller for this directive will be retrieved (e.g.\n * `'ngModel'`).\n * - `injector()` - retrieves the injector of the current element or its parent.\n * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current\n * element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to\n * be enabled.\n * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the\n * current element. This getter should be used only on elements that contain a directive which starts a new isolate\n * scope. Calling `scope()` on this element always returns the original non-isolate scope.\n * Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.\n * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top\n * parent element is reached.\n *\n * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.\n * @returns {Object} jQuery object.\n */\n\nJQLite.expando = 'ng339';\n\nvar jqCache = JQLite.cache = {},\n jqId = 1,\n addEventListenerFn = function(element, type, fn) {\n element.addEventListener(type, fn, false);\n },\n removeEventListenerFn = function(element, type, fn) {\n element.removeEventListener(type, fn, false);\n };\n\n/*\n * !!! This is an undocumented \"private\" function !!!\n */\nJQLite._data = function(node) {\n //jQuery always returns an object on cache miss\n return this.cache[node[this.expando]] || {};\n};\n\nfunction jqNextId() { return ++jqId; }\n\n\nvar SPECIAL_CHARS_REGEXP = /([\\:\\-\\_]+(.))/g;\nvar MOZ_HACK_REGEXP = /^moz([A-Z])/;\nvar MOUSE_EVENT_MAP= { mouseleave: \"mouseout\", mouseenter: \"mouseover\"};\nvar jqLiteMinErr = minErr('jqLite');\n\n/**\n * Converts snake_case to camelCase.\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction camelCase(name) {\n return name.\n replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {\n return offset ? letter.toUpperCase() : letter;\n }).\n replace(MOZ_HACK_REGEXP, 'Moz$1');\n}\n\nvar SINGLE_TAG_REGEXP = /^<([\\w-]+)\\s*\\/?>(?:<\\/\\1>|)$/;\nvar HTML_REGEXP = /<|&#?\\w+;/;\nvar TAG_NAME_REGEXP = /<([\\w:-]+)/;\nvar XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi;\n\nvar wrapMap = {\n 'option': [1, '<select multiple=\"multiple\">', '</select>'],\n\n 'thead': [1, '<table>', '</table>'],\n 'col': [2, '<table><colgroup>', '</colgroup></table>'],\n 'tr': [2, '<table><tbody>', '</tbody></table>'],\n 'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n '_default': [0, \"\", \"\"]\n};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n\nfunction jqLiteIsTextNode(html) {\n return !HTML_REGEXP.test(html);\n}\n\nfunction jqLiteAcceptsData(node) {\n // The window object can accept data but has no nodeType\n // Otherwise we are only interested in elements (1) and documents (9)\n var nodeType = node.nodeType;\n return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;\n}\n\nfunction jqLiteHasData(node) {\n for (var key in jqCache[node.ng339]) {\n return true;\n }\n return false;\n}\n\nfunction jqLiteBuildFragment(html, context) {\n var tmp, tag, wrap,\n fragment = context.createDocumentFragment(),\n nodes = [], i;\n\n if (jqLiteIsTextNode(html)) {\n // Convert non-html into a text node\n nodes.push(context.createTextNode(html));\n } else {\n // Convert html into DOM nodes\n tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\n wrap = wrapMap[tag] || wrapMap._default;\n tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\n\n // Descend through wrappers to the right content\n i = wrap[0];\n while (i--) {\n tmp = tmp.lastChild;\n }\n\n nodes = concat(nodes, tmp.childNodes);\n\n tmp = fragment.firstChild;\n tmp.textContent = \"\";\n }\n\n // Remove wrapper from fragment\n fragment.textContent = \"\";\n fragment.innerHTML = \"\"; // Clear inner HTML\n forEach(nodes, function(node) {\n fragment.appendChild(node);\n });\n\n return fragment;\n}\n\nfunction jqLiteParseHTML(html, context) {\n context = context || document;\n var parsed;\n\n if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {\n return [context.createElement(parsed[1])];\n }\n\n if ((parsed = jqLiteBuildFragment(html, context))) {\n return parsed.childNodes;\n }\n\n return [];\n}\n\nfunction jqLiteWrapNode(node, wrapper) {\n var parent = node.parentNode;\n\n if (parent) {\n parent.replaceChild(wrapper, node);\n }\n\n wrapper.appendChild(node);\n}\n\n\n// IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\nvar jqLiteContains = Node.prototype.contains || function(arg) {\n // jshint bitwise: false\n return !!(this.compareDocumentPosition(arg) & 16);\n // jshint bitwise: true\n};\n\n/////////////////////////////////////////////\nfunction JQLite(element) {\n if (element instanceof JQLite) {\n return element;\n }\n\n var argIsString;\n\n if (isString(element)) {\n element = trim(element);\n argIsString = true;\n }\n if (!(this instanceof JQLite)) {\n if (argIsString && element.charAt(0) != '<') {\n throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');\n }\n return new JQLite(element);\n }\n\n if (argIsString) {\n jqLiteAddNodes(this, jqLiteParseHTML(element));\n } else {\n jqLiteAddNodes(this, element);\n }\n}\n\nfunction jqLiteClone(element) {\n return element.cloneNode(true);\n}\n\nfunction jqLiteDealoc(element, onlyDescendants) {\n if (!onlyDescendants) jqLiteRemoveData(element);\n\n if (element.querySelectorAll) {\n var descendants = element.querySelectorAll('*');\n for (var i = 0, l = descendants.length; i < l; i++) {\n jqLiteRemoveData(descendants[i]);\n }\n }\n}\n\nfunction jqLiteOff(element, type, fn, unsupported) {\n if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');\n\n var expandoStore = jqLiteExpandoStore(element);\n var events = expandoStore && expandoStore.events;\n var handle = expandoStore && expandoStore.handle;\n\n if (!handle) return; //no listeners registered\n\n if (!type) {\n for (type in events) {\n if (type !== '$destroy') {\n removeEventListenerFn(element, type, handle);\n }\n delete events[type];\n }\n } else {\n\n var removeHandler = function(type) {\n var listenerFns = events[type];\n if (isDefined(fn)) {\n arrayRemove(listenerFns || [], fn);\n }\n if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {\n removeEventListenerFn(element, type, handle);\n delete events[type];\n }\n };\n\n forEach(type.split(' '), function(type) {\n removeHandler(type);\n if (MOUSE_EVENT_MAP[type]) {\n removeHandler(MOUSE_EVENT_MAP[type]);\n }\n });\n }\n}\n\nfunction jqLiteRemoveData(element, name) {\n var expandoId = element.ng339;\n var expandoStore = expandoId && jqCache[expandoId];\n\n if (expandoStore) {\n if (name) {\n delete expandoStore.data[name];\n return;\n }\n\n if (expandoStore.handle) {\n if (expandoStore.events.$destroy) {\n expandoStore.handle({}, '$destroy');\n }\n jqLiteOff(element);\n }\n delete jqCache[expandoId];\n element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it\n }\n}\n\n\nfunction jqLiteExpandoStore(element, createIfNecessary) {\n var expandoId = element.ng339,\n expandoStore = expandoId && jqCache[expandoId];\n\n if (createIfNecessary && !expandoStore) {\n element.ng339 = expandoId = jqNextId();\n expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};\n }\n\n return expandoStore;\n}\n\n\nfunction jqLiteData(element, key, value) {\n if (jqLiteAcceptsData(element)) {\n\n var isSimpleSetter = isDefined(value);\n var isSimpleGetter = !isSimpleSetter && key && !isObject(key);\n var massGetter = !key;\n var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);\n var data = expandoStore && expandoStore.data;\n\n if (isSimpleSetter) { // data('key', value)\n data[key] = value;\n } else {\n if (massGetter) { // data()\n return data;\n } else {\n if (isSimpleGetter) { // data('key')\n // don't force creation of expandoStore if it doesn't exist yet\n return data && data[key];\n } else { // mass-setter: data({key1: val1, key2: val2})\n extend(data, key);\n }\n }\n }\n }\n}\n\nfunction jqLiteHasClass(element, selector) {\n if (!element.getAttribute) return false;\n return ((\" \" + (element.getAttribute('class') || '') + \" \").replace(/[\\n\\t]/g, \" \").\n indexOf(\" \" + selector + \" \") > -1);\n}\n\nfunction jqLiteRemoveClass(element, cssClasses) {\n if (cssClasses && element.setAttribute) {\n forEach(cssClasses.split(' '), function(cssClass) {\n element.setAttribute('class', trim(\n (\" \" + (element.getAttribute('class') || '') + \" \")\n .replace(/[\\n\\t]/g, \" \")\n .replace(\" \" + trim(cssClass) + \" \", \" \"))\n );\n });\n }\n}\n\nfunction jqLiteAddClass(element, cssClasses) {\n if (cssClasses && element.setAttribute) {\n var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')\n .replace(/[\\n\\t]/g, \" \");\n\n forEach(cssClasses.split(' '), function(cssClass) {\n cssClass = trim(cssClass);\n if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n existingClasses += cssClass + ' ';\n }\n });\n\n element.setAttribute('class', trim(existingClasses));\n }\n}\n\n\nfunction jqLiteAddNodes(root, elements) {\n // THIS CODE IS VERY HOT. Don't make changes without benchmarking.\n\n if (elements) {\n\n // if a Node (the most common case)\n if (elements.nodeType) {\n root[root.length++] = elements;\n } else {\n var length = elements.length;\n\n // if an Array or NodeList and not a Window\n if (typeof length === 'number' && elements.window !== elements) {\n if (length) {\n for (var i = 0; i < length; i++) {\n root[root.length++] = elements[i];\n }\n }\n } else {\n root[root.length++] = elements;\n }\n }\n }\n}\n\n\nfunction jqLiteController(element, name) {\n return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');\n}\n\nfunction jqLiteInheritedData(element, name, value) {\n // if element is the document object work with the html element instead\n // this makes $(document).scope() possible\n if (element.nodeType == NODE_TYPE_DOCUMENT) {\n element = element.documentElement;\n }\n var names = isArray(name) ? name : [name];\n\n while (element) {\n for (var i = 0, ii = names.length; i < ii; i++) {\n if (isDefined(value = jqLite.data(element, names[i]))) return value;\n }\n\n // If dealing with a document fragment node with a host element, and no parent, use the host\n // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM\n // to lookup parent controllers.\n element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);\n }\n}\n\nfunction jqLiteEmpty(element) {\n jqLiteDealoc(element, true);\n while (element.firstChild) {\n element.removeChild(element.firstChild);\n }\n}\n\nfunction jqLiteRemove(element, keepData) {\n if (!keepData) jqLiteDealoc(element);\n var parent = element.parentNode;\n if (parent) parent.removeChild(element);\n}\n\n\nfunction jqLiteDocumentLoaded(action, win) {\n win = win || window;\n if (win.document.readyState === 'complete') {\n // Force the action to be run async for consistent behaviour\n // from the action's point of view\n // i.e. it will definitely not be in a $apply\n win.setTimeout(action);\n } else {\n // No need to unbind this handler as load is only ever called once\n jqLite(win).on('load', action);\n }\n}\n\n//////////////////////////////////////////\n// Functions which are declared directly.\n//////////////////////////////////////////\nvar JQLitePrototype = JQLite.prototype = {\n ready: function(fn) {\n var fired = false;\n\n function trigger() {\n if (fired) return;\n fired = true;\n fn();\n }\n\n // check if document is already loaded\n if (document.readyState === 'complete') {\n setTimeout(trigger);\n } else {\n this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9\n // we can not use jqLite since we are not done loading and jQuery could be loaded later.\n // jshint -W064\n JQLite(window).on('load', trigger); // fallback to window.onload for others\n // jshint +W064\n }\n },\n toString: function() {\n var value = [];\n forEach(this, function(e) { value.push('' + e);});\n return '[' + value.join(', ') + ']';\n },\n\n eq: function(index) {\n return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);\n },\n\n length: 0,\n push: push,\n sort: [].sort,\n splice: [].splice\n};\n\n//////////////////////////////////////////\n// Functions iterating getter/setters.\n// these functions return self on setter and\n// value on get.\n//////////////////////////////////////////\nvar BOOLEAN_ATTR = {};\nforEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {\n BOOLEAN_ATTR[lowercase(value)] = value;\n});\nvar BOOLEAN_ELEMENTS = {};\nforEach('input,select,option,textarea,button,form,details'.split(','), function(value) {\n BOOLEAN_ELEMENTS[value] = true;\n});\nvar ALIASED_ATTR = {\n 'ngMinlength': 'minlength',\n 'ngMaxlength': 'maxlength',\n 'ngMin': 'min',\n 'ngMax': 'max',\n 'ngPattern': 'pattern'\n};\n\nfunction getBooleanAttrName(element, name) {\n // check dom last since we will most likely fail on name\n var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];\n\n // booleanAttr is here twice to minimize DOM access\n return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;\n}\n\nfunction getAliasedAttrName(name) {\n return ALIASED_ATTR[name];\n}\n\nforEach({\n data: jqLiteData,\n removeData: jqLiteRemoveData,\n hasData: jqLiteHasData\n}, function(fn, name) {\n JQLite[name] = fn;\n});\n\nforEach({\n data: jqLiteData,\n inheritedData: jqLiteInheritedData,\n\n scope: function(element) {\n // Can't use jqLiteData here directly so we stay compatible with jQuery!\n return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);\n },\n\n isolateScope: function(element) {\n // Can't use jqLiteData here directly so we stay compatible with jQuery!\n return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');\n },\n\n controller: jqLiteController,\n\n injector: function(element) {\n return jqLiteInheritedData(element, '$injector');\n },\n\n removeAttr: function(element, name) {\n element.removeAttribute(name);\n },\n\n hasClass: jqLiteHasClass,\n\n css: function(element, name, value) {\n name = camelCase(name);\n\n if (isDefined(value)) {\n element.style[name] = value;\n } else {\n return element.style[name];\n }\n },\n\n attr: function(element, name, value) {\n var nodeType = element.nodeType;\n if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {\n return;\n }\n var lowercasedName = lowercase(name);\n if (BOOLEAN_ATTR[lowercasedName]) {\n if (isDefined(value)) {\n if (!!value) {\n element[name] = true;\n element.setAttribute(name, lowercasedName);\n } else {\n element[name] = false;\n element.removeAttribute(lowercasedName);\n }\n } else {\n return (element[name] ||\n (element.attributes.getNamedItem(name) || noop).specified)\n ? lowercasedName\n : undefined;\n }\n } else if (isDefined(value)) {\n element.setAttribute(name, value);\n } else if (element.getAttribute) {\n // the extra argument \"2\" is to get the right thing for a.href in IE, see jQuery code\n // some elements (e.g. Document) don't have get attribute, so return undefined\n var ret = element.getAttribute(name, 2);\n // normalize non-existing attributes to undefined (as jQuery)\n return ret === null ? undefined : ret;\n }\n },\n\n prop: function(element, name, value) {\n if (isDefined(value)) {\n element[name] = value;\n } else {\n return element[name];\n }\n },\n\n text: (function() {\n getText.$dv = '';\n return getText;\n\n function getText(element, value) {\n if (isUndefined(value)) {\n var nodeType = element.nodeType;\n return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';\n }\n element.textContent = value;\n }\n })(),\n\n val: function(element, value) {\n if (isUndefined(value)) {\n if (element.multiple && nodeName_(element) === 'select') {\n var result = [];\n forEach(element.options, function(option) {\n if (option.selected) {\n result.push(option.value || option.text);\n }\n });\n return result.length === 0 ? null : result;\n }\n return element.value;\n }\n element.value = value;\n },\n\n html: function(element, value) {\n if (isUndefined(value)) {\n return element.innerHTML;\n }\n jqLiteDealoc(element, true);\n element.innerHTML = value;\n },\n\n empty: jqLiteEmpty\n}, function(fn, name) {\n /**\n * Properties: writes return selection, reads return first value\n */\n JQLite.prototype[name] = function(arg1, arg2) {\n var i, key;\n var nodeCount = this.length;\n\n // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it\n // in a way that survives minification.\n // jqLiteEmpty takes no arguments but is a setter.\n if (fn !== jqLiteEmpty &&\n (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {\n if (isObject(arg1)) {\n\n // we are a write, but the object properties are the key/values\n for (i = 0; i < nodeCount; i++) {\n if (fn === jqLiteData) {\n // data() takes the whole object in jQuery\n fn(this[i], arg1);\n } else {\n for (key in arg1) {\n fn(this[i], key, arg1[key]);\n }\n }\n }\n // return self for chaining\n return this;\n } else {\n // we are a read, so read the first child.\n // TODO: do we still need this?\n var value = fn.$dv;\n // Only if we have $dv do we iterate over all, otherwise it is just the first element.\n var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;\n for (var j = 0; j < jj; j++) {\n var nodeValue = fn(this[j], arg1, arg2);\n value = value ? value + nodeValue : nodeValue;\n }\n return value;\n }\n } else {\n // we are a write, so apply to all children\n for (i = 0; i < nodeCount; i++) {\n fn(this[i], arg1, arg2);\n }\n // return self for chaining\n return this;\n }\n };\n});\n\nfunction createEventHandler(element, events) {\n var eventHandler = function(event, type) {\n // jQuery specific api\n event.isDefaultPrevented = function() {\n return event.defaultPrevented;\n };\n\n var eventFns = events[type || event.type];\n var eventFnsLength = eventFns ? eventFns.length : 0;\n\n if (!eventFnsLength) return;\n\n if (isUndefined(event.immediatePropagationStopped)) {\n var originalStopImmediatePropagation = event.stopImmediatePropagation;\n event.stopImmediatePropagation = function() {\n event.immediatePropagationStopped = true;\n\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n\n if (originalStopImmediatePropagation) {\n originalStopImmediatePropagation.call(event);\n }\n };\n }\n\n event.isImmediatePropagationStopped = function() {\n return event.immediatePropagationStopped === true;\n };\n\n // Some events have special handlers that wrap the real handler\n var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;\n\n // Copy event handlers in case event handlers array is modified during execution.\n if ((eventFnsLength > 1)) {\n eventFns = shallowCopy(eventFns);\n }\n\n for (var i = 0; i < eventFnsLength; i++) {\n if (!event.isImmediatePropagationStopped()) {\n handlerWrapper(element, event, eventFns[i]);\n }\n }\n };\n\n // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all\n // events on `element`\n eventHandler.elem = element;\n return eventHandler;\n}\n\nfunction defaultHandlerWrapper(element, event, handler) {\n handler.call(element, event);\n}\n\nfunction specialMouseHandlerWrapper(target, event, handler) {\n // Refer to jQuery's implementation of mouseenter & mouseleave\n // Read about mouseenter and mouseleave:\n // http://www.quirksmode.org/js/events_mouse.html#link8\n var related = event.relatedTarget;\n // For mousenter/leave call the handler if related is outside the target.\n // NB: No relatedTarget if the mouse left/entered the browser window\n if (!related || (related !== target && !jqLiteContains.call(target, related))) {\n handler.call(target, event);\n }\n}\n\n//////////////////////////////////////////\n// Functions iterating traversal.\n// These functions chain results into a single\n// selector.\n//////////////////////////////////////////\nforEach({\n removeData: jqLiteRemoveData,\n\n on: function jqLiteOn(element, type, fn, unsupported) {\n if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');\n\n // Do not add event handlers to non-elements because they will not be cleaned up.\n if (!jqLiteAcceptsData(element)) {\n return;\n }\n\n var expandoStore = jqLiteExpandoStore(element, true);\n var events = expandoStore.events;\n var handle = expandoStore.handle;\n\n if (!handle) {\n handle = expandoStore.handle = createEventHandler(element, events);\n }\n\n // http://jsperf.com/string-indexof-vs-split\n var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];\n var i = types.length;\n\n var addHandler = function(type, specialHandlerWrapper, noEventListener) {\n var eventFns = events[type];\n\n if (!eventFns) {\n eventFns = events[type] = [];\n eventFns.specialHandlerWrapper = specialHandlerWrapper;\n if (type !== '$destroy' && !noEventListener) {\n addEventListenerFn(element, type, handle);\n }\n }\n\n eventFns.push(fn);\n };\n\n while (i--) {\n type = types[i];\n if (MOUSE_EVENT_MAP[type]) {\n addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);\n addHandler(type, undefined, true);\n } else {\n addHandler(type);\n }\n }\n },\n\n off: jqLiteOff,\n\n one: function(element, type, fn) {\n element = jqLite(element);\n\n //add the listener twice so that when it is called\n //you can remove the original function and still be\n //able to call element.off(ev, fn) normally\n element.on(type, function onFn() {\n element.off(type, fn);\n element.off(type, onFn);\n });\n element.on(type, fn);\n },\n\n replaceWith: function(element, replaceNode) {\n var index, parent = element.parentNode;\n jqLiteDealoc(element);\n forEach(new JQLite(replaceNode), function(node) {\n if (index) {\n parent.insertBefore(node, index.nextSibling);\n } else {\n parent.replaceChild(node, element);\n }\n index = node;\n });\n },\n\n children: function(element) {\n var children = [];\n forEach(element.childNodes, function(element) {\n if (element.nodeType === NODE_TYPE_ELEMENT) {\n children.push(element);\n }\n });\n return children;\n },\n\n contents: function(element) {\n return element.contentDocument || element.childNodes || [];\n },\n\n append: function(element, node) {\n var nodeType = element.nodeType;\n if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;\n\n node = new JQLite(node);\n\n for (var i = 0, ii = node.length; i < ii; i++) {\n var child = node[i];\n element.appendChild(child);\n }\n },\n\n prepend: function(element, node) {\n if (element.nodeType === NODE_TYPE_ELEMENT) {\n var index = element.firstChild;\n forEach(new JQLite(node), function(child) {\n element.insertBefore(child, index);\n });\n }\n },\n\n wrap: function(element, wrapNode) {\n jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);\n },\n\n remove: jqLiteRemove,\n\n detach: function(element) {\n jqLiteRemove(element, true);\n },\n\n after: function(element, newElement) {\n var index = element, parent = element.parentNode;\n newElement = new JQLite(newElement);\n\n for (var i = 0, ii = newElement.length; i < ii; i++) {\n var node = newElement[i];\n parent.insertBefore(node, index.nextSibling);\n index = node;\n }\n },\n\n addClass: jqLiteAddClass,\n removeClass: jqLiteRemoveClass,\n\n toggleClass: function(element, selector, condition) {\n if (selector) {\n forEach(selector.split(' '), function(className) {\n var classCondition = condition;\n if (isUndefined(classCondition)) {\n classCondition = !jqLiteHasClass(element, className);\n }\n (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);\n });\n }\n },\n\n parent: function(element) {\n var parent = element.parentNode;\n return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;\n },\n\n next: function(element) {\n return element.nextElementSibling;\n },\n\n find: function(element, selector) {\n if (element.getElementsByTagName) {\n return element.getElementsByTagName(selector);\n } else {\n return [];\n }\n },\n\n clone: jqLiteClone,\n\n triggerHandler: function(element, event, extraParameters) {\n\n var dummyEvent, eventFnsCopy, handlerArgs;\n var eventName = event.type || event;\n var expandoStore = jqLiteExpandoStore(element);\n var events = expandoStore && expandoStore.events;\n var eventFns = events && events[eventName];\n\n if (eventFns) {\n // Create a dummy event to pass to the handlers\n dummyEvent = {\n preventDefault: function() { this.defaultPrevented = true; },\n isDefaultPrevented: function() { return this.defaultPrevented === true; },\n stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },\n isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },\n stopPropagation: noop,\n type: eventName,\n target: element\n };\n\n // If a custom event was provided then extend our dummy event with it\n if (event.type) {\n dummyEvent = extend(dummyEvent, event);\n }\n\n // Copy event handlers in case event handlers array is modified during execution.\n eventFnsCopy = shallowCopy(eventFns);\n handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];\n\n forEach(eventFnsCopy, function(fn) {\n if (!dummyEvent.isImmediatePropagationStopped()) {\n fn.apply(element, handlerArgs);\n }\n });\n }\n }\n}, function(fn, name) {\n /**\n * chaining functions\n */\n JQLite.prototype[name] = function(arg1, arg2, arg3) {\n var value;\n\n for (var i = 0, ii = this.length; i < ii; i++) {\n if (isUndefined(value)) {\n value = fn(this[i], arg1, arg2, arg3);\n if (isDefined(value)) {\n // any function which returns a value needs to be wrapped\n value = jqLite(value);\n }\n } else {\n jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));\n }\n }\n return isDefined(value) ? value : this;\n };\n\n // bind legacy bind/unbind to on/off\n JQLite.prototype.bind = JQLite.prototype.on;\n JQLite.prototype.unbind = JQLite.prototype.off;\n});\n\n\n// Provider for private $$jqLite service\nfunction $$jqLiteProvider() {\n this.$get = function $$jqLite() {\n return extend(JQLite, {\n hasClass: function(node, classes) {\n if (node.attr) node = node[0];\n return jqLiteHasClass(node, classes);\n },\n addClass: function(node, classes) {\n if (node.attr) node = node[0];\n return jqLiteAddClass(node, classes);\n },\n removeClass: function(node, classes) {\n if (node.attr) node = node[0];\n return jqLiteRemoveClass(node, classes);\n }\n });\n };\n}\n\n/**\n * Computes a hash of an 'obj'.\n * Hash of a:\n * string is string\n * number is number as string\n * object is either result of calling $$hashKey function on the object or uniquely generated id,\n * that is also assigned to the $$hashKey property of the object.\n *\n * @param obj\n * @returns {string} hash string such that the same input will have the same hash string.\n * The resulting string key is in 'type:hashKey' format.\n */\nfunction hashKey(obj, nextUidFn) {\n var key = obj && obj.$$hashKey;\n\n if (key) {\n if (typeof key === 'function') {\n key = obj.$$hashKey();\n }\n return key;\n }\n\n var objType = typeof obj;\n if (objType == 'function' || (objType == 'object' && obj !== null)) {\n key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();\n } else {\n key = objType + ':' + obj;\n }\n\n return key;\n}\n\n/**\n * HashMap which can use objects as keys\n */\nfunction HashMap(array, isolatedUid) {\n if (isolatedUid) {\n var uid = 0;\n this.nextUid = function() {\n return ++uid;\n };\n }\n forEach(array, this.put, this);\n}\nHashMap.prototype = {\n /**\n * Store key value pair\n * @param key key to store can be any type\n * @param value value to store can be any type\n */\n put: function(key, value) {\n this[hashKey(key, this.nextUid)] = value;\n },\n\n /**\n * @param key\n * @returns {Object} the value for the key\n */\n get: function(key) {\n return this[hashKey(key, this.nextUid)];\n },\n\n /**\n * Remove the key/value pair\n * @param key\n */\n remove: function(key) {\n var value = this[key = hashKey(key, this.nextUid)];\n delete this[key];\n return value;\n }\n};\n\nvar $$HashMapProvider = [function() {\n this.$get = [function() {\n return HashMap;\n }];\n}];\n\n/**\n * @ngdoc function\n * @module ng\n * @name angular.injector\n * @kind function\n *\n * @description\n * Creates an injector object that can be used for retrieving services as well as for\n * dependency injection (see {@link guide/di dependency injection}).\n *\n * @param {Array.<string|Function>} modules A list of module functions or their aliases. See\n * {@link angular.module}. The `ng` module must be explicitly added.\n * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which\n * disallows argument name annotation inference.\n * @returns {injector} Injector object. See {@link auto.$injector $injector}.\n *\n * @example\n * Typical usage\n * ```js\n * // create an injector\n * var $injector = angular.injector(['ng']);\n *\n * // use the injector to kick off your application\n * // use the type inference to auto inject arguments, or use implicit injection\n * $injector.invoke(function($rootScope, $compile, $document) {\n * $compile($document)($rootScope);\n * $rootScope.$digest();\n * });\n * ```\n *\n * Sometimes you want to get access to the injector of a currently running Angular app\n * from outside Angular. Perhaps, you want to inject and compile some markup after the\n * application has been bootstrapped. You can do this using the extra `injector()` added\n * to JQuery/jqLite elements. See {@link angular.element}.\n *\n * *This is fairly rare but could be the case if a third party library is injecting the\n * markup.*\n *\n * In the following example a new block of HTML containing a `ng-controller`\n * directive is added to the end of the document body by JQuery. We then compile and link\n * it into the current AngularJS scope.\n *\n * ```js\n * var $div = $('<div ng-controller=\"MyCtrl\">{{content.label}}</div>');\n * $(document.body).append($div);\n *\n * angular.element(document).injector().invoke(function($compile) {\n * var scope = angular.element($div).scope();\n * $compile($div)(scope);\n * });\n * ```\n */\n\n\n/**\n * @ngdoc module\n * @name auto\n * @description\n *\n * Implicit module which gets automatically added to each {@link auto.$injector $injector}.\n */\n\nvar FN_ARGS = /^[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /^\\s*(_?)(\\S+?)\\1\\s*$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar $injectorMinErr = minErr('$injector');\n\nfunction anonFn(fn) {\n // For anonymous functions, showing at the very least the function signature can help in\n // debugging.\n var fnText = fn.toString().replace(STRIP_COMMENTS, ''),\n args = fnText.match(FN_ARGS);\n if (args) {\n return 'function(' + (args[1] || '').replace(/[\\s\\r\\n]+/, ' ') + ')';\n }\n return 'fn';\n}\n\nfunction annotate(fn, strictDi, name) {\n var $inject,\n fnText,\n argDecl,\n last;\n\n if (typeof fn === 'function') {\n if (!($inject = fn.$inject)) {\n $inject = [];\n if (fn.length) {\n if (strictDi) {\n if (!isString(name) || !name) {\n name = fn.name || anonFn(fn);\n }\n throw $injectorMinErr('strictdi',\n '{0} is not using explicit annotation and cannot be invoked in strict mode', name);\n }\n fnText = fn.toString().replace(STRIP_COMMENTS, '');\n argDecl = fnText.match(FN_ARGS);\n forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {\n arg.replace(FN_ARG, function(all, underscore, name) {\n $inject.push(name);\n });\n });\n }\n fn.$inject = $inject;\n }\n } else if (isArray(fn)) {\n last = fn.length - 1;\n assertArgFn(fn[last], 'fn');\n $inject = fn.slice(0, last);\n } else {\n assertArgFn(fn, 'fn', true);\n }\n return $inject;\n}\n\n///////////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $injector\n *\n * @description\n *\n * `$injector` is used to retrieve object instances as defined by\n * {@link auto.$provide provider}, instantiate types, invoke methods,\n * and load modules.\n *\n * The following always holds true:\n *\n * ```js\n * var $injector = angular.injector();\n * expect($injector.get('$injector')).toBe($injector);\n * expect($injector.invoke(function($injector) {\n * return $injector;\n * })).toBe($injector);\n * ```\n *\n * # Injection Function Annotation\n *\n * JavaScript does not have annotations, and annotations are needed for dependency injection. The\n * following are all valid ways of annotating function with injection arguments and are equivalent.\n *\n * ```js\n * // inferred (only works if code not minified/obfuscated)\n * $injector.invoke(function(serviceA){});\n *\n * // annotated\n * function explicit(serviceA) {};\n * explicit.$inject = ['serviceA'];\n * $injector.invoke(explicit);\n *\n * // inline\n * $injector.invoke(['serviceA', function(serviceA){}]);\n * ```\n *\n * ## Inference\n *\n * In JavaScript calling `toString()` on a function returns the function definition. The definition\n * can then be parsed and the function arguments can be extracted. This method of discovering\n * annotations is disallowed when the injector is in strict mode.\n * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the\n * argument names.\n *\n * ## `$inject` Annotation\n * By adding an `$inject` property onto a function the injection parameters can be specified.\n *\n * ## Inline\n * As an array of injection names, where the last item in the array is the function to call.\n */\n\n/**\n * @ngdoc method\n * @name $injector#get\n *\n * @description\n * Return an instance of the service.\n *\n * @param {string} name The name of the instance to retrieve.\n * @param {string=} caller An optional string to provide the origin of the function call for error messages.\n * @return {*} The instance.\n */\n\n/**\n * @ngdoc method\n * @name $injector#invoke\n *\n * @description\n * Invoke the method and supply the method arguments from the `$injector`.\n *\n * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are\n * injected according to the {@link guide/di $inject Annotation} rules.\n * @param {Object=} self The `this` for the invoked method.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {*} the value returned by the invoked `fn` function.\n */\n\n/**\n * @ngdoc method\n * @name $injector#has\n *\n * @description\n * Allows the user to query if the particular service exists.\n *\n * @param {string} name Name of the service to query.\n * @returns {boolean} `true` if injector has given service.\n */\n\n/**\n * @ngdoc method\n * @name $injector#instantiate\n * @description\n * Create a new instance of JS type. The method takes a constructor function, invokes the new\n * operator, and supplies all of the arguments to the constructor function as specified by the\n * constructor annotation.\n *\n * @param {Function} Type Annotated constructor function.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {Object} new instance of `Type`.\n */\n\n/**\n * @ngdoc method\n * @name $injector#annotate\n *\n * @description\n * Returns an array of service names which the function is requesting for injection. This API is\n * used by the injector to determine which services need to be injected into the function when the\n * function is invoked. There are three ways in which the function can be annotated with the needed\n * dependencies.\n *\n * # Argument names\n *\n * The simplest form is to extract the dependencies from the arguments of the function. This is done\n * by converting the function into a string using `toString()` method and extracting the argument\n * names.\n * ```js\n * // Given\n * function MyController($scope, $route) {\n * // ...\n * }\n *\n * // Then\n * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * You can disallow this method by using strict injection mode.\n *\n * This method does not work with code minification / obfuscation. For this reason the following\n * annotation strategies are supported.\n *\n * # The `$inject` property\n *\n * If a function has an `$inject` property and its value is an array of strings, then the strings\n * represent names of services to be injected into the function.\n * ```js\n * // Given\n * var MyController = function(obfuscatedScope, obfuscatedRoute) {\n * // ...\n * }\n * // Define function dependencies\n * MyController['$inject'] = ['$scope', '$route'];\n *\n * // Then\n * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * # The array notation\n *\n * It is often desirable to inline Injected functions and that's when setting the `$inject` property\n * is very inconvenient. In these situations using the array notation to specify the dependencies in\n * a way that survives minification is a better choice:\n *\n * ```js\n * // We wish to write this (not minification / obfuscation safe)\n * injector.invoke(function($compile, $rootScope) {\n * // ...\n * });\n *\n * // We are forced to write break inlining\n * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {\n * // ...\n * };\n * tmpFn.$inject = ['$compile', '$rootScope'];\n * injector.invoke(tmpFn);\n *\n * // To better support inline function the inline annotation is supported\n * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {\n * // ...\n * }]);\n *\n * // Therefore\n * expect(injector.annotate(\n * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])\n * ).toEqual(['$compile', '$rootScope']);\n * ```\n *\n * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to\n * be retrieved as described above.\n *\n * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.\n *\n * @returns {Array.<string>} The names of the services which the function requires.\n */\n\n\n\n\n/**\n * @ngdoc service\n * @name $provide\n *\n * @description\n *\n * The {@link auto.$provide $provide} service has a number of methods for registering components\n * with the {@link auto.$injector $injector}. Many of these functions are also exposed on\n * {@link angular.Module}.\n *\n * An Angular **service** is a singleton object created by a **service factory**. These **service\n * factories** are functions which, in turn, are created by a **service provider**.\n * The **service providers** are constructor functions. When instantiated they must contain a\n * property called `$get`, which holds the **service factory** function.\n *\n * When you request a service, the {@link auto.$injector $injector} is responsible for finding the\n * correct **service provider**, instantiating it and then calling its `$get` **service factory**\n * function to get the instance of the **service**.\n *\n * Often services have no configuration options and there is no need to add methods to the service\n * provider. The provider will be no more than a constructor function with a `$get` property. For\n * these cases the {@link auto.$provide $provide} service has additional helper methods to register\n * services without specifying a provider.\n *\n * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the\n * {@link auto.$injector $injector}\n * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by\n * providers and services.\n * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by\n * services, not providers.\n * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,\n * that will be wrapped in a **service provider** object, whose `$get` property will contain the\n * given factory function.\n * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`\n * that will be wrapped in a **service provider** object, whose `$get` property will instantiate\n * a new object using the given constructor function.\n *\n * See the individual methods for more information and examples.\n */\n\n/**\n * @ngdoc method\n * @name $provide#provider\n * @description\n *\n * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions\n * are constructor functions, whose instances are responsible for \"providing\" a factory for a\n * service.\n *\n * Service provider names start with the name of the service they provide followed by `Provider`.\n * For example, the {@link ng.$log $log} service has a provider called\n * {@link ng.$logProvider $logProvider}.\n *\n * Service provider objects can have additional methods which allow configuration of the provider\n * and its service. Importantly, you can configure what kind of service is created by the `$get`\n * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a\n * method {@link ng.$logProvider#debugEnabled debugEnabled}\n * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the\n * console or not.\n *\n * @param {string} name The name of the instance. NOTE: the provider will be available under `name +\n 'Provider'` key.\n * @param {(Object|function())} provider If the provider is:\n *\n * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using\n * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.\n * - `Constructor`: a new instance of the provider will be created using\n * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.\n *\n * @returns {Object} registered provider instance\n\n * @example\n *\n * The following example shows how to create a simple event tracking service and register it using\n * {@link auto.$provide#provider $provide.provider()}.\n *\n * ```js\n * // Define the eventTracker provider\n * function EventTrackerProvider() {\n * var trackingUrl = '/track';\n *\n * // A provider method for configuring where the tracked events should been saved\n * this.setTrackingUrl = function(url) {\n * trackingUrl = url;\n * };\n *\n * // The service factory function\n * this.$get = ['$http', function($http) {\n * var trackedEvents = {};\n * return {\n * // Call this to track an event\n * event: function(event) {\n * var count = trackedEvents[event] || 0;\n * count += 1;\n * trackedEvents[event] = count;\n * return count;\n * },\n * // Call this to save the tracked events to the trackingUrl\n * save: function() {\n * $http.post(trackingUrl, trackedEvents);\n * }\n * };\n * }];\n * }\n *\n * describe('eventTracker', function() {\n * var postSpy;\n *\n * beforeEach(module(function($provide) {\n * // Register the eventTracker provider\n * $provide.provider('eventTracker', EventTrackerProvider);\n * }));\n *\n * beforeEach(module(function(eventTrackerProvider) {\n * // Configure eventTracker provider\n * eventTrackerProvider.setTrackingUrl('/custom-track');\n * }));\n *\n * it('tracks events', inject(function(eventTracker) {\n * expect(eventTracker.event('login')).toEqual(1);\n * expect(eventTracker.event('login')).toEqual(2);\n * }));\n *\n * it('saves to the tracking url', inject(function(eventTracker, $http) {\n * postSpy = spyOn($http, 'post');\n * eventTracker.event('login');\n * eventTracker.save();\n * expect(postSpy).toHaveBeenCalled();\n * expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');\n * expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');\n * expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });\n * }));\n * });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $provide#factory\n * @description\n *\n * Register a **service factory**, which will be called to return the service instance.\n * This is short for registering a service where its provider consists of only a `$get` property,\n * which is the given service factory function.\n * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to\n * configure your service in a provider.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.\n * Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service\n * ```js\n * $provide.factory('ping', ['$http', function($http) {\n * return function ping() {\n * return $http.send('/ping');\n * };\n * }]);\n * ```\n * You would then inject and use this service like this:\n * ```js\n * someModule.controller('Ctrl', ['ping', function(ping) {\n * ping();\n * }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#service\n * @description\n *\n * Register a **service constructor**, which will be invoked with `new` to create the service\n * instance.\n * This is short for registering a service where its provider's `$get` property is a factory\n * function that returns an instance instantiated by the injector from the service constructor\n * function.\n *\n * Internally it looks a bit like this:\n *\n * ```\n * {\n * $get: function() {\n * return $injector.instantiate(constructor);\n * }\n * }\n * ```\n *\n *\n * You should use {@link auto.$provide#service $provide.service(class)} if you define your service\n * as a type/class.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)\n * that will be instantiated.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service using\n * {@link auto.$provide#service $provide.service(class)}.\n * ```js\n * var Ping = function($http) {\n * this.$http = $http;\n * };\n *\n * Ping.$inject = ['$http'];\n *\n * Ping.prototype.send = function() {\n * return this.$http.get('/ping');\n * };\n * $provide.service('ping', Ping);\n * ```\n * You would then inject and use this service like this:\n * ```js\n * someModule.controller('Ctrl', ['ping', function(ping) {\n * ping.send();\n * }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#value\n * @description\n *\n * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a\n * number, an array, an object or a function. This is short for registering a service where its\n * provider's `$get` property is a factory function that takes no arguments and returns the **value\n * service**. That also means it is not possible to inject other services into a value service.\n *\n * Value services are similar to constant services, except that they cannot be injected into a\n * module configuration function (see {@link angular.Module#config}) but they can be overridden by\n * an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the instance.\n * @param {*} value The value.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here are some examples of creating value services.\n * ```js\n * $provide.value('ADMIN_USER', 'admin');\n *\n * $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });\n *\n * $provide.value('halfOf', function(value) {\n * return value / 2;\n * });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#constant\n * @description\n *\n * Register a **constant service** with the {@link auto.$injector $injector}, such as a string,\n * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not\n * possible to inject other services into a constant.\n *\n * But unlike {@link auto.$provide#value value}, a constant can be\n * injected into a module configuration function (see {@link angular.Module#config}) and it cannot\n * be overridden by an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the constant.\n * @param {*} value The constant value.\n * @returns {Object} registered instance\n *\n * @example\n * Here a some examples of creating constants:\n * ```js\n * $provide.constant('SHARD_HEIGHT', 306);\n *\n * $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);\n *\n * $provide.constant('double', function(value) {\n * return value * 2;\n * });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#decorator\n * @description\n *\n * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator\n * intercepts the creation of a service, allowing it to override or modify the behavior of the\n * service. The object returned by the decorator may be the original service, or a new service\n * object which replaces or wraps and delegates to the original service.\n *\n * @param {string} name The name of the service to decorate.\n * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be\n * instantiated and should return the decorated service instance. The function is called using\n * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.\n * Local injection arguments:\n *\n * * `$delegate` - The original service instance, which can be monkey patched, configured,\n * decorated or delegated to.\n *\n * @example\n * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting\n * calls to {@link ng.$log#error $log.warn()}.\n * ```js\n * $provide.decorator('$log', ['$delegate', function($delegate) {\n * $delegate.warn = $delegate.error;\n * return $delegate;\n * }]);\n * ```\n */\n\n\nfunction createInjector(modulesToLoad, strictDi) {\n strictDi = (strictDi === true);\n var INSTANTIATING = {},\n providerSuffix = 'Provider',\n path = [],\n loadedModules = new HashMap([], true),\n providerCache = {\n $provide: {\n provider: supportObject(provider),\n factory: supportObject(factory),\n service: supportObject(service),\n value: supportObject(value),\n constant: supportObject(constant),\n decorator: decorator\n }\n },\n providerInjector = (providerCache.$injector =\n createInternalInjector(providerCache, function(serviceName, caller) {\n if (angular.isString(caller)) {\n path.push(caller);\n }\n throw $injectorMinErr('unpr', \"Unknown provider: {0}\", path.join(' <- '));\n })),\n instanceCache = {},\n instanceInjector = (instanceCache.$injector =\n createInternalInjector(instanceCache, function(serviceName, caller) {\n var provider = providerInjector.get(serviceName + providerSuffix, caller);\n return instanceInjector.invoke(provider.$get, provider, undefined, serviceName);\n }));\n\n\n forEach(loadModules(modulesToLoad), function(fn) { if (fn) instanceInjector.invoke(fn); });\n\n return instanceInjector;\n\n ////////////////////////////////////\n // $provider\n ////////////////////////////////////\n\n function supportObject(delegate) {\n return function(key, value) {\n if (isObject(key)) {\n forEach(key, reverseParams(delegate));\n } else {\n return delegate(key, value);\n }\n };\n }\n\n function provider(name, provider_) {\n assertNotHasOwnProperty(name, 'service');\n if (isFunction(provider_) || isArray(provider_)) {\n provider_ = providerInjector.instantiate(provider_);\n }\n if (!provider_.$get) {\n throw $injectorMinErr('pget', \"Provider '{0}' must define $get factory method.\", name);\n }\n return providerCache[name + providerSuffix] = provider_;\n }\n\n function enforceReturnValue(name, factory) {\n return function enforcedReturnValue() {\n var result = instanceInjector.invoke(factory, this);\n if (isUndefined(result)) {\n throw $injectorMinErr('undef', \"Provider '{0}' must return a value from $get factory method.\", name);\n }\n return result;\n };\n }\n\n function factory(name, factoryFn, enforce) {\n return provider(name, {\n $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn\n });\n }\n\n function service(name, constructor) {\n return factory(name, ['$injector', function($injector) {\n return $injector.instantiate(constructor);\n }]);\n }\n\n function value(name, val) { return factory(name, valueFn(val), false); }\n\n function constant(name, value) {\n assertNotHasOwnProperty(name, 'constant');\n providerCache[name] = value;\n instanceCache[name] = value;\n }\n\n function decorator(serviceName, decorFn) {\n var origProvider = providerInjector.get(serviceName + providerSuffix),\n orig$get = origProvider.$get;\n\n origProvider.$get = function() {\n var origInstance = instanceInjector.invoke(orig$get, origProvider);\n return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});\n };\n }\n\n ////////////////////////////////////\n // Module Loading\n ////////////////////////////////////\n function loadModules(modulesToLoad) {\n assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');\n var runBlocks = [], moduleFn;\n forEach(modulesToLoad, function(module) {\n if (loadedModules.get(module)) return;\n loadedModules.put(module, true);\n\n function runInvokeQueue(queue) {\n var i, ii;\n for (i = 0, ii = queue.length; i < ii; i++) {\n var invokeArgs = queue[i],\n provider = providerInjector.get(invokeArgs[0]);\n\n provider[invokeArgs[1]].apply(provider, invokeArgs[2]);\n }\n }\n\n try {\n if (isString(module)) {\n moduleFn = angularModule(module);\n runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);\n runInvokeQueue(moduleFn._invokeQueue);\n runInvokeQueue(moduleFn._configBlocks);\n } else if (isFunction(module)) {\n runBlocks.push(providerInjector.invoke(module));\n } else if (isArray(module)) {\n runBlocks.push(providerInjector.invoke(module));\n } else {\n assertArgFn(module, 'module');\n }\n } catch (e) {\n if (isArray(module)) {\n module = module[module.length - 1];\n }\n if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {\n // Safari & FF's stack traces don't contain error.message content\n // unlike those of Chrome and IE\n // So if stack doesn't contain message, we create a new string that contains both.\n // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.\n /* jshint -W022 */\n e = e.message + '\\n' + e.stack;\n }\n throw $injectorMinErr('modulerr', \"Failed to instantiate module {0} due to:\\n{1}\",\n module, e.stack || e.message || e);\n }\n });\n return runBlocks;\n }\n\n ////////////////////////////////////\n // internal Injector\n ////////////////////////////////////\n\n function createInternalInjector(cache, factory) {\n\n function getService(serviceName, caller) {\n if (cache.hasOwnProperty(serviceName)) {\n if (cache[serviceName] === INSTANTIATING) {\n throw $injectorMinErr('cdep', 'Circular dependency found: {0}',\n serviceName + ' <- ' + path.join(' <- '));\n }\n return cache[serviceName];\n } else {\n try {\n path.unshift(serviceName);\n cache[serviceName] = INSTANTIATING;\n return cache[serviceName] = factory(serviceName, caller);\n } catch (err) {\n if (cache[serviceName] === INSTANTIATING) {\n delete cache[serviceName];\n }\n throw err;\n } finally {\n path.shift();\n }\n }\n }\n\n function invoke(fn, self, locals, serviceName) {\n if (typeof locals === 'string') {\n serviceName = locals;\n locals = null;\n }\n\n var args = [],\n $inject = createInjector.$$annotate(fn, strictDi, serviceName),\n length, i,\n key;\n\n for (i = 0, length = $inject.length; i < length; i++) {\n key = $inject[i];\n if (typeof key !== 'string') {\n throw $injectorMinErr('itkn',\n 'Incorrect injection token! Expected service name as string, got {0}', key);\n }\n args.push(\n locals && locals.hasOwnProperty(key)\n ? locals[key]\n : getService(key, serviceName)\n );\n }\n if (isArray(fn)) {\n fn = fn[length];\n }\n\n // http://jsperf.com/angularjs-invoke-apply-vs-switch\n // #5388\n return fn.apply(self, args);\n }\n\n function instantiate(Type, locals, serviceName) {\n // Check if Type is annotated and use just the given function at n-1 as parameter\n // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);\n // Object creation: http://jsperf.com/create-constructor/2\n var instance = Object.create((isArray(Type) ? Type[Type.length - 1] : Type).prototype || null);\n var returnedValue = invoke(Type, instance, locals, serviceName);\n\n return isObject(returnedValue) || isFunction(returnedValue) ? returnedValue : instance;\n }\n\n return {\n invoke: invoke,\n instantiate: instantiate,\n get: getService,\n annotate: createInjector.$$annotate,\n has: function(name) {\n return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);\n }\n };\n }\n}\n\ncreateInjector.$$annotate = annotate;\n\n/**\n * @ngdoc provider\n * @name $anchorScrollProvider\n *\n * @description\n * Use `$anchorScrollProvider` to disable automatic scrolling whenever\n * {@link ng.$location#hash $location.hash()} changes.\n */\nfunction $AnchorScrollProvider() {\n\n var autoScrollingEnabled = true;\n\n /**\n * @ngdoc method\n * @name $anchorScrollProvider#disableAutoScrolling\n *\n * @description\n * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to\n * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />\n * Use this method to disable automatic scrolling.\n *\n * If automatic scrolling is disabled, one must explicitly call\n * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the\n * current hash.\n */\n this.disableAutoScrolling = function() {\n autoScrollingEnabled = false;\n };\n\n /**\n * @ngdoc service\n * @name $anchorScroll\n * @kind function\n * @requires $window\n * @requires $location\n * @requires $rootScope\n *\n * @description\n * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the\n * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified\n * in the\n * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document).\n *\n * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to\n * match any anchor whenever it changes. This can be disabled by calling\n * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.\n *\n * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a\n * vertical scroll-offset (either fixed or dynamic).\n *\n * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of\n * {@link ng.$location#hash $location.hash()} will be used.\n *\n * @property {(number|function|jqLite)} yOffset\n * If set, specifies a vertical scroll-offset. This is often useful when there are fixed\n * positioned elements at the top of the page, such as navbars, headers etc.\n *\n * `yOffset` can be specified in various ways:\n * - **number**: A fixed number of pixels to be used as offset.<br /><br />\n * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return\n * a number representing the offset (in pixels).<br /><br />\n * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from\n * the top of the page to the element's bottom will be used as offset.<br />\n * **Note**: The element will be taken into account only as long as its `position` is set to\n * `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust\n * their height and/or positioning according to the viewport's size.\n *\n * <br />\n * <div class=\"alert alert-warning\">\n * In order for `yOffset` to work properly, scrolling should take place on the document's root and\n * not some child element.\n * </div>\n *\n * @example\n <example module=\"anchorScrollExample\">\n <file name=\"index.html\">\n <div id=\"scrollArea\" ng-controller=\"ScrollController\">\n <a ng-click=\"gotoBottom()\">Go to bottom</a>\n <a id=\"bottom\"></a> You're at the bottom!\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('anchorScrollExample', [])\n .controller('ScrollController', ['$scope', '$location', '$anchorScroll',\n function ($scope, $location, $anchorScroll) {\n $scope.gotoBottom = function() {\n // set the location.hash to the id of\n // the element you wish to scroll to.\n $location.hash('bottom');\n\n // call $anchorScroll()\n $anchorScroll();\n };\n }]);\n </file>\n <file name=\"style.css\">\n #scrollArea {\n height: 280px;\n overflow: auto;\n }\n\n #bottom {\n display: block;\n margin-top: 2000px;\n }\n </file>\n </example>\n *\n * <hr />\n * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).\n * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.\n *\n * @example\n <example module=\"anchorScrollOffsetExample\">\n <file name=\"index.html\">\n <div class=\"fixed-header\" ng-controller=\"headerCtrl\">\n <a href=\"\" ng-click=\"gotoAnchor(x)\" ng-repeat=\"x in [1,2,3,4,5]\">\n Go to anchor {{x}}\n </a>\n </div>\n <div id=\"anchor{{x}}\" class=\"anchor\" ng-repeat=\"x in [1,2,3,4,5]\">\n Anchor {{x}} of 5\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('anchorScrollOffsetExample', [])\n .run(['$anchorScroll', function($anchorScroll) {\n $anchorScroll.yOffset = 50; // always scroll by 50 extra pixels\n }])\n .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',\n function ($anchorScroll, $location, $scope) {\n $scope.gotoAnchor = function(x) {\n var newHash = 'anchor' + x;\n if ($location.hash() !== newHash) {\n // set the $location.hash to `newHash` and\n // $anchorScroll will automatically scroll to it\n $location.hash('anchor' + x);\n } else {\n // call $anchorScroll() explicitly,\n // since $location.hash hasn't changed\n $anchorScroll();\n }\n };\n }\n ]);\n </file>\n <file name=\"style.css\">\n body {\n padding-top: 50px;\n }\n\n .anchor {\n border: 2px dashed DarkOrchid;\n padding: 10px 10px 200px 10px;\n }\n\n .fixed-header {\n background-color: rgba(0, 0, 0, 0.2);\n height: 50px;\n position: fixed;\n top: 0; left: 0; right: 0;\n }\n\n .fixed-header > a {\n display: inline-block;\n margin: 5px 15px;\n }\n </file>\n </example>\n */\n this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {\n var document = $window.document;\n\n // Helper function to get first anchor from a NodeList\n // (using `Array#some()` instead of `angular#forEach()` since it's more performant\n // and working in all supported browsers.)\n function getFirstAnchor(list) {\n var result = null;\n Array.prototype.some.call(list, function(element) {\n if (nodeName_(element) === 'a') {\n result = element;\n return true;\n }\n });\n return result;\n }\n\n function getYOffset() {\n\n var offset = scroll.yOffset;\n\n if (isFunction(offset)) {\n offset = offset();\n } else if (isElement(offset)) {\n var elem = offset[0];\n var style = $window.getComputedStyle(elem);\n if (style.position !== 'fixed') {\n offset = 0;\n } else {\n offset = elem.getBoundingClientRect().bottom;\n }\n } else if (!isNumber(offset)) {\n offset = 0;\n }\n\n return offset;\n }\n\n function scrollTo(elem) {\n if (elem) {\n elem.scrollIntoView();\n\n var offset = getYOffset();\n\n if (offset) {\n // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.\n // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the\n // top of the viewport.\n //\n // IF the number of pixels from the top of `elem` to the end of the page's content is less\n // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some\n // way down the page.\n //\n // This is often the case for elements near the bottom of the page.\n //\n // In such cases we do not need to scroll the whole `offset` up, just the difference between\n // the top of the element and the offset, which is enough to align the top of `elem` at the\n // desired position.\n var elemTop = elem.getBoundingClientRect().top;\n $window.scrollBy(0, elemTop - offset);\n }\n } else {\n $window.scrollTo(0, 0);\n }\n }\n\n function scroll(hash) {\n hash = isString(hash) ? hash : $location.hash();\n var elm;\n\n // empty hash, scroll to the top of the page\n if (!hash) scrollTo(null);\n\n // element with given id\n else if ((elm = document.getElementById(hash))) scrollTo(elm);\n\n // first anchor with given name :-D\n else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);\n\n // no element and hash == 'top', scroll to the top of the page\n else if (hash === 'top') scrollTo(null);\n }\n\n // does not scroll when user clicks on anchor link that is currently on\n // (no url change, no $location.hash() change), browser native does scroll\n if (autoScrollingEnabled) {\n $rootScope.$watch(function autoScrollWatch() {return $location.hash();},\n function autoScrollWatchAction(newVal, oldVal) {\n // skip the initial scroll if $location.hash is empty\n if (newVal === oldVal && newVal === '') return;\n\n jqLiteDocumentLoaded(function() {\n $rootScope.$evalAsync(scroll);\n });\n });\n }\n\n return scroll;\n }];\n}\n\nvar $animateMinErr = minErr('$animate');\nvar ELEMENT_NODE = 1;\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\n\nfunction mergeClasses(a,b) {\n if (!a && !b) return '';\n if (!a) return b;\n if (!b) return a;\n if (isArray(a)) a = a.join(' ');\n if (isArray(b)) b = b.join(' ');\n return a + ' ' + b;\n}\n\nfunction extractElementNode(element) {\n for (var i = 0; i < element.length; i++) {\n var elm = element[i];\n if (elm.nodeType === ELEMENT_NODE) {\n return elm;\n }\n }\n}\n\nfunction splitClasses(classes) {\n if (isString(classes)) {\n classes = classes.split(' ');\n }\n\n // Use createMap() to prevent class assumptions involving property names in\n // Object.prototype\n var obj = createMap();\n forEach(classes, function(klass) {\n // sometimes the split leaves empty string values\n // incase extra spaces were applied to the options\n if (klass.length) {\n obj[klass] = true;\n }\n });\n return obj;\n}\n\n// if any other type of options value besides an Object value is\n// passed into the $animate.method() animation then this helper code\n// will be run which will ignore it. While this patch is not the\n// greatest solution to this, a lot of existing plugins depend on\n// $animate to either call the callback (< 1.2) or return a promise\n// that can be changed. This helper function ensures that the options\n// are wiped clean incase a callback function is provided.\nfunction prepareAnimateOptions(options) {\n return isObject(options)\n ? options\n : {};\n}\n\nvar $$CoreAnimateJsProvider = function() {\n this.$get = function() {};\n};\n\n// this is prefixed with Core since it conflicts with\n// the animateQueueProvider defined in ngAnimate/animateQueue.js\nvar $$CoreAnimateQueueProvider = function() {\n var postDigestQueue = new HashMap();\n var postDigestElements = [];\n\n this.$get = ['$$AnimateRunner', '$rootScope',\n function($$AnimateRunner, $rootScope) {\n return {\n enabled: noop,\n on: noop,\n off: noop,\n pin: noop,\n\n push: function(element, event, options, domOperation) {\n domOperation && domOperation();\n\n options = options || {};\n options.from && element.css(options.from);\n options.to && element.css(options.to);\n\n if (options.addClass || options.removeClass) {\n addRemoveClassesPostDigest(element, options.addClass, options.removeClass);\n }\n\n var runner = new $$AnimateRunner(); // jshint ignore:line\n\n // since there are no animations to run the runner needs to be\n // notified that the animation call is complete.\n runner.complete();\n return runner;\n }\n };\n\n\n function updateData(data, classes, value) {\n var changed = false;\n if (classes) {\n classes = isString(classes) ? classes.split(' ') :\n isArray(classes) ? classes : [];\n forEach(classes, function(className) {\n if (className) {\n changed = true;\n data[className] = value;\n }\n });\n }\n return changed;\n }\n\n function handleCSSClassChanges() {\n forEach(postDigestElements, function(element) {\n var data = postDigestQueue.get(element);\n if (data) {\n var existing = splitClasses(element.attr('class'));\n var toAdd = '';\n var toRemove = '';\n forEach(data, function(status, className) {\n var hasClass = !!existing[className];\n if (status !== hasClass) {\n if (status) {\n toAdd += (toAdd.length ? ' ' : '') + className;\n } else {\n toRemove += (toRemove.length ? ' ' : '') + className;\n }\n }\n });\n\n forEach(element, function(elm) {\n toAdd && jqLiteAddClass(elm, toAdd);\n toRemove && jqLiteRemoveClass(elm, toRemove);\n });\n postDigestQueue.remove(element);\n }\n });\n postDigestElements.length = 0;\n }\n\n\n function addRemoveClassesPostDigest(element, add, remove) {\n var data = postDigestQueue.get(element) || {};\n\n var classesAdded = updateData(data, add, true);\n var classesRemoved = updateData(data, remove, false);\n\n if (classesAdded || classesRemoved) {\n\n postDigestQueue.put(element, data);\n postDigestElements.push(element);\n\n if (postDigestElements.length === 1) {\n $rootScope.$$postDigest(handleCSSClassChanges);\n }\n }\n }\n }];\n};\n\n/**\n * @ngdoc provider\n * @name $animateProvider\n *\n * @description\n * Default implementation of $animate that doesn't perform any animations, instead just\n * synchronously performs DOM updates and resolves the returned runner promise.\n *\n * In order to enable animations the `ngAnimate` module has to be loaded.\n *\n * To see the functional implementation check out `src/ngAnimate/animate.js`.\n */\nvar $AnimateProvider = ['$provide', function($provide) {\n var provider = this;\n\n this.$$registeredAnimations = Object.create(null);\n\n /**\n * @ngdoc method\n * @name $animateProvider#register\n *\n * @description\n * Registers a new injectable animation factory function. The factory function produces the\n * animation object which contains callback functions for each event that is expected to be\n * animated.\n *\n * * `eventFn`: `function(element, ... , doneFunction, options)`\n * The element to animate, the `doneFunction` and the options fed into the animation. Depending\n * on the type of animation additional arguments will be injected into the animation function. The\n * list below explains the function signatures for the different animation methods:\n *\n * - setClass: function(element, addedClasses, removedClasses, doneFunction, options)\n * - addClass: function(element, addedClasses, doneFunction, options)\n * - removeClass: function(element, removedClasses, doneFunction, options)\n * - enter, leave, move: function(element, doneFunction, options)\n * - animate: function(element, fromStyles, toStyles, doneFunction, options)\n *\n * Make sure to trigger the `doneFunction` once the animation is fully complete.\n *\n * ```js\n * return {\n * //enter, leave, move signature\n * eventFn : function(element, done, options) {\n * //code to run the animation\n * //once complete, then run done()\n * return function endFunction(wasCancelled) {\n * //code to cancel the animation\n * }\n * }\n * }\n * ```\n *\n * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).\n * @param {Function} factory The factory function that will be executed to return the animation\n * object.\n */\n this.register = function(name, factory) {\n if (name && name.charAt(0) !== '.') {\n throw $animateMinErr('notcsel', \"Expecting class selector starting with '.' got '{0}'.\", name);\n }\n\n var key = name + '-animation';\n provider.$$registeredAnimations[name.substr(1)] = key;\n $provide.factory(key, factory);\n };\n\n /**\n * @ngdoc method\n * @name $animateProvider#classNameFilter\n *\n * @description\n * Sets and/or returns the CSS class regular expression that is checked when performing\n * an animation. Upon bootstrap the classNameFilter value is not set at all and will\n * therefore enable $animate to attempt to perform an animation on any element that is triggered.\n * When setting the `classNameFilter` value, animations will only be performed on elements\n * that successfully match the filter expression. This in turn can boost performance\n * for low-powered devices as well as applications containing a lot of structural operations.\n * @param {RegExp=} expression The className expression which will be checked against all animations\n * @return {RegExp} The current CSS className expression value. If null then there is no expression value\n */\n this.classNameFilter = function(expression) {\n if (arguments.length === 1) {\n this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;\n if (this.$$classNameFilter) {\n var reservedRegex = new RegExp(\"(\\\\s+|\\\\/)\" + NG_ANIMATE_CLASSNAME + \"(\\\\s+|\\\\/)\");\n if (reservedRegex.test(this.$$classNameFilter.toString())) {\n throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the \"{0}\" CSS class.', NG_ANIMATE_CLASSNAME);\n\n }\n }\n }\n return this.$$classNameFilter;\n };\n\n this.$get = ['$$animateQueue', function($$animateQueue) {\n function domInsert(element, parentElement, afterElement) {\n // if for some reason the previous element was removed\n // from the dom sometime before this code runs then let's\n // just stick to using the parent element as the anchor\n if (afterElement) {\n var afterNode = extractElementNode(afterElement);\n if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {\n afterElement = null;\n }\n }\n afterElement ? afterElement.after(element) : parentElement.prepend(element);\n }\n\n /**\n * @ngdoc service\n * @name $animate\n * @description The $animate service exposes a series of DOM utility methods that provide support\n * for animation hooks. The default behavior is the application of DOM operations, however,\n * when an animation is detected (and animations are enabled), $animate will do the heavy lifting\n * to ensure that animation runs with the triggered DOM operation.\n *\n * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't\n * included and only when it is active then the animation hooks that `$animate` triggers will be\n * functional. Once active then all structural `ng-` directives will trigger animations as they perform\n * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,\n * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.\n *\n * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.\n *\n * To learn more about enabling animation support, click here to visit the\n * {@link ngAnimate ngAnimate module page}.\n */\n return {\n // we don't call it directly since non-existant arguments may\n // be interpreted as null within the sub enabled function\n\n /**\n *\n * @ngdoc method\n * @name $animate#on\n * @kind function\n * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)\n * has fired on the given element or among any of its children. Once the listener is fired, the provided callback\n * is fired with the following params:\n *\n * ```js\n * $animate.on('enter', container,\n * function callback(element, phase) {\n * // cool we detected an enter animation within the container\n * }\n * );\n * ```\n *\n * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)\n * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself\n * as well as among its children\n * @param {Function} callback the callback function that will be fired when the listener is triggered\n *\n * The arguments present in the callback function are:\n * * `element` - The captured DOM element that the animation was fired on.\n * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).\n */\n on: $$animateQueue.on,\n\n /**\n *\n * @ngdoc method\n * @name $animate#off\n * @kind function\n * @description Deregisters an event listener based on the event which has been associated with the provided element. This method\n * can be used in three different ways depending on the arguments:\n *\n * ```js\n * // remove all the animation event listeners listening for `enter`\n * $animate.off('enter');\n *\n * // remove all the animation event listeners listening for `enter` on the given element and its children\n * $animate.off('enter', container);\n *\n * // remove the event listener function provided by `listenerFn` that is set\n * // to listen for `enter` on the given `element` as well as its children\n * $animate.off('enter', container, callback);\n * ```\n *\n * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)\n * @param {DOMElement=} container the container element the event listener was placed on\n * @param {Function=} callback the callback function that was registered as the listener\n */\n off: $$animateQueue.off,\n\n /**\n * @ngdoc method\n * @name $animate#pin\n * @kind function\n * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists\n * outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the\n * element despite being outside the realm of the application or within another application. Say for example if the application\n * was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated\n * as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind\n * that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.\n *\n * Note that this feature is only active when the `ngAnimate` module is used.\n *\n * @param {DOMElement} element the external element that will be pinned\n * @param {DOMElement} parentElement the host parent element that will be associated with the external element\n */\n pin: $$animateQueue.pin,\n\n /**\n *\n * @ngdoc method\n * @name $animate#enabled\n * @kind function\n * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This\n * function can be called in four ways:\n *\n * ```js\n * // returns true or false\n * $animate.enabled();\n *\n * // changes the enabled state for all animations\n * $animate.enabled(false);\n * $animate.enabled(true);\n *\n * // returns true or false if animations are enabled for an element\n * $animate.enabled(element);\n *\n * // changes the enabled state for an element and its children\n * $animate.enabled(element, true);\n * $animate.enabled(element, false);\n * ```\n *\n * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state\n * @param {boolean=} enabled whether or not the animations will be enabled for the element\n *\n * @return {boolean} whether or not animations are enabled\n */\n enabled: $$animateQueue.enabled,\n\n /**\n * @ngdoc method\n * @name $animate#cancel\n * @kind function\n * @description Cancels the provided animation.\n *\n * @param {Promise} animationPromise The animation promise that is returned when an animation is started.\n */\n cancel: function(runner) {\n runner.end && runner.end();\n },\n\n /**\n *\n * @ngdoc method\n * @name $animate#enter\n * @kind function\n * @description Inserts the element into the DOM either after the `after` element (if provided) or\n * as the first child within the `parent` element and then triggers an animation.\n * A promise is returned that will be resolved during the next digest once the animation\n * has completed.\n *\n * @param {DOMElement} element the element which will be inserted into the DOM\n * @param {DOMElement} parent the parent element which will append the element as\n * a child (so long as the after element is not present)\n * @param {DOMElement=} after the sibling element after which the element will be appended\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n enter: function(element, parent, after, options) {\n parent = parent && jqLite(parent);\n after = after && jqLite(after);\n parent = parent || after.parent();\n domInsert(element, parent, after);\n return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));\n },\n\n /**\n *\n * @ngdoc method\n * @name $animate#move\n * @kind function\n * @description Inserts (moves) the element into its new position in the DOM either after\n * the `after` element (if provided) or as the first child within the `parent` element\n * and then triggers an animation. A promise is returned that will be resolved\n * during the next digest once the animation has completed.\n *\n * @param {DOMElement} element the element which will be moved into the new DOM position\n * @param {DOMElement} parent the parent element which will append the element as\n * a child (so long as the after element is not present)\n * @param {DOMElement=} after the sibling element after which the element will be appended\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n move: function(element, parent, after, options) {\n parent = parent && jqLite(parent);\n after = after && jqLite(after);\n parent = parent || after.parent();\n domInsert(element, parent, after);\n return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));\n },\n\n /**\n * @ngdoc method\n * @name $animate#leave\n * @kind function\n * @description Triggers an animation and then removes the element from the DOM.\n * When the function is called a promise is returned that will be resolved during the next\n * digest once the animation has completed.\n *\n * @param {DOMElement} element the element which will be removed from the DOM\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n leave: function(element, options) {\n return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {\n element.remove();\n });\n },\n\n /**\n * @ngdoc method\n * @name $animate#addClass\n * @kind function\n *\n * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon\n * execution, the addClass operation will only be handled after the next digest and it will not trigger an\n * animation if element already contains the CSS class or if the class is removed at a later step.\n * Note that class-based animations are treated differently compared to structural animations\n * (like enter, move and leave) since the CSS classes may be added/removed at different points\n * depending if CSS or JavaScript animations are used.\n *\n * @param {DOMElement} element the element which the CSS classes will be applied to\n * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n addClass: function(element, className, options) {\n options = prepareAnimateOptions(options);\n options.addClass = mergeClasses(options.addclass, className);\n return $$animateQueue.push(element, 'addClass', options);\n },\n\n /**\n * @ngdoc method\n * @name $animate#removeClass\n * @kind function\n *\n * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon\n * execution, the removeClass operation will only be handled after the next digest and it will not trigger an\n * animation if element does not contain the CSS class or if the class is added at a later step.\n * Note that class-based animations are treated differently compared to structural animations\n * (like enter, move and leave) since the CSS classes may be added/removed at different points\n * depending if CSS or JavaScript animations are used.\n *\n * @param {DOMElement} element the element which the CSS classes will be applied to\n * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n removeClass: function(element, className, options) {\n options = prepareAnimateOptions(options);\n options.removeClass = mergeClasses(options.removeClass, className);\n return $$animateQueue.push(element, 'removeClass', options);\n },\n\n /**\n * @ngdoc method\n * @name $animate#setClass\n * @kind function\n *\n * @description Performs both the addition and removal of a CSS classes on an element and (during the process)\n * triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and\n * `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has\n * passed. Note that class-based animations are treated differently compared to structural animations\n * (like enter, move and leave) since the CSS classes may be added/removed at different points\n * depending if CSS or JavaScript animations are used.\n *\n * @param {DOMElement} element the element which the CSS classes will be applied to\n * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)\n * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n setClass: function(element, add, remove, options) {\n options = prepareAnimateOptions(options);\n options.addClass = mergeClasses(options.addClass, add);\n options.removeClass = mergeClasses(options.removeClass, remove);\n return $$animateQueue.push(element, 'setClass', options);\n },\n\n /**\n * @ngdoc method\n * @name $animate#animate\n * @kind function\n *\n * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.\n * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take\n * on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and\n * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding\n * style in `to`, the style in `from` is applied immediately, and no animation is run.\n * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`\n * method (or as part of the `options` parameter):\n *\n * ```js\n * ngModule.animation('.my-inline-animation', function() {\n * return {\n * animate : function(element, from, to, done, options) {\n * //animation\n * done();\n * }\n * }\n * });\n * ```\n *\n * @param {DOMElement} element the element which the CSS styles will be applied to\n * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.\n * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.\n * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If\n * this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.\n * (Note that if no animation is detected then this value will not be appplied to the element.)\n * @param {object=} options an optional collection of options/styles that will be applied to the element\n *\n * @return {Promise} the animation callback promise\n */\n animate: function(element, from, to, className, options) {\n options = prepareAnimateOptions(options);\n options.from = options.from ? extend(options.from, from) : from;\n options.to = options.to ? extend(options.to, to) : to;\n\n className = className || 'ng-inline-animate';\n options.tempClasses = mergeClasses(options.tempClasses, className);\n return $$animateQueue.push(element, 'animate', options);\n }\n };\n }];\n}];\n\nvar $$AnimateAsyncRunFactoryProvider = function() {\n this.$get = ['$$rAF', function($$rAF) {\n var waitQueue = [];\n\n function waitForTick(fn) {\n waitQueue.push(fn);\n if (waitQueue.length > 1) return;\n $$rAF(function() {\n for (var i = 0; i < waitQueue.length; i++) {\n waitQueue[i]();\n }\n waitQueue = [];\n });\n }\n\n return function() {\n var passed = false;\n waitForTick(function() {\n passed = true;\n });\n return function(callback) {\n passed ? callback() : waitForTick(callback);\n };\n };\n }];\n};\n\nvar $$AnimateRunnerFactoryProvider = function() {\n this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',\n function($q, $sniffer, $$animateAsyncRun, $document, $timeout) {\n\n var INITIAL_STATE = 0;\n var DONE_PENDING_STATE = 1;\n var DONE_COMPLETE_STATE = 2;\n\n AnimateRunner.chain = function(chain, callback) {\n var index = 0;\n\n next();\n function next() {\n if (index === chain.length) {\n callback(true);\n return;\n }\n\n chain[index](function(response) {\n if (response === false) {\n callback(false);\n return;\n }\n index++;\n next();\n });\n }\n };\n\n AnimateRunner.all = function(runners, callback) {\n var count = 0;\n var status = true;\n forEach(runners, function(runner) {\n runner.done(onProgress);\n });\n\n function onProgress(response) {\n status = status && response;\n if (++count === runners.length) {\n callback(status);\n }\n }\n };\n\n function AnimateRunner(host) {\n this.setHost(host);\n\n var rafTick = $$animateAsyncRun();\n var timeoutTick = function(fn) {\n $timeout(fn, 0, false);\n };\n\n this._doneCallbacks = [];\n this._tick = function(fn) {\n var doc = $document[0];\n\n // the document may not be ready or attached\n // to the module for some internal tests\n if (doc && doc.hidden) {\n timeoutTick(fn);\n } else {\n rafTick(fn);\n }\n };\n this._state = 0;\n }\n\n AnimateRunner.prototype = {\n setHost: function(host) {\n this.host = host || {};\n },\n\n done: function(fn) {\n if (this._state === DONE_COMPLETE_STATE) {\n fn();\n } else {\n this._doneCallbacks.push(fn);\n }\n },\n\n progress: noop,\n\n getPromise: function() {\n if (!this.promise) {\n var self = this;\n this.promise = $q(function(resolve, reject) {\n self.done(function(status) {\n status === false ? reject() : resolve();\n });\n });\n }\n return this.promise;\n },\n\n then: function(resolveHandler, rejectHandler) {\n return this.getPromise().then(resolveHandler, rejectHandler);\n },\n\n 'catch': function(handler) {\n return this.getPromise()['catch'](handler);\n },\n\n 'finally': function(handler) {\n return this.getPromise()['finally'](handler);\n },\n\n pause: function() {\n if (this.host.pause) {\n this.host.pause();\n }\n },\n\n resume: function() {\n if (this.host.resume) {\n this.host.resume();\n }\n },\n\n end: function() {\n if (this.host.end) {\n this.host.end();\n }\n this._resolve(true);\n },\n\n cancel: function() {\n if (this.host.cancel) {\n this.host.cancel();\n }\n this._resolve(false);\n },\n\n complete: function(response) {\n var self = this;\n if (self._state === INITIAL_STATE) {\n self._state = DONE_PENDING_STATE;\n self._tick(function() {\n self._resolve(response);\n });\n }\n },\n\n _resolve: function(response) {\n if (this._state !== DONE_COMPLETE_STATE) {\n forEach(this._doneCallbacks, function(fn) {\n fn(response);\n });\n this._doneCallbacks.length = 0;\n this._state = DONE_COMPLETE_STATE;\n }\n }\n };\n\n return AnimateRunner;\n }];\n};\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,\n * then the `$animateCss` service will actually perform animations.\n *\n * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.\n */\nvar $CoreAnimateCssProvider = function() {\n this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {\n\n return function(element, initialOptions) {\n // all of the animation functions should create\n // a copy of the options data, however, if a\n // parent service has already created a copy then\n // we should stick to using that\n var options = initialOptions || {};\n if (!options.$$prepared) {\n options = copy(options);\n }\n\n // there is no point in applying the styles since\n // there is no animation that goes on at all in\n // this version of $animateCss.\n if (options.cleanupStyles) {\n options.from = options.to = null;\n }\n\n if (options.from) {\n element.css(options.from);\n options.from = null;\n }\n\n /* jshint newcap: false*/\n var closed, runner = new $$AnimateRunner();\n return {\n start: run,\n end: run\n };\n\n function run() {\n $$rAF(function() {\n applyAnimationContents();\n if (!closed) {\n runner.complete();\n }\n closed = true;\n });\n return runner;\n }\n\n function applyAnimationContents() {\n if (options.addClass) {\n element.addClass(options.addClass);\n options.addClass = null;\n }\n if (options.removeClass) {\n element.removeClass(options.removeClass);\n options.removeClass = null;\n }\n if (options.to) {\n element.css(options.to);\n options.to = null;\n }\n }\n };\n }];\n};\n\n/* global stripHash: true */\n\n/**\n * ! This is a private undocumented service !\n *\n * @name $browser\n * @requires $log\n * @description\n * This object has two goals:\n *\n * - hide all the global state in the browser caused by the window object\n * - abstract away all the browser specific features and inconsistencies\n *\n * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`\n * service, which can be used for convenient testing of the application without the interaction with\n * the real browser apis.\n */\n/**\n * @param {object} window The global window object.\n * @param {object} document jQuery wrapped document.\n * @param {object} $log window.console or an object with the same interface.\n * @param {object} $sniffer $sniffer service\n */\nfunction Browser(window, document, $log, $sniffer) {\n var self = this,\n rawDocument = document[0],\n location = window.location,\n history = window.history,\n setTimeout = window.setTimeout,\n clearTimeout = window.clearTimeout,\n pendingDeferIds = {};\n\n self.isMock = false;\n\n var outstandingRequestCount = 0;\n var outstandingRequestCallbacks = [];\n\n // TODO(vojta): remove this temporary api\n self.$$completeOutstandingRequest = completeOutstandingRequest;\n self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };\n\n /**\n * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`\n * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.\n */\n function completeOutstandingRequest(fn) {\n try {\n fn.apply(null, sliceArgs(arguments, 1));\n } finally {\n outstandingRequestCount--;\n if (outstandingRequestCount === 0) {\n while (outstandingRequestCallbacks.length) {\n try {\n outstandingRequestCallbacks.pop()();\n } catch (e) {\n $log.error(e);\n }\n }\n }\n }\n }\n\n function getHash(url) {\n var index = url.indexOf('#');\n return index === -1 ? '' : url.substr(index);\n }\n\n /**\n * @private\n * Note: this method is used only by scenario runner\n * TODO(vojta): prefix this method with $$ ?\n * @param {function()} callback Function that will be called when no outstanding request\n */\n self.notifyWhenNoOutstandingRequests = function(callback) {\n if (outstandingRequestCount === 0) {\n callback();\n } else {\n outstandingRequestCallbacks.push(callback);\n }\n };\n\n //////////////////////////////////////////////////////////////\n // URL API\n //////////////////////////////////////////////////////////////\n\n var cachedState, lastHistoryState,\n lastBrowserUrl = location.href,\n baseElement = document.find('base'),\n pendingLocation = null;\n\n cacheState();\n lastHistoryState = cachedState;\n\n /**\n * @name $browser#url\n *\n * @description\n * GETTER:\n * Without any argument, this method just returns current value of location.href.\n *\n * SETTER:\n * With at least one argument, this method sets url to new value.\n * If html5 history api supported, pushState/replaceState is used, otherwise\n * location.href/location.replace is used.\n * Returns its own instance to allow chaining\n *\n * NOTE: this api is intended for use only by the $location service. Please use the\n * {@link ng.$location $location service} to change url.\n *\n * @param {string} url New url (when used as setter)\n * @param {boolean=} replace Should new url replace current history record?\n * @param {object=} state object to use with pushState/replaceState\n */\n self.url = function(url, replace, state) {\n // In modern browsers `history.state` is `null` by default; treating it separately\n // from `undefined` would cause `$browser.url('/foo')` to change `history.state`\n // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.\n if (isUndefined(state)) {\n state = null;\n }\n\n // Android Browser BFCache causes location, history reference to become stale.\n if (location !== window.location) location = window.location;\n if (history !== window.history) history = window.history;\n\n // setter\n if (url) {\n var sameState = lastHistoryState === state;\n\n // Don't change anything if previous and current URLs and states match. This also prevents\n // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.\n // See https://github.com/angular/angular.js/commit/ffb2701\n if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {\n return self;\n }\n var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);\n lastBrowserUrl = url;\n lastHistoryState = state;\n // Don't use history API if only the hash changed\n // due to a bug in IE10/IE11 which leads\n // to not firing a `hashchange` nor `popstate` event\n // in some cases (see #9143).\n if ($sniffer.history && (!sameBase || !sameState)) {\n history[replace ? 'replaceState' : 'pushState'](state, '', url);\n cacheState();\n // Do the assignment again so that those two variables are referentially identical.\n lastHistoryState = cachedState;\n } else {\n if (!sameBase || pendingLocation) {\n pendingLocation = url;\n }\n if (replace) {\n location.replace(url);\n } else if (!sameBase) {\n location.href = url;\n } else {\n location.hash = getHash(url);\n }\n if (location.href !== url) {\n pendingLocation = url;\n }\n }\n return self;\n // getter\n } else {\n // - pendingLocation is needed as browsers don't allow to read out\n // the new location.href if a reload happened or if there is a bug like in iOS 9 (see\n // https://openradar.appspot.com/22186109).\n // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172\n return pendingLocation || location.href.replace(/%27/g,\"'\");\n }\n };\n\n /**\n * @name $browser#state\n *\n * @description\n * This method is a getter.\n *\n * Return history.state or null if history.state is undefined.\n *\n * @returns {object} state\n */\n self.state = function() {\n return cachedState;\n };\n\n var urlChangeListeners = [],\n urlChangeInit = false;\n\n function cacheStateAndFireUrlChange() {\n pendingLocation = null;\n cacheState();\n fireUrlChange();\n }\n\n function getCurrentState() {\n try {\n return history.state;\n } catch (e) {\n // MSIE can reportedly throw when there is no state (UNCONFIRMED).\n }\n }\n\n // This variable should be used *only* inside the cacheState function.\n var lastCachedState = null;\n function cacheState() {\n // This should be the only place in $browser where `history.state` is read.\n cachedState = getCurrentState();\n cachedState = isUndefined(cachedState) ? null : cachedState;\n\n // Prevent callbacks fo fire twice if both hashchange & popstate were fired.\n if (equals(cachedState, lastCachedState)) {\n cachedState = lastCachedState;\n }\n lastCachedState = cachedState;\n }\n\n function fireUrlChange() {\n if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {\n return;\n }\n\n lastBrowserUrl = self.url();\n lastHistoryState = cachedState;\n forEach(urlChangeListeners, function(listener) {\n listener(self.url(), cachedState);\n });\n }\n\n /**\n * @name $browser#onUrlChange\n *\n * @description\n * Register callback function that will be called, when url changes.\n *\n * It's only called when the url is changed from outside of angular:\n * - user types different url into address bar\n * - user clicks on history (forward/back) button\n * - user clicks on a link\n *\n * It's not called when url is changed by $browser.url() method\n *\n * The listener gets called with new url as parameter.\n *\n * NOTE: this api is intended for use only by the $location service. Please use the\n * {@link ng.$location $location service} to monitor url changes in angular apps.\n *\n * @param {function(string)} listener Listener function to be called when url changes.\n * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.\n */\n self.onUrlChange = function(callback) {\n // TODO(vojta): refactor to use node's syntax for events\n if (!urlChangeInit) {\n // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)\n // don't fire popstate when user change the address bar and don't fire hashchange when url\n // changed by push/replaceState\n\n // html5 history api - popstate event\n if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);\n // hashchange event\n jqLite(window).on('hashchange', cacheStateAndFireUrlChange);\n\n urlChangeInit = true;\n }\n\n urlChangeListeners.push(callback);\n return callback;\n };\n\n /**\n * @private\n * Remove popstate and hashchange handler from window.\n *\n * NOTE: this api is intended for use only by $rootScope.\n */\n self.$$applicationDestroyed = function() {\n jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);\n };\n\n /**\n * Checks whether the url has changed outside of Angular.\n * Needs to be exported to be able to check for changes that have been done in sync,\n * as hashchange/popstate events fire in async.\n */\n self.$$checkUrlChange = fireUrlChange;\n\n //////////////////////////////////////////////////////////////\n // Misc API\n //////////////////////////////////////////////////////////////\n\n /**\n * @name $browser#baseHref\n *\n * @description\n * Returns current <base href>\n * (always relative - without domain)\n *\n * @returns {string} The current base href\n */\n self.baseHref = function() {\n var href = baseElement.attr('href');\n return href ? href.replace(/^(https?\\:)?\\/\\/[^\\/]*/, '') : '';\n };\n\n /**\n * @name $browser#defer\n * @param {function()} fn A function, who's execution should be deferred.\n * @param {number=} [delay=0] of milliseconds to defer the function execution.\n * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.\n *\n * @description\n * Executes a fn asynchronously via `setTimeout(fn, delay)`.\n *\n * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using\n * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed\n * via `$browser.defer.flush()`.\n *\n */\n self.defer = function(fn, delay) {\n var timeoutId;\n outstandingRequestCount++;\n timeoutId = setTimeout(function() {\n delete pendingDeferIds[timeoutId];\n completeOutstandingRequest(fn);\n }, delay || 0);\n pendingDeferIds[timeoutId] = true;\n return timeoutId;\n };\n\n\n /**\n * @name $browser#defer.cancel\n *\n * @description\n * Cancels a deferred task identified with `deferId`.\n *\n * @param {*} deferId Token returned by the `$browser.defer` function.\n * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n * canceled.\n */\n self.defer.cancel = function(deferId) {\n if (pendingDeferIds[deferId]) {\n delete pendingDeferIds[deferId];\n clearTimeout(deferId);\n completeOutstandingRequest(noop);\n return true;\n }\n return false;\n };\n\n}\n\nfunction $BrowserProvider() {\n this.$get = ['$window', '$log', '$sniffer', '$document',\n function($window, $log, $sniffer, $document) {\n return new Browser($window, $document, $log, $sniffer);\n }];\n}\n\n/**\n * @ngdoc service\n * @name $cacheFactory\n *\n * @description\n * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to\n * them.\n *\n * ```js\n *\n * var cache = $cacheFactory('cacheId');\n * expect($cacheFactory.get('cacheId')).toBe(cache);\n * expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();\n *\n * cache.put(\"key\", \"value\");\n * cache.put(\"another key\", \"another value\");\n *\n * // We've specified no options on creation\n * expect(cache.info()).toEqual({id: 'cacheId', size: 2});\n *\n * ```\n *\n *\n * @param {string} cacheId Name or id of the newly created cache.\n * @param {object=} options Options object that specifies the cache behavior. Properties:\n *\n * - `{number=}` `capacity` — turns the cache into LRU cache.\n *\n * @returns {object} Newly created cache object with the following set of methods:\n *\n * - `{object}` `info()` — Returns id, size, and options of cache.\n * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns\n * it.\n * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.\n * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.\n * - `{void}` `removeAll()` — Removes all cached values.\n * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.\n *\n * @example\n <example module=\"cacheExampleApp\">\n <file name=\"index.html\">\n <div ng-controller=\"CacheController\">\n <input ng-model=\"newCacheKey\" placeholder=\"Key\">\n <input ng-model=\"newCacheValue\" placeholder=\"Value\">\n <button ng-click=\"put(newCacheKey, newCacheValue)\">Cache</button>\n\n <p ng-if=\"keys.length\">Cached Values</p>\n <div ng-repeat=\"key in keys\">\n <span ng-bind=\"key\"></span>\n <span>: </span>\n <b ng-bind=\"cache.get(key)\"></b>\n </div>\n\n <p>Cache Info</p>\n <div ng-repeat=\"(key, value) in cache.info()\">\n <span ng-bind=\"key\"></span>\n <span>: </span>\n <b ng-bind=\"value\"></b>\n </div>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('cacheExampleApp', []).\n controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {\n $scope.keys = [];\n $scope.cache = $cacheFactory('cacheId');\n $scope.put = function(key, value) {\n if (angular.isUndefined($scope.cache.get(key))) {\n $scope.keys.push(key);\n }\n $scope.cache.put(key, angular.isUndefined(value) ? null : value);\n };\n }]);\n </file>\n <file name=\"style.css\">\n p {\n margin: 10px 0 3px;\n }\n </file>\n </example>\n */\nfunction $CacheFactoryProvider() {\n\n this.$get = function() {\n var caches = {};\n\n function cacheFactory(cacheId, options) {\n if (cacheId in caches) {\n throw minErr('$cacheFactory')('iid', \"CacheId '{0}' is already taken!\", cacheId);\n }\n\n var size = 0,\n stats = extend({}, options, {id: cacheId}),\n data = createMap(),\n capacity = (options && options.capacity) || Number.MAX_VALUE,\n lruHash = createMap(),\n freshEnd = null,\n staleEnd = null;\n\n /**\n * @ngdoc type\n * @name $cacheFactory.Cache\n *\n * @description\n * A cache object used to store and retrieve data, primarily used by\n * {@link $http $http} and the {@link ng.directive:script script} directive to cache\n * templates and other data.\n *\n * ```js\n * angular.module('superCache')\n * .factory('superCache', ['$cacheFactory', function($cacheFactory) {\n * return $cacheFactory('super-cache');\n * }]);\n * ```\n *\n * Example test:\n *\n * ```js\n * it('should behave like a cache', inject(function(superCache) {\n * superCache.put('key', 'value');\n * superCache.put('another key', 'another value');\n *\n * expect(superCache.info()).toEqual({\n * id: 'super-cache',\n * size: 2\n * });\n *\n * superCache.remove('another key');\n * expect(superCache.get('another key')).toBeUndefined();\n *\n * superCache.removeAll();\n * expect(superCache.info()).toEqual({\n * id: 'super-cache',\n * size: 0\n * });\n * }));\n * ```\n */\n return caches[cacheId] = {\n\n /**\n * @ngdoc method\n * @name $cacheFactory.Cache#put\n * @kind function\n *\n * @description\n * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be\n * retrieved later, and incrementing the size of the cache if the key was not already\n * present in the cache. If behaving like an LRU cache, it will also remove stale\n * entries from the set.\n *\n * It will not insert undefined values into the cache.\n *\n * @param {string} key the key under which the cached data is stored.\n * @param {*} value the value to store alongside the key. If it is undefined, the key\n * will not be stored.\n * @returns {*} the value stored.\n */\n put: function(key, value) {\n if (isUndefined(value)) return;\n if (capacity < Number.MAX_VALUE) {\n var lruEntry = lruHash[key] || (lruHash[key] = {key: key});\n\n refresh(lruEntry);\n }\n\n if (!(key in data)) size++;\n data[key] = value;\n\n if (size > capacity) {\n this.remove(staleEnd.key);\n }\n\n return value;\n },\n\n /**\n * @ngdoc method\n * @name $cacheFactory.Cache#get\n * @kind function\n *\n * @description\n * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.\n *\n * @param {string} key the key of the data to be retrieved\n * @returns {*} the value stored.\n */\n get: function(key) {\n if (capacity < Number.MAX_VALUE) {\n var lruEntry = lruHash[key];\n\n if (!lruEntry) return;\n\n refresh(lruEntry);\n }\n\n return data[key];\n },\n\n\n /**\n * @ngdoc method\n * @name $cacheFactory.Cache#remove\n * @kind function\n *\n * @description\n * Removes an entry from the {@link $cacheFactory.Cache Cache} object.\n *\n * @param {string} key the key of the entry to be removed\n */\n remove: function(key) {\n if (capacity < Number.MAX_VALUE) {\n var lruEntry = lruHash[key];\n\n if (!lruEntry) return;\n\n if (lruEntry == freshEnd) freshEnd = lruEntry.p;\n if (lruEntry == staleEnd) staleEnd = lruEntry.n;\n link(lruEntry.n,lruEntry.p);\n\n delete lruHash[key];\n }\n\n if (!(key in data)) return;\n\n delete data[key];\n size--;\n },\n\n\n /**\n * @ngdoc method\n * @name $cacheFactory.Cache#removeAll\n * @kind function\n *\n * @description\n * Clears the cache object of any entries.\n */\n removeAll: function() {\n data = createMap();\n size = 0;\n lruHash = createMap();\n freshEnd = staleEnd = null;\n },\n\n\n /**\n * @ngdoc method\n * @name $cacheFactory.Cache#destroy\n * @kind function\n *\n * @description\n * Destroys the {@link $cacheFactory.Cache Cache} object entirely,\n * removing it from the {@link $cacheFactory $cacheFactory} set.\n */\n destroy: function() {\n data = null;\n stats = null;\n lruHash = null;\n delete caches[cacheId];\n },\n\n\n /**\n * @ngdoc method\n * @name $cacheFactory.Cache#info\n * @kind function\n *\n * @description\n * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.\n *\n * @returns {object} an object with the following properties:\n * <ul>\n * <li>**id**: the id of the cache instance</li>\n * <li>**size**: the number of entries kept in the cache instance</li>\n * <li>**...**: any additional properties from the options object when creating the\n * cache.</li>\n * </ul>\n */\n info: function() {\n return extend({}, stats, {size: size});\n }\n };\n\n\n /**\n * makes the `entry` the freshEnd of the LRU linked list\n */\n function refresh(entry) {\n if (entry != freshEnd) {\n if (!staleEnd) {\n staleEnd = entry;\n } else if (staleEnd == entry) {\n staleEnd = entry.n;\n }\n\n link(entry.n, entry.p);\n link(entry, freshEnd);\n freshEnd = entry;\n freshEnd.n = null;\n }\n }\n\n\n /**\n * bidirectionally links two entries of the LRU linked list\n */\n function link(nextEntry, prevEntry) {\n if (nextEntry != prevEntry) {\n if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify\n if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify\n }\n }\n }\n\n\n /**\n * @ngdoc method\n * @name $cacheFactory#info\n *\n * @description\n * Get information about all the caches that have been created\n *\n * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`\n */\n cacheFactory.info = function() {\n var info = {};\n forEach(caches, function(cache, cacheId) {\n info[cacheId] = cache.info();\n });\n return info;\n };\n\n\n /**\n * @ngdoc method\n * @name $cacheFactory#get\n *\n * @description\n * Get access to a cache object by the `cacheId` used when it was created.\n *\n * @param {string} cacheId Name or id of a cache to access.\n * @returns {object} Cache object identified by the cacheId or undefined if no such cache.\n */\n cacheFactory.get = function(cacheId) {\n return caches[cacheId];\n };\n\n\n return cacheFactory;\n };\n}\n\n/**\n * @ngdoc service\n * @name $templateCache\n *\n * @description\n * The first time a template is used, it is loaded in the template cache for quick retrieval. You\n * can load templates directly into the cache in a `script` tag, or by consuming the\n * `$templateCache` service directly.\n *\n * Adding via the `script` tag:\n *\n * ```html\n * <script type=\"text/ng-template\" id=\"templateId.html\">\n * <p>This is the content of the template</p>\n * </script>\n * ```\n *\n * **Note:** the `script` tag containing the template does not need to be included in the `head` of\n * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,\n * element with ng-app attribute), otherwise the template will be ignored.\n *\n * Adding via the `$templateCache` service:\n *\n * ```js\n * var myApp = angular.module('myApp', []);\n * myApp.run(function($templateCache) {\n * $templateCache.put('templateId.html', 'This is the content of the template');\n * });\n * ```\n *\n * To retrieve the template later, simply use it in your HTML:\n * ```html\n * <div ng-include=\" 'templateId.html' \"></div>\n * ```\n *\n * or get it via Javascript:\n * ```js\n * $templateCache.get('templateId.html')\n * ```\n *\n * See {@link ng.$cacheFactory $cacheFactory}.\n *\n */\nfunction $TemplateCacheProvider() {\n this.$get = ['$cacheFactory', function($cacheFactory) {\n return $cacheFactory('templates');\n }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n * Any commits to this file should be reviewed with security in mind. *\n * Changes to this file can potentially create security vulnerabilities. *\n * An approval from 2 Core members with history of modifying *\n * this file is required. *\n * *\n * Does the change somehow allow for arbitrary javascript to be executed? *\n * Or allows for someone to change the prototype of built-in objects? *\n * Or gives undesired access to variables likes document or window? *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!\n *\n * DOM-related variables:\n *\n * - \"node\" - DOM Node\n * - \"element\" - DOM Element or Node\n * - \"$node\" or \"$element\" - jqLite-wrapped node or element\n *\n *\n * Compiler related stuff:\n *\n * - \"linkFn\" - linking fn of a single directive\n * - \"nodeLinkFn\" - function that aggregates all linking fns for a particular node\n * - \"childLinkFn\" - function that aggregates all linking fns for child nodes of a particular node\n * - \"compositeLinkFn\" - function that aggregates all linking fns for a compilation root (nodeList)\n */\n\n\n/**\n * @ngdoc service\n * @name $compile\n * @kind function\n *\n * @description\n * Compiles an HTML string or DOM into a template and produces a template function, which\n * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.\n *\n * The compilation is a process of walking the DOM tree and matching DOM elements to\n * {@link ng.$compileProvider#directive directives}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** This document is an in-depth reference of all directive options.\n * For a gentle introduction to directives with examples of common use cases,\n * see the {@link guide/directive directive guide}.\n * </div>\n *\n * ## Comprehensive Directive API\n *\n * There are many different options for a directive.\n *\n * The difference resides in the return value of the factory function.\n * You can either return a \"Directive Definition Object\" (see below) that defines the directive properties,\n * or just the `postLink` function (all other properties will have the default values).\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's recommended to use the \"directive definition object\" form.\n * </div>\n *\n * Here's an example directive declared with a Directive Definition Object:\n *\n * ```js\n * var myModule = angular.module(...);\n *\n * myModule.directive('directiveName', function factory(injectables) {\n * var directiveDefinitionObject = {\n * priority: 0,\n * template: '<div></div>', // or // function(tElement, tAttrs) { ... },\n * // or\n * // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },\n * transclude: false,\n * restrict: 'A',\n * templateNamespace: 'html',\n * scope: false,\n * controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },\n * controllerAs: 'stringIdentifier',\n * bindToController: false,\n * require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],\n * compile: function compile(tElement, tAttrs, transclude) {\n * return {\n * pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n * post: function postLink(scope, iElement, iAttrs, controller) { ... }\n * }\n * // or\n * // return function postLink( ... ) { ... }\n * },\n * // or\n * // link: {\n * // pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n * // post: function postLink(scope, iElement, iAttrs, controller) { ... }\n * // }\n * // or\n * // link: function postLink( ... ) { ... }\n * };\n * return directiveDefinitionObject;\n * });\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Any unspecified options will use the default value. You can see the default values below.\n * </div>\n *\n * Therefore the above can be simplified as:\n *\n * ```js\n * var myModule = angular.module(...);\n *\n * myModule.directive('directiveName', function factory(injectables) {\n * var directiveDefinitionObject = {\n * link: function postLink(scope, iElement, iAttrs) { ... }\n * };\n * return directiveDefinitionObject;\n * // or\n * // return function postLink(scope, iElement, iAttrs) { ... }\n * });\n * ```\n *\n *\n *\n * ### Directive Definition Object\n *\n * The directive definition object provides instructions to the {@link ng.$compile\n * compiler}. The attributes are:\n *\n * #### `multiElement`\n * When this property is set to true, the HTML compiler will collect DOM nodes between\n * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them\n * together as the directive elements. It is recommended that this feature be used on directives\n * which are not strictly behavioural (such as {@link ngClick}), and which\n * do not manipulate or replace child nodes (such as {@link ngInclude}).\n *\n * #### `priority`\n * When there are multiple directives defined on a single DOM element, sometimes it\n * is necessary to specify the order in which the directives are applied. The `priority` is used\n * to sort the directives before their `compile` functions get called. Priority is defined as a\n * number. Directives with greater numerical `priority` are compiled first. Pre-link functions\n * are also run in priority order, but post-link functions are run in reverse order. The order\n * of directives with the same priority is undefined. The default priority is `0`.\n *\n * #### `terminal`\n * If set to true then the current `priority` will be the last set of directives\n * which will execute (any directives at the current priority will still execute\n * as the order of execution on same `priority` is undefined). Note that expressions\n * and other directives used in the directive's template will also be excluded from execution.\n *\n * #### `scope`\n * The scope property can be `true`, an object or a falsy value:\n *\n * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.\n *\n * * **`true`:** A new child scope that prototypically inherits from its parent will be created for\n * the directive's element. If multiple directives on the same element request a new scope,\n * only one new scope is created. The new scope rule does not apply for the root of the template\n * since the root of the template always gets a new scope.\n *\n * * **`{...}` (an object hash):** A new \"isolate\" scope is created for the directive's element. The\n * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent\n * scope. This is useful when creating reusable components, which should not accidentally read or modify\n * data in the parent scope.\n *\n * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the\n * directive's element. These local properties are useful for aliasing values for templates. The keys in\n * the object hash map to the name of the property on the isolate scope; the values define how the property\n * is bound to the parent scope, via matching attributes on the directive's element:\n *\n * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is\n * always a string since DOM attributes are strings. If no `attr` name is specified then the\n * attribute name is assumed to be the same as the local name. Given `<my-component\n * my-attr=\"hello {{name}}\">` and the isolate scope definition `scope: { localName:'@myAttr' }`,\n * the directive's scope property `localName` will reflect the interpolated value of `hello\n * {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's\n * scope. The `name` is read from the parent scope (not the directive's scope).\n *\n * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression\n * passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.\n * If no `attr` name is specified then the attribute name is assumed to be the same as the local\n * name. Given `<my-component my-attr=\"parentModel\">` and the isolate scope definition `scope: {\n * localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the\n * value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in\n * `localModel` and vice versa. Optional attributes should be marked as such with a question mark:\n * `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't\n * optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})\n * will be thrown upon discovering changes to the local value, since it will be impossible to sync\n * them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}\n * method is used for tracking changes, and the equality check is based on object identity.\n * However, if an object literal or an array literal is passed as the binding expression, the\n * equality check is done by value (using the {@link angular.equals} function). It's also possible\n * to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection\n * `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).\n *\n * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If\n * no `attr` name is specified then the attribute name is assumed to be the same as the local name.\n * Given `<my-component my-attr=\"count = count + value\">` and the isolate scope definition `scope: {\n * localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for\n * the `count = count + value` expression. Often it's desirable to pass data from the isolated scope\n * via an expression to the parent scope. This can be done by passing a map of local variable names\n * and values into the expression wrapper fn. For example, if the expression is `increment(amount)`\n * then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.\n *\n * In general it's possible to apply more than one directive to one element, but there might be limitations\n * depending on the type of scope required by the directives. The following points will help explain these limitations.\n * For simplicity only two directives are taken into account, but it is also applicable for several directives:\n *\n * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope\n * * **child scope** + **no scope** => Both directives will share one single child scope\n * * **child scope** + **child scope** => Both directives will share one single child scope\n * * **isolated scope** + **no scope** => The isolated directive will use it's own created isolated scope. The other directive will use\n * its parent's scope\n * * **isolated scope** + **child scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives cannot\n * be applied to the same element.\n * * **isolated scope** + **isolated scope** => **Won't work!** Only one scope can be related to one element. Therefore these directives\n * cannot be applied to the same element.\n *\n *\n * #### `bindToController`\n * This property is used to bind scope properties directly to the controller. It can be either\n * `true` or an object hash with the same format as the `scope` property. Additionally, a controller\n * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller\n * definition: `controller: 'myCtrl as myAlias'`.\n *\n * When an isolate scope is used for a directive (see above), `bindToController: true` will\n * allow a component to have its properties bound to the controller, rather than to scope. When the controller\n * is instantiated, the initial values of the isolate scope bindings are already available.\n *\n * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.\n * This will set up the scope bindings to the controller directly. Note that `scope` can still be used\n * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate\n * scope (useful for component directives).\n *\n * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.\n *\n *\n * #### `controller`\n * Controller constructor function. The controller is instantiated before the\n * pre-linking phase and can be accessed by other directives (see\n * `require` attribute). This allows the directives to communicate with each other and augment\n * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:\n *\n * * `$scope` - Current scope associated with the element\n * * `$element` - Current element\n * * `$attrs` - Current attributes object for the element\n * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:\n * `function([scope], cloneLinkingFn, futureParentElement)`.\n * * `scope`: optional argument to override the scope.\n * * `cloneLinkingFn`: optional argument to create clones of the original transcluded content.\n * * `futureParentElement`:\n * * defines the parent to which the `cloneLinkingFn` will add the cloned elements.\n * * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.\n * * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)\n * and when the `cloneLinkinFn` is passed,\n * as those elements need to created and cloned in a special way when they are defined outside their\n * usual containers (e.g. like `<svg>`).\n * * See also the `directive.templateNamespace` property.\n *\n *\n * #### `require`\n * Require another directive and inject its controller as the fourth argument to the linking function. The\n * `require` takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the\n * injected argument will be an array in corresponding order. If no such directive can be\n * found, or if the directive does not have a controller, then an error is raised (unless no link function\n * is specified, in which case error checking is skipped). The name can be prefixed with:\n *\n * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.\n * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.\n * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.\n * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.\n * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass\n * `null` to the `link` fn if not found.\n * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass\n * `null` to the `link` fn if not found.\n *\n *\n * #### `controllerAs`\n * Identifier name for a reference to the controller in the directive's scope.\n * This allows the controller to be referenced from the directive template. This is especially\n * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible\n * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the\n * `controllerAs` reference might overwrite a property that already exists on the parent scope.\n *\n *\n * #### `restrict`\n * String of subset of `EACM` which restricts the directive to a specific directive\n * declaration style. If omitted, the defaults (elements and attributes) are used.\n *\n * * `E` - Element name (default): `<my-directive></my-directive>`\n * * `A` - Attribute (default): `<div my-directive=\"exp\"></div>`\n * * `C` - Class: `<div class=\"my-directive: exp;\"></div>`\n * * `M` - Comment: `<!-- directive: my-directive exp -->`\n *\n *\n * #### `templateNamespace`\n * String representing the document type used by the markup in the template.\n * AngularJS needs this information as those elements need to be created and cloned\n * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.\n *\n * * `html` - All root nodes in the template are HTML. Root nodes may also be\n * top-level elements such as `<svg>` or `<math>`.\n * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).\n * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).\n *\n * If no `templateNamespace` is specified, then the namespace is considered to be `html`.\n *\n * #### `template`\n * HTML markup that may:\n * * Replace the contents of the directive's element (default).\n * * Replace the directive's element itself (if `replace` is true - DEPRECATED).\n * * Wrap the contents of the directive's element (if `transclude` is true).\n *\n * Value may be:\n *\n * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.\n * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`\n * function api below) and returns a string value.\n *\n *\n * #### `templateUrl`\n * This is similar to `template` but the template is loaded from the specified URL, asynchronously.\n *\n * Because template loading is asynchronous the compiler will suspend compilation of directives on that element\n * for later when the template has been resolved. In the meantime it will continue to compile and link\n * sibling and parent elements as though this element had not contained any directives.\n *\n * The compiler does not suspend the entire compilation to wait for templates to be loaded because this\n * would result in the whole app \"stalling\" until all templates are loaded asynchronously - even in the\n * case when only one deeply nested directive has `templateUrl`.\n *\n * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}\n *\n * You can specify `templateUrl` as a string representing the URL or as a function which takes two\n * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns\n * a string value representing the url. In either case, the template URL is passed through {@link\n * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.\n *\n *\n * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)\n * specify what the template should replace. Defaults to `false`.\n *\n * * `true` - the template will replace the directive's element.\n * * `false` - the template will replace the contents of the directive's element.\n *\n * The replacement process migrates all of the attributes / classes from the old element to the new\n * one. See the {@link guide/directive#template-expanding-directive\n * Directives Guide} for an example.\n *\n * There are very few scenarios where element replacement is required for the application function,\n * the main one being reusable custom components that are used within SVG contexts\n * (because SVG doesn't work with custom elements in the DOM tree).\n *\n * #### `transclude`\n * Extract the contents of the element where the directive appears and make it available to the directive.\n * The contents are compiled and provided to the directive as a **transclusion function**. See the\n * {@link $compile#transclusion Transclusion} section below.\n *\n * There are two kinds of transclusion depending upon whether you want to transclude just the contents of the\n * directive's element or the entire element:\n *\n * * `true` - transclude the content (i.e. the child nodes) of the directive's element.\n * * `'element'` - transclude the whole of the directive's element including any directives on this\n * element that defined at a lower priority than this directive. When used, the `template`\n * property is ignored.\n *\n *\n * #### `compile`\n *\n * ```js\n * function compile(tElement, tAttrs, transclude) { ... }\n * ```\n *\n * The compile function deals with transforming the template DOM. Since most directives do not do\n * template transformation, it is not used often. The compile function takes the following arguments:\n *\n * * `tElement` - template element - The element where the directive has been declared. It is\n * safe to do template transformation on the element and child elements only.\n *\n * * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared\n * between all directive compile functions.\n *\n * * `transclude` - [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`\n *\n * <div class=\"alert alert-warning\">\n * **Note:** The template instance and the link instance may be different objects if the template has\n * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that\n * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration\n * should be done in a linking function rather than in a compile function.\n * </div>\n\n * <div class=\"alert alert-warning\">\n * **Note:** The compile function cannot handle directives that recursively use themselves in their\n * own templates or compile functions. Compiling these directives results in an infinite loop and\n * stack overflow errors.\n *\n * This can be avoided by manually using $compile in the postLink function to imperatively compile\n * a directive's template instead of relying on automatic template compilation via `template` or\n * `templateUrl` declaration or manual compilation inside the compile function.\n * </div>\n *\n * <div class=\"alert alert-danger\">\n * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it\n * e.g. does not know about the right outer scope. Please use the transclude function that is passed\n * to the link function instead.\n * </div>\n\n * A compile function can have a return value which can be either a function or an object.\n *\n * * returning a (post-link) function - is equivalent to registering the linking function via the\n * `link` property of the config object when the compile function is empty.\n *\n * * returning an object with function(s) registered via `pre` and `post` properties - allows you to\n * control when a linking function should be called during the linking phase. See info about\n * pre-linking and post-linking functions below.\n *\n *\n * #### `link`\n * This property is used only if the `compile` property is not defined.\n *\n * ```js\n * function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }\n * ```\n *\n * The link function is responsible for registering DOM listeners as well as updating the DOM. It is\n * executed after the template has been cloned. This is where most of the directive logic will be\n * put.\n *\n * * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the\n * directive for registering {@link ng.$rootScope.Scope#$watch watches}.\n *\n * * `iElement` - instance element - The element where the directive is to be used. It is safe to\n * manipulate the children of the element only in `postLink` function since the children have\n * already been linked.\n *\n * * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared\n * between all directive linking functions.\n *\n * * `controller` - the directive's required controller instance(s) - Instances are shared\n * among all directives, which allows the directives to use the controllers as a communication\n * channel. The exact value depends on the directive's `require` property:\n * * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one\n * * `string`: the controller instance\n * * `array`: array of controller instances\n *\n * If a required controller cannot be found, and it is optional, the instance is `null`,\n * otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.\n *\n * Note that you can also require the directive's own controller - it will be made available like\n * any other controller.\n *\n * * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.\n * This is the same as the `$transclude`\n * parameter of directive controllers, see there for details.\n * `function([scope], cloneLinkingFn, futureParentElement)`.\n *\n * #### Pre-linking function\n *\n * Executed before the child elements are linked. Not safe to do DOM transformation since the\n * compiler linking function will fail to locate the correct elements for linking.\n *\n * #### Post-linking function\n *\n * Executed after the child elements are linked.\n *\n * Note that child elements that contain `templateUrl` directives will not have been compiled\n * and linked since they are waiting for their template to load asynchronously and their own\n * compilation and linking has been suspended until that occurs.\n *\n * It is safe to do DOM transformation in the post-linking function on elements that are not waiting\n * for their async templates to be resolved.\n *\n *\n * ### Transclusion\n *\n * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and\n * copying them to another part of the DOM, while maintaining their connection to the original AngularJS\n * scope from where they were taken.\n *\n * Transclusion is used (often with {@link ngTransclude}) to insert the\n * original contents of a directive's element into a specified place in the template of the directive.\n * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded\n * content has access to the properties on the scope from which it was taken, even if the directive\n * has isolated scope.\n * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.\n *\n * This makes it possible for the widget to have private state for its template, while the transcluded\n * content has access to its originating scope.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** When testing an element transclude directive you must not place the directive at the root of the\n * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives\n * Testing Transclusion Directives}.\n * </div>\n *\n * #### Transclusion Functions\n *\n * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion\n * function** to the directive's `link` function and `controller`. This transclusion function is a special\n * **linking function** that will return the compiled contents linked to a new transclusion scope.\n *\n * <div class=\"alert alert-info\">\n * If you are just using {@link ngTransclude} then you don't need to worry about this function, since\n * ngTransclude will deal with it for us.\n * </div>\n *\n * If you want to manually control the insertion and removal of the transcluded content in your directive\n * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery\n * object that contains the compiled DOM, which is linked to the correct transclusion scope.\n *\n * When you call a transclusion function you can pass in a **clone attach function**. This function accepts\n * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded\n * content and the `scope` is the newly created transclusion scope, to which the clone is bound.\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a translude function\n * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.\n * </div>\n *\n * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone\n * attach function**:\n *\n * ```js\n * var transcludedContent, transclusionScope;\n *\n * $transclude(function(clone, scope) {\n * element.append(clone);\n * transcludedContent = clone;\n * transclusionScope = scope;\n * });\n * ```\n *\n * Later, if you want to remove the transcluded content from your DOM then you should also destroy the\n * associated transclusion scope:\n *\n * ```js\n * transcludedContent.remove();\n * transclusionScope.$destroy();\n * ```\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: if you intend to add and remove transcluded content manually in your directive\n * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),\n * then you are also responsible for calling `$destroy` on the transclusion scope.\n * </div>\n *\n * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}\n * automatically destroy their transluded clones as necessary so you do not need to worry about this if\n * you are simply using {@link ngTransclude} to inject the transclusion into your directive.\n *\n *\n * #### Transclusion Scopes\n *\n * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion\n * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed\n * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it\n * was taken.\n *\n * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look\n * like this:\n *\n * ```html\n * <div ng-app>\n * <div isolate>\n * <div transclusion>\n * </div>\n * </div>\n * </div>\n * ```\n *\n * The `$parent` scope hierarchy will look like this:\n *\n ```\n - $rootScope\n - isolate\n - transclusion\n ```\n *\n * but the scopes will inherit prototypically from different scopes to their `$parent`.\n *\n ```\n - $rootScope\n - transclusion\n - isolate\n ```\n *\n *\n * ### Attributes\n *\n * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the\n * `link()` or `compile()` functions. It has a variety of uses.\n *\n * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:\n * 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access\n * to the attributes.\n *\n * * *Directive inter-communication:* All directives share the same instance of the attributes\n * object which allows the directives to use the attributes object as inter directive\n * communication.\n *\n * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object\n * allowing other directives to read the interpolated value.\n *\n * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes\n * that contain interpolation (e.g. `src=\"{{bar}}\"`). Not only is this very efficient but it's also\n * the only way to easily get the actual value because during the linking phase the interpolation\n * hasn't been evaluated yet and so the value is at this time set to `undefined`.\n *\n * ```js\n * function linkingFn(scope, elm, attrs, ctrl) {\n * // get the attribute value\n * console.log(attrs.ngModel);\n *\n * // change the attribute\n * attrs.$set('ngModel', 'new value');\n *\n * // observe changes to interpolated attribute\n * attrs.$observe('ngModel', function(value) {\n * console.log('ngModel has changed value to ' + value);\n * });\n * }\n * ```\n *\n * ## Example\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Typically directives are registered with `module.directive`. The example below is\n * to illustrate how `$compile` works.\n * </div>\n *\n <example module=\"compileExample\">\n <file name=\"index.html\">\n <script>\n angular.module('compileExample', [], function($compileProvider) {\n // configure new 'compile' directive by passing a directive\n // factory function. The factory function injects the '$compile'\n $compileProvider.directive('compile', function($compile) {\n // directive factory creates a link function\n return function(scope, element, attrs) {\n scope.$watch(\n function(scope) {\n // watch the 'compile' expression for changes\n return scope.$eval(attrs.compile);\n },\n function(value) {\n // when the 'compile' expression changes\n // assign it into the current DOM\n element.html(value);\n\n // compile the new DOM and link it to the current\n // scope.\n // NOTE: we only compile .childNodes so that\n // we don't get into infinite loop compiling ourselves\n $compile(element.contents())(scope);\n }\n );\n };\n });\n })\n .controller('GreeterController', ['$scope', function($scope) {\n $scope.name = 'Angular';\n $scope.html = 'Hello {{name}}';\n }]);\n </script>\n <div ng-controller=\"GreeterController\">\n <input ng-model=\"name\"> <br/>\n <textarea ng-model=\"html\"></textarea> <br/>\n <div compile=\"html\"></div>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should auto compile', function() {\n var textarea = $('textarea');\n var output = $('div[compile]');\n // The initial state reads 'Hello Angular'.\n expect(output.getText()).toBe('Hello Angular');\n textarea.clear();\n textarea.sendKeys('{{name}}!');\n expect(output.getText()).toBe('Angular!');\n });\n </file>\n </example>\n\n *\n *\n * @param {string|DOMElement} element Element or HTML string to compile into a template function.\n * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.\n *\n * <div class=\"alert alert-danger\">\n * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it\n * e.g. will not use the right outer scope. Please pass the transclude function as a\n * `parentBoundTranscludeFn` to the link function instead.\n * </div>\n *\n * @param {number} maxPriority only apply directives lower than given priority (Only effects the\n * root element(s), not their children)\n * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template\n * (a DOM element/tree) to a scope. Where:\n *\n * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.\n * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the\n * `template` and call the `cloneAttachFn` function allowing the caller to attach the\n * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is\n * called as: <br/> `cloneAttachFn(clonedElement, scope)` where:\n *\n * * `clonedElement` - is a clone of the original `element` passed into the compiler.\n * * `scope` - is the current scope with which the linking function is working with.\n *\n * * `options` - An optional object hash with linking options. If `options` is provided, then the following\n * keys may be used to control linking behavior:\n *\n * * `parentBoundTranscludeFn` - the transclude function made available to\n * directives; if given, it will be passed through to the link functions of\n * directives found in `element` during compilation.\n * * `transcludeControllers` - an object hash with keys that map controller names\n * to a hash with the key `instance`, which maps to the controller instance;\n * if given, it will make the controllers available to directives on the compileNode:\n * ```\n * {\n * parent: {\n * instance: parentControllerInstance\n * }\n * }\n * ```\n * * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add\n * the cloned elements; only needed for transcludes that are allowed to contain non html\n * elements (e.g. SVG elements). See also the directive.controller property.\n *\n * Calling the linking function returns the element of the template. It is either the original\n * element passed in, or the clone of the element if the `cloneAttachFn` is provided.\n *\n * After linking the view is not updated until after a call to $digest which typically is done by\n * Angular automatically.\n *\n * If you need access to the bound view, there are two ways to do it:\n *\n * - If you are not asking the linking function to clone the template, create the DOM element(s)\n * before you send them to the compiler and keep this reference around.\n * ```js\n * var element = $compile('<p>{{total}}</p>')(scope);\n * ```\n *\n * - if on the other hand, you need the element to be cloned, the view reference from the original\n * example would not point to the clone, but rather to the original template that was cloned. In\n * this case, you can access the clone via the cloneAttachFn:\n * ```js\n * var templateElement = angular.element('<p>{{total}}</p>'),\n * scope = ....;\n *\n * var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {\n * //attach the clone to DOM document at the right place\n * });\n *\n * //now we have reference to the cloned DOM via `clonedElement`\n * ```\n *\n *\n * For information on how the compiler works, see the\n * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.\n */\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $compileProvider\n *\n * @description\n */\n$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];\nfunction $CompileProvider($provide, $$sanitizeUriProvider) {\n var hasDirectives = {},\n Suffix = 'Directive',\n COMMENT_DIRECTIVE_REGEXP = /^\\s*directive\\:\\s*([\\w\\-]+)\\s+(.*)$/,\n CLASS_DIRECTIVE_REGEXP = /(([\\w\\-]+)(?:\\:([^;]+))?;?)/,\n ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),\n REQUIRE_PREFIX_REGEXP = /^(?:(\\^\\^?)?(\\?)?(\\^\\^?)?)?/;\n\n // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes\n // The assumption is that future DOM event attribute names will begin with\n // 'on' and be composed of only English letters.\n var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;\n var bindingCache = createMap();\n\n function parseIsolateBindings(scope, directiveName, isController) {\n var LOCAL_REGEXP = /^\\s*([@&]|=(\\*?))(\\??)\\s*(\\w*)\\s*$/;\n\n var bindings = createMap();\n\n forEach(scope, function(definition, scopeName) {\n if (definition in bindingCache) {\n bindings[scopeName] = bindingCache[definition];\n return;\n }\n var match = definition.match(LOCAL_REGEXP);\n\n if (!match) {\n throw $compileMinErr('iscp',\n \"Invalid {3} for directive '{0}'.\" +\n \" Definition: {... {1}: '{2}' ...}\",\n directiveName, scopeName, definition,\n (isController ? \"controller bindings definition\" :\n \"isolate scope definition\"));\n }\n\n bindings[scopeName] = {\n mode: match[1][0],\n collection: match[2] === '*',\n optional: match[3] === '?',\n attrName: match[4] || scopeName\n };\n if (match[4]) {\n bindingCache[definition] = bindings[scopeName];\n }\n });\n\n return bindings;\n }\n\n function parseDirectiveBindings(directive, directiveName) {\n var bindings = {\n isolateScope: null,\n bindToController: null\n };\n if (isObject(directive.scope)) {\n if (directive.bindToController === true) {\n bindings.bindToController = parseIsolateBindings(directive.scope,\n directiveName, true);\n bindings.isolateScope = {};\n } else {\n bindings.isolateScope = parseIsolateBindings(directive.scope,\n directiveName, false);\n }\n }\n if (isObject(directive.bindToController)) {\n bindings.bindToController =\n parseIsolateBindings(directive.bindToController, directiveName, true);\n }\n if (isObject(bindings.bindToController)) {\n var controller = directive.controller;\n var controllerAs = directive.controllerAs;\n if (!controller) {\n // There is no controller, there may or may not be a controllerAs property\n throw $compileMinErr('noctrl',\n \"Cannot bind to controller without directive '{0}'s controller.\",\n directiveName);\n } else if (!identifierForController(controller, controllerAs)) {\n // There is a controller, but no identifier or controllerAs property\n throw $compileMinErr('noident',\n \"Cannot bind to controller without identifier for directive '{0}'.\",\n directiveName);\n }\n }\n return bindings;\n }\n\n function assertValidDirectiveName(name) {\n var letter = name.charAt(0);\n if (!letter || letter !== lowercase(letter)) {\n throw $compileMinErr('baddir', \"Directive name '{0}' is invalid. The first character must be a lowercase letter\", name);\n }\n if (name !== name.trim()) {\n throw $compileMinErr('baddir',\n \"Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces\",\n name);\n }\n }\n\n /**\n * @ngdoc method\n * @name $compileProvider#directive\n * @kind function\n *\n * @description\n * Register a new directive with the compiler.\n *\n * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which\n * will match as <code>ng-bind</code>), or an object map of directives where the keys are the\n * names and the values are the factories.\n * @param {Function|Array} directiveFactory An injectable directive factory function. See\n * {@link guide/directive} for more info.\n * @returns {ng.$compileProvider} Self for chaining.\n */\n this.directive = function registerDirective(name, directiveFactory) {\n assertNotHasOwnProperty(name, 'directive');\n if (isString(name)) {\n assertValidDirectiveName(name);\n assertArg(directiveFactory, 'directiveFactory');\n if (!hasDirectives.hasOwnProperty(name)) {\n hasDirectives[name] = [];\n $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',\n function($injector, $exceptionHandler) {\n var directives = [];\n forEach(hasDirectives[name], function(directiveFactory, index) {\n try {\n var directive = $injector.invoke(directiveFactory);\n if (isFunction(directive)) {\n directive = { compile: valueFn(directive) };\n } else if (!directive.compile && directive.link) {\n directive.compile = valueFn(directive.link);\n }\n directive.priority = directive.priority || 0;\n directive.index = index;\n directive.name = directive.name || name;\n directive.require = directive.require || (directive.controller && directive.name);\n directive.restrict = directive.restrict || 'EA';\n directive.$$moduleName = directiveFactory.$$moduleName;\n directives.push(directive);\n } catch (e) {\n $exceptionHandler(e);\n }\n });\n return directives;\n }]);\n }\n hasDirectives[name].push(directiveFactory);\n } else {\n forEach(name, reverseParams(registerDirective));\n }\n return this;\n };\n\n\n /**\n * @ngdoc method\n * @name $compileProvider#aHrefSanitizationWhitelist\n * @kind function\n *\n * @description\n * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n * urls during a[href] sanitization.\n *\n * The sanitization is a security measure aimed at preventing XSS attacks via html links.\n *\n * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n *\n * @param {RegExp=} regexp New regexp to whitelist urls with.\n * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n * chaining otherwise.\n */\n this.aHrefSanitizationWhitelist = function(regexp) {\n if (isDefined(regexp)) {\n $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);\n return this;\n } else {\n return $$sanitizeUriProvider.aHrefSanitizationWhitelist();\n }\n };\n\n\n /**\n * @ngdoc method\n * @name $compileProvider#imgSrcSanitizationWhitelist\n * @kind function\n *\n * @description\n * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n * urls during img[src] sanitization.\n *\n * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n *\n * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n *\n * @param {RegExp=} regexp New regexp to whitelist urls with.\n * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n * chaining otherwise.\n */\n this.imgSrcSanitizationWhitelist = function(regexp) {\n if (isDefined(regexp)) {\n $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);\n return this;\n } else {\n return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();\n }\n };\n\n /**\n * @ngdoc method\n * @name $compileProvider#debugInfoEnabled\n *\n * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the\n * current debugInfoEnabled state\n * @returns {*} current value if used as getter or itself (chaining) if used as setter\n *\n * @kind function\n *\n * @description\n * Call this method to enable/disable various debug runtime information in the compiler such as adding\n * binding information and a reference to the current scope on to DOM elements.\n * If enabled, the compiler will add the following to DOM elements that have been bound to the scope\n * * `ng-binding` CSS class\n * * `$binding` data property containing an array of the binding expressions\n *\n * You may want to disable this in production for a significant performance boost. See\n * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.\n *\n * The default value is true.\n */\n var debugInfoEnabled = true;\n this.debugInfoEnabled = function(enabled) {\n if (isDefined(enabled)) {\n debugInfoEnabled = enabled;\n return this;\n }\n return debugInfoEnabled;\n };\n\n this.$get = [\n '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',\n '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',\n function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse,\n $controller, $rootScope, $sce, $animate, $$sanitizeUri) {\n\n var Attributes = function(element, attributesToCopy) {\n if (attributesToCopy) {\n var keys = Object.keys(attributesToCopy);\n var i, l, key;\n\n for (i = 0, l = keys.length; i < l; i++) {\n key = keys[i];\n this[key] = attributesToCopy[key];\n }\n } else {\n this.$attr = {};\n }\n\n this.$$element = element;\n };\n\n Attributes.prototype = {\n /**\n * @ngdoc method\n * @name $compile.directive.Attributes#$normalize\n * @kind function\n *\n * @description\n * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or\n * `data-`) to its normalized, camelCase form.\n *\n * Also there is special case for Moz prefix starting with upper case letter.\n *\n * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n *\n * @param {string} name Name to normalize\n */\n $normalize: directiveNormalize,\n\n\n /**\n * @ngdoc method\n * @name $compile.directive.Attributes#$addClass\n * @kind function\n *\n * @description\n * Adds the CSS class value specified by the classVal parameter to the element. If animations\n * are enabled then an animation will be triggered for the class addition.\n *\n * @param {string} classVal The className value that will be added to the element\n */\n $addClass: function(classVal) {\n if (classVal && classVal.length > 0) {\n $animate.addClass(this.$$element, classVal);\n }\n },\n\n /**\n * @ngdoc method\n * @name $compile.directive.Attributes#$removeClass\n * @kind function\n *\n * @description\n * Removes the CSS class value specified by the classVal parameter from the element. If\n * animations are enabled then an animation will be triggered for the class removal.\n *\n * @param {string} classVal The className value that will be removed from the element\n */\n $removeClass: function(classVal) {\n if (classVal && classVal.length > 0) {\n $animate.removeClass(this.$$element, classVal);\n }\n },\n\n /**\n * @ngdoc method\n * @name $compile.directive.Attributes#$updateClass\n * @kind function\n *\n * @description\n * Adds and removes the appropriate CSS class values to the element based on the difference\n * between the new and old CSS class values (specified as newClasses and oldClasses).\n *\n * @param {string} newClasses The current CSS className value\n * @param {string} oldClasses The former CSS className value\n */\n $updateClass: function(newClasses, oldClasses) {\n var toAdd = tokenDifference(newClasses, oldClasses);\n if (toAdd && toAdd.length) {\n $animate.addClass(this.$$element, toAdd);\n }\n\n var toRemove = tokenDifference(oldClasses, newClasses);\n if (toRemove && toRemove.length) {\n $animate.removeClass(this.$$element, toRemove);\n }\n },\n\n /**\n * Set a normalized attribute on the element in a way such that all directives\n * can share the attribute. This function properly handles boolean attributes.\n * @param {string} key Normalized key. (ie ngAttribute)\n * @param {string|boolean} value The value to set. If `null` attribute will be deleted.\n * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.\n * Defaults to true.\n * @param {string=} attrName Optional none normalized name. Defaults to key.\n */\n $set: function(key, value, writeAttr, attrName) {\n // TODO: decide whether or not to throw an error if \"class\"\n //is set through this function since it may cause $updateClass to\n //become unstable.\n\n var node = this.$$element[0],\n booleanKey = getBooleanAttrName(node, key),\n aliasedKey = getAliasedAttrName(key),\n observer = key,\n nodeName;\n\n if (booleanKey) {\n this.$$element.prop(key, value);\n attrName = booleanKey;\n } else if (aliasedKey) {\n this[aliasedKey] = value;\n observer = aliasedKey;\n }\n\n this[key] = value;\n\n // translate normalized key to actual key\n if (attrName) {\n this.$attr[key] = attrName;\n } else {\n attrName = this.$attr[key];\n if (!attrName) {\n this.$attr[key] = attrName = snake_case(key, '-');\n }\n }\n\n nodeName = nodeName_(this.$$element);\n\n if ((nodeName === 'a' && key === 'href') ||\n (nodeName === 'img' && key === 'src')) {\n // sanitize a[href] and img[src] values\n this[key] = value = $$sanitizeUri(value, key === 'src');\n } else if (nodeName === 'img' && key === 'srcset' && isDefined(value)) {\n // sanitize img[srcset] values\n var result = \"\";\n\n // first check if there are spaces because it's not the same pattern\n var trimmedSrcset = trim(value);\n // ( 999x ,| 999w ,| ,|, )\n var srcPattern = /(\\s+\\d+x\\s*,|\\s+\\d+w\\s*,|\\s+,|,\\s+)/;\n var pattern = /\\s/.test(trimmedSrcset) ? srcPattern : /(,)/;\n\n // split srcset into tuple of uri and descriptor except for the last item\n var rawUris = trimmedSrcset.split(pattern);\n\n // for each tuples\n var nbrUrisWith2parts = Math.floor(rawUris.length / 2);\n for (var i = 0; i < nbrUrisWith2parts; i++) {\n var innerIdx = i * 2;\n // sanitize the uri\n result += $$sanitizeUri(trim(rawUris[innerIdx]), true);\n // add the descriptor\n result += (\" \" + trim(rawUris[innerIdx + 1]));\n }\n\n // split the last item into uri and descriptor\n var lastTuple = trim(rawUris[i * 2]).split(/\\s/);\n\n // sanitize the last uri\n result += $$sanitizeUri(trim(lastTuple[0]), true);\n\n // and add the last descriptor if any\n if (lastTuple.length === 2) {\n result += (\" \" + trim(lastTuple[1]));\n }\n this[key] = value = result;\n }\n\n if (writeAttr !== false) {\n if (value === null || isUndefined(value)) {\n this.$$element.removeAttr(attrName);\n } else {\n this.$$element.attr(attrName, value);\n }\n }\n\n // fire observers\n var $$observers = this.$$observers;\n $$observers && forEach($$observers[observer], function(fn) {\n try {\n fn(value);\n } catch (e) {\n $exceptionHandler(e);\n }\n });\n },\n\n\n /**\n * @ngdoc method\n * @name $compile.directive.Attributes#$observe\n * @kind function\n *\n * @description\n * Observes an interpolated attribute.\n *\n * The observer function will be invoked once during the next `$digest` following\n * compilation. The observer is then invoked whenever the interpolated value\n * changes.\n *\n * @param {string} key Normalized key. (ie ngAttribute) .\n * @param {function(interpolatedValue)} fn Function that will be called whenever\n the interpolated value of the attribute changes.\n * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation\n * guide} for more info.\n * @returns {function()} Returns a deregistration function for this observer.\n */\n $observe: function(key, fn) {\n var attrs = this,\n $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),\n listeners = ($$observers[key] || ($$observers[key] = []));\n\n listeners.push(fn);\n $rootScope.$evalAsync(function() {\n if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {\n // no one registered attribute interpolation function, so lets call it manually\n fn(attrs[key]);\n }\n });\n\n return function() {\n arrayRemove(listeners, fn);\n };\n }\n };\n\n\n function safeAddClass($element, className) {\n try {\n $element.addClass(className);\n } catch (e) {\n // ignore, since it means that we are trying to set class on\n // SVG element, where class name is read-only.\n }\n }\n\n\n var startSymbol = $interpolate.startSymbol(),\n endSymbol = $interpolate.endSymbol(),\n denormalizeTemplate = (startSymbol == '{{' && endSymbol == '}}')\n ? identity\n : function denormalizeTemplate(template) {\n return template.replace(/\\{\\{/g, startSymbol).replace(/}}/g, endSymbol);\n },\n NG_ATTR_BINDING = /^ngAttr[A-Z]/;\n var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;\n\n compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {\n var bindings = $element.data('$binding') || [];\n\n if (isArray(binding)) {\n bindings = bindings.concat(binding);\n } else {\n bindings.push(binding);\n }\n\n $element.data('$binding', bindings);\n } : noop;\n\n compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {\n safeAddClass($element, 'ng-binding');\n } : noop;\n\n compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {\n var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';\n $element.data(dataName, scope);\n } : noop;\n\n compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {\n safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');\n } : noop;\n\n return compile;\n\n //================================\n\n function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,\n previousCompileContext) {\n if (!($compileNodes instanceof jqLite)) {\n // jquery always rewraps, whereas we need to preserve the original selector so that we can\n // modify it.\n $compileNodes = jqLite($compileNodes);\n }\n\n var NOT_EMPTY = /\\S+/;\n\n // We can not compile top level text elements since text nodes can be merged and we will\n // not be able to attach scope data to them, so we will wrap them in <span>\n for (var i = 0, len = $compileNodes.length; i < len; i++) {\n var domNode = $compileNodes[i];\n\n if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {\n jqLiteWrapNode(domNode, $compileNodes[i] = document.createElement('span'));\n }\n }\n\n var compositeLinkFn =\n compileNodes($compileNodes, transcludeFn, $compileNodes,\n maxPriority, ignoreDirective, previousCompileContext);\n compile.$$addScopeClass($compileNodes);\n var namespace = null;\n return function publicLinkFn(scope, cloneConnectFn, options) {\n assertArg(scope, 'scope');\n\n if (previousCompileContext && previousCompileContext.needsNewScope) {\n // A parent directive did a replace and a directive on this element asked\n // for transclusion, which caused us to lose a layer of element on which\n // we could hold the new transclusion scope, so we will create it manually\n // here.\n scope = scope.$parent.$new();\n }\n\n options = options || {};\n var parentBoundTranscludeFn = options.parentBoundTranscludeFn,\n transcludeControllers = options.transcludeControllers,\n futureParentElement = options.futureParentElement;\n\n // When `parentBoundTranscludeFn` is passed, it is a\n // `controllersBoundTransclude` function (it was previously passed\n // as `transclude` to directive.link) so we must unwrap it to get\n // its `boundTranscludeFn`\n if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {\n parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;\n }\n\n if (!namespace) {\n namespace = detectNamespaceForChildElements(futureParentElement);\n }\n var $linkNode;\n if (namespace !== 'html') {\n // When using a directive with replace:true and templateUrl the $compileNodes\n // (or a child element inside of them)\n // might change, so we need to recreate the namespace adapted compileNodes\n // for call to the link function.\n // Note: This will already clone the nodes...\n $linkNode = jqLite(\n wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())\n );\n } else if (cloneConnectFn) {\n // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart\n // and sometimes changes the structure of the DOM.\n $linkNode = JQLitePrototype.clone.call($compileNodes);\n } else {\n $linkNode = $compileNodes;\n }\n\n if (transcludeControllers) {\n for (var controllerName in transcludeControllers) {\n $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);\n }\n }\n\n compile.$$addScopeInfo($linkNode, scope);\n\n if (cloneConnectFn) cloneConnectFn($linkNode, scope);\n if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);\n return $linkNode;\n };\n }\n\n function detectNamespaceForChildElements(parentElement) {\n // TODO: Make this detect MathML as well...\n var node = parentElement && parentElement[0];\n if (!node) {\n return 'html';\n } else {\n return nodeName_(node) !== 'foreignobject' && node.toString().match(/SVG/) ? 'svg' : 'html';\n }\n }\n\n /**\n * Compile function matches each node in nodeList against the directives. Once all directives\n * for a particular node are collected their compile functions are executed. The compile\n * functions return values - the linking functions - are combined into a composite linking\n * function, which is the a linking function for the node.\n *\n * @param {NodeList} nodeList an array of nodes or NodeList to compile\n * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n * scope argument is auto-generated to the new child of the transcluded parent scope.\n * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then\n * the rootElement must be set the jqLite collection of the compile root. This is\n * needed so that the jqLite collection items can be replaced with widgets.\n * @param {number=} maxPriority Max directive priority.\n * @returns {Function} A composite linking function of all of the matched directives or null.\n */\n function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,\n previousCompileContext) {\n var linkFns = [],\n attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;\n\n for (var i = 0; i < nodeList.length; i++) {\n attrs = new Attributes();\n\n // we must always refer to nodeList[i] since the nodes can be replaced underneath us.\n directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,\n ignoreDirective);\n\n nodeLinkFn = (directives.length)\n ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,\n null, [], [], previousCompileContext)\n : null;\n\n if (nodeLinkFn && nodeLinkFn.scope) {\n compile.$$addScopeClass(attrs.$$element);\n }\n\n childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||\n !(childNodes = nodeList[i].childNodes) ||\n !childNodes.length)\n ? null\n : compileNodes(childNodes,\n nodeLinkFn ? (\n (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)\n && nodeLinkFn.transclude) : transcludeFn);\n\n if (nodeLinkFn || childLinkFn) {\n linkFns.push(i, nodeLinkFn, childLinkFn);\n linkFnFound = true;\n nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;\n }\n\n //use the previous context only for the first element in the virtual group\n previousCompileContext = null;\n }\n\n // return a linking function if we have found anything, null otherwise\n return linkFnFound ? compositeLinkFn : null;\n\n function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {\n var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;\n var stableNodeList;\n\n\n if (nodeLinkFnFound) {\n // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our\n // offsets don't get screwed up\n var nodeListLength = nodeList.length;\n stableNodeList = new Array(nodeListLength);\n\n // create a sparse array by only copying the elements which have a linkFn\n for (i = 0; i < linkFns.length; i+=3) {\n idx = linkFns[i];\n stableNodeList[idx] = nodeList[idx];\n }\n } else {\n stableNodeList = nodeList;\n }\n\n for (i = 0, ii = linkFns.length; i < ii;) {\n node = stableNodeList[linkFns[i++]];\n nodeLinkFn = linkFns[i++];\n childLinkFn = linkFns[i++];\n\n if (nodeLinkFn) {\n if (nodeLinkFn.scope) {\n childScope = scope.$new();\n compile.$$addScopeInfo(jqLite(node), childScope);\n } else {\n childScope = scope;\n }\n\n if (nodeLinkFn.transcludeOnThisElement) {\n childBoundTranscludeFn = createBoundTranscludeFn(\n scope, nodeLinkFn.transclude, parentBoundTranscludeFn);\n\n } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {\n childBoundTranscludeFn = parentBoundTranscludeFn;\n\n } else if (!parentBoundTranscludeFn && transcludeFn) {\n childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);\n\n } else {\n childBoundTranscludeFn = null;\n }\n\n nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);\n\n } else if (childLinkFn) {\n childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);\n }\n }\n }\n }\n\n function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {\n\n var boundTranscludeFn = function(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {\n\n if (!transcludedScope) {\n transcludedScope = scope.$new(false, containingScope);\n transcludedScope.$$transcluded = true;\n }\n\n return transcludeFn(transcludedScope, cloneFn, {\n parentBoundTranscludeFn: previousBoundTranscludeFn,\n transcludeControllers: controllers,\n futureParentElement: futureParentElement\n });\n };\n\n return boundTranscludeFn;\n }\n\n /**\n * Looks for directives on the given node and adds them to the directive collection which is\n * sorted.\n *\n * @param node Node to search.\n * @param directives An array to which the directives are added to. This array is sorted before\n * the function returns.\n * @param attrs The shared attrs object which is used to populate the normalized attributes.\n * @param {number=} maxPriority Max directive priority.\n */\n function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {\n var nodeType = node.nodeType,\n attrsMap = attrs.$attr,\n match,\n nodeName,\n className;\n\n switch (nodeType) {\n case NODE_TYPE_ELEMENT: /* Element */\n\n nodeName = nodeName_(node);\n\n // use the node name: <directive>\n addDirective(directives,\n directiveNormalize(nodeName), 'E', maxPriority, ignoreDirective);\n\n // iterate over the attributes\n for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,\n j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {\n var attrStartName = false;\n var attrEndName = false;\n\n attr = nAttrs[j];\n name = attr.name;\n value = trim(attr.value);\n\n // support ngAttr attribute binding\n ngAttrName = directiveNormalize(name);\n if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {\n name = name.replace(PREFIX_REGEXP, '')\n .substr(8).replace(/_(.)/g, function(match, letter) {\n return letter.toUpperCase();\n });\n }\n\n var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);\n if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {\n attrStartName = name;\n attrEndName = name.substr(0, name.length - 5) + 'end';\n name = name.substr(0, name.length - 6);\n }\n\n nName = directiveNormalize(name.toLowerCase());\n attrsMap[nName] = name;\n if (isNgAttr || !attrs.hasOwnProperty(nName)) {\n attrs[nName] = value;\n if (getBooleanAttrName(node, nName)) {\n attrs[nName] = true; // presence means true\n }\n }\n addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);\n addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,\n attrEndName);\n }\n\n if (nodeName === 'input' && node.getAttribute('type') === 'hidden') {\n // Hidden input elements can have strange behaviour when navigating back to the page\n // This tells the browser not to try to cache and reinstate previous values\n node.setAttribute('autocomplete', 'off');\n }\n\n // use class as directive\n className = node.className;\n if (isObject(className)) {\n // Maybe SVGAnimatedString\n className = className.animVal;\n }\n if (isString(className) && className !== '') {\n while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {\n nName = directiveNormalize(match[2]);\n if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {\n attrs[nName] = trim(match[3]);\n }\n className = className.substr(match.index + match[0].length);\n }\n }\n break;\n case NODE_TYPE_TEXT: /* Text Node */\n if (msie === 11) {\n // Workaround for #11781\n while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {\n node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;\n node.parentNode.removeChild(node.nextSibling);\n }\n }\n addTextInterpolateDirective(directives, node.nodeValue);\n break;\n case NODE_TYPE_COMMENT: /* Comment */\n try {\n match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);\n if (match) {\n nName = directiveNormalize(match[1]);\n if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {\n attrs[nName] = trim(match[2]);\n }\n }\n } catch (e) {\n // turns out that under some circumstances IE9 throws errors when one attempts to read\n // comment's node value.\n // Just ignore it and continue. (Can't seem to reproduce in test case.)\n }\n break;\n }\n\n directives.sort(byPriority);\n return directives;\n }\n\n /**\n * Given a node with an directive-start it collects all of the siblings until it finds\n * directive-end.\n * @param node\n * @param attrStart\n * @param attrEnd\n * @returns {*}\n */\n function groupScan(node, attrStart, attrEnd) {\n var nodes = [];\n var depth = 0;\n if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {\n do {\n if (!node) {\n throw $compileMinErr('uterdir',\n \"Unterminated attribute, found '{0}' but no matching '{1}' found.\",\n attrStart, attrEnd);\n }\n if (node.nodeType == NODE_TYPE_ELEMENT) {\n if (node.hasAttribute(attrStart)) depth++;\n if (node.hasAttribute(attrEnd)) depth--;\n }\n nodes.push(node);\n node = node.nextSibling;\n } while (depth > 0);\n } else {\n nodes.push(node);\n }\n\n return jqLite(nodes);\n }\n\n /**\n * Wrapper for linking function which converts normal linking function into a grouped\n * linking function.\n * @param linkFn\n * @param attrStart\n * @param attrEnd\n * @returns {Function}\n */\n function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {\n return function(scope, element, attrs, controllers, transcludeFn) {\n element = groupScan(element[0], attrStart, attrEnd);\n return linkFn(scope, element, attrs, controllers, transcludeFn);\n };\n }\n\n /**\n * Once the directives have been collected, their compile functions are executed. This method\n * is responsible for inlining directive templates as well as terminating the application\n * of the directives if the terminal directive has been reached.\n *\n * @param {Array} directives Array of collected directives to execute their compile function.\n * this needs to be pre-sorted by priority order.\n * @param {Node} compileNode The raw DOM node to apply the compile functions to\n * @param {Object} templateAttrs The shared attribute function\n * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n * scope argument is auto-generated to the new\n * child of the transcluded parent scope.\n * @param {JQLite} jqCollection If we are working on the root of the compile tree then this\n * argument has the root jqLite array so that we can replace nodes\n * on it.\n * @param {Object=} originalReplaceDirective An optional directive that will be ignored when\n * compiling the transclusion.\n * @param {Array.<Function>} preLinkFns\n * @param {Array.<Function>} postLinkFns\n * @param {Object} previousCompileContext Context used for previous compilation of the current\n * node\n * @returns {Function} linkFn\n */\n function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,\n jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,\n previousCompileContext) {\n previousCompileContext = previousCompileContext || {};\n\n var terminalPriority = -Number.MAX_VALUE,\n newScopeDirective = previousCompileContext.newScopeDirective,\n controllerDirectives = previousCompileContext.controllerDirectives,\n newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,\n templateDirective = previousCompileContext.templateDirective,\n nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,\n hasTranscludeDirective = false,\n hasTemplate = false,\n hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,\n $compileNode = templateAttrs.$$element = jqLite(compileNode),\n directive,\n directiveName,\n $template,\n replaceDirective = originalReplaceDirective,\n childTranscludeFn = transcludeFn,\n linkFn,\n directiveValue;\n\n // executes all directives on the current element\n for (var i = 0, ii = directives.length; i < ii; i++) {\n directive = directives[i];\n var attrStart = directive.$$start;\n var attrEnd = directive.$$end;\n\n // collect multiblock sections\n if (attrStart) {\n $compileNode = groupScan(compileNode, attrStart, attrEnd);\n }\n $template = undefined;\n\n if (terminalPriority > directive.priority) {\n break; // prevent further processing of directives\n }\n\n if (directiveValue = directive.scope) {\n\n // skip the check for directives with async templates, we'll check the derived sync\n // directive when the template arrives\n if (!directive.templateUrl) {\n if (isObject(directiveValue)) {\n // This directive is trying to add an isolated scope.\n // Check that there is no scope of any kind already\n assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,\n directive, $compileNode);\n newIsolateScopeDirective = directive;\n } else {\n // This directive is trying to add a child scope.\n // Check that there is no isolated scope already\n assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,\n $compileNode);\n }\n }\n\n newScopeDirective = newScopeDirective || directive;\n }\n\n directiveName = directive.name;\n\n if (!directive.templateUrl && directive.controller) {\n directiveValue = directive.controller;\n controllerDirectives = controllerDirectives || createMap();\n assertNoDuplicate(\"'\" + directiveName + \"' controller\",\n controllerDirectives[directiveName], directive, $compileNode);\n controllerDirectives[directiveName] = directive;\n }\n\n if (directiveValue = directive.transclude) {\n hasTranscludeDirective = true;\n\n // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.\n // This option should only be used by directives that know how to safely handle element transclusion,\n // where the transcluded nodes are added or replaced after linking.\n if (!directive.$$tlb) {\n assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);\n nonTlbTranscludeDirective = directive;\n }\n\n if (directiveValue == 'element') {\n hasElementTranscludeDirective = true;\n terminalPriority = directive.priority;\n $template = $compileNode;\n $compileNode = templateAttrs.$$element =\n jqLite(document.createComment(' ' + directiveName + ': ' +\n templateAttrs[directiveName] + ' '));\n compileNode = $compileNode[0];\n replaceWith(jqCollection, sliceArgs($template), compileNode);\n\n childTranscludeFn = compile($template, transcludeFn, terminalPriority,\n replaceDirective && replaceDirective.name, {\n // Don't pass in:\n // - controllerDirectives - otherwise we'll create duplicates controllers\n // - newIsolateScopeDirective or templateDirective - combining templates with\n // element transclusion doesn't make sense.\n //\n // We need only nonTlbTranscludeDirective so that we prevent putting transclusion\n // on the same element more than once.\n nonTlbTranscludeDirective: nonTlbTranscludeDirective\n });\n } else {\n $template = jqLite(jqLiteClone(compileNode)).contents();\n $compileNode.empty(); // clear contents\n childTranscludeFn = compile($template, transcludeFn, undefined,\n undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});\n }\n }\n\n if (directive.template) {\n hasTemplate = true;\n assertNoDuplicate('template', templateDirective, directive, $compileNode);\n templateDirective = directive;\n\n directiveValue = (isFunction(directive.template))\n ? directive.template($compileNode, templateAttrs)\n : directive.template;\n\n directiveValue = denormalizeTemplate(directiveValue);\n\n if (directive.replace) {\n replaceDirective = directive;\n if (jqLiteIsTextNode(directiveValue)) {\n $template = [];\n } else {\n $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));\n }\n compileNode = $template[0];\n\n if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n throw $compileMinErr('tplrt',\n \"Template for directive '{0}' must have exactly one root element. {1}\",\n directiveName, '');\n }\n\n replaceWith(jqCollection, $compileNode, compileNode);\n\n var newTemplateAttrs = {$attr: {}};\n\n // combine directives from the original node and from the template:\n // - take the array of directives for this element\n // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)\n // - collect directives from the template and sort them by priority\n // - combine directives as: processed + template + unprocessed\n var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);\n var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));\n\n if (newIsolateScopeDirective || newScopeDirective) {\n // The original directive caused the current element to be replaced but this element\n // also needs to have a new scope, so we need to tell the template directives\n // that they would need to get their scope from further up, if they require transclusion\n markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);\n }\n directives = directives.concat(templateDirectives).concat(unprocessedDirectives);\n mergeTemplateAttributes(templateAttrs, newTemplateAttrs);\n\n ii = directives.length;\n } else {\n $compileNode.html(directiveValue);\n }\n }\n\n if (directive.templateUrl) {\n hasTemplate = true;\n assertNoDuplicate('template', templateDirective, directive, $compileNode);\n templateDirective = directive;\n\n if (directive.replace) {\n replaceDirective = directive;\n }\n\n nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,\n templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {\n controllerDirectives: controllerDirectives,\n newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,\n newIsolateScopeDirective: newIsolateScopeDirective,\n templateDirective: templateDirective,\n nonTlbTranscludeDirective: nonTlbTranscludeDirective\n });\n ii = directives.length;\n } else if (directive.compile) {\n try {\n linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);\n if (isFunction(linkFn)) {\n addLinkFns(null, linkFn, attrStart, attrEnd);\n } else if (linkFn) {\n addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);\n }\n } catch (e) {\n $exceptionHandler(e, startingTag($compileNode));\n }\n }\n\n if (directive.terminal) {\n nodeLinkFn.terminal = true;\n terminalPriority = Math.max(terminalPriority, directive.priority);\n }\n\n }\n\n nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;\n nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;\n nodeLinkFn.templateOnThisElement = hasTemplate;\n nodeLinkFn.transclude = childTranscludeFn;\n\n previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;\n\n // might be normal or delayed nodeLinkFn depending on if templateUrl is present\n return nodeLinkFn;\n\n ////////////////////\n\n function addLinkFns(pre, post, attrStart, attrEnd) {\n if (pre) {\n if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);\n pre.require = directive.require;\n pre.directiveName = directiveName;\n if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n pre = cloneAndAnnotateFn(pre, {isolateScope: true});\n }\n preLinkFns.push(pre);\n }\n if (post) {\n if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);\n post.require = directive.require;\n post.directiveName = directiveName;\n if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n post = cloneAndAnnotateFn(post, {isolateScope: true});\n }\n postLinkFns.push(post);\n }\n }\n\n\n function getControllers(directiveName, require, $element, elementControllers) {\n var value;\n\n if (isString(require)) {\n var match = require.match(REQUIRE_PREFIX_REGEXP);\n var name = require.substring(match[0].length);\n var inheritType = match[1] || match[3];\n var optional = match[2] === '?';\n\n //If only parents then start at the parent element\n if (inheritType === '^^') {\n $element = $element.parent();\n //Otherwise attempt getting the controller from elementControllers in case\n //the element is transcluded (and has no data) and to avoid .data if possible\n } else {\n value = elementControllers && elementControllers[name];\n value = value && value.instance;\n }\n\n if (!value) {\n var dataName = '$' + name + 'Controller';\n value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);\n }\n\n if (!value && !optional) {\n throw $compileMinErr('ctreq',\n \"Controller '{0}', required by directive '{1}', can't be found!\",\n name, directiveName);\n }\n } else if (isArray(require)) {\n value = [];\n for (var i = 0, ii = require.length; i < ii; i++) {\n value[i] = getControllers(directiveName, require[i], $element, elementControllers);\n }\n }\n\n return value || null;\n }\n\n function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope) {\n var elementControllers = createMap();\n for (var controllerKey in controllerDirectives) {\n var directive = controllerDirectives[controllerKey];\n var locals = {\n $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,\n $element: $element,\n $attrs: attrs,\n $transclude: transcludeFn\n };\n\n var controller = directive.controller;\n if (controller == '@') {\n controller = attrs[directive.name];\n }\n\n var controllerInstance = $controller(controller, locals, true, directive.controllerAs);\n\n // For directives with element transclusion the element is a comment.\n // In this case .data will not attach any data.\n // Instead, we save the controllers for the element in a local hash and attach to .data\n // later, once we have the actual element.\n elementControllers[directive.name] = controllerInstance;\n $element.data('$' + directive.name + 'Controller', controllerInstance.instance);\n }\n return elementControllers;\n }\n\n function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {\n var linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,\n attrs, removeScopeBindingWatches, removeControllerBindingWatches;\n\n if (compileNode === linkNode) {\n attrs = templateAttrs;\n $element = templateAttrs.$$element;\n } else {\n $element = jqLite(linkNode);\n attrs = new Attributes($element, templateAttrs);\n }\n\n controllerScope = scope;\n if (newIsolateScopeDirective) {\n isolateScope = scope.$new(true);\n } else if (newScopeDirective) {\n controllerScope = scope.$parent;\n }\n\n if (boundTranscludeFn) {\n // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`\n // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`\n transcludeFn = controllersBoundTransclude;\n transcludeFn.$$boundTransclude = boundTranscludeFn;\n }\n\n if (controllerDirectives) {\n elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope);\n }\n\n if (newIsolateScopeDirective) {\n // Initialize isolate scope bindings for new isolate scope directive.\n compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||\n templateDirective === newIsolateScopeDirective.$$originalDirective)));\n compile.$$addScopeClass($element, true);\n isolateScope.$$isolateBindings =\n newIsolateScopeDirective.$$isolateBindings;\n removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,\n isolateScope.$$isolateBindings,\n newIsolateScopeDirective);\n if (removeScopeBindingWatches) {\n isolateScope.$on('$destroy', removeScopeBindingWatches);\n }\n }\n\n // Initialize bindToController bindings\n for (var name in elementControllers) {\n var controllerDirective = controllerDirectives[name];\n var controller = elementControllers[name];\n var bindings = controllerDirective.$$bindings.bindToController;\n\n if (controller.identifier && bindings) {\n removeControllerBindingWatches =\n initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n }\n\n var controllerResult = controller();\n if (controllerResult !== controller.instance) {\n // If the controller constructor has a return value, overwrite the instance\n // from setupControllers\n controller.instance = controllerResult;\n $element.data('$' + controllerDirective.name + 'Controller', controllerResult);\n removeControllerBindingWatches && removeControllerBindingWatches();\n removeControllerBindingWatches =\n initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n }\n }\n\n // PRELINKING\n for (i = 0, ii = preLinkFns.length; i < ii; i++) {\n linkFn = preLinkFns[i];\n invokeLinkFn(linkFn,\n linkFn.isolateScope ? isolateScope : scope,\n $element,\n attrs,\n linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n transcludeFn\n );\n }\n\n // RECURSION\n // We only pass the isolate scope, if the isolate directive has a template,\n // otherwise the child elements do not belong to the isolate directive.\n var scopeToChild = scope;\n if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {\n scopeToChild = isolateScope;\n }\n childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);\n\n // POSTLINKING\n for (i = postLinkFns.length - 1; i >= 0; i--) {\n linkFn = postLinkFns[i];\n invokeLinkFn(linkFn,\n linkFn.isolateScope ? isolateScope : scope,\n $element,\n attrs,\n linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n transcludeFn\n );\n }\n\n // This is the function that is injected as `$transclude`.\n // Note: all arguments are optional!\n function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement) {\n var transcludeControllers;\n\n // No scope passed in:\n if (!isScope(scope)) {\n futureParentElement = cloneAttachFn;\n cloneAttachFn = scope;\n scope = undefined;\n }\n\n if (hasElementTranscludeDirective) {\n transcludeControllers = elementControllers;\n }\n if (!futureParentElement) {\n futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;\n }\n return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n }\n }\n }\n\n // Depending upon the context in which a directive finds itself it might need to have a new isolated\n // or child scope created. For instance:\n // * if the directive has been pulled into a template because another directive with a higher priority\n // asked for element transclusion\n // * if the directive itself asks for transclusion but it is at the root of a template and the original\n // element was replaced. See https://github.com/angular/angular.js/issues/12936\n function markDirectiveScope(directives, isolateScope, newScope) {\n for (var j = 0, jj = directives.length; j < jj; j++) {\n directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});\n }\n }\n\n /**\n * looks up the directive and decorates it with exception handling and proper parameters. We\n * call this the boundDirective.\n *\n * @param {string} name name of the directive to look up.\n * @param {string} location The directive must be found in specific format.\n * String containing any of theses characters:\n *\n * * `E`: element name\n * * `A': attribute\n * * `C`: class\n * * `M`: comment\n * @returns {boolean} true if directive was added.\n */\n function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,\n endAttrName) {\n if (name === ignoreDirective) return null;\n var match = null;\n if (hasDirectives.hasOwnProperty(name)) {\n for (var directive, directives = $injector.get(name + Suffix),\n i = 0, ii = directives.length; i < ii; i++) {\n try {\n directive = directives[i];\n if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&\n directive.restrict.indexOf(location) != -1) {\n if (startAttrName) {\n directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});\n }\n if (!directive.$$bindings) {\n var bindings = directive.$$bindings =\n parseDirectiveBindings(directive, directive.name);\n if (isObject(bindings.isolateScope)) {\n directive.$$isolateBindings = bindings.isolateScope;\n }\n }\n tDirectives.push(directive);\n match = directive;\n }\n } catch (e) { $exceptionHandler(e); }\n }\n }\n return match;\n }\n\n\n /**\n * looks up the directive and returns true if it is a multi-element directive,\n * and therefore requires DOM nodes between -start and -end markers to be grouped\n * together.\n *\n * @param {string} name name of the directive to look up.\n * @returns true if directive was registered as multi-element.\n */\n function directiveIsMultiElement(name) {\n if (hasDirectives.hasOwnProperty(name)) {\n for (var directive, directives = $injector.get(name + Suffix),\n i = 0, ii = directives.length; i < ii; i++) {\n directive = directives[i];\n if (directive.multiElement) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * When the element is replaced with HTML template then the new attributes\n * on the template need to be merged with the existing attributes in the DOM.\n * The desired effect is to have both of the attributes present.\n *\n * @param {object} dst destination attributes (original DOM)\n * @param {object} src source attributes (from the directive template)\n */\n function mergeTemplateAttributes(dst, src) {\n var srcAttr = src.$attr,\n dstAttr = dst.$attr,\n $element = dst.$$element;\n\n // reapply the old attributes to the new element\n forEach(dst, function(value, key) {\n if (key.charAt(0) != '$') {\n if (src[key] && src[key] !== value) {\n value += (key === 'style' ? ';' : ' ') + src[key];\n }\n dst.$set(key, value, true, srcAttr[key]);\n }\n });\n\n // copy the new attributes on the old attrs object\n forEach(src, function(value, key) {\n if (key == 'class') {\n safeAddClass($element, value);\n dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;\n } else if (key == 'style') {\n $element.attr('style', $element.attr('style') + ';' + value);\n dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;\n // `dst` will never contain hasOwnProperty as DOM parser won't let it.\n // You will get an \"InvalidCharacterError: DOM Exception 5\" error if you\n // have an attribute like \"has-own-property\" or \"data-has-own-property\", etc.\n } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {\n dst[key] = value;\n dstAttr[key] = srcAttr[key];\n }\n });\n }\n\n\n function compileTemplateUrl(directives, $compileNode, tAttrs,\n $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {\n var linkQueue = [],\n afterTemplateNodeLinkFn,\n afterTemplateChildLinkFn,\n beforeTemplateCompileNode = $compileNode[0],\n origAsyncDirective = directives.shift(),\n derivedSyncDirective = inherit(origAsyncDirective, {\n templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective\n }),\n templateUrl = (isFunction(origAsyncDirective.templateUrl))\n ? origAsyncDirective.templateUrl($compileNode, tAttrs)\n : origAsyncDirective.templateUrl,\n templateNamespace = origAsyncDirective.templateNamespace;\n\n $compileNode.empty();\n\n $templateRequest(templateUrl)\n .then(function(content) {\n var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;\n\n content = denormalizeTemplate(content);\n\n if (origAsyncDirective.replace) {\n if (jqLiteIsTextNode(content)) {\n $template = [];\n } else {\n $template = removeComments(wrapTemplate(templateNamespace, trim(content)));\n }\n compileNode = $template[0];\n\n if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n throw $compileMinErr('tplrt',\n \"Template for directive '{0}' must have exactly one root element. {1}\",\n origAsyncDirective.name, templateUrl);\n }\n\n tempTemplateAttrs = {$attr: {}};\n replaceWith($rootElement, $compileNode, compileNode);\n var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);\n\n if (isObject(origAsyncDirective.scope)) {\n // the original directive that caused the template to be loaded async required\n // an isolate scope\n markDirectiveScope(templateDirectives, true);\n }\n directives = templateDirectives.concat(directives);\n mergeTemplateAttributes(tAttrs, tempTemplateAttrs);\n } else {\n compileNode = beforeTemplateCompileNode;\n $compileNode.html(content);\n }\n\n directives.unshift(derivedSyncDirective);\n\n afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,\n childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,\n previousCompileContext);\n forEach($rootElement, function(node, i) {\n if (node == compileNode) {\n $rootElement[i] = $compileNode[0];\n }\n });\n afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);\n\n while (linkQueue.length) {\n var scope = linkQueue.shift(),\n beforeTemplateLinkNode = linkQueue.shift(),\n linkRootElement = linkQueue.shift(),\n boundTranscludeFn = linkQueue.shift(),\n linkNode = $compileNode[0];\n\n if (scope.$$destroyed) continue;\n\n if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {\n var oldClasses = beforeTemplateLinkNode.className;\n\n if (!(previousCompileContext.hasElementTranscludeDirective &&\n origAsyncDirective.replace)) {\n // it was cloned therefore we have to clone as well.\n linkNode = jqLiteClone(compileNode);\n }\n replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);\n\n // Copy in CSS classes from original node\n safeAddClass(jqLite(linkNode), oldClasses);\n }\n if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n } else {\n childBoundTranscludeFn = boundTranscludeFn;\n }\n afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,\n childBoundTranscludeFn);\n }\n linkQueue = null;\n });\n\n return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {\n var childBoundTranscludeFn = boundTranscludeFn;\n if (scope.$$destroyed) return;\n if (linkQueue) {\n linkQueue.push(scope,\n node,\n rootElement,\n childBoundTranscludeFn);\n } else {\n if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n }\n afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);\n }\n };\n }\n\n\n /**\n * Sorting function for bound directives.\n */\n function byPriority(a, b) {\n var diff = b.priority - a.priority;\n if (diff !== 0) return diff;\n if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;\n return a.index - b.index;\n }\n\n function assertNoDuplicate(what, previousDirective, directive, element) {\n\n function wrapModuleNameIfDefined(moduleName) {\n return moduleName ?\n (' (module: ' + moduleName + ')') :\n '';\n }\n\n if (previousDirective) {\n throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',\n previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),\n directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));\n }\n }\n\n\n function addTextInterpolateDirective(directives, text) {\n var interpolateFn = $interpolate(text, true);\n if (interpolateFn) {\n directives.push({\n priority: 0,\n compile: function textInterpolateCompileFn(templateNode) {\n var templateNodeParent = templateNode.parent(),\n hasCompileParent = !!templateNodeParent.length;\n\n // When transcluding a template that has bindings in the root\n // we don't have a parent and thus need to add the class during linking fn.\n if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);\n\n return function textInterpolateLinkFn(scope, node) {\n var parent = node.parent();\n if (!hasCompileParent) compile.$$addBindingClass(parent);\n compile.$$addBindingInfo(parent, interpolateFn.expressions);\n scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {\n node[0].nodeValue = value;\n });\n };\n }\n });\n }\n }\n\n\n function wrapTemplate(type, template) {\n type = lowercase(type || 'html');\n switch (type) {\n case 'svg':\n case 'math':\n var wrapper = document.createElement('div');\n wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';\n return wrapper.childNodes[0].childNodes;\n default:\n return template;\n }\n }\n\n\n function getTrustedContext(node, attrNormalizedName) {\n if (attrNormalizedName == \"srcdoc\") {\n return $sce.HTML;\n }\n var tag = nodeName_(node);\n // maction[xlink:href] can source SVG. It's not limited to <maction>.\n if (attrNormalizedName == \"xlinkHref\" ||\n (tag == \"form\" && attrNormalizedName == \"action\") ||\n (tag != \"img\" && (attrNormalizedName == \"src\" ||\n attrNormalizedName == \"ngSrc\"))) {\n return $sce.RESOURCE_URL;\n }\n }\n\n\n function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {\n var trustedContext = getTrustedContext(node, name);\n allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;\n\n var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);\n\n // no interpolation found -> ignore\n if (!interpolateFn) return;\n\n\n if (name === \"multiple\" && nodeName_(node) === \"select\") {\n throw $compileMinErr(\"selmulti\",\n \"Binding to the 'multiple' attribute is not supported. Element: {0}\",\n startingTag(node));\n }\n\n directives.push({\n priority: 100,\n compile: function() {\n return {\n pre: function attrInterpolatePreLinkFn(scope, element, attr) {\n var $$observers = (attr.$$observers || (attr.$$observers = createMap()));\n\n if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {\n throw $compileMinErr('nodomevents',\n \"Interpolations for HTML DOM event attributes are disallowed. Please use the \" +\n \"ng- versions (such as ng-click instead of onclick) instead.\");\n }\n\n // If the attribute has changed since last $interpolate()ed\n var newValue = attr[name];\n if (newValue !== value) {\n // we need to interpolate again since the attribute value has been updated\n // (e.g. by another directive's compile function)\n // ensure unset/empty values make interpolateFn falsy\n interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);\n value = newValue;\n }\n\n // if attribute was updated so that there is no interpolation going on we don't want to\n // register any observers\n if (!interpolateFn) return;\n\n // initialize attr object so that it's ready in case we need the value for isolate\n // scope initialization, otherwise the value would not be available from isolate\n // directive's linking fn during linking phase\n attr[name] = interpolateFn(scope);\n\n ($$observers[name] || ($$observers[name] = [])).$$inter = true;\n (attr.$$observers && attr.$$observers[name].$$scope || scope).\n $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {\n //special case for class attribute addition + removal\n //so that class changes can tap into the animation\n //hooks provided by the $animate service. Be sure to\n //skip animations when the first digest occurs (when\n //both the new and the old values are the same) since\n //the CSS classes are the non-interpolated values\n if (name === 'class' && newValue != oldValue) {\n attr.$updateClass(newValue, oldValue);\n } else {\n attr.$set(name, newValue);\n }\n });\n }\n };\n }\n });\n }\n\n\n /**\n * This is a special jqLite.replaceWith, which can replace items which\n * have no parents, provided that the containing jqLite collection is provided.\n *\n * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes\n * in the root of the tree.\n * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep\n * the shell, but replace its DOM node reference.\n * @param {Node} newNode The new DOM node.\n */\n function replaceWith($rootElement, elementsToRemove, newNode) {\n var firstElementToRemove = elementsToRemove[0],\n removeCount = elementsToRemove.length,\n parent = firstElementToRemove.parentNode,\n i, ii;\n\n if ($rootElement) {\n for (i = 0, ii = $rootElement.length; i < ii; i++) {\n if ($rootElement[i] == firstElementToRemove) {\n $rootElement[i++] = newNode;\n for (var j = i, j2 = j + removeCount - 1,\n jj = $rootElement.length;\n j < jj; j++, j2++) {\n if (j2 < jj) {\n $rootElement[j] = $rootElement[j2];\n } else {\n delete $rootElement[j];\n }\n }\n $rootElement.length -= removeCount - 1;\n\n // If the replaced element is also the jQuery .context then replace it\n // .context is a deprecated jQuery api, so we should set it only when jQuery set it\n // http://api.jquery.com/context/\n if ($rootElement.context === firstElementToRemove) {\n $rootElement.context = newNode;\n }\n break;\n }\n }\n }\n\n if (parent) {\n parent.replaceChild(newNode, firstElementToRemove);\n }\n\n // TODO(perf): what's this document fragment for? is it needed? can we at least reuse it?\n var fragment = document.createDocumentFragment();\n fragment.appendChild(firstElementToRemove);\n\n if (jqLite.hasData(firstElementToRemove)) {\n // Copy over user data (that includes Angular's $scope etc.). Don't copy private\n // data here because there's no public interface in jQuery to do that and copying over\n // event listeners (which is the main use of private data) wouldn't work anyway.\n jqLite.data(newNode, jqLite.data(firstElementToRemove));\n\n // Remove data of the replaced element. We cannot just call .remove()\n // on the element it since that would deallocate scope that is needed\n // for the new node. Instead, remove the data \"manually\".\n if (!jQuery) {\n delete jqLite.cache[firstElementToRemove[jqLite.expando]];\n } else {\n // jQuery 2.x doesn't expose the data storage. Use jQuery.cleanData to clean up after\n // the replaced element. The cleanData version monkey-patched by Angular would cause\n // the scope to be trashed and we do need the very same scope to work with the new\n // element. However, we cannot just cache the non-patched version and use it here as\n // that would break if another library patches the method after Angular does (one\n // example is jQuery UI). Instead, set a flag indicating scope destroying should be\n // skipped this one time.\n skipDestroyOnNextJQueryCleanData = true;\n jQuery.cleanData([firstElementToRemove]);\n }\n }\n\n for (var k = 1, kk = elementsToRemove.length; k < kk; k++) {\n var element = elementsToRemove[k];\n jqLite(element).remove(); // must do this way to clean up expando\n fragment.appendChild(element);\n delete elementsToRemove[k];\n }\n\n elementsToRemove[0] = newNode;\n elementsToRemove.length = 1;\n }\n\n\n function cloneAndAnnotateFn(fn, annotation) {\n return extend(function() { return fn.apply(null, arguments); }, fn, annotation);\n }\n\n\n function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {\n try {\n linkFn(scope, $element, attrs, controllers, transcludeFn);\n } catch (e) {\n $exceptionHandler(e, startingTag($element));\n }\n }\n\n\n // Set up $watches for isolate scope and controller bindings. This process\n // only occurs for isolate scopes and new scopes with controllerAs.\n function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {\n var removeWatchCollection = [];\n forEach(bindings, function(definition, scopeName) {\n var attrName = definition.attrName,\n optional = definition.optional,\n mode = definition.mode, // @, =, or &\n lastValue,\n parentGet, parentSet, compare;\n\n switch (mode) {\n\n case '@':\n if (!optional && !hasOwnProperty.call(attrs, attrName)) {\n destination[scopeName] = attrs[attrName] = void 0;\n }\n attrs.$observe(attrName, function(value) {\n if (isString(value)) {\n destination[scopeName] = value;\n }\n });\n attrs.$$observers[attrName].$$scope = scope;\n lastValue = attrs[attrName];\n if (isString(lastValue)) {\n // If the attribute has been provided then we trigger an interpolation to ensure\n // the value is there for use in the link fn\n destination[scopeName] = $interpolate(lastValue)(scope);\n } else if (isBoolean(lastValue)) {\n // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted\n // the value to boolean rather than a string, so we special case this situation\n destination[scopeName] = lastValue;\n }\n break;\n\n case '=':\n if (!hasOwnProperty.call(attrs, attrName)) {\n if (optional) break;\n attrs[attrName] = void 0;\n }\n if (optional && !attrs[attrName]) break;\n\n parentGet = $parse(attrs[attrName]);\n if (parentGet.literal) {\n compare = equals;\n } else {\n compare = function(a, b) { return a === b || (a !== a && b !== b); };\n }\n parentSet = parentGet.assign || function() {\n // reset the change, or we will throw this exception on every $digest\n lastValue = destination[scopeName] = parentGet(scope);\n throw $compileMinErr('nonassign',\n \"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!\",\n attrs[attrName], attrName, directive.name);\n };\n lastValue = destination[scopeName] = parentGet(scope);\n var parentValueWatch = function parentValueWatch(parentValue) {\n if (!compare(parentValue, destination[scopeName])) {\n // we are out of sync and need to copy\n if (!compare(parentValue, lastValue)) {\n // parent changed and it has precedence\n destination[scopeName] = parentValue;\n } else {\n // if the parent can be assigned then do so\n parentSet(scope, parentValue = destination[scopeName]);\n }\n }\n return lastValue = parentValue;\n };\n parentValueWatch.$stateful = true;\n var removeWatch;\n if (definition.collection) {\n removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);\n } else {\n removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);\n }\n removeWatchCollection.push(removeWatch);\n break;\n\n case '&':\n // Don't assign Object.prototype method to scope\n parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;\n\n // Don't assign noop to destination if expression is not valid\n if (parentGet === noop && optional) break;\n\n destination[scopeName] = function(locals) {\n return parentGet(scope, locals);\n };\n break;\n }\n });\n\n return removeWatchCollection.length && function removeWatches() {\n for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {\n removeWatchCollection[i]();\n }\n };\n }\n }];\n}\n\nvar PREFIX_REGEXP = /^((?:x|data)[\\:\\-_])/i;\n/**\n * Converts all accepted directives format into proper directive name.\n * @param name Name to normalize\n */\nfunction directiveNormalize(name) {\n return camelCase(name.replace(PREFIX_REGEXP, ''));\n}\n\n/**\n * @ngdoc type\n * @name $compile.directive.Attributes\n *\n * @description\n * A shared object between directive compile / linking functions which contains normalized DOM\n * element attributes. The values reflect current binding state `{{ }}`. The normalization is\n * needed since all of these are treated as equivalent in Angular:\n *\n * ```\n * <span ng:bind=\"a\" ng-bind=\"a\" data-ng-bind=\"a\" x-ng-bind=\"a\">\n * ```\n */\n\n/**\n * @ngdoc property\n * @name $compile.directive.Attributes#$attr\n *\n * @description\n * A map of DOM element attribute names to the normalized name. This is\n * needed to do reverse lookup from normalized name back to actual name.\n */\n\n\n/**\n * @ngdoc method\n * @name $compile.directive.Attributes#$set\n * @kind function\n *\n * @description\n * Set DOM element attribute value.\n *\n *\n * @param {string} name Normalized element attribute name of the property to modify. The name is\n * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}\n * property to the original name.\n * @param {string} value Value to set the attribute to. The value can be an interpolated string.\n */\n\n\n\n/**\n * Closure compiler type information\n */\n\nfunction nodesetLinkingFn(\n /* angular.Scope */ scope,\n /* NodeList */ nodeList,\n /* Element */ rootElement,\n /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction directiveLinkingFn(\n /* nodesetLinkingFn */ nodesetLinkingFn,\n /* angular.Scope */ scope,\n /* Node */ node,\n /* Element */ rootElement,\n /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction tokenDifference(str1, str2) {\n var values = '',\n tokens1 = str1.split(/\\s+/),\n tokens2 = str2.split(/\\s+/);\n\n outer:\n for (var i = 0; i < tokens1.length; i++) {\n var token = tokens1[i];\n for (var j = 0; j < tokens2.length; j++) {\n if (token == tokens2[j]) continue outer;\n }\n values += (values.length > 0 ? ' ' : '') + token;\n }\n return values;\n}\n\nfunction removeComments(jqNodes) {\n jqNodes = jqLite(jqNodes);\n var i = jqNodes.length;\n\n if (i <= 1) {\n return jqNodes;\n }\n\n while (i--) {\n var node = jqNodes[i];\n if (node.nodeType === NODE_TYPE_COMMENT) {\n splice.call(jqNodes, i, 1);\n }\n }\n return jqNodes;\n}\n\nvar $controllerMinErr = minErr('$controller');\n\n\nvar CNTRL_REG = /^(\\S+)(\\s+as\\s+([\\w$]+))?$/;\nfunction identifierForController(controller, ident) {\n if (ident && isString(ident)) return ident;\n if (isString(controller)) {\n var match = CNTRL_REG.exec(controller);\n if (match) return match[3];\n }\n}\n\n\n/**\n * @ngdoc provider\n * @name $controllerProvider\n * @description\n * The {@link ng.$controller $controller service} is used by Angular to create new\n * controllers.\n *\n * This provider allows controller registration via the\n * {@link ng.$controllerProvider#register register} method.\n */\nfunction $ControllerProvider() {\n var controllers = {},\n globals = false;\n\n /**\n * @ngdoc method\n * @name $controllerProvider#register\n * @param {string|Object} name Controller name, or an object map of controllers where the keys are\n * the names and the values are the constructors.\n * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI\n * annotations in the array notation).\n */\n this.register = function(name, constructor) {\n assertNotHasOwnProperty(name, 'controller');\n if (isObject(name)) {\n extend(controllers, name);\n } else {\n controllers[name] = constructor;\n }\n };\n\n /**\n * @ngdoc method\n * @name $controllerProvider#allowGlobals\n * @description If called, allows `$controller` to find controller constructors on `window`\n */\n this.allowGlobals = function() {\n globals = true;\n };\n\n\n this.$get = ['$injector', '$window', function($injector, $window) {\n\n /**\n * @ngdoc service\n * @name $controller\n * @requires $injector\n *\n * @param {Function|string} constructor If called with a function then it's considered to be the\n * controller constructor function. Otherwise it's considered to be a string which is used\n * to retrieve the controller constructor using the following steps:\n *\n * * check if a controller with given name is registered via `$controllerProvider`\n * * check if evaluating the string on the current scope returns a constructor\n * * if $controllerProvider#allowGlobals, check `window[constructor]` on the global\n * `window` object (not recommended)\n *\n * The string can use the `controller as property` syntax, where the controller instance is published\n * as the specified property on the `scope`; the `scope` must be injected into `locals` param for this\n * to work correctly.\n *\n * @param {Object} locals Injection locals for Controller.\n * @return {Object} Instance of given controller.\n *\n * @description\n * `$controller` service is responsible for instantiating controllers.\n *\n * It's just a simple call to {@link auto.$injector $injector}, but extracted into\n * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).\n */\n return function(expression, locals, later, ident) {\n // PRIVATE API:\n // param `later` --- indicates that the controller's constructor is invoked at a later time.\n // If true, $controller will allocate the object with the correct\n // prototype chain, but will not invoke the controller until a returned\n // callback is invoked.\n // param `ident` --- An optional label which overrides the label parsed from the controller\n // expression, if any.\n var instance, match, constructor, identifier;\n later = later === true;\n if (ident && isString(ident)) {\n identifier = ident;\n }\n\n if (isString(expression)) {\n match = expression.match(CNTRL_REG);\n if (!match) {\n throw $controllerMinErr('ctrlfmt',\n \"Badly formed controller string '{0}'. \" +\n \"Must match `__name__ as __id__` or `__name__`.\", expression);\n }\n constructor = match[1],\n identifier = identifier || match[3];\n expression = controllers.hasOwnProperty(constructor)\n ? controllers[constructor]\n : getter(locals.$scope, constructor, true) ||\n (globals ? getter($window, constructor, true) : undefined);\n\n assertArgFn(expression, constructor, true);\n }\n\n if (later) {\n // Instantiate controller later:\n // This machinery is used to create an instance of the object before calling the\n // controller's constructor itself.\n //\n // This allows properties to be added to the controller before the constructor is\n // invoked. Primarily, this is used for isolate scope bindings in $compile.\n //\n // This feature is not intended for use by applications, and is thus not documented\n // publicly.\n // Object creation: http://jsperf.com/create-constructor/2\n var controllerPrototype = (isArray(expression) ?\n expression[expression.length - 1] : expression).prototype;\n instance = Object.create(controllerPrototype || null);\n\n if (identifier) {\n addIdentifier(locals, identifier, instance, constructor || expression.name);\n }\n\n var instantiate;\n return instantiate = extend(function() {\n var result = $injector.invoke(expression, instance, locals, constructor);\n if (result !== instance && (isObject(result) || isFunction(result))) {\n instance = result;\n if (identifier) {\n // If result changed, re-assign controllerAs value to scope.\n addIdentifier(locals, identifier, instance, constructor || expression.name);\n }\n }\n return instance;\n }, {\n instance: instance,\n identifier: identifier\n });\n }\n\n instance = $injector.instantiate(expression, locals, constructor);\n\n if (identifier) {\n addIdentifier(locals, identifier, instance, constructor || expression.name);\n }\n\n return instance;\n };\n\n function addIdentifier(locals, identifier, instance, name) {\n if (!(locals && isObject(locals.$scope))) {\n throw minErr('$controller')('noscp',\n \"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.\",\n name, identifier);\n }\n\n locals.$scope[identifier] = instance;\n }\n }];\n}\n\n/**\n * @ngdoc service\n * @name $document\n * @requires $window\n *\n * @description\n * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.\n *\n * @example\n <example module=\"documentExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <p>$document title: <b ng-bind=\"title\"></b></p>\n <p>window.document title: <b ng-bind=\"windowTitle\"></b></p>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('documentExample', [])\n .controller('ExampleController', ['$scope', '$document', function($scope, $document) {\n $scope.title = $document[0].title;\n $scope.windowTitle = angular.element(window.document)[0].title;\n }]);\n </file>\n </example>\n */\nfunction $DocumentProvider() {\n this.$get = ['$window', function(window) {\n return jqLite(window.document);\n }];\n}\n\n/**\n * @ngdoc service\n * @name $exceptionHandler\n * @requires ng.$log\n *\n * @description\n * Any uncaught exception in angular expressions is delegated to this service.\n * The default implementation simply delegates to `$log.error` which logs it into\n * the browser console.\n *\n * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by\n * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.\n *\n * ## Example:\n *\n * ```js\n * angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {\n * return function(exception, cause) {\n * exception.message += ' (caused by \"' + cause + '\")';\n * throw exception;\n * };\n * });\n * ```\n *\n * This example will override the normal action of `$exceptionHandler`, to make angular\n * exceptions fail hard when they happen, instead of just logging to the console.\n *\n * <hr />\n * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`\n * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}\n * (unless executed during a digest).\n *\n * If you wish, you can manually delegate exceptions, e.g.\n * `try { ... } catch(e) { $exceptionHandler(e); }`\n *\n * @param {Error} exception Exception associated with the error.\n * @param {string=} cause optional information about the context in which\n * the error was thrown.\n *\n */\nfunction $ExceptionHandlerProvider() {\n this.$get = ['$log', function($log) {\n return function(exception, cause) {\n $log.error.apply($log, arguments);\n };\n }];\n}\n\nvar $$ForceReflowProvider = function() {\n this.$get = ['$document', function($document) {\n return function(domNode) {\n //the line below will force the browser to perform a repaint so\n //that all the animated elements within the animation frame will\n //be properly updated and drawn on screen. This is required to\n //ensure that the preparation animation is properly flushed so that\n //the active state picks up from there. DO NOT REMOVE THIS LINE.\n //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH\n //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND\n //WILL TAKE YEARS AWAY FROM YOUR LIFE.\n if (domNode) {\n if (!domNode.nodeType && domNode instanceof jqLite) {\n domNode = domNode[0];\n }\n } else {\n domNode = $document[0].body;\n }\n return domNode.offsetWidth + 1;\n };\n }];\n};\n\nvar APPLICATION_JSON = 'application/json';\nvar CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};\nvar JSON_START = /^\\[|^\\{(?!\\{)/;\nvar JSON_ENDS = {\n '[': /]$/,\n '{': /}$/\n};\nvar JSON_PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar $httpMinErr = minErr('$http');\nvar $httpMinErrLegacyFn = function(method) {\n return function() {\n throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);\n };\n};\n\nfunction serializeValue(v) {\n if (isObject(v)) {\n return isDate(v) ? v.toISOString() : toJson(v);\n }\n return v;\n}\n\n\nfunction $HttpParamSerializerProvider() {\n /**\n * @ngdoc service\n * @name $httpParamSerializer\n * @description\n *\n * Default {@link $http `$http`} params serializer that converts objects to strings\n * according to the following rules:\n *\n * * `{'foo': 'bar'}` results in `foo=bar`\n * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)\n * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)\n * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D\"` (stringified and encoded representation of an object)\n *\n * Note that serializer will sort the request parameters alphabetically.\n * */\n\n this.$get = function() {\n return function ngParamSerializer(params) {\n if (!params) return '';\n var parts = [];\n forEachSorted(params, function(value, key) {\n if (value === null || isUndefined(value)) return;\n if (isArray(value)) {\n forEach(value, function(v, k) {\n parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));\n });\n } else {\n parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));\n }\n });\n\n return parts.join('&');\n };\n };\n}\n\nfunction $HttpParamSerializerJQLikeProvider() {\n /**\n * @ngdoc service\n * @name $httpParamSerializerJQLike\n * @description\n *\n * Alternative {@link $http `$http`} params serializer that follows\n * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.\n * The serializer will also sort the params alphabetically.\n *\n * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:\n *\n * ```js\n * $http({\n * url: myUrl,\n * method: 'GET',\n * params: myParams,\n * paramSerializer: '$httpParamSerializerJQLike'\n * });\n * ```\n *\n * It is also possible to set it as the default `paramSerializer` in the\n * {@link $httpProvider#defaults `$httpProvider`}.\n *\n * Additionally, you can inject the serializer and use it explicitly, for example to serialize\n * form data for submission:\n *\n * ```js\n * .controller(function($http, $httpParamSerializerJQLike) {\n * //...\n *\n * $http({\n * url: myUrl,\n * method: 'POST',\n * data: $httpParamSerializerJQLike(myData),\n * headers: {\n * 'Content-Type': 'application/x-www-form-urlencoded'\n * }\n * });\n *\n * });\n * ```\n *\n * */\n this.$get = function() {\n return function jQueryLikeParamSerializer(params) {\n if (!params) return '';\n var parts = [];\n serialize(params, '', true);\n return parts.join('&');\n\n function serialize(toSerialize, prefix, topLevel) {\n if (toSerialize === null || isUndefined(toSerialize)) return;\n if (isArray(toSerialize)) {\n forEach(toSerialize, function(value, index) {\n serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');\n });\n } else if (isObject(toSerialize) && !isDate(toSerialize)) {\n forEachSorted(toSerialize, function(value, key) {\n serialize(value, prefix +\n (topLevel ? '' : '[') +\n key +\n (topLevel ? '' : ']'));\n });\n } else {\n parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));\n }\n }\n };\n };\n}\n\nfunction defaultHttpResponseTransform(data, headers) {\n if (isString(data)) {\n // Strip json vulnerability protection prefix and trim whitespace\n var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();\n\n if (tempData) {\n var contentType = headers('Content-Type');\n if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {\n data = fromJson(tempData);\n }\n }\n }\n\n return data;\n}\n\nfunction isJsonLike(str) {\n var jsonStart = str.match(JSON_START);\n return jsonStart && JSON_ENDS[jsonStart[0]].test(str);\n}\n\n/**\n * Parse headers into key value object\n *\n * @param {string} headers Raw headers as a string\n * @returns {Object} Parsed headers as key value object\n */\nfunction parseHeaders(headers) {\n var parsed = createMap(), i;\n\n function fillInParsed(key, val) {\n if (key) {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n\n if (isString(headers)) {\n forEach(headers.split('\\n'), function(line) {\n i = line.indexOf(':');\n fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));\n });\n } else if (isObject(headers)) {\n forEach(headers, function(headerVal, headerKey) {\n fillInParsed(lowercase(headerKey), trim(headerVal));\n });\n }\n\n return parsed;\n}\n\n\n/**\n * Returns a function that provides access to parsed headers.\n *\n * Headers are lazy parsed when first requested.\n * @see parseHeaders\n *\n * @param {(string|Object)} headers Headers to provide access to.\n * @returns {function(string=)} Returns a getter function which if called with:\n *\n * - if called with single an argument returns a single header value or null\n * - if called with no arguments returns an object containing all headers.\n */\nfunction headersGetter(headers) {\n var headersObj;\n\n return function(name) {\n if (!headersObj) headersObj = parseHeaders(headers);\n\n if (name) {\n var value = headersObj[lowercase(name)];\n if (value === void 0) {\n value = null;\n }\n return value;\n }\n\n return headersObj;\n };\n}\n\n\n/**\n * Chain all given functions\n *\n * This function is used for both request and response transforming\n *\n * @param {*} data Data to transform.\n * @param {function(string=)} headers HTTP headers getter fn.\n * @param {number} status HTTP status code of the response.\n * @param {(Function|Array.<Function>)} fns Function or an array of functions.\n * @returns {*} Transformed data.\n */\nfunction transformData(data, headers, status, fns) {\n if (isFunction(fns)) {\n return fns(data, headers, status);\n }\n\n forEach(fns, function(fn) {\n data = fn(data, headers, status);\n });\n\n return data;\n}\n\n\nfunction isSuccess(status) {\n return 200 <= status && status < 300;\n}\n\n\n/**\n * @ngdoc provider\n * @name $httpProvider\n * @description\n * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.\n * */\nfunction $HttpProvider() {\n /**\n * @ngdoc property\n * @name $httpProvider#defaults\n * @description\n *\n * Object containing default values for all {@link ng.$http $http} requests.\n *\n * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with\n * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses\n * by default. See {@link $http#caching $http Caching} for more information.\n *\n * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.\n * Defaults value is `'XSRF-TOKEN'`.\n *\n * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the\n * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.\n *\n * - **`defaults.headers`** - {Object} - Default headers for all $http requests.\n * Refer to {@link ng.$http#setting-http-headers $http} for documentation on\n * setting default headers.\n * - **`defaults.headers.common`**\n * - **`defaults.headers.post`**\n * - **`defaults.headers.put`**\n * - **`defaults.headers.patch`**\n *\n *\n * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function\n * used to the prepare string representation of request parameters (specified as an object).\n * If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.\n * Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.\n *\n **/\n var defaults = this.defaults = {\n // transform incoming response data\n transformResponse: [defaultHttpResponseTransform],\n\n // transform outgoing request data\n transformRequest: [function(d) {\n return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;\n }],\n\n // default headers\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n },\n post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)\n },\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n paramSerializer: '$httpParamSerializer'\n };\n\n var useApplyAsync = false;\n /**\n * @ngdoc method\n * @name $httpProvider#useApplyAsync\n * @description\n *\n * Configure $http service to combine processing of multiple http responses received at around\n * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in\n * significant performance improvement for bigger applications that make many HTTP requests\n * concurrently (common during application bootstrap).\n *\n * Defaults to false. If no value is specified, returns the current configured value.\n *\n * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred\n * \"apply\" on the next tick, giving time for subsequent requests in a roughly ~10ms window\n * to load and share the same digest cycle.\n *\n * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n * otherwise, returns the current configured value.\n **/\n this.useApplyAsync = function(value) {\n if (isDefined(value)) {\n useApplyAsync = !!value;\n return this;\n }\n return useApplyAsync;\n };\n\n var useLegacyPromise = true;\n /**\n * @ngdoc method\n * @name $httpProvider#useLegacyPromiseExtensions\n * @description\n *\n * Configure `$http` service to return promises without the shorthand methods `success` and `error`.\n * This should be used to make sure that applications work without these methods.\n *\n * Defaults to true. If no value is specified, returns the current configured value.\n *\n * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.\n *\n * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n * otherwise, returns the current configured value.\n **/\n this.useLegacyPromiseExtensions = function(value) {\n if (isDefined(value)) {\n useLegacyPromise = !!value;\n return this;\n }\n return useLegacyPromise;\n };\n\n /**\n * @ngdoc property\n * @name $httpProvider#interceptors\n * @description\n *\n * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}\n * pre-processing of request or postprocessing of responses.\n *\n * These service factories are ordered by request, i.e. they are applied in the same order as the\n * array, on request, but reverse order, on response.\n *\n * {@link ng.$http#interceptors Interceptors detailed info}\n **/\n var interceptorFactories = this.interceptors = [];\n\n this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',\n function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {\n\n var defaultCache = $cacheFactory('$http');\n\n /**\n * Make sure that default param serializer is exposed as a function\n */\n defaults.paramSerializer = isString(defaults.paramSerializer) ?\n $injector.get(defaults.paramSerializer) : defaults.paramSerializer;\n\n /**\n * Interceptors stored in reverse order. Inner interceptors before outer interceptors.\n * The reversal is needed so that we can build up the interception chain around the\n * server request.\n */\n var reversedInterceptors = [];\n\n forEach(interceptorFactories, function(interceptorFactory) {\n reversedInterceptors.unshift(isString(interceptorFactory)\n ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));\n });\n\n /**\n * @ngdoc service\n * @kind function\n * @name $http\n * @requires ng.$httpBackend\n * @requires $cacheFactory\n * @requires $rootScope\n * @requires $q\n * @requires $injector\n *\n * @description\n * The `$http` service is a core Angular service that facilitates communication with the remote\n * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)\n * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).\n *\n * For unit testing applications that use `$http` service, see\n * {@link ngMock.$httpBackend $httpBackend mock}.\n *\n * For a higher level of abstraction, please check out the {@link ngResource.$resource\n * $resource} service.\n *\n * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by\n * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage\n * it is important to familiarize yourself with these APIs and the guarantees they provide.\n *\n *\n * ## General usage\n * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —\n * that is used to generate an HTTP request and returns a {@link ng.$q promise}.\n *\n * ```js\n * // Simple GET request example:\n * $http({\n * method: 'GET',\n * url: '/someUrl'\n * }).then(function successCallback(response) {\n * // this callback will be called asynchronously\n * // when the response is available\n * }, function errorCallback(response) {\n * // called asynchronously if an error occurs\n * // or server returns response with an error status.\n * });\n * ```\n *\n * The response object has these properties:\n *\n * - **data** `{string|Object}` The response body transformed with the transform\n * functions.\n * - **status** `{number}` HTTP status code of the response.\n * - **headers** `{function([headerName])}` Header getter function.\n * - **config** `{Object}` The configuration object that was used to generate the request.\n * - **statusText** `{string}` HTTP status text of the response.\n *\n * A response status code between 200 and 299 is considered a success status and\n * will result in the success callback being called. Note that if the response is a redirect,\n * XMLHttpRequest will transparently follow it, meaning that the error callback will not be\n * called for such responses.\n *\n *\n * ## Shortcut methods\n *\n * Shortcut methods are also available. All shortcut methods require passing in the URL, and\n * request data must be passed in for POST/PUT requests. An optional config can be passed as the\n * last argument.\n *\n * ```js\n * $http.get('/someUrl', config).then(successCallback, errorCallback);\n * $http.post('/someUrl', data, config).then(successCallback, errorCallback);\n * ```\n *\n * Complete list of shortcut methods:\n *\n * - {@link ng.$http#get $http.get}\n * - {@link ng.$http#head $http.head}\n * - {@link ng.$http#post $http.post}\n * - {@link ng.$http#put $http.put}\n * - {@link ng.$http#delete $http.delete}\n * - {@link ng.$http#jsonp $http.jsonp}\n * - {@link ng.$http#patch $http.patch}\n *\n *\n * ## Writing Unit Tests that use $http\n * When unit testing (using {@link ngMock ngMock}), it is necessary to call\n * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending\n * request using trained responses.\n *\n * ```\n * $httpBackend.expectGET(...);\n * $http.get(...);\n * $httpBackend.flush();\n * ```\n *\n * ## Deprecation Notice\n * <div class=\"alert alert-danger\">\n * The `$http` legacy promise methods `success` and `error` have been deprecated.\n * Use the standard `then` method instead.\n * If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to\n * `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.\n * </div>\n *\n * ## Setting HTTP Headers\n *\n * The $http service will automatically add certain HTTP headers to all requests. These defaults\n * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration\n * object, which currently contains this default configuration:\n *\n * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):\n * - `Accept: application/json, text/plain, * / *`\n * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)\n * - `Content-Type: application/json`\n * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)\n * - `Content-Type: application/json`\n *\n * To add or overwrite these defaults, simply add or remove a property from these configuration\n * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object\n * with the lowercased HTTP method name as the key, e.g.\n * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.\n *\n * The defaults can also be set at runtime via the `$http.defaults` object in the same\n * fashion. For example:\n *\n * ```\n * module.run(function($http) {\n * $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w'\n * });\n * ```\n *\n * In addition, you can supply a `headers` property in the config object passed when\n * calling `$http(config)`, which overrides the defaults without changing them globally.\n *\n * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,\n * Use the `headers` property, setting the desired header to `undefined`. For example:\n *\n * ```js\n * var req = {\n * method: 'POST',\n * url: 'http://example.com',\n * headers: {\n * 'Content-Type': undefined\n * },\n * data: { test: 'test' }\n * }\n *\n * $http(req).then(function(){...}, function(){...});\n * ```\n *\n * ## Transforming Requests and Responses\n *\n * Both requests and responses can be transformed using transformation functions: `transformRequest`\n * and `transformResponse`. These properties can be a single function that returns\n * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,\n * which allows you to `push` or `unshift` a new transformation function into the transformation chain.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Angular does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline.\n * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference).\n * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest\n * function will be reflected on the scope and in any templates where the object is data-bound.\n * To prevent this, transform functions should have no side-effects.\n * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return.\n * </div>\n *\n * ### Default Transformations\n *\n * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and\n * `defaults.transformResponse` properties. If a request does not provide its own transformations\n * then these will be applied.\n *\n * You can augment or replace the default transformations by modifying these properties by adding to or\n * replacing the array.\n *\n * Angular provides the following default transformations:\n *\n * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):\n *\n * - If the `data` property of the request configuration object contains an object, serialize it\n * into JSON format.\n *\n * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):\n *\n * - If XSRF prefix is detected, strip it (see Security Considerations section below).\n * - If JSON response is detected, deserialize it using a JSON parser.\n *\n *\n * ### Overriding the Default Transformations Per Request\n *\n * If you wish override the request/response transformations only for a single request then provide\n * `transformRequest` and/or `transformResponse` properties on the configuration object passed\n * into `$http`.\n *\n * Note that if you provide these properties on the config object the default transformations will be\n * overwritten. If you wish to augment the default transformations then you must include them in your\n * local transformation array.\n *\n * The following code demonstrates adding a new response transformation to be run after the default response\n * transformations have been run.\n *\n * ```js\n * function appendTransform(defaults, transform) {\n *\n * // We can't guarantee that the default transformation is an array\n * defaults = angular.isArray(defaults) ? defaults : [defaults];\n *\n * // Append the new transformation to the defaults\n * return defaults.concat(transform);\n * }\n *\n * $http({\n * url: '...',\n * method: 'GET',\n * transformResponse: appendTransform($http.defaults.transformResponse, function(value) {\n * return doTransform(value);\n * })\n * });\n * ```\n *\n *\n * ## Caching\n *\n * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must\n * set the config.cache value or the default cache value to TRUE or to a cache object (created\n * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes\n * precedence over the default cache value.\n *\n * In order to:\n * * cache all responses - set the default cache value to TRUE or to a cache object\n * * cache a specific response - set config.cache value to TRUE or to a cache object\n *\n * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,\n * then the default `$cacheFactory($http)` object is used.\n *\n * The default cache value can be set by updating the\n * {@link ng.$http#defaults `$http.defaults.cache`} property or the\n * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.\n *\n * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using\n * the relevant cache object. The next time the same request is made, the response is returned\n * from the cache without sending a request to the server.\n *\n * Take note that:\n *\n * * Only GET and JSONP requests are cached.\n * * The cache key is the request URL including search parameters; headers are not considered.\n * * Cached responses are returned asynchronously, in the same way as responses from the server.\n * * If multiple identical requests are made using the same cache, which is not yet populated,\n * one request will be made to the server and remaining requests will return the same response.\n * * A cache-control header on the response does not affect if or how responses are cached.\n *\n *\n * ## Interceptors\n *\n * Before you start creating interceptors, be sure to understand the\n * {@link ng.$q $q and deferred/promise APIs}.\n *\n * For purposes of global error handling, authentication, or any kind of synchronous or\n * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be\n * able to intercept requests before they are handed to the server and\n * responses before they are handed over to the application code that\n * initiated these requests. The interceptors leverage the {@link ng.$q\n * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.\n *\n * The interceptors are service factories that are registered with the `$httpProvider` by\n * adding them to the `$httpProvider.interceptors` array. The factory is called and\n * injected with dependencies (if specified) and returns the interceptor.\n *\n * There are two kinds of interceptors (and two kinds of rejection interceptors):\n *\n * * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to\n * modify the `config` object or create a new one. The function needs to return the `config`\n * object directly, or a promise containing the `config` or a new `config` object.\n * * `requestError`: interceptor gets called when a previous interceptor threw an error or\n * resolved with a rejection.\n * * `response`: interceptors get called with http `response` object. The function is free to\n * modify the `response` object or create a new one. The function needs to return the `response`\n * object directly, or as a promise containing the `response` or a new `response` object.\n * * `responseError`: interceptor gets called when a previous interceptor threw an error or\n * resolved with a rejection.\n *\n *\n * ```js\n * // register the interceptor as a service\n * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n * return {\n * // optional method\n * 'request': function(config) {\n * // do something on success\n * return config;\n * },\n *\n * // optional method\n * 'requestError': function(rejection) {\n * // do something on error\n * if (canRecover(rejection)) {\n * return responseOrNewPromise\n * }\n * return $q.reject(rejection);\n * },\n *\n *\n *\n * // optional method\n * 'response': function(response) {\n * // do something on success\n * return response;\n * },\n *\n * // optional method\n * 'responseError': function(rejection) {\n * // do something on error\n * if (canRecover(rejection)) {\n * return responseOrNewPromise\n * }\n * return $q.reject(rejection);\n * }\n * };\n * });\n *\n * $httpProvider.interceptors.push('myHttpInterceptor');\n *\n *\n * // alternatively, register the interceptor via an anonymous factory\n * $httpProvider.interceptors.push(function($q, dependency1, dependency2) {\n * return {\n * 'request': function(config) {\n * // same as above\n * },\n *\n * 'response': function(response) {\n * // same as above\n * }\n * };\n * });\n * ```\n *\n * ## Security Considerations\n *\n * When designing web applications, consider security threats from:\n *\n * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)\n *\n * Both server and the client must cooperate in order to eliminate these threats. Angular comes\n * pre-configured with strategies that address these issues, but for this to work backend server\n * cooperation is required.\n *\n * ### JSON Vulnerability Protection\n *\n * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n * allows third party website to turn your JSON resource URL into\n * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To\n * counter this your server can prefix all JSON requests with following string `\")]}',\\n\"`.\n * Angular will automatically strip the prefix before processing it as JSON.\n *\n * For example if your server needs to return:\n * ```js\n * ['one','two']\n * ```\n *\n * which is vulnerable to attack, your server can return:\n * ```js\n * )]}',\n * ['one','two']\n * ```\n *\n * Angular will strip the prefix, before processing the JSON.\n *\n *\n * ### Cross Site Request Forgery (XSRF) Protection\n *\n * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by\n * which the attacker can trick an authenticated user into unknowingly executing actions on your\n * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the\n * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP\n * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the\n * cookie, your server can be assured that the XHR came from JavaScript running on your domain.\n * The header will not be set for cross-domain requests.\n *\n * To take advantage of this, your server needs to set a token in a JavaScript readable session\n * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the\n * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure\n * that only JavaScript running on your domain could have sent the request. The token must be\n * unique for each user and must be verifiable by the server (to prevent the JavaScript from\n * making up its own tokens). We recommend that the token is a digest of your site's\n * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)\n * for added security.\n *\n * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName\n * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,\n * or the per-request config object.\n *\n * In order to prevent collisions in environments where multiple Angular apps share the\n * same domain or subdomain, we recommend that each application uses unique cookie name.\n *\n * @param {object} config Object describing the request to be made and how it should be\n * processed. The object has following properties:\n *\n * - **method** `{string}` HTTP method (e.g. 'GET', 'POST', etc)\n * - **url** `{string}` Absolute or relative URL of the resource that is being requested.\n * - **params** `{Object.<string|Object>}` Map of strings or objects which will be serialized\n * with the `paramSerializer` and appended as GET parameters.\n * - **data** `{string|Object}` Data to be sent as the request message data.\n * - **headers** `{Object}` Map of strings or functions which return strings representing\n * HTTP headers to send to the server. If the return value of a function is null, the\n * header will not be sent. Functions accept a config object as an argument.\n * - **xsrfHeaderName** `{string}` Name of HTTP header to populate with the XSRF token.\n * - **xsrfCookieName** `{string}` Name of cookie containing the XSRF token.\n * - **transformRequest** \n * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` \n * transform function or an array of such functions. The transform function takes the http\n * request body and headers and returns its transformed (typically serialized) version.\n * See {@link ng.$http#overriding-the-default-transformations-per-request\n * Overriding the Default Transformations}\n * - **transformResponse** \n * `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` \n * transform function or an array of such functions. The transform function takes the http\n * response body, headers and status and returns its transformed (typically deserialized) version.\n * See {@link ng.$http#overriding-the-default-transformations-per-request\n * Overriding the Default Transformations}\n * - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to\n * prepare the string representation of request parameters (specified as an object).\n * If specified as string, it is interpreted as function registered with the\n * {@link $injector $injector}, which means you can create your own serializer\n * by registering it as a {@link auto.$provide#service service}.\n * The default serializer is the {@link $httpParamSerializer $httpParamSerializer};\n * alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}\n * - **cache** `{boolean|Object}` A boolean value or object created with\n * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.\n * See {@link $http#caching $http Caching} for more information.\n * - **timeout** `{number|Promise}` timeout in milliseconds, or {@link ng.$q promise}\n * that should abort the request when resolved.\n * - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the\n * XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)\n * for more information.\n * - **responseType** - `{string}` - see\n * [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).\n *\n * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object\n * when the request succeeds or fails.\n *\n *\n * @property {Array.<Object>} pendingRequests Array of config objects for currently pending\n * requests. This is primarily meant to be used for debugging purposes.\n *\n *\n * @example\n<example module=\"httpExample\">\n<file name=\"index.html\">\n <div ng-controller=\"FetchController\">\n <select ng-model=\"method\" aria-label=\"Request method\">\n <option>GET</option>\n <option>JSONP</option>\n </select>\n <input type=\"text\" ng-model=\"url\" size=\"80\" aria-label=\"URL\" />\n <button id=\"fetchbtn\" ng-click=\"fetch()\">fetch</button><br>\n <button id=\"samplegetbtn\" ng-click=\"updateModel('GET', 'http-hello.html')\">Sample GET</button>\n <button id=\"samplejsonpbtn\"\n ng-click=\"updateModel('JSONP',\n 'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')\">\n Sample JSONP\n </button>\n <button id=\"invalidjsonpbtn\"\n ng-click=\"updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')\">\n Invalid JSONP\n </button>\n <pre>http status code: {{status}}</pre>\n <pre>http response data: {{data}}</pre>\n </div>\n</file>\n<file name=\"script.js\">\n angular.module('httpExample', [])\n .controller('FetchController', ['$scope', '$http', '$templateCache',\n function($scope, $http, $templateCache) {\n $scope.method = 'GET';\n $scope.url = 'http-hello.html';\n\n $scope.fetch = function() {\n $scope.code = null;\n $scope.response = null;\n\n $http({method: $scope.method, url: $scope.url, cache: $templateCache}).\n then(function(response) {\n $scope.status = response.status;\n $scope.data = response.data;\n }, function(response) {\n $scope.data = response.data || \"Request failed\";\n $scope.status = response.status;\n });\n };\n\n $scope.updateModel = function(method, url) {\n $scope.method = method;\n $scope.url = url;\n };\n }]);\n</file>\n<file name=\"http-hello.html\">\n Hello, $http!\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n var status = element(by.binding('status'));\n var data = element(by.binding('data'));\n var fetchBtn = element(by.id('fetchbtn'));\n var sampleGetBtn = element(by.id('samplegetbtn'));\n var sampleJsonpBtn = element(by.id('samplejsonpbtn'));\n var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));\n\n it('should make an xhr GET request', function() {\n sampleGetBtn.click();\n fetchBtn.click();\n expect(status.getText()).toMatch('200');\n expect(data.getText()).toMatch(/Hello, \\$http!/);\n });\n\n// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185\n// it('should make a JSONP request to angularjs.org', function() {\n// sampleJsonpBtn.click();\n// fetchBtn.click();\n// expect(status.getText()).toMatch('200');\n// expect(data.getText()).toMatch(/Super Hero!/);\n// });\n\n it('should make JSONP request to invalid URL and invoke the error handler',\n function() {\n invalidJsonpBtn.click();\n fetchBtn.click();\n expect(status.getText()).toMatch('0');\n expect(data.getText()).toMatch('Request failed');\n });\n</file>\n</example>\n */\n function $http(requestConfig) {\n\n if (!angular.isObject(requestConfig)) {\n throw minErr('$http')('badreq', 'Http request configuration must be an object. Received: {0}', requestConfig);\n }\n\n if (!isString(requestConfig.url)) {\n throw minErr('$http')('badreq', 'Http request configuration url must be a string. Received: {0}', requestConfig.url);\n }\n\n var config = extend({\n method: 'get',\n transformRequest: defaults.transformRequest,\n transformResponse: defaults.transformResponse,\n paramSerializer: defaults.paramSerializer\n }, requestConfig);\n\n config.headers = mergeHeaders(requestConfig);\n config.method = uppercase(config.method);\n config.paramSerializer = isString(config.paramSerializer) ?\n $injector.get(config.paramSerializer) : config.paramSerializer;\n\n var serverRequest = function(config) {\n var headers = config.headers;\n var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);\n\n // strip content-type if data is undefined\n if (isUndefined(reqData)) {\n forEach(headers, function(value, header) {\n if (lowercase(header) === 'content-type') {\n delete headers[header];\n }\n });\n }\n\n if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {\n config.withCredentials = defaults.withCredentials;\n }\n\n // send request\n return sendReq(config, reqData).then(transformResponse, transformResponse);\n };\n\n var chain = [serverRequest, undefined];\n var promise = $q.when(config);\n\n // apply interceptors\n forEach(reversedInterceptors, function(interceptor) {\n if (interceptor.request || interceptor.requestError) {\n chain.unshift(interceptor.request, interceptor.requestError);\n }\n if (interceptor.response || interceptor.responseError) {\n chain.push(interceptor.response, interceptor.responseError);\n }\n });\n\n while (chain.length) {\n var thenFn = chain.shift();\n var rejectFn = chain.shift();\n\n promise = promise.then(thenFn, rejectFn);\n }\n\n if (useLegacyPromise) {\n promise.success = function(fn) {\n assertArgFn(fn, 'fn');\n\n promise.then(function(response) {\n fn(response.data, response.status, response.headers, config);\n });\n return promise;\n };\n\n promise.error = function(fn) {\n assertArgFn(fn, 'fn');\n\n promise.then(null, function(response) {\n fn(response.data, response.status, response.headers, config);\n });\n return promise;\n };\n } else {\n promise.success = $httpMinErrLegacyFn('success');\n promise.error = $httpMinErrLegacyFn('error');\n }\n\n return promise;\n\n function transformResponse(response) {\n // make a copy since the response must be cacheable\n var resp = extend({}, response);\n resp.data = transformData(response.data, response.headers, response.status,\n config.transformResponse);\n return (isSuccess(response.status))\n ? resp\n : $q.reject(resp);\n }\n\n function executeHeaderFns(headers, config) {\n var headerContent, processedHeaders = {};\n\n forEach(headers, function(headerFn, header) {\n if (isFunction(headerFn)) {\n headerContent = headerFn(config);\n if (headerContent != null) {\n processedHeaders[header] = headerContent;\n }\n } else {\n processedHeaders[header] = headerFn;\n }\n });\n\n return processedHeaders;\n }\n\n function mergeHeaders(config) {\n var defHeaders = defaults.headers,\n reqHeaders = extend({}, config.headers),\n defHeaderName, lowercaseDefHeaderName, reqHeaderName;\n\n defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);\n\n // using for-in instead of forEach to avoid unecessary iteration after header has been found\n defaultHeadersIteration:\n for (defHeaderName in defHeaders) {\n lowercaseDefHeaderName = lowercase(defHeaderName);\n\n for (reqHeaderName in reqHeaders) {\n if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {\n continue defaultHeadersIteration;\n }\n }\n\n reqHeaders[defHeaderName] = defHeaders[defHeaderName];\n }\n\n // execute if header value is a function for merged headers\n return executeHeaderFns(reqHeaders, shallowCopy(config));\n }\n }\n\n $http.pendingRequests = [];\n\n /**\n * @ngdoc method\n * @name $http#get\n *\n * @description\n * Shortcut method to perform `GET` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n\n /**\n * @ngdoc method\n * @name $http#delete\n *\n * @description\n * Shortcut method to perform `DELETE` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n\n /**\n * @ngdoc method\n * @name $http#head\n *\n * @description\n * Shortcut method to perform `HEAD` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n\n /**\n * @ngdoc method\n * @name $http#jsonp\n *\n * @description\n * Shortcut method to perform `JSONP` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request.\n * The name of the callback should be the string `JSON_CALLBACK`.\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n createShortMethods('get', 'delete', 'head', 'jsonp');\n\n /**\n * @ngdoc method\n * @name $http#post\n *\n * @description\n * Shortcut method to perform `POST` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request\n * @param {*} data Request content\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n\n /**\n * @ngdoc method\n * @name $http#put\n *\n * @description\n * Shortcut method to perform `PUT` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request\n * @param {*} data Request content\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n\n /**\n * @ngdoc method\n * @name $http#patch\n *\n * @description\n * Shortcut method to perform `PATCH` request.\n *\n * @param {string} url Relative or absolute URL specifying the destination of the request\n * @param {*} data Request content\n * @param {Object=} config Optional configuration object\n * @returns {HttpPromise} Future object\n */\n createShortMethodsWithData('post', 'put', 'patch');\n\n /**\n * @ngdoc property\n * @name $http#defaults\n *\n * @description\n * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of\n * default headers, withCredentials as well as request and response transformations.\n *\n * See \"Setting HTTP Headers\" and \"Transforming Requests and Responses\" sections above.\n */\n $http.defaults = defaults;\n\n\n return $http;\n\n\n function createShortMethods(names) {\n forEach(arguments, function(name) {\n $http[name] = function(url, config) {\n return $http(extend({}, config || {}, {\n method: name,\n url: url\n }));\n };\n });\n }\n\n\n function createShortMethodsWithData(name) {\n forEach(arguments, function(name) {\n $http[name] = function(url, data, config) {\n return $http(extend({}, config || {}, {\n method: name,\n url: url,\n data: data\n }));\n };\n });\n }\n\n\n /**\n * Makes the request.\n *\n * !!! ACCESSES CLOSURE VARS:\n * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests\n */\n function sendReq(config, reqData) {\n var deferred = $q.defer(),\n promise = deferred.promise,\n cache,\n cachedResp,\n reqHeaders = config.headers,\n url = buildUrl(config.url, config.paramSerializer(config.params));\n\n $http.pendingRequests.push(config);\n promise.then(removePendingReq, removePendingReq);\n\n\n if ((config.cache || defaults.cache) && config.cache !== false &&\n (config.method === 'GET' || config.method === 'JSONP')) {\n cache = isObject(config.cache) ? config.cache\n : isObject(defaults.cache) ? defaults.cache\n : defaultCache;\n }\n\n if (cache) {\n cachedResp = cache.get(url);\n if (isDefined(cachedResp)) {\n if (isPromiseLike(cachedResp)) {\n // cached request has already been sent, but there is no response yet\n cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);\n } else {\n // serving from cache\n if (isArray(cachedResp)) {\n resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);\n } else {\n resolvePromise(cachedResp, 200, {}, 'OK');\n }\n }\n } else {\n // put the promise for the non-transformed response into cache as a placeholder\n cache.put(url, promise);\n }\n }\n\n\n // if we won't have the response in cache, set the xsrf headers and\n // send the request to the backend\n if (isUndefined(cachedResp)) {\n var xsrfValue = urlIsSameOrigin(config.url)\n ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]\n : undefined;\n if (xsrfValue) {\n reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;\n }\n\n $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,\n config.withCredentials, config.responseType);\n }\n\n return promise;\n\n\n /**\n * Callback registered to $httpBackend():\n * - caches the response if desired\n * - resolves the raw $http promise\n * - calls $apply\n */\n function done(status, response, headersString, statusText) {\n if (cache) {\n if (isSuccess(status)) {\n cache.put(url, [status, response, parseHeaders(headersString), statusText]);\n } else {\n // remove promise from the cache\n cache.remove(url);\n }\n }\n\n function resolveHttpPromise() {\n resolvePromise(response, status, headersString, statusText);\n }\n\n if (useApplyAsync) {\n $rootScope.$applyAsync(resolveHttpPromise);\n } else {\n resolveHttpPromise();\n if (!$rootScope.$$phase) $rootScope.$apply();\n }\n }\n\n\n /**\n * Resolves the raw $http promise.\n */\n function resolvePromise(response, status, headers, statusText) {\n //status: HTTP response status code, 0, -1 (aborted by timeout / promise)\n status = status >= -1 ? status : 0;\n\n (isSuccess(status) ? deferred.resolve : deferred.reject)({\n data: response,\n status: status,\n headers: headersGetter(headers),\n config: config,\n statusText: statusText\n });\n }\n\n function resolvePromiseWithResult(result) {\n resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);\n }\n\n function removePendingReq() {\n var idx = $http.pendingRequests.indexOf(config);\n if (idx !== -1) $http.pendingRequests.splice(idx, 1);\n }\n }\n\n\n function buildUrl(url, serializedParams) {\n if (serializedParams.length > 0) {\n url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;\n }\n return url;\n }\n }];\n}\n\n/**\n * @ngdoc service\n * @name $xhrFactory\n *\n * @description\n * Factory function used to create XMLHttpRequest objects.\n *\n * Replace or decorate this service to create your own custom XMLHttpRequest objects.\n *\n * ```\n * angular.module('myApp', [])\n * .factory('$xhrFactory', function() {\n * return function createXhr(method, url) {\n * return new window.XMLHttpRequest({mozSystem: true});\n * };\n * });\n * ```\n *\n * @param {string} method HTTP method of the request (GET, POST, PUT, ..)\n * @param {string} url URL of the request.\n */\nfunction $xhrFactoryProvider() {\n this.$get = function() {\n return function createXhr() {\n return new window.XMLHttpRequest();\n };\n };\n}\n\n/**\n * @ngdoc service\n * @name $httpBackend\n * @requires $window\n * @requires $document\n * @requires $xhrFactory\n *\n * @description\n * HTTP backend used by the {@link ng.$http service} that delegates to\n * XMLHttpRequest object or JSONP and deals with browser incompatibilities.\n *\n * You should never need to use this service directly, instead use the higher-level abstractions:\n * {@link ng.$http $http} or {@link ngResource.$resource $resource}.\n *\n * During testing this implementation is swapped with {@link ngMock.$httpBackend mock\n * $httpBackend} which can be trained with responses.\n */\nfunction $HttpBackendProvider() {\n this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {\n return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);\n }];\n}\n\nfunction createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {\n // TODO(vojta): fix the signature\n return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {\n $browser.$$incOutstandingRequestCount();\n url = url || $browser.url();\n\n if (lowercase(method) == 'jsonp') {\n var callbackId = '_' + (callbacks.counter++).toString(36);\n callbacks[callbackId] = function(data) {\n callbacks[callbackId].data = data;\n callbacks[callbackId].called = true;\n };\n\n var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),\n callbackId, function(status, text) {\n completeRequest(callback, status, callbacks[callbackId].data, \"\", text);\n callbacks[callbackId] = noop;\n });\n } else {\n\n var xhr = createXhr(method, url);\n\n xhr.open(method, url, true);\n forEach(headers, function(value, key) {\n if (isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n\n xhr.onload = function requestLoaded() {\n var statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n var response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n var status = xhr.status === 1223 ? 204 : xhr.status;\n\n // fix status code when it is 0 (0 status is undocumented).\n // Occurs when accessing file resources or on Android 4.1 stock browser\n // while retrieving files from application cache.\n if (status === 0) {\n status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;\n }\n\n completeRequest(callback,\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n var requestError = function() {\n // The response is always empty\n // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error\n completeRequest(callback, -1, null, null, '');\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n if (withCredentials) {\n xhr.withCredentials = true;\n }\n\n if (responseType) {\n try {\n xhr.responseType = responseType;\n } catch (e) {\n // WebKit added support for the json responseType value on 09/03/2013\n // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n // known to throw when setting the value \"json\" as the response type. Other older\n // browsers implementing the responseType\n //\n // The json response type can be ignored if not supported, because JSON payloads are\n // parsed on the client-side regardless.\n if (responseType !== 'json') {\n throw e;\n }\n }\n }\n\n xhr.send(isUndefined(post) ? null : post);\n }\n\n if (timeout > 0) {\n var timeoutId = $browserDefer(timeoutRequest, timeout);\n } else if (isPromiseLike(timeout)) {\n timeout.then(timeoutRequest);\n }\n\n\n function timeoutRequest() {\n jsonpDone && jsonpDone();\n xhr && xhr.abort();\n }\n\n function completeRequest(callback, status, response, headersString, statusText) {\n // cancel timeout and subsequent timeout promise resolution\n if (isDefined(timeoutId)) {\n $browserDefer.cancel(timeoutId);\n }\n jsonpDone = xhr = null;\n\n callback(status, response, headersString, statusText);\n $browser.$$completeOutstandingRequest(noop);\n }\n };\n\n function jsonpReq(url, callbackId, done) {\n // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:\n // - fetches local scripts via XHR and evals them\n // - adds and immediately removes script elements from the document\n var script = rawDocument.createElement('script'), callback = null;\n script.type = \"text/javascript\";\n script.src = url;\n script.async = true;\n\n callback = function(event) {\n removeEventListenerFn(script, \"load\", callback);\n removeEventListenerFn(script, \"error\", callback);\n rawDocument.body.removeChild(script);\n script = null;\n var status = -1;\n var text = \"unknown\";\n\n if (event) {\n if (event.type === \"load\" && !callbacks[callbackId].called) {\n event = { type: \"error\" };\n }\n text = event.type;\n status = event.type === \"error\" ? 404 : 200;\n }\n\n if (done) {\n done(status, text);\n }\n };\n\n addEventListenerFn(script, \"load\", callback);\n addEventListenerFn(script, \"error\", callback);\n rawDocument.body.appendChild(script);\n return callback;\n }\n}\n\nvar $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');\n$interpolateMinErr.throwNoconcat = function(text) {\n throw $interpolateMinErr('noconcat',\n \"Error while interpolating: {0}\\nStrict Contextual Escaping disallows \" +\n \"interpolations that concatenate multiple expressions when a trusted value is \" +\n \"required. See http://docs.angularjs.org/api/ng.$sce\", text);\n};\n\n$interpolateMinErr.interr = function(text, err) {\n return $interpolateMinErr('interr', \"Can't interpolate: {0}\\n{1}\", text, err.toString());\n};\n\n/**\n * @ngdoc provider\n * @name $interpolateProvider\n *\n * @description\n *\n * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.\n *\n * @example\n<example name=\"custom-interpolation-markup\" module=\"customInterpolationApp\">\n<file name=\"index.html\">\n<script>\n var customInterpolationApp = angular.module('customInterpolationApp', []);\n\n customInterpolationApp.config(function($interpolateProvider) {\n $interpolateProvider.startSymbol('//');\n $interpolateProvider.endSymbol('//');\n });\n\n\n customInterpolationApp.controller('DemoController', function() {\n this.label = \"This binding is brought you by // interpolation symbols.\";\n });\n</script>\n<div ng-controller=\"DemoController as demo\">\n //demo.label//\n</div>\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n it('should interpolate binding with custom symbols', function() {\n expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');\n });\n</file>\n</example>\n */\nfunction $InterpolateProvider() {\n var startSymbol = '{{';\n var endSymbol = '}}';\n\n /**\n * @ngdoc method\n * @name $interpolateProvider#startSymbol\n * @description\n * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.\n *\n * @param {string=} value new value to set the starting symbol to.\n * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n */\n this.startSymbol = function(value) {\n if (value) {\n startSymbol = value;\n return this;\n } else {\n return startSymbol;\n }\n };\n\n /**\n * @ngdoc method\n * @name $interpolateProvider#endSymbol\n * @description\n * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n *\n * @param {string=} value new value to set the ending symbol to.\n * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n */\n this.endSymbol = function(value) {\n if (value) {\n endSymbol = value;\n return this;\n } else {\n return endSymbol;\n }\n };\n\n\n this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {\n var startSymbolLength = startSymbol.length,\n endSymbolLength = endSymbol.length,\n escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),\n escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');\n\n function escape(ch) {\n return '\\\\\\\\\\\\' + ch;\n }\n\n function unescapeText(text) {\n return text.replace(escapedStartRegexp, startSymbol).\n replace(escapedEndRegexp, endSymbol);\n }\n\n function stringify(value) {\n if (value == null) { // null || undefined\n return '';\n }\n switch (typeof value) {\n case 'string':\n break;\n case 'number':\n value = '' + value;\n break;\n default:\n value = toJson(value);\n }\n\n return value;\n }\n\n /**\n * @ngdoc service\n * @name $interpolate\n * @kind function\n *\n * @requires $parse\n * @requires $sce\n *\n * @description\n *\n * Compiles a string with markup into an interpolation function. This service is used by the\n * HTML {@link ng.$compile $compile} service for data binding. See\n * {@link ng.$interpolateProvider $interpolateProvider} for configuring the\n * interpolation markup.\n *\n *\n * ```js\n * var $interpolate = ...; // injected\n * var exp = $interpolate('Hello {{name | uppercase}}!');\n * expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');\n * ```\n *\n * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is\n * `true`, the interpolation function will return `undefined` unless all embedded expressions\n * evaluate to a value other than `undefined`.\n *\n * ```js\n * var $interpolate = ...; // injected\n * var context = {greeting: 'Hello', name: undefined };\n *\n * // default \"forgiving\" mode\n * var exp = $interpolate('{{greeting}} {{name}}!');\n * expect(exp(context)).toEqual('Hello !');\n *\n * // \"allOrNothing\" mode\n * exp = $interpolate('{{greeting}} {{name}}!', false, null, true);\n * expect(exp(context)).toBeUndefined();\n * context.name = 'Angular';\n * expect(exp(context)).toEqual('Hello Angular!');\n * ```\n *\n * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.\n *\n * ####Escaped Interpolation\n * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers\n * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).\n * It will be rendered as a regular start/end marker, and will not be interpreted as an expression\n * or binding.\n *\n * This enables web-servers to prevent script injection attacks and defacing attacks, to some\n * degree, while also enabling code examples to work without relying on the\n * {@link ng.directive:ngNonBindable ngNonBindable} directive.\n *\n * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,\n * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all\n * interpolation start/end markers with their escaped counterparts.**\n *\n * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered\n * output when the $interpolate service processes the text. So, for HTML elements interpolated\n * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter\n * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,\n * this is typically useful only when user-data is used in rendering a template from the server, or\n * when otherwise untrusted data is used by a directive.\n *\n * <example>\n * <file name=\"index.html\">\n * <div ng-init=\"username='A user'\">\n * <p ng-init=\"apptitle='Escaping demo'\">{{apptitle}}: \\{\\{ username = \"defaced value\"; \\}\\}\n * </p>\n * <p><strong>{{username}}</strong> attempts to inject code which will deface the\n * application, but fails to accomplish their task, because the server has correctly\n * escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)\n * characters.</p>\n * <p>Instead, the result of the attempted script injection is visible, and can be removed\n * from the database by an administrator.</p>\n * </div>\n * </file>\n * </example>\n *\n * @knownIssue\n * It is currently not possible for an interpolated expression to contain the interpolation end\n * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e.\n * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string.\n *\n * @param {string} text The text with markup to interpolate.\n * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have\n * embedded expression in order to return an interpolation function. Strings with no\n * embedded expression will return null for the interpolation function.\n * @param {string=} trustedContext when provided, the returned function passes the interpolated\n * result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,\n * trustedContext)} before returning it. Refer to the {@link ng.$sce $sce} service that\n * provides Strict Contextual Escaping for details.\n * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined\n * unless all embedded expressions evaluate to a value other than `undefined`.\n * @returns {function(context)} an interpolation function which is used to compute the\n * interpolated string. The function has these parameters:\n *\n * - `context`: evaluation context for all expressions embedded in the interpolated text\n */\n function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {\n allOrNothing = !!allOrNothing;\n var startIndex,\n endIndex,\n index = 0,\n expressions = [],\n parseFns = [],\n textLength = text.length,\n exp,\n concat = [],\n expressionPositions = [];\n\n while (index < textLength) {\n if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&\n ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {\n if (index !== startIndex) {\n concat.push(unescapeText(text.substring(index, startIndex)));\n }\n exp = text.substring(startIndex + startSymbolLength, endIndex);\n expressions.push(exp);\n parseFns.push($parse(exp, parseStringifyInterceptor));\n index = endIndex + endSymbolLength;\n expressionPositions.push(concat.length);\n concat.push('');\n } else {\n // we did not find an interpolation, so we have to add the remainder to the separators array\n if (index !== textLength) {\n concat.push(unescapeText(text.substring(index)));\n }\n break;\n }\n }\n\n // Concatenating expressions makes it hard to reason about whether some combination of\n // concatenated values are unsafe to use and could easily lead to XSS. By requiring that a\n // single expression be used for iframe[src], object[src], etc., we ensure that the value\n // that's used is assigned or constructed by some JS code somewhere that is more testable or\n // make it obvious that you bound the value to some user controlled value. This helps reduce\n // the load when auditing for XSS issues.\n if (trustedContext && concat.length > 1) {\n $interpolateMinErr.throwNoconcat(text);\n }\n\n if (!mustHaveExpression || expressions.length) {\n var compute = function(values) {\n for (var i = 0, ii = expressions.length; i < ii; i++) {\n if (allOrNothing && isUndefined(values[i])) return;\n concat[expressionPositions[i]] = values[i];\n }\n return concat.join('');\n };\n\n var getValue = function(value) {\n return trustedContext ?\n $sce.getTrusted(trustedContext, value) :\n $sce.valueOf(value);\n };\n\n return extend(function interpolationFn(context) {\n var i = 0;\n var ii = expressions.length;\n var values = new Array(ii);\n\n try {\n for (; i < ii; i++) {\n values[i] = parseFns[i](context);\n }\n\n return compute(values);\n } catch (err) {\n $exceptionHandler($interpolateMinErr.interr(text, err));\n }\n\n }, {\n // all of these properties are undocumented for now\n exp: text, //just for compatibility with regular watchers created via $watch\n expressions: expressions,\n $$watchDelegate: function(scope, listener) {\n var lastValue;\n return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {\n var currValue = compute(values);\n if (isFunction(listener)) {\n listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);\n }\n lastValue = currValue;\n });\n }\n });\n }\n\n function parseStringifyInterceptor(value) {\n try {\n value = getValue(value);\n return allOrNothing && !isDefined(value) ? value : stringify(value);\n } catch (err) {\n $exceptionHandler($interpolateMinErr.interr(text, err));\n }\n }\n }\n\n\n /**\n * @ngdoc method\n * @name $interpolate#startSymbol\n * @description\n * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.\n *\n * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change\n * the symbol.\n *\n * @returns {string} start symbol.\n */\n $interpolate.startSymbol = function() {\n return startSymbol;\n };\n\n\n /**\n * @ngdoc method\n * @name $interpolate#endSymbol\n * @description\n * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n *\n * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change\n * the symbol.\n *\n * @returns {string} end symbol.\n */\n $interpolate.endSymbol = function() {\n return endSymbol;\n };\n\n return $interpolate;\n }];\n}\n\nfunction $IntervalProvider() {\n this.$get = ['$rootScope', '$window', '$q', '$$q',\n function($rootScope, $window, $q, $$q) {\n var intervals = {};\n\n\n /**\n * @ngdoc service\n * @name $interval\n *\n * @description\n * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`\n * milliseconds.\n *\n * The return value of registering an interval function is a promise. This promise will be\n * notified upon each tick of the interval, and will be resolved after `count` iterations, or\n * run indefinitely if `count` is not defined. The value of the notification will be the\n * number of iterations that have run.\n * To cancel an interval, call `$interval.cancel(promise)`.\n *\n * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to\n * move forward by `millis` milliseconds and trigger any functions scheduled to run in that\n * time.\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Intervals created by this service must be explicitly destroyed when you are finished\n * with them. In particular they are not automatically destroyed when a controller's scope or a\n * directive's element are destroyed.\n * You should take this into consideration and make sure to always cancel the interval at the\n * appropriate moment. See the example below for more details on how and when to do this.\n * </div>\n *\n * @param {function()} fn A function that should be called repeatedly.\n * @param {number} delay Number of milliseconds between each function call.\n * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat\n * indefinitely.\n * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n * @param {...*=} Pass additional parameters to the executed function.\n * @returns {promise} A promise which will be notified on each iteration.\n *\n * @example\n * <example module=\"intervalExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('intervalExample', [])\n * .controller('ExampleController', ['$scope', '$interval',\n * function($scope, $interval) {\n * $scope.format = 'M/d/yy h:mm:ss a';\n * $scope.blood_1 = 100;\n * $scope.blood_2 = 120;\n *\n * var stop;\n * $scope.fight = function() {\n * // Don't start a new fight if we are already fighting\n * if ( angular.isDefined(stop) ) return;\n *\n * stop = $interval(function() {\n * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {\n * $scope.blood_1 = $scope.blood_1 - 3;\n * $scope.blood_2 = $scope.blood_2 - 4;\n * } else {\n * $scope.stopFight();\n * }\n * }, 100);\n * };\n *\n * $scope.stopFight = function() {\n * if (angular.isDefined(stop)) {\n * $interval.cancel(stop);\n * stop = undefined;\n * }\n * };\n *\n * $scope.resetFight = function() {\n * $scope.blood_1 = 100;\n * $scope.blood_2 = 120;\n * };\n *\n * $scope.$on('$destroy', function() {\n * // Make sure that the interval is destroyed too\n * $scope.stopFight();\n * });\n * }])\n * // Register the 'myCurrentTime' directive factory method.\n * // We inject $interval and dateFilter service since the factory method is DI.\n * .directive('myCurrentTime', ['$interval', 'dateFilter',\n * function($interval, dateFilter) {\n * // return the directive link function. (compile function not needed)\n * return function(scope, element, attrs) {\n * var format, // date format\n * stopTime; // so that we can cancel the time updates\n *\n * // used to update the UI\n * function updateTime() {\n * element.text(dateFilter(new Date(), format));\n * }\n *\n * // watch the expression, and update the UI on change.\n * scope.$watch(attrs.myCurrentTime, function(value) {\n * format = value;\n * updateTime();\n * });\n *\n * stopTime = $interval(updateTime, 1000);\n *\n * // listen on DOM destroy (removal) event, and cancel the next UI update\n * // to prevent updating time after the DOM element was removed.\n * element.on('$destroy', function() {\n * $interval.cancel(stopTime);\n * });\n * }\n * }]);\n * </script>\n *\n * <div>\n * <div ng-controller=\"ExampleController\">\n * <label>Date format: <input ng-model=\"format\"></label> <hr/>\n * Current time is: <span my-current-time=\"format\"></span>\n * <hr/>\n * Blood 1 : <font color='red'>{{blood_1}}</font>\n * Blood 2 : <font color='red'>{{blood_2}}</font>\n * <button type=\"button\" data-ng-click=\"fight()\">Fight</button>\n * <button type=\"button\" data-ng-click=\"stopFight()\">StopFight</button>\n * <button type=\"button\" data-ng-click=\"resetFight()\">resetFight</button>\n * </div>\n * </div>\n *\n * </file>\n * </example>\n */\n function interval(fn, delay, count, invokeApply) {\n var hasParams = arguments.length > 4,\n args = hasParams ? sliceArgs(arguments, 4) : [],\n setInterval = $window.setInterval,\n clearInterval = $window.clearInterval,\n iteration = 0,\n skipApply = (isDefined(invokeApply) && !invokeApply),\n deferred = (skipApply ? $$q : $q).defer(),\n promise = deferred.promise;\n\n count = isDefined(count) ? count : 0;\n\n promise.then(null, null, (!hasParams) ? fn : function() {\n fn.apply(null, args);\n });\n\n promise.$$intervalId = setInterval(function tick() {\n deferred.notify(iteration++);\n\n if (count > 0 && iteration >= count) {\n deferred.resolve(iteration);\n clearInterval(promise.$$intervalId);\n delete intervals[promise.$$intervalId];\n }\n\n if (!skipApply) $rootScope.$apply();\n\n }, delay);\n\n intervals[promise.$$intervalId] = deferred;\n\n return promise;\n }\n\n\n /**\n * @ngdoc method\n * @name $interval#cancel\n *\n * @description\n * Cancels a task associated with the `promise`.\n *\n * @param {Promise=} promise returned by the `$interval` function.\n * @returns {boolean} Returns `true` if the task was successfully canceled.\n */\n interval.cancel = function(promise) {\n if (promise && promise.$$intervalId in intervals) {\n intervals[promise.$$intervalId].reject('canceled');\n $window.clearInterval(promise.$$intervalId);\n delete intervals[promise.$$intervalId];\n return true;\n }\n return false;\n };\n\n return interval;\n }];\n}\n\n/**\n * @ngdoc service\n * @name $locale\n *\n * @description\n * $locale service provides localization rules for various Angular components. As of right now the\n * only public api is:\n *\n * * `id` `{string}` locale id formatted as `languageId-countryId` (e.g. `en-us`)\n */\n\nvar PATH_MATCH = /^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,\n DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};\nvar $locationMinErr = minErr('$location');\n\n\n/**\n * Encode path using encodeUriSegment, ignoring forward slashes\n *\n * @param {string} path Path to encode\n * @returns {string}\n */\nfunction encodePath(path) {\n var segments = path.split('/'),\n i = segments.length;\n\n while (i--) {\n segments[i] = encodeUriSegment(segments[i]);\n }\n\n return segments.join('/');\n}\n\nfunction parseAbsoluteUrl(absoluteUrl, locationObj) {\n var parsedUrl = urlResolve(absoluteUrl);\n\n locationObj.$$protocol = parsedUrl.protocol;\n locationObj.$$host = parsedUrl.hostname;\n locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n}\n\n\nfunction parseAppUrl(relativeUrl, locationObj) {\n var prefixed = (relativeUrl.charAt(0) !== '/');\n if (prefixed) {\n relativeUrl = '/' + relativeUrl;\n }\n var match = urlResolve(relativeUrl);\n locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?\n match.pathname.substring(1) : match.pathname);\n locationObj.$$search = parseKeyValue(match.search);\n locationObj.$$hash = decodeURIComponent(match.hash);\n\n // make sure path starts with '/';\n if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {\n locationObj.$$path = '/' + locationObj.$$path;\n }\n}\n\n\n/**\n *\n * @param {string} begin\n * @param {string} whole\n * @returns {string} returns text from whole after begin or undefined if it does not begin with\n * expected string.\n */\nfunction beginsWith(begin, whole) {\n if (whole.indexOf(begin) === 0) {\n return whole.substr(begin.length);\n }\n}\n\n\nfunction stripHash(url) {\n var index = url.indexOf('#');\n return index == -1 ? url : url.substr(0, index);\n}\n\nfunction trimEmptyHash(url) {\n return url.replace(/(#.+)|#$/, '$1');\n}\n\n\nfunction stripFile(url) {\n return url.substr(0, stripHash(url).lastIndexOf('/') + 1);\n}\n\n/* return the server only (scheme://host:port) */\nfunction serverBase(url) {\n return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));\n}\n\n\n/**\n * LocationHtml5Url represents an url\n * This object is exposed as $location service when HTML5 mode is enabled and supported\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} basePrefix url path prefix\n */\nfunction LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {\n this.$$html5 = true;\n basePrefix = basePrefix || '';\n parseAbsoluteUrl(appBase, this);\n\n\n /**\n * Parse given html5 (regular) url string into properties\n * @param {string} url HTML5 url\n * @private\n */\n this.$$parse = function(url) {\n var pathUrl = beginsWith(appBaseNoFile, url);\n if (!isString(pathUrl)) {\n throw $locationMinErr('ipthprfx', 'Invalid url \"{0}\", missing path prefix \"{1}\".', url,\n appBaseNoFile);\n }\n\n parseAppUrl(pathUrl, this);\n\n if (!this.$$path) {\n this.$$path = '/';\n }\n\n this.$$compose();\n };\n\n /**\n * Compose url and update `absUrl` property\n * @private\n */\n this.$$compose = function() {\n var search = toKeyValue(this.$$search),\n hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'\n };\n\n this.$$parseLinkUrl = function(url, relHref) {\n if (relHref && relHref[0] === '#') {\n // special case for links to hash fragments:\n // keep the old url and only replace the hash fragment\n this.hash(relHref.slice(1));\n return true;\n }\n var appUrl, prevAppUrl;\n var rewrittenUrl;\n\n if (isDefined(appUrl = beginsWith(appBase, url))) {\n prevAppUrl = appUrl;\n if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {\n rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);\n } else {\n rewrittenUrl = appBase + prevAppUrl;\n }\n } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {\n rewrittenUrl = appBaseNoFile + appUrl;\n } else if (appBaseNoFile == url + '/') {\n rewrittenUrl = appBaseNoFile;\n }\n if (rewrittenUrl) {\n this.$$parse(rewrittenUrl);\n }\n return !!rewrittenUrl;\n };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when developer doesn't opt into html5 mode.\n * It also serves as the base class for html5 mode fallback on legacy browsers.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {\n\n parseAbsoluteUrl(appBase, this);\n\n\n /**\n * Parse given hashbang url into properties\n * @param {string} url Hashbang url\n * @private\n */\n this.$$parse = function(url) {\n var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);\n var withoutHashUrl;\n\n if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {\n\n // The rest of the url starts with a hash so we have\n // got either a hashbang path or a plain hash fragment\n withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);\n if (isUndefined(withoutHashUrl)) {\n // There was no hashbang prefix so we just have a hash fragment\n withoutHashUrl = withoutBaseUrl;\n }\n\n } else {\n // There was no hashbang path nor hash fragment:\n // If we are in HTML5 mode we use what is left as the path;\n // Otherwise we ignore what is left\n if (this.$$html5) {\n withoutHashUrl = withoutBaseUrl;\n } else {\n withoutHashUrl = '';\n if (isUndefined(withoutBaseUrl)) {\n appBase = url;\n this.replace();\n }\n }\n }\n\n parseAppUrl(withoutHashUrl, this);\n\n this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);\n\n this.$$compose();\n\n /*\n * In Windows, on an anchor node on documents loaded from\n * the filesystem, the browser will return a pathname\n * prefixed with the drive name ('/C:/path') when a\n * pathname without a drive is set:\n * * a.setAttribute('href', '/foo')\n * * a.pathname === '/C:/foo' //true\n *\n * Inside of Angular, we're always using pathnames that\n * do not include drive names for routing.\n */\n function removeWindowsDriveName(path, url, base) {\n /*\n Matches paths for file protocol on windows,\n such as /C:/foo/bar, and captures only /foo/bar.\n */\n var windowsFilePathExp = /^\\/[A-Z]:(\\/.*)/;\n\n var firstPathSegmentMatch;\n\n //Get the relative path from the input URL.\n if (url.indexOf(base) === 0) {\n url = url.replace(base, '');\n }\n\n // The input URL intentionally contains a first path segment that ends with a colon.\n if (windowsFilePathExp.exec(url)) {\n return path;\n }\n\n firstPathSegmentMatch = windowsFilePathExp.exec(path);\n return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;\n }\n };\n\n /**\n * Compose hashbang url and update `absUrl` property\n * @private\n */\n this.$$compose = function() {\n var search = toKeyValue(this.$$search),\n hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');\n };\n\n this.$$parseLinkUrl = function(url, relHref) {\n if (stripHash(appBase) == stripHash(url)) {\n this.$$parse(url);\n return true;\n }\n return false;\n };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when html5 history api is enabled but the browser\n * does not support it.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {\n this.$$html5 = true;\n LocationHashbangUrl.apply(this, arguments);\n\n this.$$parseLinkUrl = function(url, relHref) {\n if (relHref && relHref[0] === '#') {\n // special case for links to hash fragments:\n // keep the old url and only replace the hash fragment\n this.hash(relHref.slice(1));\n return true;\n }\n\n var rewrittenUrl;\n var appUrl;\n\n if (appBase == stripHash(url)) {\n rewrittenUrl = url;\n } else if ((appUrl = beginsWith(appBaseNoFile, url))) {\n rewrittenUrl = appBase + hashPrefix + appUrl;\n } else if (appBaseNoFile === url + '/') {\n rewrittenUrl = appBaseNoFile;\n }\n if (rewrittenUrl) {\n this.$$parse(rewrittenUrl);\n }\n return !!rewrittenUrl;\n };\n\n this.$$compose = function() {\n var search = toKeyValue(this.$$search),\n hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'\n this.$$absUrl = appBase + hashPrefix + this.$$url;\n };\n\n}\n\n\nvar locationPrototype = {\n\n /**\n * Are we in html5 mode?\n * @private\n */\n $$html5: false,\n\n /**\n * Has any change been replacing?\n * @private\n */\n $$replace: false,\n\n /**\n * @ngdoc method\n * @name $location#absUrl\n *\n * @description\n * This method is getter only.\n *\n * Return full url representation with all segments encoded according to rules specified in\n * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var absUrl = $location.absUrl();\n * // => \"http://example.com/#/some/path?foo=bar&baz=xoxo\"\n * ```\n *\n * @return {string} full url\n */\n absUrl: locationGetter('$$absUrl'),\n\n /**\n * @ngdoc method\n * @name $location#url\n *\n * @description\n * This method is getter / setter.\n *\n * Return url (e.g. `/path?a=b#hash`) when called without any parameter.\n *\n * Change path, search and hash, when called with parameter and return `$location`.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var url = $location.url();\n * // => \"/some/path?foo=bar&baz=xoxo\"\n * ```\n *\n * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)\n * @return {string} url\n */\n url: function(url) {\n if (isUndefined(url)) {\n return this.$$url;\n }\n\n var match = PATH_MATCH.exec(url);\n if (match[1] || url === '') this.path(decodeURIComponent(match[1]));\n if (match[2] || match[1] || url === '') this.search(match[3] || '');\n this.hash(match[5] || '');\n\n return this;\n },\n\n /**\n * @ngdoc method\n * @name $location#protocol\n *\n * @description\n * This method is getter only.\n *\n * Return protocol of current url.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var protocol = $location.protocol();\n * // => \"http\"\n * ```\n *\n * @return {string} protocol of current url\n */\n protocol: locationGetter('$$protocol'),\n\n /**\n * @ngdoc method\n * @name $location#host\n *\n * @description\n * This method is getter only.\n *\n * Return host of current url.\n *\n * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var host = $location.host();\n * // => \"example.com\"\n *\n * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo\n * host = $location.host();\n * // => \"example.com\"\n * host = location.host;\n * // => \"example.com:8080\"\n * ```\n *\n * @return {string} host of current url.\n */\n host: locationGetter('$$host'),\n\n /**\n * @ngdoc method\n * @name $location#port\n *\n * @description\n * This method is getter only.\n *\n * Return port of current url.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var port = $location.port();\n * // => 80\n * ```\n *\n * @return {Number} port\n */\n port: locationGetter('$$port'),\n\n /**\n * @ngdoc method\n * @name $location#path\n *\n * @description\n * This method is getter / setter.\n *\n * Return path of current url when called without any parameter.\n *\n * Change path when called with parameter and return `$location`.\n *\n * Note: Path should always begin with forward slash (/), this method will add the forward slash\n * if it is missing.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var path = $location.path();\n * // => \"/some/path\"\n * ```\n *\n * @param {(string|number)=} path New path\n * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter\n */\n path: locationGetterSetter('$$path', function(path) {\n path = path !== null ? path.toString() : '';\n return path.charAt(0) == '/' ? path : '/' + path;\n }),\n\n /**\n * @ngdoc method\n * @name $location#search\n *\n * @description\n * This method is getter / setter.\n *\n * Return search part (as object) of current url when called without any parameter.\n *\n * Change search part when called with parameter and return `$location`.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n * var searchObject = $location.search();\n * // => {foo: 'bar', baz: 'xoxo'}\n *\n * // set foo to 'yipee'\n * $location.search('foo', 'yipee');\n * // $location.search() => {foo: 'yipee', baz: 'xoxo'}\n * ```\n *\n * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or\n * hash object.\n *\n * When called with a single argument the method acts as a setter, setting the `search` component\n * of `$location` to the specified value.\n *\n * If the argument is a hash object containing an array of values, these values will be encoded\n * as duplicate search parameters in the url.\n *\n * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`\n * will override only a single search property.\n *\n * If `paramValue` is an array, it will override the property of the `search` component of\n * `$location` specified via the first argument.\n *\n * If `paramValue` is `null`, the property specified via the first argument will be deleted.\n *\n * If `paramValue` is `true`, the property specified via the first argument will be added with no\n * value nor trailing equal sign.\n *\n * @return {Object} If called with no arguments returns the parsed `search` object. If called with\n * one or more arguments returns `$location` object itself.\n */\n search: function(search, paramValue) {\n switch (arguments.length) {\n case 0:\n return this.$$search;\n case 1:\n if (isString(search) || isNumber(search)) {\n search = search.toString();\n this.$$search = parseKeyValue(search);\n } else if (isObject(search)) {\n search = copy(search, {});\n // remove object undefined or null properties\n forEach(search, function(value, key) {\n if (value == null) delete search[key];\n });\n\n this.$$search = search;\n } else {\n throw $locationMinErr('isrcharg',\n 'The first argument of the `$location#search()` call must be a string or an object.');\n }\n break;\n default:\n if (isUndefined(paramValue) || paramValue === null) {\n delete this.$$search[search];\n } else {\n this.$$search[search] = paramValue;\n }\n }\n\n this.$$compose();\n return this;\n },\n\n /**\n * @ngdoc method\n * @name $location#hash\n *\n * @description\n * This method is getter / setter.\n *\n * Returns the hash fragment when called without any parameters.\n *\n * Changes the hash fragment when called with a parameter and returns `$location`.\n *\n *\n * ```js\n * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue\n * var hash = $location.hash();\n * // => \"hashValue\"\n * ```\n *\n * @param {(string|number)=} hash New hash fragment\n * @return {string} hash\n */\n hash: locationGetterSetter('$$hash', function(hash) {\n return hash !== null ? hash.toString() : '';\n }),\n\n /**\n * @ngdoc method\n * @name $location#replace\n *\n * @description\n * If called, all changes to $location during the current `$digest` will replace the current history\n * record, instead of adding a new one.\n */\n replace: function() {\n this.$$replace = true;\n return this;\n }\n};\n\nforEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {\n Location.prototype = Object.create(locationPrototype);\n\n /**\n * @ngdoc method\n * @name $location#state\n *\n * @description\n * This method is getter / setter.\n *\n * Return the history state object when called without any parameter.\n *\n * Change the history state object when called with one parameter and return `$location`.\n * The state object is later passed to `pushState` or `replaceState`.\n *\n * NOTE: This method is supported only in HTML5 mode and only in browsers supporting\n * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support\n * older browsers (like IE9 or Android < 4.0), don't use this method.\n *\n * @param {object=} state State object for pushState or replaceState\n * @return {object} state\n */\n Location.prototype.state = function(state) {\n if (!arguments.length) {\n return this.$$state;\n }\n\n if (Location !== LocationHtml5Url || !this.$$html5) {\n throw $locationMinErr('nostate', 'History API state support is available only ' +\n 'in HTML5 mode and only in browsers supporting HTML5 History API');\n }\n // The user might modify `stateObject` after invoking `$location.state(stateObject)`\n // but we're changing the $$state reference to $browser.state() during the $digest\n // so the modification window is narrow.\n this.$$state = isUndefined(state) ? null : state;\n\n return this;\n };\n});\n\n\nfunction locationGetter(property) {\n return function() {\n return this[property];\n };\n}\n\n\nfunction locationGetterSetter(property, preprocess) {\n return function(value) {\n if (isUndefined(value)) {\n return this[property];\n }\n\n this[property] = preprocess(value);\n this.$$compose();\n\n return this;\n };\n}\n\n\n/**\n * @ngdoc service\n * @name $location\n *\n * @requires $rootElement\n *\n * @description\n * The $location service parses the URL in the browser address bar (based on the\n * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL\n * available to your application. Changes to the URL in the address bar are reflected into\n * $location service and changes to $location are reflected into the browser address bar.\n *\n * **The $location service:**\n *\n * - Exposes the current URL in the browser address bar, so you can\n * - Watch and observe the URL.\n * - Change the URL.\n * - Synchronizes the URL with the browser when the user\n * - Changes the address bar.\n * - Clicks the back or forward button (or clicks a History link).\n * - Clicks on a link.\n * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).\n *\n * For more information see {@link guide/$location Developer Guide: Using $location}\n */\n\n/**\n * @ngdoc provider\n * @name $locationProvider\n * @description\n * Use the `$locationProvider` to configure how the application deep linking paths are stored.\n */\nfunction $LocationProvider() {\n var hashPrefix = '',\n html5Mode = {\n enabled: false,\n requireBase: true,\n rewriteLinks: true\n };\n\n /**\n * @ngdoc method\n * @name $locationProvider#hashPrefix\n * @description\n * @param {string=} prefix Prefix for hash part (containing path and search)\n * @returns {*} current value if used as getter or itself (chaining) if used as setter\n */\n this.hashPrefix = function(prefix) {\n if (isDefined(prefix)) {\n hashPrefix = prefix;\n return this;\n } else {\n return hashPrefix;\n }\n };\n\n /**\n * @ngdoc method\n * @name $locationProvider#html5Mode\n * @description\n * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.\n * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported\n * properties:\n * - **enabled** `{boolean}` (default: false) If true, will rely on `history.pushState` to\n * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not\n * support `pushState`.\n * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies\n * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are\n * true, and a base tag is not present, an error will be thrown when `$location` is injected.\n * See the {@link guide/$location $location guide for more information}\n * - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,\n * enables/disables url rewriting for relative links.\n *\n * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter\n */\n this.html5Mode = function(mode) {\n if (isBoolean(mode)) {\n html5Mode.enabled = mode;\n return this;\n } else if (isObject(mode)) {\n\n if (isBoolean(mode.enabled)) {\n html5Mode.enabled = mode.enabled;\n }\n\n if (isBoolean(mode.requireBase)) {\n html5Mode.requireBase = mode.requireBase;\n }\n\n if (isBoolean(mode.rewriteLinks)) {\n html5Mode.rewriteLinks = mode.rewriteLinks;\n }\n\n return this;\n } else {\n return html5Mode;\n }\n };\n\n /**\n * @ngdoc event\n * @name $location#$locationChangeStart\n * @eventType broadcast on root scope\n * @description\n * Broadcasted before a URL will change.\n *\n * This change can be prevented by calling\n * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more\n * details about event object. Upon successful change\n * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.\n *\n * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n * the browser supports the HTML5 History API.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {string} newUrl New URL\n * @param {string=} oldUrl URL that was before it was changed.\n * @param {string=} newState New history state object\n * @param {string=} oldState History state object that was before it was changed.\n */\n\n /**\n * @ngdoc event\n * @name $location#$locationChangeSuccess\n * @eventType broadcast on root scope\n * @description\n * Broadcasted after a URL was changed.\n *\n * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n * the browser supports the HTML5 History API.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {string} newUrl New URL\n * @param {string=} oldUrl URL that was before it was changed.\n * @param {string=} newState New history state object\n * @param {string=} oldState History state object that was before it was changed.\n */\n\n this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',\n function($rootScope, $browser, $sniffer, $rootElement, $window) {\n var $location,\n LocationMode,\n baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''\n initialUrl = $browser.url(),\n appBase;\n\n if (html5Mode.enabled) {\n if (!baseHref && html5Mode.requireBase) {\n throw $locationMinErr('nobase',\n \"$location in HTML5 mode requires a <base> tag to be present!\");\n }\n appBase = serverBase(initialUrl) + (baseHref || '/');\n LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;\n } else {\n appBase = stripHash(initialUrl);\n LocationMode = LocationHashbangUrl;\n }\n var appBaseNoFile = stripFile(appBase);\n\n $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);\n $location.$$parseLinkUrl(initialUrl, initialUrl);\n\n $location.$$state = $browser.state();\n\n var IGNORE_URI_REGEXP = /^\\s*(javascript|mailto):/i;\n\n function setBrowserUrlWithFallback(url, replace, state) {\n var oldUrl = $location.url();\n var oldState = $location.$$state;\n try {\n $browser.url(url, replace, state);\n\n // Make sure $location.state() returns referentially identical (not just deeply equal)\n // state object; this makes possible quick checking if the state changed in the digest\n // loop. Checking deep equality would be too expensive.\n $location.$$state = $browser.state();\n } catch (e) {\n // Restore old values if pushState fails\n $location.url(oldUrl);\n $location.$$state = oldState;\n\n throw e;\n }\n }\n\n $rootElement.on('click', function(event) {\n // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)\n // currently we open nice url link and redirect then\n\n if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;\n\n var elm = jqLite(event.target);\n\n // traverse the DOM up to find first A tag\n while (nodeName_(elm[0]) !== 'a') {\n // ignore rewriting if no A tag (reached root element, or no parent - removed from document)\n if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;\n }\n\n var absHref = elm.prop('href');\n // get the actual href attribute - see\n // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx\n var relHref = elm.attr('href') || elm.attr('xlink:href');\n\n if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {\n // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during\n // an animation.\n absHref = urlResolve(absHref.animVal).href;\n }\n\n // Ignore when url is started with javascript: or mailto:\n if (IGNORE_URI_REGEXP.test(absHref)) return;\n\n if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {\n if ($location.$$parseLinkUrl(absHref, relHref)) {\n // We do a preventDefault for all urls that are part of the angular application,\n // in html5mode and also without, so that we are able to abort navigation without\n // getting double entries in the location history.\n event.preventDefault();\n // update location manually\n if ($location.absUrl() != $browser.url()) {\n $rootScope.$apply();\n // hack to work around FF6 bug 684208 when scenario runner clicks on links\n $window.angular['ff-684208-preventDefault'] = true;\n }\n }\n }\n });\n\n\n // rewrite hashbang url <> html5 url\n if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {\n $browser.url($location.absUrl(), true);\n }\n\n var initializing = true;\n\n // update $location when $browser url changes\n $browser.onUrlChange(function(newUrl, newState) {\n\n if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {\n // If we are navigating outside of the app then force a reload\n $window.location.href = newUrl;\n return;\n }\n\n $rootScope.$evalAsync(function() {\n var oldUrl = $location.absUrl();\n var oldState = $location.$$state;\n var defaultPrevented;\n newUrl = trimEmptyHash(newUrl);\n $location.$$parse(newUrl);\n $location.$$state = newState;\n\n defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n newState, oldState).defaultPrevented;\n\n // if the location was changed by a `$locationChangeStart` handler then stop\n // processing this location change\n if ($location.absUrl() !== newUrl) return;\n\n if (defaultPrevented) {\n $location.$$parse(oldUrl);\n $location.$$state = oldState;\n setBrowserUrlWithFallback(oldUrl, false, oldState);\n } else {\n initializing = false;\n afterLocationChange(oldUrl, oldState);\n }\n });\n if (!$rootScope.$$phase) $rootScope.$digest();\n });\n\n // update browser\n $rootScope.$watch(function $locationWatch() {\n var oldUrl = trimEmptyHash($browser.url());\n var newUrl = trimEmptyHash($location.absUrl());\n var oldState = $browser.state();\n var currentReplace = $location.$$replace;\n var urlOrStateChanged = oldUrl !== newUrl ||\n ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);\n\n if (initializing || urlOrStateChanged) {\n initializing = false;\n\n $rootScope.$evalAsync(function() {\n var newUrl = $location.absUrl();\n var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n $location.$$state, oldState).defaultPrevented;\n\n // if the location was changed by a `$locationChangeStart` handler then stop\n // processing this location change\n if ($location.absUrl() !== newUrl) return;\n\n if (defaultPrevented) {\n $location.$$parse(oldUrl);\n $location.$$state = oldState;\n } else {\n if (urlOrStateChanged) {\n setBrowserUrlWithFallback(newUrl, currentReplace,\n oldState === $location.$$state ? null : $location.$$state);\n }\n afterLocationChange(oldUrl, oldState);\n }\n });\n }\n\n $location.$$replace = false;\n\n // we don't need to return anything because $evalAsync will make the digest loop dirty when\n // there is a change\n });\n\n return $location;\n\n function afterLocationChange(oldUrl, oldState) {\n $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,\n $location.$$state, oldState);\n }\n}];\n}\n\n/**\n * @ngdoc service\n * @name $log\n * @requires $window\n *\n * @description\n * Simple service for logging. Default implementation safely writes the message\n * into the browser's console (if present).\n *\n * The main purpose of this service is to simplify debugging and troubleshooting.\n *\n * The default is to log `debug` messages. You can use\n * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.\n *\n * @example\n <example module=\"logExample\">\n <file name=\"script.js\">\n angular.module('logExample', [])\n .controller('LogController', ['$scope', '$log', function($scope, $log) {\n $scope.$log = $log;\n $scope.message = 'Hello World!';\n }]);\n </file>\n <file name=\"index.html\">\n <div ng-controller=\"LogController\">\n <p>Reload this page with open console, enter text and hit the log button...</p>\n <label>Message:\n <input type=\"text\" ng-model=\"message\" /></label>\n <button ng-click=\"$log.log(message)\">log</button>\n <button ng-click=\"$log.warn(message)\">warn</button>\n <button ng-click=\"$log.info(message)\">info</button>\n <button ng-click=\"$log.error(message)\">error</button>\n <button ng-click=\"$log.debug(message)\">debug</button>\n </div>\n </file>\n </example>\n */\n\n/**\n * @ngdoc provider\n * @name $logProvider\n * @description\n * Use the `$logProvider` to configure how the application logs messages\n */\nfunction $LogProvider() {\n var debug = true,\n self = this;\n\n /**\n * @ngdoc method\n * @name $logProvider#debugEnabled\n * @description\n * @param {boolean=} flag enable or disable debug level messages\n * @returns {*} current value if used as getter or itself (chaining) if used as setter\n */\n this.debugEnabled = function(flag) {\n if (isDefined(flag)) {\n debug = flag;\n return this;\n } else {\n return debug;\n }\n };\n\n this.$get = ['$window', function($window) {\n return {\n /**\n * @ngdoc method\n * @name $log#log\n *\n * @description\n * Write a log message\n */\n log: consoleLog('log'),\n\n /**\n * @ngdoc method\n * @name $log#info\n *\n * @description\n * Write an information message\n */\n info: consoleLog('info'),\n\n /**\n * @ngdoc method\n * @name $log#warn\n *\n * @description\n * Write a warning message\n */\n warn: consoleLog('warn'),\n\n /**\n * @ngdoc method\n * @name $log#error\n *\n * @description\n * Write an error message\n */\n error: consoleLog('error'),\n\n /**\n * @ngdoc method\n * @name $log#debug\n *\n * @description\n * Write a debug message\n */\n debug: (function() {\n var fn = consoleLog('debug');\n\n return function() {\n if (debug) {\n fn.apply(self, arguments);\n }\n };\n }())\n };\n\n function formatError(arg) {\n if (arg instanceof Error) {\n if (arg.stack) {\n arg = (arg.message && arg.stack.indexOf(arg.message) === -1)\n ? 'Error: ' + arg.message + '\\n' + arg.stack\n : arg.stack;\n } else if (arg.sourceURL) {\n arg = arg.message + '\\n' + arg.sourceURL + ':' + arg.line;\n }\n }\n return arg;\n }\n\n function consoleLog(type) {\n var console = $window.console || {},\n logFn = console[type] || console.log || noop,\n hasApply = false;\n\n // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.\n // The reason behind this is that console.log has type \"object\" in IE8...\n try {\n hasApply = !!logFn.apply;\n } catch (e) {}\n\n if (hasApply) {\n return function() {\n var args = [];\n forEach(arguments, function(arg) {\n args.push(formatError(arg));\n });\n return logFn.apply(console, args);\n };\n }\n\n // we are IE which either doesn't have window.console => this is noop and we do nothing,\n // or we are IE where console.log doesn't have apply so we log at least first 2 args\n return function(arg1, arg2) {\n logFn(arg1, arg2 == null ? '' : arg2);\n };\n }\n }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n * Any commits to this file should be reviewed with security in mind. *\n * Changes to this file can potentially create security vulnerabilities. *\n * An approval from 2 Core members with history of modifying *\n * this file is required. *\n * *\n * Does the change somehow allow for arbitrary javascript to be executed? *\n * Or allows for someone to change the prototype of built-in objects? *\n * Or gives undesired access to variables likes document or window? *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $parseMinErr = minErr('$parse');\n\n// Sandboxing Angular Expressions\n// ------------------------------\n// Angular expressions are generally considered safe because these expressions only have direct\n// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by\n// obtaining a reference to native JS functions such as the Function constructor.\n//\n// As an example, consider the following Angular expression:\n//\n// {}.toString.constructor('alert(\"evil JS code\")')\n//\n// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits\n// against the expression language, but not to prevent exploits that were enabled by exposing\n// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good\n// practice and therefore we are not even trying to protect against interaction with an object\n// explicitly exposed in this way.\n//\n// In general, it is not possible to access a Window object from an angular expression unless a\n// window or some DOM object that has a reference to window is published onto a Scope.\n// Similarly we prevent invocations of function known to be dangerous, as well as assignments to\n// native objects.\n//\n// See https://docs.angularjs.org/guide/security\n\n\nfunction ensureSafeMemberName(name, fullExpression) {\n if (name === \"__defineGetter__\" || name === \"__defineSetter__\"\n || name === \"__lookupGetter__\" || name === \"__lookupSetter__\"\n || name === \"__proto__\") {\n throw $parseMinErr('isecfld',\n 'Attempting to access a disallowed field in Angular expressions! '\n + 'Expression: {0}', fullExpression);\n }\n return name;\n}\n\nfunction getStringValue(name, fullExpression) {\n // From the JavaScript docs:\n // Property names must be strings. This means that non-string objects cannot be used\n // as keys in an object. Any non-string object, including a number, is typecasted\n // into a string via the toString method.\n //\n // So, to ensure that we are checking the same `name` that JavaScript would use,\n // we cast it to a string, if possible.\n // Doing `name + ''` can cause a repl error if the result to `toString` is not a string,\n // this is, this will handle objects that misbehave.\n name = name + '';\n if (!isString(name)) {\n throw $parseMinErr('iseccst',\n 'Cannot convert object to primitive value! '\n + 'Expression: {0}', fullExpression);\n }\n return name;\n}\n\nfunction ensureSafeObject(obj, fullExpression) {\n // nifty check if obj is Function that is fast and works across iframes and other contexts\n if (obj) {\n if (obj.constructor === obj) {\n throw $parseMinErr('isecfn',\n 'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n fullExpression);\n } else if (// isWindow(obj)\n obj.window === obj) {\n throw $parseMinErr('isecwindow',\n 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',\n fullExpression);\n } else if (// isElement(obj)\n obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {\n throw $parseMinErr('isecdom',\n 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',\n fullExpression);\n } else if (// block Object so that we can't get hold of dangerous Object.* methods\n obj === Object) {\n throw $parseMinErr('isecobj',\n 'Referencing Object in Angular expressions is disallowed! Expression: {0}',\n fullExpression);\n }\n }\n return obj;\n}\n\nvar CALL = Function.prototype.call;\nvar APPLY = Function.prototype.apply;\nvar BIND = Function.prototype.bind;\n\nfunction ensureSafeFunction(obj, fullExpression) {\n if (obj) {\n if (obj.constructor === obj) {\n throw $parseMinErr('isecfn',\n 'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n fullExpression);\n } else if (obj === CALL || obj === APPLY || obj === BIND) {\n throw $parseMinErr('isecff',\n 'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',\n fullExpression);\n }\n }\n}\n\nfunction ensureSafeAssignContext(obj, fullExpression) {\n if (obj) {\n if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||\n obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {\n throw $parseMinErr('isecaf',\n 'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);\n }\n }\n}\n\nvar OPERATORS = createMap();\nforEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });\nvar ESCAPE = {\"n\":\"\\n\", \"f\":\"\\f\", \"r\":\"\\r\", \"t\":\"\\t\", \"v\":\"\\v\", \"'\":\"'\", '\"':'\"'};\n\n\n/////////////////////////////////////////\n\n\n/**\n * @constructor\n */\nvar Lexer = function(options) {\n this.options = options;\n};\n\nLexer.prototype = {\n constructor: Lexer,\n\n lex: function(text) {\n this.text = text;\n this.index = 0;\n this.tokens = [];\n\n while (this.index < this.text.length) {\n var ch = this.text.charAt(this.index);\n if (ch === '\"' || ch === \"'\") {\n this.readString(ch);\n } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {\n this.readNumber();\n } else if (this.isIdent(ch)) {\n this.readIdent();\n } else if (this.is(ch, '(){}[].,;:?')) {\n this.tokens.push({index: this.index, text: ch});\n this.index++;\n } else if (this.isWhitespace(ch)) {\n this.index++;\n } else {\n var ch2 = ch + this.peek();\n var ch3 = ch2 + this.peek(2);\n var op1 = OPERATORS[ch];\n var op2 = OPERATORS[ch2];\n var op3 = OPERATORS[ch3];\n if (op1 || op2 || op3) {\n var token = op3 ? ch3 : (op2 ? ch2 : ch);\n this.tokens.push({index: this.index, text: token, operator: true});\n this.index += token.length;\n } else {\n this.throwError('Unexpected next character ', this.index, this.index + 1);\n }\n }\n }\n return this.tokens;\n },\n\n is: function(ch, chars) {\n return chars.indexOf(ch) !== -1;\n },\n\n peek: function(i) {\n var num = i || 1;\n return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;\n },\n\n isNumber: function(ch) {\n return ('0' <= ch && ch <= '9') && typeof ch === \"string\";\n },\n\n isWhitespace: function(ch) {\n // IE treats non-breaking space as \\u00A0\n return (ch === ' ' || ch === '\\r' || ch === '\\t' ||\n ch === '\\n' || ch === '\\v' || ch === '\\u00A0');\n },\n\n isIdent: function(ch) {\n return ('a' <= ch && ch <= 'z' ||\n 'A' <= ch && ch <= 'Z' ||\n '_' === ch || ch === '$');\n },\n\n isExpOperator: function(ch) {\n return (ch === '-' || ch === '+' || this.isNumber(ch));\n },\n\n throwError: function(error, start, end) {\n end = end || this.index;\n var colStr = (isDefined(start)\n ? 's ' + start + '-' + this.index + ' [' + this.text.substring(start, end) + ']'\n : ' ' + end);\n throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',\n error, colStr, this.text);\n },\n\n readNumber: function() {\n var number = '';\n var start = this.index;\n while (this.index < this.text.length) {\n var ch = lowercase(this.text.charAt(this.index));\n if (ch == '.' || this.isNumber(ch)) {\n number += ch;\n } else {\n var peekCh = this.peek();\n if (ch == 'e' && this.isExpOperator(peekCh)) {\n number += ch;\n } else if (this.isExpOperator(ch) &&\n peekCh && this.isNumber(peekCh) &&\n number.charAt(number.length - 1) == 'e') {\n number += ch;\n } else if (this.isExpOperator(ch) &&\n (!peekCh || !this.isNumber(peekCh)) &&\n number.charAt(number.length - 1) == 'e') {\n this.throwError('Invalid exponent');\n } else {\n break;\n }\n }\n this.index++;\n }\n this.tokens.push({\n index: start,\n text: number,\n constant: true,\n value: Number(number)\n });\n },\n\n readIdent: function() {\n var start = this.index;\n while (this.index < this.text.length) {\n var ch = this.text.charAt(this.index);\n if (!(this.isIdent(ch) || this.isNumber(ch))) {\n break;\n }\n this.index++;\n }\n this.tokens.push({\n index: start,\n text: this.text.slice(start, this.index),\n identifier: true\n });\n },\n\n readString: function(quote) {\n var start = this.index;\n this.index++;\n var string = '';\n var rawString = quote;\n var escape = false;\n while (this.index < this.text.length) {\n var ch = this.text.charAt(this.index);\n rawString += ch;\n if (escape) {\n if (ch === 'u') {\n var hex = this.text.substring(this.index + 1, this.index + 5);\n if (!hex.match(/[\\da-f]{4}/i)) {\n this.throwError('Invalid unicode escape [\\\\u' + hex + ']');\n }\n this.index += 4;\n string += String.fromCharCode(parseInt(hex, 16));\n } else {\n var rep = ESCAPE[ch];\n string = string + (rep || ch);\n }\n escape = false;\n } else if (ch === '\\\\') {\n escape = true;\n } else if (ch === quote) {\n this.index++;\n this.tokens.push({\n index: start,\n text: rawString,\n constant: true,\n value: string\n });\n return;\n } else {\n string += ch;\n }\n this.index++;\n }\n this.throwError('Unterminated quote', start);\n }\n};\n\nvar AST = function(lexer, options) {\n this.lexer = lexer;\n this.options = options;\n};\n\nAST.Program = 'Program';\nAST.ExpressionStatement = 'ExpressionStatement';\nAST.AssignmentExpression = 'AssignmentExpression';\nAST.ConditionalExpression = 'ConditionalExpression';\nAST.LogicalExpression = 'LogicalExpression';\nAST.BinaryExpression = 'BinaryExpression';\nAST.UnaryExpression = 'UnaryExpression';\nAST.CallExpression = 'CallExpression';\nAST.MemberExpression = 'MemberExpression';\nAST.Identifier = 'Identifier';\nAST.Literal = 'Literal';\nAST.ArrayExpression = 'ArrayExpression';\nAST.Property = 'Property';\nAST.ObjectExpression = 'ObjectExpression';\nAST.ThisExpression = 'ThisExpression';\n\n// Internal use only\nAST.NGValueParameter = 'NGValueParameter';\n\nAST.prototype = {\n ast: function(text) {\n this.text = text;\n this.tokens = this.lexer.lex(text);\n\n var value = this.program();\n\n if (this.tokens.length !== 0) {\n this.throwError('is an unexpected token', this.tokens[0]);\n }\n\n return value;\n },\n\n program: function() {\n var body = [];\n while (true) {\n if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))\n body.push(this.expressionStatement());\n if (!this.expect(';')) {\n return { type: AST.Program, body: body};\n }\n }\n },\n\n expressionStatement: function() {\n return { type: AST.ExpressionStatement, expression: this.filterChain() };\n },\n\n filterChain: function() {\n var left = this.expression();\n var token;\n while ((token = this.expect('|'))) {\n left = this.filter(left);\n }\n return left;\n },\n\n expression: function() {\n return this.assignment();\n },\n\n assignment: function() {\n var result = this.ternary();\n if (this.expect('=')) {\n result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};\n }\n return result;\n },\n\n ternary: function() {\n var test = this.logicalOR();\n var alternate;\n var consequent;\n if (this.expect('?')) {\n alternate = this.expression();\n if (this.consume(':')) {\n consequent = this.expression();\n return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};\n }\n }\n return test;\n },\n\n logicalOR: function() {\n var left = this.logicalAND();\n while (this.expect('||')) {\n left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };\n }\n return left;\n },\n\n logicalAND: function() {\n var left = this.equality();\n while (this.expect('&&')) {\n left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};\n }\n return left;\n },\n\n equality: function() {\n var left = this.relational();\n var token;\n while ((token = this.expect('==','!=','===','!=='))) {\n left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };\n }\n return left;\n },\n\n relational: function() {\n var left = this.additive();\n var token;\n while ((token = this.expect('<', '>', '<=', '>='))) {\n left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };\n }\n return left;\n },\n\n additive: function() {\n var left = this.multiplicative();\n var token;\n while ((token = this.expect('+','-'))) {\n left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };\n }\n return left;\n },\n\n multiplicative: function() {\n var left = this.unary();\n var token;\n while ((token = this.expect('*','/','%'))) {\n left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };\n }\n return left;\n },\n\n unary: function() {\n var token;\n if ((token = this.expect('+', '-', '!'))) {\n return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };\n } else {\n return this.primary();\n }\n },\n\n primary: function() {\n var primary;\n if (this.expect('(')) {\n primary = this.filterChain();\n this.consume(')');\n } else if (this.expect('[')) {\n primary = this.arrayDeclaration();\n } else if (this.expect('{')) {\n primary = this.object();\n } else if (this.constants.hasOwnProperty(this.peek().text)) {\n primary = copy(this.constants[this.consume().text]);\n } else if (this.peek().identifier) {\n primary = this.identifier();\n } else if (this.peek().constant) {\n primary = this.constant();\n } else {\n this.throwError('not a primary expression', this.peek());\n }\n\n var next;\n while ((next = this.expect('(', '[', '.'))) {\n if (next.text === '(') {\n primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };\n this.consume(')');\n } else if (next.text === '[') {\n primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };\n this.consume(']');\n } else if (next.text === '.') {\n primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };\n } else {\n this.throwError('IMPOSSIBLE');\n }\n }\n return primary;\n },\n\n filter: function(baseExpression) {\n var args = [baseExpression];\n var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};\n\n while (this.expect(':')) {\n args.push(this.expression());\n }\n\n return result;\n },\n\n parseArguments: function() {\n var args = [];\n if (this.peekToken().text !== ')') {\n do {\n args.push(this.expression());\n } while (this.expect(','));\n }\n return args;\n },\n\n identifier: function() {\n var token = this.consume();\n if (!token.identifier) {\n this.throwError('is not a valid identifier', token);\n }\n return { type: AST.Identifier, name: token.text };\n },\n\n constant: function() {\n // TODO check that it is a constant\n return { type: AST.Literal, value: this.consume().value };\n },\n\n arrayDeclaration: function() {\n var elements = [];\n if (this.peekToken().text !== ']') {\n do {\n if (this.peek(']')) {\n // Support trailing commas per ES5.1.\n break;\n }\n elements.push(this.expression());\n } while (this.expect(','));\n }\n this.consume(']');\n\n return { type: AST.ArrayExpression, elements: elements };\n },\n\n object: function() {\n var properties = [], property;\n if (this.peekToken().text !== '}') {\n do {\n if (this.peek('}')) {\n // Support trailing commas per ES5.1.\n break;\n }\n property = {type: AST.Property, kind: 'init'};\n if (this.peek().constant) {\n property.key = this.constant();\n } else if (this.peek().identifier) {\n property.key = this.identifier();\n } else {\n this.throwError(\"invalid key\", this.peek());\n }\n this.consume(':');\n property.value = this.expression();\n properties.push(property);\n } while (this.expect(','));\n }\n this.consume('}');\n\n return {type: AST.ObjectExpression, properties: properties };\n },\n\n throwError: function(msg, token) {\n throw $parseMinErr('syntax',\n 'Syntax Error: Token \\'{0}\\' {1} at column {2} of the expression [{3}] starting at [{4}].',\n token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));\n },\n\n consume: function(e1) {\n if (this.tokens.length === 0) {\n throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n }\n\n var token = this.expect(e1);\n if (!token) {\n this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());\n }\n return token;\n },\n\n peekToken: function() {\n if (this.tokens.length === 0) {\n throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n }\n return this.tokens[0];\n },\n\n peek: function(e1, e2, e3, e4) {\n return this.peekAhead(0, e1, e2, e3, e4);\n },\n\n peekAhead: function(i, e1, e2, e3, e4) {\n if (this.tokens.length > i) {\n var token = this.tokens[i];\n var t = token.text;\n if (t === e1 || t === e2 || t === e3 || t === e4 ||\n (!e1 && !e2 && !e3 && !e4)) {\n return token;\n }\n }\n return false;\n },\n\n expect: function(e1, e2, e3, e4) {\n var token = this.peek(e1, e2, e3, e4);\n if (token) {\n this.tokens.shift();\n return token;\n }\n return false;\n },\n\n\n /* `undefined` is not a constant, it is an identifier,\n * but using it as an identifier is not supported\n */\n constants: {\n 'true': { type: AST.Literal, value: true },\n 'false': { type: AST.Literal, value: false },\n 'null': { type: AST.Literal, value: null },\n 'undefined': {type: AST.Literal, value: undefined },\n 'this': {type: AST.ThisExpression }\n }\n};\n\nfunction ifDefined(v, d) {\n return typeof v !== 'undefined' ? v : d;\n}\n\nfunction plusFn(l, r) {\n if (typeof l === 'undefined') return r;\n if (typeof r === 'undefined') return l;\n return l + r;\n}\n\nfunction isStateless($filter, filterName) {\n var fn = $filter(filterName);\n return !fn.$stateful;\n}\n\nfunction findConstantAndWatchExpressions(ast, $filter) {\n var allConstants;\n var argsToWatch;\n switch (ast.type) {\n case AST.Program:\n allConstants = true;\n forEach(ast.body, function(expr) {\n findConstantAndWatchExpressions(expr.expression, $filter);\n allConstants = allConstants && expr.expression.constant;\n });\n ast.constant = allConstants;\n break;\n case AST.Literal:\n ast.constant = true;\n ast.toWatch = [];\n break;\n case AST.UnaryExpression:\n findConstantAndWatchExpressions(ast.argument, $filter);\n ast.constant = ast.argument.constant;\n ast.toWatch = ast.argument.toWatch;\n break;\n case AST.BinaryExpression:\n findConstantAndWatchExpressions(ast.left, $filter);\n findConstantAndWatchExpressions(ast.right, $filter);\n ast.constant = ast.left.constant && ast.right.constant;\n ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);\n break;\n case AST.LogicalExpression:\n findConstantAndWatchExpressions(ast.left, $filter);\n findConstantAndWatchExpressions(ast.right, $filter);\n ast.constant = ast.left.constant && ast.right.constant;\n ast.toWatch = ast.constant ? [] : [ast];\n break;\n case AST.ConditionalExpression:\n findConstantAndWatchExpressions(ast.test, $filter);\n findConstantAndWatchExpressions(ast.alternate, $filter);\n findConstantAndWatchExpressions(ast.consequent, $filter);\n ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;\n ast.toWatch = ast.constant ? [] : [ast];\n break;\n case AST.Identifier:\n ast.constant = false;\n ast.toWatch = [ast];\n break;\n case AST.MemberExpression:\n findConstantAndWatchExpressions(ast.object, $filter);\n if (ast.computed) {\n findConstantAndWatchExpressions(ast.property, $filter);\n }\n ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);\n ast.toWatch = [ast];\n break;\n case AST.CallExpression:\n allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;\n argsToWatch = [];\n forEach(ast.arguments, function(expr) {\n findConstantAndWatchExpressions(expr, $filter);\n allConstants = allConstants && expr.constant;\n if (!expr.constant) {\n argsToWatch.push.apply(argsToWatch, expr.toWatch);\n }\n });\n ast.constant = allConstants;\n ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];\n break;\n case AST.AssignmentExpression:\n findConstantAndWatchExpressions(ast.left, $filter);\n findConstantAndWatchExpressions(ast.right, $filter);\n ast.constant = ast.left.constant && ast.right.constant;\n ast.toWatch = [ast];\n break;\n case AST.ArrayExpression:\n allConstants = true;\n argsToWatch = [];\n forEach(ast.elements, function(expr) {\n findConstantAndWatchExpressions(expr, $filter);\n allConstants = allConstants && expr.constant;\n if (!expr.constant) {\n argsToWatch.push.apply(argsToWatch, expr.toWatch);\n }\n });\n ast.constant = allConstants;\n ast.toWatch = argsToWatch;\n break;\n case AST.ObjectExpression:\n allConstants = true;\n argsToWatch = [];\n forEach(ast.properties, function(property) {\n findConstantAndWatchExpressions(property.value, $filter);\n allConstants = allConstants && property.value.constant;\n if (!property.value.constant) {\n argsToWatch.push.apply(argsToWatch, property.value.toWatch);\n }\n });\n ast.constant = allConstants;\n ast.toWatch = argsToWatch;\n break;\n case AST.ThisExpression:\n ast.constant = false;\n ast.toWatch = [];\n break;\n }\n}\n\nfunction getInputs(body) {\n if (body.length != 1) return;\n var lastExpression = body[0].expression;\n var candidate = lastExpression.toWatch;\n if (candidate.length !== 1) return candidate;\n return candidate[0] !== lastExpression ? candidate : undefined;\n}\n\nfunction isAssignable(ast) {\n return ast.type === AST.Identifier || ast.type === AST.MemberExpression;\n}\n\nfunction assignableAST(ast) {\n if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {\n return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};\n }\n}\n\nfunction isLiteral(ast) {\n return ast.body.length === 0 ||\n ast.body.length === 1 && (\n ast.body[0].expression.type === AST.Literal ||\n ast.body[0].expression.type === AST.ArrayExpression ||\n ast.body[0].expression.type === AST.ObjectExpression);\n}\n\nfunction isConstant(ast) {\n return ast.constant;\n}\n\nfunction ASTCompiler(astBuilder, $filter) {\n this.astBuilder = astBuilder;\n this.$filter = $filter;\n}\n\nASTCompiler.prototype = {\n compile: function(expression, expensiveChecks) {\n var self = this;\n var ast = this.astBuilder.ast(expression);\n this.state = {\n nextId: 0,\n filters: {},\n expensiveChecks: expensiveChecks,\n fn: {vars: [], body: [], own: {}},\n assign: {vars: [], body: [], own: {}},\n inputs: []\n };\n findConstantAndWatchExpressions(ast, self.$filter);\n var extra = '';\n var assignable;\n this.stage = 'assign';\n if ((assignable = assignableAST(ast))) {\n this.state.computing = 'assign';\n var result = this.nextId();\n this.recurse(assignable, result);\n this.return_(result);\n extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');\n }\n var toWatch = getInputs(ast.body);\n self.stage = 'inputs';\n forEach(toWatch, function(watch, key) {\n var fnKey = 'fn' + key;\n self.state[fnKey] = {vars: [], body: [], own: {}};\n self.state.computing = fnKey;\n var intoId = self.nextId();\n self.recurse(watch, intoId);\n self.return_(intoId);\n self.state.inputs.push(fnKey);\n watch.watchId = key;\n });\n this.state.computing = 'fn';\n this.stage = 'main';\n this.recurse(ast);\n var fnString =\n // The build and minification steps remove the string \"use strict\" from the code, but this is done using a regex.\n // This is a workaround for this until we do a better job at only removing the prefix only when we should.\n '\"' + this.USE + ' ' + this.STRICT + '\";\\n' +\n this.filterPrefix() +\n 'var fn=' + this.generateFunction('fn', 's,l,a,i') +\n extra +\n this.watchFns() +\n 'return fn;';\n\n /* jshint -W054 */\n var fn = (new Function('$filter',\n 'ensureSafeMemberName',\n 'ensureSafeObject',\n 'ensureSafeFunction',\n 'getStringValue',\n 'ensureSafeAssignContext',\n 'ifDefined',\n 'plus',\n 'text',\n fnString))(\n this.$filter,\n ensureSafeMemberName,\n ensureSafeObject,\n ensureSafeFunction,\n getStringValue,\n ensureSafeAssignContext,\n ifDefined,\n plusFn,\n expression);\n /* jshint +W054 */\n this.state = this.stage = undefined;\n fn.literal = isLiteral(ast);\n fn.constant = isConstant(ast);\n return fn;\n },\n\n USE: 'use',\n\n STRICT: 'strict',\n\n watchFns: function() {\n var result = [];\n var fns = this.state.inputs;\n var self = this;\n forEach(fns, function(name) {\n result.push('var ' + name + '=' + self.generateFunction(name, 's'));\n });\n if (fns.length) {\n result.push('fn.inputs=[' + fns.join(',') + '];');\n }\n return result.join('');\n },\n\n generateFunction: function(name, params) {\n return 'function(' + params + '){' +\n this.varsPrefix(name) +\n this.body(name) +\n '};';\n },\n\n filterPrefix: function() {\n var parts = [];\n var self = this;\n forEach(this.state.filters, function(id, filter) {\n parts.push(id + '=$filter(' + self.escape(filter) + ')');\n });\n if (parts.length) return 'var ' + parts.join(',') + ';';\n return '';\n },\n\n varsPrefix: function(section) {\n return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';\n },\n\n body: function(section) {\n return this.state[section].body.join('');\n },\n\n recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n var left, right, self = this, args, expression;\n recursionFn = recursionFn || noop;\n if (!skipWatchIdCheck && isDefined(ast.watchId)) {\n intoId = intoId || this.nextId();\n this.if_('i',\n this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),\n this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)\n );\n return;\n }\n switch (ast.type) {\n case AST.Program:\n forEach(ast.body, function(expression, pos) {\n self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });\n if (pos !== ast.body.length - 1) {\n self.current().body.push(right, ';');\n } else {\n self.return_(right);\n }\n });\n break;\n case AST.Literal:\n expression = this.escape(ast.value);\n this.assign(intoId, expression);\n recursionFn(expression);\n break;\n case AST.UnaryExpression:\n this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });\n expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';\n this.assign(intoId, expression);\n recursionFn(expression);\n break;\n case AST.BinaryExpression:\n this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });\n this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });\n if (ast.operator === '+') {\n expression = this.plus(left, right);\n } else if (ast.operator === '-') {\n expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);\n } else {\n expression = '(' + left + ')' + ast.operator + '(' + right + ')';\n }\n this.assign(intoId, expression);\n recursionFn(expression);\n break;\n case AST.LogicalExpression:\n intoId = intoId || this.nextId();\n self.recurse(ast.left, intoId);\n self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));\n recursionFn(intoId);\n break;\n case AST.ConditionalExpression:\n intoId = intoId || this.nextId();\n self.recurse(ast.test, intoId);\n self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));\n recursionFn(intoId);\n break;\n case AST.Identifier:\n intoId = intoId || this.nextId();\n if (nameId) {\n nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');\n nameId.computed = false;\n nameId.name = ast.name;\n }\n ensureSafeMemberName(ast.name);\n self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),\n function() {\n self.if_(self.stage === 'inputs' || 's', function() {\n if (create && create !== 1) {\n self.if_(\n self.not(self.nonComputedMember('s', ast.name)),\n self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));\n }\n self.assign(intoId, self.nonComputedMember('s', ast.name));\n });\n }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))\n );\n if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {\n self.addEnsureSafeObject(intoId);\n }\n recursionFn(intoId);\n break;\n case AST.MemberExpression:\n left = nameId && (nameId.context = this.nextId()) || this.nextId();\n intoId = intoId || this.nextId();\n self.recurse(ast.object, left, undefined, function() {\n self.if_(self.notNull(left), function() {\n if (create && create !== 1) {\n self.addEnsureSafeAssignContext(left);\n }\n if (ast.computed) {\n right = self.nextId();\n self.recurse(ast.property, right);\n self.getStringValue(right);\n self.addEnsureSafeMemberName(right);\n if (create && create !== 1) {\n self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));\n }\n expression = self.ensureSafeObject(self.computedMember(left, right));\n self.assign(intoId, expression);\n if (nameId) {\n nameId.computed = true;\n nameId.name = right;\n }\n } else {\n ensureSafeMemberName(ast.property.name);\n if (create && create !== 1) {\n self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));\n }\n expression = self.nonComputedMember(left, ast.property.name);\n if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {\n expression = self.ensureSafeObject(expression);\n }\n self.assign(intoId, expression);\n if (nameId) {\n nameId.computed = false;\n nameId.name = ast.property.name;\n }\n }\n }, function() {\n self.assign(intoId, 'undefined');\n });\n recursionFn(intoId);\n }, !!create);\n break;\n case AST.CallExpression:\n intoId = intoId || this.nextId();\n if (ast.filter) {\n right = self.filter(ast.callee.name);\n args = [];\n forEach(ast.arguments, function(expr) {\n var argument = self.nextId();\n self.recurse(expr, argument);\n args.push(argument);\n });\n expression = right + '(' + args.join(',') + ')';\n self.assign(intoId, expression);\n recursionFn(intoId);\n } else {\n right = self.nextId();\n left = {};\n args = [];\n self.recurse(ast.callee, right, left, function() {\n self.if_(self.notNull(right), function() {\n self.addEnsureSafeFunction(right);\n forEach(ast.arguments, function(expr) {\n self.recurse(expr, self.nextId(), undefined, function(argument) {\n args.push(self.ensureSafeObject(argument));\n });\n });\n if (left.name) {\n if (!self.state.expensiveChecks) {\n self.addEnsureSafeObject(left.context);\n }\n expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';\n } else {\n expression = right + '(' + args.join(',') + ')';\n }\n expression = self.ensureSafeObject(expression);\n self.assign(intoId, expression);\n }, function() {\n self.assign(intoId, 'undefined');\n });\n recursionFn(intoId);\n });\n }\n break;\n case AST.AssignmentExpression:\n right = this.nextId();\n left = {};\n if (!isAssignable(ast.left)) {\n throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');\n }\n this.recurse(ast.left, undefined, left, function() {\n self.if_(self.notNull(left.context), function() {\n self.recurse(ast.right, right);\n self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));\n self.addEnsureSafeAssignContext(left.context);\n expression = self.member(left.context, left.name, left.computed) + ast.operator + right;\n self.assign(intoId, expression);\n recursionFn(intoId || expression);\n });\n }, 1);\n break;\n case AST.ArrayExpression:\n args = [];\n forEach(ast.elements, function(expr) {\n self.recurse(expr, self.nextId(), undefined, function(argument) {\n args.push(argument);\n });\n });\n expression = '[' + args.join(',') + ']';\n this.assign(intoId, expression);\n recursionFn(expression);\n break;\n case AST.ObjectExpression:\n args = [];\n forEach(ast.properties, function(property) {\n self.recurse(property.value, self.nextId(), undefined, function(expr) {\n args.push(self.escape(\n property.key.type === AST.Identifier ? property.key.name :\n ('' + property.key.value)) +\n ':' + expr);\n });\n });\n expression = '{' + args.join(',') + '}';\n this.assign(intoId, expression);\n recursionFn(expression);\n break;\n case AST.ThisExpression:\n this.assign(intoId, 's');\n recursionFn('s');\n break;\n case AST.NGValueParameter:\n this.assign(intoId, 'v');\n recursionFn('v');\n break;\n }\n },\n\n getHasOwnProperty: function(element, property) {\n var key = element + '.' + property;\n var own = this.current().own;\n if (!own.hasOwnProperty(key)) {\n own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');\n }\n return own[key];\n },\n\n assign: function(id, value) {\n if (!id) return;\n this.current().body.push(id, '=', value, ';');\n return id;\n },\n\n filter: function(filterName) {\n if (!this.state.filters.hasOwnProperty(filterName)) {\n this.state.filters[filterName] = this.nextId(true);\n }\n return this.state.filters[filterName];\n },\n\n ifDefined: function(id, defaultValue) {\n return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';\n },\n\n plus: function(left, right) {\n return 'plus(' + left + ',' + right + ')';\n },\n\n return_: function(id) {\n this.current().body.push('return ', id, ';');\n },\n\n if_: function(test, alternate, consequent) {\n if (test === true) {\n alternate();\n } else {\n var body = this.current().body;\n body.push('if(', test, '){');\n alternate();\n body.push('}');\n if (consequent) {\n body.push('else{');\n consequent();\n body.push('}');\n }\n }\n },\n\n not: function(expression) {\n return '!(' + expression + ')';\n },\n\n notNull: function(expression) {\n return expression + '!=null';\n },\n\n nonComputedMember: function(left, right) {\n return left + '.' + right;\n },\n\n computedMember: function(left, right) {\n return left + '[' + right + ']';\n },\n\n member: function(left, right, computed) {\n if (computed) return this.computedMember(left, right);\n return this.nonComputedMember(left, right);\n },\n\n addEnsureSafeObject: function(item) {\n this.current().body.push(this.ensureSafeObject(item), ';');\n },\n\n addEnsureSafeMemberName: function(item) {\n this.current().body.push(this.ensureSafeMemberName(item), ';');\n },\n\n addEnsureSafeFunction: function(item) {\n this.current().body.push(this.ensureSafeFunction(item), ';');\n },\n\n addEnsureSafeAssignContext: function(item) {\n this.current().body.push(this.ensureSafeAssignContext(item), ';');\n },\n\n ensureSafeObject: function(item) {\n return 'ensureSafeObject(' + item + ',text)';\n },\n\n ensureSafeMemberName: function(item) {\n return 'ensureSafeMemberName(' + item + ',text)';\n },\n\n ensureSafeFunction: function(item) {\n return 'ensureSafeFunction(' + item + ',text)';\n },\n\n getStringValue: function(item) {\n this.assign(item, 'getStringValue(' + item + ',text)');\n },\n\n ensureSafeAssignContext: function(item) {\n return 'ensureSafeAssignContext(' + item + ',text)';\n },\n\n lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n var self = this;\n return function() {\n self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);\n };\n },\n\n lazyAssign: function(id, value) {\n var self = this;\n return function() {\n self.assign(id, value);\n };\n },\n\n stringEscapeRegex: /[^ a-zA-Z0-9]/g,\n\n stringEscapeFn: function(c) {\n return '\\\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);\n },\n\n escape: function(value) {\n if (isString(value)) return \"'\" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + \"'\";\n if (isNumber(value)) return value.toString();\n if (value === true) return 'true';\n if (value === false) return 'false';\n if (value === null) return 'null';\n if (typeof value === 'undefined') return 'undefined';\n\n throw $parseMinErr('esc', 'IMPOSSIBLE');\n },\n\n nextId: function(skip, init) {\n var id = 'v' + (this.state.nextId++);\n if (!skip) {\n this.current().vars.push(id + (init ? '=' + init : ''));\n }\n return id;\n },\n\n current: function() {\n return this.state[this.state.computing];\n }\n};\n\n\nfunction ASTInterpreter(astBuilder, $filter) {\n this.astBuilder = astBuilder;\n this.$filter = $filter;\n}\n\nASTInterpreter.prototype = {\n compile: function(expression, expensiveChecks) {\n var self = this;\n var ast = this.astBuilder.ast(expression);\n this.expression = expression;\n this.expensiveChecks = expensiveChecks;\n findConstantAndWatchExpressions(ast, self.$filter);\n var assignable;\n var assign;\n if ((assignable = assignableAST(ast))) {\n assign = this.recurse(assignable);\n }\n var toWatch = getInputs(ast.body);\n var inputs;\n if (toWatch) {\n inputs = [];\n forEach(toWatch, function(watch, key) {\n var input = self.recurse(watch);\n watch.input = input;\n inputs.push(input);\n watch.watchId = key;\n });\n }\n var expressions = [];\n forEach(ast.body, function(expression) {\n expressions.push(self.recurse(expression.expression));\n });\n var fn = ast.body.length === 0 ? function() {} :\n ast.body.length === 1 ? expressions[0] :\n function(scope, locals) {\n var lastValue;\n forEach(expressions, function(exp) {\n lastValue = exp(scope, locals);\n });\n return lastValue;\n };\n if (assign) {\n fn.assign = function(scope, value, locals) {\n return assign(scope, locals, value);\n };\n }\n if (inputs) {\n fn.inputs = inputs;\n }\n fn.literal = isLiteral(ast);\n fn.constant = isConstant(ast);\n return fn;\n },\n\n recurse: function(ast, context, create) {\n var left, right, self = this, args, expression;\n if (ast.input) {\n return this.inputs(ast.input, ast.watchId);\n }\n switch (ast.type) {\n case AST.Literal:\n return this.value(ast.value, context);\n case AST.UnaryExpression:\n right = this.recurse(ast.argument);\n return this['unary' + ast.operator](right, context);\n case AST.BinaryExpression:\n left = this.recurse(ast.left);\n right = this.recurse(ast.right);\n return this['binary' + ast.operator](left, right, context);\n case AST.LogicalExpression:\n left = this.recurse(ast.left);\n right = this.recurse(ast.right);\n return this['binary' + ast.operator](left, right, context);\n case AST.ConditionalExpression:\n return this['ternary?:'](\n this.recurse(ast.test),\n this.recurse(ast.alternate),\n this.recurse(ast.consequent),\n context\n );\n case AST.Identifier:\n ensureSafeMemberName(ast.name, self.expression);\n return self.identifier(ast.name,\n self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),\n context, create, self.expression);\n case AST.MemberExpression:\n left = this.recurse(ast.object, false, !!create);\n if (!ast.computed) {\n ensureSafeMemberName(ast.property.name, self.expression);\n right = ast.property.name;\n }\n if (ast.computed) right = this.recurse(ast.property);\n return ast.computed ?\n this.computedMember(left, right, context, create, self.expression) :\n this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);\n case AST.CallExpression:\n args = [];\n forEach(ast.arguments, function(expr) {\n args.push(self.recurse(expr));\n });\n if (ast.filter) right = this.$filter(ast.callee.name);\n if (!ast.filter) right = this.recurse(ast.callee, true);\n return ast.filter ?\n function(scope, locals, assign, inputs) {\n var values = [];\n for (var i = 0; i < args.length; ++i) {\n values.push(args[i](scope, locals, assign, inputs));\n }\n var value = right.apply(undefined, values, inputs);\n return context ? {context: undefined, name: undefined, value: value} : value;\n } :\n function(scope, locals, assign, inputs) {\n var rhs = right(scope, locals, assign, inputs);\n var value;\n if (rhs.value != null) {\n ensureSafeObject(rhs.context, self.expression);\n ensureSafeFunction(rhs.value, self.expression);\n var values = [];\n for (var i = 0; i < args.length; ++i) {\n values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));\n }\n value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);\n }\n return context ? {value: value} : value;\n };\n case AST.AssignmentExpression:\n left = this.recurse(ast.left, true, 1);\n right = this.recurse(ast.right);\n return function(scope, locals, assign, inputs) {\n var lhs = left(scope, locals, assign, inputs);\n var rhs = right(scope, locals, assign, inputs);\n ensureSafeObject(lhs.value, self.expression);\n ensureSafeAssignContext(lhs.context);\n lhs.context[lhs.name] = rhs;\n return context ? {value: rhs} : rhs;\n };\n case AST.ArrayExpression:\n args = [];\n forEach(ast.elements, function(expr) {\n args.push(self.recurse(expr));\n });\n return function(scope, locals, assign, inputs) {\n var value = [];\n for (var i = 0; i < args.length; ++i) {\n value.push(args[i](scope, locals, assign, inputs));\n }\n return context ? {value: value} : value;\n };\n case AST.ObjectExpression:\n args = [];\n forEach(ast.properties, function(property) {\n args.push({key: property.key.type === AST.Identifier ?\n property.key.name :\n ('' + property.key.value),\n value: self.recurse(property.value)\n });\n });\n return function(scope, locals, assign, inputs) {\n var value = {};\n for (var i = 0; i < args.length; ++i) {\n value[args[i].key] = args[i].value(scope, locals, assign, inputs);\n }\n return context ? {value: value} : value;\n };\n case AST.ThisExpression:\n return function(scope) {\n return context ? {value: scope} : scope;\n };\n case AST.NGValueParameter:\n return function(scope, locals, assign, inputs) {\n return context ? {value: assign} : assign;\n };\n }\n },\n\n 'unary+': function(argument, context) {\n return function(scope, locals, assign, inputs) {\n var arg = argument(scope, locals, assign, inputs);\n if (isDefined(arg)) {\n arg = +arg;\n } else {\n arg = 0;\n }\n return context ? {value: arg} : arg;\n };\n },\n 'unary-': function(argument, context) {\n return function(scope, locals, assign, inputs) {\n var arg = argument(scope, locals, assign, inputs);\n if (isDefined(arg)) {\n arg = -arg;\n } else {\n arg = 0;\n }\n return context ? {value: arg} : arg;\n };\n },\n 'unary!': function(argument, context) {\n return function(scope, locals, assign, inputs) {\n var arg = !argument(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary+': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var lhs = left(scope, locals, assign, inputs);\n var rhs = right(scope, locals, assign, inputs);\n var arg = plusFn(lhs, rhs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary-': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var lhs = left(scope, locals, assign, inputs);\n var rhs = right(scope, locals, assign, inputs);\n var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);\n return context ? {value: arg} : arg;\n };\n },\n 'binary*': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary/': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary%': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary===': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary!==': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary==': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary!=': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary<': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary>': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary<=': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary>=': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary&&': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'binary||': function(left, right, context) {\n return function(scope, locals, assign, inputs) {\n var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n 'ternary?:': function(test, alternate, consequent, context) {\n return function(scope, locals, assign, inputs) {\n var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);\n return context ? {value: arg} : arg;\n };\n },\n value: function(value, context) {\n return function() { return context ? {context: undefined, name: undefined, value: value} : value; };\n },\n identifier: function(name, expensiveChecks, context, create, expression) {\n return function(scope, locals, assign, inputs) {\n var base = locals && (name in locals) ? locals : scope;\n if (create && create !== 1 && base && !(base[name])) {\n base[name] = {};\n }\n var value = base ? base[name] : undefined;\n if (expensiveChecks) {\n ensureSafeObject(value, expression);\n }\n if (context) {\n return {context: base, name: name, value: value};\n } else {\n return value;\n }\n };\n },\n computedMember: function(left, right, context, create, expression) {\n return function(scope, locals, assign, inputs) {\n var lhs = left(scope, locals, assign, inputs);\n var rhs;\n var value;\n if (lhs != null) {\n rhs = right(scope, locals, assign, inputs);\n rhs = getStringValue(rhs);\n ensureSafeMemberName(rhs, expression);\n if (create && create !== 1) {\n ensureSafeAssignContext(lhs);\n if (lhs && !(lhs[rhs])) {\n lhs[rhs] = {};\n }\n }\n value = lhs[rhs];\n ensureSafeObject(value, expression);\n }\n if (context) {\n return {context: lhs, name: rhs, value: value};\n } else {\n return value;\n }\n };\n },\n nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {\n return function(scope, locals, assign, inputs) {\n var lhs = left(scope, locals, assign, inputs);\n if (create && create !== 1) {\n ensureSafeAssignContext(lhs);\n if (lhs && !(lhs[right])) {\n lhs[right] = {};\n }\n }\n var value = lhs != null ? lhs[right] : undefined;\n if (expensiveChecks || isPossiblyDangerousMemberName(right)) {\n ensureSafeObject(value, expression);\n }\n if (context) {\n return {context: lhs, name: right, value: value};\n } else {\n return value;\n }\n };\n },\n inputs: function(input, watchId) {\n return function(scope, value, locals, inputs) {\n if (inputs) return inputs[watchId];\n return input(scope, value, locals);\n };\n }\n};\n\n/**\n * @constructor\n */\nvar Parser = function(lexer, $filter, options) {\n this.lexer = lexer;\n this.$filter = $filter;\n this.options = options;\n this.ast = new AST(this.lexer);\n this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :\n new ASTCompiler(this.ast, $filter);\n};\n\nParser.prototype = {\n constructor: Parser,\n\n parse: function(text) {\n return this.astCompiler.compile(text, this.options.expensiveChecks);\n }\n};\n\nfunction isPossiblyDangerousMemberName(name) {\n return name == 'constructor';\n}\n\nvar objectValueOf = Object.prototype.valueOf;\n\nfunction getValueOf(value) {\n return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);\n}\n\n///////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $parse\n * @kind function\n *\n * @description\n *\n * Converts Angular {@link guide/expression expression} into a function.\n *\n * ```js\n * var getter = $parse('user.name');\n * var setter = getter.assign;\n * var context = {user:{name:'angular'}};\n * var locals = {user:{name:'local'}};\n *\n * expect(getter(context)).toEqual('angular');\n * setter(context, 'newValue');\n * expect(context.user.name).toEqual('newValue');\n * expect(getter(context, locals)).toEqual('local');\n * ```\n *\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n *\n * The returned function also has the following properties:\n * * `literal` `{boolean}` whether the expression's top-level node is a JavaScript\n * literal.\n * * `constant` `{boolean}` whether the expression is made entirely of JavaScript\n * constant literals.\n * * `assign` `{?function(context, value)}` if the expression is assignable, this will be\n * set to a function to change its value on the given context.\n *\n */\n\n\n/**\n * @ngdoc provider\n * @name $parseProvider\n *\n * @description\n * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}\n * service.\n */\nfunction $ParseProvider() {\n var cacheDefault = createMap();\n var cacheExpensive = createMap();\n\n this.$get = ['$filter', function($filter) {\n var noUnsafeEval = csp().noUnsafeEval;\n var $parseOptions = {\n csp: noUnsafeEval,\n expensiveChecks: false\n },\n $parseOptionsExpensive = {\n csp: noUnsafeEval,\n expensiveChecks: true\n };\n var runningChecksEnabled = false;\n\n $parse.$$runningExpensiveChecks = function() {\n return runningChecksEnabled;\n };\n\n return $parse;\n\n function $parse(exp, interceptorFn, expensiveChecks) {\n var parsedExpression, oneTime, cacheKey;\n\n expensiveChecks = expensiveChecks || runningChecksEnabled;\n\n switch (typeof exp) {\n case 'string':\n exp = exp.trim();\n cacheKey = exp;\n\n var cache = (expensiveChecks ? cacheExpensive : cacheDefault);\n parsedExpression = cache[cacheKey];\n\n if (!parsedExpression) {\n if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {\n oneTime = true;\n exp = exp.substring(2);\n }\n var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;\n var lexer = new Lexer(parseOptions);\n var parser = new Parser(lexer, $filter, parseOptions);\n parsedExpression = parser.parse(exp);\n if (parsedExpression.constant) {\n parsedExpression.$$watchDelegate = constantWatchDelegate;\n } else if (oneTime) {\n parsedExpression.$$watchDelegate = parsedExpression.literal ?\n oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;\n } else if (parsedExpression.inputs) {\n parsedExpression.$$watchDelegate = inputsWatchDelegate;\n }\n if (expensiveChecks) {\n parsedExpression = expensiveChecksInterceptor(parsedExpression);\n }\n cache[cacheKey] = parsedExpression;\n }\n return addInterceptor(parsedExpression, interceptorFn);\n\n case 'function':\n return addInterceptor(exp, interceptorFn);\n\n default:\n return addInterceptor(noop, interceptorFn);\n }\n }\n\n function expensiveChecksInterceptor(fn) {\n if (!fn) return fn;\n expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;\n expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);\n expensiveCheckFn.constant = fn.constant;\n expensiveCheckFn.literal = fn.literal;\n for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {\n fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);\n }\n expensiveCheckFn.inputs = fn.inputs;\n\n return expensiveCheckFn;\n\n function expensiveCheckFn(scope, locals, assign, inputs) {\n var expensiveCheckOldValue = runningChecksEnabled;\n runningChecksEnabled = true;\n try {\n return fn(scope, locals, assign, inputs);\n } finally {\n runningChecksEnabled = expensiveCheckOldValue;\n }\n }\n }\n\n function expressionInputDirtyCheck(newValue, oldValueOfValue) {\n\n if (newValue == null || oldValueOfValue == null) { // null/undefined\n return newValue === oldValueOfValue;\n }\n\n if (typeof newValue === 'object') {\n\n // attempt to convert the value to a primitive type\n // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can\n // be cheaply dirty-checked\n newValue = getValueOf(newValue);\n\n if (typeof newValue === 'object') {\n // objects/arrays are not supported - deep-watching them would be too expensive\n return false;\n }\n\n // fall-through to the primitive equality check\n }\n\n //Primitive or NaN\n return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);\n }\n\n function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {\n var inputExpressions = parsedExpression.inputs;\n var lastResult;\n\n if (inputExpressions.length === 1) {\n var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails\n inputExpressions = inputExpressions[0];\n return scope.$watch(function expressionInputWatch(scope) {\n var newInputValue = inputExpressions(scope);\n if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {\n lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);\n oldInputValueOf = newInputValue && getValueOf(newInputValue);\n }\n return lastResult;\n }, listener, objectEquality, prettyPrintExpression);\n }\n\n var oldInputValueOfValues = [];\n var oldInputValues = [];\n for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails\n oldInputValues[i] = null;\n }\n\n return scope.$watch(function expressionInputsWatch(scope) {\n var changed = false;\n\n for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n var newInputValue = inputExpressions[i](scope);\n if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {\n oldInputValues[i] = newInputValue;\n oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);\n }\n }\n\n if (changed) {\n lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);\n }\n\n return lastResult;\n }, listener, objectEquality, prettyPrintExpression);\n }\n\n function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n var unwatch, lastValue;\n return unwatch = scope.$watch(function oneTimeWatch(scope) {\n return parsedExpression(scope);\n }, function oneTimeListener(value, old, scope) {\n lastValue = value;\n if (isFunction(listener)) {\n listener.apply(this, arguments);\n }\n if (isDefined(value)) {\n scope.$$postDigest(function() {\n if (isDefined(lastValue)) {\n unwatch();\n }\n });\n }\n }, objectEquality);\n }\n\n function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n var unwatch, lastValue;\n return unwatch = scope.$watch(function oneTimeWatch(scope) {\n return parsedExpression(scope);\n }, function oneTimeListener(value, old, scope) {\n lastValue = value;\n if (isFunction(listener)) {\n listener.call(this, value, old, scope);\n }\n if (isAllDefined(value)) {\n scope.$$postDigest(function() {\n if (isAllDefined(lastValue)) unwatch();\n });\n }\n }, objectEquality);\n\n function isAllDefined(value) {\n var allDefined = true;\n forEach(value, function(val) {\n if (!isDefined(val)) allDefined = false;\n });\n return allDefined;\n }\n }\n\n function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n var unwatch;\n return unwatch = scope.$watch(function constantWatch(scope) {\n return parsedExpression(scope);\n }, function constantListener(value, old, scope) {\n if (isFunction(listener)) {\n listener.apply(this, arguments);\n }\n unwatch();\n }, objectEquality);\n }\n\n function addInterceptor(parsedExpression, interceptorFn) {\n if (!interceptorFn) return parsedExpression;\n var watchDelegate = parsedExpression.$$watchDelegate;\n var useInputs = false;\n\n var regularWatch =\n watchDelegate !== oneTimeLiteralWatchDelegate &&\n watchDelegate !== oneTimeWatchDelegate;\n\n var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {\n var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);\n return interceptorFn(value, scope, locals);\n } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {\n var value = parsedExpression(scope, locals, assign, inputs);\n var result = interceptorFn(value, scope, locals);\n // we only return the interceptor's result if the\n // initial value is defined (for bind-once)\n return isDefined(value) ? result : value;\n };\n\n // Propagate $$watchDelegates other then inputsWatchDelegate\n if (parsedExpression.$$watchDelegate &&\n parsedExpression.$$watchDelegate !== inputsWatchDelegate) {\n fn.$$watchDelegate = parsedExpression.$$watchDelegate;\n } else if (!interceptorFn.$stateful) {\n // If there is an interceptor, but no watchDelegate then treat the interceptor like\n // we treat filters - it is assumed to be a pure function unless flagged with $stateful\n fn.$$watchDelegate = inputsWatchDelegate;\n useInputs = !parsedExpression.inputs;\n fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];\n }\n\n return fn;\n }\n }];\n}\n\n/**\n * @ngdoc service\n * @name $q\n * @requires $rootScope\n *\n * @description\n * A service that helps you run functions asynchronously, and use their return values (or exceptions)\n * when they are done processing.\n *\n * This is an implementation of promises/deferred objects inspired by\n * [Kris Kowal's Q](https://github.com/kriskowal/q).\n *\n * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred\n * implementations, and the other which resembles ES6 (ES2015) promises to some degree.\n *\n * # $q constructor\n *\n * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`\n * function as the first argument. This is similar to the native Promise implementation from ES6,\n * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n *\n * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are\n * available yet.\n *\n * It can be used like so:\n *\n * ```js\n * // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n * // are available in the current lexical scope (they could have been injected or passed in).\n *\n * function asyncGreet(name) {\n * // perform some asynchronous operation, resolve or reject the promise when appropriate.\n * return $q(function(resolve, reject) {\n * setTimeout(function() {\n * if (okToGreet(name)) {\n * resolve('Hello, ' + name + '!');\n * } else {\n * reject('Greeting ' + name + ' is not allowed.');\n * }\n * }, 1000);\n * });\n * }\n *\n * var promise = asyncGreet('Robin Hood');\n * promise.then(function(greeting) {\n * alert('Success: ' + greeting);\n * }, function(reason) {\n * alert('Failed: ' + reason);\n * });\n * ```\n *\n * Note: progress/notify callbacks are not currently supported via the ES6-style interface.\n *\n * Note: unlike ES6 behaviour, an exception thrown in the constructor function will NOT implicitly reject the promise.\n *\n * However, the more traditional CommonJS-style usage is still available, and documented below.\n *\n * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an\n * interface for interacting with an object that represents the result of an action that is\n * performed asynchronously, and may or may not be finished at any given point in time.\n *\n * From the perspective of dealing with error handling, deferred and promise APIs are to\n * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.\n *\n * ```js\n * // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n * // are available in the current lexical scope (they could have been injected or passed in).\n *\n * function asyncGreet(name) {\n * var deferred = $q.defer();\n *\n * setTimeout(function() {\n * deferred.notify('About to greet ' + name + '.');\n *\n * if (okToGreet(name)) {\n * deferred.resolve('Hello, ' + name + '!');\n * } else {\n * deferred.reject('Greeting ' + name + ' is not allowed.');\n * }\n * }, 1000);\n *\n * return deferred.promise;\n * }\n *\n * var promise = asyncGreet('Robin Hood');\n * promise.then(function(greeting) {\n * alert('Success: ' + greeting);\n * }, function(reason) {\n * alert('Failed: ' + reason);\n * }, function(update) {\n * alert('Got notification: ' + update);\n * });\n * ```\n *\n * At first it might not be obvious why this extra complexity is worth the trouble. The payoff\n * comes in the way of guarantees that promise and deferred APIs make, see\n * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.\n *\n * Additionally the promise api allows for composition that is very hard to do with the\n * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.\n * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the\n * section on serial or parallel joining of promises.\n *\n * # The Deferred API\n *\n * A new instance of deferred is constructed by calling `$q.defer()`.\n *\n * The purpose of the deferred object is to expose the associated Promise instance as well as APIs\n * that can be used for signaling the successful or unsuccessful completion, as well as the status\n * of the task.\n *\n * **Methods**\n *\n * - `resolve(value)` resolves the derived promise with the `value`. If the value is a rejection\n * constructed via `$q.reject`, the promise will be rejected instead.\n * - `reject(reason)` rejects the derived promise with the `reason`. This is equivalent to\n * resolving it with a rejection constructed via `$q.reject`.\n * - `notify(value)` - provides updates on the status of the promise's execution. This may be called\n * multiple times before the promise is either resolved or rejected.\n *\n * **Properties**\n *\n * - promise `{Promise}` promise object associated with this deferred.\n *\n *\n * # The Promise API\n *\n * A new promise instance is created when a deferred instance is created and can be retrieved by\n * calling `deferred.promise`.\n *\n * The purpose of the promise object is to allow for interested parties to get access to the result\n * of the deferred task when it completes.\n *\n * **Methods**\n *\n * - `then(successCallback, errorCallback, notifyCallback)` regardless of when the promise was or\n * will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously\n * as soon as the result is available. The callbacks are called with a single argument: the result\n * or rejection reason. Additionally, the notify callback may be called zero or more times to\n * provide a progress indication, before the promise is resolved or rejected.\n *\n * This method *returns a new promise* which is resolved or rejected via the return value of the\n * `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved\n * with the value which is resolved in that promise using\n * [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).\n * It also notifies via the return value of the `notifyCallback` method. The promise cannot be\n * resolved or rejected from the notifyCallback method.\n *\n * - `catch(errorCallback)` shorthand for `promise.then(null, errorCallback)`\n *\n * - `finally(callback, notifyCallback)` allows you to observe either the fulfillment or rejection of a promise,\n * but to do so without modifying the final value. This is useful to release resources or do some\n * clean-up that needs to be done whether the promise was rejected or resolved. See the [full\n * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for\n * more information.\n *\n * # Chaining promises\n *\n * Because calling the `then` method of a promise returns a new derived promise, it is easily\n * possible to create a chain of promises:\n *\n * ```js\n * promiseB = promiseA.then(function(result) {\n * return result + 1;\n * });\n *\n * // promiseB will be resolved immediately after promiseA is resolved and its value\n * // will be the result of promiseA incremented by 1\n * ```\n *\n * It is possible to create chains of any length and since a promise can be resolved with another\n * promise (which will defer its resolution further), it is possible to pause/defer resolution of\n * the promises at any point in the chain. This makes it possible to implement powerful APIs like\n * $http's response interceptors.\n *\n *\n * # Differences between Kris Kowal's Q and $q\n *\n * There are two main differences:\n *\n * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation\n * mechanism in angular, which means faster propagation of resolution or rejection into your\n * models and avoiding unnecessary browser repaints, which would result in flickering UI.\n * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains\n * all the important functionality needed for common async tasks.\n *\n * # Testing\n *\n * ```js\n * it('should simulate promise', inject(function($q, $rootScope) {\n * var deferred = $q.defer();\n * var promise = deferred.promise;\n * var resolvedValue;\n *\n * promise.then(function(value) { resolvedValue = value; });\n * expect(resolvedValue).toBeUndefined();\n *\n * // Simulate resolving of promise\n * deferred.resolve(123);\n * // Note that the 'then' function does not get called synchronously.\n * // This is because we want the promise API to always be async, whether or not\n * // it got called synchronously or asynchronously.\n * expect(resolvedValue).toBeUndefined();\n *\n * // Propagate promise resolution to 'then' functions using $apply().\n * $rootScope.$apply();\n * expect(resolvedValue).toEqual(123);\n * }));\n * ```\n *\n * @param {function(function, function)} resolver Function which is responsible for resolving or\n * rejecting the newly created promise. The first parameter is a function which resolves the\n * promise, the second parameter is a function which rejects the promise.\n *\n * @returns {Promise} The newly created promise.\n */\nfunction $QProvider() {\n\n this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {\n return qFactory(function(callback) {\n $rootScope.$evalAsync(callback);\n }, $exceptionHandler);\n }];\n}\n\nfunction $$QProvider() {\n this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {\n return qFactory(function(callback) {\n $browser.defer(callback);\n }, $exceptionHandler);\n }];\n}\n\n/**\n * Constructs a promise manager.\n *\n * @param {function(function)} nextTick Function for executing functions in the next turn.\n * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for\n * debugging purposes.\n * @returns {object} Promise manager.\n */\nfunction qFactory(nextTick, exceptionHandler) {\n var $qMinErr = minErr('$q', TypeError);\n function callOnce(self, resolveFn, rejectFn) {\n var called = false;\n function wrap(fn) {\n return function(value) {\n if (called) return;\n called = true;\n fn.call(self, value);\n };\n }\n\n return [wrap(resolveFn), wrap(rejectFn)];\n }\n\n /**\n * @ngdoc method\n * @name ng.$q#defer\n * @kind function\n *\n * @description\n * Creates a `Deferred` object which represents a task which will finish in the future.\n *\n * @returns {Deferred} Returns a new instance of deferred.\n */\n var defer = function() {\n return new Deferred();\n };\n\n function Promise() {\n this.$$state = { status: 0 };\n }\n\n extend(Promise.prototype, {\n then: function(onFulfilled, onRejected, progressBack) {\n if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {\n return this;\n }\n var result = new Deferred();\n\n this.$$state.pending = this.$$state.pending || [];\n this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);\n if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);\n\n return result.promise;\n },\n\n \"catch\": function(callback) {\n return this.then(null, callback);\n },\n\n \"finally\": function(callback, progressBack) {\n return this.then(function(value) {\n return handleCallback(value, true, callback);\n }, function(error) {\n return handleCallback(error, false, callback);\n }, progressBack);\n }\n });\n\n //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native\n function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }\n\n function processQueue(state) {\n var fn, deferred, pending;\n\n pending = state.pending;\n state.processScheduled = false;\n state.pending = undefined;\n for (var i = 0, ii = pending.length; i < ii; ++i) {\n deferred = pending[i][0];\n fn = pending[i][state.status];\n try {\n if (isFunction(fn)) {\n deferred.resolve(fn(state.value));\n } else if (state.status === 1) {\n deferred.resolve(state.value);\n } else {\n deferred.reject(state.value);\n }\n } catch (e) {\n deferred.reject(e);\n exceptionHandler(e);\n }\n }\n }\n\n function scheduleProcessQueue(state) {\n if (state.processScheduled || !state.pending) return;\n state.processScheduled = true;\n nextTick(function() { processQueue(state); });\n }\n\n function Deferred() {\n this.promise = new Promise();\n //Necessary to support unbound execution :/\n this.resolve = simpleBind(this, this.resolve);\n this.reject = simpleBind(this, this.reject);\n this.notify = simpleBind(this, this.notify);\n }\n\n extend(Deferred.prototype, {\n resolve: function(val) {\n if (this.promise.$$state.status) return;\n if (val === this.promise) {\n this.$$reject($qMinErr(\n 'qcycle',\n \"Expected promise to be resolved with value other than itself '{0}'\",\n val));\n } else {\n this.$$resolve(val);\n }\n\n },\n\n $$resolve: function(val) {\n var then, fns;\n\n fns = callOnce(this, this.$$resolve, this.$$reject);\n try {\n if ((isObject(val) || isFunction(val))) then = val && val.then;\n if (isFunction(then)) {\n this.promise.$$state.status = -1;\n then.call(val, fns[0], fns[1], this.notify);\n } else {\n this.promise.$$state.value = val;\n this.promise.$$state.status = 1;\n scheduleProcessQueue(this.promise.$$state);\n }\n } catch (e) {\n fns[1](e);\n exceptionHandler(e);\n }\n },\n\n reject: function(reason) {\n if (this.promise.$$state.status) return;\n this.$$reject(reason);\n },\n\n $$reject: function(reason) {\n this.promise.$$state.value = reason;\n this.promise.$$state.status = 2;\n scheduleProcessQueue(this.promise.$$state);\n },\n\n notify: function(progress) {\n var callbacks = this.promise.$$state.pending;\n\n if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {\n nextTick(function() {\n var callback, result;\n for (var i = 0, ii = callbacks.length; i < ii; i++) {\n result = callbacks[i][0];\n callback = callbacks[i][3];\n try {\n result.notify(isFunction(callback) ? callback(progress) : progress);\n } catch (e) {\n exceptionHandler(e);\n }\n }\n });\n }\n }\n });\n\n /**\n * @ngdoc method\n * @name $q#reject\n * @kind function\n *\n * @description\n * Creates a promise that is resolved as rejected with the specified `reason`. This api should be\n * used to forward rejection in a chain of promises. If you are dealing with the last promise in\n * a promise chain, you don't need to worry about it.\n *\n * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of\n * `reject` as the `throw` keyword in JavaScript. This also means that if you \"catch\" an error via\n * a promise error callback and you want to forward the error to the promise derived from the\n * current promise, you have to \"rethrow\" the error by returning a rejection constructed via\n * `reject`.\n *\n * ```js\n * promiseB = promiseA.then(function(result) {\n * // success: do something and resolve promiseB\n * // with the old or a new result\n * return result;\n * }, function(reason) {\n * // error: handle the error if possible and\n * // resolve promiseB with newPromiseOrValue,\n * // otherwise forward the rejection to promiseB\n * if (canHandle(reason)) {\n * // handle the error and recover\n * return newPromiseOrValue;\n * }\n * return $q.reject(reason);\n * });\n * ```\n *\n * @param {*} reason Constant, message, exception or an object representing the rejection reason.\n * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.\n */\n var reject = function(reason) {\n var result = new Deferred();\n result.reject(reason);\n return result.promise;\n };\n\n var makePromise = function makePromise(value, resolved) {\n var result = new Deferred();\n if (resolved) {\n result.resolve(value);\n } else {\n result.reject(value);\n }\n return result.promise;\n };\n\n var handleCallback = function handleCallback(value, isResolved, callback) {\n var callbackOutput = null;\n try {\n if (isFunction(callback)) callbackOutput = callback();\n } catch (e) {\n return makePromise(e, false);\n }\n if (isPromiseLike(callbackOutput)) {\n return callbackOutput.then(function() {\n return makePromise(value, isResolved);\n }, function(error) {\n return makePromise(error, false);\n });\n } else {\n return makePromise(value, isResolved);\n }\n };\n\n /**\n * @ngdoc method\n * @name $q#when\n * @kind function\n *\n * @description\n * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.\n * This is useful when you are dealing with an object that might or might not be a promise, or if\n * the promise comes from a source that can't be trusted.\n *\n * @param {*} value Value or a promise\n * @param {Function=} successCallback\n * @param {Function=} errorCallback\n * @param {Function=} progressCallback\n * @returns {Promise} Returns a promise of the passed value or promise\n */\n\n\n var when = function(value, callback, errback, progressBack) {\n var result = new Deferred();\n result.resolve(value);\n return result.promise.then(callback, errback, progressBack);\n };\n\n /**\n * @ngdoc method\n * @name $q#resolve\n * @kind function\n *\n * @description\n * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.\n *\n * @param {*} value Value or a promise\n * @param {Function=} successCallback\n * @param {Function=} errorCallback\n * @param {Function=} progressCallback\n * @returns {Promise} Returns a promise of the passed value or promise\n */\n var resolve = when;\n\n /**\n * @ngdoc method\n * @name $q#all\n * @kind function\n *\n * @description\n * Combines multiple promises into a single promise that is resolved when all of the input\n * promises are resolved.\n *\n * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.\n * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,\n * each value corresponding to the promise at the same index/key in the `promises` array/hash.\n * If any of the promises is resolved with a rejection, this resulting promise will be rejected\n * with the same rejection value.\n */\n\n function all(promises) {\n var deferred = new Deferred(),\n counter = 0,\n results = isArray(promises) ? [] : {};\n\n forEach(promises, function(promise, key) {\n counter++;\n when(promise).then(function(value) {\n if (results.hasOwnProperty(key)) return;\n results[key] = value;\n if (!(--counter)) deferred.resolve(results);\n }, function(reason) {\n if (results.hasOwnProperty(key)) return;\n deferred.reject(reason);\n });\n });\n\n if (counter === 0) {\n deferred.resolve(results);\n }\n\n return deferred.promise;\n }\n\n var $Q = function Q(resolver) {\n if (!isFunction(resolver)) {\n throw $qMinErr('norslvr', \"Expected resolverFn, got '{0}'\", resolver);\n }\n\n if (!(this instanceof Q)) {\n // More useful when $Q is the Promise itself.\n return new Q(resolver);\n }\n\n var deferred = new Deferred();\n\n function resolveFn(value) {\n deferred.resolve(value);\n }\n\n function rejectFn(reason) {\n deferred.reject(reason);\n }\n\n resolver(resolveFn, rejectFn);\n\n return deferred.promise;\n };\n\n $Q.defer = defer;\n $Q.reject = reject;\n $Q.when = when;\n $Q.resolve = resolve;\n $Q.all = all;\n\n return $Q;\n}\n\nfunction $$RAFProvider() { //rAF\n this.$get = ['$window', '$timeout', function($window, $timeout) {\n var requestAnimationFrame = $window.requestAnimationFrame ||\n $window.webkitRequestAnimationFrame;\n\n var cancelAnimationFrame = $window.cancelAnimationFrame ||\n $window.webkitCancelAnimationFrame ||\n $window.webkitCancelRequestAnimationFrame;\n\n var rafSupported = !!requestAnimationFrame;\n var raf = rafSupported\n ? function(fn) {\n var id = requestAnimationFrame(fn);\n return function() {\n cancelAnimationFrame(id);\n };\n }\n : function(fn) {\n var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n return function() {\n $timeout.cancel(timer);\n };\n };\n\n raf.supported = rafSupported;\n\n return raf;\n }];\n}\n\n/**\n * DESIGN NOTES\n *\n * The design decisions behind the scope are heavily favored for speed and memory consumption.\n *\n * The typical use of scope is to watch the expressions, which most of the time return the same\n * value as last time so we optimize the operation.\n *\n * Closures construction is expensive in terms of speed as well as memory:\n * - No closures, instead use prototypical inheritance for API\n * - Internal state needs to be stored on scope directly, which means that private state is\n * exposed as $$____ properties\n *\n * Loop operations are optimized by using while(count--) { ... }\n * - This means that in order to keep the same order of execution as addition we have to add\n * items to the array at the beginning (unshift) instead of at the end (push)\n *\n * Child scopes are created and removed often\n * - Using an array would be slow since inserts in the middle are expensive; so we use linked lists\n *\n * There are fewer watches than observers. This is why you don't want the observer to be implemented\n * in the same way as watch. Watch requires return of the initialization function which is expensive\n * to construct.\n */\n\n\n/**\n * @ngdoc provider\n * @name $rootScopeProvider\n * @description\n *\n * Provider for the $rootScope service.\n */\n\n/**\n * @ngdoc method\n * @name $rootScopeProvider#digestTtl\n * @description\n *\n * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and\n * assuming that the model is unstable.\n *\n * The current default is 10 iterations.\n *\n * In complex applications it's possible that the dependencies between `$watch`s will result in\n * several digest iterations. However if an application needs more than the default 10 digest\n * iterations for its model to stabilize then you should investigate what is causing the model to\n * continuously change during the digest.\n *\n * Increasing the TTL could have performance implications, so you should not change it without\n * proper justification.\n *\n * @param {number} limit The number of digest iterations.\n */\n\n\n/**\n * @ngdoc service\n * @name $rootScope\n * @description\n *\n * Every application has a single root {@link ng.$rootScope.Scope scope}.\n * All other scopes are descendant scopes of the root scope. Scopes provide separation\n * between the model and the view, via a mechanism for watching the model for changes.\n * They also provide event emission/broadcast and subscription facility. See the\n * {@link guide/scope developer guide on scopes}.\n */\nfunction $RootScopeProvider() {\n var TTL = 10;\n var $rootScopeMinErr = minErr('$rootScope');\n var lastDirtyWatch = null;\n var applyAsyncId = null;\n\n this.digestTtl = function(value) {\n if (arguments.length) {\n TTL = value;\n }\n return TTL;\n };\n\n function createChildScopeClass(parent) {\n function ChildScope() {\n this.$$watchers = this.$$nextSibling =\n this.$$childHead = this.$$childTail = null;\n this.$$listeners = {};\n this.$$listenerCount = {};\n this.$$watchersCount = 0;\n this.$id = nextUid();\n this.$$ChildScope = null;\n }\n ChildScope.prototype = parent;\n return ChildScope;\n }\n\n this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',\n function($injector, $exceptionHandler, $parse, $browser) {\n\n function destroyChildScope($event) {\n $event.currentScope.$$destroyed = true;\n }\n\n function cleanUpScope($scope) {\n\n if (msie === 9) {\n // There is a memory leak in IE9 if all child scopes are not disconnected\n // completely when a scope is destroyed. So this code will recurse up through\n // all this scopes children\n //\n // See issue https://github.com/angular/angular.js/issues/10706\n $scope.$$childHead && cleanUpScope($scope.$$childHead);\n $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);\n }\n\n // The code below works around IE9 and V8's memory leaks\n //\n // See:\n // - https://code.google.com/p/v8/issues/detail?id=2073#c26\n // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909\n // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451\n\n $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =\n $scope.$$childTail = $scope.$root = $scope.$$watchers = null;\n }\n\n /**\n * @ngdoc type\n * @name $rootScope.Scope\n *\n * @description\n * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the\n * {@link auto.$injector $injector}. Child scopes are created using the\n * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when\n * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for\n * an in-depth introduction and usage examples.\n *\n *\n * # Inheritance\n * A scope can inherit from a parent scope, as in this example:\n * ```js\n var parent = $rootScope;\n var child = parent.$new();\n\n parent.salutation = \"Hello\";\n expect(child.salutation).toEqual('Hello');\n\n child.salutation = \"Welcome\";\n expect(child.salutation).toEqual('Welcome');\n expect(parent.salutation).toEqual('Hello');\n * ```\n *\n * When interacting with `Scope` in tests, additional helper methods are available on the\n * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional\n * details.\n *\n *\n * @param {Object.<string, function()>=} providers Map of service factory which need to be\n * provided for the current scope. Defaults to {@link ng}.\n * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should\n * append/override services provided by `providers`. This is handy\n * when unit-testing and having the need to override a default\n * service.\n * @returns {Object} Newly created scope.\n *\n */\n function Scope() {\n this.$id = nextUid();\n this.$$phase = this.$parent = this.$$watchers =\n this.$$nextSibling = this.$$prevSibling =\n this.$$childHead = this.$$childTail = null;\n this.$root = this;\n this.$$destroyed = false;\n this.$$listeners = {};\n this.$$listenerCount = {};\n this.$$watchersCount = 0;\n this.$$isolateBindings = null;\n }\n\n /**\n * @ngdoc property\n * @name $rootScope.Scope#$id\n *\n * @description\n * Unique scope ID (monotonically increasing) useful for debugging.\n */\n\n /**\n * @ngdoc property\n * @name $rootScope.Scope#$parent\n *\n * @description\n * Reference to the parent scope.\n */\n\n /**\n * @ngdoc property\n * @name $rootScope.Scope#$root\n *\n * @description\n * Reference to the root scope.\n */\n\n Scope.prototype = {\n constructor: Scope,\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$new\n * @kind function\n *\n * @description\n * Creates a new child {@link ng.$rootScope.Scope scope}.\n *\n * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.\n * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.\n *\n * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is\n * desired for the scope and its child scopes to be permanently detached from the parent and\n * thus stop participating in model change detection and listener notification by invoking.\n *\n * @param {boolean} isolate If true, then the scope does not prototypically inherit from the\n * parent scope. The scope is isolated, as it can not see parent scope properties.\n * When creating widgets, it is useful for the widget to not accidentally read parent\n * state.\n *\n * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`\n * of the newly created scope. Defaults to `this` scope if not provided.\n * This is used when creating a transclude scope to correctly place it\n * in the scope hierarchy while maintaining the correct prototypical\n * inheritance.\n *\n * @returns {Object} The newly created child scope.\n *\n */\n $new: function(isolate, parent) {\n var child;\n\n parent = parent || this;\n\n if (isolate) {\n child = new Scope();\n child.$root = this.$root;\n } else {\n // Only create a child scope class if somebody asks for one,\n // but cache it to allow the VM to optimize lookups.\n if (!this.$$ChildScope) {\n this.$$ChildScope = createChildScopeClass(this);\n }\n child = new this.$$ChildScope();\n }\n child.$parent = parent;\n child.$$prevSibling = parent.$$childTail;\n if (parent.$$childHead) {\n parent.$$childTail.$$nextSibling = child;\n parent.$$childTail = child;\n } else {\n parent.$$childHead = parent.$$childTail = child;\n }\n\n // When the new scope is not isolated or we inherit from `this`, and\n // the parent scope is destroyed, the property `$$destroyed` is inherited\n // prototypically. In all other cases, this property needs to be set\n // when the parent scope is destroyed.\n // The listener needs to be added after the parent is set\n if (isolate || parent != this) child.$on('$destroy', destroyChildScope);\n\n return child;\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$watch\n * @kind function\n *\n * @description\n * Registers a `listener` callback to be executed whenever the `watchExpression` changes.\n *\n * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest\n * $digest()} and should return the value that will be watched. (`watchExpression` should not change\n * its value when executed multiple times with the same input because it may be executed multiple\n * times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be\n * [idempotent](http://en.wikipedia.org/wiki/Idempotence).\n * - The `listener` is called only when the value from the current `watchExpression` and the\n * previous call to `watchExpression` are not equal (with the exception of the initial run,\n * see below). Inequality is determined according to reference inequality,\n * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)\n * via the `!==` Javascript operator, unless `objectEquality == true`\n * (see next point)\n * - When `objectEquality == true`, inequality of the `watchExpression` is determined\n * according to the {@link angular.equals} function. To save the value of the object for\n * later comparison, the {@link angular.copy} function is used. This therefore means that\n * watching complex objects will have adverse memory and performance implications.\n * - The watch `listener` may change the model, which may trigger other `listener`s to fire.\n * This is achieved by rerunning the watchers until no changes are detected. The rerun\n * iteration limit is 10 to prevent an infinite loop deadlock.\n *\n *\n * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,\n * you can register a `watchExpression` function with no `listener`. (Be prepared for\n * multiple calls to your `watchExpression` because it will execute multiple times in a\n * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)\n *\n * After a watcher is registered with the scope, the `listener` fn is called asynchronously\n * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the\n * watcher. In rare cases, this is undesirable because the listener is called when the result\n * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you\n * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the\n * listener was called due to initialization.\n *\n *\n *\n * # Example\n * ```js\n // let's assume that scope was dependency injected as the $rootScope\n var scope = $rootScope;\n scope.name = 'misko';\n scope.counter = 0;\n\n expect(scope.counter).toEqual(0);\n scope.$watch('name', function(newValue, oldValue) {\n scope.counter = scope.counter + 1;\n });\n expect(scope.counter).toEqual(0);\n\n scope.$digest();\n // the listener is always called during the first $digest loop after it was registered\n expect(scope.counter).toEqual(1);\n\n scope.$digest();\n // but now it will not be called unless the value changes\n expect(scope.counter).toEqual(1);\n\n scope.name = 'adam';\n scope.$digest();\n expect(scope.counter).toEqual(2);\n\n\n\n // Using a function as a watchExpression\n var food;\n scope.foodCounter = 0;\n expect(scope.foodCounter).toEqual(0);\n scope.$watch(\n // This function returns the value being watched. It is called for each turn of the $digest loop\n function() { return food; },\n // This is the change listener, called when the value returned from the above function changes\n function(newValue, oldValue) {\n if ( newValue !== oldValue ) {\n // Only increment the counter if the value changed\n scope.foodCounter = scope.foodCounter + 1;\n }\n }\n );\n // No digest has been run so the counter will be zero\n expect(scope.foodCounter).toEqual(0);\n\n // Run the digest but since food has not changed count will still be zero\n scope.$digest();\n expect(scope.foodCounter).toEqual(0);\n\n // Update food and run digest. Now the counter will increment\n food = 'cheeseburger';\n scope.$digest();\n expect(scope.foodCounter).toEqual(1);\n\n * ```\n *\n *\n *\n * @param {(function()|string)} watchExpression Expression that is evaluated on each\n * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers\n * a call to the `listener`.\n *\n * - `string`: Evaluated as {@link guide/expression expression}\n * - `function(scope)`: called with current `scope` as a parameter.\n * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value\n * of `watchExpression` changes.\n *\n * - `newVal` contains the current value of the `watchExpression`\n * - `oldVal` contains the previous value of the `watchExpression`\n * - `scope` refers to the current scope\n * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of\n * comparing for reference equality.\n * @returns {function()} Returns a deregistration function for this listener.\n */\n $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {\n var get = $parse(watchExp);\n\n if (get.$$watchDelegate) {\n return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);\n }\n var scope = this,\n array = scope.$$watchers,\n watcher = {\n fn: listener,\n last: initWatchVal,\n get: get,\n exp: prettyPrintExpression || watchExp,\n eq: !!objectEquality\n };\n\n lastDirtyWatch = null;\n\n if (!isFunction(listener)) {\n watcher.fn = noop;\n }\n\n if (!array) {\n array = scope.$$watchers = [];\n }\n // we use unshift since we use a while loop in $digest for speed.\n // the while loop reads in reverse order.\n array.unshift(watcher);\n incrementWatchersCount(this, 1);\n\n return function deregisterWatch() {\n if (arrayRemove(array, watcher) >= 0) {\n incrementWatchersCount(scope, -1);\n }\n lastDirtyWatch = null;\n };\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$watchGroup\n * @kind function\n *\n * @description\n * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.\n * If any one expression in the collection changes the `listener` is executed.\n *\n * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every\n * call to $digest() to see if any items changes.\n * - The `listener` is called whenever any expression in the `watchExpressions` array changes.\n *\n * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually\n * watched using {@link ng.$rootScope.Scope#$watch $watch()}\n *\n * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any\n * expression in `watchExpressions` changes\n * The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching\n * those of `watchExpression`\n * and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching\n * those of `watchExpression`\n * The `scope` refers to the current scope.\n * @returns {function()} Returns a de-registration function for all listeners.\n */\n $watchGroup: function(watchExpressions, listener) {\n var oldValues = new Array(watchExpressions.length);\n var newValues = new Array(watchExpressions.length);\n var deregisterFns = [];\n var self = this;\n var changeReactionScheduled = false;\n var firstRun = true;\n\n if (!watchExpressions.length) {\n // No expressions means we call the listener ASAP\n var shouldCall = true;\n self.$evalAsync(function() {\n if (shouldCall) listener(newValues, newValues, self);\n });\n return function deregisterWatchGroup() {\n shouldCall = false;\n };\n }\n\n if (watchExpressions.length === 1) {\n // Special case size of one\n return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {\n newValues[0] = value;\n oldValues[0] = oldValue;\n listener(newValues, (value === oldValue) ? newValues : oldValues, scope);\n });\n }\n\n forEach(watchExpressions, function(expr, i) {\n var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {\n newValues[i] = value;\n oldValues[i] = oldValue;\n if (!changeReactionScheduled) {\n changeReactionScheduled = true;\n self.$evalAsync(watchGroupAction);\n }\n });\n deregisterFns.push(unwatchFn);\n });\n\n function watchGroupAction() {\n changeReactionScheduled = false;\n\n if (firstRun) {\n firstRun = false;\n listener(newValues, newValues, self);\n } else {\n listener(newValues, oldValues, self);\n }\n }\n\n return function deregisterWatchGroup() {\n while (deregisterFns.length) {\n deregisterFns.shift()();\n }\n };\n },\n\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$watchCollection\n * @kind function\n *\n * @description\n * Shallow watches the properties of an object and fires whenever any of the properties change\n * (for arrays, this implies watching the array items; for object maps, this implies watching\n * the properties). If a change is detected, the `listener` callback is fired.\n *\n * - The `obj` collection is observed via standard $watch operation and is examined on every\n * call to $digest() to see if any items have been added, removed, or moved.\n * - The `listener` is called whenever anything within the `obj` has changed. Examples include\n * adding, removing, and moving items belonging to an object or array.\n *\n *\n * # Example\n * ```js\n $scope.names = ['igor', 'matias', 'misko', 'james'];\n $scope.dataCount = 4;\n\n $scope.$watchCollection('names', function(newNames, oldNames) {\n $scope.dataCount = newNames.length;\n });\n\n expect($scope.dataCount).toEqual(4);\n $scope.$digest();\n\n //still at 4 ... no changes\n expect($scope.dataCount).toEqual(4);\n\n $scope.names.pop();\n $scope.$digest();\n\n //now there's been a change\n expect($scope.dataCount).toEqual(3);\n * ```\n *\n *\n * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The\n * expression value should evaluate to an object or an array which is observed on each\n * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the\n * collection will trigger a call to the `listener`.\n *\n * @param {function(newCollection, oldCollection, scope)} listener a callback function called\n * when a change is detected.\n * - The `newCollection` object is the newly modified data obtained from the `obj` expression\n * - The `oldCollection` object is a copy of the former collection data.\n * Due to performance considerations, the`oldCollection` value is computed only if the\n * `listener` function declares two or more arguments.\n * - The `scope` argument refers to the current scope.\n *\n * @returns {function()} Returns a de-registration function for this listener. When the\n * de-registration function is executed, the internal watch operation is terminated.\n */\n $watchCollection: function(obj, listener) {\n $watchCollectionInterceptor.$stateful = true;\n\n var self = this;\n // the current value, updated on each dirty-check run\n var newValue;\n // a shallow copy of the newValue from the last dirty-check run,\n // updated to match newValue during dirty-check run\n var oldValue;\n // a shallow copy of the newValue from when the last change happened\n var veryOldValue;\n // only track veryOldValue if the listener is asking for it\n var trackVeryOldValue = (listener.length > 1);\n var changeDetected = 0;\n var changeDetector = $parse(obj, $watchCollectionInterceptor);\n var internalArray = [];\n var internalObject = {};\n var initRun = true;\n var oldLength = 0;\n\n function $watchCollectionInterceptor(_value) {\n newValue = _value;\n var newLength, key, bothNaN, newItem, oldItem;\n\n // If the new value is undefined, then return undefined as the watch may be a one-time watch\n if (isUndefined(newValue)) return;\n\n if (!isObject(newValue)) { // if primitive\n if (oldValue !== newValue) {\n oldValue = newValue;\n changeDetected++;\n }\n } else if (isArrayLike(newValue)) {\n if (oldValue !== internalArray) {\n // we are transitioning from something which was not an array into array.\n oldValue = internalArray;\n oldLength = oldValue.length = 0;\n changeDetected++;\n }\n\n newLength = newValue.length;\n\n if (oldLength !== newLength) {\n // if lengths do not match we need to trigger change notification\n changeDetected++;\n oldValue.length = oldLength = newLength;\n }\n // copy the items to oldValue and look for changes.\n for (var i = 0; i < newLength; i++) {\n oldItem = oldValue[i];\n newItem = newValue[i];\n\n bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n if (!bothNaN && (oldItem !== newItem)) {\n changeDetected++;\n oldValue[i] = newItem;\n }\n }\n } else {\n if (oldValue !== internalObject) {\n // we are transitioning from something which was not an object into object.\n oldValue = internalObject = {};\n oldLength = 0;\n changeDetected++;\n }\n // copy the items to oldValue and look for changes.\n newLength = 0;\n for (key in newValue) {\n if (hasOwnProperty.call(newValue, key)) {\n newLength++;\n newItem = newValue[key];\n oldItem = oldValue[key];\n\n if (key in oldValue) {\n bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n if (!bothNaN && (oldItem !== newItem)) {\n changeDetected++;\n oldValue[key] = newItem;\n }\n } else {\n oldLength++;\n oldValue[key] = newItem;\n changeDetected++;\n }\n }\n }\n if (oldLength > newLength) {\n // we used to have more keys, need to find them and destroy them.\n changeDetected++;\n for (key in oldValue) {\n if (!hasOwnProperty.call(newValue, key)) {\n oldLength--;\n delete oldValue[key];\n }\n }\n }\n }\n return changeDetected;\n }\n\n function $watchCollectionAction() {\n if (initRun) {\n initRun = false;\n listener(newValue, newValue, self);\n } else {\n listener(newValue, veryOldValue, self);\n }\n\n // make a copy for the next time a collection is changed\n if (trackVeryOldValue) {\n if (!isObject(newValue)) {\n //primitive\n veryOldValue = newValue;\n } else if (isArrayLike(newValue)) {\n veryOldValue = new Array(newValue.length);\n for (var i = 0; i < newValue.length; i++) {\n veryOldValue[i] = newValue[i];\n }\n } else { // if object\n veryOldValue = {};\n for (var key in newValue) {\n if (hasOwnProperty.call(newValue, key)) {\n veryOldValue[key] = newValue[key];\n }\n }\n }\n }\n }\n\n return this.$watch(changeDetector, $watchCollectionAction);\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$digest\n * @kind function\n *\n * @description\n * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and\n * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change\n * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}\n * until no more listeners are firing. This means that it is possible to get into an infinite\n * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of\n * iterations exceeds 10.\n *\n * Usually, you don't call `$digest()` directly in\n * {@link ng.directive:ngController controllers} or in\n * {@link ng.$compileProvider#directive directives}.\n * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within\n * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.\n *\n * If you want to be notified whenever `$digest()` is called,\n * you can register a `watchExpression` function with\n * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.\n *\n * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.\n *\n * # Example\n * ```js\n var scope = ...;\n scope.name = 'misko';\n scope.counter = 0;\n\n expect(scope.counter).toEqual(0);\n scope.$watch('name', function(newValue, oldValue) {\n scope.counter = scope.counter + 1;\n });\n expect(scope.counter).toEqual(0);\n\n scope.$digest();\n // the listener is always called during the first $digest loop after it was registered\n expect(scope.counter).toEqual(1);\n\n scope.$digest();\n // but now it will not be called unless the value changes\n expect(scope.counter).toEqual(1);\n\n scope.name = 'adam';\n scope.$digest();\n expect(scope.counter).toEqual(2);\n * ```\n *\n */\n $digest: function() {\n var watch, value, last, fn, get,\n watchers,\n length,\n dirty, ttl = TTL,\n next, current, target = this,\n watchLog = [],\n logIdx, logMsg, asyncTask;\n\n beginPhase('$digest');\n // Check for changes to browser url that happened in sync before the call to $digest\n $browser.$$checkUrlChange();\n\n if (this === $rootScope && applyAsyncId !== null) {\n // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then\n // cancel the scheduled $apply and flush the queue of expressions to be evaluated.\n $browser.defer.cancel(applyAsyncId);\n flushApplyAsync();\n }\n\n lastDirtyWatch = null;\n\n do { // \"while dirty\" loop\n dirty = false;\n current = target;\n\n while (asyncQueue.length) {\n try {\n asyncTask = asyncQueue.shift();\n asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);\n } catch (e) {\n $exceptionHandler(e);\n }\n lastDirtyWatch = null;\n }\n\n traverseScopesLoop:\n do { // \"traverse the scopes\" loop\n if ((watchers = current.$$watchers)) {\n // process our watches\n length = watchers.length;\n while (length--) {\n try {\n watch = watchers[length];\n // Most common watches are on primitives, in which case we can short\n // circuit it with === operator, only when === fails do we use .equals\n if (watch) {\n get = watch.get;\n if ((value = get(current)) !== (last = watch.last) &&\n !(watch.eq\n ? equals(value, last)\n : (typeof value === 'number' && typeof last === 'number'\n && isNaN(value) && isNaN(last)))) {\n dirty = true;\n lastDirtyWatch = watch;\n watch.last = watch.eq ? copy(value, null) : value;\n fn = watch.fn;\n fn(value, ((last === initWatchVal) ? value : last), current);\n if (ttl < 5) {\n logIdx = 4 - ttl;\n if (!watchLog[logIdx]) watchLog[logIdx] = [];\n watchLog[logIdx].push({\n msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,\n newVal: value,\n oldVal: last\n });\n }\n } else if (watch === lastDirtyWatch) {\n // If the most recently dirty watcher is now clean, short circuit since the remaining watchers\n // have already been tested.\n dirty = false;\n break traverseScopesLoop;\n }\n }\n } catch (e) {\n $exceptionHandler(e);\n }\n }\n }\n\n // Insanity Warning: scope depth-first traversal\n // yes, this code is a bit crazy, but it works and we have tests to prove it!\n // this piece should be kept in sync with the traversal in $broadcast\n if (!(next = ((current.$$watchersCount && current.$$childHead) ||\n (current !== target && current.$$nextSibling)))) {\n while (current !== target && !(next = current.$$nextSibling)) {\n current = current.$parent;\n }\n }\n } while ((current = next));\n\n // `break traverseScopesLoop;` takes us to here\n\n if ((dirty || asyncQueue.length) && !(ttl--)) {\n clearPhase();\n throw $rootScopeMinErr('infdig',\n '{0} $digest() iterations reached. Aborting!\\n' +\n 'Watchers fired in the last 5 iterations: {1}',\n TTL, watchLog);\n }\n\n } while (dirty || asyncQueue.length);\n\n clearPhase();\n\n while (postDigestQueue.length) {\n try {\n postDigestQueue.shift()();\n } catch (e) {\n $exceptionHandler(e);\n }\n }\n },\n\n\n /**\n * @ngdoc event\n * @name $rootScope.Scope#$destroy\n * @eventType broadcast on scope being destroyed\n *\n * @description\n * Broadcasted when a scope and its children are being destroyed.\n *\n * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n * clean up DOM bindings before an element is removed from the DOM.\n */\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$destroy\n * @kind function\n *\n * @description\n * Removes the current scope (and all of its children) from the parent scope. Removal implies\n * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer\n * propagate to the current scope and its children. Removal also implies that the current\n * scope is eligible for garbage collection.\n *\n * The `$destroy()` is usually used by directives such as\n * {@link ng.directive:ngRepeat ngRepeat} for managing the\n * unrolling of the loop.\n *\n * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.\n * Application code can register a `$destroy` event handler that will give it a chance to\n * perform any necessary cleanup.\n *\n * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n * clean up DOM bindings before an element is removed from the DOM.\n */\n $destroy: function() {\n // We can't destroy a scope that has been already destroyed.\n if (this.$$destroyed) return;\n var parent = this.$parent;\n\n this.$broadcast('$destroy');\n this.$$destroyed = true;\n\n if (this === $rootScope) {\n //Remove handlers attached to window when $rootScope is removed\n $browser.$$applicationDestroyed();\n }\n\n incrementWatchersCount(this, -this.$$watchersCount);\n for (var eventName in this.$$listenerCount) {\n decrementListenerCount(this, this.$$listenerCount[eventName], eventName);\n }\n\n // sever all the references to parent scopes (after this cleanup, the current scope should\n // not be retained by any of our references and should be eligible for garbage collection)\n if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;\n if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;\n if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;\n if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;\n\n // Disable listeners, watchers and apply/digest methods\n this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;\n this.$on = this.$watch = this.$watchGroup = function() { return noop; };\n this.$$listeners = {};\n\n // Disconnect the next sibling to prevent `cleanUpScope` destroying those too\n this.$$nextSibling = null;\n cleanUpScope(this);\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$eval\n * @kind function\n *\n * @description\n * Executes the `expression` on the current scope and returns the result. Any exceptions in\n * the expression are propagated (uncaught). This is useful when evaluating Angular\n * expressions.\n *\n * # Example\n * ```js\n var scope = ng.$rootScope.Scope();\n scope.a = 1;\n scope.b = 2;\n\n expect(scope.$eval('a+b')).toEqual(3);\n expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);\n * ```\n *\n * @param {(string|function())=} expression An angular expression to be executed.\n *\n * - `string`: execute using the rules as defined in {@link guide/expression expression}.\n * - `function(scope)`: execute the function with the current `scope` parameter.\n *\n * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n * @returns {*} The result of evaluating the expression.\n */\n $eval: function(expr, locals) {\n return $parse(expr)(this, locals);\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$evalAsync\n * @kind function\n *\n * @description\n * Executes the expression on the current scope at a later point in time.\n *\n * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only\n * that:\n *\n * - it will execute after the function that scheduled the evaluation (preferably before DOM\n * rendering).\n * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after\n * `expression` execution.\n *\n * Any exceptions from the execution of the expression are forwarded to the\n * {@link ng.$exceptionHandler $exceptionHandler} service.\n *\n * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle\n * will be scheduled. However, it is encouraged to always call code that changes the model\n * from within an `$apply` call. That includes code evaluated via `$evalAsync`.\n *\n * @param {(string|function())=} expression An angular expression to be executed.\n *\n * - `string`: execute using the rules as defined in {@link guide/expression expression}.\n * - `function(scope)`: execute the function with the current `scope` parameter.\n *\n * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n */\n $evalAsync: function(expr, locals) {\n // if we are outside of an $digest loop and this is the first time we are scheduling async\n // task also schedule async auto-flush\n if (!$rootScope.$$phase && !asyncQueue.length) {\n $browser.defer(function() {\n if (asyncQueue.length) {\n $rootScope.$digest();\n }\n });\n }\n\n asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});\n },\n\n $$postDigest: function(fn) {\n postDigestQueue.push(fn);\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$apply\n * @kind function\n *\n * @description\n * `$apply()` is used to execute an expression in angular from outside of the angular\n * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).\n * Because we are calling into the angular framework we need to perform proper scope life\n * cycle of {@link ng.$exceptionHandler exception handling},\n * {@link ng.$rootScope.Scope#$digest executing watches}.\n *\n * ## Life cycle\n *\n * # Pseudo-Code of `$apply()`\n * ```js\n function $apply(expr) {\n try {\n return $eval(expr);\n } catch (e) {\n $exceptionHandler(e);\n } finally {\n $root.$digest();\n }\n }\n * ```\n *\n *\n * Scope's `$apply()` method transitions through the following stages:\n *\n * 1. The {@link guide/expression expression} is executed using the\n * {@link ng.$rootScope.Scope#$eval $eval()} method.\n * 2. Any exceptions from the execution of the expression are forwarded to the\n * {@link ng.$exceptionHandler $exceptionHandler} service.\n * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the\n * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.\n *\n *\n * @param {(string|function())=} exp An angular expression to be executed.\n *\n * - `string`: execute using the rules as defined in {@link guide/expression expression}.\n * - `function(scope)`: execute the function with current `scope` parameter.\n *\n * @returns {*} The result of evaluating the expression.\n */\n $apply: function(expr) {\n try {\n beginPhase('$apply');\n try {\n return this.$eval(expr);\n } finally {\n clearPhase();\n }\n } catch (e) {\n $exceptionHandler(e);\n } finally {\n try {\n $rootScope.$digest();\n } catch (e) {\n $exceptionHandler(e);\n throw e;\n }\n }\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$applyAsync\n * @kind function\n *\n * @description\n * Schedule the invocation of $apply to occur at a later time. The actual time difference\n * varies across browsers, but is typically around ~10 milliseconds.\n *\n * This can be used to queue up multiple expressions which need to be evaluated in the same\n * digest.\n *\n * @param {(string|function())=} exp An angular expression to be executed.\n *\n * - `string`: execute using the rules as defined in {@link guide/expression expression}.\n * - `function(scope)`: execute the function with current `scope` parameter.\n */\n $applyAsync: function(expr) {\n var scope = this;\n expr && applyAsyncQueue.push($applyAsyncExpression);\n expr = $parse(expr);\n scheduleApplyAsync();\n\n function $applyAsyncExpression() {\n scope.$eval(expr);\n }\n },\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$on\n * @kind function\n *\n * @description\n * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for\n * discussion of event life cycle.\n *\n * The event listener function format is: `function(event, args...)`. The `event` object\n * passed into the listener has the following attributes:\n *\n * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or\n * `$broadcast`-ed.\n * - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the\n * event propagates through the scope hierarchy, this property is set to null.\n * - `name` - `{string}`: name of the event.\n * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel\n * further event propagation (available only for events that were `$emit`-ed).\n * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag\n * to true.\n * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.\n *\n * @param {string} name Event name to listen on.\n * @param {function(event, ...args)} listener Function to call when the event is emitted.\n * @returns {function()} Returns a deregistration function for this listener.\n */\n $on: function(name, listener) {\n var namedListeners = this.$$listeners[name];\n if (!namedListeners) {\n this.$$listeners[name] = namedListeners = [];\n }\n namedListeners.push(listener);\n\n var current = this;\n do {\n if (!current.$$listenerCount[name]) {\n current.$$listenerCount[name] = 0;\n }\n current.$$listenerCount[name]++;\n } while ((current = current.$parent));\n\n var self = this;\n return function() {\n var indexOfListener = namedListeners.indexOf(listener);\n if (indexOfListener !== -1) {\n namedListeners[indexOfListener] = null;\n decrementListenerCount(self, 1, name);\n }\n };\n },\n\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$emit\n * @kind function\n *\n * @description\n * Dispatches an event `name` upwards through the scope hierarchy notifying the\n * registered {@link ng.$rootScope.Scope#$on} listeners.\n *\n * The event life cycle starts at the scope on which `$emit` was called. All\n * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n * notified. Afterwards, the event traverses upwards toward the root scope and calls all\n * registered listeners along the way. The event will stop propagating if one of the listeners\n * cancels it.\n *\n * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n *\n * @param {string} name Event name to emit.\n * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).\n */\n $emit: function(name, args) {\n var empty = [],\n namedListeners,\n scope = this,\n stopPropagation = false,\n event = {\n name: name,\n targetScope: scope,\n stopPropagation: function() {stopPropagation = true;},\n preventDefault: function() {\n event.defaultPrevented = true;\n },\n defaultPrevented: false\n },\n listenerArgs = concat([event], arguments, 1),\n i, length;\n\n do {\n namedListeners = scope.$$listeners[name] || empty;\n event.currentScope = scope;\n for (i = 0, length = namedListeners.length; i < length; i++) {\n\n // if listeners were deregistered, defragment the array\n if (!namedListeners[i]) {\n namedListeners.splice(i, 1);\n i--;\n length--;\n continue;\n }\n try {\n //allow all listeners attached to the current scope to run\n namedListeners[i].apply(null, listenerArgs);\n } catch (e) {\n $exceptionHandler(e);\n }\n }\n //if any listener on the current scope stops propagation, prevent bubbling\n if (stopPropagation) {\n event.currentScope = null;\n return event;\n }\n //traverse upwards\n scope = scope.$parent;\n } while (scope);\n\n event.currentScope = null;\n\n return event;\n },\n\n\n /**\n * @ngdoc method\n * @name $rootScope.Scope#$broadcast\n * @kind function\n *\n * @description\n * Dispatches an event `name` downwards to all child scopes (and their children) notifying the\n * registered {@link ng.$rootScope.Scope#$on} listeners.\n *\n * The event life cycle starts at the scope on which `$broadcast` was called. All\n * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n * notified. Afterwards, the event propagates to all direct and indirect scopes of the current\n * scope and calls all registered listeners along the way. The event cannot be canceled.\n *\n * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n *\n * @param {string} name Event name to broadcast.\n * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}\n */\n $broadcast: function(name, args) {\n var target = this,\n current = target,\n next = target,\n event = {\n name: name,\n targetScope: target,\n preventDefault: function() {\n event.defaultPrevented = true;\n },\n defaultPrevented: false\n };\n\n if (!target.$$listenerCount[name]) return event;\n\n var listenerArgs = concat([event], arguments, 1),\n listeners, i, length;\n\n //down while you can, then up and next sibling or up and next sibling until back at root\n while ((current = next)) {\n event.currentScope = current;\n listeners = current.$$listeners[name] || [];\n for (i = 0, length = listeners.length; i < length; i++) {\n // if listeners were deregistered, defragment the array\n if (!listeners[i]) {\n listeners.splice(i, 1);\n i--;\n length--;\n continue;\n }\n\n try {\n listeners[i].apply(null, listenerArgs);\n } catch (e) {\n $exceptionHandler(e);\n }\n }\n\n // Insanity Warning: scope depth-first traversal\n // yes, this code is a bit crazy, but it works and we have tests to prove it!\n // this piece should be kept in sync with the traversal in $digest\n // (though it differs due to having the extra check for $$listenerCount)\n if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||\n (current !== target && current.$$nextSibling)))) {\n while (current !== target && !(next = current.$$nextSibling)) {\n current = current.$parent;\n }\n }\n }\n\n event.currentScope = null;\n return event;\n }\n };\n\n var $rootScope = new Scope();\n\n //The internal queues. Expose them on the $rootScope for debugging/testing purposes.\n var asyncQueue = $rootScope.$$asyncQueue = [];\n var postDigestQueue = $rootScope.$$postDigestQueue = [];\n var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];\n\n return $rootScope;\n\n\n function beginPhase(phase) {\n if ($rootScope.$$phase) {\n throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);\n }\n\n $rootScope.$$phase = phase;\n }\n\n function clearPhase() {\n $rootScope.$$phase = null;\n }\n\n function incrementWatchersCount(current, count) {\n do {\n current.$$watchersCount += count;\n } while ((current = current.$parent));\n }\n\n function decrementListenerCount(current, count, name) {\n do {\n current.$$listenerCount[name] -= count;\n\n if (current.$$listenerCount[name] === 0) {\n delete current.$$listenerCount[name];\n }\n } while ((current = current.$parent));\n }\n\n /**\n * function used as an initial value for watchers.\n * because it's unique we can easily tell it apart from other values\n */\n function initWatchVal() {}\n\n function flushApplyAsync() {\n while (applyAsyncQueue.length) {\n try {\n applyAsyncQueue.shift()();\n } catch (e) {\n $exceptionHandler(e);\n }\n }\n applyAsyncId = null;\n }\n\n function scheduleApplyAsync() {\n if (applyAsyncId === null) {\n applyAsyncId = $browser.defer(function() {\n $rootScope.$apply(flushApplyAsync);\n });\n }\n }\n }];\n}\n\n/**\n * @ngdoc service\n * @name $rootElement\n *\n * @description\n * The root element of Angular application. This is either the element where {@link\n * ng.directive:ngApp ngApp} was declared or the element passed into\n * {@link angular.bootstrap}. The element represents the root element of application. It is also the\n * location where the application's {@link auto.$injector $injector} service gets\n * published, and can be retrieved using `$rootElement.injector()`.\n */\n\n\n// the implementation is in angular.bootstrap\n\n/**\n * @description\n * Private service to sanitize uris for links and images. Used by $compile and $sanitize.\n */\nfunction $$SanitizeUriProvider() {\n var aHrefSanitizationWhitelist = /^\\s*(https?|ftp|mailto|tel|file):/,\n imgSrcSanitizationWhitelist = /^\\s*((https?|ftp|file|blob):|data:image\\/)/;\n\n /**\n * @description\n * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n * urls during a[href] sanitization.\n *\n * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n *\n * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n *\n * @param {RegExp=} regexp New regexp to whitelist urls with.\n * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n * chaining otherwise.\n */\n this.aHrefSanitizationWhitelist = function(regexp) {\n if (isDefined(regexp)) {\n aHrefSanitizationWhitelist = regexp;\n return this;\n }\n return aHrefSanitizationWhitelist;\n };\n\n\n /**\n * @description\n * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n * urls during img[src] sanitization.\n *\n * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n *\n * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n *\n * @param {RegExp=} regexp New regexp to whitelist urls with.\n * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n * chaining otherwise.\n */\n this.imgSrcSanitizationWhitelist = function(regexp) {\n if (isDefined(regexp)) {\n imgSrcSanitizationWhitelist = regexp;\n return this;\n }\n return imgSrcSanitizationWhitelist;\n };\n\n this.$get = function() {\n return function sanitizeUri(uri, isImage) {\n var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;\n var normalizedVal;\n normalizedVal = urlResolve(uri).href;\n if (normalizedVal !== '' && !normalizedVal.match(regex)) {\n return 'unsafe:' + normalizedVal;\n }\n return uri;\n };\n };\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n * Any commits to this file should be reviewed with security in mind. *\n * Changes to this file can potentially create security vulnerabilities. *\n * An approval from 2 Core members with history of modifying *\n * this file is required. *\n * *\n * Does the change somehow allow for arbitrary javascript to be executed? *\n * Or allows for someone to change the prototype of built-in objects? *\n * Or gives undesired access to variables likes document or window? *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sceMinErr = minErr('$sce');\n\nvar SCE_CONTEXTS = {\n HTML: 'html',\n CSS: 'css',\n URL: 'url',\n // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a\n // url. (e.g. ng-include, script src, templateUrl)\n RESOURCE_URL: 'resourceUrl',\n JS: 'js'\n};\n\n// Helper functions follow.\n\nfunction adjustMatcher(matcher) {\n if (matcher === 'self') {\n return matcher;\n } else if (isString(matcher)) {\n // Strings match exactly except for 2 wildcards - '*' and '**'.\n // '*' matches any character except those from the set ':/.?&'.\n // '**' matches any character (like .* in a RegExp).\n // More than 2 *'s raises an error as it's ill defined.\n if (matcher.indexOf('***') > -1) {\n throw $sceMinErr('iwcard',\n 'Illegal sequence *** in string matcher. String: {0}', matcher);\n }\n matcher = escapeForRegexp(matcher).\n replace('\\\\*\\\\*', '.*').\n replace('\\\\*', '[^:/.?&;]*');\n return new RegExp('^' + matcher + '$');\n } else if (isRegExp(matcher)) {\n // The only other type of matcher allowed is a Regexp.\n // Match entire URL / disallow partial matches.\n // Flags are reset (i.e. no global, ignoreCase or multiline)\n return new RegExp('^' + matcher.source + '$');\n } else {\n throw $sceMinErr('imatcher',\n 'Matchers may only be \"self\", string patterns or RegExp objects');\n }\n}\n\n\nfunction adjustMatchers(matchers) {\n var adjustedMatchers = [];\n if (isDefined(matchers)) {\n forEach(matchers, function(matcher) {\n adjustedMatchers.push(adjustMatcher(matcher));\n });\n }\n return adjustedMatchers;\n}\n\n\n/**\n * @ngdoc service\n * @name $sceDelegate\n * @kind function\n *\n * @description\n *\n * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict\n * Contextual Escaping (SCE)} services to AngularJS.\n *\n * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of\n * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS. This is\n * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to\n * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things\n * work because `$sce` delegates to `$sceDelegate` for these operations.\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.\n *\n * The default instance of `$sceDelegate` should work out of the box with little pain. While you\n * can override it completely to change the behavior of `$sce`, the common case would\n * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting\n * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as\n * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist\n * $sceDelegateProvider.resourceUrlWhitelist} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n */\n\n/**\n * @ngdoc provider\n * @name $sceDelegateProvider\n * @description\n *\n * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate\n * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure\n * that the URLs used for sourcing Angular templates are safe. Refer {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and\n * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n *\n * For the general details about this service in Angular, read the main page for {@link ng.$sce\n * Strict Contextual Escaping (SCE)}.\n *\n * **Example**: Consider the following case. <a name=\"example\"></a>\n *\n * - your app is hosted at url `http://myapp.example.com/`\n * - but some of your templates are hosted on other domains you control such as\n * `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.\n * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.\n *\n * Here is what a secure configuration for this scenario might look like:\n *\n * ```\n * angular.module('myApp', []).config(function($sceDelegateProvider) {\n * $sceDelegateProvider.resourceUrlWhitelist([\n * // Allow same origin resource loads.\n * 'self',\n * // Allow loading from our assets domain. Notice the difference between * and **.\n * 'http://srv*.assets.example.com/**'\n * ]);\n *\n * // The blacklist overrides the whitelist so the open redirect here is blocked.\n * $sceDelegateProvider.resourceUrlBlacklist([\n * 'http://myapp.example.com/clickThru**'\n * ]);\n * });\n * ```\n */\n\nfunction $SceDelegateProvider() {\n this.SCE_CONTEXTS = SCE_CONTEXTS;\n\n // Resource URLs can also be trusted by policy.\n var resourceUrlWhitelist = ['self'],\n resourceUrlBlacklist = [];\n\n /**\n * @ngdoc method\n * @name $sceDelegateProvider#resourceUrlWhitelist\n * @kind function\n *\n * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value\n * provided. This must be an array or null. A snapshot of this array is used so further\n * changes to the array are ignored.\n *\n * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n * allowed in this array.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** an empty whitelist array will block all URLs!\n * </div>\n *\n * @return {Array} the currently set whitelist array.\n *\n * The **default value** when no whitelist has been explicitly set is `['self']` allowing only\n * same origin resource requests.\n *\n * @description\n * Sets/Gets the whitelist of trusted resource URLs.\n */\n this.resourceUrlWhitelist = function(value) {\n if (arguments.length) {\n resourceUrlWhitelist = adjustMatchers(value);\n }\n return resourceUrlWhitelist;\n };\n\n /**\n * @ngdoc method\n * @name $sceDelegateProvider#resourceUrlBlacklist\n * @kind function\n *\n * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value\n * provided. This must be an array or null. A snapshot of this array is used so further\n * changes to the array are ignored.\n *\n * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n * allowed in this array.\n *\n * The typical usage for the blacklist is to **block\n * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as\n * these would otherwise be trusted but actually return content from the redirected domain.\n *\n * Finally, **the blacklist overrides the whitelist** and has the final say.\n *\n * @return {Array} the currently set blacklist array.\n *\n * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there\n * is no blacklist.)\n *\n * @description\n * Sets/Gets the blacklist of trusted resource URLs.\n */\n\n this.resourceUrlBlacklist = function(value) {\n if (arguments.length) {\n resourceUrlBlacklist = adjustMatchers(value);\n }\n return resourceUrlBlacklist;\n };\n\n this.$get = ['$injector', function($injector) {\n\n var htmlSanitizer = function htmlSanitizer(html) {\n throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n };\n\n if ($injector.has('$sanitize')) {\n htmlSanitizer = $injector.get('$sanitize');\n }\n\n\n function matchUrl(matcher, parsedUrl) {\n if (matcher === 'self') {\n return urlIsSameOrigin(parsedUrl);\n } else {\n // definitely a regex. See adjustMatchers()\n return !!matcher.exec(parsedUrl.href);\n }\n }\n\n function isResourceUrlAllowedByPolicy(url) {\n var parsedUrl = urlResolve(url.toString());\n var i, n, allowed = false;\n // Ensure that at least one item from the whitelist allows this url.\n for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {\n if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {\n allowed = true;\n break;\n }\n }\n if (allowed) {\n // Ensure that no item from the blacklist blocked this url.\n for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {\n if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {\n allowed = false;\n break;\n }\n }\n }\n return allowed;\n }\n\n function generateHolderType(Base) {\n var holderType = function TrustedValueHolderType(trustedValue) {\n this.$$unwrapTrustedValue = function() {\n return trustedValue;\n };\n };\n if (Base) {\n holderType.prototype = new Base();\n }\n holderType.prototype.valueOf = function sceValueOf() {\n return this.$$unwrapTrustedValue();\n };\n holderType.prototype.toString = function sceToString() {\n return this.$$unwrapTrustedValue().toString();\n };\n return holderType;\n }\n\n var trustedValueHolderBase = generateHolderType(),\n byType = {};\n\n byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);\n byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);\n byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);\n byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);\n byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);\n\n /**\n * @ngdoc method\n * @name $sceDelegate#trustAs\n *\n * @description\n * Returns an object that is trusted by angular for use in specified strict\n * contextual escaping contexts (such as ng-bind-html, ng-include, any src\n * attribute interpolation, any dom event binding attribute interpolation\n * such as for onclick, etc.) that uses the provided value.\n * See {@link ng.$sce $sce} for enabling strict contextual escaping.\n *\n * @param {string} type The kind of context in which this value is safe for use. e.g. url,\n * resourceUrl, html, js and css.\n * @param {*} value The value that that should be considered trusted/safe.\n * @returns {*} A value that can be used to stand in for the provided `value` in places\n * where Angular expects a $sce.trustAs() return value.\n */\n function trustAs(type, trustedValue) {\n var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n if (!Constructor) {\n throw $sceMinErr('icontext',\n 'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',\n type, trustedValue);\n }\n if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {\n return trustedValue;\n }\n // All the current contexts in SCE_CONTEXTS happen to be strings. In order to avoid trusting\n // mutable objects, we ensure here that the value passed in is actually a string.\n if (typeof trustedValue !== 'string') {\n throw $sceMinErr('itype',\n 'Attempted to trust a non-string value in a content requiring a string: Context: {0}',\n type);\n }\n return new Constructor(trustedValue);\n }\n\n /**\n * @ngdoc method\n * @name $sceDelegate#valueOf\n *\n * @description\n * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs\n * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link\n * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.\n *\n * If the passed parameter is not a value that had been returned by {@link\n * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.\n *\n * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}\n * call or anything else.\n * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs\n * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns\n * `value` unchanged.\n */\n function valueOf(maybeTrusted) {\n if (maybeTrusted instanceof trustedValueHolderBase) {\n return maybeTrusted.$$unwrapTrustedValue();\n } else {\n return maybeTrusted;\n }\n }\n\n /**\n * @ngdoc method\n * @name $sceDelegate#getTrusted\n *\n * @description\n * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and\n * returns the originally supplied value if the queried context type is a supertype of the\n * created type. If this condition isn't satisfied, throws an exception.\n *\n * @param {string} type The kind of context in which this value is to be used.\n * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs\n * `$sceDelegate.trustAs`} call.\n * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs\n * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception.\n */\n function getTrusted(type, maybeTrusted) {\n if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {\n return maybeTrusted;\n }\n var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n if (constructor && maybeTrusted instanceof constructor) {\n return maybeTrusted.$$unwrapTrustedValue();\n }\n // If we get here, then we may only take one of two actions.\n // 1. sanitize the value for the requested type, or\n // 2. throw an exception.\n if (type === SCE_CONTEXTS.RESOURCE_URL) {\n if (isResourceUrlAllowedByPolicy(maybeTrusted)) {\n return maybeTrusted;\n } else {\n throw $sceMinErr('insecurl',\n 'Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}',\n maybeTrusted.toString());\n }\n } else if (type === SCE_CONTEXTS.HTML) {\n return htmlSanitizer(maybeTrusted);\n }\n throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n }\n\n return { trustAs: trustAs,\n getTrusted: getTrusted,\n valueOf: valueOf };\n }];\n}\n\n\n/**\n * @ngdoc provider\n * @name $sceProvider\n * @description\n *\n * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.\n * - enable/disable Strict Contextual Escaping (SCE) in a module\n * - override the default implementation with a custom delegate\n *\n * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.\n */\n\n/* jshint maxlen: false*/\n\n/**\n * @ngdoc service\n * @name $sce\n * @kind function\n *\n * @description\n *\n * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.\n *\n * # Strict Contextual Escaping\n *\n * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain\n * contexts to result in a value that is marked as safe to use for that context. One example of\n * such a context is binding arbitrary html controlled by the user via `ng-bind-html`. We refer\n * to these contexts as privileged or SCE contexts.\n *\n * As of version 1.2, Angular ships with SCE enabled by default.\n *\n * Note: When enabled (the default), IE<11 in quirks mode is not supported. In this mode, IE<11 allow\n * one to execute arbitrary javascript by the use of the expression() syntax. Refer\n * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.\n * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`\n * to the top of your HTML document.\n *\n * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for\n * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.\n *\n * Here's an example of a binding in a privileged context:\n *\n * ```\n * <input ng-model=\"userHtml\" aria-label=\"User input\">\n * <div ng-bind-html=\"userHtml\"></div>\n * ```\n *\n * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE\n * disabled, this application allows the user to render arbitrary HTML into the DIV.\n * In a more realistic example, one may be rendering user comments, blog articles, etc. via\n * bindings. (HTML is just one example of a context where rendering user controlled input creates\n * security vulnerabilities.)\n *\n * For the case of HTML, you might use a library, either on the client side, or on the server side,\n * to sanitize unsafe HTML before binding to the value and rendering it in the document.\n *\n * How would you ensure that every place that used these types of bindings was bound to a value that\n * was sanitized by your library (or returned as safe for rendering by your server?) How can you\n * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some\n * properties/fields and forgot to update the binding to the sanitized value?\n *\n * To be secure by default, you want to ensure that any such bindings are disallowed unless you can\n * determine that something explicitly says it's safe to use a value for binding in that\n * context. You can then audit your code (a simple grep would do) to ensure that this is only done\n * for those values that you can easily tell are safe - because they were received from your server,\n * sanitized by your library, etc. You can organize your codebase to help with this - perhaps\n * allowing only the files in a specific directory to do this. Ensuring that the internal API\n * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.\n *\n * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}\n * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to\n * obtain values that will be accepted by SCE / privileged contexts.\n *\n *\n * ## How does it work?\n *\n * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted\n * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link\n * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the\n * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.\n *\n * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link\n * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly\n * simplified):\n *\n * ```\n * var ngBindHtmlDirective = ['$sce', function($sce) {\n * return function(scope, element, attr) {\n * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {\n * element.html(value || '');\n * });\n * };\n * }];\n * ```\n *\n * ## Impact on loading templates\n *\n * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as\n * `templateUrl`'s specified by {@link guide/directive directives}.\n *\n * By default, Angular only loads templates from the same domain and protocol as the application\n * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or\n * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist\n * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.\n *\n * *Please note*:\n * The browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy apply in addition to this and may further restrict whether the template is successfully\n * loaded. This means that without the right CORS policy, loading templates from a different domain\n * won't work on all browsers. Also, loading templates from `file://` URL does not work on some\n * browsers.\n *\n * ## This feels like too much overhead\n *\n * It's important to remember that SCE only applies to interpolation expressions.\n *\n * If your expressions are constant literals, they're automatically trusted and you don't need to\n * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.\n * `<div ng-bind-html=\"'<b>implicitly trusted</b>'\"></div>`) just works.\n *\n * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them\n * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here.\n *\n * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load\n * templates in `ng-include` from your application's domain without having to even know about SCE.\n * It blocks loading templates from other domains or loading templates over http from an https\n * served document. You can change these by setting your own custom {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.\n *\n * This significantly reduces the overhead. It is far easier to pay the small overhead and have an\n * application that's secure and can be audited to verify that with much more ease than bolting\n * security onto an application later.\n *\n * <a name=\"contexts\"></a>\n * ## What trusted context types are supported?\n *\n * | Context | Notes |\n * |---------------------|----------------|\n * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |\n * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |\n * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |\n * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.) <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |\n * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |\n *\n * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name=\"resourceUrlPatternItem\"></a>\n *\n * Each element in these arrays must be one of the following:\n *\n * - **'self'**\n * - The special **string**, `'self'`, can be used to match against all URLs of the **same\n * domain** as the application document using the **same protocol**.\n * - **String** (except the special value `'self'`)\n * - The string is matched against the full *normalized / absolute URL* of the resource\n * being tested (substring matches are not good enough.)\n * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters\n * match themselves.\n * - `*`: matches zero or more occurrences of any character other than one of the following 6\n * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'. It's a useful wildcard for use\n * in a whitelist.\n * - `**`: matches zero or more occurrences of *any* character. As such, it's not\n * appropriate for use in a scheme, domain, etc. as it would match too much. (e.g.\n * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might\n * not have been the intention.) Its usage at the very end of the path is ok. (e.g.\n * http://foo.example.com/templates/**).\n * - **RegExp** (*see caveat below*)\n * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax\n * (and all the inevitable escaping) makes them *harder to maintain*. It's easy to\n * accidentally introduce a bug when one updates a complex expression (imho, all regexes should\n * have good test coverage). For instance, the use of `.` in the regex is correct only in a\n * small number of cases. A `.` character in the regex used when matching the scheme or a\n * subdomain could be matched against a `:` or literal `.` that was likely not intended. It\n * is highly recommended to use the string patterns and only fall back to regular expressions\n * as a last resort.\n * - The regular expression must be an instance of RegExp (i.e. not a string.) It is\n * matched against the **entire** *normalized / absolute URL* of the resource being tested\n * (even when the RegExp did not have the `^` and `$` codes.) In addition, any flags\n * present on the RegExp (such as multiline, global, ignoreCase) are ignored.\n * - If you are generating your JavaScript from some other templating engine (not\n * recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),\n * remember to escape your regular expression (and be aware that you might need more than\n * one level of escaping depending on your templating engine and the way you interpolated\n * the value.) Do make use of your platform's escaping mechanism as it might be good\n * enough before coding your own. E.g. Ruby has\n * [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)\n * and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).\n * Javascript lacks a similar built in function for escaping. Take a look at Google\n * Closure library's [goog.string.regExpEscape(s)](\n * http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.\n *\n * ## Show me an example using SCE.\n *\n * <example module=\"mySceApp\" deps=\"angular-sanitize.js\">\n * <file name=\"index.html\">\n * <div ng-controller=\"AppController as myCtrl\">\n * <i ng-bind-html=\"myCtrl.explicitlyTrustedHtml\" id=\"explicitlyTrustedHtml\"></i><br><br>\n * <b>User comments</b><br>\n * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when\n * $sanitize is available. If $sanitize isn't available, this results in an error instead of an\n * exploit.\n * <div class=\"well\">\n * <div ng-repeat=\"userComment in myCtrl.userComments\">\n * <b>{{userComment.name}}</b>:\n * <span ng-bind-html=\"userComment.htmlComment\" class=\"htmlComment\"></span>\n * <br>\n * </div>\n * </div>\n * </div>\n * </file>\n *\n * <file name=\"script.js\">\n * angular.module('mySceApp', ['ngSanitize'])\n * .controller('AppController', ['$http', '$templateCache', '$sce',\n * function($http, $templateCache, $sce) {\n * var self = this;\n * $http.get(\"test_data.json\", {cache: $templateCache}).success(function(userComments) {\n * self.userComments = userComments;\n * });\n * self.explicitlyTrustedHtml = $sce.trustAsHtml(\n * '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n * 'sanitization.&quot;\">Hover over this text.</span>');\n * }]);\n * </file>\n *\n * <file name=\"test_data.json\">\n * [\n * { \"name\": \"Alice\",\n * \"htmlComment\":\n * \"<span onmouseover='this.textContent=\\\"PWN3D!\\\"'>Is <i>anyone</i> reading this?</span>\"\n * },\n * { \"name\": \"Bob\",\n * \"htmlComment\": \"<i>Yes!</i> Am I the only other one?\"\n * }\n * ]\n * </file>\n *\n * <file name=\"protractor.js\" type=\"protractor\">\n * describe('SCE doc demo', function() {\n * it('should sanitize untrusted values', function() {\n * expect(element.all(by.css('.htmlComment')).first().getInnerHtml())\n * .toBe('<span>Is <i>anyone</i> reading this?</span>');\n * });\n *\n * it('should NOT sanitize explicitly trusted values', function() {\n * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(\n * '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n * 'sanitization.&quot;\">Hover over this text.</span>');\n * });\n * });\n * </file>\n * </example>\n *\n *\n *\n * ## Can I disable SCE completely?\n *\n * Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits\n * for little coding overhead. It will be much harder to take an SCE disabled application and\n * either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE\n * for cases where you have a lot of existing code that was written before SCE was introduced and\n * you're migrating them a module at a time.\n *\n * That said, here's how you can completely disable SCE:\n *\n * ```\n * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {\n * // Completely disable SCE. For demonstration purposes only!\n * // Do not use in new projects.\n * $sceProvider.enabled(false);\n * });\n * ```\n *\n */\n/* jshint maxlen: 100 */\n\nfunction $SceProvider() {\n var enabled = true;\n\n /**\n * @ngdoc method\n * @name $sceProvider#enabled\n * @kind function\n *\n * @param {boolean=} value If provided, then enables/disables SCE.\n * @return {boolean} true if SCE is enabled, false otherwise.\n *\n * @description\n * Enables/disables SCE and returns the current value.\n */\n this.enabled = function(value) {\n if (arguments.length) {\n enabled = !!value;\n }\n return enabled;\n };\n\n\n /* Design notes on the default implementation for SCE.\n *\n * The API contract for the SCE delegate\n * -------------------------------------\n * The SCE delegate object must provide the following 3 methods:\n *\n * - trustAs(contextEnum, value)\n * This method is used to tell the SCE service that the provided value is OK to use in the\n * contexts specified by contextEnum. It must return an object that will be accepted by\n * getTrusted() for a compatible contextEnum and return this value.\n *\n * - valueOf(value)\n * For values that were not produced by trustAs(), return them as is. For values that were\n * produced by trustAs(), return the corresponding input value to trustAs. Basically, if\n * trustAs is wrapping the given values into some type, this operation unwraps it when given\n * such a value.\n *\n * - getTrusted(contextEnum, value)\n * This function should return the a value that is safe to use in the context specified by\n * contextEnum or throw and exception otherwise.\n *\n * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be\n * opaque or wrapped in some holder object. That happens to be an implementation detail. For\n * instance, an implementation could maintain a registry of all trusted objects by context. In\n * such a case, trustAs() would return the same object that was passed in. getTrusted() would\n * return the same object passed in if it was found in the registry under a compatible context or\n * throw an exception otherwise. An implementation might only wrap values some of the time based\n * on some criteria. getTrusted() might return a value and not throw an exception for special\n * constants or objects even if not wrapped. All such implementations fulfill this contract.\n *\n *\n * A note on the inheritance model for SCE contexts\n * ------------------------------------------------\n * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types. This\n * is purely an implementation details.\n *\n * The contract is simply this:\n *\n * getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)\n * will also succeed.\n *\n * Inheritance happens to capture this in a natural way. In some future, we\n * may not use inheritance anymore. That is OK because no code outside of\n * sce.js and sceSpecs.js would need to be aware of this detail.\n */\n\n this.$get = ['$parse', '$sceDelegate', function(\n $parse, $sceDelegate) {\n // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow\n // the \"expression(javascript expression)\" syntax which is insecure.\n if (enabled && msie < 8) {\n throw $sceMinErr('iequirks',\n 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +\n 'mode. You can fix this by adding the text <!doctype html> to the top of your HTML ' +\n 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');\n }\n\n var sce = shallowCopy(SCE_CONTEXTS);\n\n /**\n * @ngdoc method\n * @name $sce#isEnabled\n * @kind function\n *\n * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you\n * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.\n *\n * @description\n * Returns a boolean indicating if SCE is enabled.\n */\n sce.isEnabled = function() {\n return enabled;\n };\n sce.trustAs = $sceDelegate.trustAs;\n sce.getTrusted = $sceDelegate.getTrusted;\n sce.valueOf = $sceDelegate.valueOf;\n\n if (!enabled) {\n sce.trustAs = sce.getTrusted = function(type, value) { return value; };\n sce.valueOf = identity;\n }\n\n /**\n * @ngdoc method\n * @name $sce#parseAs\n *\n * @description\n * Converts Angular {@link guide/expression expression} into a function. This is like {@link\n * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it\n * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,\n * *result*)}\n *\n * @param {string} type The kind of SCE context in which this result will be used.\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n */\n sce.parseAs = function sceParseAs(type, expr) {\n var parsed = $parse(expr);\n if (parsed.literal && parsed.constant) {\n return parsed;\n } else {\n return $parse(expr, function(value) {\n return sce.getTrusted(type, value);\n });\n }\n };\n\n /**\n * @ngdoc method\n * @name $sce#trustAs\n *\n * @description\n * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such,\n * returns an object that is trusted by angular for use in specified strict contextual\n * escaping contexts (such as ng-bind-html, ng-include, any src attribute\n * interpolation, any dom event binding attribute interpolation such as for onclick, etc.)\n * that uses the provided value. See * {@link ng.$sce $sce} for enabling strict contextual\n * escaping.\n *\n * @param {string} type The kind of context in which this value is safe for use. e.g. url,\n * resourceUrl, html, js and css.\n * @param {*} value The value that that should be considered trusted/safe.\n * @returns {*} A value that can be used to stand in for the provided `value` in places\n * where Angular expects a $sce.trustAs() return value.\n */\n\n /**\n * @ngdoc method\n * @name $sce#trustAsHtml\n *\n * @description\n * Shorthand method. `$sce.trustAsHtml(value)` →\n * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}\n *\n * @param {*} value The value to trustAs.\n * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml\n * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives\n * only accept expressions that are either literal constants or are the\n * return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n */\n\n /**\n * @ngdoc method\n * @name $sce#trustAsUrl\n *\n * @description\n * Shorthand method. `$sce.trustAsUrl(value)` →\n * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}\n *\n * @param {*} value The value to trustAs.\n * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl\n * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives\n * only accept expressions that are either literal constants or are the\n * return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n */\n\n /**\n * @ngdoc method\n * @name $sce#trustAsResourceUrl\n *\n * @description\n * Shorthand method. `$sce.trustAsResourceUrl(value)` →\n * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}\n *\n * @param {*} value The value to trustAs.\n * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives\n * only accept expressions that are either literal constants or are the return\n * value of {@link ng.$sce#trustAs $sce.trustAs}.)\n */\n\n /**\n * @ngdoc method\n * @name $sce#trustAsJs\n *\n * @description\n * Shorthand method. `$sce.trustAsJs(value)` →\n * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}\n *\n * @param {*} value The value to trustAs.\n * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs\n * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives\n * only accept expressions that are either literal constants or are the\n * return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n */\n\n /**\n * @ngdoc method\n * @name $sce#getTrusted\n *\n * @description\n * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such,\n * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the\n * originally supplied value if the queried context type is a supertype of the created type.\n * If this condition isn't satisfied, throws an exception.\n *\n * @param {string} type The kind of context in which this value is to be used.\n * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}\n * call.\n * @returns {*} The value the was originally provided to\n * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.\n * Otherwise, throws an exception.\n */\n\n /**\n * @ngdoc method\n * @name $sce#getTrustedHtml\n *\n * @description\n * Shorthand method. `$sce.getTrustedHtml(value)` →\n * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}\n *\n * @param {*} value The value to pass to `$sce.getTrusted`.\n * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`\n */\n\n /**\n * @ngdoc method\n * @name $sce#getTrustedCss\n *\n * @description\n * Shorthand method. `$sce.getTrustedCss(value)` →\n * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}\n *\n * @param {*} value The value to pass to `$sce.getTrusted`.\n * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`\n */\n\n /**\n * @ngdoc method\n * @name $sce#getTrustedUrl\n *\n * @description\n * Shorthand method. `$sce.getTrustedUrl(value)` →\n * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}\n *\n * @param {*} value The value to pass to `$sce.getTrusted`.\n * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`\n */\n\n /**\n * @ngdoc method\n * @name $sce#getTrustedResourceUrl\n *\n * @description\n * Shorthand method. `$sce.getTrustedResourceUrl(value)` →\n * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}\n *\n * @param {*} value The value to pass to `$sceDelegate.getTrusted`.\n * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`\n */\n\n /**\n * @ngdoc method\n * @name $sce#getTrustedJs\n *\n * @description\n * Shorthand method. `$sce.getTrustedJs(value)` →\n * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}\n *\n * @param {*} value The value to pass to `$sce.getTrusted`.\n * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`\n */\n\n /**\n * @ngdoc method\n * @name $sce#parseAsHtml\n *\n * @description\n * Shorthand method. `$sce.parseAsHtml(expression string)` →\n * {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n */\n\n /**\n * @ngdoc method\n * @name $sce#parseAsCss\n *\n * @description\n * Shorthand method. `$sce.parseAsCss(value)` →\n * {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n */\n\n /**\n * @ngdoc method\n * @name $sce#parseAsUrl\n *\n * @description\n * Shorthand method. `$sce.parseAsUrl(value)` →\n * {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n */\n\n /**\n * @ngdoc method\n * @name $sce#parseAsResourceUrl\n *\n * @description\n * Shorthand method. `$sce.parseAsResourceUrl(value)` →\n * {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n */\n\n /**\n * @ngdoc method\n * @name $sce#parseAsJs\n *\n * @description\n * Shorthand method. `$sce.parseAsJs(value)` →\n * {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n * * `context` `{object}` an object against which any expressions embedded in the strings\n * are evaluated against (typically a scope object).\n * * `locals` `{object=}` local variables context object, useful for overriding values in\n * `context`.\n */\n\n // Shorthand delegations.\n var parse = sce.parseAs,\n getTrusted = sce.getTrusted,\n trustAs = sce.trustAs;\n\n forEach(SCE_CONTEXTS, function(enumValue, name) {\n var lName = lowercase(name);\n sce[camelCase(\"parse_as_\" + lName)] = function(expr) {\n return parse(enumValue, expr);\n };\n sce[camelCase(\"get_trusted_\" + lName)] = function(value) {\n return getTrusted(enumValue, value);\n };\n sce[camelCase(\"trust_as_\" + lName)] = function(value) {\n return trustAs(enumValue, value);\n };\n });\n\n return sce;\n }];\n}\n\n/**\n * !!! This is an undocumented \"private\" service !!!\n *\n * @name $sniffer\n * @requires $window\n * @requires $document\n *\n * @property {boolean} history Does the browser support html5 history api ?\n * @property {boolean} transitions Does the browser support CSS transition events ?\n * @property {boolean} animations Does the browser support CSS animation events ?\n *\n * @description\n * This is very simple implementation of testing browser's features.\n */\nfunction $SnifferProvider() {\n this.$get = ['$window', '$document', function($window, $document) {\n var eventSupport = {},\n android =\n toInt((/android (\\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),\n boxee = /Boxee/i.test(($window.navigator || {}).userAgent),\n document = $document[0] || {},\n vendorPrefix,\n vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,\n bodyStyle = document.body && document.body.style,\n transitions = false,\n animations = false,\n match;\n\n if (bodyStyle) {\n for (var prop in bodyStyle) {\n if (match = vendorRegex.exec(prop)) {\n vendorPrefix = match[0];\n vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);\n break;\n }\n }\n\n if (!vendorPrefix) {\n vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';\n }\n\n transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));\n animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));\n\n if (android && (!transitions || !animations)) {\n transitions = isString(bodyStyle.webkitTransition);\n animations = isString(bodyStyle.webkitAnimation);\n }\n }\n\n\n return {\n // Android has history.pushState, but it does not update location correctly\n // so let's not use the history API at all.\n // http://code.google.com/p/android/issues/detail?id=17471\n // https://github.com/angular/angular.js/issues/904\n\n // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has\n // so let's not use the history API also\n // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined\n // jshint -W018\n history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),\n // jshint +W018\n hasEvent: function(event) {\n // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have\n // it. In particular the event is not fired when backspace or delete key are pressed or\n // when cut operation is performed.\n // IE10+ implements 'input' event but it erroneously fires under various situations,\n // e.g. when placeholder changes, or a form is focused.\n if (event === 'input' && msie <= 11) return false;\n\n if (isUndefined(eventSupport[event])) {\n var divElm = document.createElement('div');\n eventSupport[event] = 'on' + event in divElm;\n }\n\n return eventSupport[event];\n },\n csp: csp(),\n vendorPrefix: vendorPrefix,\n transitions: transitions,\n animations: animations,\n android: android\n };\n }];\n}\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc service\n * @name $templateRequest\n *\n * @description\n * The `$templateRequest` service runs security checks then downloads the provided template using\n * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request\n * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the\n * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the\n * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted\n * when `tpl` is of type string and `$templateCache` has the matching entry.\n *\n * @param {string|TrustedResourceUrl} tpl The HTTP request template URL\n * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty\n *\n * @return {Promise} a promise for the HTTP response data of the given URL.\n *\n * @property {number} totalPendingRequests total amount of pending template requests being downloaded.\n */\nfunction $TemplateRequestProvider() {\n this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {\n function handleRequestFn(tpl, ignoreRequestError) {\n handleRequestFn.totalPendingRequests++;\n\n // We consider the template cache holds only trusted templates, so\n // there's no need to go through whitelisting again for keys that already\n // are included in there. This also makes Angular accept any script\n // directive, no matter its name. However, we still need to unwrap trusted\n // types.\n if (!isString(tpl) || isUndefined($templateCache.get(tpl))) {\n tpl = $sce.getTrustedResourceUrl(tpl);\n }\n\n var transformResponse = $http.defaults && $http.defaults.transformResponse;\n\n if (isArray(transformResponse)) {\n transformResponse = transformResponse.filter(function(transformer) {\n return transformer !== defaultHttpResponseTransform;\n });\n } else if (transformResponse === defaultHttpResponseTransform) {\n transformResponse = null;\n }\n\n var httpOptions = {\n cache: $templateCache,\n transformResponse: transformResponse\n };\n\n return $http.get(tpl, httpOptions)\n ['finally'](function() {\n handleRequestFn.totalPendingRequests--;\n })\n .then(function(response) {\n $templateCache.put(tpl, response.data);\n return response.data;\n }, handleError);\n\n function handleError(resp) {\n if (!ignoreRequestError) {\n throw $compileMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',\n tpl, resp.status, resp.statusText);\n }\n return $q.reject(resp);\n }\n }\n\n handleRequestFn.totalPendingRequests = 0;\n\n return handleRequestFn;\n }];\n}\n\nfunction $$TestabilityProvider() {\n this.$get = ['$rootScope', '$browser', '$location',\n function($rootScope, $browser, $location) {\n\n /**\n * @name $testability\n *\n * @description\n * The private $$testability service provides a collection of methods for use when debugging\n * or by automated test and debugging tools.\n */\n var testability = {};\n\n /**\n * @name $$testability#findBindings\n *\n * @description\n * Returns an array of elements that are bound (via ng-bind or {{}})\n * to expressions matching the input.\n *\n * @param {Element} element The element root to search from.\n * @param {string} expression The binding expression to match.\n * @param {boolean} opt_exactMatch If true, only returns exact matches\n * for the expression. Filters and whitespace are ignored.\n */\n testability.findBindings = function(element, expression, opt_exactMatch) {\n var bindings = element.getElementsByClassName('ng-binding');\n var matches = [];\n forEach(bindings, function(binding) {\n var dataBinding = angular.element(binding).data('$binding');\n if (dataBinding) {\n forEach(dataBinding, function(bindingName) {\n if (opt_exactMatch) {\n var matcher = new RegExp('(^|\\\\s)' + escapeForRegexp(expression) + '(\\\\s|\\\\||$)');\n if (matcher.test(bindingName)) {\n matches.push(binding);\n }\n } else {\n if (bindingName.indexOf(expression) != -1) {\n matches.push(binding);\n }\n }\n });\n }\n });\n return matches;\n };\n\n /**\n * @name $$testability#findModels\n *\n * @description\n * Returns an array of elements that are two-way found via ng-model to\n * expressions matching the input.\n *\n * @param {Element} element The element root to search from.\n * @param {string} expression The model expression to match.\n * @param {boolean} opt_exactMatch If true, only returns exact matches\n * for the expression.\n */\n testability.findModels = function(element, expression, opt_exactMatch) {\n var prefixes = ['ng-', 'data-ng-', 'ng\\\\:'];\n for (var p = 0; p < prefixes.length; ++p) {\n var attributeEquals = opt_exactMatch ? '=' : '*=';\n var selector = '[' + prefixes[p] + 'model' + attributeEquals + '\"' + expression + '\"]';\n var elements = element.querySelectorAll(selector);\n if (elements.length) {\n return elements;\n }\n }\n };\n\n /**\n * @name $$testability#getLocation\n *\n * @description\n * Shortcut for getting the location in a browser agnostic way. Returns\n * the path, search, and hash. (e.g. /path?a=b#hash)\n */\n testability.getLocation = function() {\n return $location.url();\n };\n\n /**\n * @name $$testability#setLocation\n *\n * @description\n * Shortcut for navigating to a location without doing a full page reload.\n *\n * @param {string} url The location url (path, search and hash,\n * e.g. /path?a=b#hash) to go to.\n */\n testability.setLocation = function(url) {\n if (url !== $location.url()) {\n $location.url(url);\n $rootScope.$digest();\n }\n };\n\n /**\n * @name $$testability#whenStable\n *\n * @description\n * Calls the callback when $timeout and $http requests are completed.\n *\n * @param {function} callback\n */\n testability.whenStable = function(callback) {\n $browser.notifyWhenNoOutstandingRequests(callback);\n };\n\n return testability;\n }];\n}\n\nfunction $TimeoutProvider() {\n this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',\n function($rootScope, $browser, $q, $$q, $exceptionHandler) {\n\n var deferreds = {};\n\n\n /**\n * @ngdoc service\n * @name $timeout\n *\n * @description\n * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch\n * block and delegates any exceptions to\n * {@link ng.$exceptionHandler $exceptionHandler} service.\n *\n * The return value of calling `$timeout` is a promise, which will be resolved when\n * the delay has passed and the timeout function, if provided, is executed.\n *\n * To cancel a timeout request, call `$timeout.cancel(promise)`.\n *\n * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to\n * synchronously flush the queue of deferred functions.\n *\n * If you only want a promise that will be resolved after some specified delay\n * then you can call `$timeout` without the `fn` function.\n *\n * @param {function()=} fn A function, whose execution should be delayed.\n * @param {number=} [delay=0] Delay in milliseconds.\n * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n * @param {...*=} Pass additional parameters to the executed function.\n * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise\n * will be resolved with the return value of the `fn` function.\n *\n */\n function timeout(fn, delay, invokeApply) {\n if (!isFunction(fn)) {\n invokeApply = delay;\n delay = fn;\n fn = noop;\n }\n\n var args = sliceArgs(arguments, 3),\n skipApply = (isDefined(invokeApply) && !invokeApply),\n deferred = (skipApply ? $$q : $q).defer(),\n promise = deferred.promise,\n timeoutId;\n\n timeoutId = $browser.defer(function() {\n try {\n deferred.resolve(fn.apply(null, args));\n } catch (e) {\n deferred.reject(e);\n $exceptionHandler(e);\n }\n finally {\n delete deferreds[promise.$$timeoutId];\n }\n\n if (!skipApply) $rootScope.$apply();\n }, delay);\n\n promise.$$timeoutId = timeoutId;\n deferreds[timeoutId] = deferred;\n\n return promise;\n }\n\n\n /**\n * @ngdoc method\n * @name $timeout#cancel\n *\n * @description\n * Cancels a task associated with the `promise`. As a result of this, the promise will be\n * resolved with a rejection.\n *\n * @param {Promise=} promise Promise returned by the `$timeout` function.\n * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n * canceled.\n */\n timeout.cancel = function(promise) {\n if (promise && promise.$$timeoutId in deferreds) {\n deferreds[promise.$$timeoutId].reject('canceled');\n delete deferreds[promise.$$timeoutId];\n return $browser.defer.cancel(promise.$$timeoutId);\n }\n return false;\n };\n\n return timeout;\n }];\n}\n\n// NOTE: The usage of window and document instead of $window and $document here is\n// deliberate. This service depends on the specific behavior of anchor nodes created by the\n// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and\n// cause us to break tests. In addition, when the browser resolves a URL for XHR, it\n// doesn't know about mocked locations and resolves URLs to the real document - which is\n// exactly the behavior needed here. There is little value is mocking these out for this\n// service.\nvar urlParsingNode = document.createElement(\"a\");\nvar originUrl = urlResolve(window.location.href);\n\n\n/**\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\nfunction urlResolve(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n/**\n * Parse a request URL and determine whether this is a same-origin request as the application document.\n *\n * @param {string|object} requestUrl The url of the request as a string that will be resolved\n * or a parsed URL object.\n * @returns {boolean} Whether the request is for the same origin as the application document.\n */\nfunction urlIsSameOrigin(requestUrl) {\n var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;\n return (parsed.protocol === originUrl.protocol &&\n parsed.host === originUrl.host);\n}\n\n/**\n * @ngdoc service\n * @name $window\n *\n * @description\n * A reference to the browser's `window` object. While `window`\n * is globally available in JavaScript, it causes testability problems, because\n * it is a global variable. In angular we always refer to it through the\n * `$window` service, so it may be overridden, removed or mocked for testing.\n *\n * Expressions, like the one defined for the `ngClick` directive in the example\n * below, are evaluated with respect to the current scope. Therefore, there is\n * no risk of inadvertently coding in a dependency on a global value in such an\n * expression.\n *\n * @example\n <example module=\"windowExample\">\n <file name=\"index.html\">\n <script>\n angular.module('windowExample', [])\n .controller('ExampleController', ['$scope', '$window', function($scope, $window) {\n $scope.greeting = 'Hello, World!';\n $scope.doGreeting = function(greeting) {\n $window.alert(greeting);\n };\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <input type=\"text\" ng-model=\"greeting\" aria-label=\"greeting\" />\n <button ng-click=\"doGreeting(greeting)\">ALERT</button>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should display the greeting in the input box', function() {\n element(by.model('greeting')).sendKeys('Hello, E2E Tests');\n // If we click the button it will block the test runner\n // element(':button').click();\n });\n </file>\n </example>\n */\nfunction $WindowProvider() {\n this.$get = valueFn(window);\n}\n\n/**\n * @name $$cookieReader\n * @requires $document\n *\n * @description\n * This is a private service for reading cookies used by $http and ngCookies\n *\n * @return {Object} a key/value map of the current cookies\n */\nfunction $$CookieReader($document) {\n var rawDocument = $document[0] || {};\n var lastCookies = {};\n var lastCookieString = '';\n\n function safeDecodeURIComponent(str) {\n try {\n return decodeURIComponent(str);\n } catch (e) {\n return str;\n }\n }\n\n return function() {\n var cookieArray, cookie, i, index, name;\n var currentCookieString = rawDocument.cookie || '';\n\n if (currentCookieString !== lastCookieString) {\n lastCookieString = currentCookieString;\n cookieArray = lastCookieString.split('; ');\n lastCookies = {};\n\n for (i = 0; i < cookieArray.length; i++) {\n cookie = cookieArray[i];\n index = cookie.indexOf('=');\n if (index > 0) { //ignore nameless cookies\n name = safeDecodeURIComponent(cookie.substring(0, index));\n // the first value that is seen for a cookie is the most\n // specific one. values for the same cookie name that\n // follow are for less specific paths.\n if (isUndefined(lastCookies[name])) {\n lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));\n }\n }\n }\n }\n return lastCookies;\n };\n}\n\n$$CookieReader.$inject = ['$document'];\n\nfunction $$CookieReaderProvider() {\n this.$get = $$CookieReader;\n}\n\n/* global currencyFilter: true,\n dateFilter: true,\n filterFilter: true,\n jsonFilter: true,\n limitToFilter: true,\n lowercaseFilter: true,\n numberFilter: true,\n orderByFilter: true,\n uppercaseFilter: true,\n */\n\n/**\n * @ngdoc provider\n * @name $filterProvider\n * @description\n *\n * Filters are just functions which transform input to an output. However filters need to be\n * Dependency Injected. To achieve this a filter definition consists of a factory function which is\n * annotated with dependencies and is responsible for creating a filter function.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n * (`myapp_subsection_filterx`).\n * </div>\n *\n * ```js\n * // Filter registration\n * function MyModule($provide, $filterProvider) {\n * // create a service to demonstrate injection (not always needed)\n * $provide.value('greet', function(name){\n * return 'Hello ' + name + '!';\n * });\n *\n * // register a filter factory which uses the\n * // greet service to demonstrate DI.\n * $filterProvider.register('greet', function(greet){\n * // return the filter function which uses the greet service\n * // to generate salutation\n * return function(text) {\n * // filters need to be forgiving so check input validity\n * return text && greet(text) || text;\n * };\n * });\n * }\n * ```\n *\n * The filter function is registered with the `$injector` under the filter name suffix with\n * `Filter`.\n *\n * ```js\n * it('should be the same instance', inject(\n * function($filterProvider) {\n * $filterProvider.register('reverse', function(){\n * return ...;\n * });\n * },\n * function($filter, reverseFilter) {\n * expect($filter('reverse')).toBe(reverseFilter);\n * });\n * ```\n *\n *\n * For more information about how angular filters work, and how to create your own filters, see\n * {@link guide/filter Filters} in the Angular Developer Guide.\n */\n\n/**\n * @ngdoc service\n * @name $filter\n * @kind function\n * @description\n * Filters are used for formatting data displayed to the user.\n *\n * The general syntax in templates is as follows:\n *\n * {{ expression [| filter_name[:parameter_value] ... ] }}\n *\n * @param {String} name Name of the filter function to retrieve\n * @return {Function} the filter function\n * @example\n <example name=\"$filter\" module=\"filterExample\">\n <file name=\"index.html\">\n <div ng-controller=\"MainCtrl\">\n <h3>{{ originalText }}</h3>\n <h3>{{ filteredText }}</h3>\n </div>\n </file>\n\n <file name=\"script.js\">\n angular.module('filterExample', [])\n .controller('MainCtrl', function($scope, $filter) {\n $scope.originalText = 'hello';\n $scope.filteredText = $filter('uppercase')($scope.originalText);\n });\n </file>\n </example>\n */\n$FilterProvider.$inject = ['$provide'];\nfunction $FilterProvider($provide) {\n var suffix = 'Filter';\n\n /**\n * @ngdoc method\n * @name $filterProvider#register\n * @param {string|Object} name Name of the filter function, or an object map of filters where\n * the keys are the filter names and the values are the filter factories.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n * (`myapp_subsection_filterx`).\n * </div>\n * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.\n * @returns {Object} Registered filter instance, or if a map of filters was provided then a map\n * of the registered filter instances.\n */\n function register(name, factory) {\n if (isObject(name)) {\n var filters = {};\n forEach(name, function(filter, key) {\n filters[key] = register(key, filter);\n });\n return filters;\n } else {\n return $provide.factory(name + suffix, factory);\n }\n }\n this.register = register;\n\n this.$get = ['$injector', function($injector) {\n return function(name) {\n return $injector.get(name + suffix);\n };\n }];\n\n ////////////////////////////////////////\n\n /* global\n currencyFilter: false,\n dateFilter: false,\n filterFilter: false,\n jsonFilter: false,\n limitToFilter: false,\n lowercaseFilter: false,\n numberFilter: false,\n orderByFilter: false,\n uppercaseFilter: false,\n */\n\n register('currency', currencyFilter);\n register('date', dateFilter);\n register('filter', filterFilter);\n register('json', jsonFilter);\n register('limitTo', limitToFilter);\n register('lowercase', lowercaseFilter);\n register('number', numberFilter);\n register('orderBy', orderByFilter);\n register('uppercase', uppercaseFilter);\n}\n\n/**\n * @ngdoc filter\n * @name filter\n * @kind function\n *\n * @description\n * Selects a subset of items from `array` and returns it as a new array.\n *\n * @param {Array} array The source array.\n * @param {string|Object|function()} expression The predicate to be used for selecting items from\n * `array`.\n *\n * Can be one of:\n *\n * - `string`: The string is used for matching against the contents of the `array`. All strings or\n * objects with string properties in `array` that match this string will be returned. This also\n * applies to nested object properties.\n * The predicate can be negated by prefixing the string with `!`.\n *\n * - `Object`: A pattern object can be used to filter specific properties on objects contained\n * by `array`. For example `{name:\"M\", phone:\"1\"}` predicate will return an array of items\n * which have property `name` containing \"M\" and property `phone` containing \"1\". A special\n * property name `$` can be used (as in `{$:\"text\"}`) to accept a match against any\n * property of the object or its nested object properties. That's equivalent to the simple\n * substring match with a `string` as described above. The predicate can be negated by prefixing\n * the string with `!`.\n * For example `{name: \"!M\"}` predicate will return an array of items which have property `name`\n * not containing \"M\".\n *\n * Note that a named property will match properties on the same level only, while the special\n * `$` property will match properties on the same level or deeper. E.g. an array item like\n * `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but\n * **will** be matched by `{$: 'John'}`.\n *\n * - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.\n * The function is called for each element of the array, with the element, its index, and\n * the entire array itself as arguments.\n *\n * The final result is an array of those elements that the predicate returned true for.\n *\n * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in\n * determining if the expected value (from the filter expression) and actual value (from\n * the object in the array) should be considered a match.\n *\n * Can be one of:\n *\n * - `function(actual, expected)`:\n * The function will be given the object value and the predicate value to compare and\n * should return true if both values should be considered equal.\n *\n * - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.\n * This is essentially strict comparison of expected and actual.\n *\n * - `false|undefined`: A short hand for a function which will look for a substring match in case\n * insensitive way.\n *\n * Primitive values are converted to strings. Objects are not compared against primitives,\n * unless they have a custom `toString` method (e.g. `Date` objects).\n *\n * @example\n <example>\n <file name=\"index.html\">\n <div ng-init=\"friends = [{name:'John', phone:'555-1276'},\n {name:'Mary', phone:'800-BIG-MARY'},\n {name:'Mike', phone:'555-4321'},\n {name:'Adam', phone:'555-5678'},\n {name:'Julie', phone:'555-8765'},\n {name:'Juliette', phone:'555-5678'}]\"></div>\n\n <label>Search: <input ng-model=\"searchText\"></label>\n <table id=\"searchTextResults\">\n <tr><th>Name</th><th>Phone</th></tr>\n <tr ng-repeat=\"friend in friends | filter:searchText\">\n <td>{{friend.name}}</td>\n <td>{{friend.phone}}</td>\n </tr>\n </table>\n <hr>\n <label>Any: <input ng-model=\"search.$\"></label> <br>\n <label>Name only <input ng-model=\"search.name\"></label><br>\n <label>Phone only <input ng-model=\"search.phone\"></label><br>\n <label>Equality <input type=\"checkbox\" ng-model=\"strict\"></label><br>\n <table id=\"searchObjResults\">\n <tr><th>Name</th><th>Phone</th></tr>\n <tr ng-repeat=\"friendObj in friends | filter:search:strict\">\n <td>{{friendObj.name}}</td>\n <td>{{friendObj.phone}}</td>\n </tr>\n </table>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var expectFriendNames = function(expectedNames, key) {\n element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {\n arr.forEach(function(wd, i) {\n expect(wd.getText()).toMatch(expectedNames[i]);\n });\n });\n };\n\n it('should search across all fields when filtering with a string', function() {\n var searchText = element(by.model('searchText'));\n searchText.clear();\n searchText.sendKeys('m');\n expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');\n\n searchText.clear();\n searchText.sendKeys('76');\n expectFriendNames(['John', 'Julie'], 'friend');\n });\n\n it('should search in specific fields when filtering with a predicate object', function() {\n var searchAny = element(by.model('search.$'));\n searchAny.clear();\n searchAny.sendKeys('i');\n expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');\n });\n it('should use a equal comparison when comparator is true', function() {\n var searchName = element(by.model('search.name'));\n var strict = element(by.model('strict'));\n searchName.clear();\n searchName.sendKeys('Julie');\n strict.click();\n expectFriendNames(['Julie'], 'friendObj');\n });\n </file>\n </example>\n */\nfunction filterFilter() {\n return function(array, expression, comparator) {\n if (!isArrayLike(array)) {\n if (array == null) {\n return array;\n } else {\n throw minErr('filter')('notarray', 'Expected array but received: {0}', array);\n }\n }\n\n var expressionType = getTypeForFilter(expression);\n var predicateFn;\n var matchAgainstAnyProp;\n\n switch (expressionType) {\n case 'function':\n predicateFn = expression;\n break;\n case 'boolean':\n case 'null':\n case 'number':\n case 'string':\n matchAgainstAnyProp = true;\n //jshint -W086\n case 'object':\n //jshint +W086\n predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);\n break;\n default:\n return array;\n }\n\n return Array.prototype.filter.call(array, predicateFn);\n };\n}\n\n// Helper functions for `filterFilter`\nfunction createPredicateFn(expression, comparator, matchAgainstAnyProp) {\n var shouldMatchPrimitives = isObject(expression) && ('$' in expression);\n var predicateFn;\n\n if (comparator === true) {\n comparator = equals;\n } else if (!isFunction(comparator)) {\n comparator = function(actual, expected) {\n if (isUndefined(actual)) {\n // No substring matching against `undefined`\n return false;\n }\n if ((actual === null) || (expected === null)) {\n // No substring matching against `null`; only match against `null`\n return actual === expected;\n }\n if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {\n // Should not compare primitives against objects, unless they have custom `toString` method\n return false;\n }\n\n actual = lowercase('' + actual);\n expected = lowercase('' + expected);\n return actual.indexOf(expected) !== -1;\n };\n }\n\n predicateFn = function(item) {\n if (shouldMatchPrimitives && !isObject(item)) {\n return deepCompare(item, expression.$, comparator, false);\n }\n return deepCompare(item, expression, comparator, matchAgainstAnyProp);\n };\n\n return predicateFn;\n}\n\nfunction deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {\n var actualType = getTypeForFilter(actual);\n var expectedType = getTypeForFilter(expected);\n\n if ((expectedType === 'string') && (expected.charAt(0) === '!')) {\n return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);\n } else if (isArray(actual)) {\n // In case `actual` is an array, consider it a match\n // if ANY of it's items matches `expected`\n return actual.some(function(item) {\n return deepCompare(item, expected, comparator, matchAgainstAnyProp);\n });\n }\n\n switch (actualType) {\n case 'object':\n var key;\n if (matchAgainstAnyProp) {\n for (key in actual) {\n if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {\n return true;\n }\n }\n return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);\n } else if (expectedType === 'object') {\n for (key in expected) {\n var expectedVal = expected[key];\n if (isFunction(expectedVal) || isUndefined(expectedVal)) {\n continue;\n }\n\n var matchAnyProperty = key === '$';\n var actualVal = matchAnyProperty ? actual : actual[key];\n if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {\n return false;\n }\n }\n return true;\n } else {\n return comparator(actual, expected);\n }\n break;\n case 'function':\n return false;\n default:\n return comparator(actual, expected);\n }\n}\n\n// Used for easily differentiating between `null` and actual `object`\nfunction getTypeForFilter(val) {\n return (val === null) ? 'null' : typeof val;\n}\n\nvar MAX_DIGITS = 22;\nvar DECIMAL_SEP = '.';\nvar ZERO_CHAR = '0';\n\n/**\n * @ngdoc filter\n * @name currency\n * @kind function\n *\n * @description\n * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default\n * symbol for current locale is used.\n *\n * @param {number} amount Input to filter.\n * @param {string=} symbol Currency symbol or identifier to be displayed.\n * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale\n * @returns {string} Formatted number.\n *\n *\n * @example\n <example module=\"currencyExample\">\n <file name=\"index.html\">\n <script>\n angular.module('currencyExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.amount = 1234.56;\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <input type=\"number\" ng-model=\"amount\" aria-label=\"amount\"> <br>\n default currency symbol ($): <span id=\"currency-default\">{{amount | currency}}</span><br>\n custom currency identifier (USD$): <span id=\"currency-custom\">{{amount | currency:\"USD$\"}}</span>\n no fractions (0): <span id=\"currency-no-fractions\">{{amount | currency:\"USD$\":0}}</span>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should init with 1234.56', function() {\n expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');\n expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');\n expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');\n });\n it('should update', function() {\n if (browser.params.browser == 'safari') {\n // Safari does not understand the minus key. See\n // https://github.com/angular/protractor/issues/481\n return;\n }\n element(by.model('amount')).clear();\n element(by.model('amount')).sendKeys('-1234');\n expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');\n expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');\n expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');\n });\n </file>\n </example>\n */\ncurrencyFilter.$inject = ['$locale'];\nfunction currencyFilter($locale) {\n var formats = $locale.NUMBER_FORMATS;\n return function(amount, currencySymbol, fractionSize) {\n if (isUndefined(currencySymbol)) {\n currencySymbol = formats.CURRENCY_SYM;\n }\n\n if (isUndefined(fractionSize)) {\n fractionSize = formats.PATTERNS[1].maxFrac;\n }\n\n // if null or undefined pass it through\n return (amount == null)\n ? amount\n : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).\n replace(/\\u00A4/g, currencySymbol);\n };\n}\n\n/**\n * @ngdoc filter\n * @name number\n * @kind function\n *\n * @description\n * Formats a number as text.\n *\n * If the input is null or undefined, it will just be returned.\n * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively.\n * If the input is not a number an empty string is returned.\n *\n *\n * @param {number|string} number Number to format.\n * @param {(number|string)=} fractionSize Number of decimal places to round the number to.\n * If this is not provided then the fraction size is computed from the current locale's number\n * formatting pattern. In the case of the default locale, it will be 3.\n * @returns {string} Number rounded to `fractionSize` appropriately formatted based on the current\n * locale (e.g., in the en_US locale it will have \".\" as the decimal separator and\n * include \",\" group separators after each third digit).\n *\n * @example\n <example module=\"numberFilterExample\">\n <file name=\"index.html\">\n <script>\n angular.module('numberFilterExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.val = 1234.56789;\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <label>Enter number: <input ng-model='val'></label><br>\n Default formatting: <span id='number-default'>{{val | number}}</span><br>\n No fractions: <span>{{val | number:0}}</span><br>\n Negative number: <span>{{-val | number:4}}</span>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should format numbers', function() {\n expect(element(by.id('number-default')).getText()).toBe('1,234.568');\n expect(element(by.binding('val | number:0')).getText()).toBe('1,235');\n expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');\n });\n\n it('should update', function() {\n element(by.model('val')).clear();\n element(by.model('val')).sendKeys('3374.333');\n expect(element(by.id('number-default')).getText()).toBe('3,374.333');\n expect(element(by.binding('val | number:0')).getText()).toBe('3,374');\n expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');\n });\n </file>\n </example>\n */\nnumberFilter.$inject = ['$locale'];\nfunction numberFilter($locale) {\n var formats = $locale.NUMBER_FORMATS;\n return function(number, fractionSize) {\n\n // if null or undefined pass it through\n return (number == null)\n ? number\n : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,\n fractionSize);\n };\n}\n\n/**\n * Parse a number (as a string) into three components that can be used\n * for formatting the number.\n *\n * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)\n *\n * @param {string} numStr The number to parse\n * @return {object} An object describing this number, containing the following keys:\n * - d : an array of digits containing leading zeros as necessary\n * - i : the number of the digits in `d` that are to the left of the decimal point\n * - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`\n *\n */\nfunction parse(numStr) {\n var exponent = 0, digits, numberOfIntegerDigits;\n var i, j, zeros;\n\n // Decimal point?\n if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {\n numStr = numStr.replace(DECIMAL_SEP, '');\n }\n\n // Exponential form?\n if ((i = numStr.search(/e/i)) > 0) {\n // Work out the exponent.\n if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;\n numberOfIntegerDigits += +numStr.slice(i + 1);\n numStr = numStr.substring(0, i);\n } else if (numberOfIntegerDigits < 0) {\n // There was no decimal point or exponent so it is an integer.\n numberOfIntegerDigits = numStr.length;\n }\n\n // Count the number of leading zeros.\n for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++) {/* jshint noempty: false */}\n\n if (i == (zeros = numStr.length)) {\n // The digits are all zero.\n digits = [0];\n numberOfIntegerDigits = 1;\n } else {\n // Count the number of trailing zeros\n zeros--;\n while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;\n\n // Trailing zeros are insignificant so ignore them\n numberOfIntegerDigits -= i;\n digits = [];\n // Convert string to array of digits without leading/trailing zeros.\n for (j = 0; i <= zeros; i++, j++) {\n digits[j] = +numStr.charAt(i);\n }\n }\n\n // If the number overflows the maximum allowed digits then use an exponent.\n if (numberOfIntegerDigits > MAX_DIGITS) {\n digits = digits.splice(0, MAX_DIGITS - 1);\n exponent = numberOfIntegerDigits - 1;\n numberOfIntegerDigits = 1;\n }\n\n return { d: digits, e: exponent, i: numberOfIntegerDigits };\n}\n\n/**\n * Round the parsed number to the specified number of decimal places\n * This function changed the parsedNumber in-place\n */\nfunction roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {\n var digits = parsedNumber.d;\n var fractionLen = digits.length - parsedNumber.i;\n\n // determine fractionSize if it is not specified; `+fractionSize` converts it to a number\n fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;\n\n // The index of the digit to where rounding is to occur\n var roundAt = fractionSize + parsedNumber.i;\n var digit = digits[roundAt];\n\n if (roundAt > 0) {\n digits.splice(roundAt);\n } else {\n // We rounded to zero so reset the parsedNumber\n parsedNumber.i = 1;\n digits.length = roundAt = fractionSize + 1;\n for (var i=0; i < roundAt; i++) digits[i] = 0;\n }\n\n if (digit >= 5) digits[roundAt - 1]++;\n\n // Pad out with zeros to get the required fraction length\n for (; fractionLen < fractionSize; fractionLen++) digits.push(0);\n\n\n // Do any carrying, e.g. a digit was rounded up to 10\n var carry = digits.reduceRight(function(carry, d, i, digits) {\n d = d + carry;\n digits[i] = d % 10;\n return Math.floor(d / 10);\n }, 0);\n if (carry) {\n digits.unshift(carry);\n parsedNumber.i++;\n }\n}\n\n/**\n * Format a number into a string\n * @param {number} number The number to format\n * @param {{\n * minFrac, // the minimum number of digits required in the fraction part of the number\n * maxFrac, // the maximum number of digits required in the fraction part of the number\n * gSize, // number of digits in each group of separated digits\n * lgSize, // number of digits in the last group of digits before the decimal separator\n * negPre, // the string to go in front of a negative number (e.g. `-` or `(`))\n * posPre, // the string to go in front of a positive number\n * negSuf, // the string to go after a negative number (e.g. `)`)\n * posSuf // the string to go after a positive number\n * }} pattern\n * @param {string} groupSep The string to separate groups of number (e.g. `,`)\n * @param {string} decimalSep The string to act as the decimal separator (e.g. `.`)\n * @param {[type]} fractionSize The size of the fractional part of the number\n * @return {string} The number formatted as a string\n */\nfunction formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {\n\n if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';\n\n var isInfinity = !isFinite(number);\n var isZero = false;\n var numStr = Math.abs(number) + '',\n formattedText = '',\n parsedNumber;\n\n if (isInfinity) {\n formattedText = '\\u221e';\n } else {\n parsedNumber = parse(numStr);\n\n roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);\n\n var digits = parsedNumber.d;\n var integerLen = parsedNumber.i;\n var exponent = parsedNumber.e;\n var decimals = [];\n isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);\n\n // pad zeros for small numbers\n while (integerLen < 0) {\n digits.unshift(0);\n integerLen++;\n }\n\n // extract decimals digits\n if (integerLen > 0) {\n decimals = digits.splice(integerLen, digits.length);\n } else {\n decimals = digits;\n digits = [0];\n }\n\n // format the integer digits with grouping separators\n var groups = [];\n if (digits.length >= pattern.lgSize) {\n groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));\n }\n while (digits.length > pattern.gSize) {\n groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));\n }\n if (digits.length) {\n groups.unshift(digits.join(''));\n }\n formattedText = groups.join(groupSep);\n\n // append the decimal digits\n if (decimals.length) {\n formattedText += decimalSep + decimals.join('');\n }\n\n if (exponent) {\n formattedText += 'e+' + exponent;\n }\n }\n if (number < 0 && !isZero) {\n return pattern.negPre + formattedText + pattern.negSuf;\n } else {\n return pattern.posPre + formattedText + pattern.posSuf;\n }\n}\n\nfunction padNumber(num, digits, trim) {\n var neg = '';\n if (num < 0) {\n neg = '-';\n num = -num;\n }\n num = '' + num;\n while (num.length < digits) num = ZERO_CHAR + num;\n if (trim) {\n num = num.substr(num.length - digits);\n }\n return neg + num;\n}\n\n\nfunction dateGetter(name, size, offset, trim) {\n offset = offset || 0;\n return function(date) {\n var value = date['get' + name]();\n if (offset > 0 || value > -offset) {\n value += offset;\n }\n if (value === 0 && offset == -12) value = 12;\n return padNumber(value, size, trim);\n };\n}\n\nfunction dateStrGetter(name, shortForm) {\n return function(date, formats) {\n var value = date['get' + name]();\n var get = uppercase(shortForm ? ('SHORT' + name) : name);\n\n return formats[get][value];\n };\n}\n\nfunction timeZoneGetter(date, formats, offset) {\n var zone = -1 * offset;\n var paddedZone = (zone >= 0) ? \"+\" : \"\";\n\n paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +\n padNumber(Math.abs(zone % 60), 2);\n\n return paddedZone;\n}\n\nfunction getFirstThursdayOfYear(year) {\n // 0 = index of January\n var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();\n // 4 = index of Thursday (+1 to account for 1st = 5)\n // 11 = index of *next* Thursday (+1 account for 1st = 12)\n return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);\n}\n\nfunction getThursdayThisWeek(datetime) {\n return new Date(datetime.getFullYear(), datetime.getMonth(),\n // 4 = index of Thursday\n datetime.getDate() + (4 - datetime.getDay()));\n}\n\nfunction weekGetter(size) {\n return function(date) {\n var firstThurs = getFirstThursdayOfYear(date.getFullYear()),\n thisThurs = getThursdayThisWeek(date);\n\n var diff = +thisThurs - +firstThurs,\n result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week\n\n return padNumber(result, size);\n };\n}\n\nfunction ampmGetter(date, formats) {\n return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];\n}\n\nfunction eraGetter(date, formats) {\n return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];\n}\n\nfunction longEraGetter(date, formats) {\n return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];\n}\n\nvar DATE_FORMATS = {\n yyyy: dateGetter('FullYear', 4),\n yy: dateGetter('FullYear', 2, 0, true),\n y: dateGetter('FullYear', 1),\n MMMM: dateStrGetter('Month'),\n MMM: dateStrGetter('Month', true),\n MM: dateGetter('Month', 2, 1),\n M: dateGetter('Month', 1, 1),\n dd: dateGetter('Date', 2),\n d: dateGetter('Date', 1),\n HH: dateGetter('Hours', 2),\n H: dateGetter('Hours', 1),\n hh: dateGetter('Hours', 2, -12),\n h: dateGetter('Hours', 1, -12),\n mm: dateGetter('Minutes', 2),\n m: dateGetter('Minutes', 1),\n ss: dateGetter('Seconds', 2),\n s: dateGetter('Seconds', 1),\n // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions\n sss: dateGetter('Milliseconds', 3),\n EEEE: dateStrGetter('Day'),\n EEE: dateStrGetter('Day', true),\n a: ampmGetter,\n Z: timeZoneGetter,\n ww: weekGetter(2),\n w: weekGetter(1),\n G: eraGetter,\n GG: eraGetter,\n GGG: eraGetter,\n GGGG: longEraGetter\n};\n\nvar DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,\n NUMBER_STRING = /^\\-?\\d+$/;\n\n/**\n * @ngdoc filter\n * @name date\n * @kind function\n *\n * @description\n * Formats `date` to a string based on the requested `format`.\n *\n * `format` string can be composed of the following elements:\n *\n * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)\n * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)\n * * `'MMMM'`: Month in year (January-December)\n * * `'MMM'`: Month in year (Jan-Dec)\n * * `'MM'`: Month in year, padded (01-12)\n * * `'M'`: Month in year (1-12)\n * * `'dd'`: Day in month, padded (01-31)\n * * `'d'`: Day in month (1-31)\n * * `'EEEE'`: Day in Week,(Sunday-Saturday)\n * * `'EEE'`: Day in Week, (Sun-Sat)\n * * `'HH'`: Hour in day, padded (00-23)\n * * `'H'`: Hour in day (0-23)\n * * `'hh'`: Hour in AM/PM, padded (01-12)\n * * `'h'`: Hour in AM/PM, (1-12)\n * * `'mm'`: Minute in hour, padded (00-59)\n * * `'m'`: Minute in hour (0-59)\n * * `'ss'`: Second in minute, padded (00-59)\n * * `'s'`: Second in minute (0-59)\n * * `'sss'`: Millisecond in second, padded (000-999)\n * * `'a'`: AM/PM marker\n * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)\n * * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year\n * * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year\n * * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')\n * * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')\n *\n * `format` string can also be one of the following predefined\n * {@link guide/i18n localizable formats}:\n *\n * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale\n * (e.g. Sep 3, 2010 12:05:08 PM)\n * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 PM)\n * * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US locale\n * (e.g. Friday, September 3, 2010)\n * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010)\n * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010)\n * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)\n * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)\n * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)\n *\n * `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.\n * `\"h 'in the morning'\"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence\n * (e.g. `\"h 'o''clock'\"`).\n *\n * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or\n * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its\n * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is\n * specified in the string input, the time is considered to be in the local timezone.\n * @param {string=} format Formatting rules (see Description). If not specified,\n * `mediumDate` is used.\n * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the\n * continental US time zone abbreviations, but for general use, use a time zone offset, for\n * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n * If not specified, the timezone of the browser will be used.\n * @returns {string} Formatted string or the input if input is not recognized as date/millis.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:\n <span>{{1288323623006 | date:'medium'}}</span><br>\n <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:\n <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>\n <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:\n <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>\n <span ng-non-bindable>{{1288323623006 | date:\"MM/dd/yyyy 'at' h:mma\"}}</span>:\n <span>{{'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"}}</span><br>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should format date', function() {\n expect(element(by.binding(\"1288323623006 | date:'medium'\")).getText()).\n toMatch(/Oct 2\\d, 2010 \\d{1,2}:\\d{2}:\\d{2} (AM|PM)/);\n expect(element(by.binding(\"1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'\")).getText()).\n toMatch(/2010\\-10\\-2\\d \\d{2}:\\d{2}:\\d{2} (\\-|\\+)?\\d{4}/);\n expect(element(by.binding(\"'1288323623006' | date:'MM/dd/yyyy @ h:mma'\")).getText()).\n toMatch(/10\\/2\\d\\/2010 @ \\d{1,2}:\\d{2}(AM|PM)/);\n expect(element(by.binding(\"'1288323623006' | date:\\\"MM/dd/yyyy 'at' h:mma\\\"\")).getText()).\n toMatch(/10\\/2\\d\\/2010 at \\d{1,2}:\\d{2}(AM|PM)/);\n });\n </file>\n </example>\n */\ndateFilter.$inject = ['$locale'];\nfunction dateFilter($locale) {\n\n\n var R_ISO8601_STR = /^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n // 1 2 3 4 5 6 7 8 9 10 11\n function jsonStringToDate(string) {\n var match;\n if (match = string.match(R_ISO8601_STR)) {\n var date = new Date(0),\n tzHour = 0,\n tzMin = 0,\n dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,\n timeSetter = match[8] ? date.setUTCHours : date.setHours;\n\n if (match[9]) {\n tzHour = toInt(match[9] + match[10]);\n tzMin = toInt(match[9] + match[11]);\n }\n dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));\n var h = toInt(match[4] || 0) - tzHour;\n var m = toInt(match[5] || 0) - tzMin;\n var s = toInt(match[6] || 0);\n var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n }\n return string;\n }\n\n\n return function(date, format, timezone) {\n var text = '',\n parts = [],\n fn, match;\n\n format = format || 'mediumDate';\n format = $locale.DATETIME_FORMATS[format] || format;\n if (isString(date)) {\n date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);\n }\n\n if (isNumber(date)) {\n date = new Date(date);\n }\n\n if (!isDate(date) || !isFinite(date.getTime())) {\n return date;\n }\n\n while (format) {\n match = DATE_FORMATS_SPLIT.exec(format);\n if (match) {\n parts = concat(parts, match, 1);\n format = parts.pop();\n } else {\n parts.push(format);\n format = null;\n }\n }\n\n var dateTimezoneOffset = date.getTimezoneOffset();\n if (timezone) {\n dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n date = convertTimezoneToLocal(date, timezone, true);\n }\n forEach(parts, function(value) {\n fn = DATE_FORMATS[value];\n text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)\n : value === \"''\" ? \"'\" : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n });\n\n return text;\n };\n}\n\n\n/**\n * @ngdoc filter\n * @name json\n * @kind function\n *\n * @description\n * Allows you to convert a JavaScript object into JSON string.\n *\n * This filter is mostly useful for debugging. When using the double curly {{value}} notation\n * the binding is automatically converted to JSON.\n *\n * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.\n * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.\n * @returns {string} JSON string.\n *\n *\n * @example\n <example>\n <file name=\"index.html\">\n <pre id=\"default-spacing\">{{ {'name':'value'} | json }}</pre>\n <pre id=\"custom-spacing\">{{ {'name':'value'} | json:4 }}</pre>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should jsonify filtered objects', function() {\n expect(element(by.id('default-spacing')).getText()).toMatch(/\\{\\n \"name\": ?\"value\"\\n}/);\n expect(element(by.id('custom-spacing')).getText()).toMatch(/\\{\\n \"name\": ?\"value\"\\n}/);\n });\n </file>\n </example>\n *\n */\nfunction jsonFilter() {\n return function(object, spacing) {\n if (isUndefined(spacing)) {\n spacing = 2;\n }\n return toJson(object, spacing);\n };\n}\n\n\n/**\n * @ngdoc filter\n * @name lowercase\n * @kind function\n * @description\n * Converts string to lowercase.\n * @see angular.lowercase\n */\nvar lowercaseFilter = valueFn(lowercase);\n\n\n/**\n * @ngdoc filter\n * @name uppercase\n * @kind function\n * @description\n * Converts string to uppercase.\n * @see angular.uppercase\n */\nvar uppercaseFilter = valueFn(uppercase);\n\n/**\n * @ngdoc filter\n * @name limitTo\n * @kind function\n *\n * @description\n * Creates a new array or string containing only a specified number of elements. The elements\n * are taken from either the beginning or the end of the source array, string or number, as specified by\n * the value and sign (positive or negative) of `limit`. If a number is used as input, it is\n * converted to a string.\n *\n * @param {Array|string|number} input Source array, string or number to be limited.\n * @param {string|number} limit The length of the returned array or string. If the `limit` number\n * is positive, `limit` number of items from the beginning of the source array/string are copied.\n * If the number is negative, `limit` number of items from the end of the source array/string\n * are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,\n * the input will be returned unchanged.\n * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`\n * indicates an offset from the end of `input`. Defaults to `0`.\n * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array\n * had less than `limit` elements.\n *\n * @example\n <example module=\"limitToExample\">\n <file name=\"index.html\">\n <script>\n angular.module('limitToExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.numbers = [1,2,3,4,5,6,7,8,9];\n $scope.letters = \"abcdefghi\";\n $scope.longNumber = 2345432342;\n $scope.numLimit = 3;\n $scope.letterLimit = 3;\n $scope.longNumberLimit = 3;\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <label>\n Limit {{numbers}} to:\n <input type=\"number\" step=\"1\" ng-model=\"numLimit\">\n </label>\n <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>\n <label>\n Limit {{letters}} to:\n <input type=\"number\" step=\"1\" ng-model=\"letterLimit\">\n </label>\n <p>Output letters: {{ letters | limitTo:letterLimit }}</p>\n <label>\n Limit {{longNumber}} to:\n <input type=\"number\" step=\"1\" ng-model=\"longNumberLimit\">\n </label>\n <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var numLimitInput = element(by.model('numLimit'));\n var letterLimitInput = element(by.model('letterLimit'));\n var longNumberLimitInput = element(by.model('longNumberLimit'));\n var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));\n var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));\n var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));\n\n it('should limit the number array to first three items', function() {\n expect(numLimitInput.getAttribute('value')).toBe('3');\n expect(letterLimitInput.getAttribute('value')).toBe('3');\n expect(longNumberLimitInput.getAttribute('value')).toBe('3');\n expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');\n expect(limitedLetters.getText()).toEqual('Output letters: abc');\n expect(limitedLongNumber.getText()).toEqual('Output long number: 234');\n });\n\n // There is a bug in safari and protractor that doesn't like the minus key\n // it('should update the output when -3 is entered', function() {\n // numLimitInput.clear();\n // numLimitInput.sendKeys('-3');\n // letterLimitInput.clear();\n // letterLimitInput.sendKeys('-3');\n // longNumberLimitInput.clear();\n // longNumberLimitInput.sendKeys('-3');\n // expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');\n // expect(limitedLetters.getText()).toEqual('Output letters: ghi');\n // expect(limitedLongNumber.getText()).toEqual('Output long number: 342');\n // });\n\n it('should not exceed the maximum size of input array', function() {\n numLimitInput.clear();\n numLimitInput.sendKeys('100');\n letterLimitInput.clear();\n letterLimitInput.sendKeys('100');\n longNumberLimitInput.clear();\n longNumberLimitInput.sendKeys('100');\n expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');\n expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');\n expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');\n });\n </file>\n </example>\n*/\nfunction limitToFilter() {\n return function(input, limit, begin) {\n if (Math.abs(Number(limit)) === Infinity) {\n limit = Number(limit);\n } else {\n limit = toInt(limit);\n }\n if (isNaN(limit)) return input;\n\n if (isNumber(input)) input = input.toString();\n if (!isArray(input) && !isString(input)) return input;\n\n begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);\n begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;\n\n if (limit >= 0) {\n return input.slice(begin, begin + limit);\n } else {\n if (begin === 0) {\n return input.slice(limit, input.length);\n } else {\n return input.slice(Math.max(0, begin + limit), begin);\n }\n }\n };\n}\n\n/**\n * @ngdoc filter\n * @name orderBy\n * @kind function\n *\n * @description\n * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically\n * for strings and numerically for numbers. Note: if you notice numbers are not being sorted\n * as expected, make sure they are actually being saved as numbers and not strings.\n *\n * @param {Array} array The array to sort.\n * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be\n * used by the comparator to determine the order of elements.\n *\n * Can be one of:\n *\n * - `function`: Getter function. The result of this function will be sorted using the\n * `<`, `===`, `>` operator.\n * - `string`: An Angular expression. The result of this expression is used to compare elements\n * (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by\n * 3 first characters of a property called `name`). The result of a constant expression\n * is interpreted as a property name to be used in comparisons (for example `\"special name\"`\n * to sort object by the value of their `special name` property). An expression can be\n * optionally prefixed with `+` or `-` to control ascending or descending sort order\n * (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array\n * element itself is used to compare where sorting.\n * - `Array`: An array of function or string predicates. The first predicate in the array\n * is used for sorting, but when two items are equivalent, the next predicate is used.\n *\n * If the predicate is missing or empty then it defaults to `'+'`.\n *\n * @param {boolean=} reverse Reverse the order of the array.\n * @returns {Array} Sorted copy of the source array.\n *\n *\n * @example\n * The example below demonstrates a simple ngRepeat, where the data is sorted\n * by age in descending order (predicate is set to `'-age'`).\n * `reverse` is not set, which means it defaults to `false`.\n <example module=\"orderByExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <table class=\"friend\">\n <tr>\n <th>Name</th>\n <th>Phone Number</th>\n <th>Age</th>\n </tr>\n <tr ng-repeat=\"friend in friends | orderBy:'-age'\">\n <td>{{friend.name}}</td>\n <td>{{friend.phone}}</td>\n <td>{{friend.age}}</td>\n </tr>\n </table>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('orderByExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.friends =\n [{name:'John', phone:'555-1212', age:10},\n {name:'Mary', phone:'555-9876', age:19},\n {name:'Mike', phone:'555-4321', age:21},\n {name:'Adam', phone:'555-5678', age:35},\n {name:'Julie', phone:'555-8765', age:29}];\n }]);\n </file>\n </example>\n *\n * The predicate and reverse parameters can be controlled dynamically through scope properties,\n * as shown in the next example.\n * @example\n <example module=\"orderByExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n <hr/>\n <button ng-click=\"predicate=''\">Set to unsorted</button>\n <table class=\"friend\">\n <tr>\n <th>\n <button ng-click=\"order('name')\">Name</button>\n <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n </th>\n <th>\n <button ng-click=\"order('phone')\">Phone Number</button>\n <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n </th>\n <th>\n <button ng-click=\"order('age')\">Age</button>\n <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n </th>\n </tr>\n <tr ng-repeat=\"friend in friends | orderBy:predicate:reverse\">\n <td>{{friend.name}}</td>\n <td>{{friend.phone}}</td>\n <td>{{friend.age}}</td>\n </tr>\n </table>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('orderByExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.friends =\n [{name:'John', phone:'555-1212', age:10},\n {name:'Mary', phone:'555-9876', age:19},\n {name:'Mike', phone:'555-4321', age:21},\n {name:'Adam', phone:'555-5678', age:35},\n {name:'Julie', phone:'555-8765', age:29}];\n $scope.predicate = 'age';\n $scope.reverse = true;\n $scope.order = function(predicate) {\n $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n $scope.predicate = predicate;\n };\n }]);\n </file>\n <file name=\"style.css\">\n .sortorder:after {\n content: '\\25b2';\n }\n .sortorder.reverse:after {\n content: '\\25bc';\n }\n </file>\n </example>\n *\n * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the\n * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the\n * desired parameters.\n *\n * Example:\n *\n * @example\n <example module=\"orderByExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n <table class=\"friend\">\n <tr>\n <th>\n <button ng-click=\"order('name')\">Name</button>\n <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n </th>\n <th>\n <button ng-click=\"order('phone')\">Phone Number</button>\n <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n </th>\n <th>\n <button ng-click=\"order('age')\">Age</button>\n <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n </th>\n </tr>\n <tr ng-repeat=\"friend in friends\">\n <td>{{friend.name}}</td>\n <td>{{friend.phone}}</td>\n <td>{{friend.age}}</td>\n </tr>\n </table>\n </div>\n </file>\n\n <file name=\"script.js\">\n angular.module('orderByExample', [])\n .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {\n var orderBy = $filter('orderBy');\n $scope.friends = [\n { name: 'John', phone: '555-1212', age: 10 },\n { name: 'Mary', phone: '555-9876', age: 19 },\n { name: 'Mike', phone: '555-4321', age: 21 },\n { name: 'Adam', phone: '555-5678', age: 35 },\n { name: 'Julie', phone: '555-8765', age: 29 }\n ];\n $scope.order = function(predicate) {\n $scope.predicate = predicate;\n $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);\n };\n $scope.order('age', true);\n }]);\n </file>\n\n <file name=\"style.css\">\n .sortorder:after {\n content: '\\25b2';\n }\n .sortorder.reverse:after {\n content: '\\25bc';\n }\n </file>\n</example>\n */\norderByFilter.$inject = ['$parse'];\nfunction orderByFilter($parse) {\n return function(array, sortPredicate, reverseOrder) {\n\n if (!(isArrayLike(array))) return array;\n\n if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }\n if (sortPredicate.length === 0) { sortPredicate = ['+']; }\n\n var predicates = processPredicates(sortPredicate, reverseOrder);\n // Add a predicate at the end that evaluates to the element index. This makes the\n // sort stable as it works as a tie-breaker when all the input predicates cannot\n // distinguish between two elements.\n predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});\n\n // The next three lines are a version of a Swartzian Transform idiom from Perl\n // (sometimes called the Decorate-Sort-Undecorate idiom)\n // See https://en.wikipedia.org/wiki/Schwartzian_transform\n var compareValues = Array.prototype.map.call(array, getComparisonObject);\n compareValues.sort(doComparison);\n array = compareValues.map(function(item) { return item.value; });\n\n return array;\n\n function getComparisonObject(value, index) {\n return {\n value: value,\n predicateValues: predicates.map(function(predicate) {\n return getPredicateValue(predicate.get(value), index);\n })\n };\n }\n\n function doComparison(v1, v2) {\n var result = 0;\n for (var index=0, length = predicates.length; index < length; ++index) {\n result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;\n if (result) break;\n }\n return result;\n }\n };\n\n function processPredicates(sortPredicate, reverseOrder) {\n reverseOrder = reverseOrder ? -1 : 1;\n return sortPredicate.map(function(predicate) {\n var descending = 1, get = identity;\n\n if (isFunction(predicate)) {\n get = predicate;\n } else if (isString(predicate)) {\n if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {\n descending = predicate.charAt(0) == '-' ? -1 : 1;\n predicate = predicate.substring(1);\n }\n if (predicate !== '') {\n get = $parse(predicate);\n if (get.constant) {\n var key = get();\n get = function(value) { return value[key]; };\n }\n }\n }\n return { get: get, descending: descending * reverseOrder };\n });\n }\n\n function isPrimitive(value) {\n switch (typeof value) {\n case 'number': /* falls through */\n case 'boolean': /* falls through */\n case 'string':\n return true;\n default:\n return false;\n }\n }\n\n function objectValue(value, index) {\n // If `valueOf` is a valid function use that\n if (typeof value.valueOf === 'function') {\n value = value.valueOf();\n if (isPrimitive(value)) return value;\n }\n // If `toString` is a valid function and not the one from `Object.prototype` use that\n if (hasCustomToString(value)) {\n value = value.toString();\n if (isPrimitive(value)) return value;\n }\n // We have a basic object so we use the position of the object in the collection\n return index;\n }\n\n function getPredicateValue(value, index) {\n var type = typeof value;\n if (value === null) {\n type = 'string';\n value = 'null';\n } else if (type === 'string') {\n value = value.toLowerCase();\n } else if (type === 'object') {\n value = objectValue(value, index);\n }\n return { value: value, type: type };\n }\n\n function compare(v1, v2) {\n var result = 0;\n if (v1.type === v2.type) {\n if (v1.value !== v2.value) {\n result = v1.value < v2.value ? -1 : 1;\n }\n } else {\n result = v1.type < v2.type ? -1 : 1;\n }\n return result;\n }\n}\n\nfunction ngDirective(directive) {\n if (isFunction(directive)) {\n directive = {\n link: directive\n };\n }\n directive.restrict = directive.restrict || 'AC';\n return valueFn(directive);\n}\n\n/**\n * @ngdoc directive\n * @name a\n * @restrict E\n *\n * @description\n * Modifies the default behavior of the html A tag so that the default action is prevented when\n * the href attribute is empty.\n *\n * This change permits the easy creation of action links with the `ngClick` directive\n * without changing the location or causing page reloads, e.g.:\n * `<a href=\"\" ng-click=\"list.addItem()\">Add Item</a>`\n */\nvar htmlAnchorDirective = valueFn({\n restrict: 'E',\n compile: function(element, attr) {\n if (!attr.href && !attr.xlinkHref) {\n return function(scope, element) {\n // If the linked element is not an anchor tag anymore, do nothing\n if (element[0].nodeName.toLowerCase() !== 'a') return;\n\n // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?\n 'xlink:href' : 'href';\n element.on('click', function(event) {\n // if we have no href url, then don't navigate anywhere.\n if (!element.attr(href)) {\n event.preventDefault();\n }\n });\n };\n }\n }\n});\n\n/**\n * @ngdoc directive\n * @name ngHref\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in an href attribute will\n * make the link go to the wrong URL if the user clicks it before\n * Angular has a chance to replace the `{{hash}}` markup with its\n * value. Until Angular replaces the markup the link will be broken\n * and will most likely return a 404 error. The `ngHref` directive\n * solves this problem.\n *\n * The wrong way to write it:\n * ```html\n * <a href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <a ng-href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * @element A\n * @param {template} ngHref any string which can contain `{{}}` markup.\n *\n * @example\n * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes\n * in links and their different behaviors:\n <example>\n <file name=\"index.html\">\n <input ng-model=\"value\" /><br />\n <a id=\"link-1\" href ng-click=\"value = 1\">link 1</a> (link, don't reload)<br />\n <a id=\"link-2\" href=\"\" ng-click=\"value = 2\">link 2</a> (link, don't reload)<br />\n <a id=\"link-3\" ng-href=\"/{{'123'}}\">link 3</a> (link, reload!)<br />\n <a id=\"link-4\" href=\"\" name=\"xx\" ng-click=\"value = 4\">anchor</a> (link, don't reload)<br />\n <a id=\"link-5\" name=\"xxx\" ng-click=\"value = 5\">anchor</a> (no link)<br />\n <a id=\"link-6\" ng-href=\"{{value}}\">link</a> (link, change location)\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should execute ng-click but not reload when href without value', function() {\n element(by.id('link-1')).click();\n expect(element(by.model('value')).getAttribute('value')).toEqual('1');\n expect(element(by.id('link-1')).getAttribute('href')).toBe('');\n });\n\n it('should execute ng-click but not reload when href empty string', function() {\n element(by.id('link-2')).click();\n expect(element(by.model('value')).getAttribute('value')).toEqual('2');\n expect(element(by.id('link-2')).getAttribute('href')).toBe('');\n });\n\n it('should execute ng-click and change url when ng-href specified', function() {\n expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\\/123$/);\n\n element(by.id('link-3')).click();\n\n // At this point, we navigate away from an Angular page, so we need\n // to use browser.driver to get the base webdriver.\n\n browser.wait(function() {\n return browser.driver.getCurrentUrl().then(function(url) {\n return url.match(/\\/123$/);\n });\n }, 5000, 'page should navigate to /123');\n });\n\n it('should execute ng-click but not reload when href empty string and name specified', function() {\n element(by.id('link-4')).click();\n expect(element(by.model('value')).getAttribute('value')).toEqual('4');\n expect(element(by.id('link-4')).getAttribute('href')).toBe('');\n });\n\n it('should execute ng-click but not reload when no href but name specified', function() {\n element(by.id('link-5')).click();\n expect(element(by.model('value')).getAttribute('value')).toEqual('5');\n expect(element(by.id('link-5')).getAttribute('href')).toBe(null);\n });\n\n it('should only change url when only ng-href', function() {\n element(by.model('value')).clear();\n element(by.model('value')).sendKeys('6');\n expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\\/6$/);\n\n element(by.id('link-6')).click();\n\n // At this point, we navigate away from an Angular page, so we need\n // to use browser.driver to get the base webdriver.\n browser.wait(function() {\n return browser.driver.getCurrentUrl().then(function(url) {\n return url.match(/\\/6$/);\n });\n }, 5000, 'page should navigate to /6');\n });\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSrc\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `src` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrc` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrc any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngSrcset\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrcset` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrcset any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngDisabled\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * This directive sets the `disabled` attribute on the element if the\n * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `disabled`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <label>Click me to toggle: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n <button ng-model=\"button\" ng-disabled=\"checked\">Button</button>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should toggle button', function() {\n expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();\n element(by.model('checked')).click();\n expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();\n });\n </file>\n </example>\n *\n * @element INPUT\n * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,\n * then the `disabled` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngChecked\n * @restrict A\n * @priority 100\n *\n * @description\n * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.\n *\n * Note that this directive should not be used together with {@link ngModel `ngModel`},\n * as this can lead to unexpected behavior.\n *\n * A special directive is necessary because we cannot use interpolation inside the `checked`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <label>Check me to check both: <input type=\"checkbox\" ng-model=\"master\"></label><br/>\n <input id=\"checkSlave\" type=\"checkbox\" ng-checked=\"master\" aria-label=\"Slave input\">\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check both checkBoxes', function() {\n expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();\n element(by.model('master')).click();\n expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();\n });\n </file>\n </example>\n *\n * @element INPUT\n * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,\n * then the `checked` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngReadonly\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `readOnly`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <label>Check me to make text readonly: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n <input type=\"text\" ng-readonly=\"checked\" value=\"I'm Angular\" aria-label=\"Readonly field\" />\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should toggle readonly attr', function() {\n expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeFalsy();\n element(by.model('checked')).click();\n expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeTruthy();\n });\n </file>\n </example>\n *\n * @element INPUT\n * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,\n * then special attribute \"readonly\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSelected\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `selected`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <label>Check me to select: <input type=\"checkbox\" ng-model=\"selected\"></label><br/>\n <select aria-label=\"ngSelected demo\">\n <option>Hello!</option>\n <option id=\"greet\" ng-selected=\"selected\">Greetings!</option>\n </select>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should select Greetings!', function() {\n expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();\n element(by.model('selected')).click();\n expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();\n });\n </file>\n </example>\n *\n * @element OPTION\n * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,\n * then special attribute \"selected\" will be set on the element\n */\n\n/**\n * @ngdoc directive\n * @name ngOpen\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `open`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <label>Check me check multiple: <input type=\"checkbox\" ng-model=\"open\"></label><br/>\n <details id=\"details\" ng-open=\"open\">\n <summary>Show/Hide me</summary>\n </details>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should toggle open', function() {\n expect(element(by.id('details')).getAttribute('open')).toBeFalsy();\n element(by.model('open')).click();\n expect(element(by.id('details')).getAttribute('open')).toBeTruthy();\n });\n </file>\n </example>\n *\n * @element DETAILS\n * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,\n * then special attribute \"open\" will be set on the element\n */\n\nvar ngAttributeAliasDirectives = {};\n\n// boolean attrs are evaluated\nforEach(BOOLEAN_ATTR, function(propName, attrName) {\n // binding to multiple is not supported\n if (propName == \"multiple\") return;\n\n function defaultLinkFn(scope, element, attr) {\n scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {\n attr.$set(attrName, !!value);\n });\n }\n\n var normalized = directiveNormalize('ng-' + attrName);\n var linkFn = defaultLinkFn;\n\n if (propName === 'checked') {\n linkFn = function(scope, element, attr) {\n // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input\n if (attr.ngModel !== attr[normalized]) {\n defaultLinkFn(scope, element, attr);\n }\n };\n }\n\n ngAttributeAliasDirectives[normalized] = function() {\n return {\n restrict: 'A',\n priority: 100,\n link: linkFn\n };\n };\n});\n\n// aliased input attrs are evaluated\nforEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {\n ngAttributeAliasDirectives[ngAttr] = function() {\n return {\n priority: 100,\n link: function(scope, element, attr) {\n //special case ngPattern when a literal regular expression value\n //is used as the expression (this way we don't have to watch anything).\n if (ngAttr === \"ngPattern\" && attr.ngPattern.charAt(0) == \"/\") {\n var match = attr.ngPattern.match(REGEX_STRING_REGEXP);\n if (match) {\n attr.$set(\"ngPattern\", new RegExp(match[1], match[2]));\n return;\n }\n }\n\n scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {\n attr.$set(ngAttr, value);\n });\n }\n };\n };\n});\n\n// ng-src, ng-srcset, ng-href are interpolated\nforEach(['src', 'srcset', 'href'], function(attrName) {\n var normalized = directiveNormalize('ng-' + attrName);\n ngAttributeAliasDirectives[normalized] = function() {\n return {\n priority: 99, // it needs to run after the attributes are interpolated\n link: function(scope, element, attr) {\n var propName = attrName,\n name = attrName;\n\n if (attrName === 'href' &&\n toString.call(element.prop('href')) === '[object SVGAnimatedString]') {\n name = 'xlinkHref';\n attr.$attr[name] = 'xlink:href';\n propName = null;\n }\n\n attr.$observe(normalized, function(value) {\n if (!value) {\n if (attrName === 'href') {\n attr.$set(name, null);\n }\n return;\n }\n\n attr.$set(name, value);\n\n // on IE, if \"ng:src\" directive declaration is used and \"src\" attribute doesn't exist\n // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need\n // to set the property as well to achieve the desired effect.\n // we use attr[attrName] value since $set can sanitize the url.\n if (msie && propName) element.prop(propName, attr[name]);\n });\n }\n };\n };\n});\n\n/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true\n */\nvar nullFormCtrl = {\n $addControl: noop,\n $$renameControl: nullFormRenameControl,\n $removeControl: noop,\n $setValidity: noop,\n $setDirty: noop,\n $setPristine: noop,\n $setSubmitted: noop\n},\nSUBMITTED_CLASS = 'ng-submitted';\n\nfunction nullFormRenameControl(control, name) {\n control.$name = name;\n}\n\n/**\n * @ngdoc type\n * @name form.FormController\n *\n * @property {boolean} $pristine True if user has not interacted with the form yet.\n * @property {boolean} $dirty True if user has already interacted with the form.\n * @property {boolean} $valid True if all of the containing forms and controls are valid.\n * @property {boolean} $invalid True if at least one containing control or form is invalid.\n * @property {boolean} $pending True if at least one containing control or form is pending.\n * @property {boolean} $submitted True if user has submitted the form even if its invalid.\n *\n * @property {Object} $error Is an object hash, containing references to controls or\n * forms with failing validators, where:\n *\n * - keys are validation tokens (error names),\n * - values are arrays of controls or forms that have a failing validator for given error name.\n *\n * Built-in validation tokens:\n *\n * - `email`\n * - `max`\n * - `maxlength`\n * - `min`\n * - `minlength`\n * - `number`\n * - `pattern`\n * - `required`\n * - `url`\n * - `date`\n * - `datetimelocal`\n * - `time`\n * - `week`\n * - `month`\n *\n * @description\n * `FormController` keeps track of all its controls and nested forms as well as the state of them,\n * such as being valid/invalid or dirty/pristine.\n *\n * Each {@link ng.directive:form form} directive creates an instance\n * of `FormController`.\n *\n */\n//asks for $scope to fool the BC controller module\nFormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];\nfunction FormController(element, attrs, $scope, $animate, $interpolate) {\n var form = this,\n controls = [];\n\n // init state\n form.$error = {};\n form.$$success = {};\n form.$pending = undefined;\n form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);\n form.$dirty = false;\n form.$pristine = true;\n form.$valid = true;\n form.$invalid = false;\n form.$submitted = false;\n form.$$parentForm = nullFormCtrl;\n\n /**\n * @ngdoc method\n * @name form.FormController#$rollbackViewValue\n *\n * @description\n * Rollback all form controls pending updates to the `$modelValue`.\n *\n * Updates may be pending by a debounced event or because the input is waiting for a some future\n * event defined in `ng-model-options`. This method is typically needed by the reset button of\n * a form that uses `ng-model-options` to pend updates.\n */\n form.$rollbackViewValue = function() {\n forEach(controls, function(control) {\n control.$rollbackViewValue();\n });\n };\n\n /**\n * @ngdoc method\n * @name form.FormController#$commitViewValue\n *\n * @description\n * Commit all form controls pending updates to the `$modelValue`.\n *\n * Updates may be pending by a debounced event or because the input is waiting for a some future\n * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`\n * usually handles calling this in response to input events.\n */\n form.$commitViewValue = function() {\n forEach(controls, function(control) {\n control.$commitViewValue();\n });\n };\n\n /**\n * @ngdoc method\n * @name form.FormController#$addControl\n * @param {object} control control object, either a {@link form.FormController} or an\n * {@link ngModel.NgModelController}\n *\n * @description\n * Register a control with the form. Input elements using ngModelController do this automatically\n * when they are linked.\n *\n * Note that the current state of the control will not be reflected on the new parent form. This\n * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`\n * state.\n *\n * However, if the method is used programmatically, for example by adding dynamically created controls,\n * or controls that have been previously removed without destroying their corresponding DOM element,\n * it's the developers responsiblity to make sure the current state propagates to the parent form.\n *\n * For example, if an input control is added that is already `$dirty` and has `$error` properties,\n * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.\n */\n form.$addControl = function(control) {\n // Breaking change - before, inputs whose name was \"hasOwnProperty\" were quietly ignored\n // and not added to the scope. Now we throw an error.\n assertNotHasOwnProperty(control.$name, 'input');\n controls.push(control);\n\n if (control.$name) {\n form[control.$name] = control;\n }\n\n control.$$parentForm = form;\n };\n\n // Private API: rename a form control\n form.$$renameControl = function(control, newName) {\n var oldName = control.$name;\n\n if (form[oldName] === control) {\n delete form[oldName];\n }\n form[newName] = control;\n control.$name = newName;\n };\n\n /**\n * @ngdoc method\n * @name form.FormController#$removeControl\n * @param {object} control control object, either a {@link form.FormController} or an\n * {@link ngModel.NgModelController}\n *\n * @description\n * Deregister a control from the form.\n *\n * Input elements using ngModelController do this automatically when they are destroyed.\n *\n * Note that only the removed control's validation state (`$errors`etc.) will be removed from the\n * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be\n * different from case to case. For example, removing the only `$dirty` control from a form may or\n * may not mean that the form is still `$dirty`.\n */\n form.$removeControl = function(control) {\n if (control.$name && form[control.$name] === control) {\n delete form[control.$name];\n }\n forEach(form.$pending, function(value, name) {\n form.$setValidity(name, null, control);\n });\n forEach(form.$error, function(value, name) {\n form.$setValidity(name, null, control);\n });\n forEach(form.$$success, function(value, name) {\n form.$setValidity(name, null, control);\n });\n\n arrayRemove(controls, control);\n control.$$parentForm = nullFormCtrl;\n };\n\n\n /**\n * @ngdoc method\n * @name form.FormController#$setValidity\n *\n * @description\n * Sets the validity of a form control.\n *\n * This method will also propagate to parent forms.\n */\n addSetValidityMethod({\n ctrl: this,\n $element: element,\n set: function(object, property, controller) {\n var list = object[property];\n if (!list) {\n object[property] = [controller];\n } else {\n var index = list.indexOf(controller);\n if (index === -1) {\n list.push(controller);\n }\n }\n },\n unset: function(object, property, controller) {\n var list = object[property];\n if (!list) {\n return;\n }\n arrayRemove(list, controller);\n if (list.length === 0) {\n delete object[property];\n }\n },\n $animate: $animate\n });\n\n /**\n * @ngdoc method\n * @name form.FormController#$setDirty\n *\n * @description\n * Sets the form to a dirty state.\n *\n * This method can be called to add the 'ng-dirty' class and set the form to a dirty\n * state (ng-dirty class). This method will also propagate to parent forms.\n */\n form.$setDirty = function() {\n $animate.removeClass(element, PRISTINE_CLASS);\n $animate.addClass(element, DIRTY_CLASS);\n form.$dirty = true;\n form.$pristine = false;\n form.$$parentForm.$setDirty();\n };\n\n /**\n * @ngdoc method\n * @name form.FormController#$setPristine\n *\n * @description\n * Sets the form to its pristine state.\n *\n * This method can be called to remove the 'ng-dirty' class and set the form to its pristine\n * state (ng-pristine class). This method will also propagate to all the controls contained\n * in this form.\n *\n * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after\n * saving or resetting it.\n */\n form.$setPristine = function() {\n $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);\n form.$dirty = false;\n form.$pristine = true;\n form.$submitted = false;\n forEach(controls, function(control) {\n control.$setPristine();\n });\n };\n\n /**\n * @ngdoc method\n * @name form.FormController#$setUntouched\n *\n * @description\n * Sets the form to its untouched state.\n *\n * This method can be called to remove the 'ng-touched' class and set the form controls to their\n * untouched state (ng-untouched class).\n *\n * Setting a form controls back to their untouched state is often useful when setting the form\n * back to its pristine state.\n */\n form.$setUntouched = function() {\n forEach(controls, function(control) {\n control.$setUntouched();\n });\n };\n\n /**\n * @ngdoc method\n * @name form.FormController#$setSubmitted\n *\n * @description\n * Sets the form to its submitted state.\n */\n form.$setSubmitted = function() {\n $animate.addClass(element, SUBMITTED_CLASS);\n form.$submitted = true;\n form.$$parentForm.$setSubmitted();\n };\n}\n\n/**\n * @ngdoc directive\n * @name ngForm\n * @restrict EAC\n *\n * @description\n * Nestable alias of {@link ng.directive:form `form`} directive. HTML\n * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a\n * sub-group of controls needs to be determined.\n *\n * Note: the purpose of `ngForm` is to group controls,\n * but not to be a replacement for the `<form>` tag with all of its capabilities\n * (e.g. posting to the server, ...).\n *\n * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into\n * related scope, under this name.\n *\n */\n\n /**\n * @ngdoc directive\n * @name form\n * @restrict E\n *\n * @description\n * Directive that instantiates\n * {@link form.FormController FormController}.\n *\n * If the `name` attribute is specified, the form controller is published onto the current scope under\n * this name.\n *\n * # Alias: {@link ng.directive:ngForm `ngForm`}\n *\n * In Angular, forms can be nested. This means that the outer form is valid when all of the child\n * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so\n * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to\n * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group\n * of controls needs to be determined.\n *\n * # CSS classes\n * - `ng-valid` is set if the form is valid.\n * - `ng-invalid` is set if the form is invalid.\n * - `ng-pending` is set if the form is pending.\n * - `ng-pristine` is set if the form is pristine.\n * - `ng-dirty` is set if the form is dirty.\n * - `ng-submitted` is set if the form was submitted.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n *\n * # Submitting a form and preventing the default action\n *\n * Since the role of forms in client-side Angular applications is different than in classical\n * roundtrip apps, it is desirable for the browser not to translate the form submission into a full\n * page reload that sends the data to the server. Instead some javascript logic should be triggered\n * to handle the form submission in an application-specific way.\n *\n * For this reason, Angular prevents the default action (form submission to the server) unless the\n * `<form>` element has an `action` attribute specified.\n *\n * You can use one of the following two ways to specify what javascript method should be called when\n * a form is submitted:\n *\n * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element\n * - {@link ng.directive:ngClick ngClick} directive on the first\n * button or input field of type submit (input[type=submit])\n *\n * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}\n * or {@link ng.directive:ngClick ngClick} directives.\n * This is because of the following form submission rules in the HTML specification:\n *\n * - If a form has only one input field then hitting enter in this field triggers form submit\n * (`ngSubmit`)\n * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter\n * doesn't trigger submit\n * - if a form has one or more input fields and one or more buttons or input[type=submit] then\n * hitting enter in any of the input fields will trigger the click handler on the *first* button or\n * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)\n *\n * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is\n * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * ## Animation Hooks\n *\n * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.\n * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any\n * other validations that are performed within the form. Animations in ngForm are similar to how\n * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well\n * as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style a form element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-form {\n * transition:0.5s linear all;\n * background: white;\n * }\n * .my-form.ng-invalid {\n * background: red;\n * color:white;\n * }\n * </pre>\n *\n * @example\n <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"formExample\">\n <file name=\"index.html\">\n <script>\n angular.module('formExample', [])\n .controller('FormController', ['$scope', function($scope) {\n $scope.userType = 'guest';\n }]);\n </script>\n <style>\n .my-form {\n transition:all linear 0.5s;\n background: transparent;\n }\n .my-form.ng-invalid {\n background: red;\n }\n </style>\n <form name=\"myForm\" ng-controller=\"FormController\" class=\"my-form\">\n userType: <input name=\"input\" ng-model=\"userType\" required>\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">Required!</span><br>\n <code>userType = {{userType}}</code><br>\n <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>\n <code>myForm.input.$error = {{myForm.input.$error}}</code><br>\n <code>myForm.$valid = {{myForm.$valid}}</code><br>\n <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should initialize to model', function() {\n var userType = element(by.binding('userType'));\n var valid = element(by.binding('myForm.input.$valid'));\n\n expect(userType.getText()).toContain('guest');\n expect(valid.getText()).toContain('true');\n });\n\n it('should be invalid if empty', function() {\n var userType = element(by.binding('userType'));\n var valid = element(by.binding('myForm.input.$valid'));\n var userInput = element(by.model('userType'));\n\n userInput.clear();\n userInput.sendKeys('');\n\n expect(userType.getText()).toEqual('userType =');\n expect(valid.getText()).toContain('false');\n });\n </file>\n </example>\n *\n * @param {string=} name Name of the form. If specified, the form controller will be published into\n * related scope, under this name.\n */\nvar formDirectiveFactory = function(isNgForm) {\n return ['$timeout', '$parse', function($timeout, $parse) {\n var formDirective = {\n name: 'form',\n restrict: isNgForm ? 'EAC' : 'E',\n require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form\n controller: FormController,\n compile: function ngFormCompile(formElement, attr) {\n // Setup initial state of the control\n formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);\n\n var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);\n\n return {\n pre: function ngFormPreLink(scope, formElement, attr, ctrls) {\n var controller = ctrls[0];\n\n // if `action` attr is not present on the form, prevent the default action (submission)\n if (!('action' in attr)) {\n // we can't use jq events because if a form is destroyed during submission the default\n // action is not prevented. see #1238\n //\n // IE 9 is not affected because it doesn't fire a submit event and try to do a full\n // page reload if the form was destroyed by submission of the form via a click handler\n // on a button in the form. Looks like an IE9 specific bug.\n var handleFormSubmission = function(event) {\n scope.$apply(function() {\n controller.$commitViewValue();\n controller.$setSubmitted();\n });\n\n event.preventDefault();\n };\n\n addEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n\n // unregister the preventDefault listener so that we don't not leak memory but in a\n // way that will achieve the prevention of the default action.\n formElement.on('$destroy', function() {\n $timeout(function() {\n removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n }, 0, false);\n });\n }\n\n var parentFormCtrl = ctrls[1] || controller.$$parentForm;\n parentFormCtrl.$addControl(controller);\n\n var setter = nameAttr ? getSetter(controller.$name) : noop;\n\n if (nameAttr) {\n setter(scope, controller);\n attr.$observe(nameAttr, function(newValue) {\n if (controller.$name === newValue) return;\n setter(scope, undefined);\n controller.$$parentForm.$$renameControl(controller, newValue);\n setter = getSetter(controller.$name);\n setter(scope, controller);\n });\n }\n formElement.on('$destroy', function() {\n controller.$$parentForm.$removeControl(controller);\n setter(scope, undefined);\n extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards\n });\n }\n };\n }\n };\n\n return formDirective;\n\n function getSetter(expression) {\n if (expression === '') {\n //create an assignable expression, so forms with an empty name can be renamed later\n return $parse('this[\"\"]').assign;\n }\n return $parse(expression).assign || noop;\n }\n }];\n};\n\nvar formDirective = formDirectiveFactory();\nvar ngFormDirective = formDirectiveFactory(true);\n\n/* global VALID_CLASS: false,\n INVALID_CLASS: false,\n PRISTINE_CLASS: false,\n DIRTY_CLASS: false,\n UNTOUCHED_CLASS: false,\n TOUCHED_CLASS: false,\n ngModelMinErr: false,\n*/\n\n// Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231\nvar ISO_DATE_REGEXP = /\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/;\n// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)\n// Note: We are being more lenient, because browsers are too.\n// 1. Scheme\n// 2. Slashes\n// 3. Username\n// 4. Password\n// 5. Hostname\n// 6. Port\n// 7. Path\n// 8. Query\n// 9. Fragment\n// 1111111111111111 222 333333 44444 555555555555555555555555 666 77777777 8888888 999\nvar URL_REGEXP = /^[a-z][a-z\\d.+-]*:\\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\\s:/?#]+|\\[[a-f\\d:]+\\])(?::\\d+)?(?:\\/[^?#]*)?(?:\\?[^#]*)?(?:#.*)?$/i;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;\nvar NUMBER_REGEXP = /^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))([eE][+-]?\\d+)?\\s*$/;\nvar DATE_REGEXP = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nvar DATETIMELOCAL_REGEXP = /^(\\d{4})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\nvar WEEK_REGEXP = /^(\\d{4})-W(\\d\\d)$/;\nvar MONTH_REGEXP = /^(\\d{4})-(\\d\\d)$/;\nvar TIME_REGEXP = /^(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\n\nvar PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown';\nvar PARTIAL_VALIDATION_TYPES = createMap();\nforEach('date,datetime-local,month,time,week'.split(','), function(type) {\n PARTIAL_VALIDATION_TYPES[type] = true;\n});\n\nvar inputType = {\n\n /**\n * @ngdoc input\n * @name input[text]\n *\n * @description\n * Standard HTML text input with angular data binding, inherited by most of the `input` elements.\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Adds `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n * minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n * any length.\n * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n * that contains the regular expression body that will be converted to a regular expression\n * as in the ngPattern directive.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match\n * a RegExp found by evaluating the Angular expression given in the attribute value.\n * If the expression evaluates to a RegExp object, then this is used directly.\n * If the expression evaluates to a string, then it will be converted to a RegExp\n * after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n * `new RegExp('^abc$')`.<br />\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n * This parameter is ignored for input[type=password] controls, which will never trim the\n * input.\n *\n * @example\n <example name=\"text-input-directive\" module=\"textInputExample\">\n <file name=\"index.html\">\n <script>\n angular.module('textInputExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.example = {\n text: 'guest',\n word: /^\\s*\\w*\\s*$/\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"ExampleController\">\n <label>Single word:\n <input type=\"text\" name=\"input\" ng-model=\"example.text\"\n ng-pattern=\"example.word\" required ng-trim=\"false\">\n </label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.pattern\">\n Single word only!</span>\n </div>\n <tt>text = {{example.text}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var text = element(by.binding('example.text'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.text'));\n\n it('should initialize to model', function() {\n expect(text.getText()).toContain('guest');\n expect(valid.getText()).toContain('true');\n });\n\n it('should be invalid if empty', function() {\n input.clear();\n input.sendKeys('');\n\n expect(text.getText()).toEqual('text =');\n expect(valid.getText()).toContain('false');\n });\n\n it('should be invalid if multi word', function() {\n input.clear();\n input.sendKeys('hello world');\n\n expect(valid.getText()).toContain('false');\n });\n </file>\n </example>\n */\n 'text': textInputType,\n\n /**\n * @ngdoc input\n * @name input[date]\n *\n * @description\n * Input with date validation and transformation. In browsers that do not yet support\n * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601\n * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many\n * modern browsers do not yet support this input type, it is important to provide cues to users on the\n * expected input format via a placeholder or label.\n *\n * The model must always be a Date object, otherwise Angular will throw an error.\n * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n *\n * The timezone to be used to read/write the `Date` instance in the model can be defined using\n * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a\n * valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n * (e.g. `min=\"{{minDate | date:'yyyy-MM-dd'}}\"`). Note that `min` will also add native HTML5\n * constraint validation.\n * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be\n * a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n * (e.g. `max=\"{{maxDate | date:'yyyy-MM-dd'}}\"`). Note that `max` will also add native HTML5\n * constraint validation.\n * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string\n * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string\n * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"date-input-directive\" module=\"dateInputExample\">\n <file name=\"index.html\">\n <script>\n angular.module('dateInputExample', [])\n .controller('DateController', ['$scope', function($scope) {\n $scope.example = {\n value: new Date(2013, 9, 22)\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n <label for=\"exampleInput\">Pick a date in 2013:</label>\n <input type=\"date\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n placeholder=\"yyyy-MM-dd\" min=\"2013-01-01\" max=\"2013-12-31\" required />\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.date\">\n Not a valid date!</span>\n </div>\n <tt>value = {{example.value | date: \"yyyy-MM-dd\"}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var value = element(by.binding('example.value | date: \"yyyy-MM-dd\"'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.value'));\n\n // currently protractor/webdriver does not support\n // sending keys to all known HTML5 input controls\n // for various browsers (see https://github.com/angular/protractor/issues/562).\n function setInput(val) {\n // set the value of the element and force validation.\n var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n \"ipt.value = '\" + val + \"';\" +\n \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n browser.executeScript(scr);\n }\n\n it('should initialize to model', function() {\n expect(value.getText()).toContain('2013-10-22');\n expect(valid.getText()).toContain('myForm.input.$valid = true');\n });\n\n it('should be invalid if empty', function() {\n setInput('');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n\n it('should be invalid if over max', function() {\n setInput('2015-01-01');\n expect(value.getText()).toContain('');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n </file>\n </example>\n */\n 'date': createDateInputType('date', DATE_REGEXP,\n createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),\n 'yyyy-MM-dd'),\n\n /**\n * @ngdoc input\n * @name input[datetime-local]\n *\n * @description\n * Input with datetime validation and transformation. In browsers that do not yet support\n * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.\n *\n * The model must always be a Date object, otherwise Angular will throw an error.\n * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n *\n * The timezone to be used to read/write the `Date` instance in the model can be defined using\n * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n * inside this attribute (e.g. `min=\"{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n * Note that `min` will also add native HTML5 constraint validation.\n * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n * This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n * inside this attribute (e.g. `max=\"{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n * Note that `max` will also add native HTML5 constraint validation.\n * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string\n * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string\n * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"datetimelocal-input-directive\" module=\"dateExample\">\n <file name=\"index.html\">\n <script>\n angular.module('dateExample', [])\n .controller('DateController', ['$scope', function($scope) {\n $scope.example = {\n value: new Date(2010, 11, 28, 14, 57)\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n <label for=\"exampleInput\">Pick a date between in 2013:</label>\n <input type=\"datetime-local\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n placeholder=\"yyyy-MM-ddTHH:mm:ss\" min=\"2001-01-01T00:00:00\" max=\"2013-12-31T00:00:00\" required />\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.datetimelocal\">\n Not a valid date!</span>\n </div>\n <tt>value = {{example.value | date: \"yyyy-MM-ddTHH:mm:ss\"}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var value = element(by.binding('example.value | date: \"yyyy-MM-ddTHH:mm:ss\"'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.value'));\n\n // currently protractor/webdriver does not support\n // sending keys to all known HTML5 input controls\n // for various browsers (https://github.com/angular/protractor/issues/562).\n function setInput(val) {\n // set the value of the element and force validation.\n var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n \"ipt.value = '\" + val + \"';\" +\n \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n browser.executeScript(scr);\n }\n\n it('should initialize to model', function() {\n expect(value.getText()).toContain('2010-12-28T14:57:00');\n expect(valid.getText()).toContain('myForm.input.$valid = true');\n });\n\n it('should be invalid if empty', function() {\n setInput('');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n\n it('should be invalid if over max', function() {\n setInput('2015-01-01T23:59:00');\n expect(value.getText()).toContain('');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n </file>\n </example>\n */\n 'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,\n createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),\n 'yyyy-MM-ddTHH:mm:ss.sss'),\n\n /**\n * @ngdoc input\n * @name input[time]\n *\n * @description\n * Input with time validation and transformation. In browsers that do not yet support\n * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a\n * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.\n *\n * The model must always be a Date object, otherwise Angular will throw an error.\n * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n *\n * The timezone to be used to read/write the `Date` instance in the model can be defined using\n * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n * attribute (e.g. `min=\"{{minTime | date:'HH:mm:ss'}}\"`). Note that `min` will also add\n * native HTML5 constraint validation.\n * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n * This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n * attribute (e.g. `max=\"{{maxTime | date:'HH:mm:ss'}}\"`). Note that `max` will also add\n * native HTML5 constraint validation.\n * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the\n * `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the\n * `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"time-input-directive\" module=\"timeExample\">\n <file name=\"index.html\">\n <script>\n angular.module('timeExample', [])\n .controller('DateController', ['$scope', function($scope) {\n $scope.example = {\n value: new Date(1970, 0, 1, 14, 57, 0)\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n <label for=\"exampleInput\">Pick a time between 8am and 5pm:</label>\n <input type=\"time\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n placeholder=\"HH:mm:ss\" min=\"08:00:00\" max=\"17:00:00\" required />\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.time\">\n Not a valid date!</span>\n </div>\n <tt>value = {{example.value | date: \"HH:mm:ss\"}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var value = element(by.binding('example.value | date: \"HH:mm:ss\"'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.value'));\n\n // currently protractor/webdriver does not support\n // sending keys to all known HTML5 input controls\n // for various browsers (https://github.com/angular/protractor/issues/562).\n function setInput(val) {\n // set the value of the element and force validation.\n var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n \"ipt.value = '\" + val + \"';\" +\n \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n browser.executeScript(scr);\n }\n\n it('should initialize to model', function() {\n expect(value.getText()).toContain('14:57:00');\n expect(valid.getText()).toContain('myForm.input.$valid = true');\n });\n\n it('should be invalid if empty', function() {\n setInput('');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n\n it('should be invalid if over max', function() {\n setInput('23:59:00');\n expect(value.getText()).toContain('');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n </file>\n </example>\n */\n 'time': createDateInputType('time', TIME_REGEXP,\n createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),\n 'HH:mm:ss.sss'),\n\n /**\n * @ngdoc input\n * @name input[week]\n *\n * @description\n * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support\n * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n * week format (yyyy-W##), for example: `2013-W02`.\n *\n * The model must always be a Date object, otherwise Angular will throw an error.\n * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n *\n * The timezone to be used to read/write the `Date` instance in the model can be defined using\n * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n * attribute (e.g. `min=\"{{minWeek | date:'yyyy-Www'}}\"`). Note that `min` will also add\n * native HTML5 constraint validation.\n * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n * This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n * attribute (e.g. `max=\"{{maxWeek | date:'yyyy-Www'}}\"`). Note that `max` will also add\n * native HTML5 constraint validation.\n * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"week-input-directive\" module=\"weekExample\">\n <file name=\"index.html\">\n <script>\n angular.module('weekExample', [])\n .controller('DateController', ['$scope', function($scope) {\n $scope.example = {\n value: new Date(2013, 0, 3)\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n <label>Pick a date between in 2013:\n <input id=\"exampleInput\" type=\"week\" name=\"input\" ng-model=\"example.value\"\n placeholder=\"YYYY-W##\" min=\"2012-W32\"\n max=\"2013-W52\" required />\n </label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.week\">\n Not a valid date!</span>\n </div>\n <tt>value = {{example.value | date: \"yyyy-Www\"}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var value = element(by.binding('example.value | date: \"yyyy-Www\"'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.value'));\n\n // currently protractor/webdriver does not support\n // sending keys to all known HTML5 input controls\n // for various browsers (https://github.com/angular/protractor/issues/562).\n function setInput(val) {\n // set the value of the element and force validation.\n var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n \"ipt.value = '\" + val + \"';\" +\n \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n browser.executeScript(scr);\n }\n\n it('should initialize to model', function() {\n expect(value.getText()).toContain('2013-W01');\n expect(valid.getText()).toContain('myForm.input.$valid = true');\n });\n\n it('should be invalid if empty', function() {\n setInput('');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n\n it('should be invalid if over max', function() {\n setInput('2015-W01');\n expect(value.getText()).toContain('');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n </file>\n </example>\n */\n 'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),\n\n /**\n * @ngdoc input\n * @name input[month]\n *\n * @description\n * Input with month validation and transformation. In browsers that do not yet support\n * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n * month format (yyyy-MM), for example: `2009-01`.\n *\n * The model must always be a Date object, otherwise Angular will throw an error.\n * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n * If the model is not set to the first of the month, the next view to model update will set it\n * to the first of the month.\n *\n * The timezone to be used to read/write the `Date` instance in the model can be defined using\n * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n * attribute (e.g. `min=\"{{minMonth | date:'yyyy-MM'}}\"`). Note that `min` will also add\n * native HTML5 constraint validation.\n * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n * This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n * attribute (e.g. `max=\"{{maxMonth | date:'yyyy-MM'}}\"`). Note that `max` will also add\n * native HTML5 constraint validation.\n * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n * the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n * the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"month-input-directive\" module=\"monthExample\">\n <file name=\"index.html\">\n <script>\n angular.module('monthExample', [])\n .controller('DateController', ['$scope', function($scope) {\n $scope.example = {\n value: new Date(2013, 9, 1)\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n <label for=\"exampleInput\">Pick a month in 2013:</label>\n <input id=\"exampleInput\" type=\"month\" name=\"input\" ng-model=\"example.value\"\n placeholder=\"yyyy-MM\" min=\"2013-01\" max=\"2013-12\" required />\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.month\">\n Not a valid month!</span>\n </div>\n <tt>value = {{example.value | date: \"yyyy-MM\"}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var value = element(by.binding('example.value | date: \"yyyy-MM\"'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.value'));\n\n // currently protractor/webdriver does not support\n // sending keys to all known HTML5 input controls\n // for various browsers (https://github.com/angular/protractor/issues/562).\n function setInput(val) {\n // set the value of the element and force validation.\n var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n \"ipt.value = '\" + val + \"';\" +\n \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n browser.executeScript(scr);\n }\n\n it('should initialize to model', function() {\n expect(value.getText()).toContain('2013-10');\n expect(valid.getText()).toContain('myForm.input.$valid = true');\n });\n\n it('should be invalid if empty', function() {\n setInput('');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n\n it('should be invalid if over max', function() {\n setInput('2015-01');\n expect(value.getText()).toContain('');\n expect(valid.getText()).toContain('myForm.input.$valid = false');\n });\n </file>\n </example>\n */\n 'month': createDateInputType('month', MONTH_REGEXP,\n createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),\n 'yyyy-MM'),\n\n /**\n * @ngdoc input\n * @name input[number]\n *\n * @description\n * Text input with number validation and transformation. Sets the `number` validation\n * error if not a valid number.\n *\n * <div class=\"alert alert-warning\">\n * The model must always be of type `number` otherwise Angular will throw an error.\n * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}\n * error docs for more information and an example of how to convert your model if necessary.\n * </div>\n *\n * ## Issues with HTML5 constraint validation\n *\n * In browsers that follow the\n * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),\n * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.\n * If a non-number is entered in the input, the browser will report the value as an empty string,\n * which means the view / model values in `ngModel` and subsequently the scope value\n * will also be an empty string.\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n * minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n * any length.\n * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n * that contains the regular expression body that will be converted to a regular expression\n * as in the ngPattern directive.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match\n * a RegExp found by evaluating the Angular expression given in the attribute value.\n * If the expression evaluates to a RegExp object, then this is used directly.\n * If the expression evaluates to a string, then it will be converted to a RegExp\n * after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n * `new RegExp('^abc$')`.<br />\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"number-input-directive\" module=\"numberExample\">\n <file name=\"index.html\">\n <script>\n angular.module('numberExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.example = {\n value: 12\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"ExampleController\">\n <label>Number:\n <input type=\"number\" name=\"input\" ng-model=\"example.value\"\n min=\"0\" max=\"99\" required>\n </label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.number\">\n Not valid number!</span>\n </div>\n <tt>value = {{example.value}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var value = element(by.binding('example.value'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('example.value'));\n\n it('should initialize to model', function() {\n expect(value.getText()).toContain('12');\n expect(valid.getText()).toContain('true');\n });\n\n it('should be invalid if empty', function() {\n input.clear();\n input.sendKeys('');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('false');\n });\n\n it('should be invalid if over max', function() {\n input.clear();\n input.sendKeys('123');\n expect(value.getText()).toEqual('value =');\n expect(valid.getText()).toContain('false');\n });\n </file>\n </example>\n */\n 'number': numberInputType,\n\n\n /**\n * @ngdoc input\n * @name input[url]\n *\n * @description\n * Text input with URL validation. Sets the `url` validation error key if the content is not a\n * valid URL.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex\n * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify\n * the built-in validators (see the {@link guide/forms Forms guide})\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n * minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n * any length.\n * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n * that contains the regular expression body that will be converted to a regular expression\n * as in the ngPattern directive.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match\n * a RegExp found by evaluating the Angular expression given in the attribute value.\n * If the expression evaluates to a RegExp object, then this is used directly.\n * If the expression evaluates to a string, then it will be converted to a RegExp\n * after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n * `new RegExp('^abc$')`.<br />\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"url-input-directive\" module=\"urlExample\">\n <file name=\"index.html\">\n <script>\n angular.module('urlExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.url = {\n text: 'http://google.com'\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"ExampleController\">\n <label>URL:\n <input type=\"url\" name=\"input\" ng-model=\"url.text\" required>\n <label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.url\">\n Not valid url!</span>\n </div>\n <tt>text = {{url.text}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var text = element(by.binding('url.text'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('url.text'));\n\n it('should initialize to model', function() {\n expect(text.getText()).toContain('http://google.com');\n expect(valid.getText()).toContain('true');\n });\n\n it('should be invalid if empty', function() {\n input.clear();\n input.sendKeys('');\n\n expect(text.getText()).toEqual('text =');\n expect(valid.getText()).toContain('false');\n });\n\n it('should be invalid if not url', function() {\n input.clear();\n input.sendKeys('box');\n\n expect(valid.getText()).toContain('false');\n });\n </file>\n </example>\n */\n 'url': urlInputType,\n\n\n /**\n * @ngdoc input\n * @name input[email]\n *\n * @description\n * Text input with email validation. Sets the `email` validation error key if not a valid email\n * address.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex\n * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can\n * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n * minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n * any length.\n * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n * that contains the regular expression body that will be converted to a regular expression\n * as in the ngPattern directive.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match\n * a RegExp found by evaluating the Angular expression given in the attribute value.\n * If the expression evaluates to a RegExp object, then this is used directly.\n * If the expression evaluates to a string, then it will be converted to a RegExp\n * after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n * `new RegExp('^abc$')`.<br />\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"email-input-directive\" module=\"emailExample\">\n <file name=\"index.html\">\n <script>\n angular.module('emailExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.email = {\n text: 'me@example.com'\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"ExampleController\">\n <label>Email:\n <input type=\"email\" name=\"input\" ng-model=\"email.text\" required>\n </label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n Required!</span>\n <span class=\"error\" ng-show=\"myForm.input.$error.email\">\n Not valid email!</span>\n </div>\n <tt>text = {{email.text}}</tt><br/>\n <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var text = element(by.binding('email.text'));\n var valid = element(by.binding('myForm.input.$valid'));\n var input = element(by.model('email.text'));\n\n it('should initialize to model', function() {\n expect(text.getText()).toContain('me@example.com');\n expect(valid.getText()).toContain('true');\n });\n\n it('should be invalid if empty', function() {\n input.clear();\n input.sendKeys('');\n expect(text.getText()).toEqual('text =');\n expect(valid.getText()).toContain('false');\n });\n\n it('should be invalid if not email', function() {\n input.clear();\n input.sendKeys('xxx');\n\n expect(valid.getText()).toContain('false');\n });\n </file>\n </example>\n */\n 'email': emailInputType,\n\n\n /**\n * @ngdoc input\n * @name input[radio]\n *\n * @description\n * HTML radio button.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string} value The value to which the `ngModel` expression should be set when selected.\n * Note that `value` only supports `string` values, i.e. the scope model needs to be a string,\n * too. Use `ngValue` if you need complex models (`number`, `object`, ...).\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio\n * is selected. Should be used instead of the `value` attribute if you need\n * a non-string `ngModel` (`boolean`, `array`, ...).\n *\n * @example\n <example name=\"radio-input-directive\" module=\"radioExample\">\n <file name=\"index.html\">\n <script>\n angular.module('radioExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.color = {\n name: 'blue'\n };\n $scope.specialValue = {\n \"id\": \"12345\",\n \"value\": \"green\"\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"ExampleController\">\n <label>\n <input type=\"radio\" ng-model=\"color.name\" value=\"red\">\n Red\n </label><br/>\n <label>\n <input type=\"radio\" ng-model=\"color.name\" ng-value=\"specialValue\">\n Green\n </label><br/>\n <label>\n <input type=\"radio\" ng-model=\"color.name\" value=\"blue\">\n Blue\n </label><br/>\n <tt>color = {{color.name | json}}</tt><br/>\n </form>\n Note that `ng-value=\"specialValue\"` sets radio item's value to be the value of `$scope.specialValue`.\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should change state', function() {\n var color = element(by.binding('color.name'));\n\n expect(color.getText()).toContain('blue');\n\n element.all(by.model('color.name')).get(0).click();\n\n expect(color.getText()).toContain('red');\n });\n </file>\n </example>\n */\n 'radio': radioInputType,\n\n\n /**\n * @ngdoc input\n * @name input[checkbox]\n *\n * @description\n * HTML checkbox.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {expression=} ngTrueValue The value to which the expression should be set when selected.\n * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n *\n * @example\n <example name=\"checkbox-input-directive\" module=\"checkboxExample\">\n <file name=\"index.html\">\n <script>\n angular.module('checkboxExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.checkboxModel = {\n value1 : true,\n value2 : 'YES'\n };\n }]);\n </script>\n <form name=\"myForm\" ng-controller=\"ExampleController\">\n <label>Value1:\n <input type=\"checkbox\" ng-model=\"checkboxModel.value1\">\n </label><br/>\n <label>Value2:\n <input type=\"checkbox\" ng-model=\"checkboxModel.value2\"\n ng-true-value=\"'YES'\" ng-false-value=\"'NO'\">\n </label><br/>\n <tt>value1 = {{checkboxModel.value1}}</tt><br/>\n <tt>value2 = {{checkboxModel.value2}}</tt><br/>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should change state', function() {\n var value1 = element(by.binding('checkboxModel.value1'));\n var value2 = element(by.binding('checkboxModel.value2'));\n\n expect(value1.getText()).toContain('true');\n expect(value2.getText()).toContain('YES');\n\n element(by.model('checkboxModel.value1')).click();\n element(by.model('checkboxModel.value2')).click();\n\n expect(value1.getText()).toContain('false');\n expect(value2.getText()).toContain('NO');\n });\n </file>\n </example>\n */\n 'checkbox': checkboxInputType,\n\n 'hidden': noop,\n 'button': noop,\n 'submit': noop,\n 'reset': noop,\n 'file': noop\n};\n\nfunction stringBasedInputType(ctrl) {\n ctrl.$formatters.push(function(value) {\n return ctrl.$isEmpty(value) ? value : value.toString();\n });\n}\n\nfunction textInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n stringBasedInputType(ctrl);\n}\n\nfunction baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n var type = lowercase(element[0].type);\n\n // In composition mode, users are still inputing intermediate text buffer,\n // hold the listener until composition is done.\n // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent\n if (!$sniffer.android) {\n var composing = false;\n\n element.on('compositionstart', function(data) {\n composing = true;\n });\n\n element.on('compositionend', function() {\n composing = false;\n listener();\n });\n }\n\n var timeout;\n\n var listener = function(ev) {\n if (timeout) {\n $browser.defer.cancel(timeout);\n timeout = null;\n }\n if (composing) return;\n var value = element.val(),\n event = ev && ev.type;\n\n // By default we will trim the value\n // If the attribute ng-trim exists we will avoid trimming\n // If input type is 'password', the value is never trimmed\n if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {\n value = trim(value);\n }\n\n // If a control is suffering from bad input (due to native validators), browsers discard its\n // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the\n // control's value is the same empty value twice in a row.\n if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {\n ctrl.$setViewValue(value, event);\n }\n };\n\n // if the browser does support \"input\" event, we are fine - except on IE9 which doesn't fire the\n // input event on backspace, delete or cut\n if ($sniffer.hasEvent('input')) {\n element.on('input', listener);\n } else {\n var deferListener = function(ev, input, origValue) {\n if (!timeout) {\n timeout = $browser.defer(function() {\n timeout = null;\n if (!input || input.value !== origValue) {\n listener(ev);\n }\n });\n }\n };\n\n element.on('keydown', function(event) {\n var key = event.keyCode;\n\n // ignore\n // command modifiers arrows\n if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;\n\n deferListener(event, this, this.value);\n });\n\n // if user modifies input value using context menu in IE, we need \"paste\" and \"cut\" events to catch it\n if ($sniffer.hasEvent('paste')) {\n element.on('paste cut', deferListener);\n }\n }\n\n // if user paste into input using mouse on older browser\n // or form autocomplete on newer browser, we need \"change\" event to catch it\n element.on('change', listener);\n\n // Some native input types (date-family) have the ability to change validity without\n // firing any input/change events.\n // For these event types, when native validators are present and the browser supports the type,\n // check for validity changes on various DOM events.\n if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {\n element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {\n if (!timeout) {\n var validity = this[VALIDITY_STATE_PROPERTY];\n var origBadInput = validity.badInput;\n var origTypeMismatch = validity.typeMismatch;\n timeout = $browser.defer(function() {\n timeout = null;\n if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) {\n listener(ev);\n }\n });\n }\n });\n }\n\n ctrl.$render = function() {\n // Workaround for Firefox validation #12102.\n var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;\n if (element.val() !== value) {\n element.val(value);\n }\n };\n}\n\nfunction weekParser(isoWeek, existingDate) {\n if (isDate(isoWeek)) {\n return isoWeek;\n }\n\n if (isString(isoWeek)) {\n WEEK_REGEXP.lastIndex = 0;\n var parts = WEEK_REGEXP.exec(isoWeek);\n if (parts) {\n var year = +parts[1],\n week = +parts[2],\n hours = 0,\n minutes = 0,\n seconds = 0,\n milliseconds = 0,\n firstThurs = getFirstThursdayOfYear(year),\n addDays = (week - 1) * 7;\n\n if (existingDate) {\n hours = existingDate.getHours();\n minutes = existingDate.getMinutes();\n seconds = existingDate.getSeconds();\n milliseconds = existingDate.getMilliseconds();\n }\n\n return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);\n }\n }\n\n return NaN;\n}\n\nfunction createDateParser(regexp, mapping) {\n return function(iso, date) {\n var parts, map;\n\n if (isDate(iso)) {\n return iso;\n }\n\n if (isString(iso)) {\n // When a date is JSON'ified to wraps itself inside of an extra\n // set of double quotes. This makes the date parsing code unable\n // to match the date string and parse it as a date.\n if (iso.charAt(0) == '\"' && iso.charAt(iso.length - 1) == '\"') {\n iso = iso.substring(1, iso.length - 1);\n }\n if (ISO_DATE_REGEXP.test(iso)) {\n return new Date(iso);\n }\n regexp.lastIndex = 0;\n parts = regexp.exec(iso);\n\n if (parts) {\n parts.shift();\n if (date) {\n map = {\n yyyy: date.getFullYear(),\n MM: date.getMonth() + 1,\n dd: date.getDate(),\n HH: date.getHours(),\n mm: date.getMinutes(),\n ss: date.getSeconds(),\n sss: date.getMilliseconds() / 1000\n };\n } else {\n map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };\n }\n\n forEach(parts, function(part, index) {\n if (index < mapping.length) {\n map[mapping[index]] = +part;\n }\n });\n return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);\n }\n }\n\n return NaN;\n };\n}\n\nfunction createDateInputType(type, regexp, parseDate, format) {\n return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {\n badInputChecker(scope, element, attr, ctrl);\n baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;\n var previousDate;\n\n ctrl.$$parserName = type;\n ctrl.$parsers.push(function(value) {\n if (ctrl.$isEmpty(value)) return null;\n if (regexp.test(value)) {\n // Note: We cannot read ctrl.$modelValue, as there might be a different\n // parser/formatter in the processing chain so that the model\n // contains some different data format!\n var parsedDate = parseDate(value, previousDate);\n if (timezone) {\n parsedDate = convertTimezoneToLocal(parsedDate, timezone);\n }\n return parsedDate;\n }\n return undefined;\n });\n\n ctrl.$formatters.push(function(value) {\n if (value && !isDate(value)) {\n throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);\n }\n if (isValidDate(value)) {\n previousDate = value;\n if (previousDate && timezone) {\n previousDate = convertTimezoneToLocal(previousDate, timezone, true);\n }\n return $filter('date')(value, format, timezone);\n } else {\n previousDate = null;\n return '';\n }\n });\n\n if (isDefined(attr.min) || attr.ngMin) {\n var minVal;\n ctrl.$validators.min = function(value) {\n return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;\n };\n attr.$observe('min', function(val) {\n minVal = parseObservedDateValue(val);\n ctrl.$validate();\n });\n }\n\n if (isDefined(attr.max) || attr.ngMax) {\n var maxVal;\n ctrl.$validators.max = function(value) {\n return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;\n };\n attr.$observe('max', function(val) {\n maxVal = parseObservedDateValue(val);\n ctrl.$validate();\n });\n }\n\n function isValidDate(value) {\n // Invalid Date: getTime() returns NaN\n return value && !(value.getTime && value.getTime() !== value.getTime());\n }\n\n function parseObservedDateValue(val) {\n return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;\n }\n };\n}\n\nfunction badInputChecker(scope, element, attr, ctrl) {\n var node = element[0];\n var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);\n if (nativeValidation) {\n ctrl.$parsers.push(function(value) {\n var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};\n // Detect bug in FF35 for input[email] (https://bugzilla.mozilla.org/show_bug.cgi?id=1064430):\n // - also sets validity.badInput (should only be validity.typeMismatch).\n // - see http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#e-mail-state-(type=email)\n // - can ignore this case as we can still read out the erroneous email...\n return validity.badInput && !validity.typeMismatch ? undefined : value;\n });\n }\n}\n\nfunction numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n badInputChecker(scope, element, attr, ctrl);\n baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n ctrl.$$parserName = 'number';\n ctrl.$parsers.push(function(value) {\n if (ctrl.$isEmpty(value)) return null;\n if (NUMBER_REGEXP.test(value)) return parseFloat(value);\n return undefined;\n });\n\n ctrl.$formatters.push(function(value) {\n if (!ctrl.$isEmpty(value)) {\n if (!isNumber(value)) {\n throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);\n }\n value = value.toString();\n }\n return value;\n });\n\n if (isDefined(attr.min) || attr.ngMin) {\n var minVal;\n ctrl.$validators.min = function(value) {\n return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;\n };\n\n attr.$observe('min', function(val) {\n if (isDefined(val) && !isNumber(val)) {\n val = parseFloat(val, 10);\n }\n minVal = isNumber(val) && !isNaN(val) ? val : undefined;\n // TODO(matsko): implement validateLater to reduce number of validations\n ctrl.$validate();\n });\n }\n\n if (isDefined(attr.max) || attr.ngMax) {\n var maxVal;\n ctrl.$validators.max = function(value) {\n return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;\n };\n\n attr.$observe('max', function(val) {\n if (isDefined(val) && !isNumber(val)) {\n val = parseFloat(val, 10);\n }\n maxVal = isNumber(val) && !isNaN(val) ? val : undefined;\n // TODO(matsko): implement validateLater to reduce number of validations\n ctrl.$validate();\n });\n }\n}\n\nfunction urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n // Note: no badInputChecker here by purpose as `url` is only a validation\n // in browsers, i.e. we can always read out input.value even if it is not valid!\n baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n stringBasedInputType(ctrl);\n\n ctrl.$$parserName = 'url';\n ctrl.$validators.url = function(modelValue, viewValue) {\n var value = modelValue || viewValue;\n return ctrl.$isEmpty(value) || URL_REGEXP.test(value);\n };\n}\n\nfunction emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n // Note: no badInputChecker here by purpose as `url` is only a validation\n // in browsers, i.e. we can always read out input.value even if it is not valid!\n baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n stringBasedInputType(ctrl);\n\n ctrl.$$parserName = 'email';\n ctrl.$validators.email = function(modelValue, viewValue) {\n var value = modelValue || viewValue;\n return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);\n };\n}\n\nfunction radioInputType(scope, element, attr, ctrl) {\n // make the name unique, if not defined\n if (isUndefined(attr.name)) {\n element.attr('name', nextUid());\n }\n\n var listener = function(ev) {\n if (element[0].checked) {\n ctrl.$setViewValue(attr.value, ev && ev.type);\n }\n };\n\n element.on('click', listener);\n\n ctrl.$render = function() {\n var value = attr.value;\n element[0].checked = (value == ctrl.$viewValue);\n };\n\n attr.$observe('value', ctrl.$render);\n}\n\nfunction parseConstantExpr($parse, context, name, expression, fallback) {\n var parseFn;\n if (isDefined(expression)) {\n parseFn = $parse(expression);\n if (!parseFn.constant) {\n throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +\n '`{1}`.', name, expression);\n }\n return parseFn(context);\n }\n return fallback;\n}\n\nfunction checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {\n var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);\n var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);\n\n var listener = function(ev) {\n ctrl.$setViewValue(element[0].checked, ev && ev.type);\n };\n\n element.on('click', listener);\n\n ctrl.$render = function() {\n element[0].checked = ctrl.$viewValue;\n };\n\n // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`\n // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert\n // it to a boolean.\n ctrl.$isEmpty = function(value) {\n return value === false;\n };\n\n ctrl.$formatters.push(function(value) {\n return equals(value, trueValue);\n });\n\n ctrl.$parsers.push(function(value) {\n return value ? trueValue : falseValue;\n });\n}\n\n\n/**\n * @ngdoc directive\n * @name textarea\n * @restrict E\n *\n * @description\n * HTML textarea element control with angular data-binding. The data-binding and validation\n * properties of this element are exactly the same as those of the\n * {@link ng.directive:input input element}.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n * minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n * length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match\n * a RegExp found by evaluating the Angular expression given in the attribute value.\n * If the expression evaluates to a RegExp object, then this is used directly.\n * If the expression evaluates to a string, then it will be converted to a RegExp\n * after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n * `new RegExp('^abc$')`.<br />\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n */\n\n\n/**\n * @ngdoc directive\n * @name input\n * @restrict E\n *\n * @description\n * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,\n * input state control, and validation.\n * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Not every feature offered is available for all input types.\n * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {boolean=} ngRequired Sets `required` attribute if set to true\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n * minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n * maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n * length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel value does not match\n * a RegExp found by evaluating the Angular expression given in the attribute value.\n * If the expression evaluates to a RegExp object, then this is used directly.\n * If the expression evaluates to a string, then it will be converted to a RegExp\n * after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n * `new RegExp('^abc$')`.<br />\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n * interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n * This parameter is ignored for input[type=password] controls, which will never trim the\n * input.\n *\n * @example\n <example name=\"input-directive\" module=\"inputExample\">\n <file name=\"index.html\">\n <script>\n angular.module('inputExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.user = {name: 'guest', last: 'visitor'};\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <form name=\"myForm\">\n <label>\n User name:\n <input type=\"text\" name=\"userName\" ng-model=\"user.name\" required>\n </label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.userName.$error.required\">\n Required!</span>\n </div>\n <label>\n Last name:\n <input type=\"text\" name=\"lastName\" ng-model=\"user.last\"\n ng-minlength=\"3\" ng-maxlength=\"10\">\n </label>\n <div role=\"alert\">\n <span class=\"error\" ng-show=\"myForm.lastName.$error.minlength\">\n Too short!</span>\n <span class=\"error\" ng-show=\"myForm.lastName.$error.maxlength\">\n Too long!</span>\n </div>\n </form>\n <hr>\n <tt>user = {{user}}</tt><br/>\n <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>\n <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>\n <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>\n <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>\n <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>\n <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var user = element(by.exactBinding('user'));\n var userNameValid = element(by.binding('myForm.userName.$valid'));\n var lastNameValid = element(by.binding('myForm.lastName.$valid'));\n var lastNameError = element(by.binding('myForm.lastName.$error'));\n var formValid = element(by.binding('myForm.$valid'));\n var userNameInput = element(by.model('user.name'));\n var userLastInput = element(by.model('user.last'));\n\n it('should initialize to model', function() {\n expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"visitor\"}');\n expect(userNameValid.getText()).toContain('true');\n expect(formValid.getText()).toContain('true');\n });\n\n it('should be invalid if empty when required', function() {\n userNameInput.clear();\n userNameInput.sendKeys('');\n\n expect(user.getText()).toContain('{\"last\":\"visitor\"}');\n expect(userNameValid.getText()).toContain('false');\n expect(formValid.getText()).toContain('false');\n });\n\n it('should be valid if empty when min length is set', function() {\n userLastInput.clear();\n userLastInput.sendKeys('');\n\n expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"\"}');\n expect(lastNameValid.getText()).toContain('true');\n expect(formValid.getText()).toContain('true');\n });\n\n it('should be invalid if less than required min length', function() {\n userLastInput.clear();\n userLastInput.sendKeys('xx');\n\n expect(user.getText()).toContain('{\"name\":\"guest\"}');\n expect(lastNameValid.getText()).toContain('false');\n expect(lastNameError.getText()).toContain('minlength');\n expect(formValid.getText()).toContain('false');\n });\n\n it('should be invalid if longer than max length', function() {\n userLastInput.clear();\n userLastInput.sendKeys('some ridiculously long name');\n\n expect(user.getText()).toContain('{\"name\":\"guest\"}');\n expect(lastNameValid.getText()).toContain('false');\n expect(lastNameError.getText()).toContain('maxlength');\n expect(formValid.getText()).toContain('false');\n });\n </file>\n </example>\n */\nvar inputDirective = ['$browser', '$sniffer', '$filter', '$parse',\n function($browser, $sniffer, $filter, $parse) {\n return {\n restrict: 'E',\n require: ['?ngModel'],\n link: {\n pre: function(scope, element, attr, ctrls) {\n if (ctrls[0]) {\n (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,\n $browser, $filter, $parse);\n }\n }\n }\n };\n}];\n\n\n\nvar CONSTANT_VALUE_REGEXP = /^(true|false|\\d+)$/;\n/**\n * @ngdoc directive\n * @name ngValue\n *\n * @description\n * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},\n * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to\n * the bound value.\n *\n * `ngValue` is useful when dynamically generating lists of radio buttons using\n * {@link ngRepeat `ngRepeat`}, as shown below.\n *\n * Likewise, `ngValue` can be used to generate `<option>` elements for\n * the {@link select `select`} element. In that case however, only strings are supported\n * for the `value `attribute, so the resulting `ngModel` will always be a string.\n * Support for `select` models with non-string values is available via `ngOptions`.\n *\n * @element input\n * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute\n * of the `input` element\n *\n * @example\n <example name=\"ngValue-directive\" module=\"valueExample\">\n <file name=\"index.html\">\n <script>\n angular.module('valueExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.names = ['pizza', 'unicorns', 'robots'];\n $scope.my = { favorite: 'unicorns' };\n }]);\n </script>\n <form ng-controller=\"ExampleController\">\n <h2>Which is your favorite?</h2>\n <label ng-repeat=\"name in names\" for=\"{{name}}\">\n {{name}}\n <input type=\"radio\"\n ng-model=\"my.favorite\"\n ng-value=\"name\"\n id=\"{{name}}\"\n name=\"favorite\">\n </label>\n <div>You chose {{my.favorite}}</div>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var favorite = element(by.binding('my.favorite'));\n\n it('should initialize to model', function() {\n expect(favorite.getText()).toContain('unicorns');\n });\n it('should bind the values to the inputs', function() {\n element.all(by.model('my.favorite')).get(0).click();\n expect(favorite.getText()).toContain('pizza');\n });\n </file>\n </example>\n */\nvar ngValueDirective = function() {\n return {\n restrict: 'A',\n priority: 100,\n compile: function(tpl, tplAttr) {\n if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {\n return function ngValueConstantLink(scope, elm, attr) {\n attr.$set('value', scope.$eval(attr.ngValue));\n };\n } else {\n return function ngValueLink(scope, elm, attr) {\n scope.$watch(attr.ngValue, function valueWatchAction(value) {\n attr.$set('value', value);\n });\n };\n }\n }\n };\n};\n\n/**\n * @ngdoc directive\n * @name ngBind\n * @restrict AC\n *\n * @description\n * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element\n * with the value of a given expression, and to update the text content when the value of that\n * expression changes.\n *\n * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like\n * `{{ expression }}` which is similar but less verbose.\n *\n * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily\n * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an\n * element attribute, it makes the bindings invisible to the user while the page is loading.\n *\n * An alternative solution to this problem would be using the\n * {@link ng.directive:ngCloak ngCloak} directive.\n *\n *\n * @element ANY\n * @param {expression} ngBind {@link guide/expression Expression} to evaluate.\n *\n * @example\n * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.\n <example module=\"bindExample\">\n <file name=\"index.html\">\n <script>\n angular.module('bindExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.name = 'Whirled';\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <label>Enter name: <input type=\"text\" ng-model=\"name\"></label><br>\n Hello <span ng-bind=\"name\"></span>!\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-bind', function() {\n var nameInput = element(by.model('name'));\n\n expect(element(by.binding('name')).getText()).toBe('Whirled');\n nameInput.clear();\n nameInput.sendKeys('world');\n expect(element(by.binding('name')).getText()).toBe('world');\n });\n </file>\n </example>\n */\nvar ngBindDirective = ['$compile', function($compile) {\n return {\n restrict: 'AC',\n compile: function ngBindCompile(templateElement) {\n $compile.$$addBindingClass(templateElement);\n return function ngBindLink(scope, element, attr) {\n $compile.$$addBindingInfo(element, attr.ngBind);\n element = element[0];\n scope.$watch(attr.ngBind, function ngBindWatchAction(value) {\n element.textContent = isUndefined(value) ? '' : value;\n });\n };\n }\n };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindTemplate\n *\n * @description\n * The `ngBindTemplate` directive specifies that the element\n * text content should be replaced with the interpolation of the template\n * in the `ngBindTemplate` attribute.\n * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`\n * expressions. This directive is needed since some HTML elements\n * (such as TITLE and OPTION) cannot contain SPAN elements.\n *\n * @element ANY\n * @param {string} ngBindTemplate template of form\n * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.\n *\n * @example\n * Try it here: enter text in text box and watch the greeting change.\n <example module=\"bindExample\">\n <file name=\"index.html\">\n <script>\n angular.module('bindExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.salutation = 'Hello';\n $scope.name = 'World';\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <label>Salutation: <input type=\"text\" ng-model=\"salutation\"></label><br>\n <label>Name: <input type=\"text\" ng-model=\"name\"></label><br>\n <pre ng-bind-template=\"{{salutation}} {{name}}!\"></pre>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-bind', function() {\n var salutationElem = element(by.binding('salutation'));\n var salutationInput = element(by.model('salutation'));\n var nameInput = element(by.model('name'));\n\n expect(salutationElem.getText()).toBe('Hello World!');\n\n salutationInput.clear();\n salutationInput.sendKeys('Greetings');\n nameInput.clear();\n nameInput.sendKeys('user');\n\n expect(salutationElem.getText()).toBe('Greetings user!');\n });\n </file>\n </example>\n */\nvar ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {\n return {\n compile: function ngBindTemplateCompile(templateElement) {\n $compile.$$addBindingClass(templateElement);\n return function ngBindTemplateLink(scope, element, attr) {\n var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));\n $compile.$$addBindingInfo(element, interpolateFn.expressions);\n element = element[0];\n attr.$observe('ngBindTemplate', function(value) {\n element.textContent = isUndefined(value) ? '' : value;\n });\n };\n }\n };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindHtml\n *\n * @description\n * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,\n * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.\n * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link\n * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}\n * in your module's dependencies, you need to include \"angular-sanitize.js\" in your application.\n *\n * You may also bypass sanitization for values you know are safe. To do so, bind to\n * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}. See the example\n * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.\n *\n * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you\n * will have an exception (instead of an exploit.)\n *\n * @element ANY\n * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.\n *\n * @example\n\n <example module=\"bindHtmlExample\" deps=\"angular-sanitize.js\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <p ng-bind-html=\"myHTML\"></p>\n </div>\n </file>\n\n <file name=\"script.js\">\n angular.module('bindHtmlExample', ['ngSanitize'])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.myHTML =\n 'I am an <code>HTML</code>string with ' +\n '<a href=\"#\">links!</a> and other <em>stuff</em>';\n }]);\n </file>\n\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-bind-html', function() {\n expect(element(by.binding('myHTML')).getText()).toBe(\n 'I am an HTMLstring with links! and other stuff');\n });\n </file>\n </example>\n */\nvar ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {\n return {\n restrict: 'A',\n compile: function ngBindHtmlCompile(tElement, tAttrs) {\n var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);\n var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function sceValueOf(val) {\n // Unwrap the value to compare the actual inner safe value, not the wrapper object.\n return $sce.valueOf(val);\n });\n $compile.$$addBindingClass(tElement);\n\n return function ngBindHtmlLink(scope, element, attr) {\n $compile.$$addBindingInfo(element, attr.ngBindHtml);\n\n scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {\n // The watched value is the unwrapped value. To avoid re-escaping, use the direct getter.\n var value = ngBindHtmlGetter(scope);\n element.html($sce.getTrustedHtml(value) || '');\n });\n };\n }\n };\n}];\n\n/**\n * @ngdoc directive\n * @name ngChange\n *\n * @description\n * Evaluate the given expression when the user changes the input.\n * The expression is evaluated immediately, unlike the JavaScript onchange event\n * which only triggers at the end of a change (usually, when the user leaves the\n * form element or presses the return key).\n *\n * The `ngChange` expression is only evaluated when a change in the input value causes\n * a new value to be committed to the model.\n *\n * It will not be evaluated:\n * * if the value returned from the `$parsers` transformation pipeline has not changed\n * * if the input has continued to be invalid since the model will stay `null`\n * * if the model is changed programmatically and not by a change to the input value\n *\n *\n * Note, this directive requires `ngModel` to be present.\n *\n * @element input\n * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change\n * in input value.\n *\n * @example\n * <example name=\"ngChange-directive\" module=\"changeExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('changeExample', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.counter = 0;\n * $scope.change = function() {\n * $scope.counter++;\n * };\n * }]);\n * </script>\n * <div ng-controller=\"ExampleController\">\n * <input type=\"checkbox\" ng-model=\"confirmed\" ng-change=\"change()\" id=\"ng-change-example1\" />\n * <input type=\"checkbox\" ng-model=\"confirmed\" id=\"ng-change-example2\" />\n * <label for=\"ng-change-example2\">Confirmed</label><br />\n * <tt>debug = {{confirmed}}</tt><br/>\n * <tt>counter = {{counter}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * var counter = element(by.binding('counter'));\n * var debug = element(by.binding('confirmed'));\n *\n * it('should evaluate the expression if changing from view', function() {\n * expect(counter.getText()).toContain('0');\n *\n * element(by.id('ng-change-example1')).click();\n *\n * expect(counter.getText()).toContain('1');\n * expect(debug.getText()).toContain('true');\n * });\n *\n * it('should not evaluate the expression if changing from model', function() {\n * element(by.id('ng-change-example2')).click();\n\n * expect(counter.getText()).toContain('0');\n * expect(debug.getText()).toContain('true');\n * });\n * </file>\n * </example>\n */\nvar ngChangeDirective = valueFn({\n restrict: 'A',\n require: 'ngModel',\n link: function(scope, element, attr, ctrl) {\n ctrl.$viewChangeListeners.push(function() {\n scope.$eval(attr.ngChange);\n });\n }\n});\n\nfunction classDirective(name, selector) {\n name = 'ngClass' + name;\n return ['$animate', function($animate) {\n return {\n restrict: 'AC',\n link: function(scope, element, attr) {\n var oldVal;\n\n scope.$watch(attr[name], ngClassWatchAction, true);\n\n attr.$observe('class', function(value) {\n ngClassWatchAction(scope.$eval(attr[name]));\n });\n\n\n if (name !== 'ngClass') {\n scope.$watch('$index', function($index, old$index) {\n // jshint bitwise: false\n var mod = $index & 1;\n if (mod !== (old$index & 1)) {\n var classes = arrayClasses(scope.$eval(attr[name]));\n mod === selector ?\n addClasses(classes) :\n removeClasses(classes);\n }\n });\n }\n\n function addClasses(classes) {\n var newClasses = digestClassCounts(classes, 1);\n attr.$addClass(newClasses);\n }\n\n function removeClasses(classes) {\n var newClasses = digestClassCounts(classes, -1);\n attr.$removeClass(newClasses);\n }\n\n function digestClassCounts(classes, count) {\n // Use createMap() to prevent class assumptions involving property\n // names in Object.prototype\n var classCounts = element.data('$classCounts') || createMap();\n var classesToUpdate = [];\n forEach(classes, function(className) {\n if (count > 0 || classCounts[className]) {\n classCounts[className] = (classCounts[className] || 0) + count;\n if (classCounts[className] === +(count > 0)) {\n classesToUpdate.push(className);\n }\n }\n });\n element.data('$classCounts', classCounts);\n return classesToUpdate.join(' ');\n }\n\n function updateClasses(oldClasses, newClasses) {\n var toAdd = arrayDifference(newClasses, oldClasses);\n var toRemove = arrayDifference(oldClasses, newClasses);\n toAdd = digestClassCounts(toAdd, 1);\n toRemove = digestClassCounts(toRemove, -1);\n if (toAdd && toAdd.length) {\n $animate.addClass(element, toAdd);\n }\n if (toRemove && toRemove.length) {\n $animate.removeClass(element, toRemove);\n }\n }\n\n function ngClassWatchAction(newVal) {\n if (selector === true || scope.$index % 2 === selector) {\n var newClasses = arrayClasses(newVal || []);\n if (!oldVal) {\n addClasses(newClasses);\n } else if (!equals(newVal,oldVal)) {\n var oldClasses = arrayClasses(oldVal);\n updateClasses(oldClasses, newClasses);\n }\n }\n if (isArray(newVal)) {\n oldVal = newVal.map(function(v) { return shallowCopy(v); });\n } else {\n oldVal = shallowCopy(newVal);\n }\n }\n }\n };\n\n function arrayDifference(tokens1, tokens2) {\n var values = [];\n\n outer:\n for (var i = 0; i < tokens1.length; i++) {\n var token = tokens1[i];\n for (var j = 0; j < tokens2.length; j++) {\n if (token == tokens2[j]) continue outer;\n }\n values.push(token);\n }\n return values;\n }\n\n function arrayClasses(classVal) {\n var classes = [];\n if (isArray(classVal)) {\n forEach(classVal, function(v) {\n classes = classes.concat(arrayClasses(v));\n });\n return classes;\n } else if (isString(classVal)) {\n return classVal.split(' ');\n } else if (isObject(classVal)) {\n forEach(classVal, function(v, k) {\n if (v) {\n classes = classes.concat(k.split(' '));\n }\n });\n return classes;\n }\n return classVal;\n }\n }];\n}\n\n/**\n * @ngdoc directive\n * @name ngClass\n * @restrict AC\n *\n * @description\n * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding\n * an expression that represents all classes to be added.\n *\n * The directive operates in three different ways, depending on which of three types the expression\n * evaluates to:\n *\n * 1. If the expression evaluates to a string, the string should be one or more space-delimited class\n * names.\n *\n * 2. If the expression evaluates to an object, then for each key-value pair of the\n * object with a truthy value the corresponding key is used as a class name.\n *\n * 3. If the expression evaluates to an array, each element of the array should either be a string as in\n * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array\n * to give you more control over what CSS classes appear. See the code below for an example of this.\n *\n *\n * The directive won't add duplicate classes if a particular class was already set.\n *\n * When the expression changes, the previously added classes are removed and only then are the\n * new classes added.\n *\n * @animations\n * **add** - happens just before the class is applied to the elements\n *\n * **remove** - happens just before the class is removed from the element\n *\n * @element ANY\n * @param {expression} ngClass {@link guide/expression Expression} to eval. The result\n * of the evaluation can be a string representing space delimited class\n * names, an array, or a map of class names to boolean values. In the case of a map, the\n * names of the properties whose values are truthy will be added as css classes to the\n * element.\n *\n * @example Example that demonstrates basic bindings via ngClass directive.\n <example>\n <file name=\"index.html\">\n <p ng-class=\"{strike: deleted, bold: important, 'has-error': error}\">Map Syntax Example</p>\n <label>\n <input type=\"checkbox\" ng-model=\"deleted\">\n deleted (apply \"strike\" class)\n </label><br>\n <label>\n <input type=\"checkbox\" ng-model=\"important\">\n important (apply \"bold\" class)\n </label><br>\n <label>\n <input type=\"checkbox\" ng-model=\"error\">\n error (apply \"has-error\" class)\n </label>\n <hr>\n <p ng-class=\"style\">Using String Syntax</p>\n <input type=\"text\" ng-model=\"style\"\n placeholder=\"Type: bold strike red\" aria-label=\"Type: bold strike red\">\n <hr>\n <p ng-class=\"[style1, style2, style3]\">Using Array Syntax</p>\n <input ng-model=\"style1\"\n placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red\"><br>\n <input ng-model=\"style2\"\n placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 2\"><br>\n <input ng-model=\"style3\"\n placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 3\"><br>\n <hr>\n <p ng-class=\"[style4, {orange: warning}]\">Using Array and Map Syntax</p>\n <input ng-model=\"style4\" placeholder=\"Type: bold, strike\" aria-label=\"Type: bold, strike\"><br>\n <label><input type=\"checkbox\" ng-model=\"warning\"> warning (apply \"orange\" class)</label>\n </file>\n <file name=\"style.css\">\n .strike {\n text-decoration: line-through;\n }\n .bold {\n font-weight: bold;\n }\n .red {\n color: red;\n }\n .has-error {\n color: red;\n background-color: yellow;\n }\n .orange {\n color: orange;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var ps = element.all(by.css('p'));\n\n it('should let you toggle the class', function() {\n\n expect(ps.first().getAttribute('class')).not.toMatch(/bold/);\n expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);\n\n element(by.model('important')).click();\n expect(ps.first().getAttribute('class')).toMatch(/bold/);\n\n element(by.model('error')).click();\n expect(ps.first().getAttribute('class')).toMatch(/has-error/);\n });\n\n it('should let you toggle string example', function() {\n expect(ps.get(1).getAttribute('class')).toBe('');\n element(by.model('style')).clear();\n element(by.model('style')).sendKeys('red');\n expect(ps.get(1).getAttribute('class')).toBe('red');\n });\n\n it('array example should have 3 classes', function() {\n expect(ps.get(2).getAttribute('class')).toBe('');\n element(by.model('style1')).sendKeys('bold');\n element(by.model('style2')).sendKeys('strike');\n element(by.model('style3')).sendKeys('red');\n expect(ps.get(2).getAttribute('class')).toBe('bold strike red');\n });\n\n it('array with map example should have 2 classes', function() {\n expect(ps.last().getAttribute('class')).toBe('');\n element(by.model('style4')).sendKeys('bold');\n element(by.model('warning')).click();\n expect(ps.last().getAttribute('class')).toBe('bold orange');\n });\n </file>\n </example>\n\n ## Animations\n\n The example below demonstrates how to perform animations using ngClass.\n\n <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n <input id=\"setbtn\" type=\"button\" value=\"set\" ng-click=\"myVar='my-class'\">\n <input id=\"clearbtn\" type=\"button\" value=\"clear\" ng-click=\"myVar=''\">\n <br>\n <span class=\"base-class\" ng-class=\"myVar\">Sample Text</span>\n </file>\n <file name=\"style.css\">\n .base-class {\n transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n }\n\n .base-class.my-class {\n color: red;\n font-size:3em;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-class', function() {\n expect(element(by.css('.base-class')).getAttribute('class')).not.\n toMatch(/my-class/);\n\n element(by.id('setbtn')).click();\n\n expect(element(by.css('.base-class')).getAttribute('class')).\n toMatch(/my-class/);\n\n element(by.id('clearbtn')).click();\n\n expect(element(by.css('.base-class')).getAttribute('class')).not.\n toMatch(/my-class/);\n });\n </file>\n </example>\n\n\n ## ngClass and pre-existing CSS3 Transitions/Animations\n The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.\n Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder\n any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure\n to view the step by step details of {@link $animate#addClass $animate.addClass} and\n {@link $animate#removeClass $animate.removeClass}.\n */\nvar ngClassDirective = classDirective('', true);\n\n/**\n * @ngdoc directive\n * @name ngClassOdd\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result\n * of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n <li ng-repeat=\"name in names\">\n <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n {{name}}\n </span>\n </li>\n </ol>\n </file>\n <file name=\"style.css\">\n .odd {\n color: red;\n }\n .even {\n color: blue;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-class-odd and ng-class-even', function() {\n expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n toMatch(/odd/);\n expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n toMatch(/even/);\n });\n </file>\n </example>\n */\nvar ngClassOddDirective = classDirective('Odd', 0);\n\n/**\n * @ngdoc directive\n * @name ngClassEven\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The\n * result of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n <li ng-repeat=\"name in names\">\n <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n {{name}} &nbsp; &nbsp; &nbsp;\n </span>\n </li>\n </ol>\n </file>\n <file name=\"style.css\">\n .odd {\n color: red;\n }\n .even {\n color: blue;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-class-odd and ng-class-even', function() {\n expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n toMatch(/odd/);\n expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n toMatch(/even/);\n });\n </file>\n </example>\n */\nvar ngClassEvenDirective = classDirective('Even', 1);\n\n/**\n * @ngdoc directive\n * @name ngCloak\n * @restrict AC\n *\n * @description\n * The `ngCloak` directive is used to prevent the Angular html template from being briefly\n * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this\n * directive to avoid the undesirable flicker effect caused by the html template display.\n *\n * The directive can be applied to the `<body>` element, but the preferred usage is to apply\n * multiple `ngCloak` directives to small portions of the page to permit progressive rendering\n * of the browser view.\n *\n * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and\n * `angular.min.js`.\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```css\n * [ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {\n * display: none !important;\n * }\n * ```\n *\n * When this css rule is loaded by the browser, all html elements (including their children) that\n * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive\n * during the compilation of the template it deletes the `ngCloak` element attribute, making\n * the compiled element visible.\n *\n * For the best result, the `angular.js` script must be loaded in the head section of the html\n * document; alternatively, the css rule above must be included in the external stylesheet of the\n * application.\n *\n * @element ANY\n *\n * @example\n <example>\n <file name=\"index.html\">\n <div id=\"template1\" ng-cloak>{{ 'hello' }}</div>\n <div id=\"template2\" class=\"ng-cloak\">{{ 'world' }}</div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should remove the template directive and css class', function() {\n expect($('#template1').getAttribute('ng-cloak')).\n toBeNull();\n expect($('#template2').getAttribute('ng-cloak')).\n toBeNull();\n });\n </file>\n </example>\n *\n */\nvar ngCloakDirective = ngDirective({\n compile: function(element, attr) {\n attr.$set('ngCloak', undefined);\n element.removeClass('ng-cloak');\n }\n});\n\n/**\n * @ngdoc directive\n * @name ngController\n *\n * @description\n * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular\n * supports the principles behind the Model-View-Controller design pattern.\n *\n * MVC components in angular:\n *\n * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties\n * are accessed through bindings.\n * * View — The template (HTML with data bindings) that is rendered into the View.\n * * Controller — The `ngController` directive specifies a Controller class; the class contains business\n * logic behind the application to decorate the scope with functions and values\n *\n * Note that you can also attach controllers to the DOM by declaring it in a route definition\n * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller\n * again using `ng-controller` in the template itself. This will cause the controller to be attached\n * and executed twice.\n *\n * @element ANY\n * @scope\n * @priority 500\n * @param {expression} ngController Name of a constructor function registered with the current\n * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}\n * that on the current scope evaluates to a constructor function.\n *\n * The controller instance can be published into a scope property by specifying\n * `ng-controller=\"as propertyName\"`.\n *\n * If the current `$controllerProvider` is configured to use globals (via\n * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may\n * also be the name of a globally accessible constructor function (not recommended).\n *\n * @example\n * Here is a simple form for editing user contact information. Adding, removing, clearing, and\n * greeting are methods declared on the controller (see source tab). These methods can\n * easily be called from the angular markup. Any changes to the data are automatically reflected\n * in the View without the need for a manual update.\n *\n * Two different declaration styles are included below:\n *\n * * one binds methods and properties directly onto the controller using `this`:\n * `ng-controller=\"SettingsController1 as settings\"`\n * * one injects `$scope` into the controller:\n * `ng-controller=\"SettingsController2\"`\n *\n * The second option is more common in the Angular community, and is generally used in boilerplates\n * and in this guide. However, there are advantages to binding properties directly to the controller\n * and avoiding scope.\n *\n * * Using `controller as` makes it obvious which controller you are accessing in the template when\n * multiple controllers apply to an element.\n * * If you are writing your controllers as classes you have easier access to the properties and\n * methods, which will appear on the scope, from inside the controller code.\n * * Since there is always a `.` in the bindings, you don't have to worry about prototypal\n * inheritance masking primitives.\n *\n * This example demonstrates the `controller as` syntax.\n *\n * <example name=\"ngControllerAs\" module=\"controllerAsExample\">\n * <file name=\"index.html\">\n * <div id=\"ctrl-as-exmpl\" ng-controller=\"SettingsController1 as settings\">\n * <label>Name: <input type=\"text\" ng-model=\"settings.name\"/></label>\n * <button ng-click=\"settings.greet()\">greet</button><br/>\n * Contact:\n * <ul>\n * <li ng-repeat=\"contact in settings.contacts\">\n * <select ng-model=\"contact.type\" aria-label=\"Contact method\" id=\"select_{{$index}}\">\n * <option>phone</option>\n * <option>email</option>\n * </select>\n * <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n * <button ng-click=\"settings.clearContact(contact)\">clear</button>\n * <button ng-click=\"settings.removeContact(contact)\" aria-label=\"Remove\">X</button>\n * </li>\n * <li><button ng-click=\"settings.addContact()\">add</button></li>\n * </ul>\n * </div>\n * </file>\n * <file name=\"app.js\">\n * angular.module('controllerAsExample', [])\n * .controller('SettingsController1', SettingsController1);\n *\n * function SettingsController1() {\n * this.name = \"John Smith\";\n * this.contacts = [\n * {type: 'phone', value: '408 555 1212'},\n * {type: 'email', value: 'john.smith@example.org'} ];\n * }\n *\n * SettingsController1.prototype.greet = function() {\n * alert(this.name);\n * };\n *\n * SettingsController1.prototype.addContact = function() {\n * this.contacts.push({type: 'email', value: 'yourname@example.org'});\n * };\n *\n * SettingsController1.prototype.removeContact = function(contactToRemove) {\n * var index = this.contacts.indexOf(contactToRemove);\n * this.contacts.splice(index, 1);\n * };\n *\n * SettingsController1.prototype.clearContact = function(contact) {\n * contact.type = 'phone';\n * contact.value = '';\n * };\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should check controller as', function() {\n * var container = element(by.id('ctrl-as-exmpl'));\n * expect(container.element(by.model('settings.name'))\n * .getAttribute('value')).toBe('John Smith');\n *\n * var firstRepeat =\n * container.element(by.repeater('contact in settings.contacts').row(0));\n * var secondRepeat =\n * container.element(by.repeater('contact in settings.contacts').row(1));\n *\n * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n * .toBe('408 555 1212');\n *\n * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n * .toBe('john.smith@example.org');\n *\n * firstRepeat.element(by.buttonText('clear')).click();\n *\n * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n * .toBe('');\n *\n * container.element(by.buttonText('add')).click();\n *\n * expect(container.element(by.repeater('contact in settings.contacts').row(2))\n * .element(by.model('contact.value'))\n * .getAttribute('value'))\n * .toBe('yourname@example.org');\n * });\n * </file>\n * </example>\n *\n * This example demonstrates the \"attach to `$scope`\" style of controller.\n *\n * <example name=\"ngController\" module=\"controllerExample\">\n * <file name=\"index.html\">\n * <div id=\"ctrl-exmpl\" ng-controller=\"SettingsController2\">\n * <label>Name: <input type=\"text\" ng-model=\"name\"/></label>\n * <button ng-click=\"greet()\">greet</button><br/>\n * Contact:\n * <ul>\n * <li ng-repeat=\"contact in contacts\">\n * <select ng-model=\"contact.type\" id=\"select_{{$index}}\">\n * <option>phone</option>\n * <option>email</option>\n * </select>\n * <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n * <button ng-click=\"clearContact(contact)\">clear</button>\n * <button ng-click=\"removeContact(contact)\">X</button>\n * </li>\n * <li>[ <button ng-click=\"addContact()\">add</button> ]</li>\n * </ul>\n * </div>\n * </file>\n * <file name=\"app.js\">\n * angular.module('controllerExample', [])\n * .controller('SettingsController2', ['$scope', SettingsController2]);\n *\n * function SettingsController2($scope) {\n * $scope.name = \"John Smith\";\n * $scope.contacts = [\n * {type:'phone', value:'408 555 1212'},\n * {type:'email', value:'john.smith@example.org'} ];\n *\n * $scope.greet = function() {\n * alert($scope.name);\n * };\n *\n * $scope.addContact = function() {\n * $scope.contacts.push({type:'email', value:'yourname@example.org'});\n * };\n *\n * $scope.removeContact = function(contactToRemove) {\n * var index = $scope.contacts.indexOf(contactToRemove);\n * $scope.contacts.splice(index, 1);\n * };\n *\n * $scope.clearContact = function(contact) {\n * contact.type = 'phone';\n * contact.value = '';\n * };\n * }\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should check controller', function() {\n * var container = element(by.id('ctrl-exmpl'));\n *\n * expect(container.element(by.model('name'))\n * .getAttribute('value')).toBe('John Smith');\n *\n * var firstRepeat =\n * container.element(by.repeater('contact in contacts').row(0));\n * var secondRepeat =\n * container.element(by.repeater('contact in contacts').row(1));\n *\n * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n * .toBe('408 555 1212');\n * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n * .toBe('john.smith@example.org');\n *\n * firstRepeat.element(by.buttonText('clear')).click();\n *\n * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n * .toBe('');\n *\n * container.element(by.buttonText('add')).click();\n *\n * expect(container.element(by.repeater('contact in contacts').row(2))\n * .element(by.model('contact.value'))\n * .getAttribute('value'))\n * .toBe('yourname@example.org');\n * });\n * </file>\n *</example>\n\n */\nvar ngControllerDirective = [function() {\n return {\n restrict: 'A',\n scope: true,\n controller: '@',\n priority: 500\n };\n}];\n\n/**\n * @ngdoc directive\n * @name ngCsp\n *\n * @element html\n * @description\n *\n * Angular has some features that can break certain\n * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.\n *\n * If you intend to implement these rules then you must tell Angular not to use these features.\n *\n * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.\n *\n *\n * The following rules affect Angular:\n *\n * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions\n * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%\n * increase in the speed of evaluating Angular expressions.\n *\n * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular\n * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).\n * To make these directives work when a CSP rule is blocking inline styles, you must link to the\n * `angular-csp.css` in your HTML manually.\n *\n * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval\n * and automatically deactivates this feature in the {@link $parse} service. This autodetection,\n * however, triggers a CSP error to be logged in the console:\n *\n * ```\n * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of\n * script in the following Content Security Policy directive: \"default-src 'self'\". Note that\n * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.\n * ```\n *\n * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`\n * directive on an element of the HTML document that appears before the `<script>` tag that loads\n * the `angular.js` file.\n *\n * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*\n *\n * You can specify which of the CSP related Angular features should be deactivated by providing\n * a value for the `ng-csp` attribute. The options are as follows:\n *\n * * no-inline-style: this stops Angular from injecting CSS styles into the DOM\n *\n * * no-unsafe-eval: this stops Angular from optimising $parse with unsafe eval of strings\n *\n * You can use these values in the following combinations:\n *\n *\n * * No declaration means that Angular will assume that you can do inline styles, but it will do\n * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline\n * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject\n * inline styles. E.g. `<body ng-csp=\"no-unsafe-eval\">`.\n *\n * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can\n * run eval - no automcatic check for unsafe eval will occur. E.g. `<body ng-csp=\"no-inline-style\">`\n *\n * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject\n * styles nor use eval, which is the same as an empty: ng-csp.\n * E.g.`<body ng-csp=\"no-inline-style;no-unsafe-eval\">`\n *\n * @example\n * This example shows how to apply the `ngCsp` directive to the `html` tag.\n ```html\n <!doctype html>\n <html ng-app ng-csp>\n ...\n ...\n </html>\n ```\n * @example\n // Note: the suffix `.csp` in the example name triggers\n // csp mode in our http server!\n <example name=\"example.csp\" module=\"cspExample\" ng-csp=\"true\">\n <file name=\"index.html\">\n <div ng-controller=\"MainController as ctrl\">\n <div>\n <button ng-click=\"ctrl.inc()\" id=\"inc\">Increment</button>\n <span id=\"counter\">\n {{ctrl.counter}}\n </span>\n </div>\n\n <div>\n <button ng-click=\"ctrl.evil()\" id=\"evil\">Evil</button>\n <span id=\"evilError\">\n {{ctrl.evilError}}\n </span>\n </div>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('cspExample', [])\n .controller('MainController', function() {\n this.counter = 0;\n this.inc = function() {\n this.counter++;\n };\n this.evil = function() {\n // jshint evil:true\n try {\n eval('1+2');\n } catch (e) {\n this.evilError = e.message;\n }\n };\n });\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var util, webdriver;\n\n var incBtn = element(by.id('inc'));\n var counter = element(by.id('counter'));\n var evilBtn = element(by.id('evil'));\n var evilError = element(by.id('evilError'));\n\n function getAndClearSevereErrors() {\n return browser.manage().logs().get('browser').then(function(browserLog) {\n return browserLog.filter(function(logEntry) {\n return logEntry.level.value > webdriver.logging.Level.WARNING.value;\n });\n });\n }\n\n function clearErrors() {\n getAndClearSevereErrors();\n }\n\n function expectNoErrors() {\n getAndClearSevereErrors().then(function(filteredLog) {\n expect(filteredLog.length).toEqual(0);\n if (filteredLog.length) {\n console.log('browser console errors: ' + util.inspect(filteredLog));\n }\n });\n }\n\n function expectError(regex) {\n getAndClearSevereErrors().then(function(filteredLog) {\n var found = false;\n filteredLog.forEach(function(log) {\n if (log.message.match(regex)) {\n found = true;\n }\n });\n if (!found) {\n throw new Error('expected an error that matches ' + regex);\n }\n });\n }\n\n beforeEach(function() {\n util = require('util');\n webdriver = require('protractor/node_modules/selenium-webdriver');\n });\n\n // For now, we only test on Chrome,\n // as Safari does not load the page with Protractor's injected scripts,\n // and Firefox webdriver always disables content security policy (#6358)\n if (browser.params.browser !== 'chrome') {\n return;\n }\n\n it('should not report errors when the page is loaded', function() {\n // clear errors so we are not dependent on previous tests\n clearErrors();\n // Need to reload the page as the page is already loaded when\n // we come here\n browser.driver.getCurrentUrl().then(function(url) {\n browser.get(url);\n });\n expectNoErrors();\n });\n\n it('should evaluate expressions', function() {\n expect(counter.getText()).toEqual('0');\n incBtn.click();\n expect(counter.getText()).toEqual('1');\n expectNoErrors();\n });\n\n it('should throw and report an error when using \"eval\"', function() {\n evilBtn.click();\n expect(evilError.getText()).toMatch(/Content Security Policy/);\n expectError(/Content Security Policy/);\n });\n </file>\n </example>\n */\n\n// ngCsp is not implemented as a proper directive any more, because we need it be processed while we\n// bootstrap the system (before $parse is instantiated), for this reason we just have\n// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * The ngClick directive allows you to specify custom behavior when\n * an element is clicked.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon\n * click. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n Increment\n </button>\n <span>\n count: {{count}}\n </span>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-click', function() {\n expect(element(by.binding('count')).getText()).toMatch('0');\n element(by.css('button')).click();\n expect(element(by.binding('count')).getText()).toMatch('1');\n });\n </file>\n </example>\n */\n/*\n * A collection of directives that allows creation of custom event handlers that are defined as\n * angular expressions and are compiled and executed within the current scope.\n */\nvar ngEventDirectives = {};\n\n// For events that might fire synchronously during DOM manipulation\n// we need to execute their event handlers asynchronously using $evalAsync,\n// so that they are not executed in an inconsistent state.\nvar forceAsyncEvents = {\n 'blur': true,\n 'focus': true\n};\nforEach(\n 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),\n function(eventName) {\n var directiveName = directiveNormalize('ng-' + eventName);\n ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {\n return {\n restrict: 'A',\n compile: function($element, attr) {\n // We expose the powerful $event object on the scope that provides access to the Window,\n // etc. that isn't protected by the fast paths in $parse. We explicitly request better\n // checks at the cost of speed since event handler expressions are not executed as\n // frequently as regular change detection.\n var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);\n return function ngEventHandler(scope, element) {\n element.on(eventName, function(event) {\n var callback = function() {\n fn(scope, {$event:event});\n };\n if (forceAsyncEvents[eventName] && $rootScope.$$phase) {\n scope.$evalAsync(callback);\n } else {\n scope.$apply(callback);\n }\n });\n };\n }\n };\n }];\n }\n);\n\n/**\n * @ngdoc directive\n * @name ngDblclick\n *\n * @description\n * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon\n * a dblclick. (The Event object is available as `$event`)\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-dblclick=\"count = count + 1\" ng-init=\"count=0\">\n Increment (on double click)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousedown\n *\n * @description\n * The ngMousedown directive allows you to specify custom behavior on mousedown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon\n * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-mousedown=\"count = count + 1\" ng-init=\"count=0\">\n Increment (on mouse down)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseup\n *\n * @description\n * Specify custom behavior on mouseup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon\n * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-mouseup=\"count = count + 1\" ng-init=\"count=0\">\n Increment (on mouse up)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngMouseover\n *\n * @description\n * Specify custom behavior on mouseover event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon\n * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-mouseover=\"count = count + 1\" ng-init=\"count=0\">\n Increment (when mouse is over)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseenter\n *\n * @description\n * Specify custom behavior on mouseenter event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon\n * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-mouseenter=\"count = count + 1\" ng-init=\"count=0\">\n Increment (when mouse enters)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseleave\n *\n * @description\n * Specify custom behavior on mouseleave event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon\n * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-mouseleave=\"count = count + 1\" ng-init=\"count=0\">\n Increment (when mouse leaves)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousemove\n *\n * @description\n * Specify custom behavior on mousemove event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon\n * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <button ng-mousemove=\"count = count + 1\" ng-init=\"count=0\">\n Increment (when mouse moves)\n </button>\n count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeydown\n *\n * @description\n * Specify custom behavior on keydown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon\n * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n <example>\n <file name=\"index.html\">\n <input ng-keydown=\"count = count + 1\" ng-init=\"count=0\">\n key down count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeyup\n *\n * @description\n * Specify custom behavior on keyup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon\n * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n <example>\n <file name=\"index.html\">\n <p>Typing in the input box below updates the key count</p>\n <input ng-keyup=\"count = count + 1\" ng-init=\"count=0\"> key up count: {{count}}\n\n <p>Typing in the input box below updates the keycode</p>\n <input ng-keyup=\"event=$event\">\n <p>event keyCode: {{ event.keyCode }}</p>\n <p>event altKey: {{ event.altKey }}</p>\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeypress\n *\n * @description\n * Specify custom behavior on keypress event.\n *\n * @element ANY\n * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon\n * keypress. ({@link guide/expression#-event- Event object is available as `$event`}\n * and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n <example>\n <file name=\"index.html\">\n <input ng-keypress=\"count = count + 1\" ng-init=\"count=0\">\n key press count: {{count}}\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSubmit\n *\n * @description\n * Enables binding angular expressions to onsubmit events.\n *\n * Additionally it prevents the default action (which for form means sending the request to the\n * server and reloading the current page), but only if the form does not contain `action`,\n * `data-action`, or `x-action` attributes.\n *\n * <div class=\"alert alert-warning\">\n * **Warning:** Be careful not to cause \"double-submission\" by using both the `ngClick` and\n * `ngSubmit` handlers together. See the\n * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}\n * for a detailed discussion of when `ngSubmit` may be triggered.\n * </div>\n *\n * @element form\n * @priority 0\n * @param {expression} ngSubmit {@link guide/expression Expression} to eval.\n * ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example module=\"submitExample\">\n <file name=\"index.html\">\n <script>\n angular.module('submitExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.list = [];\n $scope.text = 'hello';\n $scope.submit = function() {\n if ($scope.text) {\n $scope.list.push(this.text);\n $scope.text = '';\n }\n };\n }]);\n </script>\n <form ng-submit=\"submit()\" ng-controller=\"ExampleController\">\n Enter text and hit enter:\n <input type=\"text\" ng-model=\"text\" name=\"text\" />\n <input type=\"submit\" id=\"submit\" value=\"Submit\" />\n <pre>list={{list}}</pre>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-submit', function() {\n expect(element(by.binding('list')).getText()).toBe('list=[]');\n element(by.css('#submit')).click();\n expect(element(by.binding('list')).getText()).toContain('hello');\n expect(element(by.model('text')).getAttribute('value')).toBe('');\n });\n it('should ignore empty strings', function() {\n expect(element(by.binding('list')).getText()).toBe('list=[]');\n element(by.css('#submit')).click();\n element(by.css('#submit')).click();\n expect(element(by.binding('list')).getText()).toContain('hello');\n });\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngFocus\n *\n * @description\n * Specify custom behavior on focus event.\n *\n * Note: As the `focus` event is executed synchronously when calling `input.focus()`\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon\n * focus. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngBlur\n *\n * @description\n * Specify custom behavior on blur event.\n *\n * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when\n * an element has lost focus.\n *\n * Note: As the `blur` event is executed synchronously also during DOM manipulations\n * (e.g. removing a focussed input),\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon\n * blur. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngCopy\n *\n * @description\n * Specify custom behavior on copy event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon\n * copy. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <input ng-copy=\"copied=true\" ng-init=\"copied=false; value='copy me'\" ng-model=\"value\">\n copied: {{copied}}\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngCut\n *\n * @description\n * Specify custom behavior on cut event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon\n * cut. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <input ng-cut=\"cut=true\" ng-init=\"cut=false; value='cut me'\" ng-model=\"value\">\n cut: {{cut}}\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngPaste\n *\n * @description\n * Specify custom behavior on paste event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon\n * paste. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n <example>\n <file name=\"index.html\">\n <input ng-paste=\"paste=true\" ng-init=\"paste=false\" placeholder='paste here'>\n pasted: {{paste}}\n </file>\n </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngIf\n * @restrict A\n * @multiElement\n *\n * @description\n * The `ngIf` directive removes or recreates a portion of the DOM tree based on an\n * {expression}. If the expression assigned to `ngIf` evaluates to a false\n * value then the element is removed from the DOM, otherwise a clone of the\n * element is reinserted into the DOM.\n *\n * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the\n * element in the DOM rather than changing its visibility via the `display` css property. A common\n * case when this difference is significant is when using css selectors that rely on an element's\n * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.\n *\n * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope\n * is created when the element is restored. The scope created within `ngIf` inherits from\n * its parent scope using\n * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).\n * An important implication of this is if `ngModel` is used within `ngIf` to bind to\n * a javascript primitive defined in the parent scope. In this case any modifications made to the\n * variable within the child scope will override (hide) the value in the parent scope.\n *\n * Also, `ngIf` recreates elements using their compiled state. An example of this behavior\n * is if an element's class attribute is directly modified after it's compiled, using something like\n * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element\n * the added class will be lost because the original compiled state is used to regenerate the element.\n *\n * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`\n * and `leave` effects.\n *\n * @animations\n * enter - happens just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container\n * leave - happens just before the `ngIf` contents are removed from the DOM\n *\n * @element ANY\n * @scope\n * @priority 600\n * @param {expression} ngIf If the {@link guide/expression expression} is falsy then\n * the element is removed from the DOM tree. If it is truthy a copy of the compiled\n * element is added to the DOM tree.\n *\n * @example\n <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n <label>Click me: <input type=\"checkbox\" ng-model=\"checked\" ng-init=\"checked=true\" /></label><br/>\n Show when checked:\n <span ng-if=\"checked\" class=\"animate-if\">\n This is removed when the checkbox is unchecked.\n </span>\n </file>\n <file name=\"animations.css\">\n .animate-if {\n background:white;\n border:1px solid black;\n padding:10px;\n }\n\n .animate-if.ng-enter, .animate-if.ng-leave {\n transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n }\n\n .animate-if.ng-enter,\n .animate-if.ng-leave.ng-leave-active {\n opacity:0;\n }\n\n .animate-if.ng-leave,\n .animate-if.ng-enter.ng-enter-active {\n opacity:1;\n }\n </file>\n </example>\n */\nvar ngIfDirective = ['$animate', function($animate) {\n return {\n multiElement: true,\n transclude: 'element',\n priority: 600,\n terminal: true,\n restrict: 'A',\n $$tlb: true,\n link: function($scope, $element, $attr, ctrl, $transclude) {\n var block, childScope, previousElements;\n $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {\n\n if (value) {\n if (!childScope) {\n $transclude(function(clone, newScope) {\n childScope = newScope;\n clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');\n // Note: We only need the first/last node of the cloned nodes.\n // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n // by a directive with templateUrl when its template arrives.\n block = {\n clone: clone\n };\n $animate.enter(clone, $element.parent(), $element);\n });\n }\n } else {\n if (previousElements) {\n previousElements.remove();\n previousElements = null;\n }\n if (childScope) {\n childScope.$destroy();\n childScope = null;\n }\n if (block) {\n previousElements = getBlockNodes(block.clone);\n $animate.leave(previousElements).then(function() {\n previousElements = null;\n });\n block = null;\n }\n }\n });\n }\n };\n}];\n\n/**\n * @ngdoc directive\n * @name ngInclude\n * @restrict ECA\n *\n * @description\n * Fetches, compiles and includes an external HTML fragment.\n *\n * By default, the template URL is restricted to the same domain and protocol as the\n * application document. This is done by calling {@link $sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols\n * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or\n * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link\n * ng.$sce Strict Contextual Escaping}.\n *\n * In addition, the browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy may further restrict whether the template is successfully loaded.\n * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`\n * access on some browsers.\n *\n * @animations\n * enter - animation is used to bring new content into the browser.\n * leave - animation is used to animate existing content away.\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n *\n * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,\n * make sure you wrap it in **single** quotes, e.g. `src=\"'myPartialTemplate.html'\"`.\n * @param {string=} onload Expression to evaluate when a new partial is loaded.\n * <div class=\"alert alert-warning\">\n * **Note:** When using onload on SVG elements in IE11, the browser will try to call\n * a function with the name on the window element, which will usually throw a\n * \"function is undefined\" error. To fix this, you can instead use `data-onload` or a\n * different form that {@link guide/directive#normalization matches} `onload`.\n * </div>\n *\n * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll\n * $anchorScroll} to scroll the viewport after the content is loaded.\n *\n * - If the attribute is not set, disable scrolling.\n * - If the attribute is set without value, enable scrolling.\n * - Otherwise enable scrolling only if the expression evaluates to truthy value.\n *\n * @example\n <example module=\"includeExample\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <select ng-model=\"template\" ng-options=\"t.name for t in templates\">\n <option value=\"\">(blank)</option>\n </select>\n url of the template: <code>{{template.url}}</code>\n <hr/>\n <div class=\"slide-animate-container\">\n <div class=\"slide-animate\" ng-include=\"template.url\"></div>\n </div>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('includeExample', ['ngAnimate'])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.templates =\n [ { name: 'template1.html', url: 'template1.html'},\n { name: 'template2.html', url: 'template2.html'} ];\n $scope.template = $scope.templates[0];\n }]);\n </file>\n <file name=\"template1.html\">\n Content of template1.html\n </file>\n <file name=\"template2.html\">\n Content of template2.html\n </file>\n <file name=\"animations.css\">\n .slide-animate-container {\n position:relative;\n background:white;\n border:1px solid black;\n height:40px;\n overflow:hidden;\n }\n\n .slide-animate {\n padding:10px;\n }\n\n .slide-animate.ng-enter, .slide-animate.ng-leave {\n transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n position:absolute;\n top:0;\n left:0;\n right:0;\n bottom:0;\n display:block;\n padding:10px;\n }\n\n .slide-animate.ng-enter {\n top:-50px;\n }\n .slide-animate.ng-enter.ng-enter-active {\n top:0;\n }\n\n .slide-animate.ng-leave {\n top:0;\n }\n .slide-animate.ng-leave.ng-leave-active {\n top:50px;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var templateSelect = element(by.model('template'));\n var includeElem = element(by.css('[ng-include]'));\n\n it('should load template1.html', function() {\n expect(includeElem.getText()).toMatch(/Content of template1.html/);\n });\n\n it('should load template2.html', function() {\n if (browser.params.browser == 'firefox') {\n // Firefox can't handle using selects\n // See https://github.com/angular/protractor/issues/480\n return;\n }\n templateSelect.click();\n templateSelect.all(by.css('option')).get(2).click();\n expect(includeElem.getText()).toMatch(/Content of template2.html/);\n });\n\n it('should change to blank', function() {\n if (browser.params.browser == 'firefox') {\n // Firefox can't handle using selects\n return;\n }\n templateSelect.click();\n templateSelect.all(by.css('option')).get(0).click();\n expect(includeElem.isPresent()).toBe(false);\n });\n </file>\n </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentRequested\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted every time the ngInclude content is requested.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentLoaded\n * @eventType emit on the current ngInclude scope\n * @description\n * Emitted every time the ngInclude content is reloaded.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentError\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\nvar ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',\n function($templateRequest, $anchorScroll, $animate) {\n return {\n restrict: 'ECA',\n priority: 400,\n terminal: true,\n transclude: 'element',\n controller: angular.noop,\n compile: function(element, attr) {\n var srcExp = attr.ngInclude || attr.src,\n onloadExp = attr.onload || '',\n autoScrollExp = attr.autoscroll;\n\n return function(scope, $element, $attr, ctrl, $transclude) {\n var changeCounter = 0,\n currentScope,\n previousElement,\n currentElement;\n\n var cleanupLastIncludeContent = function() {\n if (previousElement) {\n previousElement.remove();\n previousElement = null;\n }\n if (currentScope) {\n currentScope.$destroy();\n currentScope = null;\n }\n if (currentElement) {\n $animate.leave(currentElement).then(function() {\n previousElement = null;\n });\n previousElement = currentElement;\n currentElement = null;\n }\n };\n\n scope.$watch(srcExp, function ngIncludeWatchAction(src) {\n var afterAnimation = function() {\n if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n $anchorScroll();\n }\n };\n var thisChangeId = ++changeCounter;\n\n if (src) {\n //set the 2nd param to true to ignore the template request error so that the inner\n //contents and scope can be cleaned up.\n $templateRequest(src, true).then(function(response) {\n if (scope.$$destroyed) return;\n\n if (thisChangeId !== changeCounter) return;\n var newScope = scope.$new();\n ctrl.template = response;\n\n // Note: This will also link all children of ng-include that were contained in the original\n // html. If that content contains controllers, ... they could pollute/change the scope.\n // However, using ng-include on an element with additional content does not make sense...\n // Note: We can't remove them in the cloneAttchFn of $transclude as that\n // function is called before linking the content, which would apply child\n // directives to non existing elements.\n var clone = $transclude(newScope, function(clone) {\n cleanupLastIncludeContent();\n $animate.enter(clone, null, $element).then(afterAnimation);\n });\n\n currentScope = newScope;\n currentElement = clone;\n\n currentScope.$emit('$includeContentLoaded', src);\n scope.$eval(onloadExp);\n }, function() {\n if (scope.$$destroyed) return;\n\n if (thisChangeId === changeCounter) {\n cleanupLastIncludeContent();\n scope.$emit('$includeContentError', src);\n }\n });\n scope.$emit('$includeContentRequested', src);\n } else {\n cleanupLastIncludeContent();\n ctrl.template = null;\n }\n });\n };\n }\n };\n}];\n\n// This directive is called during the $transclude call of the first `ngInclude` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngInclude\n// is called.\nvar ngIncludeFillContentDirective = ['$compile',\n function($compile) {\n return {\n restrict: 'ECA',\n priority: -400,\n require: 'ngInclude',\n link: function(scope, $element, $attr, ctrl) {\n if (/SVG/.test($element[0].toString())) {\n // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not\n // support innerHTML, so detect this here and try to generate the contents\n // specially.\n $element.empty();\n $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,\n function namespaceAdaptedClone(clone) {\n $element.append(clone);\n }, {futureParentElement: $element});\n return;\n }\n\n $element.html(ctrl.template);\n $compile($element.contents())(scope);\n }\n };\n }];\n\n/**\n * @ngdoc directive\n * @name ngInit\n * @restrict AC\n *\n * @description\n * The `ngInit` directive allows you to evaluate an expression in the\n * current scope.\n *\n * <div class=\"alert alert-danger\">\n * This directive can be abused to add unnecessary amounts of logic into your templates.\n * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of\n * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via\n * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}\n * rather than `ngInit` to initialize values on a scope.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make\n * sure you have parentheses to ensure correct operator precedence:\n * <pre class=\"prettyprint\">\n * `<div ng-init=\"test1 = ($index | toString)\"></div>`\n * </pre>\n * </div>\n *\n * @priority 450\n *\n * @element ANY\n * @param {expression} ngInit {@link guide/expression Expression} to eval.\n *\n * @example\n <example module=\"initExample\">\n <file name=\"index.html\">\n <script>\n angular.module('initExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.list = [['a', 'b'], ['c', 'd']];\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <div ng-repeat=\"innerList in list\" ng-init=\"outerIndex = $index\">\n <div ng-repeat=\"value in innerList\" ng-init=\"innerIndex = $index\">\n <span class=\"example-init\">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>\n </div>\n </div>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should alias index positions', function() {\n var elements = element.all(by.css('.example-init'));\n expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');\n expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');\n expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');\n expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');\n });\n </file>\n </example>\n */\nvar ngInitDirective = ngDirective({\n priority: 450,\n compile: function() {\n return {\n pre: function(scope, element, attrs) {\n scope.$eval(attrs.ngInit);\n }\n };\n }\n});\n\n/**\n * @ngdoc directive\n * @name ngList\n *\n * @description\n * Text input that converts between a delimited string and an array of strings. The default\n * delimiter is a comma followed by a space - equivalent to `ng-list=\", \"`. You can specify a custom\n * delimiter as the value of the `ngList` attribute - for example, `ng-list=\" | \"`.\n *\n * The behaviour of the directive is affected by the use of the `ngTrim` attribute.\n * * If `ngTrim` is set to `\"false\"` then whitespace around both the separator and each\n * list item is respected. This implies that the user of the directive is responsible for\n * dealing with whitespace but also allows you to use whitespace as a delimiter, such as a\n * tab or newline character.\n * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected\n * when joining the list items back together) and whitespace around each list item is stripped\n * before it is added to the model.\n *\n * ### Example with Validation\n *\n * <example name=\"ngList-directive\" module=\"listExample\">\n * <file name=\"app.js\">\n * angular.module('listExample', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.names = ['morpheus', 'neo', 'trinity'];\n * }]);\n * </file>\n * <file name=\"index.html\">\n * <form name=\"myForm\" ng-controller=\"ExampleController\">\n * <label>List: <input name=\"namesInput\" ng-model=\"names\" ng-list required></label>\n * <span role=\"alert\">\n * <span class=\"error\" ng-show=\"myForm.namesInput.$error.required\">\n * Required!</span>\n * </span>\n * <br>\n * <tt>names = {{names}}</tt><br/>\n * <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>\n * <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>\n * <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n * <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n * </form>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * var listInput = element(by.model('names'));\n * var names = element(by.exactBinding('names'));\n * var valid = element(by.binding('myForm.namesInput.$valid'));\n * var error = element(by.css('span.error'));\n *\n * it('should initialize to model', function() {\n * expect(names.getText()).toContain('[\"morpheus\",\"neo\",\"trinity\"]');\n * expect(valid.getText()).toContain('true');\n * expect(error.getCssValue('display')).toBe('none');\n * });\n *\n * it('should be invalid if empty', function() {\n * listInput.clear();\n * listInput.sendKeys('');\n *\n * expect(names.getText()).toContain('');\n * expect(valid.getText()).toContain('false');\n * expect(error.getCssValue('display')).not.toBe('none');\n * });\n * </file>\n * </example>\n *\n * ### Example - splitting on newline\n * <example name=\"ngList-directive-newlines\">\n * <file name=\"index.html\">\n * <textarea ng-model=\"list\" ng-list=\"&#10;\" ng-trim=\"false\"></textarea>\n * <pre>{{ list | json }}</pre>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it(\"should split the text by newlines\", function() {\n * var listInput = element(by.model('list'));\n * var output = element(by.binding('list | json'));\n * listInput.sendKeys('abc\\ndef\\nghi');\n * expect(output.getText()).toContain('[\\n \"abc\",\\n \"def\",\\n \"ghi\"\\n]');\n * });\n * </file>\n * </example>\n *\n * @element input\n * @param {string=} ngList optional delimiter that should be used to split the value.\n */\nvar ngListDirective = function() {\n return {\n restrict: 'A',\n priority: 100,\n require: 'ngModel',\n link: function(scope, element, attr, ctrl) {\n // We want to control whitespace trimming so we use this convoluted approach\n // to access the ngList attribute, which doesn't pre-trim the attribute\n var ngList = element.attr(attr.$attr.ngList) || ', ';\n var trimValues = attr.ngTrim !== 'false';\n var separator = trimValues ? trim(ngList) : ngList;\n\n var parse = function(viewValue) {\n // If the viewValue is invalid (say required but empty) it will be `undefined`\n if (isUndefined(viewValue)) return;\n\n var list = [];\n\n if (viewValue) {\n forEach(viewValue.split(separator), function(value) {\n if (value) list.push(trimValues ? trim(value) : value);\n });\n }\n\n return list;\n };\n\n ctrl.$parsers.push(parse);\n ctrl.$formatters.push(function(value) {\n if (isArray(value)) {\n return value.join(ngList);\n }\n\n return undefined;\n });\n\n // Override the standard $isEmpty because an empty array means the input is empty.\n ctrl.$isEmpty = function(value) {\n return !value || !value.length;\n };\n }\n };\n};\n\n/* global VALID_CLASS: true,\n INVALID_CLASS: true,\n PRISTINE_CLASS: true,\n DIRTY_CLASS: true,\n UNTOUCHED_CLASS: true,\n TOUCHED_CLASS: true,\n*/\n\nvar VALID_CLASS = 'ng-valid',\n INVALID_CLASS = 'ng-invalid',\n PRISTINE_CLASS = 'ng-pristine',\n DIRTY_CLASS = 'ng-dirty',\n UNTOUCHED_CLASS = 'ng-untouched',\n TOUCHED_CLASS = 'ng-touched',\n PENDING_CLASS = 'ng-pending';\n\nvar ngModelMinErr = minErr('ngModel');\n\n/**\n * @ngdoc type\n * @name ngModel.NgModelController\n *\n * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a\n * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue\n * is set.\n * @property {*} $modelValue The value in the model that the control is bound to.\n * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever\n the control reads value from the DOM. The functions are called in array order, each passing\n its return value through to the next. The last return value is forwarded to the\n {@link ngModel.NgModelController#$validators `$validators`} collection.\n\nParsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue\n`$viewValue`}.\n\nReturning `undefined` from a parser means a parse error occurred. In that case,\nno {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`\nwill be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}\nis set to `true`. The parse error is stored in `ngModel.$error.parse`.\n\n *\n * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever\n the model value changes. The functions are called in reverse array order, each passing the value through to the\n next. The last return value is used as the actual DOM value.\n Used to format / convert values for display in the control.\n * ```js\n * function formatter(value) {\n * if (value) {\n * return value.toUpperCase();\n * }\n * }\n * ngModel.$formatters.push(formatter);\n * ```\n *\n * @property {Object.<string, function>} $validators A collection of validators that are applied\n * whenever the model value changes. The key value within the object refers to the name of the\n * validator while the function refers to the validation operation. The validation operation is\n * provided with the model value as an argument and must return a true or false value depending\n * on the response of that validation.\n *\n * ```js\n * ngModel.$validators.validCharacters = function(modelValue, viewValue) {\n * var value = modelValue || viewValue;\n * return /[0-9]+/.test(value) &&\n * /[a-z]+/.test(value) &&\n * /[A-Z]+/.test(value) &&\n * /\\W+/.test(value);\n * };\n * ```\n *\n * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to\n * perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided\n * is expected to return a promise when it is run during the model validation process. Once the promise\n * is delivered then the validation status will be set to true when fulfilled and false when rejected.\n * When the asynchronous validators are triggered, each of the validators will run in parallel and the model\n * value will only be updated once all validators have been fulfilled. As long as an asynchronous validator\n * is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators\n * will only run once all synchronous validators have passed.\n *\n * Please note that if $http is used then it is important that the server returns a success HTTP response code\n * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.\n *\n * ```js\n * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {\n * var value = modelValue || viewValue;\n *\n * // Lookup user by username\n * return $http.get('/api/users/' + value).\n * then(function resolved() {\n * //username exists, this means validation fails\n * return $q.reject('exists');\n * }, function rejected() {\n * //username does not exist, therefore this validation passes\n * return true;\n * });\n * };\n * ```\n *\n * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the\n * view value has changed. It is called with no arguments, and its return value is ignored.\n * This can be used in place of additional $watches against the model value.\n *\n * @property {Object} $error An object hash with all failing validator ids as keys.\n * @property {Object} $pending An object hash with all pending validator ids as keys.\n *\n * @property {boolean} $untouched True if control has not lost focus yet.\n * @property {boolean} $touched True if control has lost focus.\n * @property {boolean} $pristine True if user has not interacted with the control yet.\n * @property {boolean} $dirty True if user has already interacted with the control.\n * @property {boolean} $valid True if there is no error.\n * @property {boolean} $invalid True if at least one error on the control.\n * @property {string} $name The name attribute of the control.\n *\n * @description\n *\n * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.\n * The controller contains services for data-binding, validation, CSS updates, and value formatting\n * and parsing. It purposefully does not contain any logic which deals with DOM rendering or\n * listening to DOM events.\n * Such DOM related logic should be provided by other directives which make use of\n * `NgModelController` for data-binding to control elements.\n * Angular provides this DOM logic for most {@link input `input`} elements.\n * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example\n * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.\n *\n * @example\n * ### Custom Control Example\n * This example shows how to use `NgModelController` with a custom control to achieve\n * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)\n * collaborate together to achieve the desired result.\n *\n * `contenteditable` is an HTML5 attribute, which tells the browser to let the element\n * contents be edited in place by the user.\n *\n * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}\n * module to automatically remove \"bad\" content like inline event listener (e.g. `<span onclick=\"...\">`).\n * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks\n * that content using the `$sce` service.\n *\n * <example name=\"NgModelController\" module=\"customControl\" deps=\"angular-sanitize.js\">\n <file name=\"style.css\">\n [contenteditable] {\n border: 1px solid black;\n background-color: white;\n min-height: 20px;\n }\n\n .ng-invalid {\n border: 1px solid red;\n }\n\n </file>\n <file name=\"script.js\">\n angular.module('customControl', ['ngSanitize']).\n directive('contenteditable', ['$sce', function($sce) {\n return {\n restrict: 'A', // only activate on element attribute\n require: '?ngModel', // get a hold of NgModelController\n link: function(scope, element, attrs, ngModel) {\n if (!ngModel) return; // do nothing if no ng-model\n\n // Specify how UI should be updated\n ngModel.$render = function() {\n element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));\n };\n\n // Listen for change events to enable binding\n element.on('blur keyup change', function() {\n scope.$evalAsync(read);\n });\n read(); // initialize\n\n // Write data to the model\n function read() {\n var html = element.html();\n // When we clear the content editable the browser leaves a <br> behind\n // If strip-br attribute is provided then we strip this out\n if ( attrs.stripBr && html == '<br>' ) {\n html = '';\n }\n ngModel.$setViewValue(html);\n }\n }\n };\n }]);\n </file>\n <file name=\"index.html\">\n <form name=\"myForm\">\n <div contenteditable\n name=\"myWidget\" ng-model=\"userContent\"\n strip-br=\"true\"\n required>Change me!</div>\n <span ng-show=\"myForm.myWidget.$error.required\">Required!</span>\n <hr>\n <textarea ng-model=\"userContent\" aria-label=\"Dynamic textarea\"></textarea>\n </form>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should data-bind and become invalid', function() {\n if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {\n // SafariDriver can't handle contenteditable\n // and Firefox driver can't clear contenteditables very well\n return;\n }\n var contentEditable = element(by.css('[contenteditable]'));\n var content = 'Change me!';\n\n expect(contentEditable.getText()).toEqual(content);\n\n contentEditable.clear();\n contentEditable.sendKeys(protractor.Key.BACK_SPACE);\n expect(contentEditable.getText()).toEqual('');\n expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);\n });\n </file>\n * </example>\n *\n *\n */\nvar NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',\n function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {\n this.$viewValue = Number.NaN;\n this.$modelValue = Number.NaN;\n this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.\n this.$validators = {};\n this.$asyncValidators = {};\n this.$parsers = [];\n this.$formatters = [];\n this.$viewChangeListeners = [];\n this.$untouched = true;\n this.$touched = false;\n this.$pristine = true;\n this.$dirty = false;\n this.$valid = true;\n this.$invalid = false;\n this.$error = {}; // keep invalid keys here\n this.$$success = {}; // keep valid keys here\n this.$pending = undefined; // keep pending keys here\n this.$name = $interpolate($attr.name || '', false)($scope);\n this.$$parentForm = nullFormCtrl;\n\n var parsedNgModel = $parse($attr.ngModel),\n parsedNgModelAssign = parsedNgModel.assign,\n ngModelGet = parsedNgModel,\n ngModelSet = parsedNgModelAssign,\n pendingDebounce = null,\n parserValid,\n ctrl = this;\n\n this.$$setOptions = function(options) {\n ctrl.$options = options;\n if (options && options.getterSetter) {\n var invokeModelGetter = $parse($attr.ngModel + '()'),\n invokeModelSetter = $parse($attr.ngModel + '($$$p)');\n\n ngModelGet = function($scope) {\n var modelValue = parsedNgModel($scope);\n if (isFunction(modelValue)) {\n modelValue = invokeModelGetter($scope);\n }\n return modelValue;\n };\n ngModelSet = function($scope, newValue) {\n if (isFunction(parsedNgModel($scope))) {\n invokeModelSetter($scope, {$$$p: ctrl.$modelValue});\n } else {\n parsedNgModelAssign($scope, ctrl.$modelValue);\n }\n };\n } else if (!parsedNgModel.assign) {\n throw ngModelMinErr('nonassign', \"Expression '{0}' is non-assignable. Element: {1}\",\n $attr.ngModel, startingTag($element));\n }\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$render\n *\n * @description\n * Called when the view needs to be updated. It is expected that the user of the ng-model\n * directive will implement this method.\n *\n * The `$render()` method is invoked in the following situations:\n *\n * * `$rollbackViewValue()` is called. If we are rolling back the view value to the last\n * committed value then `$render()` is called to update the input control.\n * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and\n * the `$viewValue` are different from last time.\n *\n * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of\n * `$modelValue` and `$viewValue` are actually different from their previous value. If `$modelValue`\n * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be\n * invoked if you only change a property on the objects.\n */\n this.$render = noop;\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$isEmpty\n *\n * @description\n * This is called when we need to determine if the value of an input is empty.\n *\n * For instance, the required directive does this to work out if the input has data or not.\n *\n * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.\n *\n * You can override this for input directives whose concept of being empty is different from the\n * default. The `checkboxInputType` directive does this because in its case a value of `false`\n * implies empty.\n *\n * @param {*} value The value of the input to check for emptiness.\n * @returns {boolean} True if `value` is \"empty\".\n */\n this.$isEmpty = function(value) {\n return isUndefined(value) || value === '' || value === null || value !== value;\n };\n\n var currentValidationRunId = 0;\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$setValidity\n *\n * @description\n * Change the validity state, and notify the form.\n *\n * This method can be called within $parsers/$formatters or a custom validation implementation.\n * However, in most cases it should be sufficient to use the `ngModel.$validators` and\n * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.\n *\n * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned\n * to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`\n * (for unfulfilled `$asyncValidators`), so that it is available for data-binding.\n * The `validationErrorKey` should be in camelCase and will get converted into dash-case\n * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`\n * class and can be bound to as `{{someForm.someControl.$error.myError}}` .\n * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),\n * or skipped (null). Pending is used for unfulfilled `$asyncValidators`.\n * Skipped is used by Angular when validators do not run because of parse errors and\n * when `$asyncValidators` do not run because any of the `$validators` failed.\n */\n addSetValidityMethod({\n ctrl: this,\n $element: $element,\n set: function(object, property) {\n object[property] = true;\n },\n unset: function(object, property) {\n delete object[property];\n },\n $animate: $animate\n });\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$setPristine\n *\n * @description\n * Sets the control to its pristine state.\n *\n * This method can be called to remove the `ng-dirty` class and set the control to its pristine\n * state (`ng-pristine` class). A model is considered to be pristine when the control\n * has not been changed from when first compiled.\n */\n this.$setPristine = function() {\n ctrl.$dirty = false;\n ctrl.$pristine = true;\n $animate.removeClass($element, DIRTY_CLASS);\n $animate.addClass($element, PRISTINE_CLASS);\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$setDirty\n *\n * @description\n * Sets the control to its dirty state.\n *\n * This method can be called to remove the `ng-pristine` class and set the control to its dirty\n * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed\n * from when first compiled.\n */\n this.$setDirty = function() {\n ctrl.$dirty = true;\n ctrl.$pristine = false;\n $animate.removeClass($element, PRISTINE_CLASS);\n $animate.addClass($element, DIRTY_CLASS);\n ctrl.$$parentForm.$setDirty();\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$setUntouched\n *\n * @description\n * Sets the control to its untouched state.\n *\n * This method can be called to remove the `ng-touched` class and set the control to its\n * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched\n * by default, however this function can be used to restore that state if the model has\n * already been touched by the user.\n */\n this.$setUntouched = function() {\n ctrl.$touched = false;\n ctrl.$untouched = true;\n $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$setTouched\n *\n * @description\n * Sets the control to its touched state.\n *\n * This method can be called to remove the `ng-untouched` class and set the control to its\n * touched state (`ng-touched` class). A model is considered to be touched when the user has\n * first focused the control element and then shifted focus away from the control (blur event).\n */\n this.$setTouched = function() {\n ctrl.$touched = true;\n ctrl.$untouched = false;\n $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$rollbackViewValue\n *\n * @description\n * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,\n * which may be caused by a pending debounced event or because the input is waiting for a some\n * future event.\n *\n * If you have an input that uses `ng-model-options` to set up debounced updates or updates that\n * depend on special events such as blur, you can have a situation where there is a period when\n * the `$viewValue` is out of sync with the ngModel's `$modelValue`.\n *\n * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update\n * and reset the input to the last committed view value.\n *\n * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`\n * programmatically before these debounced/future events have resolved/occurred, because Angular's\n * dirty checking mechanism is not able to tell whether the model has actually changed or not.\n *\n * The `$rollbackViewValue()` method should be called before programmatically changing the model of an\n * input which may have such events pending. This is important in order to make sure that the\n * input field will be updated with the new model value and any pending operations are cancelled.\n *\n * <example name=\"ng-model-cancel-update\" module=\"cancel-update-example\">\n * <file name=\"app.js\">\n * angular.module('cancel-update-example', [])\n *\n * .controller('CancelUpdateController', ['$scope', function($scope) {\n * $scope.model = {};\n *\n * $scope.setEmpty = function(e, value, rollback) {\n * if (e.keyCode == 27) {\n * e.preventDefault();\n * if (rollback) {\n * $scope.myForm[value].$rollbackViewValue();\n * }\n * $scope.model[value] = '';\n * }\n * };\n * }]);\n * </file>\n * <file name=\"index.html\">\n * <div ng-controller=\"CancelUpdateController\">\n * <p>Both of these inputs are only updated if they are blurred. Hitting escape should\n * empty them. Follow these steps and observe the difference:</p>\n * <ol>\n * <li>Type something in the input. You will see that the model is not yet updated</li>\n * <li>Press the Escape key.\n * <ol>\n * <li> In the first example, nothing happens, because the model is already '', and no\n * update is detected. If you blur the input, the model will be set to the current view.\n * </li>\n * <li> In the second example, the pending update is cancelled, and the input is set back\n * to the last committed view value (''). Blurring the input does nothing.\n * </li>\n * </ol>\n * </li>\n * </ol>\n *\n * <form name=\"myForm\" ng-model-options=\"{ updateOn: 'blur' }\">\n * <div>\n * <p id=\"inputDescription1\">Without $rollbackViewValue():</p>\n * <input name=\"value1\" aria-describedby=\"inputDescription1\" ng-model=\"model.value1\"\n * ng-keydown=\"setEmpty($event, 'value1')\">\n * value1: \"{{ model.value1 }}\"\n * </div>\n *\n * <div>\n * <p id=\"inputDescription2\">With $rollbackViewValue():</p>\n * <input name=\"value2\" aria-describedby=\"inputDescription2\" ng-model=\"model.value2\"\n * ng-keydown=\"setEmpty($event, 'value2', true)\">\n * value2: \"{{ model.value2 }}\"\n * </div>\n * </form>\n * </div>\n * </file>\n <file name=\"style.css\">\n div {\n display: table-cell;\n }\n div:nth-child(1) {\n padding-right: 30px;\n }\n\n </file>\n * </example>\n */\n this.$rollbackViewValue = function() {\n $timeout.cancel(pendingDebounce);\n ctrl.$viewValue = ctrl.$$lastCommittedViewValue;\n ctrl.$render();\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$validate\n *\n * @description\n * Runs each of the registered validators (first synchronous validators and then\n * asynchronous validators).\n * If the validity changes to invalid, the model will be set to `undefined`,\n * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.\n * If the validity changes to valid, it will set the model to the last available valid\n * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.\n */\n this.$validate = function() {\n // ignore $validate before model is initialized\n if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n return;\n }\n\n var viewValue = ctrl.$$lastCommittedViewValue;\n // Note: we use the $$rawModelValue as $modelValue might have been\n // set to undefined during a view -> model update that found validation\n // errors. We can't parse the view here, since that could change\n // the model although neither viewValue nor the model on the scope changed\n var modelValue = ctrl.$$rawModelValue;\n\n var prevValid = ctrl.$valid;\n var prevModelValue = ctrl.$modelValue;\n\n var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n\n ctrl.$$runValidators(modelValue, viewValue, function(allValid) {\n // If there was no change in validity, don't update the model\n // This prevents changing an invalid modelValue to undefined\n if (!allowInvalid && prevValid !== allValid) {\n // Note: Don't check ctrl.$valid here, as we could have\n // external validators (e.g. calculated on the server),\n // that just call $setValidity and need the model value\n // to calculate their validity.\n ctrl.$modelValue = allValid ? modelValue : undefined;\n\n if (ctrl.$modelValue !== prevModelValue) {\n ctrl.$$writeModelToScope();\n }\n }\n });\n\n };\n\n this.$$runValidators = function(modelValue, viewValue, doneCallback) {\n currentValidationRunId++;\n var localValidationRunId = currentValidationRunId;\n\n // check parser error\n if (!processParseErrors()) {\n validationDone(false);\n return;\n }\n if (!processSyncValidators()) {\n validationDone(false);\n return;\n }\n processAsyncValidators();\n\n function processParseErrors() {\n var errorKey = ctrl.$$parserName || 'parse';\n if (isUndefined(parserValid)) {\n setValidity(errorKey, null);\n } else {\n if (!parserValid) {\n forEach(ctrl.$validators, function(v, name) {\n setValidity(name, null);\n });\n forEach(ctrl.$asyncValidators, function(v, name) {\n setValidity(name, null);\n });\n }\n // Set the parse error last, to prevent unsetting it, should a $validators key == parserName\n setValidity(errorKey, parserValid);\n return parserValid;\n }\n return true;\n }\n\n function processSyncValidators() {\n var syncValidatorsValid = true;\n forEach(ctrl.$validators, function(validator, name) {\n var result = validator(modelValue, viewValue);\n syncValidatorsValid = syncValidatorsValid && result;\n setValidity(name, result);\n });\n if (!syncValidatorsValid) {\n forEach(ctrl.$asyncValidators, function(v, name) {\n setValidity(name, null);\n });\n return false;\n }\n return true;\n }\n\n function processAsyncValidators() {\n var validatorPromises = [];\n var allValid = true;\n forEach(ctrl.$asyncValidators, function(validator, name) {\n var promise = validator(modelValue, viewValue);\n if (!isPromiseLike(promise)) {\n throw ngModelMinErr('nopromise',\n \"Expected asynchronous validator to return a promise but got '{0}' instead.\", promise);\n }\n setValidity(name, undefined);\n validatorPromises.push(promise.then(function() {\n setValidity(name, true);\n }, function(error) {\n allValid = false;\n setValidity(name, false);\n }));\n });\n if (!validatorPromises.length) {\n validationDone(true);\n } else {\n $q.all(validatorPromises).then(function() {\n validationDone(allValid);\n }, noop);\n }\n }\n\n function setValidity(name, isValid) {\n if (localValidationRunId === currentValidationRunId) {\n ctrl.$setValidity(name, isValid);\n }\n }\n\n function validationDone(allValid) {\n if (localValidationRunId === currentValidationRunId) {\n\n doneCallback(allValid);\n }\n }\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$commitViewValue\n *\n * @description\n * Commit a pending update to the `$modelValue`.\n *\n * Updates may be pending by a debounced event or because the input is waiting for a some future\n * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`\n * usually handles calling this in response to input events.\n */\n this.$commitViewValue = function() {\n var viewValue = ctrl.$viewValue;\n\n $timeout.cancel(pendingDebounce);\n\n // If the view value has not changed then we should just exit, except in the case where there is\n // a native validator on the element. In this case the validation state may have changed even though\n // the viewValue has stayed empty.\n if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {\n return;\n }\n ctrl.$$lastCommittedViewValue = viewValue;\n\n // change to dirty\n if (ctrl.$pristine) {\n this.$setDirty();\n }\n this.$$parseAndValidate();\n };\n\n this.$$parseAndValidate = function() {\n var viewValue = ctrl.$$lastCommittedViewValue;\n var modelValue = viewValue;\n parserValid = isUndefined(modelValue) ? undefined : true;\n\n if (parserValid) {\n for (var i = 0; i < ctrl.$parsers.length; i++) {\n modelValue = ctrl.$parsers[i](modelValue);\n if (isUndefined(modelValue)) {\n parserValid = false;\n break;\n }\n }\n }\n if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n // ctrl.$modelValue has not been touched yet...\n ctrl.$modelValue = ngModelGet($scope);\n }\n var prevModelValue = ctrl.$modelValue;\n var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n ctrl.$$rawModelValue = modelValue;\n\n if (allowInvalid) {\n ctrl.$modelValue = modelValue;\n writeToModelIfNeeded();\n }\n\n // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.\n // This can happen if e.g. $setViewValue is called from inside a parser\n ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {\n if (!allowInvalid) {\n // Note: Don't check ctrl.$valid here, as we could have\n // external validators (e.g. calculated on the server),\n // that just call $setValidity and need the model value\n // to calculate their validity.\n ctrl.$modelValue = allValid ? modelValue : undefined;\n writeToModelIfNeeded();\n }\n });\n\n function writeToModelIfNeeded() {\n if (ctrl.$modelValue !== prevModelValue) {\n ctrl.$$writeModelToScope();\n }\n }\n };\n\n this.$$writeModelToScope = function() {\n ngModelSet($scope, ctrl.$modelValue);\n forEach(ctrl.$viewChangeListeners, function(listener) {\n try {\n listener();\n } catch (e) {\n $exceptionHandler(e);\n }\n });\n };\n\n /**\n * @ngdoc method\n * @name ngModel.NgModelController#$setViewValue\n *\n * @description\n * Update the view value.\n *\n * This method should be called when a control wants to change the view value; typically,\n * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}\n * directive calls it when the value of the input changes and {@link ng.directive:select select}\n * calls it when an option is selected.\n *\n * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`\n * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged\n * value sent directly for processing, finally to be applied to `$modelValue` and then the\n * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,\n * in the `$viewChangeListeners` list, are called.\n *\n * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`\n * and the `default` trigger is not listed, all those actions will remain pending until one of the\n * `updateOn` events is triggered on the DOM element.\n * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}\n * directive is used with a custom debounce for this particular event.\n * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`\n * is specified, once the timer runs out.\n *\n * When used with standard inputs, the view value will always be a string (which is in some cases\n * parsed into another type, such as a `Date` object for `input[date]`.)\n * However, custom controls might also pass objects to this method. In this case, we should make\n * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not\n * perform a deep watch of objects, it only looks for a change of identity. If you only change\n * the property of the object then ngModel will not realise that the object has changed and\n * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should\n * not change properties of the copy once it has been passed to `$setViewValue`.\n * Otherwise you may cause the model value on the scope to change incorrectly.\n *\n * <div class=\"alert alert-info\">\n * In any case, the value passed to the method should always reflect the current value\n * of the control. For example, if you are calling `$setViewValue` for an input element,\n * you should pass the input DOM value. Otherwise, the control and the scope model become\n * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change\n * the control's DOM value in any way. If we want to change the control's DOM value\n * programmatically, we should update the `ngModel` scope expression. Its new value will be\n * picked up by the model controller, which will run it through the `$formatters`, `$render` it\n * to update the DOM, and finally call `$validate` on it.\n * </div>\n *\n * @param {*} value value from the view.\n * @param {string} trigger Event that triggered the update.\n */\n this.$setViewValue = function(value, trigger) {\n ctrl.$viewValue = value;\n if (!ctrl.$options || ctrl.$options.updateOnDefault) {\n ctrl.$$debounceViewValueCommit(trigger);\n }\n };\n\n this.$$debounceViewValueCommit = function(trigger) {\n var debounceDelay = 0,\n options = ctrl.$options,\n debounce;\n\n if (options && isDefined(options.debounce)) {\n debounce = options.debounce;\n if (isNumber(debounce)) {\n debounceDelay = debounce;\n } else if (isNumber(debounce[trigger])) {\n debounceDelay = debounce[trigger];\n } else if (isNumber(debounce['default'])) {\n debounceDelay = debounce['default'];\n }\n }\n\n $timeout.cancel(pendingDebounce);\n if (debounceDelay) {\n pendingDebounce = $timeout(function() {\n ctrl.$commitViewValue();\n }, debounceDelay);\n } else if ($rootScope.$$phase) {\n ctrl.$commitViewValue();\n } else {\n $scope.$apply(function() {\n ctrl.$commitViewValue();\n });\n }\n };\n\n // model -> value\n // Note: we cannot use a normal scope.$watch as we want to detect the following:\n // 1. scope value is 'a'\n // 2. user enters 'b'\n // 3. ng-change kicks in and reverts scope value to 'a'\n // -> scope value did not change since the last digest as\n // ng-change executes in apply phase\n // 4. view should be changed back to 'a'\n $scope.$watch(function ngModelWatch() {\n var modelValue = ngModelGet($scope);\n\n // if scope model value and ngModel value are out of sync\n // TODO(perf): why not move this to the action fn?\n if (modelValue !== ctrl.$modelValue &&\n // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator\n (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)\n ) {\n ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;\n parserValid = undefined;\n\n var formatters = ctrl.$formatters,\n idx = formatters.length;\n\n var viewValue = modelValue;\n while (idx--) {\n viewValue = formatters[idx](viewValue);\n }\n if (ctrl.$viewValue !== viewValue) {\n ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;\n ctrl.$render();\n\n ctrl.$$runValidators(modelValue, viewValue, noop);\n }\n }\n\n return modelValue;\n });\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngModel\n *\n * @element input\n * @priority 1\n *\n * @description\n * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a\n * property on the scope using {@link ngModel.NgModelController NgModelController},\n * which is created and exposed by this directive.\n *\n * `ngModel` is responsible for:\n *\n * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`\n * require.\n * - Providing validation behavior (i.e. required, number, email, url).\n * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).\n * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`, `ng-untouched`) including animations.\n * - Registering the control with its parent {@link ng.directive:form form}.\n *\n * Note: `ngModel` will try to bind to the property given by evaluating the expression on the\n * current scope. If the property doesn't already exist on this scope, it will be created\n * implicitly and added to the scope.\n *\n * For best practices on using `ngModel`, see:\n *\n * - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)\n *\n * For basic examples, how to use `ngModel`, see:\n *\n * - {@link ng.directive:input input}\n * - {@link input[text] text}\n * - {@link input[checkbox] checkbox}\n * - {@link input[radio] radio}\n * - {@link input[number] number}\n * - {@link input[email] email}\n * - {@link input[url] url}\n * - {@link input[date] date}\n * - {@link input[datetime-local] datetime-local}\n * - {@link input[time] time}\n * - {@link input[month] month}\n * - {@link input[week] week}\n * - {@link ng.directive:select select}\n * - {@link ng.directive:textarea textarea}\n *\n * # Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the\n * object or collection change, `ngModel` will not be notified and so the input will not be re-rendered.\n *\n * The model must be assigned an entirely new object or collection before a re-rendering will occur.\n *\n * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression\n * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or\n * if the select is given the `multiple` attribute.\n *\n * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the\n * first level of the object (or only changing the properties of an item in the collection if it's an array) will still\n * not trigger a re-rendering of the model.\n *\n * # CSS classes\n * The following CSS classes are added and removed on the associated input/select/textarea element\n * depending on the validity of the model.\n *\n * - `ng-valid`: the model is valid\n * - `ng-invalid`: the model is invalid\n * - `ng-valid-[key]`: for each valid key added by `$setValidity`\n * - `ng-invalid-[key]`: for each invalid key added by `$setValidity`\n * - `ng-pristine`: the control hasn't been interacted with yet\n * - `ng-dirty`: the control has been interacted with\n * - `ng-touched`: the control has been blurred\n * - `ng-untouched`: the control hasn't been blurred\n * - `ng-pending`: any `$asyncValidators` are unfulfilled\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n * ## Animation Hooks\n *\n * Animations within models are triggered when any of the associated CSS classes are added and removed\n * on the input element which is attached to the model. These classes are: `.ng-pristine`, `.ng-dirty`,\n * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.\n * The animations that are triggered within ngModel are similar to how they work in ngClass and\n * animations can be hooked into using CSS transitions, keyframes as well as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style an input element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-input {\n * transition:0.5s linear all;\n * background: white;\n * }\n * .my-input.ng-invalid {\n * background: red;\n * color:white;\n * }\n * </pre>\n *\n * @example\n * <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"inputExample\">\n <file name=\"index.html\">\n <script>\n angular.module('inputExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.val = '1';\n }]);\n </script>\n <style>\n .my-input {\n transition:all linear 0.5s;\n background: transparent;\n }\n .my-input.ng-invalid {\n color:white;\n background: red;\n }\n </style>\n <p id=\"inputDescription\">\n Update input to see transitions when valid/invalid.\n Integer is a valid value.\n </p>\n <form name=\"testForm\" ng-controller=\"ExampleController\">\n <input ng-model=\"val\" ng-pattern=\"/^\\d+$/\" name=\"anim\" class=\"my-input\"\n aria-describedby=\"inputDescription\" />\n </form>\n </file>\n * </example>\n *\n * ## Binding to a getter/setter\n *\n * Sometimes it's helpful to bind `ngModel` to a getter/setter function. A getter/setter is a\n * function that returns a representation of the model when called with zero arguments, and sets\n * the internal state of a model when called with an argument. It's sometimes useful to use this\n * for models that have an internal representation that's different from what the model exposes\n * to the view.\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more\n * frequently than other parts of your code.\n * </div>\n *\n * You use this behavior by adding `ng-model-options=\"{ getterSetter: true }\"` to an element that\n * has `ng-model` attached to it. You can also add `ng-model-options=\"{ getterSetter: true }\"` to\n * a `<form>`, which will enable this behavior for all `<input>`s within it. See\n * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.\n *\n * The following example shows how to use `ngModel` with a getter/setter:\n *\n * @example\n * <example name=\"ngModel-getter-setter\" module=\"getterSetterExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form name=\"userForm\">\n <label>Name:\n <input type=\"text\" name=\"userName\"\n ng-model=\"user.name\"\n ng-model-options=\"{ getterSetter: true }\" />\n </label>\n </form>\n <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n </div>\n </file>\n <file name=\"app.js\">\n angular.module('getterSetterExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n var _name = 'Brian';\n $scope.user = {\n name: function(newName) {\n // Note that newName can be undefined for two reasons:\n // 1. Because it is called as a getter and thus called with no arguments\n // 2. Because the property should actually be set to undefined. This happens e.g. if the\n // input is invalid\n return arguments.length ? (_name = newName) : _name;\n }\n };\n }]);\n </file>\n * </example>\n */\nvar ngModelDirective = ['$rootScope', function($rootScope) {\n return {\n restrict: 'A',\n require: ['ngModel', '^?form', '^?ngModelOptions'],\n controller: NgModelController,\n // Prelink needs to run before any input directive\n // so that we can set the NgModelOptions in NgModelController\n // before anyone else uses it.\n priority: 1,\n compile: function ngModelCompile(element) {\n // Setup initial state of the control\n element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);\n\n return {\n pre: function ngModelPreLink(scope, element, attr, ctrls) {\n var modelCtrl = ctrls[0],\n formCtrl = ctrls[1] || modelCtrl.$$parentForm;\n\n modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);\n\n // notify others, especially parent forms\n formCtrl.$addControl(modelCtrl);\n\n attr.$observe('name', function(newValue) {\n if (modelCtrl.$name !== newValue) {\n modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);\n }\n });\n\n scope.$on('$destroy', function() {\n modelCtrl.$$parentForm.$removeControl(modelCtrl);\n });\n },\n post: function ngModelPostLink(scope, element, attr, ctrls) {\n var modelCtrl = ctrls[0];\n if (modelCtrl.$options && modelCtrl.$options.updateOn) {\n element.on(modelCtrl.$options.updateOn, function(ev) {\n modelCtrl.$$debounceViewValueCommit(ev && ev.type);\n });\n }\n\n element.on('blur', function(ev) {\n if (modelCtrl.$touched) return;\n\n if ($rootScope.$$phase) {\n scope.$evalAsync(modelCtrl.$setTouched);\n } else {\n scope.$apply(modelCtrl.$setTouched);\n }\n });\n }\n };\n }\n };\n}];\n\nvar DEFAULT_REGEXP = /(\\s+|^)default(\\s+|$)/;\n\n/**\n * @ngdoc directive\n * @name ngModelOptions\n *\n * @description\n * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of\n * events that will trigger a model update and/or a debouncing delay so that the actual update only\n * takes place when a timer expires; this timer will be reset after another change takes place.\n *\n * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might\n * be different from the value in the actual model. This means that if you update the model you\n * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in\n * order to make sure it is synchronized with the model and that any debounced action is canceled.\n *\n * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}\n * method is by making sure the input is placed inside a form that has a `name` attribute. This is\n * important because `form` controllers are published to the related scope under the name in their\n * `name` attribute.\n *\n * Any pending changes will take place immediately when an enclosing form is submitted via the\n * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * `ngModelOptions` has an effect on the element it's declared on and its descendants.\n *\n * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:\n * - `updateOn`: string specifying which event should the input be bound to. You can set several\n * events using an space delimited list. There is a special event called `default` that\n * matches the default events belonging of the control.\n * - `debounce`: integer value which contains the debounce model update value in milliseconds. A\n * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a\n * custom value for each event. For example:\n * `ng-model-options=\"{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }\"`\n * - `allowInvalid`: boolean value which indicates that the model can be set with values that did\n * not validate correctly instead of the default behavior of setting the model to undefined.\n * - `getterSetter`: boolean value which determines whether or not to treat functions bound to\n `ngModel` as getters/setters.\n * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for\n * `<input type=\"date\">`, `<input type=\"time\">`, ... . It understands UTC/GMT and the\n * continental US time zone abbreviations, but for general use, use a time zone offset, for\n * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n * If not specified, the timezone of the browser will be used.\n *\n * @example\n\n The following example shows how to override immediate updates. Changes on the inputs within the\n form will update the model only when the control loses focus (blur event). If `escape` key is\n pressed while the input field is focused, the value is reset to the value in the current model.\n\n <example name=\"ngModelOptions-directive-blur\" module=\"optionsExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form name=\"userForm\">\n <label>Name:\n <input type=\"text\" name=\"userName\"\n ng-model=\"user.name\"\n ng-model-options=\"{ updateOn: 'blur' }\"\n ng-keyup=\"cancel($event)\" />\n </label><br />\n <label>Other data:\n <input type=\"text\" ng-model=\"user.data\" />\n </label><br />\n </form>\n <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n <pre>user.data = <span ng-bind=\"user.data\"></span></pre>\n </div>\n </file>\n <file name=\"app.js\">\n angular.module('optionsExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.user = { name: 'John', data: '' };\n\n $scope.cancel = function(e) {\n if (e.keyCode == 27) {\n $scope.userForm.userName.$rollbackViewValue();\n }\n };\n }]);\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var model = element(by.binding('user.name'));\n var input = element(by.model('user.name'));\n var other = element(by.model('user.data'));\n\n it('should allow custom events', function() {\n input.sendKeys(' Doe');\n input.click();\n expect(model.getText()).toEqual('John');\n other.click();\n expect(model.getText()).toEqual('John Doe');\n });\n\n it('should $rollbackViewValue when model changes', function() {\n input.sendKeys(' Doe');\n expect(input.getAttribute('value')).toEqual('John Doe');\n input.sendKeys(protractor.Key.ESCAPE);\n expect(input.getAttribute('value')).toEqual('John');\n other.click();\n expect(model.getText()).toEqual('John');\n });\n </file>\n </example>\n\n This one shows how to debounce model changes. Model will be updated only 1 sec after last change.\n If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.\n\n <example name=\"ngModelOptions-directive-debounce\" module=\"optionsExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form name=\"userForm\">\n <label>Name:\n <input type=\"text\" name=\"userName\"\n ng-model=\"user.name\"\n ng-model-options=\"{ debounce: 1000 }\" />\n </label>\n <button ng-click=\"userForm.userName.$rollbackViewValue(); user.name=''\">Clear</button>\n <br />\n </form>\n <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n </div>\n </file>\n <file name=\"app.js\">\n angular.module('optionsExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.user = { name: 'Igor' };\n }]);\n </file>\n </example>\n\n This one shows how to bind to getter/setters:\n\n <example name=\"ngModelOptions-directive-getter-setter\" module=\"getterSetterExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form name=\"userForm\">\n <label>Name:\n <input type=\"text\" name=\"userName\"\n ng-model=\"user.name\"\n ng-model-options=\"{ getterSetter: true }\" />\n </label>\n </form>\n <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n </div>\n </file>\n <file name=\"app.js\">\n angular.module('getterSetterExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n var _name = 'Brian';\n $scope.user = {\n name: function(newName) {\n // Note that newName can be undefined for two reasons:\n // 1. Because it is called as a getter and thus called with no arguments\n // 2. Because the property should actually be set to undefined. This happens e.g. if the\n // input is invalid\n return arguments.length ? (_name = newName) : _name;\n }\n };\n }]);\n </file>\n </example>\n */\nvar ngModelOptionsDirective = function() {\n return {\n restrict: 'A',\n controller: ['$scope', '$attrs', function($scope, $attrs) {\n var that = this;\n this.$options = copy($scope.$eval($attrs.ngModelOptions));\n // Allow adding/overriding bound events\n if (isDefined(this.$options.updateOn)) {\n this.$options.updateOnDefault = false;\n // extract \"default\" pseudo-event from list of events that can trigger a model update\n this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {\n that.$options.updateOnDefault = true;\n return ' ';\n }));\n } else {\n this.$options.updateOnDefault = true;\n }\n }]\n };\n};\n\n\n\n// helper methods\nfunction addSetValidityMethod(context) {\n var ctrl = context.ctrl,\n $element = context.$element,\n classCache = {},\n set = context.set,\n unset = context.unset,\n $animate = context.$animate;\n\n classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));\n\n ctrl.$setValidity = setValidity;\n\n function setValidity(validationErrorKey, state, controller) {\n if (isUndefined(state)) {\n createAndSet('$pending', validationErrorKey, controller);\n } else {\n unsetAndCleanup('$pending', validationErrorKey, controller);\n }\n if (!isBoolean(state)) {\n unset(ctrl.$error, validationErrorKey, controller);\n unset(ctrl.$$success, validationErrorKey, controller);\n } else {\n if (state) {\n unset(ctrl.$error, validationErrorKey, controller);\n set(ctrl.$$success, validationErrorKey, controller);\n } else {\n set(ctrl.$error, validationErrorKey, controller);\n unset(ctrl.$$success, validationErrorKey, controller);\n }\n }\n if (ctrl.$pending) {\n cachedToggleClass(PENDING_CLASS, true);\n ctrl.$valid = ctrl.$invalid = undefined;\n toggleValidationCss('', null);\n } else {\n cachedToggleClass(PENDING_CLASS, false);\n ctrl.$valid = isObjectEmpty(ctrl.$error);\n ctrl.$invalid = !ctrl.$valid;\n toggleValidationCss('', ctrl.$valid);\n }\n\n // re-read the state as the set/unset methods could have\n // combined state in ctrl.$error[validationError] (used for forms),\n // where setting/unsetting only increments/decrements the value,\n // and does not replace it.\n var combinedState;\n if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {\n combinedState = undefined;\n } else if (ctrl.$error[validationErrorKey]) {\n combinedState = false;\n } else if (ctrl.$$success[validationErrorKey]) {\n combinedState = true;\n } else {\n combinedState = null;\n }\n\n toggleValidationCss(validationErrorKey, combinedState);\n ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);\n }\n\n function createAndSet(name, value, controller) {\n if (!ctrl[name]) {\n ctrl[name] = {};\n }\n set(ctrl[name], value, controller);\n }\n\n function unsetAndCleanup(name, value, controller) {\n if (ctrl[name]) {\n unset(ctrl[name], value, controller);\n }\n if (isObjectEmpty(ctrl[name])) {\n ctrl[name] = undefined;\n }\n }\n\n function cachedToggleClass(className, switchValue) {\n if (switchValue && !classCache[className]) {\n $animate.addClass($element, className);\n classCache[className] = true;\n } else if (!switchValue && classCache[className]) {\n $animate.removeClass($element, className);\n classCache[className] = false;\n }\n }\n\n function toggleValidationCss(validationErrorKey, isValid) {\n validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n\n cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);\n cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);\n }\n}\n\nfunction isObjectEmpty(obj) {\n if (obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @ngdoc directive\n * @name ngNonBindable\n * @restrict AC\n * @priority 1000\n *\n * @description\n * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current\n * DOM element. This is useful if the element contains what appears to be Angular directives and\n * bindings but which should be ignored by Angular. This could be the case if you have a site that\n * displays snippets of code, for instance.\n *\n * @element ANY\n *\n * @example\n * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,\n * but the one wrapped in `ngNonBindable` is left alone.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <div>Normal: {{1 + 2}}</div>\n <div ng-non-bindable>Ignored: {{1 + 2}}</div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-non-bindable', function() {\n expect(element(by.binding('1 + 2')).getText()).toContain('3');\n expect(element.all(by.css('div')).last().getText()).toMatch(/1 \\+ 2/);\n });\n </file>\n </example>\n */\nvar ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });\n\n/* global jqLiteRemove */\n\nvar ngOptionsMinErr = minErr('ngOptions');\n\n/**\n * @ngdoc directive\n * @name ngOptions\n * @restrict A\n *\n * @description\n *\n * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`\n * elements for the `<select>` element using the array or object obtained by evaluating the\n * `ngOptions` comprehension expression.\n *\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a\n * similar result. However, `ngOptions` provides some benefits such as reducing memory and\n * increasing speed by not creating a new scope for each repeated instance, as well as providing\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound\n * to a non-string value. This is because an option element can only be bound to string values at\n * present.\n *\n * When an item in the `<select>` menu is selected, the array element or object property\n * represented by the selected option will be bound to the model identified by the `ngModel`\n * directive.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * ## Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding the select to a model that is an object or a collection.\n *\n * One issue occurs if you want to preselect an option. For example, if you set\n * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,\n * because the objects are not identical. So by default, you should always reference the item in your collection\n * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.\n *\n * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity\n * of the item not by reference, but by the result of the `track by` expression. For example, if your\n * collection items have an id property, you would `track by item.id`.\n *\n * A different issue with objects or collections is that ngModel won't detect if an object property or\n * a collection item changes. For that reason, `ngOptions` additionally watches the model using\n * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.\n * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection\n * has not changed identity, but only a property on the object or an item in the collection changes.\n *\n * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection\n * if the model is an array). This means that changing a property deeper than the first level inside the\n * object/collection will not trigger a re-rendering.\n *\n * ## `select` **`as`**\n *\n * Using `select` **`as`** will bind the result of the `select` expression to the model, but\n * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)\n * or property name (for object data sources) of the value within the collection. If a **`track by`** expression\n * is used, the result of that expression will be set as the value of the `option` and `select` elements.\n *\n *\n * ### `select` **`as`** and **`track by`**\n *\n * <div class=\"alert alert-warning\">\n * Be careful when using `select` **`as`** and **`track by`** in the same expression.\n * </div>\n *\n * Given this array of items on the $scope:\n *\n * ```js\n * $scope.items = [{\n * id: 1,\n * label: 'aLabel',\n * subItem: { name: 'aSubItem' }\n * }, {\n * id: 2,\n * label: 'bLabel',\n * subItem: { name: 'bSubItem' }\n * }];\n * ```\n *\n * This will work:\n *\n * ```html\n * <select ng-options=\"item as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0];\n * ```\n *\n * but this will not work:\n *\n * ```html\n * <select ng-options=\"item.subItem as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0].subItem;\n * ```\n *\n * In both examples, the **`track by`** expression is applied successfully to each `item` in the\n * `items` array. Because the selected option has been set programmatically in the controller, the\n * **`track by`** expression is also applied to the `ngModel` value. In the first example, the\n * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with\n * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**\n * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value\n * is not matched against any `<option>` and the `<select>` appears as having no selected value.\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required The control is considered valid only if value is entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n * `required` when you want to data-bind to the `required` attribute.\n * @param {comprehension_expression=} ngOptions in one of the following forms:\n *\n * * for array data sources:\n * * `label` **`for`** `value` **`in`** `array`\n * * `select` **`as`** `label` **`for`** `value` **`in`** `array`\n * * `label` **`group by`** `group` **`for`** `value` **`in`** `array`\n * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`\n * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`\n * (for including a filter with `track by`)\n * * for object data sources:\n * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`\n * * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`\n * * `select` **`as`** `label` **`group by`** `group`\n * **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n * * `select` **`as`** `label` **`disable when`** `disable`\n * **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *\n * Where:\n *\n * * `array` / `object`: an expression which evaluates to an array / object to iterate over.\n * * `value`: local variable which will refer to each item in the `array` or each property value\n * of `object` during iteration.\n * * `key`: local variable which will refer to a property name in `object` during iteration.\n * * `label`: The result of this expression will be the label for `<option>` element. The\n * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).\n * * `select`: The result of this expression will be bound to the model of the parent `<select>`\n * element. If not specified, `select` expression will default to `value`.\n * * `group`: The result of this expression will be used to group options using the `<optgroup>`\n * DOM element.\n * * `disable`: The result of this expression will be used to disable the rendered `<option>`\n * element. Return `true` to disable.\n * * `trackexpr`: Used when working with an array of objects. The result of this expression will be\n * used to identify the objects in the array. The `trackexpr` will most likely refer to the\n * `value` variable (e.g. `value.propertyName`). With this the selection is preserved\n * even when the options are recreated (e.g. reloaded from the server).\n *\n * @example\n <example module=\"selectExample\">\n <file name=\"index.html\">\n <script>\n angular.module('selectExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.colors = [\n {name:'black', shade:'dark'},\n {name:'white', shade:'light', notAnOption: true},\n {name:'red', shade:'dark'},\n {name:'blue', shade:'dark', notAnOption: true},\n {name:'yellow', shade:'light', notAnOption: false}\n ];\n $scope.myColor = $scope.colors[2]; // red\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <ul>\n <li ng-repeat=\"color in colors\">\n <label>Name: <input ng-model=\"color.name\"></label>\n <label><input type=\"checkbox\" ng-model=\"color.notAnOption\"> Disabled?</label>\n <button ng-click=\"colors.splice($index, 1)\" aria-label=\"Remove\">X</button>\n </li>\n <li>\n <button ng-click=\"colors.push({})\">add</button>\n </li>\n </ul>\n <hr/>\n <label>Color (null not allowed):\n <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\"></select>\n </label><br/>\n <label>Color (null allowed):\n <span class=\"nullable\">\n <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\">\n <option value=\"\">-- choose color --</option>\n </select>\n </span></label><br/>\n\n <label>Color grouped by shade:\n <select ng-model=\"myColor\" ng-options=\"color.name group by color.shade for color in colors\">\n </select>\n </label><br/>\n\n <label>Color grouped by shade, with some disabled:\n <select ng-model=\"myColor\"\n ng-options=\"color.name group by color.shade disable when color.notAnOption for color in colors\">\n </select>\n </label><br/>\n\n\n\n Select <button ng-click=\"myColor = { name:'not in list', shade: 'other' }\">bogus</button>.\n <br/>\n <hr/>\n Currently selected: {{ {selected_color:myColor} }}\n <div style=\"border:solid 1px black; height:20px\"\n ng-style=\"{'background-color':myColor.name}\">\n </div>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should check ng-options', function() {\n expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');\n element.all(by.model('myColor')).first().click();\n element.all(by.css('select[ng-model=\"myColor\"] option')).first().click();\n expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');\n element(by.css('.nullable select[ng-model=\"myColor\"]')).click();\n element.all(by.css('.nullable select[ng-model=\"myColor\"] option')).first().click();\n expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');\n });\n </file>\n </example>\n */\n\n// jshint maxlen: false\n// //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999\nvar NG_OPTIONS_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\s+([\\s\\S]+?))?(?:\\s+disable\\s+when\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?$/;\n // 1: value expression (valueFn)\n // 2: label expression (displayFn)\n // 3: group by expression (groupByFn)\n // 4: disable when expression (disableWhenFn)\n // 5: array item variable name\n // 6: object item key variable name\n // 7: object item value variable name\n // 8: collection expression\n // 9: track by expression\n// jshint maxlen: 100\n\n\nvar ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {\n\n function parseOptionsExpression(optionsExp, selectElement, scope) {\n\n var match = optionsExp.match(NG_OPTIONS_REGEXP);\n if (!(match)) {\n throw ngOptionsMinErr('iexp',\n \"Expected expression in form of \" +\n \"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'\" +\n \" but got '{0}'. Element: {1}\",\n optionsExp, startingTag(selectElement));\n }\n\n // Extract the parts from the ngOptions expression\n\n // The variable name for the value of the item in the collection\n var valueName = match[5] || match[7];\n // The variable name for the key of the item in the collection\n var keyName = match[6];\n\n // An expression that generates the viewValue for an option if there is a label expression\n var selectAs = / as /.test(match[0]) && match[1];\n // An expression that is used to track the id of each object in the options collection\n var trackBy = match[9];\n // An expression that generates the viewValue for an option if there is no label expression\n var valueFn = $parse(match[2] ? match[1] : valueName);\n var selectAsFn = selectAs && $parse(selectAs);\n var viewValueFn = selectAsFn || valueFn;\n var trackByFn = trackBy && $parse(trackBy);\n\n // Get the value by which we are going to track the option\n // if we have a trackFn then use that (passing scope and locals)\n // otherwise just hash the given viewValue\n var getTrackByValueFn = trackBy ?\n function(value, locals) { return trackByFn(scope, locals); } :\n function getHashOfValue(value) { return hashKey(value); };\n var getTrackByValue = function(value, key) {\n return getTrackByValueFn(value, getLocals(value, key));\n };\n\n var displayFn = $parse(match[2] || match[1]);\n var groupByFn = $parse(match[3] || '');\n var disableWhenFn = $parse(match[4] || '');\n var valuesFn = $parse(match[8]);\n\n var locals = {};\n var getLocals = keyName ? function(value, key) {\n locals[keyName] = key;\n locals[valueName] = value;\n return locals;\n } : function(value) {\n locals[valueName] = value;\n return locals;\n };\n\n\n function Option(selectValue, viewValue, label, group, disabled) {\n this.selectValue = selectValue;\n this.viewValue = viewValue;\n this.label = label;\n this.group = group;\n this.disabled = disabled;\n }\n\n function getOptionValuesKeys(optionValues) {\n var optionValuesKeys;\n\n if (!keyName && isArrayLike(optionValues)) {\n optionValuesKeys = optionValues;\n } else {\n // if object, extract keys, in enumeration order, unsorted\n optionValuesKeys = [];\n for (var itemKey in optionValues) {\n if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {\n optionValuesKeys.push(itemKey);\n }\n }\n }\n return optionValuesKeys;\n }\n\n return {\n trackBy: trackBy,\n getTrackByValue: getTrackByValue,\n getWatchables: $parse(valuesFn, function(optionValues) {\n // Create a collection of things that we would like to watch (watchedArray)\n // so that they can all be watched using a single $watchCollection\n // that only runs the handler once if anything changes\n var watchedArray = [];\n optionValues = optionValues || [];\n\n var optionValuesKeys = getOptionValuesKeys(optionValues);\n var optionValuesLength = optionValuesKeys.length;\n for (var index = 0; index < optionValuesLength; index++) {\n var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n var value = optionValues[key];\n\n var locals = getLocals(optionValues[key], key);\n var selectValue = getTrackByValueFn(optionValues[key], locals);\n watchedArray.push(selectValue);\n\n // Only need to watch the displayFn if there is a specific label expression\n if (match[2] || match[1]) {\n var label = displayFn(scope, locals);\n watchedArray.push(label);\n }\n\n // Only need to watch the disableWhenFn if there is a specific disable expression\n if (match[4]) {\n var disableWhen = disableWhenFn(scope, locals);\n watchedArray.push(disableWhen);\n }\n }\n return watchedArray;\n }),\n\n getOptions: function() {\n\n var optionItems = [];\n var selectValueMap = {};\n\n // The option values were already computed in the `getWatchables` fn,\n // which must have been called to trigger `getOptions`\n var optionValues = valuesFn(scope) || [];\n var optionValuesKeys = getOptionValuesKeys(optionValues);\n var optionValuesLength = optionValuesKeys.length;\n\n for (var index = 0; index < optionValuesLength; index++) {\n var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n var value = optionValues[key];\n var locals = getLocals(value, key);\n var viewValue = viewValueFn(scope, locals);\n var selectValue = getTrackByValueFn(viewValue, locals);\n var label = displayFn(scope, locals);\n var group = groupByFn(scope, locals);\n var disabled = disableWhenFn(scope, locals);\n var optionItem = new Option(selectValue, viewValue, label, group, disabled);\n\n optionItems.push(optionItem);\n selectValueMap[selectValue] = optionItem;\n }\n\n return {\n items: optionItems,\n selectValueMap: selectValueMap,\n getOptionFromViewValue: function(value) {\n return selectValueMap[getTrackByValue(value)];\n },\n getViewValueFromOption: function(option) {\n // If the viewValue could be an object that may be mutated by the application,\n // we need to make a copy and not return the reference to the value on the option.\n return trackBy ? angular.copy(option.viewValue) : option.viewValue;\n }\n };\n }\n };\n }\n\n\n // we can't just jqLite('<option>') since jqLite is not smart enough\n // to create it in <select> and IE barfs otherwise.\n var optionTemplate = document.createElement('option'),\n optGroupTemplate = document.createElement('optgroup');\n\n\n function ngOptionsPostLink(scope, selectElement, attr, ctrls) {\n\n // if ngModel is not defined, we don't need to do anything\n var ngModelCtrl = ctrls[1];\n if (!ngModelCtrl) return;\n\n var selectCtrl = ctrls[0];\n var multiple = attr.multiple;\n\n // The emptyOption allows the application developer to provide their own custom \"empty\"\n // option when the viewValue does not match any of the option values.\n var emptyOption;\n for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {\n if (children[i].value === '') {\n emptyOption = children.eq(i);\n break;\n }\n }\n\n var providedEmptyOption = !!emptyOption;\n\n var unknownOption = jqLite(optionTemplate.cloneNode(false));\n unknownOption.val('?');\n\n var options;\n var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);\n\n\n var renderEmptyOption = function() {\n if (!providedEmptyOption) {\n selectElement.prepend(emptyOption);\n }\n selectElement.val('');\n emptyOption.prop('selected', true); // needed for IE\n emptyOption.attr('selected', true);\n };\n\n var removeEmptyOption = function() {\n if (!providedEmptyOption) {\n emptyOption.remove();\n }\n };\n\n\n var renderUnknownOption = function() {\n selectElement.prepend(unknownOption);\n selectElement.val('?');\n unknownOption.prop('selected', true); // needed for IE\n unknownOption.attr('selected', true);\n };\n\n var removeUnknownOption = function() {\n unknownOption.remove();\n };\n\n // Update the controller methods for multiple selectable options\n if (!multiple) {\n\n selectCtrl.writeValue = function writeNgOptionsValue(value) {\n var option = options.getOptionFromViewValue(value);\n\n if (option && !option.disabled) {\n // Don't update the option when it is already selected.\n // For example, the browser will select the first option by default. In that case,\n // most properties are set automatically - except the `selected` attribute, which we\n // set always\n\n if (selectElement[0].value !== option.selectValue) {\n removeUnknownOption();\n removeEmptyOption();\n\n selectElement[0].value = option.selectValue;\n option.element.selected = true;\n }\n\n option.element.setAttribute('selected', 'selected');\n } else {\n if (value === null || providedEmptyOption) {\n removeUnknownOption();\n renderEmptyOption();\n } else {\n removeEmptyOption();\n renderUnknownOption();\n }\n }\n };\n\n selectCtrl.readValue = function readNgOptionsValue() {\n\n var selectedOption = options.selectValueMap[selectElement.val()];\n\n if (selectedOption && !selectedOption.disabled) {\n removeEmptyOption();\n removeUnknownOption();\n return options.getViewValueFromOption(selectedOption);\n }\n return null;\n };\n\n // If we are using `track by` then we must watch the tracked value on the model\n // since ngModel only watches for object identity change\n if (ngOptions.trackBy) {\n scope.$watch(\n function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },\n function() { ngModelCtrl.$render(); }\n );\n }\n\n } else {\n\n ngModelCtrl.$isEmpty = function(value) {\n return !value || value.length === 0;\n };\n\n\n selectCtrl.writeValue = function writeNgOptionsMultiple(value) {\n options.items.forEach(function(option) {\n option.element.selected = false;\n });\n\n if (value) {\n value.forEach(function(item) {\n var option = options.getOptionFromViewValue(item);\n if (option && !option.disabled) option.element.selected = true;\n });\n }\n };\n\n\n selectCtrl.readValue = function readNgOptionsMultiple() {\n var selectedValues = selectElement.val() || [],\n selections = [];\n\n forEach(selectedValues, function(value) {\n var option = options.selectValueMap[value];\n if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));\n });\n\n return selections;\n };\n\n // If we are using `track by` then we must watch these tracked values on the model\n // since ngModel only watches for object identity change\n if (ngOptions.trackBy) {\n\n scope.$watchCollection(function() {\n if (isArray(ngModelCtrl.$viewValue)) {\n return ngModelCtrl.$viewValue.map(function(value) {\n return ngOptions.getTrackByValue(value);\n });\n }\n }, function() {\n ngModelCtrl.$render();\n });\n\n }\n }\n\n\n if (providedEmptyOption) {\n\n // we need to remove it before calling selectElement.empty() because otherwise IE will\n // remove the label from the element. wtf?\n emptyOption.remove();\n\n // compile the element since there might be bindings in it\n $compile(emptyOption)(scope);\n\n // remove the class, which is added automatically because we recompile the element and it\n // becomes the compilation root\n emptyOption.removeClass('ng-scope');\n } else {\n emptyOption = jqLite(optionTemplate.cloneNode(false));\n }\n\n // We need to do this here to ensure that the options object is defined\n // when we first hit it in writeNgOptionsValue\n updateOptions();\n\n // We will re-render the option elements if the option values or labels change\n scope.$watchCollection(ngOptions.getWatchables, updateOptions);\n\n // ------------------------------------------------------------------ //\n\n\n function updateOptionElement(option, element) {\n option.element = element;\n element.disabled = option.disabled;\n // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive\n // selects in certain circumstances when multiple selects are next to each other and display\n // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].\n // See https://github.com/angular/angular.js/issues/11314 for more info.\n // This is unfortunately untestable with unit / e2e tests\n if (option.label !== element.label) {\n element.label = option.label;\n element.textContent = option.label;\n }\n if (option.value !== element.value) element.value = option.selectValue;\n }\n\n function addOrReuseElement(parent, current, type, templateElement) {\n var element;\n // Check whether we can reuse the next element\n if (current && lowercase(current.nodeName) === type) {\n // The next element is the right type so reuse it\n element = current;\n } else {\n // The next element is not the right type so create a new one\n element = templateElement.cloneNode(false);\n if (!current) {\n // There are no more elements so just append it to the select\n parent.appendChild(element);\n } else {\n // The next element is not a group so insert the new one\n parent.insertBefore(element, current);\n }\n }\n return element;\n }\n\n\n function removeExcessElements(current) {\n var next;\n while (current) {\n next = current.nextSibling;\n jqLiteRemove(current);\n current = next;\n }\n }\n\n\n function skipEmptyAndUnknownOptions(current) {\n var emptyOption_ = emptyOption && emptyOption[0];\n var unknownOption_ = unknownOption && unknownOption[0];\n\n // We cannot rely on the extracted empty option being the same as the compiled empty option,\n // because the compiled empty option might have been replaced by a comment because\n // it had an \"element\" transclusion directive on it (such as ngIf)\n if (emptyOption_ || unknownOption_) {\n while (current &&\n (current === emptyOption_ ||\n current === unknownOption_ ||\n current.nodeType === NODE_TYPE_COMMENT ||\n (nodeName_(current) === 'option' && current.value === ''))) {\n current = current.nextSibling;\n }\n }\n return current;\n }\n\n\n function updateOptions() {\n\n var previousValue = options && selectCtrl.readValue();\n\n options = ngOptions.getOptions();\n\n var groupMap = {};\n var currentElement = selectElement[0].firstChild;\n\n // Ensure that the empty option is always there if it was explicitly provided\n if (providedEmptyOption) {\n selectElement.prepend(emptyOption);\n }\n\n currentElement = skipEmptyAndUnknownOptions(currentElement);\n\n options.items.forEach(function updateOption(option) {\n var group;\n var groupElement;\n var optionElement;\n\n if (option.group) {\n\n // This option is to live in a group\n // See if we have already created this group\n group = groupMap[option.group];\n\n if (!group) {\n\n // We have not already created this group\n groupElement = addOrReuseElement(selectElement[0],\n currentElement,\n 'optgroup',\n optGroupTemplate);\n // Move to the next element\n currentElement = groupElement.nextSibling;\n\n // Update the label on the group element\n groupElement.label = option.group;\n\n // Store it for use later\n group = groupMap[option.group] = {\n groupElement: groupElement,\n currentOptionElement: groupElement.firstChild\n };\n\n }\n\n // So now we have a group for this option we add the option to the group\n optionElement = addOrReuseElement(group.groupElement,\n group.currentOptionElement,\n 'option',\n optionTemplate);\n updateOptionElement(option, optionElement);\n // Move to the next element\n group.currentOptionElement = optionElement.nextSibling;\n\n } else {\n\n // This option is not in a group\n optionElement = addOrReuseElement(selectElement[0],\n currentElement,\n 'option',\n optionTemplate);\n updateOptionElement(option, optionElement);\n // Move to the next element\n currentElement = optionElement.nextSibling;\n }\n });\n\n\n // Now remove all excess options and group\n Object.keys(groupMap).forEach(function(key) {\n removeExcessElements(groupMap[key].currentOptionElement);\n });\n removeExcessElements(currentElement);\n\n ngModelCtrl.$render();\n\n // Check to see if the value has changed due to the update to the options\n if (!ngModelCtrl.$isEmpty(previousValue)) {\n var nextValue = selectCtrl.readValue();\n var isNotPrimitive = ngOptions.trackBy || multiple;\n if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {\n ngModelCtrl.$setViewValue(nextValue);\n ngModelCtrl.$render();\n }\n }\n\n }\n }\n\n return {\n restrict: 'A',\n terminal: true,\n require: ['select', '?ngModel'],\n link: {\n pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {\n // Deactivate the SelectController.register method to prevent\n // option directives from accidentally registering themselves\n // (and unwanted $destroy handlers etc.)\n ctrls[0].registerOption = noop;\n },\n post: ngOptionsPostLink\n }\n };\n}];\n\n/**\n * @ngdoc directive\n * @name ngPluralize\n * @restrict EA\n *\n * @description\n * `ngPluralize` is a directive that displays messages according to en-US localization rules.\n * These rules are bundled with angular.js, but can be overridden\n * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive\n * by specifying the mappings between\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * and the strings to be displayed.\n *\n * # Plural categories and explicit number rules\n * There are two\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * in Angular's default en-US locale: \"one\" and \"other\".\n *\n * While a plural category may match many numbers (for example, in en-US locale, \"other\" can match\n * any number that is not 1), an explicit number rule can only match one number. For example, the\n * explicit number rule for \"3\" matches the number 3. There are examples of plural categories\n * and explicit number rules throughout the rest of this documentation.\n *\n * # Configuring ngPluralize\n * You configure ngPluralize by providing 2 attributes: `count` and `when`.\n * You can also provide an optional attribute, `offset`.\n *\n * The value of the `count` attribute can be either a string or an {@link guide/expression\n * Angular expression}; these are evaluated on the current scope for its bound value.\n *\n * The `when` attribute specifies the mappings between plural categories and the actual\n * string to be displayed. The value of the attribute should be a JSON object.\n *\n * The following example shows how to configure ngPluralize:\n *\n * ```html\n * <ng-pluralize count=\"personCount\"\n when=\"{'0': 'Nobody is viewing.',\n * 'one': '1 person is viewing.',\n * 'other': '{} people are viewing.'}\">\n * </ng-pluralize>\n *```\n *\n * In the example, `\"0: Nobody is viewing.\"` is an explicit number rule. If you did not\n * specify this rule, 0 would be matched to the \"other\" category and \"0 people are viewing\"\n * would be shown instead of \"Nobody is viewing\". You can specify an explicit number rule for\n * other numbers, for example 12, so that instead of showing \"12 people are viewing\", you can\n * show \"a dozen people are viewing\".\n *\n * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted\n * into pluralized strings. In the previous example, Angular will replace `{}` with\n * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder\n * for <span ng-non-bindable>{{numberExpression}}</span>.\n *\n * If no rule is defined for a category, then an empty string is displayed and a warning is generated.\n * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.\n *\n * # Configuring ngPluralize with offset\n * The `offset` attribute allows further customization of pluralized text, which can result in\n * a better user experience. For example, instead of the message \"4 people are viewing this document\",\n * you might display \"John, Kate and 2 others are viewing this document\".\n * The offset attribute allows you to offset a number by any desired value.\n * Let's take a look at an example:\n *\n * ```html\n * <ng-pluralize count=\"personCount\" offset=2\n * when=\"{'0': 'Nobody is viewing.',\n * '1': '{{person1}} is viewing.',\n * '2': '{{person1}} and {{person2}} are viewing.',\n * 'one': '{{person1}}, {{person2}} and one other person are viewing.',\n * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n * </ng-pluralize>\n * ```\n *\n * Notice that we are still using two plural categories(one, other), but we added\n * three explicit number rules 0, 1 and 2.\n * When one person, perhaps John, views the document, \"John is viewing\" will be shown.\n * When three people view the document, no explicit number rule is found, so\n * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.\n * In this case, plural category 'one' is matched and \"John, Mary and one other person are viewing\"\n * is shown.\n *\n * Note that when you specify offsets, you must provide explicit number rules for\n * numbers from 0 up to and including the offset. If you use an offset of 3, for example,\n * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for\n * plural categories \"one\" and \"other\".\n *\n * @param {string|expression} count The variable to be bound to.\n * @param {string} when The mapping between plural category to its corresponding strings.\n * @param {number=} offset Offset to deduct from the total number.\n *\n * @example\n <example module=\"pluralizeExample\">\n <file name=\"index.html\">\n <script>\n angular.module('pluralizeExample', [])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.person1 = 'Igor';\n $scope.person2 = 'Misko';\n $scope.personCount = 1;\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <label>Person 1:<input type=\"text\" ng-model=\"person1\" value=\"Igor\" /></label><br/>\n <label>Person 2:<input type=\"text\" ng-model=\"person2\" value=\"Misko\" /></label><br/>\n <label>Number of People:<input type=\"text\" ng-model=\"personCount\" value=\"1\" /></label><br/>\n\n <!--- Example with simple pluralization rules for en locale --->\n Without Offset:\n <ng-pluralize count=\"personCount\"\n when=\"{'0': 'Nobody is viewing.',\n 'one': '1 person is viewing.',\n 'other': '{} people are viewing.'}\">\n </ng-pluralize><br>\n\n <!--- Example with offset --->\n With Offset(2):\n <ng-pluralize count=\"personCount\" offset=2\n when=\"{'0': 'Nobody is viewing.',\n '1': '{{person1}} is viewing.',\n '2': '{{person1}} and {{person2}} are viewing.',\n 'one': '{{person1}}, {{person2}} and one other person are viewing.',\n 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n </ng-pluralize>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should show correct pluralized string', function() {\n var withoutOffset = element.all(by.css('ng-pluralize')).get(0);\n var withOffset = element.all(by.css('ng-pluralize')).get(1);\n var countInput = element(by.model('personCount'));\n\n expect(withoutOffset.getText()).toEqual('1 person is viewing.');\n expect(withOffset.getText()).toEqual('Igor is viewing.');\n\n countInput.clear();\n countInput.sendKeys('0');\n\n expect(withoutOffset.getText()).toEqual('Nobody is viewing.');\n expect(withOffset.getText()).toEqual('Nobody is viewing.');\n\n countInput.clear();\n countInput.sendKeys('2');\n\n expect(withoutOffset.getText()).toEqual('2 people are viewing.');\n expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');\n\n countInput.clear();\n countInput.sendKeys('3');\n\n expect(withoutOffset.getText()).toEqual('3 people are viewing.');\n expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');\n\n countInput.clear();\n countInput.sendKeys('4');\n\n expect(withoutOffset.getText()).toEqual('4 people are viewing.');\n expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');\n });\n it('should show data-bound names', function() {\n var withOffset = element.all(by.css('ng-pluralize')).get(1);\n var personCount = element(by.model('personCount'));\n var person1 = element(by.model('person1'));\n var person2 = element(by.model('person2'));\n personCount.clear();\n personCount.sendKeys('4');\n person1.clear();\n person1.sendKeys('Di');\n person2.clear();\n person2.sendKeys('Vojta');\n expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');\n });\n </file>\n </example>\n */\nvar ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {\n var BRACE = /{}/g,\n IS_WHEN = /^when(Minus)?(.+)$/;\n\n return {\n link: function(scope, element, attr) {\n var numberExp = attr.count,\n whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs\n offset = attr.offset || 0,\n whens = scope.$eval(whenExp) || {},\n whensExpFns = {},\n startSymbol = $interpolate.startSymbol(),\n endSymbol = $interpolate.endSymbol(),\n braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,\n watchRemover = angular.noop,\n lastCount;\n\n forEach(attr, function(expression, attributeName) {\n var tmpMatch = IS_WHEN.exec(attributeName);\n if (tmpMatch) {\n var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);\n whens[whenKey] = element.attr(attr.$attr[attributeName]);\n }\n });\n forEach(whens, function(expression, key) {\n whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));\n\n });\n\n scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {\n var count = parseFloat(newVal);\n var countIsNaN = isNaN(count);\n\n if (!countIsNaN && !(count in whens)) {\n // If an explicit number rule such as 1, 2, 3... is defined, just use it.\n // Otherwise, check it against pluralization rules in $locale service.\n count = $locale.pluralCat(count - offset);\n }\n\n // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.\n // In JS `NaN !== NaN`, so we have to exlicitly check.\n if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {\n watchRemover();\n var whenExpFn = whensExpFns[count];\n if (isUndefined(whenExpFn)) {\n if (newVal != null) {\n $log.debug(\"ngPluralize: no rule defined for '\" + count + \"' in \" + whenExp);\n }\n watchRemover = noop;\n updateElementText();\n } else {\n watchRemover = scope.$watch(whenExpFn, updateElementText);\n }\n lastCount = count;\n }\n });\n\n function updateElementText(newText) {\n element.text(newText || '');\n }\n }\n };\n}];\n\n/**\n * @ngdoc directive\n * @name ngRepeat\n * @multiElement\n *\n * @description\n * The `ngRepeat` directive instantiates a template once per item from a collection. Each template\n * instance gets its own scope, where the given loop variable is set to the current collection item,\n * and `$index` is set to the item index or key.\n *\n * Special properties are exposed on the local scope of each template instance, including:\n *\n * | Variable | Type | Details |\n * |-----------|-----------------|-----------------------------------------------------------------------------|\n * | `$index` | {@type number} | iterator offset of the repeated element (0..length-1) |\n * | `$first` | {@type boolean} | true if the repeated element is first in the iterator. |\n * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |\n * | `$last` | {@type boolean} | true if the repeated element is last in the iterator. |\n * | `$even` | {@type boolean} | true if the iterator position `$index` is even (otherwise false). |\n * | `$odd` | {@type boolean} | true if the iterator position `$index` is odd (otherwise false). |\n *\n * <div class=\"alert alert-info\">\n * Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.\n * This may be useful when, for instance, nesting ngRepeats.\n * </div>\n *\n *\n * # Iterating over object properties\n *\n * It is possible to get `ngRepeat` to iterate over the properties of an object using the following\n * syntax:\n *\n * ```js\n * <div ng-repeat=\"(key, value) in myObj\"> ... </div>\n * ```\n *\n * You need to be aware that the JavaScript specification does not define the order of keys\n * returned for an object. (To mitigate this in Angular 1.3 the `ngRepeat` directive\n * used to sort the keys alphabetically.)\n *\n * Version 1.4 removed the alphabetic sorting. We now rely on the order returned by the browser\n * when running `for key in myObj`. It seems that browsers generally follow the strategy of providing\n * keys in the order in which they were defined, although there are exceptions when keys are deleted\n * and reinstated. See the [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).\n *\n * If this is not desired, the recommended workaround is to convert your object into an array\n * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could\n * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)\n * or implement a `$watch` on the object yourself.\n *\n *\n * # Tracking and Duplicates\n *\n * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in\n * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:\n *\n * * When an item is added, a new instance of the template is added to the DOM.\n * * When an item is removed, its template instance is removed from the DOM.\n * * When items are reordered, their respective templates are reordered in the DOM.\n *\n * To minimize creation of DOM elements, `ngRepeat` uses a function\n * to \"keep track\" of all items in the collection and their corresponding DOM elements.\n * For example, if an item is added to the collection, ngRepeat will know that all other items\n * already have DOM elements, and will not re-render them.\n *\n * The default tracking function (which tracks items by their identity) does not allow\n * duplicate items in arrays. This is because when there are duplicates, it is not possible\n * to maintain a one-to-one mapping between collection items and DOM elements.\n *\n * If you do need to repeat duplicate items, you can substitute the default tracking behavior\n * with your own using the `track by` expression.\n *\n * For example, you may track items by the index of each item in the collection, using the\n * special scope property `$index`:\n * ```html\n * <div ng-repeat=\"n in [42, 42, 43, 43] track by $index\">\n * {{n}}\n * </div>\n * ```\n *\n * You may also use arbitrary expressions in `track by`, including references to custom functions\n * on the scope:\n * ```html\n * <div ng-repeat=\"n in [42, 42, 43, 43] track by myTrackingFunction(n)\">\n * {{n}}\n * </div>\n * ```\n *\n * <div class=\"alert alert-success\">\n * If you are working with objects that have an identifier property, you should track\n * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`\n * will not have to rebuild the DOM elements for items it has already rendered, even if the\n * JavaScript objects in the collection have been substituted for new ones. For large collections,\n * this signifincantly improves rendering performance. If you don't have a unique identifier,\n * `track by $index` can also provide a performance boost.\n * </div>\n * ```html\n * <div ng-repeat=\"model in collection track by model.id\">\n * {{model.name}}\n * </div>\n * ```\n *\n * When no `track by` expression is provided, it is equivalent to tracking by the built-in\n * `$id` function, which tracks items by their identity:\n * ```html\n * <div ng-repeat=\"obj in collection track by $id(obj)\">\n * {{obj.prop}}\n * </div>\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `track by` must always be the last expression:\n * </div>\n * ```\n * <div ng-repeat=\"model in collection | orderBy: 'id' as filtered_result track by model.id\">\n * {{model.name}}\n * </div>\n * ```\n *\n * # Special repeat start and end points\n * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending\n * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.\n * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)\n * up to and including the ending HTML tag where **ng-repeat-end** is placed.\n *\n * The example below makes use of this feature:\n * ```html\n * <header ng-repeat-start=\"item in items\">\n * Header {{ item }}\n * </header>\n * <div class=\"body\">\n * Body {{ item }}\n * </div>\n * <footer ng-repeat-end>\n * Footer {{ item }}\n * </footer>\n * ```\n *\n * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:\n * ```html\n * <header>\n * Header A\n * </header>\n * <div class=\"body\">\n * Body A\n * </div>\n * <footer>\n * Footer A\n * </footer>\n * <header>\n * Header B\n * </header>\n * <div class=\"body\">\n * Body B\n * </div>\n * <footer>\n * Footer B\n * </footer>\n * ```\n *\n * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such\n * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).\n *\n * @animations\n * **.enter** - when a new item is added to the list or when an item is revealed after a filter\n *\n * **.leave** - when an item is removed from the list or when an item is filtered out\n *\n * **.move** - when an adjacent item is filtered out causing a reorder or when the item contents are reordered\n *\n * @element ANY\n * @scope\n * @priority 1000\n * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These\n * formats are currently supported:\n *\n * * `variable in expression` where variable is the user defined loop variable and `expression`\n * is a scope expression giving the collection to enumerate.\n *\n * For example: `album in artist.albums`.\n *\n * * `(key, value) in expression` where `key` and `value` can be any user defined identifiers,\n * and `expression` is the scope expression giving the collection to enumerate.\n *\n * For example: `(name, age) in {'adam':10, 'amalie':12}`.\n *\n * * `variable in expression track by tracking_expression` You can also provide an optional tracking expression\n * which can be used to associate the objects in the collection with the DOM elements. If no tracking expression\n * is specified, ng-repeat associates elements by identity. It is an error to have\n * more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are\n * mapped to the same DOM element, which is not possible.)\n *\n * Note that the tracking expression must come last, after any filters, and the alias expression.\n *\n * For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements\n * will be associated by item identity in the array.\n *\n * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n * with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n * element in the same way in the DOM.\n *\n * For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n * case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n * property is same.\n *\n * For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n * to items in conjunction with a tracking expression.\n *\n * * `variable in expression as alias_expression` You can also provide an optional alias expression which will then store the\n * intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message\n * when a filter is active on the repeater, but the filtered result set is empty.\n *\n * For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after\n * the items have been processed through the filter.\n *\n * Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end\n * (and not as operator, inside an expression).\n *\n * For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .\n *\n * @example\n * This example initializes the scope to a list of names and\n * then uses `ngRepeat` to display every person:\n <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n <div ng-init=\"friends = [\n {name:'John', age:25, gender:'boy'},\n {name:'Jessie', age:30, gender:'girl'},\n {name:'Johanna', age:28, gender:'girl'},\n {name:'Joy', age:15, gender:'girl'},\n {name:'Mary', age:28, gender:'girl'},\n {name:'Peter', age:95, gender:'boy'},\n {name:'Sebastian', age:50, gender:'boy'},\n {name:'Erika', age:27, gender:'girl'},\n {name:'Patrick', age:40, gender:'boy'},\n {name:'Samantha', age:60, gender:'girl'}\n ]\">\n I have {{friends.length}} friends. They are:\n <input type=\"search\" ng-model=\"q\" placeholder=\"filter friends...\" aria-label=\"filter friends\" />\n <ul class=\"example-animate-container\">\n <li class=\"animate-repeat\" ng-repeat=\"friend in friends | filter:q as results\">\n [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.\n </li>\n <li class=\"animate-repeat\" ng-if=\"results.length == 0\">\n <strong>No results found...</strong>\n </li>\n </ul>\n </div>\n </file>\n <file name=\"animations.css\">\n .example-animate-container {\n background:white;\n border:1px solid black;\n list-style:none;\n margin:0;\n padding:0 10px;\n }\n\n .animate-repeat {\n line-height:40px;\n list-style:none;\n box-sizing:border-box;\n }\n\n .animate-repeat.ng-move,\n .animate-repeat.ng-enter,\n .animate-repeat.ng-leave {\n transition:all linear 0.5s;\n }\n\n .animate-repeat.ng-leave.ng-leave-active,\n .animate-repeat.ng-move,\n .animate-repeat.ng-enter {\n opacity:0;\n max-height:0;\n }\n\n .animate-repeat.ng-leave,\n .animate-repeat.ng-move.ng-move-active,\n .animate-repeat.ng-enter.ng-enter-active {\n opacity:1;\n max-height:40px;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var friends = element.all(by.repeater('friend in friends'));\n\n it('should render initial data set', function() {\n expect(friends.count()).toBe(10);\n expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');\n expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');\n expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');\n expect(element(by.binding('friends.length')).getText())\n .toMatch(\"I have 10 friends. They are:\");\n });\n\n it('should update repeater when filter predicate changes', function() {\n expect(friends.count()).toBe(10);\n\n element(by.model('q')).sendKeys('ma');\n\n expect(friends.count()).toBe(2);\n expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');\n expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');\n });\n </file>\n </example>\n */\nvar ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {\n var NG_REMOVED = '$$NG_REMOVED';\n var ngRepeatMinErr = minErr('ngRepeat');\n\n var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {\n // TODO(perf): generate setters to shave off ~40ms or 1-1.5%\n scope[valueIdentifier] = value;\n if (keyIdentifier) scope[keyIdentifier] = key;\n scope.$index = index;\n scope.$first = (index === 0);\n scope.$last = (index === (arrayLength - 1));\n scope.$middle = !(scope.$first || scope.$last);\n // jshint bitwise: false\n scope.$odd = !(scope.$even = (index&1) === 0);\n // jshint bitwise: true\n };\n\n var getBlockStart = function(block) {\n return block.clone[0];\n };\n\n var getBlockEnd = function(block) {\n return block.clone[block.clone.length - 1];\n };\n\n\n return {\n restrict: 'A',\n multiElement: true,\n transclude: 'element',\n priority: 1000,\n terminal: true,\n $$tlb: true,\n compile: function ngRepeatCompile($element, $attr) {\n var expression = $attr.ngRepeat;\n var ngRepeatEndComment = document.createComment(' end ngRepeat: ' + expression + ' ');\n\n var match = expression.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n\n if (!match) {\n throw ngRepeatMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n expression);\n }\n\n var lhs = match[1];\n var rhs = match[2];\n var aliasAs = match[3];\n var trackByExp = match[4];\n\n match = lhs.match(/^(?:(\\s*[\\$\\w]+)|\\(\\s*([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\s*\\))$/);\n\n if (!match) {\n throw ngRepeatMinErr('iidexp', \"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.\",\n lhs);\n }\n var valueIdentifier = match[3] || match[1];\n var keyIdentifier = match[2];\n\n if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||\n /^(null|undefined|this|\\$index|\\$first|\\$middle|\\$last|\\$even|\\$odd|\\$parent|\\$root|\\$id)$/.test(aliasAs))) {\n throw ngRepeatMinErr('badident', \"alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.\",\n aliasAs);\n }\n\n var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;\n var hashFnLocals = {$id: hashKey};\n\n if (trackByExp) {\n trackByExpGetter = $parse(trackByExp);\n } else {\n trackByIdArrayFn = function(key, value) {\n return hashKey(value);\n };\n trackByIdObjFn = function(key) {\n return key;\n };\n }\n\n return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {\n\n if (trackByExpGetter) {\n trackByIdExpFn = function(key, value, index) {\n // assign key, value, and $index to the locals so that they can be used in hash functions\n if (keyIdentifier) hashFnLocals[keyIdentifier] = key;\n hashFnLocals[valueIdentifier] = value;\n hashFnLocals.$index = index;\n return trackByExpGetter($scope, hashFnLocals);\n };\n }\n\n // Store a list of elements from previous run. This is a hash where key is the item from the\n // iterator, and the value is objects with following properties.\n // - scope: bound scope\n // - element: previous element.\n // - index: position\n //\n // We are using no-proto object so that we don't need to guard against inherited props via\n // hasOwnProperty.\n var lastBlockMap = createMap();\n\n //watch props\n $scope.$watchCollection(rhs, function ngRepeatAction(collection) {\n var index, length,\n previousNode = $element[0], // node that cloned nodes should be inserted after\n // initialized to the comment node anchor\n nextNode,\n // Same as lastBlockMap but it has the current state. It will become the\n // lastBlockMap on the next iteration.\n nextBlockMap = createMap(),\n collectionLength,\n key, value, // key/value of iteration\n trackById,\n trackByIdFn,\n collectionKeys,\n block, // last object information {scope, element, id}\n nextBlockOrder,\n elementsToRemove;\n\n if (aliasAs) {\n $scope[aliasAs] = collection;\n }\n\n if (isArrayLike(collection)) {\n collectionKeys = collection;\n trackByIdFn = trackByIdExpFn || trackByIdArrayFn;\n } else {\n trackByIdFn = trackByIdExpFn || trackByIdObjFn;\n // if object, extract keys, in enumeration order, unsorted\n collectionKeys = [];\n for (var itemKey in collection) {\n if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {\n collectionKeys.push(itemKey);\n }\n }\n }\n\n collectionLength = collectionKeys.length;\n nextBlockOrder = new Array(collectionLength);\n\n // locate existing items\n for (index = 0; index < collectionLength; index++) {\n key = (collection === collectionKeys) ? index : collectionKeys[index];\n value = collection[key];\n trackById = trackByIdFn(key, value, index);\n if (lastBlockMap[trackById]) {\n // found previously seen block\n block = lastBlockMap[trackById];\n delete lastBlockMap[trackById];\n nextBlockMap[trackById] = block;\n nextBlockOrder[index] = block;\n } else if (nextBlockMap[trackById]) {\n // if collision detected. restore lastBlockMap and throw an error\n forEach(nextBlockOrder, function(block) {\n if (block && block.scope) lastBlockMap[block.id] = block;\n });\n throw ngRepeatMinErr('dupes',\n \"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}\",\n expression, trackById, value);\n } else {\n // new never before seen block\n nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};\n nextBlockMap[trackById] = true;\n }\n }\n\n // remove leftover items\n for (var blockKey in lastBlockMap) {\n block = lastBlockMap[blockKey];\n elementsToRemove = getBlockNodes(block.clone);\n $animate.leave(elementsToRemove);\n if (elementsToRemove[0].parentNode) {\n // if the element was not removed yet because of pending animation, mark it as deleted\n // so that we can ignore it later\n for (index = 0, length = elementsToRemove.length; index < length; index++) {\n elementsToRemove[index][NG_REMOVED] = true;\n }\n }\n block.scope.$destroy();\n }\n\n // we are not using forEach for perf reasons (trying to avoid #call)\n for (index = 0; index < collectionLength; index++) {\n key = (collection === collectionKeys) ? index : collectionKeys[index];\n value = collection[key];\n block = nextBlockOrder[index];\n\n if (block.scope) {\n // if we have already seen this object, then we need to reuse the\n // associated scope/element\n\n nextNode = previousNode;\n\n // skip nodes that are already pending removal via leave animation\n do {\n nextNode = nextNode.nextSibling;\n } while (nextNode && nextNode[NG_REMOVED]);\n\n if (getBlockStart(block) != nextNode) {\n // existing item which got moved\n $animate.move(getBlockNodes(block.clone), null, previousNode);\n }\n previousNode = getBlockEnd(block);\n updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n } else {\n // new item which we don't know about\n $transclude(function ngRepeatTransclude(clone, scope) {\n block.scope = scope;\n // http://jsperf.com/clone-vs-createcomment\n var endNode = ngRepeatEndComment.cloneNode(false);\n clone[clone.length++] = endNode;\n\n $animate.enter(clone, null, previousNode);\n previousNode = endNode;\n // Note: We only need the first/last node of the cloned nodes.\n // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n // by a directive with templateUrl when its template arrives.\n block.clone = clone;\n nextBlockMap[block.id] = block;\n updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n });\n }\n }\n lastBlockMap = nextBlockMap;\n });\n };\n }\n };\n}];\n\nvar NG_HIDE_CLASS = 'ng-hide';\nvar NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';\n/**\n * @ngdoc directive\n * @name ngShow\n * @multiElement\n *\n * @description\n * The `ngShow` directive shows or hides the given HTML element based on the expression\n * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding\n * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is visible) -->\n * <div ng-show=\"myValue\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is hidden) -->\n * <div ng-show=\"myValue\" class=\"ng-hide\"></div>\n * ```\n *\n * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope\n * with extra animation classes that can be added.\n *\n * ```css\n * .ng-hide:not(.ng-hide-animate) {\n * /&#42; this is just another form of hiding an element &#42;/\n * display: block!important;\n * position: absolute;\n * top: -9999px;\n * left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngShow`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass except that\n * you must also include the !important flag to override the display property\n * so that you can perform an animation when the element is hidden during the time of the animation.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n * /&#42; this is required as of 1.3x to properly\n * apply all styling in a show/hide animation &#42;/\n * transition: 0s linear all;\n * }\n *\n * .my-element.ng-hide-add-active,\n * .my-element.ng-hide-remove-active {\n * /&#42; the transition is defined in the active class &#42;/\n * transition: 1s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * addClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a truthy value and the just before contents are set to visible\n * removeClass: `.ng-hide` - happens after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden\n *\n * @element ANY\n * @param {expression} ngShow If the {@link guide/expression expression} is truthy\n * then the element is shown or hidden respectively.\n *\n * @example\n <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngHide\"><br/>\n <div>\n Show:\n <div class=\"check-element animate-show\" ng-show=\"checked\">\n <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n </div>\n </div>\n <div>\n Hide:\n <div class=\"check-element animate-show\" ng-hide=\"checked\">\n <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n </div>\n </div>\n </file>\n <file name=\"glyphicons.css\">\n @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n </file>\n <file name=\"animations.css\">\n .animate-show {\n line-height: 20px;\n opacity: 1;\n padding: 10px;\n border: 1px solid black;\n background: white;\n }\n\n .animate-show.ng-hide-add, .animate-show.ng-hide-remove {\n transition: all linear 0.5s;\n }\n\n .animate-show.ng-hide {\n line-height: 0;\n opacity: 0;\n padding: 0 10px;\n }\n\n .check-element {\n padding: 10px;\n border: 1px solid black;\n background: white;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n it('should check ng-show / ng-hide', function() {\n expect(thumbsUp.isDisplayed()).toBeFalsy();\n expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n element(by.model('checked')).click();\n\n expect(thumbsUp.isDisplayed()).toBeTruthy();\n expect(thumbsDown.isDisplayed()).toBeFalsy();\n });\n </file>\n </example>\n */\nvar ngShowDirective = ['$animate', function($animate) {\n return {\n restrict: 'A',\n multiElement: true,\n link: function(scope, element, attr) {\n scope.$watch(attr.ngShow, function ngShowWatchAction(value) {\n // we're adding a temporary, animation-specific class for ng-hide since this way\n // we can control when the element is actually displayed on screen without having\n // to have a global/greedy CSS selector that breaks when other animations are run.\n // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845\n $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {\n tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n });\n });\n }\n };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngHide\n * @multiElement\n *\n * @description\n * The `ngHide` directive shows or hides the given HTML element based on the expression\n * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is hidden) -->\n * <div ng-hide=\"myValue\" class=\"ng-hide\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is visible) -->\n * <div ng-hide=\"myValue\"></div>\n * ```\n *\n * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n * /&#42; this is just another form of hiding an element &#42;/\n * display: block!important;\n * position: absolute;\n * top: -9999px;\n * left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngHide`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`\n * CSS class is added and removed for you instead of your own CSS class.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n * transition: 0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3.0-beta.11, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * removeClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden\n * addClass: `.ng-hide` - happens after the `ngHide` expression evaluates to a non truthy value and just before the contents are set to visible\n *\n * @element ANY\n * @param {expression} ngHide If the {@link guide/expression expression} is truthy then\n * the element is shown or hidden respectively.\n *\n * @example\n <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngShow\"><br/>\n <div>\n Show:\n <div class=\"check-element animate-hide\" ng-show=\"checked\">\n <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n </div>\n </div>\n <div>\n Hide:\n <div class=\"check-element animate-hide\" ng-hide=\"checked\">\n <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n </div>\n </div>\n </file>\n <file name=\"glyphicons.css\">\n @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n </file>\n <file name=\"animations.css\">\n .animate-hide {\n transition: all linear 0.5s;\n line-height: 20px;\n opacity: 1;\n padding: 10px;\n border: 1px solid black;\n background: white;\n }\n\n .animate-hide.ng-hide {\n line-height: 0;\n opacity: 0;\n padding: 0 10px;\n }\n\n .check-element {\n padding: 10px;\n border: 1px solid black;\n background: white;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n it('should check ng-show / ng-hide', function() {\n expect(thumbsUp.isDisplayed()).toBeFalsy();\n expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n element(by.model('checked')).click();\n\n expect(thumbsUp.isDisplayed()).toBeTruthy();\n expect(thumbsDown.isDisplayed()).toBeFalsy();\n });\n </file>\n </example>\n */\nvar ngHideDirective = ['$animate', function($animate) {\n return {\n restrict: 'A',\n multiElement: true,\n link: function(scope, element, attr) {\n scope.$watch(attr.ngHide, function ngHideWatchAction(value) {\n // The comment inside of the ngShowDirective explains why we add and\n // remove a temporary class for the show/hide animation\n $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {\n tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n });\n });\n }\n };\n}];\n\n/**\n * @ngdoc directive\n * @name ngStyle\n * @restrict AC\n *\n * @description\n * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.\n *\n * @element ANY\n * @param {expression} ngStyle\n *\n * {@link guide/expression Expression} which evals to an\n * object whose keys are CSS style names and values are corresponding values for those CSS\n * keys.\n *\n * Since some CSS style names are not valid keys for an object, they must be quoted.\n * See the 'background-color' style in the example below.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <input type=\"button\" value=\"set color\" ng-click=\"myStyle={color:'red'}\">\n <input type=\"button\" value=\"set background\" ng-click=\"myStyle={'background-color':'blue'}\">\n <input type=\"button\" value=\"clear\" ng-click=\"myStyle={}\">\n <br/>\n <span ng-style=\"myStyle\">Sample Text</span>\n <pre>myStyle={{myStyle}}</pre>\n </file>\n <file name=\"style.css\">\n span {\n color: black;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var colorSpan = element(by.css('span'));\n\n it('should check ng-style', function() {\n expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n element(by.css('input[value=\\'set color\\']')).click();\n expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');\n element(by.css('input[value=clear]')).click();\n expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n });\n </file>\n </example>\n */\nvar ngStyleDirective = ngDirective(function(scope, element, attr) {\n scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {\n if (oldStyles && (newStyles !== oldStyles)) {\n forEach(oldStyles, function(val, style) { element.css(style, '');});\n }\n if (newStyles) element.css(newStyles);\n }, true);\n});\n\n/**\n * @ngdoc directive\n * @name ngSwitch\n * @restrict EA\n *\n * @description\n * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.\n * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location\n * as specified in the template.\n *\n * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it\n * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element\n * matches the value obtained from the evaluated expression. In other words, you define a container element\n * (where you place the directive), place an expression on the **`on=\"...\"` attribute**\n * (or the **`ng-switch=\"...\"` attribute**), define any inner elements inside of the directive and place\n * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on\n * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default\n * attribute is displayed.\n *\n * <div class=\"alert alert-info\">\n * Be aware that the attribute values to match against cannot be expressions. They are interpreted\n * as literal string values to match against.\n * For example, **`ng-switch-when=\"someVal\"`** will match against the string `\"someVal\"` not against the\n * value of the expression `$scope.someVal`.\n * </div>\n\n * @animations\n * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container\n * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM\n *\n * @usage\n *\n * ```\n * <ANY ng-switch=\"expression\">\n * <ANY ng-switch-when=\"matchValue1\">...</ANY>\n * <ANY ng-switch-when=\"matchValue2\">...</ANY>\n * <ANY ng-switch-default>...</ANY>\n * </ANY>\n * ```\n *\n *\n * @scope\n * @priority 1200\n * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.\n * On child elements add:\n *\n * * `ngSwitchWhen`: the case statement to match against. If match then this\n * case will be displayed. If the same match appears multiple times, all the\n * elements will be displayed.\n * * `ngSwitchDefault`: the default case when no other case match. If there\n * are multiple default cases, all of them will be displayed when no other\n * case match.\n *\n *\n * @example\n <example module=\"switchExample\" deps=\"angular-animate.js\" animations=\"true\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <select ng-model=\"selection\" ng-options=\"item for item in items\">\n </select>\n <code>selection={{selection}}</code>\n <hr/>\n <div class=\"animate-switch-container\"\n ng-switch on=\"selection\">\n <div class=\"animate-switch\" ng-switch-when=\"settings\">Settings Div</div>\n <div class=\"animate-switch\" ng-switch-when=\"home\">Home Span</div>\n <div class=\"animate-switch\" ng-switch-default>default</div>\n </div>\n </div>\n </file>\n <file name=\"script.js\">\n angular.module('switchExample', ['ngAnimate'])\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.items = ['settings', 'home', 'other'];\n $scope.selection = $scope.items[0];\n }]);\n </file>\n <file name=\"animations.css\">\n .animate-switch-container {\n position:relative;\n background:white;\n border:1px solid black;\n height:40px;\n overflow:hidden;\n }\n\n .animate-switch {\n padding:10px;\n }\n\n .animate-switch.ng-animate {\n transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n position:absolute;\n top:0;\n left:0;\n right:0;\n bottom:0;\n }\n\n .animate-switch.ng-leave.ng-leave-active,\n .animate-switch.ng-enter {\n top:-50px;\n }\n .animate-switch.ng-leave,\n .animate-switch.ng-enter.ng-enter-active {\n top:0;\n }\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n var switchElem = element(by.css('[ng-switch]'));\n var select = element(by.model('selection'));\n\n it('should start in settings', function() {\n expect(switchElem.getText()).toMatch(/Settings Div/);\n });\n it('should change to home', function() {\n select.all(by.css('option')).get(1).click();\n expect(switchElem.getText()).toMatch(/Home Span/);\n });\n it('should select default', function() {\n select.all(by.css('option')).get(2).click();\n expect(switchElem.getText()).toMatch(/default/);\n });\n </file>\n </example>\n */\nvar ngSwitchDirective = ['$animate', function($animate) {\n return {\n require: 'ngSwitch',\n\n // asks for $scope to fool the BC controller module\n controller: ['$scope', function ngSwitchController() {\n this.cases = {};\n }],\n link: function(scope, element, attr, ngSwitchController) {\n var watchExpr = attr.ngSwitch || attr.on,\n selectedTranscludes = [],\n selectedElements = [],\n previousLeaveAnimations = [],\n selectedScopes = [];\n\n var spliceFactory = function(array, index) {\n return function() { array.splice(index, 1); };\n };\n\n scope.$watch(watchExpr, function ngSwitchWatchAction(value) {\n var i, ii;\n for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {\n $animate.cancel(previousLeaveAnimations[i]);\n }\n previousLeaveAnimations.length = 0;\n\n for (i = 0, ii = selectedScopes.length; i < ii; ++i) {\n var selected = getBlockNodes(selectedElements[i].clone);\n selectedScopes[i].$destroy();\n var promise = previousLeaveAnimations[i] = $animate.leave(selected);\n promise.then(spliceFactory(previousLeaveAnimations, i));\n }\n\n selectedElements.length = 0;\n selectedScopes.length = 0;\n\n if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {\n forEach(selectedTranscludes, function(selectedTransclude) {\n selectedTransclude.transclude(function(caseElement, selectedScope) {\n selectedScopes.push(selectedScope);\n var anchor = selectedTransclude.element;\n caseElement[caseElement.length++] = document.createComment(' end ngSwitchWhen: ');\n var block = { clone: caseElement };\n\n selectedElements.push(block);\n $animate.enter(caseElement, anchor.parent(), anchor);\n });\n });\n }\n });\n }\n };\n}];\n\nvar ngSwitchWhenDirective = ngDirective({\n transclude: 'element',\n priority: 1200,\n require: '^ngSwitch',\n multiElement: true,\n link: function(scope, element, attrs, ctrl, $transclude) {\n ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);\n ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });\n }\n});\n\nvar ngSwitchDefaultDirective = ngDirective({\n transclude: 'element',\n priority: 1200,\n require: '^ngSwitch',\n multiElement: true,\n link: function(scope, element, attr, ctrl, $transclude) {\n ctrl.cases['?'] = (ctrl.cases['?'] || []);\n ctrl.cases['?'].push({ transclude: $transclude, element: element });\n }\n});\n\n/**\n * @ngdoc directive\n * @name ngTransclude\n * @restrict EAC\n *\n * @description\n * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.\n *\n * Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.\n *\n * @element ANY\n *\n * @example\n <example module=\"transcludeExample\">\n <file name=\"index.html\">\n <script>\n angular.module('transcludeExample', [])\n .directive('pane', function(){\n return {\n restrict: 'E',\n transclude: true,\n scope: { title:'@' },\n template: '<div style=\"border: 1px solid black;\">' +\n '<div style=\"background-color: gray\">{{title}}</div>' +\n '<ng-transclude></ng-transclude>' +\n '</div>'\n };\n })\n .controller('ExampleController', ['$scope', function($scope) {\n $scope.title = 'Lorem Ipsum';\n $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n }]);\n </script>\n <div ng-controller=\"ExampleController\">\n <input ng-model=\"title\" aria-label=\"title\"> <br/>\n <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n <pane title=\"{{title}}\">{{text}}</pane>\n </div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should have transcluded', function() {\n var titleElement = element(by.model('title'));\n titleElement.clear();\n titleElement.sendKeys('TITLE');\n var textElement = element(by.model('text'));\n textElement.clear();\n textElement.sendKeys('TEXT');\n expect(element(by.binding('title')).getText()).toEqual('TITLE');\n expect(element(by.binding('text')).getText()).toEqual('TEXT');\n });\n </file>\n </example>\n *\n */\nvar ngTranscludeDirective = ngDirective({\n restrict: 'EAC',\n link: function($scope, $element, $attrs, controller, $transclude) {\n if (!$transclude) {\n throw minErr('ngTransclude')('orphan',\n 'Illegal use of ngTransclude directive in the template! ' +\n 'No parent directive that requires a transclusion found. ' +\n 'Element: {0}',\n startingTag($element));\n }\n\n $transclude(function(clone) {\n $element.empty();\n $element.append(clone);\n });\n }\n});\n\n/**\n * @ngdoc directive\n * @name script\n * @restrict E\n *\n * @description\n * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the\n * template can be used by {@link ng.directive:ngInclude `ngInclude`},\n * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the\n * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be\n * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.\n *\n * @param {string} type Must be set to `'text/ng-template'`.\n * @param {string} id Cache name of the template.\n *\n * @example\n <example>\n <file name=\"index.html\">\n <script type=\"text/ng-template\" id=\"/tpl.html\">\n Content of the template.\n </script>\n\n <a ng-click=\"currentTpl='/tpl.html'\" id=\"tpl-link\">Load inlined template</a>\n <div id=\"tpl-content\" ng-include src=\"currentTpl\"></div>\n </file>\n <file name=\"protractor.js\" type=\"protractor\">\n it('should load template defined inside script tag', function() {\n element(by.css('#tpl-link')).click();\n expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);\n });\n </file>\n </example>\n */\nvar scriptDirective = ['$templateCache', function($templateCache) {\n return {\n restrict: 'E',\n terminal: true,\n compile: function(element, attr) {\n if (attr.type == 'text/ng-template') {\n var templateUrl = attr.id,\n text = element[0].text;\n\n $templateCache.put(templateUrl, text);\n }\n }\n };\n}];\n\nvar noopNgModelController = { $setViewValue: noop, $render: noop };\n\nfunction chromeHack(optionElement) {\n // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459\n // Adding an <option selected=\"selected\"> element to a <select required=\"required\"> should\n // automatically select the new element\n if (optionElement[0].hasAttribute('selected')) {\n optionElement[0].selected = true;\n }\n}\n\n/**\n * @ngdoc type\n * @name select.SelectController\n * @description\n * The controller for the `<select>` directive. This provides support for reading\n * and writing the selected value(s) of the control and also coordinates dynamically\n * added `<option>` elements, perhaps by an `ngRepeat` directive.\n */\nvar SelectController =\n ['$element', '$scope', '$attrs', function($element, $scope, $attrs) {\n\n var self = this,\n optionsMap = new HashMap();\n\n // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors\n self.ngModelCtrl = noopNgModelController;\n\n // The \"unknown\" option is one that is prepended to the list if the viewValue\n // does not match any of the options. When it is rendered the value of the unknown\n // option is '? XXX ?' where XXX is the hashKey of the value that is not known.\n //\n // We can't just jqLite('<option>') since jqLite is not smart enough\n // to create it in <select> and IE barfs otherwise.\n self.unknownOption = jqLite(document.createElement('option'));\n self.renderUnknownOption = function(val) {\n var unknownVal = '? ' + hashKey(val) + ' ?';\n self.unknownOption.val(unknownVal);\n $element.prepend(self.unknownOption);\n $element.val(unknownVal);\n };\n\n $scope.$on('$destroy', function() {\n // disable unknown option so that we don't do work when the whole select is being destroyed\n self.renderUnknownOption = noop;\n });\n\n self.removeUnknownOption = function() {\n if (self.unknownOption.parent()) self.unknownOption.remove();\n };\n\n\n // Read the value of the select control, the implementation of this changes depending\n // upon whether the select can have multiple values and whether ngOptions is at work.\n self.readValue = function readSingleValue() {\n self.removeUnknownOption();\n return $element.val();\n };\n\n\n // Write the value to the select control, the implementation of this changes depending\n // upon whether the select can have multiple values and whether ngOptions is at work.\n self.writeValue = function writeSingleValue(value) {\n if (self.hasOption(value)) {\n self.removeUnknownOption();\n $element.val(value);\n if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy\n } else {\n if (value == null && self.emptyOption) {\n self.removeUnknownOption();\n $element.val('');\n } else {\n self.renderUnknownOption(value);\n }\n }\n };\n\n\n // Tell the select control that an option, with the given value, has been added\n self.addOption = function(value, element) {\n // Skip comment nodes, as they only pollute the `optionsMap`\n if (element[0].nodeType === NODE_TYPE_COMMENT) return;\n\n assertNotHasOwnProperty(value, '\"option value\"');\n if (value === '') {\n self.emptyOption = element;\n }\n var count = optionsMap.get(value) || 0;\n optionsMap.put(value, count + 1);\n self.ngModelCtrl.$render();\n chromeHack(element);\n };\n\n // Tell the select control that an option, with the given value, has been removed\n self.removeOption = function(value) {\n var count = optionsMap.get(value);\n if (count) {\n if (count === 1) {\n optionsMap.remove(value);\n if (value === '') {\n self.emptyOption = undefined;\n }\n } else {\n optionsMap.put(value, count - 1);\n }\n }\n };\n\n // Check whether the select control has an option matching the given value\n self.hasOption = function(value) {\n return !!optionsMap.get(value);\n };\n\n\n self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {\n\n if (interpolateValueFn) {\n // The value attribute is interpolated\n var oldVal;\n optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {\n if (isDefined(oldVal)) {\n self.removeOption(oldVal);\n }\n oldVal = newVal;\n self.addOption(newVal, optionElement);\n });\n } else if (interpolateTextFn) {\n // The text content is interpolated\n optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {\n optionAttrs.$set('value', newVal);\n if (oldVal !== newVal) {\n self.removeOption(oldVal);\n }\n self.addOption(newVal, optionElement);\n });\n } else {\n // The value attribute is static\n self.addOption(optionAttrs.value, optionElement);\n }\n\n optionElement.on('$destroy', function() {\n self.removeOption(optionAttrs.value);\n self.ngModelCtrl.$render();\n });\n };\n}];\n\n/**\n * @ngdoc directive\n * @name select\n * @restrict E\n *\n * @description\n * HTML `SELECT` element with angular data-binding.\n *\n * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding\n * between the scope and the `<select>` control (including setting default values).\n * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or\n * {@link ngOptions `ngOptions`} directives.\n *\n * When an item in the `<select>` menu is selected, the value of the selected option will be bound\n * to the model identified by the `ngModel` directive. With static or repeated options, this is\n * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.\n * If you want dynamic value attributes, you can use interpolation inside the value attribute.\n *\n * <div class=\"alert alert-warning\">\n * Note that the value of a `select` directive used without `ngOptions` is always a string.\n * When the model needs to be bound to a non-string value, you must either explictly convert it\n * using a directive (see example below) or use `ngOptions` to specify the set of options.\n * This is because an option element can only be bound to string values at present.\n * </div>\n *\n * If the viewValue of `ngModel` does not match any of the options, then the control\n * will automatically add an \"unknown\" option, which it then removes when the mismatch is resolved.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * <div class=\"alert alert-info\">\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions\n * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression, and additionally in reducing memory and increasing speed by not creating\n * a new scope for each repeated instance.\n * </div>\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} multiple Allows multiple options to be selected. The selected values will be\n * bound to the model as an array.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds required attribute and required validation constraint to\n * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required\n * when you want to data-bind to the required attribute.\n * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user\n * interaction with the select element.\n * @param {string=} ngOptions sets the options that the select is populated with and defines what is\n * set on the model on selection. See {@link ngOptions `ngOptions`}.\n *\n * @example\n * ### Simple `select` elements with static options\n *\n * <example name=\"static-select\" module=\"staticSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n * <form name=\"myForm\">\n * <label for=\"singleSelect\"> Single select: </label><br>\n * <select name=\"singleSelect\" ng-model=\"data.singleSelect\">\n * <option value=\"option-1\">Option 1</option>\n * <option value=\"option-2\">Option 2</option>\n * </select><br>\n *\n * <label for=\"singleSelect\"> Single select with \"not selected\" option and dynamic option values: </label><br>\n * <select name=\"singleSelect\" id=\"singleSelect\" ng-model=\"data.singleSelect\">\n * <option value=\"\">---Please select---</option> <!-- not selected / blank option -->\n * <option value=\"{{data.option1}}\">Option 1</option> <!-- interpolation -->\n * <option value=\"option-2\">Option 2</option>\n * </select><br>\n * <button ng-click=\"forceUnknownOption()\">Force unknown option</button><br>\n * <tt>singleSelect = {{data.singleSelect}}</tt>\n *\n * <hr>\n * <label for=\"multipleSelect\"> Multiple select: </label><br>\n * <select name=\"multipleSelect\" id=\"multipleSelect\" ng-model=\"data.multipleSelect\" multiple>\n * <option value=\"option-1\">Option 1</option>\n * <option value=\"option-2\">Option 2</option>\n * <option value=\"option-3\">Option 3</option>\n * </select><br>\n * <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>\n * </form>\n * </div>\n * </file>\n * <file name=\"app.js\">\n * angular.module('staticSelect', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.data = {\n * singleSelect: null,\n * multipleSelect: [],\n * option1: 'option-1',\n * };\n *\n * $scope.forceUnknownOption = function() {\n * $scope.data.singleSelect = 'nonsense';\n * };\n * }]);\n * </file>\n *</example>\n *\n * ### Using `ngRepeat` to generate `select` options\n * <example name=\"ngrepeat-select\" module=\"ngrepeatSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n * <form name=\"myForm\">\n * <label for=\"repeatSelect\"> Repeat select: </label>\n * <select name=\"repeatSelect\" id=\"repeatSelect\" ng-model=\"data.repeatSelect\">\n * <option ng-repeat=\"option in data.availableOptions\" value=\"{{option.id}}\">{{option.name}}</option>\n * </select>\n * </form>\n * <hr>\n * <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n * angular.module('ngrepeatSelect', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.data = {\n * repeatSelect: null,\n * availableOptions: [\n * {id: '1', name: 'Option A'},\n * {id: '2', name: 'Option B'},\n * {id: '3', name: 'Option C'}\n * ],\n * };\n * }]);\n * </file>\n *</example>\n *\n *\n * ### Using `select` with `ngOptions` and setting a default value\n * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.\n *\n * <example name=\"select-with-default-values\" module=\"defaultValueSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n * <form name=\"myForm\">\n * <label for=\"mySelect\">Make a choice:</label>\n * <select name=\"mySelect\" id=\"mySelect\"\n * ng-options=\"option.name for option in data.availableOptions track by option.id\"\n * ng-model=\"data.selectedOption\"></select>\n * </form>\n * <hr>\n * <tt>option = {{data.selectedOption}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n * angular.module('defaultValueSelect', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.data = {\n * availableOptions: [\n * {id: '1', name: 'Option A'},\n * {id: '2', name: 'Option B'},\n * {id: '3', name: 'Option C'}\n * ],\n * selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui\n * };\n * }]);\n * </file>\n *</example>\n *\n *\n * ### Binding `select` to a non-string value via `ngModel` parsing / formatting\n *\n * <example name=\"select-with-non-string-options\" module=\"nonStringSelect\">\n * <file name=\"index.html\">\n * <select ng-model=\"model.id\" convert-to-number>\n * <option value=\"0\">Zero</option>\n * <option value=\"1\">One</option>\n * <option value=\"2\">Two</option>\n * </select>\n * {{ model }}\n * </file>\n * <file name=\"app.js\">\n * angular.module('nonStringSelect', [])\n * .run(function($rootScope) {\n * $rootScope.model = { id: 2 };\n * })\n * .directive('convertToNumber', function() {\n * return {\n * require: 'ngModel',\n * link: function(scope, element, attrs, ngModel) {\n * ngModel.$parsers.push(function(val) {\n * return parseInt(val, 10);\n * });\n * ngModel.$formatters.push(function(val) {\n * return '' + val;\n * });\n * }\n * };\n * });\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should initialize to model', function() {\n * var select = element(by.css('select'));\n * expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');\n * });\n * </file>\n * </example>\n *\n */\nvar selectDirective = function() {\n\n return {\n restrict: 'E',\n require: ['select', '?ngModel'],\n controller: SelectController,\n priority: 1,\n link: {\n pre: selectPreLink,\n post: selectPostLink\n }\n };\n\n function selectPreLink(scope, element, attr, ctrls) {\n\n // if ngModel is not defined, we don't need to do anything\n var ngModelCtrl = ctrls[1];\n if (!ngModelCtrl) return;\n\n var selectCtrl = ctrls[0];\n\n selectCtrl.ngModelCtrl = ngModelCtrl;\n\n // When the selected item(s) changes we delegate getting the value of the select control\n // to the `readValue` method, which can be changed if the select can have multiple\n // selected values or if the options are being generated by `ngOptions`\n element.on('change', function() {\n scope.$apply(function() {\n ngModelCtrl.$setViewValue(selectCtrl.readValue());\n });\n });\n\n // If the select allows multiple values then we need to modify how we read and write\n // values from and to the control; also what it means for the value to be empty and\n // we have to add an extra watch since ngModel doesn't work well with arrays - it\n // doesn't trigger rendering if only an item in the array changes.\n if (attr.multiple) {\n\n // Read value now needs to check each option to see if it is selected\n selectCtrl.readValue = function readMultipleValue() {\n var array = [];\n forEach(element.find('option'), function(option) {\n if (option.selected) {\n array.push(option.value);\n }\n });\n return array;\n };\n\n // Write value now needs to set the selected property of each matching option\n selectCtrl.writeValue = function writeMultipleValue(value) {\n var items = new HashMap(value);\n forEach(element.find('option'), function(option) {\n option.selected = isDefined(items.get(option.value));\n });\n };\n\n // we have to do it on each watch since ngModel watches reference, but\n // we need to work of an array, so we need to see if anything was inserted/removed\n var lastView, lastViewRef = NaN;\n scope.$watch(function selectMultipleWatch() {\n if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {\n lastView = shallowCopy(ngModelCtrl.$viewValue);\n ngModelCtrl.$render();\n }\n lastViewRef = ngModelCtrl.$viewValue;\n });\n\n // If we are a multiple select then value is now a collection\n // so the meaning of $isEmpty changes\n ngModelCtrl.$isEmpty = function(value) {\n return !value || value.length === 0;\n };\n\n }\n }\n\n function selectPostLink(scope, element, attrs, ctrls) {\n // if ngModel is not defined, we don't need to do anything\n var ngModelCtrl = ctrls[1];\n if (!ngModelCtrl) return;\n\n var selectCtrl = ctrls[0];\n\n // We delegate rendering to the `writeValue` method, which can be changed\n // if the select can have multiple selected values or if the options are being\n // generated by `ngOptions`.\n // This must be done in the postLink fn to prevent $render to be called before\n // all nodes have been linked correctly.\n ngModelCtrl.$render = function() {\n selectCtrl.writeValue(ngModelCtrl.$viewValue);\n };\n }\n};\n\n\n// The option directive is purely designed to communicate the existence (or lack of)\n// of dynamically created (and destroyed) option elements to their containing select\n// directive via its controller.\nvar optionDirective = ['$interpolate', function($interpolate) {\n return {\n restrict: 'E',\n priority: 100,\n compile: function(element, attr) {\n if (isDefined(attr.value)) {\n // If the value attribute is defined, check if it contains an interpolation\n var interpolateValueFn = $interpolate(attr.value, true);\n } else {\n // If the value attribute is not defined then we fall back to the\n // text content of the option element, which may be interpolated\n var interpolateTextFn = $interpolate(element.text(), true);\n if (!interpolateTextFn) {\n attr.$set('value', element.text());\n }\n }\n\n return function(scope, element, attr) {\n // This is an optimization over using ^^ since we don't want to have to search\n // all the way to the root of the DOM for every single option element\n var selectCtrlName = '$selectController',\n parent = element.parent(),\n selectCtrl = parent.data(selectCtrlName) ||\n parent.parent().data(selectCtrlName); // in case we are in optgroup\n\n if (selectCtrl) {\n selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);\n }\n };\n }\n };\n}];\n\nvar styleDirective = valueFn({\n restrict: 'E',\n terminal: false\n});\n\n/**\n * @ngdoc directive\n * @name ngRequired\n * @restrict A\n *\n * @description\n *\n * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be\n * applied to custom controls.\n *\n * The directive sets the `required` attribute on the element if the Angular expression inside\n * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we\n * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}\n * for more info.\n *\n * The validator will set the `required` error key to true if the `required` attribute is set and\n * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the\n * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the\n * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing\n * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.\n *\n * @example\n * <example name=\"ngRequiredDirective\" module=\"ngRequiredExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('ngRequiredExample', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.required = true;\n * }]);\n * </script>\n * <div ng-controller=\"ExampleController\">\n * <form name=\"form\">\n * <label for=\"required\">Toggle required: </label>\n * <input type=\"checkbox\" ng-model=\"required\" id=\"required\" />\n * <br>\n * <label for=\"input\">This input must be filled if `required` is true: </label>\n * <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-required=\"required\" /><br>\n * <hr>\n * required error set? = <code>{{form.input.$error.required}}</code><br>\n * model = <code>{{model}}</code>\n * </form>\n * </div>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n var required = element(by.binding('form.input.$error.required'));\n var model = element(by.binding('model'));\n var input = element(by.id('input'));\n\n it('should set the required error', function() {\n expect(required.getText()).toContain('true');\n\n input.sendKeys('123');\n expect(required.getText()).not.toContain('true');\n expect(model.getText()).toContain('123');\n });\n * </file>\n * </example>\n */\nvar requiredDirective = function() {\n return {\n restrict: 'A',\n require: '?ngModel',\n link: function(scope, elm, attr, ctrl) {\n if (!ctrl) return;\n attr.required = true; // force truthy in case we are on non input element\n\n ctrl.$validators.required = function(modelValue, viewValue) {\n return !attr.required || !ctrl.$isEmpty(viewValue);\n };\n\n attr.$observe('required', function() {\n ctrl.$validate();\n });\n }\n };\n};\n\n/**\n * @ngdoc directive\n * @name ngPattern\n *\n * @description\n *\n * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * does not match a RegExp which is obtained by evaluating the Angular expression given in the\n * `ngPattern` attribute value:\n * * If the expression evaluates to a RegExp object, then this is used directly.\n * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it\n * in `^` and `$` characters. For instance, `\"abc\"` will be converted to `new RegExp('^abc$')`.\n *\n * <div class=\"alert alert-info\">\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * </div>\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `pattern` attribute is used, with two\n * differences:\n * <ol>\n * <li>\n * `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is\n * not available.\n * </li>\n * <li>\n * The `ngPattern` attribute must be an expression, while the `pattern` value must be\n * interpolated.\n * </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngPatternDirective\" module=\"ngPatternExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('ngPatternExample', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.regex = '\\\\d+';\n * }]);\n * </script>\n * <div ng-controller=\"ExampleController\">\n * <form name=\"form\">\n * <label for=\"regex\">Set a pattern (regex string): </label>\n * <input type=\"text\" ng-model=\"regex\" id=\"regex\" />\n * <br>\n * <label for=\"input\">This input is restricted by the current pattern: </label>\n * <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-pattern=\"regex\" /><br>\n * <hr>\n * input valid? = <code>{{form.input.$valid}}</code><br>\n * model = <code>{{model}}</code>\n * </form>\n * </div>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n var model = element(by.binding('model'));\n var input = element(by.id('input'));\n\n it('should validate the input with the default pattern', function() {\n input.sendKeys('aaa');\n expect(model.getText()).not.toContain('aaa');\n\n input.clear().then(function() {\n input.sendKeys('123');\n expect(model.getText()).toContain('123');\n });\n });\n * </file>\n * </example>\n */\nvar patternDirective = function() {\n return {\n restrict: 'A',\n require: '?ngModel',\n link: function(scope, elm, attr, ctrl) {\n if (!ctrl) return;\n\n var regexp, patternExp = attr.ngPattern || attr.pattern;\n attr.$observe('pattern', function(regex) {\n if (isString(regex) && regex.length > 0) {\n regex = new RegExp('^' + regex + '$');\n }\n\n if (regex && !regex.test) {\n throw minErr('ngPattern')('noregexp',\n 'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,\n regex, startingTag(elm));\n }\n\n regexp = regex || undefined;\n ctrl.$validate();\n });\n\n ctrl.$validators.pattern = function(modelValue, viewValue) {\n // HTML5 pattern constraint validates the input value, so we validate the viewValue\n return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);\n };\n }\n };\n};\n\n/**\n * @ngdoc directive\n * @name ngMaxlength\n *\n * @description\n *\n * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is longer than the integer obtained by evaluating the Angular expression given in the\n * `ngMaxlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two\n * differences:\n * <ol>\n * <li>\n * `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint\n * validation is not available.\n * </li>\n * <li>\n * The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be\n * interpolated.\n * </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMaxlengthDirective\" module=\"ngMaxlengthExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('ngMaxlengthExample', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.maxlength = 5;\n * }]);\n * </script>\n * <div ng-controller=\"ExampleController\">\n * <form name=\"form\">\n * <label for=\"maxlength\">Set a maxlength: </label>\n * <input type=\"number\" ng-model=\"maxlength\" id=\"maxlength\" />\n * <br>\n * <label for=\"input\">This input is restricted by the current maxlength: </label>\n * <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-maxlength=\"maxlength\" /><br>\n * <hr>\n * input valid? = <code>{{form.input.$valid}}</code><br>\n * model = <code>{{model}}</code>\n * </form>\n * </div>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n var model = element(by.binding('model'));\n var input = element(by.id('input'));\n\n it('should validate the input with the default maxlength', function() {\n input.sendKeys('abcdef');\n expect(model.getText()).not.toContain('abcdef');\n\n input.clear().then(function() {\n input.sendKeys('abcde');\n expect(model.getText()).toContain('abcde');\n });\n });\n * </file>\n * </example>\n */\nvar maxlengthDirective = function() {\n return {\n restrict: 'A',\n require: '?ngModel',\n link: function(scope, elm, attr, ctrl) {\n if (!ctrl) return;\n\n var maxlength = -1;\n attr.$observe('maxlength', function(value) {\n var intVal = toInt(value);\n maxlength = isNaN(intVal) ? -1 : intVal;\n ctrl.$validate();\n });\n ctrl.$validators.maxlength = function(modelValue, viewValue) {\n return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);\n };\n }\n };\n};\n\n/**\n * @ngdoc directive\n * @name ngMinlength\n *\n * @description\n *\n * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is shorter than the integer obtained by evaluating the Angular expression given in the\n * `ngMinlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `minlength` attribute is used, with two\n * differences:\n * <ol>\n * <li>\n * `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint\n * validation is not available.\n * </li>\n * <li>\n * The `ngMinlength` value must be an expression, while the `minlength` value must be\n * interpolated.\n * </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMinlengthDirective\" module=\"ngMinlengthExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('ngMinlengthExample', [])\n * .controller('ExampleController', ['$scope', function($scope) {\n * $scope.minlength = 3;\n * }]);\n * </script>\n * <div ng-controller=\"ExampleController\">\n * <form name=\"form\">\n * <label for=\"minlength\">Set a minlength: </label>\n * <input type=\"number\" ng-model=\"minlength\" id=\"minlength\" />\n * <br>\n * <label for=\"input\">This input is restricted by the current minlength: </label>\n * <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-minlength=\"minlength\" /><br>\n * <hr>\n * input valid? = <code>{{form.input.$valid}}</code><br>\n * model = <code>{{model}}</code>\n * </form>\n * </div>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n var model = element(by.binding('model'));\n var input = element(by.id('input'));\n\n it('should validate the input with the default minlength', function() {\n input.sendKeys('ab');\n expect(model.getText()).not.toContain('ab');\n\n input.sendKeys('abc');\n expect(model.getText()).toContain('abc');\n });\n * </file>\n * </example>\n */\nvar minlengthDirective = function() {\n return {\n restrict: 'A',\n require: '?ngModel',\n link: function(scope, elm, attr, ctrl) {\n if (!ctrl) return;\n\n var minlength = 0;\n attr.$observe('minlength', function(value) {\n minlength = toInt(value) || 0;\n ctrl.$validate();\n });\n ctrl.$validators.minlength = function(modelValue, viewValue) {\n return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;\n };\n }\n };\n};\n\nif (window.angular.bootstrap) {\n //AngularJS is already loaded, so we can return here...\n if (window.console) {\n console.log('WARNING: Tried to load angular more than once.');\n }\n return;\n}\n\n//try to bind to jquery now so that one can write jqLite(document).ready()\n//but we will rebind on bootstrap again.\nbindJQuery();\n\npublishExternalAPI(angular);\n\nangular.module(\"ngLocale\", [], [\"$provide\", function($provide) {\nvar PLURAL_CATEGORY = {ZERO: \"zero\", ONE: \"one\", TWO: \"two\", FEW: \"few\", MANY: \"many\", OTHER: \"other\"};\nfunction getDecimals(n) {\n n = n + '';\n var i = n.indexOf('.');\n return (i == -1) ? 0 : n.length - i - 1;\n}\n\nfunction getVF(n, opt_precision) {\n var v = opt_precision;\n\n if (undefined === v) {\n v = Math.min(getDecimals(n), 3);\n }\n\n var base = Math.pow(10, v);\n var f = ((n * base) | 0) % base;\n return {v: v, f: f};\n}\n\n$provide.value(\"$locale\", {\n \"DATETIME_FORMATS\": {\n \"AMPMS\": [\n \"AM\",\n \"PM\"\n ],\n \"DAY\": [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\"\n ],\n \"ERANAMES\": [\n \"Before Christ\",\n \"Anno Domini\"\n ],\n \"ERAS\": [\n \"BC\",\n \"AD\"\n ],\n \"FIRSTDAYOFWEEK\": 6,\n \"MONTH\": [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n \"SHORTDAY\": [\n \"Sun\",\n \"Mon\",\n \"Tue\",\n \"Wed\",\n \"Thu\",\n \"Fri\",\n \"Sat\"\n ],\n \"SHORTMONTH\": [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n ],\n \"STANDALONEMONTH\": [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ],\n \"WEEKENDRANGE\": [\n 5,\n 6\n ],\n \"fullDate\": \"EEEE, MMMM d, y\",\n \"longDate\": \"MMMM d, y\",\n \"medium\": \"MMM d, y h:mm:ss a\",\n \"mediumDate\": \"MMM d, y\",\n \"mediumTime\": \"h:mm:ss a\",\n \"short\": \"M/d/yy h:mm a\",\n \"shortDate\": \"M/d/yy\",\n \"shortTime\": \"h:mm a\"\n },\n \"NUMBER_FORMATS\": {\n \"CURRENCY_SYM\": \"$\",\n \"DECIMAL_SEP\": \".\",\n \"GROUP_SEP\": \",\",\n \"PATTERNS\": [\n {\n \"gSize\": 3,\n \"lgSize\": 3,\n \"maxFrac\": 3,\n \"minFrac\": 0,\n \"minInt\": 1,\n \"negPre\": \"-\",\n \"negSuf\": \"\",\n \"posPre\": \"\",\n \"posSuf\": \"\"\n },\n {\n \"gSize\": 3,\n \"lgSize\": 3,\n \"maxFrac\": 2,\n \"minFrac\": 2,\n \"minInt\": 1,\n \"negPre\": \"-\\u00a4\",\n \"negSuf\": \"\",\n \"posPre\": \"\\u00a4\",\n \"posSuf\": \"\"\n }\n ]\n },\n \"id\": \"en-us\",\n \"localeID\": \"en_US\",\n \"pluralCat\": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}\n});\n}]);\n\n jqLite(document).ready(function() {\n angularInit(document, bootstrap);\n });\n\n})(window, document);\n\n!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type=\"text/css\">@charset \"UTF-8\";[ng\\\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');","require('./angular');\nmodule.exports = angular;\n","/**\n * An abstraction for slicing an arraybuffer even when\n * ArrayBuffer.prototype.slice is not supported\n *\n * @api public\n */\n\nmodule.exports = function(arraybuffer, start, end) {\n var bytes = arraybuffer.byteLength;\n start = start || 0;\n end = end || bytes;\n\n if (arraybuffer.slice) { return arraybuffer.slice(start, end); }\n\n if (start < 0) { start += bytes; }\n if (end < 0) { end += bytes; }\n if (end > bytes) { end = bytes; }\n\n if (start >= bytes || start >= end || bytes === 0) {\n return new ArrayBuffer(0);\n }\n\n var abv = new Uint8Array(arraybuffer);\n var result = new Uint8Array(end - start);\n for (var i = start, ii = 0; i < end; i++, ii++) {\n result[ii] = abv[i];\n }\n return result.buffer;\n};\n","\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(chars){\n \"use strict\";\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = chars.indexOf(base64[i]);\n encoded2 = chars.indexOf(base64[i+1]);\n encoded3 = chars.indexOf(base64[i+2]);\n encoded4 = chars.indexOf(base64[i+3]);\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\");\n","/**\r\n * Create a blob builder even when vendor prefixes exist\r\n */\r\n\r\nvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n false;\r\n\r\n/**\r\n * Check if Blob constructor is supported\r\n */\r\n\r\nvar blobSupported = (function() {\r\n try {\r\n var a = new Blob(['hi']);\r\n return a.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if Blob constructor supports ArrayBufferViews\r\n * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n */\r\n\r\nvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n try {\r\n var b = new Blob([new Uint8Array([1,2])]);\r\n return b.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if BlobBuilder is supported\r\n */\r\n\r\nvar blobBuilderSupported = BlobBuilder\r\n && BlobBuilder.prototype.append\r\n && BlobBuilder.prototype.getBlob;\r\n\r\n/**\r\n * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n * Used by BlobBuilder constructor and old browsers that didn't\r\n * support it in the Blob constructor.\r\n */\r\n\r\nfunction mapArrayBufferViews(ary) {\r\n return ary.map(function(chunk) {\r\n if (chunk.buffer instanceof ArrayBuffer) {\r\n var buf = chunk.buffer;\r\n\r\n // if this is a subarray, make a copy so we only\r\n // include the subarray region from the underlying buffer\r\n if (chunk.byteLength !== buf.byteLength) {\r\n var copy = new Uint8Array(chunk.byteLength);\r\n copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n buf = copy.buffer;\r\n }\r\n\r\n return buf;\r\n }\r\n\r\n return chunk;\r\n });\r\n}\r\n\r\nfunction BlobBuilderConstructor(ary, options) {\r\n options = options || {};\r\n\r\n var bb = new BlobBuilder();\r\n mapArrayBufferViews(ary).forEach(function(part) {\r\n bb.append(part);\r\n });\r\n\r\n return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n};\r\n\r\nfunction BlobConstructor(ary, options) {\r\n return new Blob(mapArrayBufferViews(ary), options || {});\r\n};\r\n\r\nif (typeof Blob !== 'undefined') {\r\n BlobBuilderConstructor.prototype = Blob.prototype;\r\n BlobConstructor.prototype = Blob.prototype;\r\n}\r\n\r\nmodule.exports = (function() {\r\n if (blobSupported) {\r\n return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n } else if (blobBuilderSupported) {\r\n return BlobBuilderConstructor;\r\n } else {\r\n return undefined;\r\n }\r\n})();\r\n","/**\n * Slice reference.\n */\n\nvar slice = [].slice;\n\n/**\n * Bind `obj` to `fn`.\n *\n * @param {Object} obj\n * @param {Function|String} fn or string\n * @return {Function}\n * @api public\n */\n\nmodule.exports = function(obj, fn){\n if ('string' == typeof fn) fn = obj[fn];\n if ('function' != typeof fn) throw new Error('bind() requires a function');\n var args = slice.call(arguments, 2);\n return function(){\n return fn.apply(obj, args.concat(slice.call(arguments)));\n }\n};\n","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n // Remove event specific arrays for event types that no\r\n // one is subscribed for to avoid memory leak.\r\n if (callbacks.length === 0) {\r\n delete this._callbacks['$' + event];\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n\r\n var args = new Array(arguments.length - 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n for (var i = 1; i < arguments.length; i++) {\r\n args[i - 1] = arguments[i];\r\n }\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","\nmodule.exports = function(a, b){\n var fn = function(){};\n fn.prototype = b.prototype;\n a.prototype = new fn;\n a.prototype.constructor = a;\n};","/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',\n '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',\n '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',\n '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',\n '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',\n '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',\n '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',\n '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',\n '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',\n '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',\n '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {\n return true;\n }\n\n // Internet Explorer and Edge do not support colors.\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n }\n\n // is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n // double check webkit in userAgent just in case we are in a worker\n (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n try {\n return JSON.stringify(v);\n } catch (err) {\n return '[UnexpectedJSONParseError]: ' + err.message;\n }\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return;\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit')\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n try {\n return window.localStorage;\n } catch (e) {}\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = createDebug.debug = createDebug['default'] = createDebug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * Active `debug` instances.\n */\nexports.instances = [];\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\nexports.formatters = {};\n\n/**\n * Select a color.\n * @param {String} namespace\n * @return {Number}\n * @api private\n */\n\nfunction selectColor(namespace) {\n var hash = 0, i;\n\n for (i in namespace) {\n hash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return exports.colors[Math.abs(hash) % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction createDebug(namespace) {\n\n var prevTime;\n\n function debug() {\n // disabled?\n if (!debug.enabled) return;\n\n var self = debug;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // turn the `arguments` into a proper Array\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %O\n args.unshift('%O');\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n // apply env-specific formatting (colors, etc.)\n exports.formatArgs.call(self, args);\n\n var logFn = debug.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = exports.enabled(namespace);\n debug.useColors = exports.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n\n // env-specific initialization logic for debug instances\n if ('function' === typeof exports.init) {\n exports.init(debug);\n }\n\n exports.instances.push(debug);\n\n return debug;\n}\n\nfunction destroy () {\n var index = exports.instances.indexOf(this);\n if (index !== -1) {\n exports.instances.splice(index, 1);\n return true;\n } else {\n return false;\n }\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n exports.names = [];\n exports.skips = [];\n\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < exports.instances.length; i++) {\n var instance = exports.instances[i];\n instance.enabled = exports.enabled(instance.namespace);\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n","module.exports = (function () {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else {\n return Function('return this')(); // eslint-disable-line no-new-func\n }\n})();\n","\nmodule.exports = require('./socket');\n\n/**\n * Exports parser\n *\n * @api public\n *\n */\nmodule.exports.parser = require('engine.io-parser');\n","/**\n * Module dependencies.\n */\n\nvar transports = require('./transports/index');\nvar Emitter = require('component-emitter');\nvar debug = require('debug')('engine.io-client:socket');\nvar index = require('indexof');\nvar parser = require('engine.io-parser');\nvar parseuri = require('parseuri');\nvar parseqs = require('parseqs');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Socket;\n\n/**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n\nfunction Socket (uri, opts) {\n if (!(this instanceof Socket)) return new Socket(uri, opts);\n\n opts = opts || {};\n\n if (uri && 'object' === typeof uri) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n this.secure = null != opts.secure ? opts.secure\n : (typeof location !== 'undefined' && 'https:' === location.protocol);\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = this.secure ? '443' : '80';\n }\n\n this.agent = opts.agent || false;\n this.hostname = opts.hostname ||\n (typeof location !== 'undefined' ? location.hostname : 'localhost');\n this.port = opts.port || (typeof location !== 'undefined' && location.port\n ? location.port\n : (this.secure ? 443 : 80));\n this.query = opts.query || {};\n if ('string' === typeof this.query) this.query = parseqs.decode(this.query);\n this.upgrade = false !== opts.upgrade;\n this.path = (opts.path || '/engine.io').replace(/\\/$/, '') + '/';\n this.forceJSONP = !!opts.forceJSONP;\n this.jsonp = false !== opts.jsonp;\n this.forceBase64 = !!opts.forceBase64;\n this.enablesXDR = !!opts.enablesXDR;\n this.withCredentials = false !== opts.withCredentials;\n this.timestampParam = opts.timestampParam || 't';\n this.timestampRequests = opts.timestampRequests;\n this.transports = opts.transports || ['polling', 'websocket'];\n this.transportOptions = opts.transportOptions || {};\n this.readyState = '';\n this.writeBuffer = [];\n this.prevBufferLen = 0;\n this.policyPort = opts.policyPort || 843;\n this.rememberUpgrade = opts.rememberUpgrade || false;\n this.binaryType = null;\n this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;\n this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;\n\n if (true === this.perMessageDeflate) this.perMessageDeflate = {};\n if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {\n this.perMessageDeflate.threshold = 1024;\n }\n\n // SSL options for Node.js client\n this.pfx = opts.pfx || null;\n this.key = opts.key || null;\n this.passphrase = opts.passphrase || null;\n this.cert = opts.cert || null;\n this.ca = opts.ca || null;\n this.ciphers = opts.ciphers || null;\n this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;\n this.forceNode = !!opts.forceNode;\n\n // detect ReactNative environment\n this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');\n\n // other options for Node.js or ReactNative client\n if (typeof self === 'undefined' || this.isReactNative) {\n if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {\n this.extraHeaders = opts.extraHeaders;\n }\n\n if (opts.localAddress) {\n this.localAddress = opts.localAddress;\n }\n }\n\n // set on handshake\n this.id = null;\n this.upgrades = null;\n this.pingInterval = null;\n this.pingTimeout = null;\n\n // set on heartbeat\n this.pingIntervalTimer = null;\n this.pingTimeoutTimer = null;\n\n this.open();\n}\n\nSocket.priorWebsocketSuccess = false;\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\nSocket.Socket = Socket;\nSocket.Transport = require('./transport');\nSocket.transports = require('./transports/index');\nSocket.parser = require('engine.io-parser');\n\n/**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n\nSocket.prototype.createTransport = function (name) {\n debug('creating transport \"%s\"', name);\n var query = clone(this.query);\n\n // append engine.io protocol identifier\n query.EIO = parser.protocol;\n\n // transport name\n query.transport = name;\n\n // per-transport options\n var options = this.transportOptions[name] || {};\n\n // session id if we already have one\n if (this.id) query.sid = this.id;\n\n var transport = new transports[name]({\n query: query,\n socket: this,\n agent: options.agent || this.agent,\n hostname: options.hostname || this.hostname,\n port: options.port || this.port,\n secure: options.secure || this.secure,\n path: options.path || this.path,\n forceJSONP: options.forceJSONP || this.forceJSONP,\n jsonp: options.jsonp || this.jsonp,\n forceBase64: options.forceBase64 || this.forceBase64,\n enablesXDR: options.enablesXDR || this.enablesXDR,\n withCredentials: options.withCredentials || this.withCredentials,\n timestampRequests: options.timestampRequests || this.timestampRequests,\n timestampParam: options.timestampParam || this.timestampParam,\n policyPort: options.policyPort || this.policyPort,\n pfx: options.pfx || this.pfx,\n key: options.key || this.key,\n passphrase: options.passphrase || this.passphrase,\n cert: options.cert || this.cert,\n ca: options.ca || this.ca,\n ciphers: options.ciphers || this.ciphers,\n rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,\n perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,\n extraHeaders: options.extraHeaders || this.extraHeaders,\n forceNode: options.forceNode || this.forceNode,\n localAddress: options.localAddress || this.localAddress,\n requestTimeout: options.requestTimeout || this.requestTimeout,\n protocols: options.protocols || void (0),\n isReactNative: this.isReactNative\n });\n\n return transport;\n};\n\nfunction clone (obj) {\n var o = {};\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n return o;\n}\n\n/**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\nSocket.prototype.open = function () {\n var transport;\n if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {\n transport = 'websocket';\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n var self = this;\n setTimeout(function () {\n self.emit('error', 'No transports available');\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n this.readyState = 'opening';\n\n // Retry with the next transport if the transport is disabled (jsonp: false)\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n};\n\n/**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n\nSocket.prototype.setTransport = function (transport) {\n debug('setting transport %s', transport.name);\n var self = this;\n\n if (this.transport) {\n debug('clearing existing transport %s', this.transport.name);\n this.transport.removeAllListeners();\n }\n\n // set up transport\n this.transport = transport;\n\n // set up transport listeners\n transport\n .on('drain', function () {\n self.onDrain();\n })\n .on('packet', function (packet) {\n self.onPacket(packet);\n })\n .on('error', function (e) {\n self.onError(e);\n })\n .on('close', function () {\n self.onClose('transport close');\n });\n};\n\n/**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n\nSocket.prototype.probe = function (name) {\n debug('probing transport \"%s\"', name);\n var transport = this.createTransport(name, { probe: 1 });\n var failed = false;\n var self = this;\n\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen () {\n if (self.onlyBinaryUpgrades) {\n var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n if (failed) return;\n\n debug('probe transport \"%s\" opened', name);\n transport.send([{ type: 'ping', data: 'probe' }]);\n transport.once('packet', function (msg) {\n if (failed) return;\n if ('pong' === msg.type && 'probe' === msg.data) {\n debug('probe transport \"%s\" pong', name);\n self.upgrading = true;\n self.emit('upgrading', transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = 'websocket' === transport.name;\n\n debug('pausing current transport \"%s\"', self.transport.name);\n self.transport.pause(function () {\n if (failed) return;\n if ('closed' === self.readyState) return;\n debug('changing transport and sending upgrade packet');\n\n cleanup();\n\n self.setTransport(transport);\n transport.send([{ type: 'upgrade' }]);\n self.emit('upgrade', transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n debug('probe transport \"%s\" failed', name);\n var err = new Error('probe error');\n err.transport = transport.name;\n self.emit('upgradeError', err);\n }\n });\n }\n\n function freezeTransport () {\n if (failed) return;\n\n // Any callback called by transport should be ignored since now\n failed = true;\n\n cleanup();\n\n transport.close();\n transport = null;\n }\n\n // Handle any error that happens while probing\n function onerror (err) {\n var error = new Error('probe error: ' + err);\n error.transport = transport.name;\n\n freezeTransport();\n\n debug('probe transport \"%s\" failed because of error: %s', name, err);\n\n self.emit('upgradeError', error);\n }\n\n function onTransportClose () {\n onerror('transport closed');\n }\n\n // When the socket is closed while we're probing\n function onclose () {\n onerror('socket closed');\n }\n\n // When the socket is upgraded while we're probing\n function onupgrade (to) {\n if (transport && to.name !== transport.name) {\n debug('\"%s\" works - aborting \"%s\"', to.name, transport.name);\n freezeTransport();\n }\n }\n\n // Remove all listeners on the transport and on self\n function cleanup () {\n transport.removeListener('open', onTransportOpen);\n transport.removeListener('error', onerror);\n transport.removeListener('close', onTransportClose);\n self.removeListener('close', onclose);\n self.removeListener('upgrading', onupgrade);\n }\n\n transport.once('open', onTransportOpen);\n transport.once('error', onerror);\n transport.once('close', onTransportClose);\n\n this.once('close', onclose);\n this.once('upgrading', onupgrade);\n\n transport.open();\n};\n\n/**\n * Called when connection is deemed open.\n *\n * @api public\n */\n\nSocket.prototype.onOpen = function () {\n debug('socket open');\n this.readyState = 'open';\n Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;\n this.emit('open');\n this.flush();\n\n // we check for `readyState` in case an `open`\n // listener already closed the socket\n if ('open' === this.readyState && this.upgrade && this.transport.pause) {\n debug('starting upgrade probes');\n for (var i = 0, l = this.upgrades.length; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n};\n\n/**\n * Handles a packet.\n *\n * @api private\n */\n\nSocket.prototype.onPacket = function (packet) {\n if ('opening' === this.readyState || 'open' === this.readyState ||\n 'closing' === this.readyState) {\n debug('socket receive: type \"%s\", data \"%s\"', packet.type, packet.data);\n\n this.emit('packet', packet);\n\n // Socket is live - any packet counts\n this.emit('heartbeat');\n\n switch (packet.type) {\n case 'open':\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case 'pong':\n this.setPing();\n this.emit('pong');\n break;\n\n case 'error':\n var err = new Error('server error');\n err.code = packet.data;\n this.onError(err);\n break;\n\n case 'message':\n this.emit('data', packet.data);\n this.emit('message', packet.data);\n break;\n }\n } else {\n debug('packet received with socket readyState \"%s\"', this.readyState);\n }\n};\n\n/**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n\nSocket.prototype.onHandshake = function (data) {\n this.emit('handshake', data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen();\n // In case open handler closes socket\n if ('closed' === this.readyState) return;\n this.setPing();\n\n // Prolong liveness of socket on heartbeat\n this.removeListener('heartbeat', this.onHeartbeat);\n this.on('heartbeat', this.onHeartbeat);\n};\n\n/**\n * Resets ping timeout.\n *\n * @api private\n */\n\nSocket.prototype.onHeartbeat = function (timeout) {\n clearTimeout(this.pingTimeoutTimer);\n var self = this;\n self.pingTimeoutTimer = setTimeout(function () {\n if ('closed' === self.readyState) return;\n self.onClose('ping timeout');\n }, timeout || (self.pingInterval + self.pingTimeout));\n};\n\n/**\n * Pings server every `this.pingInterval` and expects response\n * within `this.pingTimeout` or closes connection.\n *\n * @api private\n */\n\nSocket.prototype.setPing = function () {\n var self = this;\n clearTimeout(self.pingIntervalTimer);\n self.pingIntervalTimer = setTimeout(function () {\n debug('writing ping packet - expecting pong within %sms', self.pingTimeout);\n self.ping();\n self.onHeartbeat(self.pingTimeout);\n }, self.pingInterval);\n};\n\n/**\n* Sends a ping packet.\n*\n* @api private\n*/\n\nSocket.prototype.ping = function () {\n var self = this;\n this.sendPacket('ping', function () {\n self.emit('ping');\n });\n};\n\n/**\n * Called on `drain` event\n *\n * @api private\n */\n\nSocket.prototype.onDrain = function () {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit('drain');\n } else {\n this.flush();\n }\n};\n\n/**\n * Flush write buffers.\n *\n * @api private\n */\n\nSocket.prototype.flush = function () {\n if ('closed' !== this.readyState && this.transport.writable &&\n !this.upgrading && this.writeBuffer.length) {\n debug('flushing %d packets in socket', this.writeBuffer.length);\n this.transport.send(this.writeBuffer);\n // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n this.prevBufferLen = this.writeBuffer.length;\n this.emit('flush');\n }\n};\n\n/**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n\nSocket.prototype.write =\nSocket.prototype.send = function (msg, options, fn) {\n this.sendPacket('message', msg, options, fn);\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n\nSocket.prototype.sendPacket = function (type, data, options, fn) {\n if ('function' === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if ('function' === typeof options) {\n fn = options;\n options = null;\n }\n\n if ('closing' === this.readyState || 'closed' === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n\n var packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit('packetCreate', packet);\n this.writeBuffer.push(packet);\n if (fn) this.once('flush', fn);\n this.flush();\n};\n\n/**\n * Closes the connection.\n *\n * @api private\n */\n\nSocket.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.readyState = 'closing';\n\n var self = this;\n\n if (this.writeBuffer.length) {\n this.once('drain', function () {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close () {\n self.onClose('forced close');\n debug('socket closing - telling transport to close');\n self.transport.close();\n }\n\n function cleanupAndClose () {\n self.removeListener('upgrade', cleanupAndClose);\n self.removeListener('upgradeError', cleanupAndClose);\n close();\n }\n\n function waitForUpgrade () {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once('upgrade', cleanupAndClose);\n self.once('upgradeError', cleanupAndClose);\n }\n\n return this;\n};\n\n/**\n * Called upon transport error\n *\n * @api private\n */\n\nSocket.prototype.onError = function (err) {\n debug('socket error %j', err);\n Socket.priorWebsocketSuccess = false;\n this.emit('error', err);\n this.onClose('transport error', err);\n};\n\n/**\n * Called upon transport close.\n *\n * @api private\n */\n\nSocket.prototype.onClose = function (reason, desc) {\n if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {\n debug('socket close with reason: \"%s\"', reason);\n var self = this;\n\n // clear timers\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer);\n\n // stop event from firing again for transport\n this.transport.removeAllListeners('close');\n\n // ensure transport won't stay open\n this.transport.close();\n\n // ignore further transport communication\n this.transport.removeAllListeners();\n\n // set ready state\n this.readyState = 'closed';\n\n // clear session id\n this.id = null;\n\n // emit close event\n this.emit('close', reason, desc);\n\n // clean buffers after, so users can still\n // grab the buffers on `close` event\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n};\n\n/**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n\nSocket.prototype.filterUpgrades = function (upgrades) {\n var filteredUpgrades = [];\n for (var i = 0, j = upgrades.length; i < j; i++) {\n if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);\n }\n return filteredUpgrades;\n};\n","/**\n * Module dependencies.\n */\n\nvar parser = require('engine.io-parser');\nvar Emitter = require('component-emitter');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Transport;\n\n/**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n\nfunction Transport (opts) {\n this.path = opts.path;\n this.hostname = opts.hostname;\n this.port = opts.port;\n this.secure = opts.secure;\n this.query = opts.query;\n this.timestampParam = opts.timestampParam;\n this.timestampRequests = opts.timestampRequests;\n this.readyState = '';\n this.agent = opts.agent || false;\n this.socket = opts.socket;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n this.forceNode = opts.forceNode;\n\n // results of ReactNative environment detection\n this.isReactNative = opts.isReactNative;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n this.localAddress = opts.localAddress;\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Transport.prototype);\n\n/**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n\nTransport.prototype.onError = function (msg, desc) {\n var err = new Error(msg);\n err.type = 'TransportError';\n err.description = desc;\n this.emit('error', err);\n return this;\n};\n\n/**\n * Opens the transport.\n *\n * @api public\n */\n\nTransport.prototype.open = function () {\n if ('closed' === this.readyState || '' === this.readyState) {\n this.readyState = 'opening';\n this.doOpen();\n }\n\n return this;\n};\n\n/**\n * Closes the transport.\n *\n * @api private\n */\n\nTransport.prototype.close = function () {\n if ('opening' === this.readyState || 'open' === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n};\n\n/**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n\nTransport.prototype.send = function (packets) {\n if ('open' === this.readyState) {\n this.write(packets);\n } else {\n throw new Error('Transport not open');\n }\n};\n\n/**\n * Called upon open\n *\n * @api private\n */\n\nTransport.prototype.onOpen = function () {\n this.readyState = 'open';\n this.writable = true;\n this.emit('open');\n};\n\n/**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n\nTransport.prototype.onData = function (data) {\n var packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n};\n\n/**\n * Called with a decoded packet.\n */\n\nTransport.prototype.onPacket = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon close.\n *\n * @api private\n */\n\nTransport.prototype.onClose = function () {\n this.readyState = 'closed';\n this.emit('close');\n};\n","/**\n * Module dependencies\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar XHR = require('./polling-xhr');\nvar JSONP = require('./polling-jsonp');\nvar websocket = require('./websocket');\n\n/**\n * Export transports.\n */\n\nexports.polling = polling;\nexports.websocket = websocket;\n\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling (opts) {\n var xhr;\n var xd = false;\n var xs = false;\n var jsonp = false !== opts.jsonp;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if ('open' in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error('JSONP disabled');\n return new JSONP(opts);\n }\n}\n","/**\n * Module requirements.\n */\n\nvar Polling = require('./polling');\nvar inherit = require('component-inherit');\nvar globalThis = require('../globalThis');\n\n/**\n * Module exports.\n */\n\nmodule.exports = JSONPPolling;\n\n/**\n * Cached regular expressions.\n */\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n\n/**\n * Noop.\n */\n\nfunction empty () { }\n\n/**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n\nfunction JSONPPolling (opts) {\n Polling.call(this, opts);\n\n this.query = this.query || {};\n\n // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n callbacks = globalThis.___eio = (globalThis.___eio || []);\n }\n\n // callback identifier\n this.index = callbacks.length;\n\n // add callback to jsonp global\n var self = this;\n callbacks.push(function (msg) {\n self.onData(msg);\n });\n\n // append to query string\n this.query.j = this.index;\n\n // prevent spurious errors from being emitted when the window is unloaded\n if (typeof addEventListener === 'function') {\n addEventListener('beforeunload', function () {\n if (self.script) self.script.onerror = empty;\n }, false);\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(JSONPPolling, Polling);\n\n/*\n * JSONP only supports binary as base64 encoded strings\n */\n\nJSONPPolling.prototype.supportsBinary = false;\n\n/**\n * Closes the socket.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doClose = function () {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n Polling.prototype.doClose.call(this);\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nJSONPPolling.prototype.doPoll = function () {\n var self = this;\n var script = document.createElement('script');\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n script.onerror = function (e) {\n self.onError('jsonp poll error', e);\n };\n\n var insertAt = document.getElementsByTagName('script')[0];\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n this.script = script;\n\n var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function () {\n var iframe = document.createElement('iframe');\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n};\n\n/**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n\nJSONPPolling.prototype.doWrite = function (data, fn) {\n var self = this;\n\n if (!this.form) {\n var form = document.createElement('form');\n var area = document.createElement('textarea');\n var id = this.iframeId = 'eio_iframe_' + this.index;\n var iframe;\n\n form.className = 'socketio';\n form.style.position = 'absolute';\n form.style.top = '-1000px';\n form.style.left = '-1000px';\n form.target = id;\n form.method = 'POST';\n form.setAttribute('accept-charset', 'utf-8');\n area.name = 'd';\n form.appendChild(area);\n document.body.appendChild(form);\n\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete () {\n initIframe();\n fn();\n }\n\n function initIframe () {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError('jsonp polling iframe removal error', e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n iframe = document.createElement(html);\n } catch (e) {\n iframe = document.createElement('iframe');\n iframe.name = self.iframeId;\n iframe.src = 'javascript:0';\n }\n\n iframe.id = self.iframeId;\n\n self.form.appendChild(iframe);\n self.iframe = iframe;\n }\n\n initIframe();\n\n // escape \\n to prevent it from being converted into \\r\\n by some UAs\n // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n data = data.replace(rEscapedNewline, '\\\\\\n');\n this.area.value = data.replace(rNewline, '\\\\n');\n\n try {\n this.form.submit();\n } catch (e) {}\n\n if (this.iframe.attachEvent) {\n this.iframe.onreadystatechange = function () {\n if (self.iframe.readyState === 'complete') {\n complete();\n }\n };\n } else {\n this.iframe.onload = complete;\n }\n};\n","/* global attachEvent */\n\n/**\n * Module requirements.\n */\n\nvar XMLHttpRequest = require('xmlhttprequest-ssl');\nvar Polling = require('./polling');\nvar Emitter = require('component-emitter');\nvar inherit = require('component-inherit');\nvar debug = require('debug')('engine.io-client:polling-xhr');\nvar globalThis = require('../globalThis');\n\n/**\n * Module exports.\n */\n\nmodule.exports = XHR;\nmodule.exports.Request = Request;\n\n/**\n * Empty function\n */\n\nfunction empty () {}\n\n/**\n * XHR Polling constructor.\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction XHR (opts) {\n Polling.call(this, opts);\n this.requestTimeout = opts.requestTimeout;\n this.extraHeaders = opts.extraHeaders;\n\n if (typeof location !== 'undefined') {\n var isSSL = 'https:' === location.protocol;\n var port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||\n port !== opts.port;\n this.xs = opts.secure !== isSSL;\n }\n}\n\n/**\n * Inherits from Polling.\n */\n\ninherit(XHR, Polling);\n\n/**\n * XHR supports binary\n */\n\nXHR.prototype.supportsBinary = true;\n\n/**\n * Creates a request.\n *\n * @param {String} method\n * @api private\n */\n\nXHR.prototype.request = function (opts) {\n opts = opts || {};\n opts.uri = this.uri();\n opts.xd = this.xd;\n opts.xs = this.xs;\n opts.agent = this.agent || false;\n opts.supportsBinary = this.supportsBinary;\n opts.enablesXDR = this.enablesXDR;\n opts.withCredentials = this.withCredentials;\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n opts.requestTimeout = this.requestTimeout;\n\n // other options for Node.js client\n opts.extraHeaders = this.extraHeaders;\n\n return new Request(opts);\n};\n\n/**\n * Sends data.\n *\n * @param {String} data to send.\n * @param {Function} called upon flush.\n * @api private\n */\n\nXHR.prototype.doWrite = function (data, fn) {\n var isBinary = typeof data !== 'string' && data !== undefined;\n var req = this.request({ method: 'POST', data: data, isBinary: isBinary });\n var self = this;\n req.on('success', fn);\n req.on('error', function (err) {\n self.onError('xhr post error', err);\n });\n this.sendXhr = req;\n};\n\n/**\n * Starts a poll cycle.\n *\n * @api private\n */\n\nXHR.prototype.doPoll = function () {\n debug('xhr poll');\n var req = this.request();\n var self = this;\n req.on('data', function (data) {\n self.onData(data);\n });\n req.on('error', function (err) {\n self.onError('xhr poll error', err);\n });\n this.pollXhr = req;\n};\n\n/**\n * Request constructor\n *\n * @param {Object} options\n * @api public\n */\n\nfunction Request (opts) {\n this.method = opts.method || 'GET';\n this.uri = opts.uri;\n this.xd = !!opts.xd;\n this.xs = !!opts.xs;\n this.async = false !== opts.async;\n this.data = undefined !== opts.data ? opts.data : null;\n this.agent = opts.agent;\n this.isBinary = opts.isBinary;\n this.supportsBinary = opts.supportsBinary;\n this.enablesXDR = opts.enablesXDR;\n this.withCredentials = opts.withCredentials;\n this.requestTimeout = opts.requestTimeout;\n\n // SSL options for Node.js client\n this.pfx = opts.pfx;\n this.key = opts.key;\n this.passphrase = opts.passphrase;\n this.cert = opts.cert;\n this.ca = opts.ca;\n this.ciphers = opts.ciphers;\n this.rejectUnauthorized = opts.rejectUnauthorized;\n\n // other options for Node.js client\n this.extraHeaders = opts.extraHeaders;\n\n this.create();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Request.prototype);\n\n/**\n * Creates the XHR object and sends the request.\n *\n * @api private\n */\n\nRequest.prototype.create = function () {\n var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n\n var xhr = this.xhr = new XMLHttpRequest(opts);\n var self = this;\n\n try {\n debug('xhr open %s: %s', this.method, this.uri);\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (var i in this.extraHeaders) {\n if (this.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if ('POST' === this.method) {\n try {\n if (this.isBinary) {\n xhr.setRequestHeader('Content-type', 'application/octet-stream');\n } else {\n xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');\n }\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader('Accept', '*/*');\n } catch (e) {}\n\n // ie6 check\n if ('withCredentials' in xhr) {\n xhr.withCredentials = this.withCredentials;\n }\n\n if (this.requestTimeout) {\n xhr.timeout = this.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function () {\n self.onLoad();\n };\n xhr.onerror = function () {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 2) {\n try {\n var contentType = xhr.getResponseHeader('Content-Type');\n if (self.supportsBinary && contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n xhr.responseType = 'arraybuffer';\n }\n } catch (e) {}\n }\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function () {\n self.onError(typeof xhr.status === 'number' ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n debug('xhr data %s', this.data);\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly fhrom the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function () {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== 'undefined') {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n};\n\n/**\n * Called upon successful response.\n *\n * @api private\n */\n\nRequest.prototype.onSuccess = function () {\n this.emit('success');\n this.cleanup();\n};\n\n/**\n * Called if we have data.\n *\n * @api private\n */\n\nRequest.prototype.onData = function (data) {\n this.emit('data', data);\n this.onSuccess();\n};\n\n/**\n * Called upon error.\n *\n * @api private\n */\n\nRequest.prototype.onError = function (err) {\n this.emit('error', err);\n this.cleanup(true);\n};\n\n/**\n * Cleans up house.\n *\n * @api private\n */\n\nRequest.prototype.cleanup = function (fromError) {\n if ('undefined' === typeof this.xhr || null === this.xhr) {\n return;\n }\n // xmlhttprequest\n if (this.hasXDR()) {\n this.xhr.onload = this.xhr.onerror = empty;\n } else {\n this.xhr.onreadystatechange = empty;\n }\n\n if (fromError) {\n try {\n this.xhr.abort();\n } catch (e) {}\n }\n\n if (typeof document !== 'undefined') {\n delete Request.requests[this.index];\n }\n\n this.xhr = null;\n};\n\n/**\n * Called upon load.\n *\n * @api private\n */\n\nRequest.prototype.onLoad = function () {\n var data;\n try {\n var contentType;\n try {\n contentType = this.xhr.getResponseHeader('Content-Type');\n } catch (e) {}\n if (contentType === 'application/octet-stream' || contentType === 'application/octet-stream; charset=UTF-8') {\n data = this.xhr.response || this.xhr.responseText;\n } else {\n data = this.xhr.responseText;\n }\n } catch (e) {\n this.onError(e);\n }\n if (null != data) {\n this.onData(data);\n }\n};\n\n/**\n * Check if it has XDomainRequest.\n *\n * @api private\n */\n\nRequest.prototype.hasXDR = function () {\n return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;\n};\n\n/**\n * Aborts the request.\n *\n * @api public\n */\n\nRequest.prototype.abort = function () {\n this.cleanup();\n};\n\n/**\n * Aborts pending requests when unloading the window. This is needed to prevent\n * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n * emitted.\n */\n\nRequest.requestsCount = 0;\nRequest.requests = {};\n\nif (typeof document !== 'undefined') {\n if (typeof attachEvent === 'function') {\n attachEvent('onunload', unloadHandler);\n } else if (typeof addEventListener === 'function') {\n var terminationEvent = 'onpagehide' in globalThis ? 'pagehide' : 'unload';\n addEventListener(terminationEvent, unloadHandler, false);\n }\n}\n\nfunction unloadHandler () {\n for (var i in Request.requests) {\n if (Request.requests.hasOwnProperty(i)) {\n Request.requests[i].abort();\n }\n }\n}\n","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parseqs = require('parseqs');\nvar parser = require('engine.io-parser');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:polling');\n\n/**\n * Module exports.\n */\n\nmodule.exports = Polling;\n\n/**\n * Is XHR2 supported?\n */\n\nvar hasXHR2 = (function () {\n var XMLHttpRequest = require('xmlhttprequest-ssl');\n var xhr = new XMLHttpRequest({ xdomain: false });\n return null != xhr.responseType;\n})();\n\n/**\n * Polling interface.\n *\n * @param {Object} opts\n * @api private\n */\n\nfunction Polling (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (!hasXHR2 || forceBase64) {\n this.supportsBinary = false;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(Polling, Transport);\n\n/**\n * Transport name.\n */\n\nPolling.prototype.name = 'polling';\n\n/**\n * Opens the socket (triggers polling). We write a PING message to determine\n * when the transport is open.\n *\n * @api private\n */\n\nPolling.prototype.doOpen = function () {\n this.poll();\n};\n\n/**\n * Pauses polling.\n *\n * @param {Function} callback upon buffers are flushed and transport is paused\n * @api private\n */\n\nPolling.prototype.pause = function (onPause) {\n var self = this;\n\n this.readyState = 'pausing';\n\n function pause () {\n debug('paused');\n self.readyState = 'paused';\n onPause();\n }\n\n if (this.polling || !this.writable) {\n var total = 0;\n\n if (this.polling) {\n debug('we are currently polling - waiting to pause');\n total++;\n this.once('pollComplete', function () {\n debug('pre-pause polling complete');\n --total || pause();\n });\n }\n\n if (!this.writable) {\n debug('we are currently writing - waiting to pause');\n total++;\n this.once('drain', function () {\n debug('pre-pause writing complete');\n --total || pause();\n });\n }\n } else {\n pause();\n }\n};\n\n/**\n * Starts polling cycle.\n *\n * @api public\n */\n\nPolling.prototype.poll = function () {\n debug('polling');\n this.polling = true;\n this.doPoll();\n this.emit('poll');\n};\n\n/**\n * Overloads onData to detect payloads.\n *\n * @api private\n */\n\nPolling.prototype.onData = function (data) {\n var self = this;\n debug('polling got data %s', data);\n var callback = function (packet, index, total) {\n // if its the first message we consider the transport open\n if ('opening' === self.readyState && packet.type === 'open') {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if ('close' === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType, callback);\n\n // if an event did not trigger closing\n if ('closed' !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit('pollComplete');\n\n if ('open' === this.readyState) {\n this.poll();\n } else {\n debug('ignoring poll - transport state \"%s\"', this.readyState);\n }\n }\n};\n\n/**\n * For polling, send a close packet.\n *\n * @api private\n */\n\nPolling.prototype.doClose = function () {\n var self = this;\n\n function close () {\n debug('writing close packet');\n self.write([{ type: 'close' }]);\n }\n\n if ('open' === this.readyState) {\n debug('transport open - closing');\n close();\n } else {\n // in case we're trying to close while\n // handshaking is in progress (GH-164)\n debug('transport not open - deferring close');\n this.once('open', close);\n }\n};\n\n/**\n * Writes a packets payload.\n *\n * @param {Array} data packets\n * @param {Function} drain callback\n * @api private\n */\n\nPolling.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n var callbackfn = function () {\n self.writable = true;\n self.emit('drain');\n };\n\n parser.encodePayload(packets, this.supportsBinary, function (data) {\n self.doWrite(data, callbackfn);\n });\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nPolling.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'https' : 'http';\n var port = '';\n\n // cache busting is forced\n if (false !== this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n if (!this.supportsBinary && !query.sid) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // avoid port if default for schema\n if (this.port && (('https' === schema && Number(this.port) !== 443) ||\n ('http' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n","/**\n * Module dependencies.\n */\n\nvar Transport = require('../transport');\nvar parser = require('engine.io-parser');\nvar parseqs = require('parseqs');\nvar inherit = require('component-inherit');\nvar yeast = require('yeast');\nvar debug = require('debug')('engine.io-client:websocket');\n\nvar BrowserWebSocket, NodeWebSocket;\n\nif (typeof WebSocket !== 'undefined') {\n BrowserWebSocket = WebSocket;\n} else if (typeof self !== 'undefined') {\n BrowserWebSocket = self.WebSocket || self.MozWebSocket;\n}\n\nif (typeof window === 'undefined') {\n try {\n NodeWebSocket = require('ws');\n } catch (e) { }\n}\n\n/**\n * Get either the `WebSocket` or `MozWebSocket` globals\n * in the browser or try to resolve WebSocket-compatible\n * interface exposed by `ws` for Node-like environment.\n */\n\nvar WebSocketImpl = BrowserWebSocket || NodeWebSocket;\n\n/**\n * Module exports.\n */\n\nmodule.exports = WS;\n\n/**\n * WebSocket transport constructor.\n *\n * @api {Object} connection options\n * @api public\n */\n\nfunction WS (opts) {\n var forceBase64 = (opts && opts.forceBase64);\n if (forceBase64) {\n this.supportsBinary = false;\n }\n this.perMessageDeflate = opts.perMessageDeflate;\n this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;\n this.protocols = opts.protocols;\n if (!this.usingBrowserWebSocket) {\n WebSocketImpl = NodeWebSocket;\n }\n Transport.call(this, opts);\n}\n\n/**\n * Inherits from Transport.\n */\n\ninherit(WS, Transport);\n\n/**\n * Transport name.\n *\n * @api public\n */\n\nWS.prototype.name = 'websocket';\n\n/*\n * WebSockets support binary\n */\n\nWS.prototype.supportsBinary = true;\n\n/**\n * Opens socket.\n *\n * @api private\n */\n\nWS.prototype.doOpen = function () {\n if (!this.check()) {\n // let probe timeout\n return;\n }\n\n var uri = this.uri();\n var protocols = this.protocols;\n\n var opts = {};\n\n if (!this.isReactNative) {\n opts.agent = this.agent;\n opts.perMessageDeflate = this.perMessageDeflate;\n\n // SSL options for Node.js client\n opts.pfx = this.pfx;\n opts.key = this.key;\n opts.passphrase = this.passphrase;\n opts.cert = this.cert;\n opts.ca = this.ca;\n opts.ciphers = this.ciphers;\n opts.rejectUnauthorized = this.rejectUnauthorized;\n }\n\n if (this.extraHeaders) {\n opts.headers = this.extraHeaders;\n }\n if (this.localAddress) {\n opts.localAddress = this.localAddress;\n }\n\n try {\n this.ws =\n this.usingBrowserWebSocket && !this.isReactNative\n ? protocols\n ? new WebSocketImpl(uri, protocols)\n : new WebSocketImpl(uri)\n : new WebSocketImpl(uri, protocols, opts);\n } catch (err) {\n return this.emit('error', err);\n }\n\n if (this.ws.binaryType === undefined) {\n this.supportsBinary = false;\n }\n\n if (this.ws.supports && this.ws.supports.binary) {\n this.supportsBinary = true;\n this.ws.binaryType = 'nodebuffer';\n } else {\n this.ws.binaryType = 'arraybuffer';\n }\n\n this.addEventListeners();\n};\n\n/**\n * Adds event listeners to the socket\n *\n * @api private\n */\n\nWS.prototype.addEventListeners = function () {\n var self = this;\n\n this.ws.onopen = function () {\n self.onOpen();\n };\n this.ws.onclose = function () {\n self.onClose();\n };\n this.ws.onmessage = function (ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function (e) {\n self.onError('websocket error', e);\n };\n};\n\n/**\n * Writes data to socket.\n *\n * @param {Array} array of packets.\n * @api private\n */\n\nWS.prototype.write = function (packets) {\n var self = this;\n this.writable = false;\n\n // encodePacket efficient as it uses WS framing\n // no need for encodePayload\n var total = packets.length;\n for (var i = 0, l = total; i < l; i++) {\n (function (packet) {\n parser.encodePacket(packet, self.supportsBinary, function (data) {\n if (!self.usingBrowserWebSocket) {\n // always create a new object (GH-437)\n var opts = {};\n if (packet.options) {\n opts.compress = packet.options.compress;\n }\n\n if (self.perMessageDeflate) {\n var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;\n if (len < self.perMessageDeflate.threshold) {\n opts.compress = false;\n }\n }\n }\n\n // Sometimes the websocket has already been closed but the browser didn't\n // have a chance of informing us about it yet, in that case send will\n // throw an error\n try {\n if (self.usingBrowserWebSocket) {\n // TypeError is thrown when passing the second argument on Safari\n self.ws.send(data);\n } else {\n self.ws.send(data, opts);\n }\n } catch (e) {\n debug('websocket closed before onclose event');\n }\n\n --total || done();\n });\n })(packets[i]);\n }\n\n function done () {\n self.emit('flush');\n\n // fake drain\n // defer to next tick to allow Socket to clear writeBuffer\n setTimeout(function () {\n self.writable = true;\n self.emit('drain');\n }, 0);\n }\n};\n\n/**\n * Called upon close\n *\n * @api private\n */\n\nWS.prototype.onClose = function () {\n Transport.prototype.onClose.call(this);\n};\n\n/**\n * Closes socket.\n *\n * @api private\n */\n\nWS.prototype.doClose = function () {\n if (typeof this.ws !== 'undefined') {\n this.ws.close();\n }\n};\n\n/**\n * Generates uri for connection.\n *\n * @api private\n */\n\nWS.prototype.uri = function () {\n var query = this.query || {};\n var schema = this.secure ? 'wss' : 'ws';\n var port = '';\n\n // avoid port if default for schema\n if (this.port && (('wss' === schema && Number(this.port) !== 443) ||\n ('ws' === schema && Number(this.port) !== 80))) {\n port = ':' + this.port;\n }\n\n // append timestamp to URI\n if (this.timestampRequests) {\n query[this.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = '?' + query;\n }\n\n var ipv6 = this.hostname.indexOf(':') !== -1;\n return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;\n};\n\n/**\n * Feature detection for WebSocket.\n *\n * @return {Boolean} whether this transport is available.\n * @api public\n */\n\nWS.prototype.check = function () {\n return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name);\n};\n","// browser shim for xmlhttprequest module\n\nvar hasCORS = require('has-cors');\nvar globalThis = require('./globalThis');\n\nmodule.exports = function (opts) {\n var xdomain = opts.xdomain;\n\n // scheme must be same when usign XDomainRequest\n // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n var xscheme = opts.xscheme;\n\n // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n // https://github.com/Automattic/engine.io-client/pull/217\n var enablesXDR = opts.enablesXDR;\n\n // XMLHttpRequest can be disabled on IE\n try {\n if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n return new XMLHttpRequest();\n }\n } catch (e) { }\n\n // Use XDomainRequest for IE8 if enablesXDR is true\n // because loading bar keeps flashing when using jsonp-polling\n // https://github.com/yujiosaka/socke.io-ie8-loading-example\n try {\n if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {\n return new XDomainRequest();\n }\n } catch (e) { }\n\n if (!xdomain) {\n try {\n return new globalThis[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');\n } catch (e) { }\n }\n};\n","/**\n * Module dependencies.\n */\n\nvar keys = require('./keys');\nvar hasBinary = require('has-binary2');\nvar sliceBuffer = require('arraybuffer.slice');\nvar after = require('after');\nvar utf8 = require('./utf8');\n\nvar base64encoder;\nif (typeof ArrayBuffer !== 'undefined') {\n base64encoder = require('base64-arraybuffer');\n}\n\n/**\n * Check if we are running an android browser. That requires us to use\n * ArrayBuffer with polling transports...\n *\n * http://ghinda.net/jpeg-blob-ajax-android/\n */\n\nvar isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\n\n/**\n * Check if we are running in PhantomJS.\n * Uploading a Blob with PhantomJS does not work correctly, as reported here:\n * https://github.com/ariya/phantomjs/issues/11395\n * @type boolean\n */\nvar isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);\n\n/**\n * When true, avoids using Blobs to encode payloads.\n * @type boolean\n */\nvar dontSendBlobs = isAndroid || isPhantomJS;\n\n/**\n * Current protocol version.\n */\n\nexports.protocol = 3;\n\n/**\n * Packet types.\n */\n\nvar packets = exports.packets = {\n open: 0 // non-ws\n , close: 1 // non-ws\n , ping: 2\n , pong: 3\n , message: 4\n , upgrade: 5\n , noop: 6\n};\n\nvar packetslist = keys(packets);\n\n/**\n * Premade error packet.\n */\n\nvar err = { type: 'error', data: 'parser error' };\n\n/**\n * Create a blob api even for blob builder when vendor prefixes exist\n */\n\nvar Blob = require('blob');\n\n/**\n * Encodes a packet.\n *\n * <packet type id> [ <data> ]\n *\n * Example:\n *\n * 5hello world\n * 3\n * 4\n *\n * Binary is encoded in an identical principle\n *\n * @api private\n */\n\nexports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = false;\n }\n\n if (typeof utf8encode === 'function') {\n callback = utf8encode;\n utf8encode = null;\n }\n\n var data = (packet.data === undefined)\n ? undefined\n : packet.data.buffer || packet.data;\n\n if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {\n return encodeArrayBuffer(packet, supportsBinary, callback);\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n return encodeBlob(packet, supportsBinary, callback);\n }\n\n // might be an object with { base64: true, data: dataAsBase64String }\n if (data && data.base64) {\n return encodeBase64Object(packet, callback);\n }\n\n // Sending data as a utf-8 string\n var encoded = packets[packet.type];\n\n // data fragment is optional\n if (undefined !== packet.data) {\n encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);\n }\n\n return callback('' + encoded);\n\n};\n\nfunction encodeBase64Object(packet, callback) {\n // packet data is an object { base64: true, data: dataAsBase64String }\n var message = 'b' + exports.packets[packet.type] + packet.data.data;\n return callback(message);\n}\n\n/**\n * Encode packet helpers for binary types\n */\n\nfunction encodeArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var data = packet.data;\n var contentArray = new Uint8Array(data);\n var resultBuffer = new Uint8Array(1 + data.byteLength);\n\n resultBuffer[0] = packets[packet.type];\n for (var i = 0; i < contentArray.length; i++) {\n resultBuffer[i+1] = contentArray[i];\n }\n\n return callback(resultBuffer.buffer);\n}\n\nfunction encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n var fr = new FileReader();\n fr.onload = function() {\n exports.encodePacket({ type: packet.type, data: fr.result }, supportsBinary, true, callback);\n };\n return fr.readAsArrayBuffer(packet.data);\n}\n\nfunction encodeBlob(packet, supportsBinary, callback) {\n if (!supportsBinary) {\n return exports.encodeBase64Packet(packet, callback);\n }\n\n if (dontSendBlobs) {\n return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);\n }\n\n var length = new Uint8Array(1);\n length[0] = packets[packet.type];\n var blob = new Blob([length.buffer, packet.data]);\n\n return callback(blob);\n}\n\n/**\n * Encodes a packet with binary data in a base64 string\n *\n * @param {Object} packet, has `type` and `data`\n * @return {String} base64 encoded message\n */\n\nexports.encodeBase64Packet = function(packet, callback) {\n var message = 'b' + exports.packets[packet.type];\n if (typeof Blob !== 'undefined' && packet.data instanceof Blob) {\n var fr = new FileReader();\n fr.onload = function() {\n var b64 = fr.result.split(',')[1];\n callback(message + b64);\n };\n return fr.readAsDataURL(packet.data);\n }\n\n var b64data;\n try {\n b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));\n } catch (e) {\n // iPhone Safari doesn't let you apply with typed arrays\n var typed = new Uint8Array(packet.data);\n var basic = new Array(typed.length);\n for (var i = 0; i < typed.length; i++) {\n basic[i] = typed[i];\n }\n b64data = String.fromCharCode.apply(null, basic);\n }\n message += btoa(b64data);\n return callback(message);\n};\n\n/**\n * Decodes a packet. Changes format to Blob if requested.\n *\n * @return {Object} with `type` and `data` (if any)\n * @api private\n */\n\nexports.decodePacket = function (data, binaryType, utf8decode) {\n if (data === undefined) {\n return err;\n }\n // String data\n if (typeof data === 'string') {\n if (data.charAt(0) === 'b') {\n return exports.decodeBase64Packet(data.substr(1), binaryType);\n }\n\n if (utf8decode) {\n data = tryDecode(data);\n if (data === false) {\n return err;\n }\n }\n var type = data.charAt(0);\n\n if (Number(type) != type || !packetslist[type]) {\n return err;\n }\n\n if (data.length > 1) {\n return { type: packetslist[type], data: data.substring(1) };\n } else {\n return { type: packetslist[type] };\n }\n }\n\n var asArray = new Uint8Array(data);\n var type = asArray[0];\n var rest = sliceBuffer(data, 1);\n if (Blob && binaryType === 'blob') {\n rest = new Blob([rest]);\n }\n return { type: packetslist[type], data: rest };\n};\n\nfunction tryDecode(data) {\n try {\n data = utf8.decode(data, { strict: false });\n } catch (e) {\n return false;\n }\n return data;\n}\n\n/**\n * Decodes a packet encoded in a base64 string\n *\n * @param {String} base64 encoded message\n * @return {Object} with `type` and `data` (if any)\n */\n\nexports.decodeBase64Packet = function(msg, binaryType) {\n var type = packetslist[msg.charAt(0)];\n if (!base64encoder) {\n return { type: type, data: { base64: true, data: msg.substr(1) } };\n }\n\n var data = base64encoder.decode(msg.substr(1));\n\n if (binaryType === 'blob' && Blob) {\n data = new Blob([data]);\n }\n\n return { type: type, data: data };\n};\n\n/**\n * Encodes multiple messages (payload).\n *\n * <length>:data\n *\n * Example:\n *\n * 11:hello world2:hi\n *\n * If any contents are binary, they will be encoded as base64 strings. Base64\n * encoded strings are marked with a b before the length specifier\n *\n * @param {Array} packets\n * @api private\n */\n\nexports.encodePayload = function (packets, supportsBinary, callback) {\n if (typeof supportsBinary === 'function') {\n callback = supportsBinary;\n supportsBinary = null;\n }\n\n var isBinary = hasBinary(packets);\n\n if (supportsBinary && isBinary) {\n if (Blob && !dontSendBlobs) {\n return exports.encodePayloadAsBlob(packets, callback);\n }\n\n return exports.encodePayloadAsArrayBuffer(packets, callback);\n }\n\n if (!packets.length) {\n return callback('0:');\n }\n\n function setLengthHeader(message) {\n return message.length + ':' + message;\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {\n doneCallback(null, setLengthHeader(message));\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(results.join(''));\n });\n};\n\n/**\n * Async array map using after\n */\n\nfunction map(ary, each, done) {\n var result = new Array(ary.length);\n var next = after(ary.length, done);\n\n var eachWithIndex = function(i, el, cb) {\n each(el, function(error, msg) {\n result[i] = msg;\n cb(error, result);\n });\n };\n\n for (var i = 0; i < ary.length; i++) {\n eachWithIndex(i, ary[i], next);\n }\n}\n\n/*\n * Decodes data when a payload is maybe expected. Possible binary contents are\n * decoded from their base64 representation\n *\n * @param {String} data, callback method\n * @api public\n */\n\nexports.decodePayload = function (data, binaryType, callback) {\n if (typeof data !== 'string') {\n return exports.decodePayloadAsBinary(data, binaryType, callback);\n }\n\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var packet;\n if (data === '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n var length = '', n, msg;\n\n for (var i = 0, l = data.length; i < l; i++) {\n var chr = data.charAt(i);\n\n if (chr !== ':') {\n length += chr;\n continue;\n }\n\n if (length === '' || (length != (n = Number(length)))) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n msg = data.substr(i + 1, n);\n\n if (length != msg.length) {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n if (msg.length) {\n packet = exports.decodePacket(msg, binaryType, false);\n\n if (err.type === packet.type && err.data === packet.data) {\n // parser error in individual packet - ignoring payload\n return callback(err, 0, 1);\n }\n\n var ret = callback(packet, i + n, l);\n if (false === ret) return;\n }\n\n // advance cursor\n i += n;\n length = '';\n }\n\n if (length !== '') {\n // parser error - ignoring payload\n return callback(err, 0, 1);\n }\n\n};\n\n/**\n * Encodes multiple messages (payload) as binary.\n *\n * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number\n * 255><data>\n *\n * Example:\n * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers\n *\n * @param {Array} packets\n * @return {ArrayBuffer} encoded payload\n * @api private\n */\n\nexports.encodePayloadAsArrayBuffer = function(packets, callback) {\n if (!packets.length) {\n return callback(new ArrayBuffer(0));\n }\n\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(data) {\n return doneCallback(null, data);\n });\n }\n\n map(packets, encodeOne, function(err, encodedPackets) {\n var totalLength = encodedPackets.reduce(function(acc, p) {\n var len;\n if (typeof p === 'string'){\n len = p.length;\n } else {\n len = p.byteLength;\n }\n return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2\n }, 0);\n\n var resultArray = new Uint8Array(totalLength);\n\n var bufferIndex = 0;\n encodedPackets.forEach(function(p) {\n var isString = typeof p === 'string';\n var ab = p;\n if (isString) {\n var view = new Uint8Array(p.length);\n for (var i = 0; i < p.length; i++) {\n view[i] = p.charCodeAt(i);\n }\n ab = view.buffer;\n }\n\n if (isString) { // not true binary\n resultArray[bufferIndex++] = 0;\n } else { // true binary\n resultArray[bufferIndex++] = 1;\n }\n\n var lenStr = ab.byteLength.toString();\n for (var i = 0; i < lenStr.length; i++) {\n resultArray[bufferIndex++] = parseInt(lenStr[i]);\n }\n resultArray[bufferIndex++] = 255;\n\n var view = new Uint8Array(ab);\n for (var i = 0; i < view.length; i++) {\n resultArray[bufferIndex++] = view[i];\n }\n });\n\n return callback(resultArray.buffer);\n });\n};\n\n/**\n * Encode as Blob\n */\n\nexports.encodePayloadAsBlob = function(packets, callback) {\n function encodeOne(packet, doneCallback) {\n exports.encodePacket(packet, true, true, function(encoded) {\n var binaryIdentifier = new Uint8Array(1);\n binaryIdentifier[0] = 1;\n if (typeof encoded === 'string') {\n var view = new Uint8Array(encoded.length);\n for (var i = 0; i < encoded.length; i++) {\n view[i] = encoded.charCodeAt(i);\n }\n encoded = view.buffer;\n binaryIdentifier[0] = 0;\n }\n\n var len = (encoded instanceof ArrayBuffer)\n ? encoded.byteLength\n : encoded.size;\n\n var lenStr = len.toString();\n var lengthAry = new Uint8Array(lenStr.length + 1);\n for (var i = 0; i < lenStr.length; i++) {\n lengthAry[i] = parseInt(lenStr[i]);\n }\n lengthAry[lenStr.length] = 255;\n\n if (Blob) {\n var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);\n doneCallback(null, blob);\n }\n });\n }\n\n map(packets, encodeOne, function(err, results) {\n return callback(new Blob(results));\n });\n};\n\n/*\n * Decodes data when a payload is maybe expected. Strings are decoded by\n * interpreting each byte as a key code for entries marked to start with 0. See\n * description of encodePayloadAsBinary\n *\n * @param {ArrayBuffer} data, callback method\n * @api public\n */\n\nexports.decodePayloadAsBinary = function (data, binaryType, callback) {\n if (typeof binaryType === 'function') {\n callback = binaryType;\n binaryType = null;\n }\n\n var bufferTail = data;\n var buffers = [];\n\n while (bufferTail.byteLength > 0) {\n var tailArray = new Uint8Array(bufferTail);\n var isString = tailArray[0] === 0;\n var msgLength = '';\n\n for (var i = 1; ; i++) {\n if (tailArray[i] === 255) break;\n\n // 310 = char length of Number.MAX_VALUE\n if (msgLength.length > 310) {\n return callback(err, 0, 1);\n }\n\n msgLength += tailArray[i];\n }\n\n bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);\n msgLength = parseInt(msgLength);\n\n var msg = sliceBuffer(bufferTail, 0, msgLength);\n if (isString) {\n try {\n msg = String.fromCharCode.apply(null, new Uint8Array(msg));\n } catch (e) {\n // iPhone Safari doesn't let you apply to typed arrays\n var typed = new Uint8Array(msg);\n msg = '';\n for (var i = 0; i < typed.length; i++) {\n msg += String.fromCharCode(typed[i]);\n }\n }\n }\n\n buffers.push(msg);\n bufferTail = sliceBuffer(bufferTail, msgLength);\n }\n\n var total = buffers.length;\n buffers.forEach(function(buffer, i) {\n callback(exports.decodePacket(buffer, binaryType, true), i, total);\n });\n};\n","\n/**\n * Gets the keys for an object.\n *\n * @return {Array} keys\n * @api private\n */\n\nmodule.exports = Object.keys || function keys (obj){\n var arr = [];\n var has = Object.prototype.hasOwnProperty;\n\n for (var i in obj) {\n if (has.call(obj, i)) {\n arr.push(i);\n }\n }\n return arr;\n};\n","/*! https://mths.be/utf8js v2.1.2 by @mathias */\n\nvar stringFromCharCode = String.fromCharCode;\n\n// Taken from https://mths.be/punycode\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\tvar value;\n\tvar extra;\n\twhile (counter < length) {\n\t\tvalue = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// high surrogate, and there is a next character\n\t\t\textra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n// Taken from https://mths.be/punycode\nfunction ucs2encode(array) {\n\tvar length = array.length;\n\tvar index = -1;\n\tvar value;\n\tvar output = '';\n\twhile (++index < length) {\n\t\tvalue = array[index];\n\t\tif (value > 0xFFFF) {\n\t\t\tvalue -= 0x10000;\n\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t}\n\t\toutput += stringFromCharCode(value);\n\t}\n\treturn output;\n}\n\nfunction checkScalarValue(codePoint, strict) {\n\tif (codePoint >= 0xD800 && codePoint <= 0xDFFF) {\n\t\tif (strict) {\n\t\t\tthrow Error(\n\t\t\t\t'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +\n\t\t\t\t' is not a scalar value'\n\t\t\t);\n\t\t}\n\t\treturn false;\n\t}\n\treturn true;\n}\n/*--------------------------------------------------------------------------*/\n\nfunction createByte(codePoint, shift) {\n\treturn stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);\n}\n\nfunction encodeCodePoint(codePoint, strict) {\n\tif ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence\n\t\treturn stringFromCharCode(codePoint);\n\t}\n\tvar symbol = '';\n\tif ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);\n\t}\n\telse if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence\n\t\tif (!checkScalarValue(codePoint, strict)) {\n\t\t\tcodePoint = 0xFFFD;\n\t\t}\n\t\tsymbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\telse if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence\n\t\tsymbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);\n\t\tsymbol += createByte(codePoint, 12);\n\t\tsymbol += createByte(codePoint, 6);\n\t}\n\tsymbol += stringFromCharCode((codePoint & 0x3F) | 0x80);\n\treturn symbol;\n}\n\nfunction utf8encode(string, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tvar codePoints = ucs2decode(string);\n\tvar length = codePoints.length;\n\tvar index = -1;\n\tvar codePoint;\n\tvar byteString = '';\n\twhile (++index < length) {\n\t\tcodePoint = codePoints[index];\n\t\tbyteString += encodeCodePoint(codePoint, strict);\n\t}\n\treturn byteString;\n}\n\n/*--------------------------------------------------------------------------*/\n\nfunction readContinuationByte() {\n\tif (byteIndex >= byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tvar continuationByte = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\tif ((continuationByte & 0xC0) == 0x80) {\n\t\treturn continuationByte & 0x3F;\n\t}\n\n\t// If we end up here, its not a continuation byte\n\tthrow Error('Invalid continuation byte');\n}\n\nfunction decodeSymbol(strict) {\n\tvar byte1;\n\tvar byte2;\n\tvar byte3;\n\tvar byte4;\n\tvar codePoint;\n\n\tif (byteIndex > byteCount) {\n\t\tthrow Error('Invalid byte index');\n\t}\n\n\tif (byteIndex == byteCount) {\n\t\treturn false;\n\t}\n\n\t// Read first byte\n\tbyte1 = byteArray[byteIndex] & 0xFF;\n\tbyteIndex++;\n\n\t// 1-byte sequence (no continuation bytes)\n\tif ((byte1 & 0x80) == 0) {\n\t\treturn byte1;\n\t}\n\n\t// 2-byte sequence\n\tif ((byte1 & 0xE0) == 0xC0) {\n\t\tbyte2 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x1F) << 6) | byte2;\n\t\tif (codePoint >= 0x80) {\n\t\t\treturn codePoint;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 3-byte sequence (may include unpaired surrogates)\n\tif ((byte1 & 0xF0) == 0xE0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;\n\t\tif (codePoint >= 0x0800) {\n\t\t\treturn checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;\n\t\t} else {\n\t\t\tthrow Error('Invalid continuation byte');\n\t\t}\n\t}\n\n\t// 4-byte sequence\n\tif ((byte1 & 0xF8) == 0xF0) {\n\t\tbyte2 = readContinuationByte();\n\t\tbyte3 = readContinuationByte();\n\t\tbyte4 = readContinuationByte();\n\t\tcodePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |\n\t\t\t(byte3 << 0x06) | byte4;\n\t\tif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {\n\t\t\treturn codePoint;\n\t\t}\n\t}\n\n\tthrow Error('Invalid UTF-8 detected');\n}\n\nvar byteArray;\nvar byteCount;\nvar byteIndex;\nfunction utf8decode(byteString, opts) {\n\topts = opts || {};\n\tvar strict = false !== opts.strict;\n\n\tbyteArray = ucs2decode(byteString);\n\tbyteCount = byteArray.length;\n\tbyteIndex = 0;\n\tvar codePoints = [];\n\tvar tmp;\n\twhile ((tmp = decodeSymbol(strict)) !== false) {\n\t\tcodePoints.push(tmp);\n\t}\n\treturn ucs2encode(codePoints);\n}\n\nmodule.exports = {\n\tversion: '2.1.2',\n\tencode: utf8encode,\n\tdecode: utf8decode\n};\n","/* global Blob File */\n\n/*\n * Module requirements.\n */\n\nvar isArray = require('isarray');\n\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' ||\n typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';\nvar withNativeFile = typeof File === 'function' ||\n typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';\n\n/**\n * Module exports.\n */\n\nmodule.exports = hasBinary;\n\n/**\n * Checks for binary data.\n *\n * Supports Buffer, ArrayBuffer, Blob and File.\n *\n * @param {Object} anything\n * @api public\n */\n\nfunction hasBinary (obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n if (isArray(obj)) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (hasBinary(obj[i])) {\n return true;\n }\n }\n return false;\n }\n\n if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||\n (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||\n (withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)\n ) {\n return true;\n }\n\n // see: https://github.com/Automattic/has-binary/pull/4\n if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {\n return hasBinary(obj.toJSON(), true);\n }\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n return true;\n }\n }\n\n return false;\n}\n","\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n","\nvar indexOf = [].indexOf;\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n};","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isNaN(val) === false) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n if (ms >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (ms >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (ms >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (ms >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n return plural(ms, d, 'day') ||\n plural(ms, h, 'hour') ||\n plural(ms, m, 'minute') ||\n plural(ms, s, 'second') ||\n ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) {\n return;\n }\n if (ms < n * 1.5) {\n return Math.floor(ms / n) + ' ' + name;\n }\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n","(function (root, factory){\n 'use strict';\n\n /*istanbul ignore next:cant test*/\n if (typeof module === 'object' && typeof module.exports === 'object') {\n module.exports = factory();\n } else if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else {\n // Browser globals\n root.objectPath = factory();\n }\n})(this, function(){\n 'use strict';\n\n var toStr = Object.prototype.toString;\n function hasOwnProperty(obj, prop) {\n if(obj == null) {\n return false\n }\n //to handle objects with null prototypes (too edge case?)\n return Object.prototype.hasOwnProperty.call(obj, prop)\n }\n\n function isEmpty(value){\n if (!value) {\n return true;\n }\n if (isArray(value) && value.length === 0) {\n return true;\n } else if (typeof value !== 'string') {\n for (var i in value) {\n if (hasOwnProperty(value, i)) {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n function toString(type){\n return toStr.call(type);\n }\n\n function isObject(obj){\n return typeof obj === 'object' && toString(obj) === \"[object Object]\";\n }\n\n var isArray = Array.isArray || function(obj){\n /*istanbul ignore next:cant test*/\n return toStr.call(obj) === '[object Array]';\n }\n\n function isBoolean(obj){\n return typeof obj === 'boolean' || toString(obj) === '[object Boolean]';\n }\n\n function getKey(key){\n var intKey = parseInt(key);\n if (intKey.toString() === key) {\n return intKey;\n }\n return key;\n }\n\n function factory(options) {\n options = options || {}\n\n var objectPath = function(obj) {\n return Object.keys(objectPath).reduce(function(proxy, prop) {\n if(prop === 'create') {\n return proxy;\n }\n\n /*istanbul ignore else*/\n if (typeof objectPath[prop] === 'function') {\n proxy[prop] = objectPath[prop].bind(objectPath, obj);\n }\n\n return proxy;\n }, {});\n };\n\n var hasShallowProperty\n if (options.includeInheritedProps) {\n hasShallowProperty = function () {\n return true\n }\n } else {\n hasShallowProperty = function (obj, prop) {\n return (typeof prop === 'number' && Array.isArray(obj)) || hasOwnProperty(obj, prop)\n }\n }\n\n function getShallowProperty(obj, prop) {\n if (hasShallowProperty(obj, prop)) {\n return obj[prop];\n }\n }\n\n function set(obj, path, value, doNotReplace){\n if (typeof path === 'number') {\n path = [path];\n }\n if (!path || path.length === 0) {\n return obj;\n }\n if (typeof path === 'string') {\n return set(obj, path.split('.').map(getKey), value, doNotReplace);\n }\n var currentPath = path[0];\n var currentValue = getShallowProperty(obj, currentPath);\n if (options.includeInheritedProps && (currentPath === '__proto__' ||\n (currentPath === 'constructor' && typeof currentValue === 'function'))) {\n throw new Error('For security reasons, object\\'s magic properties cannot be set')\n }\n if (path.length === 1) {\n if (currentValue === void 0 || !doNotReplace) {\n obj[currentPath] = value;\n }\n return currentValue;\n }\n\n if (currentValue === void 0) {\n //check if we assume an array\n if(typeof path[1] === 'number') {\n obj[currentPath] = [];\n } else {\n obj[currentPath] = {};\n }\n }\n\n return set(obj[currentPath], path.slice(1), value, doNotReplace);\n }\n\n objectPath.has = function (obj, path) {\n if (typeof path === 'number') {\n path = [path];\n } else if (typeof path === 'string') {\n path = path.split('.');\n }\n\n if (!path || path.length === 0) {\n return !!obj;\n }\n\n for (var i = 0; i < path.length; i++) {\n var j = getKey(path[i]);\n\n if((typeof j === 'number' && isArray(obj) && j < obj.length) ||\n (options.includeInheritedProps ? (j in Object(obj)) : hasOwnProperty(obj, j))) {\n obj = obj[j];\n } else {\n return false;\n }\n }\n\n return true;\n };\n\n objectPath.ensureExists = function (obj, path, value){\n return set(obj, path, value, true);\n };\n\n objectPath.set = function (obj, path, value, doNotReplace){\n return set(obj, path, value, doNotReplace);\n };\n\n objectPath.insert = function (obj, path, value, at){\n var arr = objectPath.get(obj, path);\n at = ~~at;\n if (!isArray(arr)) {\n arr = [];\n objectPath.set(obj, path, arr);\n }\n arr.splice(at, 0, value);\n };\n\n objectPath.empty = function(obj, path) {\n if (isEmpty(path)) {\n return void 0;\n }\n if (obj == null) {\n return void 0;\n }\n\n var value, i;\n if (!(value = objectPath.get(obj, path))) {\n return void 0;\n }\n\n if (typeof value === 'string') {\n return objectPath.set(obj, path, '');\n } else if (isBoolean(value)) {\n return objectPath.set(obj, path, false);\n } else if (typeof value === 'number') {\n return objectPath.set(obj, path, 0);\n } else if (isArray(value)) {\n value.length = 0;\n } else if (isObject(value)) {\n for (i in value) {\n if (hasShallowProperty(value, i)) {\n delete value[i];\n }\n }\n } else {\n return objectPath.set(obj, path, null);\n }\n };\n\n objectPath.push = function (obj, path /*, values */){\n var arr = objectPath.get(obj, path);\n if (!isArray(arr)) {\n arr = [];\n objectPath.set(obj, path, arr);\n }\n\n arr.push.apply(arr, Array.prototype.slice.call(arguments, 2));\n };\n\n objectPath.coalesce = function (obj, paths, defaultValue) {\n var value;\n\n for (var i = 0, len = paths.length; i < len; i++) {\n if ((value = objectPath.get(obj, paths[i])) !== void 0) {\n return value;\n }\n }\n\n return defaultValue;\n };\n\n objectPath.get = function (obj, path, defaultValue){\n if (typeof path === 'number') {\n path = [path];\n }\n if (!path || path.length === 0) {\n return obj;\n }\n if (obj == null) {\n return defaultValue;\n }\n if (typeof path === 'string') {\n return objectPath.get(obj, path.split('.'), defaultValue);\n }\n\n var currentPath = getKey(path[0]);\n var nextObj = getShallowProperty(obj, currentPath)\n if (nextObj === void 0) {\n return defaultValue;\n }\n\n if (path.length === 1) {\n return nextObj;\n }\n\n return objectPath.get(obj[currentPath], path.slice(1), defaultValue);\n };\n\n objectPath.del = function del(obj, path) {\n if (typeof path === 'number') {\n path = [path];\n }\n\n if (obj == null) {\n return obj;\n }\n\n if (isEmpty(path)) {\n return obj;\n }\n if(typeof path === 'string') {\n return objectPath.del(obj, path.split('.'));\n }\n\n var currentPath = getKey(path[0]);\n if (!hasShallowProperty(obj, currentPath)) {\n return obj;\n }\n\n if(path.length === 1) {\n if (isArray(obj)) {\n obj.splice(currentPath, 1);\n } else {\n delete obj[currentPath];\n }\n } else {\n return objectPath.del(obj[currentPath], path.slice(1));\n }\n\n return obj;\n }\n\n return objectPath;\n }\n\n var mod = factory();\n mod.create = factory;\n mod.withInheritedProps = factory({includeInheritedProps: true})\n return mod;\n});\n","/**\n * Compiles a querystring\n * Returns string representation of the object\n *\n * @param {Object}\n * @api private\n */\n\nexports.encode = function (obj) {\n var str = '';\n\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n if (str.length) str += '&';\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\n }\n }\n\n return str;\n};\n\n/**\n * Parses a simple querystring into an object\n *\n * @param {String} qs\n * @api private\n */\n\nexports.decode = function(qs){\n var qry = {};\n var pairs = qs.split('&');\n for (var i = 0, l = pairs.length; i < l; i++) {\n var pair = pairs[i].split('=');\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n return qry;\n};\n","/**\n * Parses an URI\n *\n * @author Steven Levithan <stevenlevithan.com> (MIT license)\n * @api private\n */\n\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\n\nvar parts = [\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\n];\n\nmodule.exports = function parseuri(str) {\n var src = str,\n b = str.indexOf('['),\n e = str.indexOf(']');\n\n if (b != -1 && e != -1) {\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\n }\n\n var m = re.exec(str || ''),\n uri = {},\n i = 14;\n\n while (i--) {\n uri[parts[i]] = m[i] || '';\n }\n\n if (b != -1 && e != -1) {\n uri.source = src;\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\n uri.ipv6uri = true;\n }\n\n uri.pathNames = pathNames(uri, uri['path']);\n uri.queryKey = queryKey(uri, uri['query']);\n\n return uri;\n};\n\nfunction pathNames(obj, path) {\n var regx = /\\/{2,9}/g,\n names = path.replace(regx, \"/\").split(\"/\");\n\n if (path.substr(0, 1) == '/' || path.length === 0) {\n names.splice(0, 1);\n }\n if (path.substr(path.length - 1, 1) == '/') {\n names.splice(names.length - 1, 1);\n }\n\n return names;\n}\n\nfunction queryKey(uri, query) {\n var data = {};\n\n query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {\n if ($1) {\n data[$1] = $2;\n }\n });\n\n return data;\n}\n","\n/**\n * Module dependencies.\n */\n\nvar url = require('./url');\nvar parser = require('socket.io-parser');\nvar Manager = require('./manager');\nvar debug = require('debug')('socket.io-client');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = lookup;\n\n/**\n * Managers cache.\n */\n\nvar cache = exports.managers = {};\n\n/**\n * Looks up an existing `Manager` for multiplexing.\n * If the user summons:\n *\n * `io('http://localhost/a');`\n * `io('http://localhost/b');`\n *\n * We reuse the existing instance based on same scheme/port/host,\n * and we initialize sockets for each namespace.\n *\n * @api public\n */\n\nfunction lookup (uri, opts) {\n if (typeof uri === 'object') {\n opts = uri;\n uri = undefined;\n }\n\n opts = opts || {};\n\n var parsed = url(uri);\n var source = parsed.source;\n var id = parsed.id;\n var path = parsed.path;\n var sameNamespace = cache[id] && path in cache[id].nsps;\n var newConnection = opts.forceNew || opts['force new connection'] ||\n false === opts.multiplex || sameNamespace;\n\n var io;\n\n if (newConnection) {\n debug('ignoring socket cache for %s', source);\n io = Manager(source, opts);\n } else {\n if (!cache[id]) {\n debug('new io instance for %s', source);\n cache[id] = Manager(source, opts);\n }\n io = cache[id];\n }\n if (parsed.query && !opts.query) {\n opts.query = parsed.query;\n }\n return io.socket(parsed.path, opts);\n}\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = parser.protocol;\n\n/**\n * `connect`.\n *\n * @param {String} uri\n * @api public\n */\n\nexports.connect = lookup;\n\n/**\n * Expose constructors for standalone build.\n *\n * @api public\n */\n\nexports.Manager = require('./manager');\nexports.Socket = require('./socket');\n","\n/**\n * Module dependencies.\n */\n\nvar eio = require('engine.io-client');\nvar Socket = require('./socket');\nvar Emitter = require('component-emitter');\nvar parser = require('socket.io-parser');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:manager');\nvar indexOf = require('indexof');\nvar Backoff = require('backo2');\n\n/**\n * IE6+ hasOwnProperty\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Module exports\n */\n\nmodule.exports = Manager;\n\n/**\n * `Manager` constructor.\n *\n * @param {String} engine instance or engine uri/opts\n * @param {Object} options\n * @api public\n */\n\nfunction Manager (uri, opts) {\n if (!(this instanceof Manager)) return new Manager(uri, opts);\n if (uri && ('object' === typeof uri)) {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n\n opts.path = opts.path || '/socket.io';\n this.nsps = {};\n this.subs = [];\n this.opts = opts;\n this.reconnection(opts.reconnection !== false);\n this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n this.reconnectionDelay(opts.reconnectionDelay || 1000);\n this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n this.randomizationFactor(opts.randomizationFactor || 0.5);\n this.backoff = new Backoff({\n min: this.reconnectionDelay(),\n max: this.reconnectionDelayMax(),\n jitter: this.randomizationFactor()\n });\n this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n this.readyState = 'closed';\n this.uri = uri;\n this.connecting = [];\n this.lastPing = null;\n this.encoding = false;\n this.packetBuffer = [];\n var _parser = opts.parser || parser;\n this.encoder = new _parser.Encoder();\n this.decoder = new _parser.Decoder();\n this.autoConnect = opts.autoConnect !== false;\n if (this.autoConnect) this.open();\n}\n\n/**\n * Propagate given event to sockets and emit on `this`\n *\n * @api private\n */\n\nManager.prototype.emitAll = function () {\n this.emit.apply(this, arguments);\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);\n }\n }\n};\n\n/**\n * Update `socket.id` of all sockets\n *\n * @api private\n */\n\nManager.prototype.updateSocketIds = function () {\n for (var nsp in this.nsps) {\n if (has.call(this.nsps, nsp)) {\n this.nsps[nsp].id = this.generateId(nsp);\n }\n }\n};\n\n/**\n * generate `socket.id` for the given `nsp`\n *\n * @param {String} nsp\n * @return {String}\n * @api private\n */\n\nManager.prototype.generateId = function (nsp) {\n return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;\n};\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Manager.prototype);\n\n/**\n * Sets the `reconnection` config.\n *\n * @param {Boolean} true/false if it should automatically reconnect\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnection = function (v) {\n if (!arguments.length) return this._reconnection;\n this._reconnection = !!v;\n return this;\n};\n\n/**\n * Sets the reconnection attempts config.\n *\n * @param {Number} max reconnection attempts before giving up\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionAttempts = function (v) {\n if (!arguments.length) return this._reconnectionAttempts;\n this._reconnectionAttempts = v;\n return this;\n};\n\n/**\n * Sets the delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelay = function (v) {\n if (!arguments.length) return this._reconnectionDelay;\n this._reconnectionDelay = v;\n this.backoff && this.backoff.setMin(v);\n return this;\n};\n\nManager.prototype.randomizationFactor = function (v) {\n if (!arguments.length) return this._randomizationFactor;\n this._randomizationFactor = v;\n this.backoff && this.backoff.setJitter(v);\n return this;\n};\n\n/**\n * Sets the maximum delay between reconnections.\n *\n * @param {Number} delay\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.reconnectionDelayMax = function (v) {\n if (!arguments.length) return this._reconnectionDelayMax;\n this._reconnectionDelayMax = v;\n this.backoff && this.backoff.setMax(v);\n return this;\n};\n\n/**\n * Sets the connection timeout. `false` to disable\n *\n * @return {Manager} self or value\n * @api public\n */\n\nManager.prototype.timeout = function (v) {\n if (!arguments.length) return this._timeout;\n this._timeout = v;\n return this;\n};\n\n/**\n * Starts trying to reconnect if reconnection is enabled and we have not\n * started reconnecting yet\n *\n * @api private\n */\n\nManager.prototype.maybeReconnectOnOpen = function () {\n // Only try to reconnect if it's the first time we're connecting\n if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {\n // keeps reconnection from firing twice for the same reconnection loop\n this.reconnect();\n }\n};\n\n/**\n * Sets the current transport `socket`.\n *\n * @param {Function} optional, callback\n * @return {Manager} self\n * @api public\n */\n\nManager.prototype.open =\nManager.prototype.connect = function (fn, opts) {\n debug('readyState %s', this.readyState);\n if (~this.readyState.indexOf('open')) return this;\n\n debug('opening %s', this.uri);\n this.engine = eio(this.uri, this.opts);\n var socket = this.engine;\n var self = this;\n this.readyState = 'opening';\n this.skipReconnect = false;\n\n // emit `open`\n var openSub = on(socket, 'open', function () {\n self.onopen();\n fn && fn();\n });\n\n // emit `connect_error`\n var errorSub = on(socket, 'error', function (data) {\n debug('connect_error');\n self.cleanup();\n self.readyState = 'closed';\n self.emitAll('connect_error', data);\n if (fn) {\n var err = new Error('Connection error');\n err.data = data;\n fn(err);\n } else {\n // Only do this if there is no fn to handle the error\n self.maybeReconnectOnOpen();\n }\n });\n\n // emit `connect_timeout`\n if (false !== this._timeout) {\n var timeout = this._timeout;\n debug('connect attempt will timeout after %d', timeout);\n\n if (timeout === 0) {\n openSub.destroy(); // prevents a race condition with the 'open' event\n }\n\n // set timer\n var timer = setTimeout(function () {\n debug('connect attempt timed out after %d', timeout);\n openSub.destroy();\n socket.close();\n socket.emit('error', 'timeout');\n self.emitAll('connect_timeout', timeout);\n }, timeout);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n\n this.subs.push(openSub);\n this.subs.push(errorSub);\n\n return this;\n};\n\n/**\n * Called upon transport open.\n *\n * @api private\n */\n\nManager.prototype.onopen = function () {\n debug('open');\n\n // clear old subs\n this.cleanup();\n\n // mark as open\n this.readyState = 'open';\n this.emit('open');\n\n // add new subs\n var socket = this.engine;\n this.subs.push(on(socket, 'data', bind(this, 'ondata')));\n this.subs.push(on(socket, 'ping', bind(this, 'onping')));\n this.subs.push(on(socket, 'pong', bind(this, 'onpong')));\n this.subs.push(on(socket, 'error', bind(this, 'onerror')));\n this.subs.push(on(socket, 'close', bind(this, 'onclose')));\n this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));\n};\n\n/**\n * Called upon a ping.\n *\n * @api private\n */\n\nManager.prototype.onping = function () {\n this.lastPing = new Date();\n this.emitAll('ping');\n};\n\n/**\n * Called upon a packet.\n *\n * @api private\n */\n\nManager.prototype.onpong = function () {\n this.emitAll('pong', new Date() - this.lastPing);\n};\n\n/**\n * Called with data.\n *\n * @api private\n */\n\nManager.prototype.ondata = function (data) {\n this.decoder.add(data);\n};\n\n/**\n * Called when parser fully decodes a packet.\n *\n * @api private\n */\n\nManager.prototype.ondecoded = function (packet) {\n this.emit('packet', packet);\n};\n\n/**\n * Called upon socket error.\n *\n * @api private\n */\n\nManager.prototype.onerror = function (err) {\n debug('error', err);\n this.emitAll('error', err);\n};\n\n/**\n * Creates a new socket for the given `nsp`.\n *\n * @return {Socket}\n * @api public\n */\n\nManager.prototype.socket = function (nsp, opts) {\n var socket = this.nsps[nsp];\n if (!socket) {\n socket = new Socket(this, nsp, opts);\n this.nsps[nsp] = socket;\n var self = this;\n socket.on('connecting', onConnecting);\n socket.on('connect', function () {\n socket.id = self.generateId(nsp);\n });\n\n if (this.autoConnect) {\n // manually call here since connecting event is fired before listening\n onConnecting();\n }\n }\n\n function onConnecting () {\n if (!~indexOf(self.connecting, socket)) {\n self.connecting.push(socket);\n }\n }\n\n return socket;\n};\n\n/**\n * Called upon a socket close.\n *\n * @param {Socket} socket\n */\n\nManager.prototype.destroy = function (socket) {\n var index = indexOf(this.connecting, socket);\n if (~index) this.connecting.splice(index, 1);\n if (this.connecting.length) return;\n\n this.close();\n};\n\n/**\n * Writes a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nManager.prototype.packet = function (packet) {\n debug('writing packet %j', packet);\n var self = this;\n if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;\n\n if (!self.encoding) {\n // encode, then write to engine with result\n self.encoding = true;\n this.encoder.encode(packet, function (encodedPackets) {\n for (var i = 0; i < encodedPackets.length; i++) {\n self.engine.write(encodedPackets[i], packet.options);\n }\n self.encoding = false;\n self.processPacketQueue();\n });\n } else { // add packet to the queue\n self.packetBuffer.push(packet);\n }\n};\n\n/**\n * If packet buffer is non-empty, begins encoding the\n * next packet in line.\n *\n * @api private\n */\n\nManager.prototype.processPacketQueue = function () {\n if (this.packetBuffer.length > 0 && !this.encoding) {\n var pack = this.packetBuffer.shift();\n this.packet(pack);\n }\n};\n\n/**\n * Clean up transport subscriptions and packet buffer.\n *\n * @api private\n */\n\nManager.prototype.cleanup = function () {\n debug('cleanup');\n\n var subsLength = this.subs.length;\n for (var i = 0; i < subsLength; i++) {\n var sub = this.subs.shift();\n sub.destroy();\n }\n\n this.packetBuffer = [];\n this.encoding = false;\n this.lastPing = null;\n\n this.decoder.destroy();\n};\n\n/**\n * Close the current socket.\n *\n * @api private\n */\n\nManager.prototype.close =\nManager.prototype.disconnect = function () {\n debug('disconnect');\n this.skipReconnect = true;\n this.reconnecting = false;\n if ('opening' === this.readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this.readyState = 'closed';\n if (this.engine) this.engine.close();\n};\n\n/**\n * Called upon engine close.\n *\n * @api private\n */\n\nManager.prototype.onclose = function (reason) {\n debug('onclose');\n\n this.cleanup();\n this.backoff.reset();\n this.readyState = 'closed';\n this.emit('close', reason);\n\n if (this._reconnection && !this.skipReconnect) {\n this.reconnect();\n }\n};\n\n/**\n * Attempt a reconnection.\n *\n * @api private\n */\n\nManager.prototype.reconnect = function () {\n if (this.reconnecting || this.skipReconnect) return this;\n\n var self = this;\n\n if (this.backoff.attempts >= this._reconnectionAttempts) {\n debug('reconnect failed');\n this.backoff.reset();\n this.emitAll('reconnect_failed');\n this.reconnecting = false;\n } else {\n var delay = this.backoff.duration();\n debug('will wait %dms before reconnect attempt', delay);\n\n this.reconnecting = true;\n var timer = setTimeout(function () {\n if (self.skipReconnect) return;\n\n debug('attempting reconnect');\n self.emitAll('reconnect_attempt', self.backoff.attempts);\n self.emitAll('reconnecting', self.backoff.attempts);\n\n // check again for the case socket closed in above events\n if (self.skipReconnect) return;\n\n self.open(function (err) {\n if (err) {\n debug('reconnect attempt error');\n self.reconnecting = false;\n self.reconnect();\n self.emitAll('reconnect_error', err.data);\n } else {\n debug('reconnect success');\n self.onreconnect();\n }\n });\n }, delay);\n\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n }\n });\n }\n};\n\n/**\n * Called upon successful reconnect.\n *\n * @api private\n */\n\nManager.prototype.onreconnect = function () {\n var attempt = this.backoff.attempts;\n this.reconnecting = false;\n this.backoff.reset();\n this.updateSocketIds();\n this.emitAll('reconnect', attempt);\n};\n","\n/**\n * Module exports.\n */\n\nmodule.exports = on;\n\n/**\n * Helper for subscriptions.\n *\n * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`\n * @param {String} event name\n * @param {Function} callback\n * @api public\n */\n\nfunction on (obj, ev, fn) {\n obj.on(ev, fn);\n return {\n destroy: function () {\n obj.removeListener(ev, fn);\n }\n };\n}\n","\n/**\n * Module dependencies.\n */\n\nvar parser = require('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar toArray = require('to-array');\nvar on = require('./on');\nvar bind = require('component-bind');\nvar debug = require('debug')('socket.io-client:socket');\nvar parseqs = require('parseqs');\nvar hasBin = require('has-binary2');\n\n/**\n * Module exports.\n */\n\nmodule.exports = exports = Socket;\n\n/**\n * Internal events (blacklisted).\n * These events can't be emitted by the user.\n *\n * @api private\n */\n\nvar events = {\n connect: 1,\n connect_error: 1,\n connect_timeout: 1,\n connecting: 1,\n disconnect: 1,\n error: 1,\n reconnect: 1,\n reconnect_attempt: 1,\n reconnect_failed: 1,\n reconnect_error: 1,\n reconnecting: 1,\n ping: 1,\n pong: 1\n};\n\n/**\n * Shortcut to `Emitter#emit`.\n */\n\nvar emit = Emitter.prototype.emit;\n\n/**\n * `Socket` constructor.\n *\n * @api public\n */\n\nfunction Socket (io, nsp, opts) {\n this.io = io;\n this.nsp = nsp;\n this.json = this; // compat\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.connected = false;\n this.disconnected = true;\n this.flags = {};\n if (opts && opts.query) {\n this.query = opts.query;\n }\n if (this.io.autoConnect) this.open();\n}\n\n/**\n * Mix in `Emitter`.\n */\n\nEmitter(Socket.prototype);\n\n/**\n * Subscribe to open, close and packet events\n *\n * @api private\n */\n\nSocket.prototype.subEvents = function () {\n if (this.subs) return;\n\n var io = this.io;\n this.subs = [\n on(io, 'open', bind(this, 'onopen')),\n on(io, 'packet', bind(this, 'onpacket')),\n on(io, 'close', bind(this, 'onclose'))\n ];\n};\n\n/**\n * \"Opens\" the socket.\n *\n * @api public\n */\n\nSocket.prototype.open =\nSocket.prototype.connect = function () {\n if (this.connected) return this;\n\n this.subEvents();\n if (!this.io.reconnecting) this.io.open(); // ensure open\n if ('open' === this.io.readyState) this.onopen();\n this.emit('connecting');\n return this;\n};\n\n/**\n * Sends a `message` event.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.send = function () {\n var args = toArray(arguments);\n args.unshift('message');\n this.emit.apply(this, args);\n return this;\n};\n\n/**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @param {String} event name\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.emit = function (ev) {\n if (events.hasOwnProperty(ev)) {\n emit.apply(this, arguments);\n return this;\n }\n\n var args = toArray(arguments);\n var packet = {\n type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,\n data: args\n };\n\n packet.options = {};\n packet.options.compress = !this.flags || false !== this.flags.compress;\n\n // event ack callback\n if ('function' === typeof args[args.length - 1]) {\n debug('emitting packet with ack id %d', this.ids);\n this.acks[this.ids] = args.pop();\n packet.id = this.ids++;\n }\n\n if (this.connected) {\n this.packet(packet);\n } else {\n this.sendBuffer.push(packet);\n }\n\n this.flags = {};\n\n return this;\n};\n\n/**\n * Sends a packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.packet = function (packet) {\n packet.nsp = this.nsp;\n this.io.packet(packet);\n};\n\n/**\n * Called upon engine `open`.\n *\n * @api private\n */\n\nSocket.prototype.onopen = function () {\n debug('transport is open - connecting');\n\n // write connect packet if necessary\n if ('/' !== this.nsp) {\n if (this.query) {\n var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;\n debug('sending connect packet with query %s', query);\n this.packet({type: parser.CONNECT, query: query});\n } else {\n this.packet({type: parser.CONNECT});\n }\n }\n};\n\n/**\n * Called upon engine `close`.\n *\n * @param {String} reason\n * @api private\n */\n\nSocket.prototype.onclose = function (reason) {\n debug('close (%s)', reason);\n this.connected = false;\n this.disconnected = true;\n delete this.id;\n this.emit('disconnect', reason);\n};\n\n/**\n * Called with socket packet.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onpacket = function (packet) {\n var sameNamespace = packet.nsp === this.nsp;\n var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';\n\n if (!sameNamespace && !rootNamespaceError) return;\n\n switch (packet.type) {\n case parser.CONNECT:\n this.onconnect();\n break;\n\n case parser.EVENT:\n this.onevent(packet);\n break;\n\n case parser.BINARY_EVENT:\n this.onevent(packet);\n break;\n\n case parser.ACK:\n this.onack(packet);\n break;\n\n case parser.BINARY_ACK:\n this.onack(packet);\n break;\n\n case parser.DISCONNECT:\n this.ondisconnect();\n break;\n\n case parser.ERROR:\n this.emit('error', packet.data);\n break;\n }\n};\n\n/**\n * Called upon a server event.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onevent = function (packet) {\n var args = packet.data || [];\n debug('emitting event %j', args);\n\n if (null != packet.id) {\n debug('attaching ack callback to event');\n args.push(this.ack(packet.id));\n }\n\n if (this.connected) {\n emit.apply(this, args);\n } else {\n this.receiveBuffer.push(args);\n }\n};\n\n/**\n * Produces an ack callback to emit with an event.\n *\n * @api private\n */\n\nSocket.prototype.ack = function (id) {\n var self = this;\n var sent = false;\n return function () {\n // prevent double callbacks\n if (sent) return;\n sent = true;\n var args = toArray(arguments);\n debug('sending ack %j', args);\n\n self.packet({\n type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,\n id: id,\n data: args\n });\n };\n};\n\n/**\n * Called upon a server acknowlegement.\n *\n * @param {Object} packet\n * @api private\n */\n\nSocket.prototype.onack = function (packet) {\n var ack = this.acks[packet.id];\n if ('function' === typeof ack) {\n debug('calling ack %s with %j', packet.id, packet.data);\n ack.apply(this, packet.data);\n delete this.acks[packet.id];\n } else {\n debug('bad ack %s', packet.id);\n }\n};\n\n/**\n * Called upon server connect.\n *\n * @api private\n */\n\nSocket.prototype.onconnect = function () {\n this.connected = true;\n this.disconnected = false;\n this.emit('connect');\n this.emitBuffered();\n};\n\n/**\n * Emit buffered events (received and emitted).\n *\n * @api private\n */\n\nSocket.prototype.emitBuffered = function () {\n var i;\n for (i = 0; i < this.receiveBuffer.length; i++) {\n emit.apply(this, this.receiveBuffer[i]);\n }\n this.receiveBuffer = [];\n\n for (i = 0; i < this.sendBuffer.length; i++) {\n this.packet(this.sendBuffer[i]);\n }\n this.sendBuffer = [];\n};\n\n/**\n * Called upon server disconnect.\n *\n * @api private\n */\n\nSocket.prototype.ondisconnect = function () {\n debug('server disconnect (%s)', this.nsp);\n this.destroy();\n this.onclose('io server disconnect');\n};\n\n/**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @api private.\n */\n\nSocket.prototype.destroy = function () {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n for (var i = 0; i < this.subs.length; i++) {\n this.subs[i].destroy();\n }\n this.subs = null;\n }\n\n this.io.destroy(this);\n};\n\n/**\n * Disconnects the socket manually.\n *\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.close =\nSocket.prototype.disconnect = function () {\n if (this.connected) {\n debug('performing disconnect (%s)', this.nsp);\n this.packet({ type: parser.DISCONNECT });\n }\n\n // remove socket from pool\n this.destroy();\n\n if (this.connected) {\n // fire events\n this.onclose('io client disconnect');\n }\n return this;\n};\n\n/**\n * Sets the compress flag.\n *\n * @param {Boolean} if `true`, compresses the sending data\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.compress = function (compress) {\n this.flags.compress = compress;\n return this;\n};\n\n/**\n * Sets the binary flag\n *\n * @param {Boolean} whether the emitted data contains binary\n * @return {Socket} self\n * @api public\n */\n\nSocket.prototype.binary = function (binary) {\n this.flags.binary = binary;\n return this;\n};\n","\n/**\n * Module dependencies.\n */\n\nvar parseuri = require('parseuri');\nvar debug = require('debug')('socket.io-client:url');\n\n/**\n * Module exports.\n */\n\nmodule.exports = url;\n\n/**\n * URL parser.\n *\n * @param {String} url\n * @param {Object} An object meant to mimic window.location.\n * Defaults to window.location.\n * @api public\n */\n\nfunction url (uri, loc) {\n var obj = uri;\n\n // default to window.location\n loc = loc || (typeof location !== 'undefined' && location);\n if (null == uri) uri = loc.protocol + '//' + loc.host;\n\n // relative path support\n if ('string' === typeof uri) {\n if ('/' === uri.charAt(0)) {\n if ('/' === uri.charAt(1)) {\n uri = loc.protocol + uri;\n } else {\n uri = loc.host + uri;\n }\n }\n\n if (!/^(https?|wss?):\\/\\//.test(uri)) {\n debug('protocol-less url %s', uri);\n if ('undefined' !== typeof loc) {\n uri = loc.protocol + '//' + uri;\n } else {\n uri = 'https://' + uri;\n }\n }\n\n // parse\n debug('parse %s', uri);\n obj = parseuri(uri);\n }\n\n // make sure we treat `localhost:80` and `localhost` equally\n if (!obj.port) {\n if (/^(http|ws)$/.test(obj.protocol)) {\n obj.port = '80';\n } else if (/^(http|ws)s$/.test(obj.protocol)) {\n obj.port = '443';\n }\n }\n\n obj.path = obj.path || '/';\n\n var ipv6 = obj.host.indexOf(':') !== -1;\n var host = ipv6 ? '[' + obj.host + ']' : obj.host;\n\n // define unique id\n obj.id = obj.protocol + '://' + host + ':' + obj.port;\n // define href\n obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));\n\n return obj;\n}\n","/*global Blob,File*/\n\n/**\n * Module requirements\n */\n\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\nvar toString = Object.prototype.toString;\nvar withNativeBlob = typeof Blob === 'function' || (typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]');\nvar withNativeFile = typeof File === 'function' || (typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]');\n\n/**\n * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.\n * Anything with blobs or files should be fed through removeBlobs before coming\n * here.\n *\n * @param {Object} packet - socket.io event packet\n * @return {Object} with deconstructed packet and list of buffers\n * @api public\n */\n\nexports.deconstructPacket = function(packet) {\n var buffers = [];\n var packetData = packet.data;\n var pack = packet;\n pack.data = _deconstructPacket(packetData, buffers);\n pack.attachments = buffers.length; // number of binary 'attachments'\n return {packet: pack, buffers: buffers};\n};\n\nfunction _deconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (isBuf(data)) {\n var placeholder = { _placeholder: true, num: buffers.length };\n buffers.push(data);\n return placeholder;\n } else if (isArray(data)) {\n var newData = new Array(data.length);\n for (var i = 0; i < data.length; i++) {\n newData[i] = _deconstructPacket(data[i], buffers);\n }\n return newData;\n } else if (typeof data === 'object' && !(data instanceof Date)) {\n var newData = {};\n for (var key in data) {\n newData[key] = _deconstructPacket(data[key], buffers);\n }\n return newData;\n }\n return data;\n}\n\n/**\n * Reconstructs a binary packet from its placeholder packet and buffers\n *\n * @param {Object} packet - event packet with placeholders\n * @param {Array} buffers - binary buffers to put in placeholder positions\n * @return {Object} reconstructed packet\n * @api public\n */\n\nexports.reconstructPacket = function(packet, buffers) {\n packet.data = _reconstructPacket(packet.data, buffers);\n packet.attachments = undefined; // no longer useful\n return packet;\n};\n\nfunction _reconstructPacket(data, buffers) {\n if (!data) return data;\n\n if (data && data._placeholder) {\n return buffers[data.num]; // appropriate buffer (should be natural order anyway)\n } else if (isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n data[i] = _reconstructPacket(data[i], buffers);\n }\n } else if (typeof data === 'object') {\n for (var key in data) {\n data[key] = _reconstructPacket(data[key], buffers);\n }\n }\n\n return data;\n}\n\n/**\n * Asynchronously removes Blobs or Files from data via\n * FileReader's readAsArrayBuffer method. Used before encoding\n * data as msgpack. Calls callback with the blobless data.\n *\n * @param {Object} data\n * @param {Function} callback\n * @api private\n */\n\nexports.removeBlobs = function(data, callback) {\n function _removeBlobs(obj, curKey, containingObject) {\n if (!obj) return obj;\n\n // convert any blob\n if ((withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File)) {\n pendingBlobs++;\n\n // async filereader\n var fileReader = new FileReader();\n fileReader.onload = function() { // this.result == arraybuffer\n if (containingObject) {\n containingObject[curKey] = this.result;\n }\n else {\n bloblessData = this.result;\n }\n\n // if nothing pending its callback time\n if(! --pendingBlobs) {\n callback(bloblessData);\n }\n };\n\n fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer\n } else if (isArray(obj)) { // handle array\n for (var i = 0; i < obj.length; i++) {\n _removeBlobs(obj[i], i, obj);\n }\n } else if (typeof obj === 'object' && !isBuf(obj)) { // and object\n for (var key in obj) {\n _removeBlobs(obj[key], key, obj);\n }\n }\n }\n\n var pendingBlobs = 0;\n var bloblessData = data;\n _removeBlobs(bloblessData);\n if (!pendingBlobs) {\n callback(bloblessData);\n }\n};\n","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('socket.io-parser');\nvar Emitter = require('component-emitter');\nvar binary = require('./binary');\nvar isArray = require('isarray');\nvar isBuf = require('./is-buffer');\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nexports.protocol = 4;\n\n/**\n * Packet types.\n *\n * @api public\n */\n\nexports.types = [\n 'CONNECT',\n 'DISCONNECT',\n 'EVENT',\n 'ACK',\n 'ERROR',\n 'BINARY_EVENT',\n 'BINARY_ACK'\n];\n\n/**\n * Packet type `connect`.\n *\n * @api public\n */\n\nexports.CONNECT = 0;\n\n/**\n * Packet type `disconnect`.\n *\n * @api public\n */\n\nexports.DISCONNECT = 1;\n\n/**\n * Packet type `event`.\n *\n * @api public\n */\n\nexports.EVENT = 2;\n\n/**\n * Packet type `ack`.\n *\n * @api public\n */\n\nexports.ACK = 3;\n\n/**\n * Packet type `error`.\n *\n * @api public\n */\n\nexports.ERROR = 4;\n\n/**\n * Packet type 'binary event'\n *\n * @api public\n */\n\nexports.BINARY_EVENT = 5;\n\n/**\n * Packet type `binary ack`. For acks with binary arguments.\n *\n * @api public\n */\n\nexports.BINARY_ACK = 6;\n\n/**\n * Encoder constructor.\n *\n * @api public\n */\n\nexports.Encoder = Encoder;\n\n/**\n * Decoder constructor.\n *\n * @api public\n */\n\nexports.Decoder = Decoder;\n\n/**\n * A socket.io Encoder instance\n *\n * @api public\n */\n\nfunction Encoder() {}\n\nvar ERROR_PACKET = exports.ERROR + '\"encode error\"';\n\n/**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n * @param {Function} callback - function to handle encodings (likely engine.write)\n * @return Calls callback with Array of encodings\n * @api public\n */\n\nEncoder.prototype.encode = function(obj, callback){\n debug('encoding packet %j', obj);\n\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n encodeAsBinary(obj, callback);\n } else {\n var encoding = encodeAsString(obj);\n callback([encoding]);\n }\n};\n\n/**\n * Encode packet as string.\n *\n * @param {Object} packet\n * @return {String} encoded\n * @api private\n */\n\nfunction encodeAsString(obj) {\n\n // first is type\n var str = '' + obj.type;\n\n // attachments if we have them\n if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {\n str += obj.attachments + '-';\n }\n\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && '/' !== obj.nsp) {\n str += obj.nsp + ',';\n }\n\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n\n // json data\n if (null != obj.data) {\n var payload = tryStringify(obj.data);\n if (payload !== false) {\n str += payload;\n } else {\n return ERROR_PACKET;\n }\n }\n\n debug('encoded %j as %s', obj, str);\n return str;\n}\n\nfunction tryStringify(str) {\n try {\n return JSON.stringify(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n *\n * @param {Object} packet\n * @return {Buffer} encoded\n * @api private\n */\n\nfunction encodeAsBinary(obj, callback) {\n\n function writeEncoding(bloblessData) {\n var deconstruction = binary.deconstructPacket(bloblessData);\n var pack = encodeAsString(deconstruction.packet);\n var buffers = deconstruction.buffers;\n\n buffers.unshift(pack); // add packet info to beginning of data list\n callback(buffers); // write all the buffers\n }\n\n binary.removeBlobs(obj, writeEncoding);\n}\n\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n * @api public\n */\n\nfunction Decoder() {\n this.reconstructor = null;\n}\n\n/**\n * Mix in `Emitter` with Decoder.\n */\n\nEmitter(Decoder.prototype);\n\n/**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n * @return {Object} packet\n * @api public\n */\n\nDecoder.prototype.add = function(obj) {\n var packet;\n if (typeof obj === 'string') {\n packet = decodeString(obj);\n if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n\n // no attachments, labeled binary but no binary data to follow\n if (this.reconstructor.reconPack.attachments === 0) {\n this.emit('decoded', packet);\n }\n } else { // non-binary full packet\n this.emit('decoded', packet);\n }\n } else if (isBuf(obj) || obj.base64) { // raw binary data\n if (!this.reconstructor) {\n throw new Error('got binary data when not reconstructing a packet');\n } else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) { // received final buffer\n this.reconstructor = null;\n this.emit('decoded', packet);\n }\n }\n } else {\n throw new Error('Unknown type: ' + obj);\n }\n};\n\n/**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n * @api private\n */\n\nfunction decodeString(str) {\n var i = 0;\n // look up type\n var p = {\n type: Number(str.charAt(0))\n };\n\n if (null == exports.types[p.type]) {\n return error('unknown packet type ' + p.type);\n }\n\n // look up attachments if type binary\n if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {\n var start = i + 1;\n while (str.charAt(++i) !== '-' && i != str.length) {}\n var buf = str.substring(start, i);\n if (buf != Number(buf) || str.charAt(i) !== '-') {\n throw new Error('Illegal attachments');\n }\n p.attachments = Number(buf);\n }\n\n // look up namespace (if any)\n if ('/' === str.charAt(i + 1)) {\n var start = i + 1;\n while (++i) {\n var c = str.charAt(i);\n if (',' === c) break;\n if (i === str.length) break;\n }\n p.nsp = str.substring(start, i);\n } else {\n p.nsp = '/';\n }\n\n // look up id\n var next = str.charAt(i + 1);\n if ('' !== next && Number(next) == next) {\n var start = i + 1;\n while (++i) {\n var c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n if (i === str.length) break;\n }\n p.id = Number(str.substring(start, i + 1));\n }\n\n // look up json data\n if (str.charAt(++i)) {\n var payload = tryParse(str.substr(i));\n var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));\n if (isPayloadValid) {\n p.data = payload;\n } else {\n return error('invalid payload');\n }\n }\n\n debug('decoded %s as %j', str, p);\n return p;\n}\n\nfunction tryParse(str) {\n try {\n return JSON.parse(str);\n } catch(e){\n return false;\n }\n}\n\n/**\n * Deallocates a parser's resources\n *\n * @api public\n */\n\nDecoder.prototype.destroy = function() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n }\n};\n\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n * @api private\n */\n\nfunction BinaryReconstructor(packet) {\n this.reconPack = packet;\n this.buffers = [];\n}\n\n/**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n * @api private\n */\n\nBinaryReconstructor.prototype.takeBinaryData = function(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) { // done with buffer list\n var packet = binary.reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n};\n\n/**\n * Cleans up binary packet reconstruction variables.\n *\n * @api private\n */\n\nBinaryReconstructor.prototype.finishedReconstruction = function() {\n this.reconPack = null;\n this.buffers = [];\n};\n\nfunction error(msg) {\n return {\n type: exports.ERROR,\n data: 'parser error: ' + msg\n };\n}\n","\nmodule.exports = isBuf;\n\nvar withNativeBuffer = typeof Buffer === 'function' && typeof Buffer.isBuffer === 'function';\nvar withNativeArrayBuffer = typeof ArrayBuffer === 'function';\n\nvar isView = function (obj) {\n return typeof ArrayBuffer.isView === 'function' ? ArrayBuffer.isView(obj) : (obj.buffer instanceof ArrayBuffer);\n};\n\n/**\n * Returns true if obj is a buffer or an arraybuffer.\n *\n * @api private\n */\n\nfunction isBuf(obj) {\n return (withNativeBuffer && Buffer.isBuffer(obj)) ||\n (withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj)));\n}\n","\"use strict\"\n// Module export pattern from\n// https://github.com/umdjs/umd/blob/master/returnExports.js\n;(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n // Browser globals (root is window)\n root.store = factory();\n }\n}(this, function () {\n\t\n\t// Store.js\n\tvar store = {},\n\t\twin = (typeof window != 'undefined' ? window : global),\n\t\tdoc = win.document,\n\t\tlocalStorageName = 'localStorage',\n\t\tscriptTag = 'script',\n\t\tstorage\n\n\tstore.disabled = false\n\tstore.version = '1.3.20'\n\tstore.set = function(key, value) {}\n\tstore.get = function(key, defaultVal) {}\n\tstore.has = function(key) { return store.get(key) !== undefined }\n\tstore.remove = function(key) {}\n\tstore.clear = function() {}\n\tstore.transact = function(key, defaultVal, transactionFn) {\n\t\tif (transactionFn == null) {\n\t\t\ttransactionFn = defaultVal\n\t\t\tdefaultVal = null\n\t\t}\n\t\tif (defaultVal == null) {\n\t\t\tdefaultVal = {}\n\t\t}\n\t\tvar val = store.get(key, defaultVal)\n\t\ttransactionFn(val)\n\t\tstore.set(key, val)\n\t}\n\tstore.getAll = function() {}\n\tstore.forEach = function() {}\n\n\tstore.serialize = function(value) {\n\t\treturn JSON.stringify(value)\n\t}\n\tstore.deserialize = function(value) {\n\t\tif (typeof value != 'string') { return undefined }\n\t\ttry { return JSON.parse(value) }\n\t\tcatch(e) { return value || undefined }\n\t}\n\n\t// Functions to encapsulate questionable FireFox 3.6.13 behavior\n\t// when about.config::dom.storage.enabled === false\n\t// See https://github.com/marcuswestin/store.js/issues#issue/13\n\tfunction isLocalStorageNameSupported() {\n\t\ttry { return (localStorageName in win && win[localStorageName]) }\n\t\tcatch(err) { return false }\n\t}\n\n\tif (isLocalStorageNameSupported()) {\n\t\tstorage = win[localStorageName]\n\t\tstore.set = function(key, val) {\n\t\t\tif (val === undefined) { return store.remove(key) }\n\t\t\tstorage.setItem(key, store.serialize(val))\n\t\t\treturn val\n\t\t}\n\t\tstore.get = function(key, defaultVal) {\n\t\t\tvar val = store.deserialize(storage.getItem(key))\n\t\t\treturn (val === undefined ? defaultVal : val)\n\t\t}\n\t\tstore.remove = function(key) { storage.removeItem(key) }\n\t\tstore.clear = function() { storage.clear() }\n\t\tstore.getAll = function() {\n\t\t\tvar ret = {}\n\t\t\tstore.forEach(function(key, val) {\n\t\t\t\tret[key] = val\n\t\t\t})\n\t\t\treturn ret\n\t\t}\n\t\tstore.forEach = function(callback) {\n\t\t\tfor (var i=0; i<storage.length; i++) {\n\t\t\t\tvar key = storage.key(i)\n\t\t\t\tcallback(key, store.get(key))\n\t\t\t}\n\t\t}\n\t} else if (doc && doc.documentElement.addBehavior) {\n\t\tvar storageOwner,\n\t\t\tstorageContainer\n\t\t// Since #userData storage applies only to specific paths, we need to\n\t\t// somehow link our data to a specific path. We choose /favicon.ico\n\t\t// as a pretty safe option, since all browsers already make a request to\n\t\t// this URL anyway and being a 404 will not hurt us here. We wrap an\n\t\t// iframe pointing to the favicon in an ActiveXObject(htmlfile) object\n\t\t// (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)\n\t\t// since the iframe access rules appear to allow direct access and\n\t\t// manipulation of the document element, even for a 404 page. This\n\t\t// document can be used instead of the current document (which would\n\t\t// have been limited to the current path) to perform #userData storage.\n\t\ttry {\n\t\t\tstorageContainer = new ActiveXObject('htmlfile')\n\t\t\tstorageContainer.open()\n\t\t\tstorageContainer.write('<'+scriptTag+'>document.w=window</'+scriptTag+'><iframe src=\"/favicon.ico\"></iframe>')\n\t\t\tstorageContainer.close()\n\t\t\tstorageOwner = storageContainer.w.frames[0].document\n\t\t\tstorage = storageOwner.createElement('div')\n\t\t} catch(e) {\n\t\t\t// somehow ActiveXObject instantiation failed (perhaps some special\n\t\t\t// security settings or otherwse), fall back to per-path storage\n\t\t\tstorage = doc.createElement('div')\n\t\t\tstorageOwner = doc.body\n\t\t}\n\t\tvar withIEStorage = function(storeFunction) {\n\t\t\treturn function() {\n\t\t\t\tvar args = Array.prototype.slice.call(arguments, 0)\n\t\t\t\targs.unshift(storage)\n\t\t\t\t// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx\n\t\t\t\t// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx\n\t\t\t\tstorageOwner.appendChild(storage)\n\t\t\t\tstorage.addBehavior('#default#userData')\n\t\t\t\tstorage.load(localStorageName)\n\t\t\t\tvar result = storeFunction.apply(store, args)\n\t\t\t\tstorageOwner.removeChild(storage)\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\n\t\t// In IE7, keys cannot start with a digit or contain certain chars.\n\t\t// See https://github.com/marcuswestin/store.js/issues/40\n\t\t// See https://github.com/marcuswestin/store.js/issues/83\n\t\tvar forbiddenCharsRegex = new RegExp(\"[!\\\"#$%&'()*+,/\\\\\\\\:;<=>?@[\\\\]^`{|}~]\", \"g\")\n\t\tvar ieKeyFix = function(key) {\n\t\t\treturn key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___')\n\t\t}\n\t\tstore.set = withIEStorage(function(storage, key, val) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tif (val === undefined) { return store.remove(key) }\n\t\t\tstorage.setAttribute(key, store.serialize(val))\n\t\t\tstorage.save(localStorageName)\n\t\t\treturn val\n\t\t})\n\t\tstore.get = withIEStorage(function(storage, key, defaultVal) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tvar val = store.deserialize(storage.getAttribute(key))\n\t\t\treturn (val === undefined ? defaultVal : val)\n\t\t})\n\t\tstore.remove = withIEStorage(function(storage, key) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tstorage.removeAttribute(key)\n\t\t\tstorage.save(localStorageName)\n\t\t})\n\t\tstore.clear = withIEStorage(function(storage) {\n\t\t\tvar attributes = storage.XMLDocument.documentElement.attributes\n\t\t\tstorage.load(localStorageName)\n\t\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\t\tstorage.removeAttribute(attributes[i].name)\n\t\t\t}\n\t\t\tstorage.save(localStorageName)\n\t\t})\n\t\tstore.getAll = function(storage) {\n\t\t\tvar ret = {}\n\t\t\tstore.forEach(function(key, val) {\n\t\t\t\tret[key] = val\n\t\t\t})\n\t\t\treturn ret\n\t\t}\n\t\tstore.forEach = withIEStorage(function(storage, callback) {\n\t\t\tvar attributes = storage.XMLDocument.documentElement.attributes\n\t\t\tfor (var i=0, attr; attr=attributes[i]; ++i) {\n\t\t\t\tcallback(attr.name, store.deserialize(storage.getAttribute(attr.name)))\n\t\t\t}\n\t\t})\n\t}\n\n\ttry {\n\t\tvar testKey = '__storejs__'\n\t\tstore.set(testKey, testKey)\n\t\tif (store.get(testKey) != testKey) { store.disabled = true }\n\t\tstore.remove(testKey)\n\t} catch(e) {\n\t\tstore.disabled = true\n\t}\n\tstore.enabled = !store.disabled\n\t\n\treturn store\n}));\n","module.exports = toArray\n\nfunction toArray(list, index) {\n var array = []\n\n index = index || 0\n\n for (var i = index || 0; i < list.length; i++) {\n array[i - index] = list[i]\n }\n\n return array\n}\n","'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n","/**\n * @type {angular}\n */\nmodule.exports = window.angular;\n","var module = require(\"./module\"); //jshint ignore:line\n\nmodule.directive(\"icon\", require(\"./directives/icon\"));\nmodule.directive(\"linkTo\", require(\"./directives/link-to\"));\nmodule.directive(\"switch\", require(\"./directives/switch\"));\nmodule.directive(\"newTab\", require(\"./directives/new-tab\"));","module.exports = function () {\n return {\n scope: {\n icon: \"@\"\n },\n restrict: \"E\",\n replace: true,\n template: \"<svg bs-svg-icon><use xlink:href=\\\"{{iconName}}\\\"></use></svg>\",\n link: function (scope, elem, attrs) {\n scope.iconName = \"#svg-\" + scope.icon;\n return scope;\n }\n };\n};","module.exports = function () {\n return {\n restrict: \"E\",\n replace: false,\n transclude: true,\n scope: {\n \"path\": \"@\"\n },\n template: \"<a href='#' ng-click='navi(path)' ng-transclude=''>as</a>\",\n controller: [\"$scope\", \"$location\", \"$injector\", function ($scope, $location, $injector) {\n\n var pages = $injector.get(\"pagesConfig\");\n var Pages = $injector.get(\"Pages\");\n\n $scope.navi = function (path) {\n var item = pages[path];\n Pages.enable(item);\n $location.path(path);\n };\n }]\n };\n};","module.exports = function () {\n return {\n scope: {\n url: \"@\",\n mode: \"@\"\n },\n restrict: \"E\",\n replace: true,\n template: '<a href=\"{{url}}\" bs-button=\"subtle-alt icon\" target=\"_blank\" title=\"Open a new tab\" ng-show=\"mode !== \\'snippet\\'\"><icon icon=\"newtab\"></icon> New Tab </a>' //jshint:ignore\n };\n};","module.exports = function () {\n return {\n scope: {\n toggle: \"&\",\n item: \"=\",\n switchid: \"@\",\n title: \"@\",\n tagline: \"@\",\n active: \"=\",\n prop: \"@\"\n },\n restrict: \"E\",\n replace: true,\n transclude: true,\n templateUrl: \"bs-switch.html\",\n controllerAs: \"ctrl\",\n controller: [\"$scope\", function ($scope) {\n var ctrl = this;\n ctrl.item = $scope.item;\n }]\n };\n};","var module = require(\"./module\"); //jshint ignore:line\nvar utils = require(\"./utils\"); //jshint ignore:line\n\nmodule\n .filter(\"ucfirst\", function () { return utils.ucfirst; })\n .filter(\"localRootUrl\", function () { return utils.localRootUrl; })\n .filter(\"localUrl\", function () { return utils.localRootUrl; })\n .filter(\"orderObjectBy\", function () { return utils.orderObjectBy; });","var app = require(\"../module\");\n\napp.controller(\"MainController\", [\n \"$scope\",\n \"$rootScope\",\n \"$location\",\n \"$injector\",\n MainController\n]);\n\n\n/**\n * @param $scope\n * @param $rootScope\n * @param $location\n * @param $injector\n * @constructor\n */\nfunction MainController ($scope, $rootScope, $location, $injector) {\n\n var ctrl = this;\n ctrl.options = false;\n ctrl.browsers = [];\n ctrl.socketId = \"\";\n\n var pagesConfig = $injector.get(\"pagesConfig\");\n var Pages = $injector.get(\"Pages\");\n var Socket = $injector.get(\"Socket\");\n var Clients = $injector.get(\"Clients\");\n\n ctrl.ui = {\n menu: pagesConfig,\n sectionMenu: false,\n disconnected: false\n };\n\n /**\n * @param $section\n */\n ctrl.setActiveSection = function ($section) {\n Pages.enable($section);\n $location.path($section.path);\n ctrl.ui.sectionMenu = false;\n };\n\n /**\n * Refresh all event\n */\n ctrl.reloadAll = function () {\n Clients.reloadAll();\n $rootScope.$emit(\"notify:flash\", {\n heading: \"Instruction sent:\",\n message: \"Reload All Browsers ✔\"\n });\n };\n\n /**\n * @param value\n */\n ctrl.scrollAllTo = function () {\n Clients.scrollAllTo(0);\n $rootScope.$emit(\"notify:flash\", {\n heading: \"Instruction sent:\",\n message: \"Scroll all browsers to Y=0 ✔\"\n });\n };\n\n /**\n * Emit the socket event\n */\n ctrl.sendAllTo = function (path) {\n Clients.sendAllTo(path);\n $rootScope.$emit(\"notify:flash\", {\n heading: \"Instruction sent:\",\n message: \"Reset all Browsers to /\"\n });\n };\n\n /**\n *\n */\n ctrl.toggleMenu = function () {\n ctrl.ui.sectionMenu = !ctrl.ui.sectionMenu;\n };\n\n /**\n * @type {{connection: connection, addBrowsers: addBrowsers}}\n */\n ctrl.socketEvents = {\n\n /**\n * @param options\n */\n connection: function (options) {\n ctrl.update(options);\n },\n /**\n *\n */\n disconnect: function () {\n ctrl.ui.disconnected = true;\n }\n };\n\n /**\n * Update the current $scope\n */\n ctrl.update = function (options) {\n\n ctrl.options = transformOptions(options);\n ctrl.ui.disconnected = false;\n\n Pages.transform(pagesConfig[\"overview\"], function ($section) {\n return $section;\n });\n };\n\n /**\n * Set the currently active page\n */\n ctrl.setActiveSection(Pages.current());\n\n /**\n * Get options from socket connection\n */\n Socket.options().then(ctrl.socketEvents.connection);\n\n /**\n * React to disconnects\n */\n $rootScope.$on(\"ui:disconnect\", ctrl.socketEvents.disconnect);\n $rootScope.$on(\"ui:connection\", function (evt, options) {\n ctrl.socketEvents.connection(options);\n $scope.$digest();\n });\n}\n\n/**\n * Options transformations\n * @param options\n * @returns {*}\n */\nfunction transformOptions(options) {\n\n options.displayUrl = getDisplayUrl(options.urls);\n\n return options;\n}\n\n/**\n * @param urls\n * @returns {*}\n */\nfunction getDisplayUrl (urls) {\n if (!urls) {\n return false;\n }\n return urls.external || urls.local;\n}","/**\n * @type {angular}\n */\nmodule.exports = window.angular.module(\"BrowserSync\");\n","var angular = require('../angular');\n\nangular\n .module(\"bsClients\", [\"bsSocket\"])\n .service(\"Clients\", [\"Socket\", ClientsService]);\n\n/**\n * @param Socket\n * @returns {{reloadAll: Function, sendAllTo: Function, scrollAllTo: Function, highlight: Function}}\n * @constructor\n */\nfunction ClientsService(Socket) {\n\n var api = {\n reloadAll: function () {\n Socket.clientEvent(\"browser:reload\");\n },\n sendAllTo: function (path) {\n Socket.emit(\"ui\", {\n namespace: \"history\",\n event: \"sendAllTo\",\n data: {\n path: path\n }\n });\n },\n scrollAllTo: function () {\n Socket.clientEvent(\"scroll\", {\n position: {\n raw: 0,\n proportional: 0\n },\n override: true\n });\n },\n highlight: function (connection) {\n Socket.emit(\"ui:highlight\", connection);\n }\n };\n\n return api;\n}\n","var angular = require('../angular');\n\nangular\n .module(\"bsDisconnect\", [])\n .directive(\"disconnectElem\", function () {\n return {\n restrict: \"E\",\n scope: {},\n template: '<section bs-overlay ng-class=\"{\\'active\\': ui.visible}\">\\n <p><icon icon=\"block\"></icon></p>\\n <h1>{{ui.heading}} {{ui.message}}</h1>\\n <p>Possible reasons are:</p>\\n <ul bs-list>\\n <li>1. Your process was exited by another tool</li>\\n </ul>\\n <p>You should check your terminal window to see what happened. <br/>(Or simply try reloading this page.)</p>\\n</section>', // jshint:ignore\n controller: [\"$scope\", \"$rootScope\", \"$window\", disconnectController]\n };\n });\n\n/**\n * Disconnect\n * @param $scope\n * @param $rootScope\n * @param $window\n */\nfunction disconnectController($scope, $rootScope, $window) {\n\n /**\n * Default settings\n */\n const DEFAULT_HEADING = \"Browsersync\";\n const DEFAULT_MESSAGE = \"Disconnected\";\n\n $scope._disconnected = false;\n\n /**\n * Default state\n * @type {{visible: boolean, status: string, heading: string, text: string}}\n */\n $scope.ui = {\n visible: false,\n heading: DEFAULT_HEADING,\n message: DEFAULT_MESSAGE\n };\n\n /**\n * @type {{connection: Function, disconnect: Function}}\n */\n $scope.socketEvents = {\n connection: function () {\n if ($scope._disconnected) {\n $window.location.reload(true);\n }\n $scope.ui.visible = false;\n $scope.$digest();\n },\n disconnect: function () {\n $scope._disconnected = true;\n $scope.ui.visible = true;\n $scope.$digest();\n }\n };\n\n $rootScope.$on(\"ui:connection\", $scope.socketEvents.connection);\n $rootScope.$on(\"ui:disconnect\", $scope.socketEvents.disconnect);\n}\n\n\n","var angular = require('../angular');\n\nangular\n .module(\"bsHistory\", [\"bsSocket\"])\n .service(\"History\", [\"Socket\", HistoryService]);\n\nfunction HistoryService(Socket) {\n\n var visited = [];\n var updateStack = [];\n\n /**\n * Add a single socket event and call all callbacks listening to it.\n */\n Socket.on(\"ui:history:update\", function (items) {\n updateStack.forEach(function (fn) {\n fn(items);\n });\n });\n\n return {\n visited: visited,\n updateHistory: function (urls) {\n visited = urls;\n },\n get: function () {\n return Socket.getData(\"visited\");\n },\n remove: function (data) {\n Socket.emit(\"ui\", {\n namespace: \"history\",\n event: \"remove\",\n data: data\n });\n },\n clear: function () {\n Socket.emit(\"ui\", {\n namespace: \"history\",\n event: \"clear\"\n });\n },\n on: function (event, fn) {\n updateStack.push(fn);\n },\n off: function (fn) {\n var index = updateStack.indexOf(fn);\n if (index > -1) {\n updateStack = updateStack.splice(index, 1);\n }\n }\n };\n}\n","var angular = require('../angular');\n\nangular\n .module('bsNotify', [])\n .directive(\"notifyElem\", function () {\n return {\n restrict: \"E\",\n scope: {},\n template: \"<div bs-notify ng-class=\\\"{\\'active\\': ui.visible}\\\">\\n <p class=\\\"notification__text\\\">{{ui.heading}} <span class=\\\"color--lime\\\">{{ui.message}}</span></p>\\n</div>\",\n controller: [\"$scope\", \"$rootScope\", notifyController]\n };\n });\n\n/**\n * Notify\n * @param $scope\n * @param $rootScope\n */\nfunction notifyController($scope, $rootScope) {\n\n /**\n * Default settings\n */\n var DEFAULT_STATUS = \"info\";\n var DEFAULT_HEADING = \"Browsersync:\";\n var DEFAULT_MESSAGE = \"Welcome to Browsersync\";\n var DEFAULT_TIMEOUT = 2000;\n\n /**\n * Default state\n * @type {{visible: boolean, status: string, heading: string, text: string}}\n */\n $scope.ui = {\n status: DEFAULT_STATUS,\n heading: DEFAULT_HEADING,\n message: DEFAULT_MESSAGE\n };\n\n /**\n * @param evt\n * @param data\n */\n $scope.show = function (evt, data) {\n\n data = data || {};\n\n /**\n *\n * Clear any previous timers\n *\n */\n if ($scope._timer) {\n clearTimeout($scope._timer);\n }\n\n /**\n *\n * Set a reset timer\n *\n */\n $scope._timer = window.setTimeout($scope.reset, data.timeout || DEFAULT_TIMEOUT);\n\n /**\n *\n * Set UI flags\n *\n */\n $scope.ui.visible = true;\n $scope.ui.status = data.status || DEFAULT_STATUS;\n $scope.ui.heading = data.heading || DEFAULT_HEADING;\n $scope.ui.message = data.message || DEFAULT_HEADING;\n };\n\n /**\n * Reset the UI\n */\n $scope.reset = function () {\n $scope.ui.visible = false;\n $scope.$digest();\n };\n\n /**\n * Listen to events on the $rootScope\n */\n $rootScope.$on(\"notify:flash\", $scope.show);\n}\n","var angular = require('../angular');\nvar socket = require('socket.io-client');\nvar socketConfig = window.___browserSync___.socketConfig;\nvar socketUrl = window.___browserSync___.socketUrl;\nvar io = socket(socketUrl, socketConfig);\n\nangular\n .module(\"bsSocket\", [])\n .service(\"Socket\", [\"$q\", \"$rootScope\", SocketService]);\n\nfunction SocketService($q, $rootScope) {\n\n var deferred = $q.defer();\n var session;\n\n io.on(\"connection\", function (out) {\n session = out.session;\n $rootScope.$emit(\"ui:connection\", out);\n\n deferred.resolve(out, this);\n\n if (window.name === '') {\n window.name = JSON.stringify({id: socket.id});\n } else {\n var prev = JSON.parse(window.name);\n //console.log(prev, socket);\n if (prev.id !== socket.id) {\n //console.log('new session');\n } else {\n //console.log('page reload');\n }\n //console.log(JSON.parse(window.name));\n }\n });\n\n io.on(\"disconnect\", function () {\n $rootScope.$emit(\"ui:disconnect\");\n });\n\n var publicApi = {\n on: function (name, callback) {\n io.on(name, callback);\n },\n off: function (name, callback) {\n io.off(name, callback);\n },\n removeEvent: function (name, callback) {\n io.removeListener(name, callback);\n },\n emit: function (name, data) {\n io.emit(name, data || {});\n },\n /**\n * Proxy client events\n * @param name\n * @param data\n */\n clientEvent: function (name, data) {\n io.emit(\"ui:client:proxy\", {\n event: name,\n data: data\n });\n },\n options: function () {\n return deferred.promise;\n },\n getData: function (name) {\n var deferred = $q.defer();\n io.on(\"ui:receive:\" + name, function (data) {\n deferred.resolve(data);\n });\n io.emit(\"ui:get:\" + name);\n return deferred.promise;\n },\n uiEvent: function (evt) {\n io.emit(\"ui\", evt);\n },\n newSession: function () {\n\n }\n };\n\n Object.defineProperty(publicApi, 'sessionId', {\n get: function () {\n return session\n }\n });\n\n return publicApi;\n}\n","var angular = require('../angular');\nvar store = require('store');\nvar objectPath = require('object-path');\n\nangular\n .module(\"bsStore\", [])\n .service(\"Store\", [\"$q\", \"$rootScope\", StoreModule]);\n\nfunction Store (ns) {\n var bs = store.get('bs', {});\n if (!Object.keys(bs).length) {\n store.set('bs', {});\n }\n this.ns = ns;\n this.get = function (path) {\n var bs = store.get('bs', {});\n if (!Object.keys(bs).length) {\n store.set('bs', {});\n }\n return objectPath.get(bs, [ns].concat(path).join('.'));\n };\n this.set = function (path, value) {\n var bs = store.get('bs', {});\n if (!Object.keys(bs).length) {\n store.set('bs', {});\n }\n if (!bs[ns]) {\n bs[ns] = {};\n }\n bs[ns][path] = value;\n store.set('bs', bs);\n },\n this.remove = function (path) {\n var bs = store.get('bs', {});\n if (!Object.keys(bs).length) {\n store.set('bs', {});\n }\n if (!bs[ns]) {\n bs[ns] = {};\n }\n if (bs[ns][path]) {\n delete bs[ns][path];\n }\n store.set('bs', bs);\n }\n}\n\nfunction StoreModule () {\n\n return {\n create: function (ns) {\n var store = new Store(ns);\n return store;\n }\n }\n};\n\n","var app = require(\"../module\");\n\napp.factory(\"Options\", [\"Socket\", OptionsService]);\n\n/**\n * @param Socket\n * @returns {{all: Function}}\n * @constructor\n */\nfunction OptionsService(Socket) {\n\n return {\n all: function () {\n return Socket.getData(\"options\");\n }\n };\n}","/**\n * @type {angular}\n */\nvar app = require(\"../module\");\n\napp.service(\"Pages\", [\"pagesConfig\", \"$location\", ContentSections]);\n\n/**\n * @param pagesConfig\n * @param $location\n * @returns {{enable: Function, transform: Function, current: Function}}\n * @constructor\n */\nfunction ContentSections(pagesConfig, $location) {\n\n return {\n /**\n * Enable a single Item\n * @param $section\n * @returns {*}\n */\n enable: function ($section) {\n angular.forEach(pagesConfig, function (item) {\n item.active = false;\n });\n $section.active = true;\n return pagesConfig;\n },\n /**\n * Transform an item\n */\n transform: function ($section, fn) {\n if (typeof fn === \"function\") {\n return $section = fn($section);\n } else {\n throw new TypeError(\"Noooo\");\n }\n },\n /**\n * Get the current section based on the path\n * @returns {*}\n */\n current: function () {\n if ($location.path() === \"/\") {\n return pagesConfig[\"overview\"];\n }\n var match;\n angular.forEach(pagesConfig, function (item) {\n if (item.path === $location.path()) {\n match = item;\n }\n });\n return match;\n }\n };\n}","module.exports = {\n ucfirst: function (string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n },\n localRootUrl: function (port, scheme) {\n return [scheme, \"://\", window.location.hostname, \":\", port].join(\"\");\n },\n localUrl: function(path, port, mode) {\n if (mode === \"snippet\") {\n return path;\n }\n return [\"//\", window.location.hostname, \":\", port, path].join(\"\");\n },\n orderObjectBy: function (items, field, reverse) {\n var filtered = [];\n Object.keys(items).forEach(function(key) {\n filtered.push(items[key]);\n });\n filtered.sort(function (a, b) {\n return (a[field] > b[field] ? 1 : -1);\n });\n if (reverse) {\n filtered.reverse();\n }\n return filtered;\n }\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","require('angular');\nrequire('angular-route');\nrequire('angular-sanitize');\nrequire('angular-touch');\n\nvar angular = window.angular;\n\nangular\n .module(\"BrowserSync\", [\n \"bsHistory\",\n \"bsClients\",\n \"bsDisconnect\",\n \"bsNotify\",\n \"bsSocket\",\n \"bsStore\",\n \"ngRoute\",\n \"ngTouch\",\n \"ngSanitize\"\n ])\n .config([\"$locationProvider\", Config]);\n\n/**\n * @constructor\n * @param $locationProvider\n */\nfunction Config($locationProvider) {\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n}\n\n\n/**\n * Modules\n * @type {exports}\n */\n/* jshint ignore:start */\nvar discon = require(\"./modules/bsDisconnect\");\nvar notify = require(\"./modules/bsNotify\");\nvar history = require(\"./modules/bsHistory\");\nvar clients = require(\"./modules/bsClients\");\nvar socket = require(\"./modules/bsSocket\");\nvar app = require(\"./services/Pages\");\nvar options = require(\"./services/Options\");\nvar Store = require(\"./modules/bsStore\");\nvar mainCtrl = require(\"./main/controller\");\nvar filter = require(\"./filters\");\nvar directives = require(\"./directives\");\n\n/* jshint ignore:end */\n"],"sourceRoot":""}