2021-10-21 08:12:50 +03:00
! function ( window1 , document1 , undefined ) {
2022-05-04 17:25:28 +03:00
"use strict" ;
2021-07-30 04:11:27 +03:00
function minErr ( module ) {
return function ( ) {
2022-01-14 10:36:48 +03:00
var obj , message , i , code = arguments [ 0 ] , template = arguments [ 1 ] , templateArgs = arguments ;
2022-05-04 17:25:28 +03:00
for ( i = 2 , message = ( message = "[" + ( module ? module + ":" : "" ) + code + "] " + template . replace ( /\{\d+\}/g , function ( match ) {
2021-07-30 04:11:27 +03:00
var arg , index = + match . slice ( 1 , - 1 ) ;
2022-05-04 17:25:28 +03:00
return index + 2 < templateArgs . length ? "function" == typeof ( arg = templateArgs [ index + 2 ] ) ? arg . toString ( ) . replace ( / ?\{[\s\S]*$/ , "" ) : void 0 === arg ? "undefined" : "string" != typeof arg ? toJson ( arg ) : arg : match ;
} ) ) + "\nhttp://errors.angularjs.org/1.2.5/" + ( module ? module + "/" : "" ) + code ; i < arguments . length ; i ++ ) message = message + ( 2 == i ? "?" : "&" ) + "p" + ( i - 2 ) + "=" + encodeURIComponent ( ( obj = arguments [ i ] , "function" == typeof obj ? obj . toString ( ) . replace ( / \{[\s\S]*$/ , "" ) : void 0 === obj ? "undefined" : "string" != typeof obj ? JSON . stringify ( obj ) : obj ) ) ;
2022-06-11 08:27:13 +03:00
return Error ( message ) ;
2021-07-30 04:11:27 +03:00
} ;
}
2021-08-07 11:27:52 +03:00
var promiseWarning , msie , jqLite , jQuery , angularModule , nodeName _ , lowercase = function ( string ) {
2021-07-30 04:11:27 +03:00
return isString ( string ) ? string . toLowerCase ( ) : string ;
} , uppercase = function ( string ) {
return isString ( string ) ? string . toUpperCase ( ) : string ;
2022-06-15 17:36:57 +03:00
} , slice = [ ] . slice , push = [ ] . push , toString = Object . prototype . toString , ngMinErr = minErr ( "ng" ) , angular1 = ( window1 . angular , window1 . angular || ( window1 . angular = { } ) ) , uid = [
2022-05-04 17:25:28 +03:00
"0" ,
"0" ,
"0"
2021-08-03 18:52:47 +03:00
] ;
2021-07-30 04:11:27 +03:00
function isArrayLike ( obj ) {
if ( null == obj || isWindow ( obj ) ) return ! 1 ;
var length = obj . length ;
2022-05-04 17:25:28 +03:00
return 1 === obj . nodeType && ! ! length || isString ( obj ) || isArray ( obj ) || 0 === length || "number" == typeof length && length > 0 && length - 1 in obj ;
2021-07-30 04:11:27 +03:00
}
function forEach ( obj , iterator , context ) {
var key ;
2022-04-12 05:12:10 +03:00
if ( obj ) {
2022-05-04 17:25:28 +03:00
if ( isFunction ( obj ) ) for ( key in obj ) "prototype" != key && "length" != key && "name" != key && obj . hasOwnProperty ( key ) && iterator . call ( context , obj [ key ] , key ) ;
2022-04-12 05:12:10 +03:00
else if ( obj . forEach && obj . forEach !== forEach ) obj . forEach ( iterator , context ) ;
else if ( isArrayLike ( obj ) ) for ( key = 0 ; key < obj . length ; key ++ ) iterator . call ( context , obj [ key ] , key ) ;
else for ( key in obj ) obj . hasOwnProperty ( key ) && iterator . call ( context , obj [ key ] , key ) ;
}
2021-07-30 04:11:27 +03:00
return obj ;
}
function sortedKeys ( obj ) {
var keys = [ ] ;
for ( var key in obj ) obj . hasOwnProperty ( key ) && keys . push ( key ) ;
return keys . sort ( ) ;
}
function reverseParams ( iteratorFn ) {
return function ( value , key ) {
iteratorFn ( key , value ) ;
} ;
}
function nextUid ( ) {
for ( var digit , index = uid . length ; index ; ) {
2022-05-04 17:25:28 +03:00
if ( 57 == ( digit = uid [ -- index ] . charCodeAt ( 0 ) ) ) return uid [ index ] = "A" , uid . join ( "" ) ;
if ( 90 != digit ) return uid [ index ] = String . fromCharCode ( digit + 1 ) , uid . join ( "" ) ;
uid [ index ] = "0" ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
return uid . unshift ( "0" ) , uid . join ( "" ) ;
2021-07-30 04:11:27 +03:00
}
function setHashKey ( obj , h ) {
h ? obj . $$hashKey = h : delete obj . $$hashKey ;
}
function extend ( dst ) {
var h = dst . $$hashKey ;
return forEach ( arguments , function ( obj ) {
obj !== dst && forEach ( obj , function ( value , key ) {
dst [ key ] = value ;
} ) ;
} ) , setHashKey ( dst , h ) , dst ;
}
function int ( str ) {
return parseInt ( str , 10 ) ;
}
function inherit ( parent , extra ) {
2022-01-02 23:54:58 +03:00
return extend ( new ( extend ( function ( ) { } , {
2021-07-30 04:11:27 +03:00
prototype : parent
} ) ) ( ) , extra ) ;
}
2022-01-02 23:54:58 +03:00
function noop ( ) { }
2021-07-30 04:11:27 +03:00
function identity ( $ ) {
return $ ;
}
2022-06-15 17:36:57 +03:00
function valueFn ( value ) {
2021-07-30 04:11:27 +03:00
return function ( ) {
return value ;
} ;
}
function isUndefined ( value ) {
return void 0 === value ;
}
function isDefined ( value ) {
return void 0 !== value ;
}
function isObject ( value ) {
2022-05-04 17:25:28 +03:00
return null != value && "object" == typeof value ;
2021-07-30 04:11:27 +03:00
}
function isString ( value ) {
2022-05-04 17:25:28 +03:00
return "string" == typeof value ;
2021-07-30 04:11:27 +03:00
}
function isNumber ( value ) {
2022-05-04 17:25:28 +03:00
return "number" == typeof value ;
2021-07-30 04:11:27 +03:00
}
function isDate ( value ) {
2022-05-04 17:25:28 +03:00
return "[object Date]" === toString . call ( value ) ;
2021-07-30 04:11:27 +03:00
}
function isArray ( value ) {
2022-05-04 17:25:28 +03:00
return "[object Array]" === toString . call ( value ) ;
2021-07-30 04:11:27 +03:00
}
function isFunction ( value ) {
2022-05-04 17:25:28 +03:00
return "function" == typeof value ;
2021-07-30 04:11:27 +03:00
}
function isRegExp ( value ) {
2022-05-04 17:25:28 +03:00
return "[object RegExp]" === toString . call ( value ) ;
2021-07-30 04:11:27 +03:00
}
function isWindow ( obj ) {
return obj && obj . document && obj . location && obj . alert && obj . setInterval ;
}
function isScope ( obj ) {
return obj && obj . $evalAsync && obj . $watch ;
}
2022-08-26 11:45:49 +03:00
msie = int ( ( /msie (\d+)/ . exec ( lowercase ( navigator . userAgent ) ) || [ ] ) [ 1 ] ) , isNaN ( msie ) && ( msie = int ( ( /trident\/.*; rv:(\d+)/ . exec ( lowercase ( navigator . userAgent ) ) || [ ] ) [ 1 ] ) ) , noop . $inject = [ ] , identity . $inject = [ ] ;
2022-06-15 17:36:57 +03:00
var trim = String . prototype . trim ? function ( value ) {
2021-07-30 04:11:27 +03:00
return isString ( value ) ? value . trim ( ) : value ;
} : function ( value ) {
2022-05-04 17:25:28 +03:00
return isString ( value ) ? value . replace ( /^\s\s*/ , "" ) . replace ( /\s\s*$/ , "" ) : value ;
2021-07-30 04:11:27 +03:00
} ;
function isElement ( node ) {
return ! ! ( node && ( node . nodeName || node . on && node . find ) ) ;
}
function indexOf ( array , obj ) {
if ( array . indexOf ) return array . indexOf ( obj ) ;
for ( var i = 0 ; i < array . length ; i ++ ) if ( obj === array [ i ] ) return i ;
return - 1 ;
}
function arrayRemove ( array , value ) {
var index = indexOf ( array , value ) ;
return index >= 0 && array . splice ( index , 1 ) , value ;
}
function copy ( source , destination ) {
2022-06-15 17:36:57 +03:00
if ( isWindow ( source ) || isScope ( source ) ) throw ngMinErr ( "cpws" , "Can't copy! Making copies of Window or Scope instances is not supported." ) ;
2021-07-30 04:11:27 +03:00
if ( destination ) {
2022-06-15 17:36:57 +03:00
if ( source === destination ) throw ngMinErr ( "cpi" , "Can't copy! Source and destination are identical." ) ;
2021-07-30 04:11:27 +03:00
if ( isArray ( source ) ) {
destination . length = 0 ;
for ( var i = 0 ; i < source . length ; i ++ ) destination . push ( copy ( source [ i ] ) ) ;
} else {
var h = destination . $$hashKey ;
2022-06-15 17:36:57 +03:00
for ( var key in forEach ( destination , function ( value , key ) {
2021-07-30 04:11:27 +03:00
delete destination [ key ] ;
2022-06-15 17:36:57 +03:00
} ) , source ) destination [ key ] = copy ( source [ key ] ) ;
2021-07-30 04:11:27 +03:00
setHashKey ( destination , h ) ;
}
2022-06-11 08:27:13 +03:00
} else destination = source , source && ( isArray ( source ) ? destination = copy ( source , [ ] ) : isDate ( source ) ? destination = new Date ( source . getTime ( ) ) : isRegExp ( source ) ? destination = RegExp ( source . source ) : isObject ( source ) && ( destination = copy ( source , { } ) ) ) ;
2021-07-30 04:11:27 +03:00
return destination ;
}
function equals ( o1 , o2 ) {
if ( o1 === o2 ) return ! 0 ;
if ( null === o1 || null === o2 ) return ! 1 ;
if ( o1 != o1 && o2 != o2 ) return ! 0 ;
2021-08-03 18:52:47 +03:00
var length , key , keySet , t1 = typeof o1 ;
2022-05-04 17:25:28 +03:00
if ( t1 == typeof o2 && "object" == t1 ) {
2022-04-12 05:12:10 +03:00
if ( isArray ( o1 ) ) {
if ( ! isArray ( o2 ) ) return ! 1 ;
if ( ( length = o1 . length ) == o2 . length ) {
for ( key = 0 ; key < length ; key ++ ) if ( ! equals ( o1 [ key ] , o2 [ key ] ) ) return ! 1 ;
return ! 0 ;
}
} else {
if ( isDate ( o1 ) ) return isDate ( o2 ) && o1 . getTime ( ) == o2 . getTime ( ) ;
if ( isRegExp ( o1 ) && isRegExp ( o2 ) ) return o1 . toString ( ) == o2 . toString ( ) ;
if ( isScope ( o1 ) || isScope ( o2 ) || isWindow ( o1 ) || isWindow ( o2 ) || isArray ( o2 ) ) return ! 1 ;
2022-05-04 17:25:28 +03:00
for ( key in keySet = { } , o1 ) if ( ! ( "$" === key . charAt ( 0 ) || isFunction ( o1 [ key ] ) ) ) {
2022-04-12 05:12:10 +03:00
if ( ! equals ( o1 [ key ] , o2 [ key ] ) ) return ! 1 ;
keySet [ key ] = ! 0 ;
}
2022-05-04 17:25:28 +03:00
for ( key in o2 ) if ( ! keySet . hasOwnProperty ( key ) && "$" !== key . charAt ( 0 ) && undefined !== o2 [ key ] && ! isFunction ( o2 [ key ] ) ) return ! 1 ;
2021-07-30 04:11:27 +03:00
return ! 0 ;
}
}
return ! 1 ;
}
function csp ( ) {
2022-05-04 17:25:28 +03:00
return document1 . securityPolicy && document1 . securityPolicy . isActive || document1 . querySelector && ! ! ( document1 . querySelector ( "[ng-csp]" ) || document1 . querySelector ( "[data-ng-csp]" ) ) ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function concat ( array1 , array2 , index ) {
2021-07-30 04:11:27 +03:00
return array1 . concat ( slice . call ( array2 , index ) ) ;
}
function sliceArgs ( args , startIndex ) {
return slice . call ( args , startIndex || 0 ) ;
}
function bind ( self , fn ) {
var curryArgs = arguments . length > 2 ? sliceArgs ( arguments , 2 ) : [ ] ;
return ! isFunction ( fn ) || fn instanceof RegExp ? fn : curryArgs . length ? function ( ) {
return arguments . length ? fn . apply ( self , curryArgs . concat ( slice . call ( arguments , 0 ) ) ) : fn . apply ( self , curryArgs ) ;
} : function ( ) {
return arguments . length ? fn . apply ( self , arguments ) : fn . call ( self ) ;
} ;
}
function toJsonReplacer ( key , value ) {
var val = value ;
2022-05-04 17:25:28 +03:00
return "string" == typeof key && "$" === key . charAt ( 0 ) ? val = undefined : isWindow ( value ) ? val = "$WINDOW" : value && document1 === value ? val = "$DOCUMENT" : isScope ( value ) && ( val = "$SCOPE" ) , val ;
2021-07-30 04:11:27 +03:00
}
function toJson ( obj , pretty ) {
2022-05-04 17:25:28 +03:00
if ( void 0 !== obj ) return JSON . stringify ( obj , toJsonReplacer , pretty ? " " : null ) ;
2021-07-30 04:11:27 +03:00
}
function fromJson ( json ) {
return isString ( json ) ? JSON . parse ( json ) : json ;
}
function toBoolean ( value ) {
if ( value && 0 !== value . length ) {
var v = lowercase ( "" + value ) ;
2022-05-04 17:25:28 +03:00
value = ! ( "f" == v || "0" == v || "false" == v || "no" == v || "n" == v || "[]" == v ) ;
2021-07-30 04:11:27 +03:00
} else value = ! 1 ;
return value ;
}
function startingTag ( element ) {
element = jqLite ( element ) . clone ( ) ;
try {
element . empty ( ) ;
2022-01-02 23:54:58 +03:00
} catch ( e ) { }
2022-05-04 17:25:28 +03:00
var elemHtml = jqLite ( "<div>" ) . append ( element ) . html ( ) ;
2021-07-30 04:11:27 +03:00
try {
return 3 === element [ 0 ] . nodeType ? lowercase ( elemHtml ) : elemHtml . match ( /^(<[^>]+>)/ ) [ 1 ] . replace ( /^<([\w\-]+)/ , function ( match , nodeName ) {
2022-05-04 17:25:28 +03:00
return "<" + lowercase ( nodeName ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2021-09-01 16:11:55 +03:00
} catch ( e1 ) {
2021-07-30 04:11:27 +03:00
return lowercase ( elemHtml ) ;
}
}
function tryDecodeURIComponent ( value ) {
try {
return decodeURIComponent ( value ) ;
2022-01-02 23:54:58 +03:00
} catch ( e ) { }
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function parseKeyValue ( keyValue ) {
2022-01-02 23:54:58 +03:00
var key _value , key , obj = { } ;
2022-06-15 17:36:57 +03:00
return forEach ( ( keyValue || "" ) . split ( "&" ) , function ( keyValue ) {
2022-08-26 11:45:49 +03:00
if ( keyValue && ( key = tryDecodeURIComponent ( ( key _value = keyValue . split ( "=" ) ) [ 0 ] ) , isDefined ( key ) ) ) {
2021-07-30 04:11:27 +03:00
var val = ! isDefined ( key _value [ 1 ] ) || tryDecodeURIComponent ( key _value [ 1 ] ) ;
2021-08-03 18:52:47 +03:00
obj [ key ] ? isArray ( obj [ key ] ) ? obj [ key ] . push ( val ) : obj [ key ] = [
obj [ key ] ,
val
] : obj [ key ] = val ;
2021-07-30 04:11:27 +03:00
}
} ) , obj ;
}
function toKeyValue ( obj ) {
var parts = [ ] ;
return forEach ( obj , function ( value , key ) {
isArray ( value ) ? forEach ( value , function ( arrayValue ) {
2022-05-04 17:25:28 +03:00
parts . push ( encodeUriQuery ( key , ! 0 ) + ( ! 0 === arrayValue ? "" : "=" + encodeUriQuery ( arrayValue , ! 0 ) ) ) ;
} ) : parts . push ( encodeUriQuery ( key , ! 0 ) + ( ! 0 === value ? "" : "=" + encodeUriQuery ( value , ! 0 ) ) ) ;
} ) , parts . length ? parts . join ( "&" ) : "" ;
2021-07-30 04:11:27 +03:00
}
function encodeUriSegment ( val ) {
2022-05-04 17:25:28 +03:00
return encodeUriQuery ( val , ! 0 ) . replace ( /%26/gi , "&" ) . replace ( /%3D/gi , "=" ) . replace ( /%2B/gi , "+" ) ;
2021-07-30 04:11:27 +03:00
}
function encodeUriQuery ( val , pctEncodeSpaces ) {
2022-05-04 17:25:28 +03:00
return encodeURIComponent ( val ) . replace ( /%40/gi , "@" ) . replace ( /%3A/gi , ":" ) . replace ( /%24/g , "$" ) . replace ( /%2C/gi , "," ) . replace ( /%20/g , pctEncodeSpaces ? "%20" : "+" ) ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function bootstrap ( element , modules ) {
2021-07-30 04:11:27 +03:00
var doBootstrap = function ( ) {
2022-08-30 06:22:18 +03:00
if ( ( element = jqLite ( element ) ) . injector ( ) ) {
2022-08-26 11:45:49 +03:00
var tag = element [ 0 ] === document1 ? "document" : startingTag ( element ) ;
throw ngMinErr ( "btstrpd" , "App Already Bootstrapped with this Element '{0}'" , tag ) ;
}
2022-08-30 06:22:18 +03:00
( modules = modules || [ ] ) . unshift ( [
2022-05-04 17:25:28 +03:00
"$provide" ,
2021-10-21 08:12:50 +03:00
function ( $provide ) {
2022-06-15 17:36:57 +03:00
$provide . value ( "$rootElement" , element ) ;
2022-05-04 17:25:28 +03:00
} ,
] ) , modules . unshift ( "ng" ) ;
2022-06-15 17:36:57 +03:00
var injector = createInjector ( modules ) ;
return injector . invoke ( [
2022-05-04 17:25:28 +03:00
"$rootScope" ,
"$rootElement" ,
"$compile" ,
"$injector" ,
"$animate" ,
2021-10-21 08:12:50 +03:00
function ( scope , element , compile , injector , animate ) {
2021-07-30 04:11:27 +03:00
scope . $apply ( function ( ) {
2022-05-04 17:25:28 +03:00
element . data ( "$injector" , injector ) , compile ( element ) ( scope ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2022-05-04 17:25:28 +03:00
} ,
2022-06-15 17:36:57 +03:00
] ) , injector ;
2021-07-30 04:11:27 +03:00
} , NG _DEFER _BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/ ;
2021-10-21 08:12:50 +03:00
if ( window1 && ! NG _DEFER _BOOTSTRAP . test ( window1 . name ) ) return doBootstrap ( ) ;
2022-05-04 17:25:28 +03:00
window1 . name = window1 . name . replace ( NG _DEFER _BOOTSTRAP , "" ) , angular1 . resumeBootstrap = function ( extraModules ) {
2021-07-30 04:11:27 +03:00
forEach ( extraModules , function ( module ) {
modules . push ( module ) ;
} ) , doBootstrap ( ) ;
} ;
}
2021-08-04 13:27:17 +03:00
nodeName _ = msie < 9 ? function ( element ) {
2022-05-04 17:25:28 +03:00
return ( element = element . nodeName ? element : element [ 0 ] ) . scopeName && "HTML" != element . scopeName ? uppercase ( element . scopeName + ":" + element . nodeName ) : element . nodeName ;
2021-08-04 13:27:17 +03:00
} : function ( element ) {
return element . nodeName ? element . nodeName : element [ 0 ] . nodeName ;
} ;
2021-07-30 04:11:27 +03:00
var SNAKE _CASE _REGEXP = /[A-Z]/g ;
function snake _case ( name , separator ) {
2022-05-04 17:25:28 +03:00
return separator = separator || "_" , name . replace ( SNAKE _CASE _REGEXP , function ( letter , pos ) {
return ( pos ? separator : "" ) + letter . toLowerCase ( ) ;
2021-07-30 04:11:27 +03:00
} ) ;
}
function assertArg ( arg , name , reason ) {
2022-06-15 17:36:57 +03:00
if ( ! arg ) throw ngMinErr ( "areq" , "Argument '{0}' is {1}" , name || "?" , reason || "required" ) ;
2021-07-30 04:11:27 +03:00
return arg ;
}
function assertArgFn ( arg , name , acceptArrayAnnotation ) {
2022-05-04 17:25:28 +03:00
return acceptArrayAnnotation && isArray ( arg ) && ( arg = arg [ arg . length - 1 ] ) , assertArg ( isFunction ( arg ) , name , "not a function, got " + ( arg && "object" == typeof arg ? arg . constructor . name || "Object" : typeof arg ) ) , arg ;
2021-07-30 04:11:27 +03:00
}
function assertNotHasOwnProperty ( name , context ) {
2022-06-15 17:36:57 +03:00
if ( "hasOwnProperty" === name ) throw ngMinErr ( "badname" , "hasOwnProperty is not a valid {0} name" , context ) ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function getter ( obj , path , bindFnToScope ) {
2021-07-30 04:11:27 +03:00
if ( ! path ) return obj ;
2022-05-04 17:25:28 +03:00
for ( var key , keys = path . split ( "." ) , lastInstance = obj , len = keys . length , i = 0 ; i < len ; i ++ ) key = keys [ i ] , obj && ( obj = ( lastInstance = obj ) [ key ] ) ;
2021-07-30 04:11:27 +03:00
return ! bindFnToScope && isFunction ( obj ) ? bind ( lastInstance , obj ) : obj ;
}
function getBlockElements ( nodes ) {
var startNode = nodes [ 0 ] , endNode = nodes [ nodes . length - 1 ] ;
if ( startNode === endNode ) return jqLite ( startNode ) ;
2021-08-03 18:52:47 +03:00
var element = startNode , elements = [
element
] ;
2021-07-30 04:11:27 +03:00
do {
if ( ! ( element = element . nextSibling ) ) break ;
elements . push ( element ) ;
} while ( element !== endNode )
return jqLite ( elements ) ;
}
var version = {
2022-05-04 17:25:28 +03:00
full : "1.2.5" ,
2021-07-30 04:11:27 +03:00
major : 1 ,
minor : 2 ,
dot : 5 ,
2022-05-04 17:25:28 +03:00
codeName : "singularity-expansion"
} , jqCache = JQLite . cache = { } , jqName = JQLite . expando = "ng-" + new Date ( ) . getTime ( ) , jqId = 1 , addEventListenerFn = window1 . document . addEventListener ? function ( element , type , fn ) {
2021-07-30 04:11:27 +03:00
element . addEventListener ( type , fn , ! 1 ) ;
} : function ( element , type , fn ) {
2022-05-04 17:25:28 +03:00
element . attachEvent ( "on" + type , fn ) ;
2021-10-21 08:12:50 +03:00
} , removeEventListenerFn = window1 . document . removeEventListener ? function ( element , type , fn ) {
2021-07-30 04:11:27 +03:00
element . removeEventListener ( type , fn , ! 1 ) ;
} : function ( element , type , fn ) {
2022-05-04 17:25:28 +03:00
element . detachEvent ( "on" + type , fn ) ;
} , SPECIAL _CHARS _REGEXP = /([\:\-\_]+(.))/g , MOZ _HACK _REGEXP = /^moz([A-Z])/ , jqLiteMinErr = minErr ( "jqLite" ) ;
2021-07-30 04:11:27 +03:00
function camelCase ( name ) {
return name . replace ( SPECIAL _CHARS _REGEXP , function ( _ , separator , letter , offset ) {
return offset ? letter . toUpperCase ( ) : letter ;
2022-05-04 17:25:28 +03:00
} ) . replace ( MOZ _HACK _REGEXP , "Moz$1" ) ;
2021-07-30 04:11:27 +03:00
}
function jqLitePatchJQueryRemove ( name , dispatchThis , filterElems , getterIfNoArguments ) {
var originalJqFn = jQuery . fn [ name ] ;
function removePatch ( param ) {
2021-08-03 18:52:47 +03:00
var set , setIndex , setLength , element , childIndex , childLength , children , list = filterElems && param ? [
this . filter ( param )
] : [
this
] , fireEvent = dispatchThis ;
2022-05-04 17:25:28 +03:00
if ( ! getterIfNoArguments || null != param ) for ( ; list . length ; ) for ( setIndex = 0 , setLength = ( set = list . shift ( ) ) . length ; setIndex < setLength ; setIndex ++ ) for ( element = jqLite ( set [ setIndex ] ) , fireEvent ? element . triggerHandler ( "$destroy" ) : fireEvent = ! fireEvent , childIndex = 0 , childLength = ( children = element . children ( ) ) . length ; childIndex < childLength ; childIndex ++ ) list . push ( jQuery ( children [ childIndex ] ) ) ;
2021-07-30 04:11:27 +03:00
return originalJqFn . apply ( this , arguments ) ;
}
originalJqFn = originalJqFn . $original || originalJqFn , removePatch . $original = originalJqFn , jQuery . fn [ name ] = removePatch ;
}
function JQLite ( element ) {
if ( element instanceof JQLite ) return element ;
if ( ! ( this instanceof JQLite ) ) {
2022-05-04 17:25:28 +03:00
if ( isString ( element ) && "<" != element . charAt ( 0 ) ) throw jqLiteMinErr ( "nosel" , "Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element" ) ;
2021-07-30 04:11:27 +03:00
return new JQLite ( element ) ;
}
if ( isString ( element ) ) {
2022-05-04 17:25:28 +03:00
var div = document1 . createElement ( "div" ) ;
2022-08-30 06:22:18 +03:00
div . innerHTML = "<div> </div>" + element , div . removeChild ( div . firstChild ) , jqLiteAddNodes ( this , div . childNodes ) , jqLite ( document1 . createDocumentFragment ( ) ) . append ( this ) ;
2021-07-30 04:11:27 +03:00
} else jqLiteAddNodes ( this , element ) ;
}
function jqLiteClone ( element ) {
return element . cloneNode ( ! 0 ) ;
}
function jqLiteDealoc ( element ) {
jqLiteRemoveData ( element ) ;
for ( var i = 0 , children = element . childNodes || [ ] ; i < children . length ; i ++ ) jqLiteDealoc ( children [ i ] ) ;
}
2022-06-15 17:36:57 +03:00
function jqLiteOff ( element , type , fn , unsupported ) {
2022-05-04 17:25:28 +03:00
if ( isDefined ( unsupported ) ) throw jqLiteMinErr ( "offargs" , "jqLite#off() does not support the `selector` argument" ) ;
2022-08-30 06:22:18 +03:00
var events = jqLiteExpandoStore ( element , "events" ) ;
jqLiteExpandoStore ( element , "handle" ) && ( isUndefined ( type ) ? forEach ( events , function ( eventHandler , type ) {
2021-07-30 04:11:27 +03:00
removeEventListenerFn ( element , type , eventHandler ) , delete events [ type ] ;
2022-06-15 17:36:57 +03:00
} ) : forEach ( type . split ( " " ) , function ( type ) {
2021-07-30 04:11:27 +03:00
isUndefined ( fn ) ? ( removeEventListenerFn ( element , type , events [ type ] ) , delete events [ type ] ) : arrayRemove ( events [ type ] || [ ] , fn ) ;
} ) ) ;
}
function jqLiteRemoveData ( element , name ) {
var expandoId = element [ jqName ] , expandoStore = jqCache [ expandoId ] ;
2021-08-03 18:52:47 +03:00
if ( expandoStore ) {
2021-09-16 07:23:33 +03:00
if ( name ) {
delete jqCache [ expandoId ] . data [ name ] ;
return ;
}
2022-05-04 17:25:28 +03:00
expandoStore . handle && ( expandoStore . events . $destroy && expandoStore . handle ( { } , "$destroy" ) , jqLiteOff ( element ) ) , delete jqCache [ expandoId ] , element [ jqName ] = undefined ;
2021-08-03 18:52:47 +03:00
}
2021-07-30 04:11:27 +03:00
}
function jqLiteExpandoStore ( element , key , value ) {
var expandoId = element [ jqName ] , expandoStore = jqCache [ expandoId || - 1 ] ;
if ( ! isDefined ( value ) ) return expandoStore && expandoStore [ key ] ;
2022-01-02 23:54:58 +03:00
expandoStore || ( element [ jqName ] = expandoId = ++ jqId , expandoStore = jqCache [ expandoId ] = { } ) , expandoStore [ key ] = value ;
2021-07-30 04:11:27 +03:00
}
function jqLiteData ( element , key , value ) {
2022-05-04 17:25:28 +03:00
var data = jqLiteExpandoStore ( element , "data" ) , isSetter = isDefined ( value ) , keyDefined = ! isSetter && isDefined ( key ) , isSimpleGetter = keyDefined && ! isObject ( key ) ;
if ( data || isSimpleGetter || jqLiteExpandoStore ( element , "data" , data = { } ) , isSetter ) data [ key ] = value ;
2021-09-08 12:45:39 +03:00
else {
if ( ! keyDefined ) return data ;
if ( isSimpleGetter ) return data && data [ key ] ;
extend ( data , key ) ;
}
2021-07-30 04:11:27 +03:00
}
function jqLiteHasClass ( element , selector ) {
2022-05-04 17:25:28 +03:00
return ! ! element . getAttribute && ( " " + ( element . getAttribute ( "class" ) || "" ) + " " ) . replace ( /[\n\t]/g , " " ) . indexOf ( " " + selector + " " ) > - 1 ;
2021-07-30 04:11:27 +03:00
}
function jqLiteRemoveClass ( element , cssClasses ) {
2022-05-04 17:25:28 +03:00
cssClasses && element . setAttribute && forEach ( cssClasses . split ( " " ) , function ( cssClass ) {
2022-06-15 17:36:57 +03:00
element . setAttribute ( "class" , trim ( ( " " + ( element . getAttribute ( "class" ) || "" ) + " " ) . replace ( /[\n\t]/g , " " ) . replace ( " " + trim ( cssClass ) + " " , " " ) ) ) ;
2021-07-30 04:11:27 +03:00
} ) ;
}
function jqLiteAddClass ( element , cssClasses ) {
if ( cssClasses && element . setAttribute ) {
2022-05-04 17:25:28 +03:00
var existingClasses = ( " " + ( element . getAttribute ( "class" ) || "" ) + " " ) . replace ( /[\n\t]/g , " " ) ;
forEach ( cssClasses . split ( " " ) , function ( cssClass ) {
2022-06-15 17:36:57 +03:00
cssClass = trim ( cssClass ) , - 1 === existingClasses . indexOf ( " " + cssClass + " " ) && ( existingClasses += cssClass + " " ) ;
} ) , element . setAttribute ( "class" , trim ( existingClasses ) ) ;
2021-07-30 04:11:27 +03:00
}
}
function jqLiteAddNodes ( root , elements ) {
if ( elements ) {
2021-08-03 18:52:47 +03:00
elements = ! elements . nodeName && isDefined ( elements . length ) && ! isWindow ( elements ) ? elements : [
elements
] ;
2021-07-30 04:11:27 +03:00
for ( var i = 0 ; i < elements . length ; i ++ ) root . push ( elements [ i ] ) ;
}
}
function jqLiteController ( element , name ) {
2022-05-04 17:25:28 +03:00
return jqLiteInheritedData ( element , "$" + ( name || "ngController" ) + "Controller" ) ;
2021-07-30 04:11:27 +03:00
}
function jqLiteInheritedData ( element , name , value ) {
2022-08-30 06:22:18 +03:00
9 == ( element = jqLite ( element ) ) [ 0 ] . nodeType && ( element = element . find ( "html" ) ) ;
2021-08-03 18:52:47 +03:00
for ( var names = isArray ( name ) ? name : [
name
] ; element . length ; ) {
2021-07-30 04:11:27 +03:00
for ( var i = 0 , ii = names . length ; i < ii ; i ++ ) if ( undefined !== ( value = element . data ( names [ i ] ) ) ) return value ;
element = element . parent ( ) ;
}
}
function jqLiteEmpty ( element ) {
for ( var i = 0 , childNodes = element . childNodes ; i < childNodes . length ; i ++ ) jqLiteDealoc ( childNodes [ i ] ) ;
for ( ; element . firstChild ; ) element . removeChild ( element . firstChild ) ;
}
var JQLitePrototype = JQLite . prototype = {
ready : function ( fn ) {
var fired = ! 1 ;
function trigger ( ) {
fired || ( fired = ! 0 , fn ( ) ) ;
}
2022-05-04 17:25:28 +03:00
"complete" === document1 . readyState ? setTimeout ( trigger ) : ( this . on ( "DOMContentLoaded" , trigger ) , JQLite ( window1 ) . on ( "load" , trigger ) ) ;
2021-07-30 04:11:27 +03:00
} ,
toString : function ( ) {
var value = [ ] ;
return forEach ( this , function ( e ) {
2022-05-04 17:25:28 +03:00
value . push ( "" + e ) ;
} ) , "[" + value . join ( ", " ) + "]" ;
2021-07-30 04:11:27 +03:00
} ,
eq : function ( index ) {
return index >= 0 ? jqLite ( this [ index ] ) : jqLite ( this [ this . length + index ] ) ;
} ,
length : 0 ,
push : push ,
sort : [ ] . sort ,
splice : [ ] . splice
2022-01-02 23:54:58 +03:00
} , BOOLEAN _ATTR = { } ;
2022-05-04 17:25:28 +03:00
forEach ( "multiple,selected,checked,disabled,readOnly,required,open" . split ( "," ) , function ( value ) {
2021-08-04 13:27:17 +03:00
BOOLEAN _ATTR [ lowercase ( value ) ] = value ;
} ) ;
2022-01-02 23:54:58 +03:00
var BOOLEAN _ELEMENTS = { } ;
2021-07-30 04:11:27 +03:00
function getBooleanAttrName ( element , name ) {
var booleanAttr = BOOLEAN _ATTR [ name . toLowerCase ( ) ] ;
return booleanAttr && BOOLEAN _ELEMENTS [ element . nodeName ] && booleanAttr ;
}
function hashKey ( obj ) {
var key , objType = typeof obj ;
2022-05-04 17:25:28 +03:00
return "object" == objType && null !== obj ? "function" == typeof ( key = obj . $$hashKey ) ? key = obj . $$hashKey ( ) : key === undefined && ( key = obj . $$hashKey = nextUid ( ) ) : key = obj , objType + ":" + key ;
2021-07-30 04:11:27 +03:00
}
function HashMap ( array ) {
forEach ( array , this . put , this ) ;
}
2022-05-04 17:25:28 +03:00
forEach ( "input,select,option,textarea,button,form,details" . split ( "," ) , function ( value ) {
2021-08-04 13:27:17 +03:00
BOOLEAN _ELEMENTS [ uppercase ( value ) ] = ! 0 ;
} ) , forEach ( {
data : jqLiteData ,
inheritedData : jqLiteInheritedData ,
scope : function ( element ) {
2022-05-04 17:25:28 +03:00
return jqLite ( element ) . data ( "$scope" ) || jqLiteInheritedData ( element . parentNode || element , [
"$isolateScope" ,
"$scope" ,
2021-08-04 13:27:17 +03:00
] ) ;
} ,
isolateScope : function ( element ) {
2022-05-04 17:25:28 +03:00
return jqLite ( element ) . data ( "$isolateScope" ) || jqLite ( element ) . data ( "$isolateScopeNoTemplate" ) ;
2021-08-04 13:27:17 +03:00
} ,
controller : jqLiteController ,
injector : function ( element ) {
2022-05-04 17:25:28 +03:00
return jqLiteInheritedData ( element , "$injector" ) ;
2021-08-04 13:27:17 +03:00
} ,
removeAttr : function ( element , name ) {
element . removeAttribute ( name ) ;
} ,
hasClass : jqLiteHasClass ,
css : function ( element , name , value ) {
if ( name = camelCase ( name ) , isDefined ( value ) ) element . style [ name ] = value ;
else {
var val ;
2022-05-04 17:25:28 +03:00
return msie <= 8 && "" === ( val = element . currentStyle && element . currentStyle [ name ] ) && ( val = "auto" ) , val = val || element . style [ name ] , msie <= 8 && ( val = "" === val ? undefined : val ) , val ;
2021-08-04 13:27:17 +03:00
}
} ,
attr : function ( element , name , value ) {
var lowercasedName = lowercase ( name ) ;
if ( BOOLEAN _ATTR [ lowercasedName ] ) {
if ( ! isDefined ( value ) ) return element [ name ] || ( element . attributes . getNamedItem ( name ) || noop ) . specified ? lowercasedName : undefined ;
value ? ( element [ name ] = ! 0 , element . setAttribute ( name , lowercasedName ) ) : ( element [ name ] = ! 1 , element . removeAttribute ( lowercasedName ) ) ;
} else if ( isDefined ( value ) ) element . setAttribute ( name , value ) ;
else if ( element . getAttribute ) {
var ret = element . getAttribute ( name , 2 ) ;
return null === ret ? undefined : ret ;
}
} ,
prop : function ( element , name , value ) {
if ( ! isDefined ( value ) ) return element [ name ] ;
element [ name ] = value ;
} ,
text : function ( ) {
2022-05-18 10:25:25 +03:00
var NODE _TYPE _TEXT _PROPERTY = [ ] ;
return msie < 9 ? ( NODE _TYPE _TEXT _PROPERTY [ 1 ] = "innerText" , NODE _TYPE _TEXT _PROPERTY [ 3 ] = "nodeValue" ) : NODE _TYPE _TEXT _PROPERTY [ 1 ] = NODE _TYPE _TEXT _PROPERTY [ 3 ] = "textContent" , getText . $dv = "" , getText ;
2021-08-04 13:27:17 +03:00
function getText ( element , value ) {
var textProp = NODE _TYPE _TEXT _PROPERTY [ element . nodeType ] ;
2022-05-04 17:25:28 +03:00
if ( isUndefined ( value ) ) return textProp ? element [ textProp ] : "" ;
2021-08-04 13:27:17 +03:00
element [ textProp ] = value ;
}
} ( ) ,
val : function ( element , value ) {
if ( isUndefined ( value ) ) {
2022-05-04 17:25:28 +03:00
if ( "SELECT" === nodeName _ ( element ) && element . multiple ) {
2021-08-04 13:27:17 +03:00
var result = [ ] ;
return forEach ( element . options , function ( option ) {
option . selected && result . push ( option . value || option . text ) ;
} ) , 0 === result . length ? null : result ;
}
return element . value ;
}
element . value = value ;
} ,
html : function ( element , value ) {
if ( isUndefined ( value ) ) return element . innerHTML ;
for ( var i = 0 , childNodes = element . childNodes ; i < childNodes . length ; i ++ ) jqLiteDealoc ( childNodes [ i ] ) ;
element . innerHTML = value ;
} ,
empty : jqLiteEmpty
} , function ( fn , name ) {
JQLite . prototype [ name ] = function ( arg1 , arg2 ) {
var i , key ;
if ( fn !== jqLiteEmpty && ( 2 == fn . length && fn !== jqLiteHasClass && fn !== jqLiteController ? arg1 : arg2 ) === undefined ) {
if ( isObject ( arg1 ) ) {
for ( i = 0 ; i < this . length ; i ++ ) if ( fn === jqLiteData ) fn ( this [ i ] , arg1 ) ;
else for ( key in arg1 ) fn ( this [ i ] , key , arg1 [ key ] ) ;
return this ;
}
for ( var value = fn . $dv , jj = value === undefined ? Math . min ( this . length , 1 ) : this . length , j = 0 ; j < jj ; j ++ ) {
var nodeValue = fn ( this [ j ] , arg1 , arg2 ) ;
value = value ? value + nodeValue : nodeValue ;
}
return value ;
}
for ( i = 0 ; i < this . length ; i ++ ) fn ( this [ i ] , arg1 , arg2 ) ;
return this ;
} ;
} ) , forEach ( {
removeData : jqLiteRemoveData ,
dealoc : jqLiteDealoc ,
2022-06-15 17:36:57 +03:00
on : function onFn ( element , type , fn , unsupported ) {
2022-05-04 17:25:28 +03:00
if ( isDefined ( unsupported ) ) throw jqLiteMinErr ( "onargs" , "jqLite#on() does not support the `selector` or `eventData` parameters" ) ;
2022-06-15 17:36:57 +03:00
var element1 , events , eventHandler , events1 = jqLiteExpandoStore ( element , "events" ) , handle = jqLiteExpandoStore ( element , "handle" ) ;
2022-09-14 15:57:18 +03:00
events1 || jqLiteExpandoStore ( element , "events" , events1 = { } ) , handle || jqLiteExpandoStore ( element , "handle" , ( events = events1 , ( eventHandler = function ( event , type ) {
2021-09-08 12:45:39 +03:00
if ( event . preventDefault || ( event . preventDefault = function ( ) {
event . returnValue = ! 1 ;
} ) , event . stopPropagation || ( event . stopPropagation = function ( ) {
event . cancelBubble = ! 0 ;
2021-10-21 08:12:50 +03:00
} ) , event . target || ( event . target = event . srcElement || document1 ) , isUndefined ( event . defaultPrevented ) ) {
2021-09-08 12:45:39 +03:00
var prevent = event . preventDefault ;
event . preventDefault = function ( ) {
event . defaultPrevented = ! 0 , prevent . call ( event ) ;
} , event . defaultPrevented = ! 1 ;
}
event . isDefaultPrevented = function ( ) {
return event . defaultPrevented || ! 1 === event . returnValue ;
2021-10-10 06:47:11 +03:00
} , forEach ( events [ type || event . type ] , function ( fn ) {
2022-09-13 06:52:47 +03:00
fn . call ( element , event ) ;
2021-09-08 12:45:39 +03:00
} ) , msie <= 8 ? ( event . preventDefault = null , event . stopPropagation = null , event . isDefaultPrevented = null ) : ( delete event . preventDefault , delete event . stopPropagation , delete event . isDefaultPrevented ) ;
2022-09-14 15:57:18 +03:00
} ) . elem = element , handle = eventHandler ) ) , forEach ( type . split ( " " ) , function ( type ) {
2021-10-06 10:12:11 +03:00
var eventFns = events1 [ type ] ;
2021-08-04 13:27:17 +03:00
if ( ! eventFns ) {
2022-05-04 17:25:28 +03:00
if ( "mouseenter" == type || "mouseleave" == type ) {
2021-10-21 08:12:50 +03:00
var contains = document1 . body . contains || document1 . body . compareDocumentPosition ? function ( a , b ) {
2021-08-04 13:27:17 +03:00
var adown = 9 === a . nodeType ? a . documentElement : a , bup = b && b . parentNode ;
return a === bup || ! ! ( bup && 1 === bup . nodeType && ( adown . contains ? adown . contains ( bup ) : a . compareDocumentPosition && 16 & a . compareDocumentPosition ( bup ) ) ) ;
} : function ( a , b ) {
if ( b ) {
for ( ; b = b . parentNode ; ) if ( b === a ) return ! 0 ;
}
return ! 1 ;
} ;
2021-10-06 10:12:11 +03:00
events1 [ type ] = [ ] , onFn ( element , {
2021-08-04 13:27:17 +03:00
mouseleave : "mouseout" ,
mouseenter : "mouseover"
} [ type ] , function ( event ) {
2022-08-05 16:25:28 +03:00
var related = event . relatedTarget ;
related && ( related === this || contains ( this , related ) ) || handle ( event , type ) ;
2021-08-04 13:27:17 +03:00
} ) ;
2021-10-06 10:12:11 +03:00
} else addEventListenerFn ( element , type , handle ) , events1 [ type ] = [ ] ;
eventFns = events1 [ type ] ;
2021-08-04 13:27:17 +03:00
}
2022-06-15 17:36:57 +03:00
eventFns . push ( fn ) ;
2021-08-04 13:27:17 +03:00
} ) ;
} ,
off : jqLiteOff ,
replaceWith : function ( element , replaceNode ) {
var index , parent = element . parentNode ;
jqLiteDealoc ( element ) , forEach ( new JQLite ( replaceNode ) , function ( node ) {
index ? parent . insertBefore ( node , index . nextSibling ) : parent . replaceChild ( node , element ) , index = node ;
} ) ;
} ,
2022-06-15 17:36:57 +03:00
children : function ( element ) {
2021-08-04 13:27:17 +03:00
var children = [ ] ;
2022-06-15 17:36:57 +03:00
return forEach ( element . childNodes , function ( element ) {
2021-08-04 13:27:17 +03:00
1 === element . nodeType && children . push ( element ) ;
} ) , children ;
} ,
contents : function ( element ) {
return element . childNodes || [ ] ;
} ,
append : function ( element , node ) {
forEach ( new JQLite ( node ) , function ( child ) {
( 1 === element . nodeType || 11 === element . nodeType ) && element . appendChild ( child ) ;
} ) ;
} ,
prepend : function ( element , node ) {
if ( 1 === element . nodeType ) {
var index = element . firstChild ;
forEach ( new JQLite ( node ) , function ( child ) {
element . insertBefore ( child , index ) ;
} ) ;
}
} ,
wrap : function ( element , wrapNode ) {
wrapNode = jqLite ( wrapNode ) [ 0 ] ;
var parent = element . parentNode ;
parent && parent . replaceChild ( wrapNode , element ) , wrapNode . appendChild ( element ) ;
} ,
remove : function ( element ) {
jqLiteDealoc ( element ) ;
var parent = element . parentNode ;
parent && parent . removeChild ( element ) ;
} ,
after : function ( element , newElement ) {
var index = element , parent = element . parentNode ;
forEach ( new JQLite ( newElement ) , function ( node ) {
parent . insertBefore ( node , index . nextSibling ) , index = node ;
} ) ;
} ,
addClass : jqLiteAddClass ,
removeClass : jqLiteRemoveClass ,
toggleClass : function ( element , selector , condition ) {
isUndefined ( condition ) && ( condition = ! jqLiteHasClass ( element , selector ) ) , ( condition ? jqLiteAddClass : jqLiteRemoveClass ) ( element , selector ) ;
} ,
parent : function ( element ) {
var parent = element . parentNode ;
return parent && 11 !== parent . nodeType ? parent : null ;
} ,
next : function ( element ) {
if ( element . nextElementSibling ) return element . nextElementSibling ;
for ( var elm = element . nextSibling ; null != elm && 1 !== elm . nodeType ; ) elm = elm . nextSibling ;
return elm ;
} ,
find : function ( element , selector ) {
return element . getElementsByTagName ? element . getElementsByTagName ( selector ) : [ ] ;
} ,
clone : jqLiteClone ,
triggerHandler : function ( element , eventName , eventData ) {
2022-05-04 17:25:28 +03:00
var eventFns = ( jqLiteExpandoStore ( element , "events" ) || { } ) [ eventName ] ;
2021-08-04 13:27:17 +03:00
eventData = eventData || [ ] ;
var event = [
{
preventDefault : noop ,
stopPropagation : noop
2022-05-04 17:25:28 +03:00
} ,
2021-08-04 13:27:17 +03:00
] ;
forEach ( eventFns , function ( fn ) {
fn . apply ( element , event . concat ( eventData ) ) ;
} ) ;
}
} , function ( fn , name ) {
JQLite . prototype [ name ] = function ( arg1 , arg2 , arg3 ) {
for ( var value , i = 0 ; i < this . length ; i ++ ) isUndefined ( value ) ? isDefined ( value = fn ( this [ i ] , arg1 , arg2 , arg3 ) ) && ( value = jqLite ( value ) ) : jqLiteAddNodes ( value , fn ( this [ i ] , arg1 , arg2 , arg3 ) ) ;
return isDefined ( value ) ? value : this ;
} , JQLite . prototype . bind = JQLite . prototype . on , JQLite . prototype . unbind = JQLite . prototype . off ;
} ) , HashMap . prototype = {
put : function ( key , value ) {
this [ hashKey ( key ) ] = value ;
} ,
get : function ( key ) {
return this [ hashKey ( key ) ] ;
} ,
remove : function ( key ) {
var value = this [ key = hashKey ( key ) ] ;
return delete this [ key ] , value ;
}
} ;
2022-06-15 17:36:57 +03:00
var FN _ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m , FN _ARG _SPLIT = /,/ , FN _ARG = /^\s*(_?)(\S+?)\1\s*$/ , STRIP _COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm , $injectorMinErr = minErr ( "$injector" ) ;
2021-07-30 04:11:27 +03:00
function annotate ( fn ) {
var $inject , last ;
2022-05-04 17:25:28 +03:00
return "function" == typeof fn ? ( $inject = fn . $inject ) || ( $inject = [ ] , fn . length && forEach ( fn . toString ( ) . replace ( STRIP _COMMENTS , "" ) . match ( FN _ARGS ) [ 1 ] . split ( FN _ARG _SPLIT ) , function ( arg ) {
2021-07-30 04:11:27 +03:00
arg . replace ( FN _ARG , function ( all , underscore , name ) {
$inject . push ( name ) ;
} ) ;
2022-08-30 06:22:18 +03:00
} ) , fn . $inject = $inject ) : isArray ( fn ) ? ( assertArgFn ( fn [ last = fn . length - 1 ] , "fn" ) , $inject = fn . slice ( 0 , last ) ) : assertArgFn ( fn , "fn" , ! 0 ) , $inject ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function createInjector ( modulesToLoad ) {
2022-05-18 10:25:25 +03:00
var INSTANTIATING = { } , providerSuffix = "Provider" , path = [ ] , loadedModules = new HashMap ( ) , providerCache = {
$provide : {
2022-06-15 17:36:57 +03:00
provider : supportObject ( provider ) ,
factory : supportObject ( factory ) ,
2022-05-18 10:25:25 +03:00
service : supportObject ( function ( name , constructor ) {
2022-06-15 17:36:57 +03:00
return factory ( name , [
2022-05-18 10:25:25 +03:00
"$injector" ,
function ( $injector ) {
return $injector . instantiate ( constructor ) ;
} ,
] ) ;
} ) ,
value : supportObject ( function ( name , val ) {
2022-06-15 17:36:57 +03:00
return factory ( name , valueFn ( val ) ) ;
2022-05-18 10:25:25 +03:00
} ) ,
constant : supportObject ( function ( name , value ) {
assertNotHasOwnProperty ( name , "constant" ) , providerCache [ name ] = value , instanceCache [ name ] = value ;
} ) ,
decorator : function ( serviceName , decorFn ) {
var origProvider = providerInjector . get ( serviceName + providerSuffix ) , orig$get = origProvider . $get ;
origProvider . $get = function ( ) {
var origInstance = instanceInjector . invoke ( orig$get , origProvider ) ;
return instanceInjector . invoke ( decorFn , null , {
$delegate : origInstance
} ) ;
} ;
}
}
} , providerInjector = providerCache . $injector = createInternalInjector ( providerCache , function ( ) {
2022-06-15 17:36:57 +03:00
throw $injectorMinErr ( "unpr" , "Unknown provider: {0}" , path . join ( " <- " ) ) ;
2022-05-18 10:25:25 +03:00
} ) , instanceCache = { } , instanceInjector = instanceCache . $injector = createInternalInjector ( instanceCache , function ( servicename ) {
var provider = providerInjector . get ( servicename + providerSuffix ) ;
return instanceInjector . invoke ( provider . $get , provider ) ;
} ) ;
2022-09-01 13:36:16 +03:00
return forEach ( function loadModules ( modulesToLoad ) {
var moduleFn , invokeQueue , i , ii , runBlocks = [ ] ;
return forEach ( modulesToLoad , function ( module ) {
if ( ! loadedModules . get ( module ) ) {
loadedModules . put ( module , ! 0 ) ;
try {
if ( isString ( module ) ) for ( moduleFn = angularModule ( module ) , runBlocks = runBlocks . concat ( loadModules ( moduleFn . requires ) ) . concat ( moduleFn . _runBlocks ) , invokeQueue = moduleFn . _invokeQueue , i = 0 , ii = invokeQueue . length ; i < ii ; i ++ ) {
var invokeArgs = invokeQueue [ i ] , provider = providerInjector . get ( invokeArgs [ 0 ] ) ;
provider [ invokeArgs [ 1 ] ] . apply ( provider , invokeArgs [ 2 ] ) ;
}
else isFunction ( module ) ? runBlocks . push ( providerInjector . invoke ( module ) ) : isArray ( module ) ? runBlocks . push ( providerInjector . invoke ( module ) ) : assertArgFn ( module , "module" ) ;
} catch ( e ) {
throw isArray ( module ) && ( module = module [ module . length - 1 ] ) , e . message && e . stack && - 1 == e . stack . indexOf ( e . message ) && ( e = e . message + "\n" + e . stack ) , $injectorMinErr ( "modulerr" , "Failed to instantiate module {0} due to:\n{1}" , module , e . stack || e . message || e ) ;
}
}
} ) , runBlocks ;
} ( modulesToLoad ) , function ( fn ) {
2022-05-18 10:25:25 +03:00
instanceInjector . invoke ( fn || noop ) ;
} ) , instanceInjector ;
2021-07-30 04:11:27 +03:00
function supportObject ( delegate ) {
return function ( key , value ) {
if ( ! isObject ( key ) ) return delegate ( key , value ) ;
forEach ( key , reverseParams ( delegate ) ) ;
} ;
}
2022-06-15 17:36:57 +03:00
function provider ( name , provider _ ) {
if ( assertNotHasOwnProperty ( name , "service" ) , ( isFunction ( provider _ ) || isArray ( provider _ ) ) && ( provider _ = providerInjector . instantiate ( provider _ ) ) , ! provider _ . $get ) throw $injectorMinErr ( "pget" , "Provider '{0}' must define $get factory method." , name ) ;
2021-11-15 08:03:03 +03:00
return providerCache [ name + providerSuffix ] = provider _ ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function factory ( name , factoryFn ) {
return provider ( name , {
2021-07-30 04:11:27 +03:00
$get : factoryFn
} ) ;
}
function createInternalInjector ( cache , factory ) {
function getService ( serviceName ) {
if ( cache . hasOwnProperty ( serviceName ) ) {
2022-06-15 17:36:57 +03:00
if ( cache [ serviceName ] === INSTANTIATING ) throw $injectorMinErr ( "cdep" , "Circular dependency found: {0}" , path . join ( " <- " ) ) ;
2021-07-30 04:11:27 +03:00
return cache [ serviceName ] ;
}
try {
return path . unshift ( serviceName ) , cache [ serviceName ] = INSTANTIATING , cache [ serviceName ] = factory ( serviceName ) ;
} finally {
path . shift ( ) ;
}
}
function invoke ( fn , self , locals ) {
var length , i , key , args = [ ] , $inject = annotate ( fn ) ;
for ( i = 0 , length = $inject . length ; i < length ; i ++ ) {
2022-08-30 06:22:18 +03:00
if ( "string" != typeof ( key = $inject [ i ] ) ) throw $injectorMinErr ( "itkn" , "Incorrect injection token! Expected service name as string, got {0}" , key ) ;
2021-07-30 04:11:27 +03:00
args . push ( locals && locals . hasOwnProperty ( key ) ? locals [ key ] : getService ( key ) ) ;
}
return fn . $inject || ( fn = fn [ length ] ) , fn . apply ( self , args ) ;
}
return {
invoke : invoke ,
instantiate : function ( Type , locals ) {
2022-01-02 23:54:58 +03:00
var instance , returnedValue , Constructor = function ( ) { } ;
2022-05-09 19:36:40 +03:00
return Constructor . prototype = ( isArray ( Type ) ? Type [ Type . length - 1 ] : Type ) . prototype , returnedValue = invoke ( Type , instance = new Constructor ( ) , locals ) , isObject ( returnedValue ) || isFunction ( returnedValue ) ? returnedValue : instance ;
2021-07-30 04:11:27 +03:00
} ,
get : getService ,
annotate : annotate ,
has : function ( name ) {
2021-11-15 08:03:03 +03:00
return providerCache . hasOwnProperty ( name + providerSuffix ) || cache . hasOwnProperty ( name ) ;
2021-07-30 04:11:27 +03:00
}
} ;
}
}
function $AnchorScrollProvider ( ) {
var autoScrollingEnabled = ! 0 ;
this . disableAutoScrolling = function ( ) {
autoScrollingEnabled = ! 1 ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$window" ,
"$location" ,
"$rootScope" ,
2021-10-21 08:12:50 +03:00
function ( $window , $location , $rootScope ) {
2022-06-15 17:36:57 +03:00
var document1 = $window . document ;
2021-07-30 04:11:27 +03:00
function scroll ( ) {
2022-03-03 22:18:43 +03:00
var list , result , elm , hash = $location . hash ( ) ;
2022-09-14 15:57:18 +03:00
hash ? ( elm = document1 . getElementById ( hash ) ) ? elm . scrollIntoView ( ) : ( list = document1 . getElementsByName ( hash ) , result = null , forEach ( list , function ( element ) {
2022-05-04 17:25:28 +03:00
result || "a" !== lowercase ( element . nodeName ) || ( result = element ) ;
2022-09-14 15:57:18 +03:00
} ) , elm = result ) ? elm . scrollIntoView ( ) : "top" === hash && $window . scrollTo ( 0 , 0 ) : $window . scrollTo ( 0 , 0 ) ;
2021-07-30 04:11:27 +03:00
}
return autoScrollingEnabled && $rootScope . $watch ( function ( ) {
return $location . hash ( ) ;
} , function ( ) {
$rootScope . $evalAsync ( scroll ) ;
} ) , scroll ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
var $animateMinErr = minErr ( "$animate" ) , $AnimateProvider = [
"$provide" ,
2021-10-21 08:12:50 +03:00
function ( $provide ) {
2022-01-02 23:54:58 +03:00
this . $$selectors = { } , this . register = function ( name , factory ) {
2022-05-04 17:25:28 +03:00
var key = name + "-animation" ;
if ( name && "." != name . charAt ( 0 ) ) throw $animateMinErr ( "notcsel" , "Expecting class selector starting with '.' got '{0}'." , name ) ;
2021-07-30 04:11:27 +03:00
this . $$selectors [ name . substr ( 1 ) ] = key , $provide . factory ( key , factory ) ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$timeout" ,
2021-10-21 08:12:50 +03:00
function ( $timeout ) {
2021-07-30 04:11:27 +03:00
return {
enter : function ( element , parent , after , done ) {
after ? after . after ( element ) : ( parent && parent [ 0 ] || ( parent = after . parent ( ) ) , parent . append ( element ) ) , done && $timeout ( done , 0 , ! 1 ) ;
} ,
leave : function ( element , done ) {
element . remove ( ) , done && $timeout ( done , 0 , ! 1 ) ;
} ,
move : function ( element , parent , after , done ) {
this . enter ( element , parent , after , done ) ;
} ,
2022-06-15 17:36:57 +03:00
addClass : function ( element , className , done ) {
className = isString ( className ) ? className : isArray ( className ) ? className . join ( " " ) : "" , forEach ( element , function ( element ) {
2021-10-10 06:47:11 +03:00
jqLiteAddClass ( element , className ) ;
2021-07-30 04:11:27 +03:00
} ) , done && $timeout ( done , 0 , ! 1 ) ;
} ,
2022-06-15 17:36:57 +03:00
removeClass : function ( element , className , done ) {
className = isString ( className ) ? className : isArray ( className ) ? className . join ( " " ) : "" , forEach ( element , function ( element ) {
2021-10-10 06:47:11 +03:00
jqLiteRemoveClass ( element , className ) ;
2021-07-30 04:11:27 +03:00
} ) , done && $timeout ( done , 0 , ! 1 ) ;
} ,
enabled : noop
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2022-06-15 17:36:57 +03:00
function Browser ( window1 , document1 , $log , $sniffer ) {
var self = this , rawDocument = document1 [ 0 ] , location = window1 . location , history = window1 . history , setTimeout1 = window1 . setTimeout , clearTimeout = window1 . clearTimeout , pendingDeferIds = { } ;
2021-08-04 13:27:17 +03:00
self . isMock = ! 1 ;
var outstandingRequestCount = 0 , outstandingRequestCallbacks = [ ] ;
2021-07-30 04:11:27 +03:00
function completeOutstandingRequest ( fn ) {
try {
fn . apply ( null , sliceArgs ( arguments , 1 ) ) ;
} finally {
2022-04-03 16:13:15 +03:00
if ( 0 == -- outstandingRequestCount ) for ( ; outstandingRequestCallbacks . length ; ) try {
2021-07-30 04:11:27 +03:00
outstandingRequestCallbacks . pop ( ) ( ) ;
} catch ( e ) {
$log . error ( e ) ;
}
}
}
2021-08-04 13:27:17 +03:00
self . $$completeOutstandingRequest = completeOutstandingRequest , self . $$incOutstandingRequestCount = function ( ) {
outstandingRequestCount ++ ;
} , self . notifyWhenNoOutstandingRequests = function ( callback ) {
forEach ( pollFns , function ( pollFn ) {
pollFn ( ) ;
} ) , 0 === outstandingRequestCount ? callback ( ) : outstandingRequestCallbacks . push ( callback ) ;
} ;
2021-07-30 04:11:27 +03:00
var pollTimeout , pollFns = [ ] ;
2021-09-08 12:45:39 +03:00
self . addPollFn = function ( fn ) {
2022-08-02 14:37:40 +03:00
var setTimeout2 ;
2022-09-13 06:52:47 +03:00
return isUndefined ( pollTimeout ) && function check ( ) {
2022-08-17 16:06:01 +03:00
forEach ( pollFns , function ( pollFn ) {
pollFn ( ) ;
2022-09-13 06:52:47 +03:00
} ) , pollTimeout = setTimeout1 ( check , 100 ) ;
} ( ) , pollFns . push ( fn ) , fn ;
2021-08-04 13:27:17 +03:00
} ;
2022-06-15 17:36:57 +03:00
var lastBrowserUrl = location . href , baseElement = document1 . find ( "base" ) , newLocation = null ;
2021-08-04 13:27:17 +03:00
self . url = function ( url , replace ) {
2022-06-15 17:36:57 +03:00
return ( location !== window1 . location && ( location = window1 . location ) , url ) ? lastBrowserUrl != url ? ( lastBrowserUrl = url , $sniffer . history ? replace ? history . replaceState ( null , "" , url ) : ( history . pushState ( null , "" , url ) , baseElement . attr ( "href" , baseElement . attr ( "href" ) ) ) : ( newLocation = url , replace ? location . replace ( url ) : location . href = url ) , self ) : void 0 : newLocation || location . href . replace ( /%27/g , "'" ) ;
2021-08-04 13:27:17 +03:00
} ;
var urlChangeListeners = [ ] , urlChangeInit = ! 1 ;
2021-07-30 04:11:27 +03:00
function fireUrlChange ( ) {
newLocation = null , lastBrowserUrl != self . url ( ) && ( lastBrowserUrl = self . url ( ) , forEach ( urlChangeListeners , function ( listener ) {
listener ( self . url ( ) ) ;
} ) ) ;
}
2021-08-04 13:27:17 +03:00
self . onUrlChange = function ( callback ) {
2022-06-15 17:36:57 +03:00
return urlChangeInit || ( $sniffer . history && jqLite ( window1 ) . on ( "popstate" , fireUrlChange ) , $sniffer . hashchange ? jqLite ( window1 ) . on ( "hashchange" , fireUrlChange ) : self . addPollFn ( fireUrlChange ) , urlChangeInit = ! 0 ) , urlChangeListeners . push ( callback ) , callback ;
2021-07-30 04:11:27 +03:00
} , self . baseHref = function ( ) {
2022-05-04 17:25:28 +03:00
var href = baseElement . attr ( "href" ) ;
return href ? href . replace ( /^https?\:\/\/[^\/]*/ , "" ) : "" ;
2021-08-04 13:27:17 +03:00
} ;
2022-05-04 17:25:28 +03:00
var lastCookies = { } , lastCookieString = "" , cookiePath = self . baseHref ( ) ;
2021-08-04 13:27:17 +03:00
self . cookies = function ( name , value ) {
2021-07-30 04:11:27 +03:00
var cookieLength , cookieArray , cookie , i , index ;
2022-05-04 17:25:28 +03:00
if ( name ) value === undefined ? rawDocument . cookie = escape ( name ) + "=;path=" + cookiePath + ";expires=Thu, 01 Jan 1970 00:00:00 GMT" : isString ( value ) && ( cookieLength = ( rawDocument . cookie = escape ( name ) + "=" + escape ( value ) + ";path=" + cookiePath ) . length + 1 ) > 4096 && $log . warn ( "Cookie '" + name + "' possibly not set or overflowed because it was too large (" + cookieLength + " > 4096 bytes)!" ) ;
2021-07-30 04:11:27 +03:00
else {
2022-05-04 17:25:28 +03:00
if ( rawDocument . cookie !== lastCookieString ) for ( i = 0 , cookieArray = ( lastCookieString = rawDocument . cookie ) . split ( "; " ) , lastCookies = { } ; i < cookieArray . length ; i ++ ) ( index = ( cookie = cookieArray [ i ] ) . indexOf ( "=" ) ) > 0 && undefined === lastCookies [ name = unescape ( cookie . substring ( 0 , index ) ) ] && ( lastCookies [ name ] = unescape ( cookie . substring ( index + 1 ) ) ) ;
2021-07-30 04:11:27 +03:00
return lastCookies ;
}
} , self . defer = function ( fn , delay ) {
var timeoutId ;
2021-10-21 08:12:50 +03:00
return outstandingRequestCount ++ , pendingDeferIds [ timeoutId = setTimeout1 ( function ( ) {
2021-07-30 04:11:27 +03:00
delete pendingDeferIds [ timeoutId ] , completeOutstandingRequest ( fn ) ;
} , delay || 0 ) ] = ! 0 , timeoutId ;
} , self . defer . cancel = function ( deferId ) {
return ! ! pendingDeferIds [ deferId ] && ( delete pendingDeferIds [ deferId ] , clearTimeout ( deferId ) , completeOutstandingRequest ( noop ) , ! 0 ) ;
} ;
}
function $BrowserProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$window" ,
"$log" ,
"$sniffer" ,
"$document" ,
2021-10-21 08:12:50 +03:00
function ( $window , $log , $sniffer , $document ) {
2021-07-30 04:11:27 +03:00
return new Browser ( $window , $document , $log , $sniffer ) ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $CacheFactoryProvider ( ) {
this . $get = function ( ) {
2022-01-02 23:54:58 +03:00
var caches = { } ;
2021-07-30 04:11:27 +03:00
function cacheFactory ( cacheId , options ) {
2022-05-04 17:25:28 +03:00
if ( cacheId in caches ) throw minErr ( "$cacheFactory" ) ( "iid" , "CacheId '{0}' is already taken!" , cacheId ) ;
2022-01-02 23:54:58 +03:00
var size = 0 , stats = extend ( { } , options , {
2021-07-30 04:11:27 +03:00
id : cacheId
2022-01-02 23:54:58 +03:00
} ) , data = { } , capacity = options && options . capacity || Number . MAX _VALUE , lruHash = { } , freshEnd = null , staleEnd = null ;
2021-07-30 04:11:27 +03:00
return caches [ cacheId ] = {
put : function ( key , value ) {
if ( refresh ( lruHash [ key ] || ( lruHash [ key ] = {
key : key
} ) ) , ! isUndefined ( value ) ) return ! ( key in data ) && size ++ , data [ key ] = value , size > capacity && this . remove ( staleEnd . key ) , value ;
} ,
get : function ( key ) {
var lruEntry = lruHash [ key ] ;
if ( lruEntry ) return refresh ( lruEntry ) , data [ key ] ;
} ,
remove : function ( key ) {
var lruEntry = lruHash [ key ] ;
2022-03-21 14:06:25 +03:00
lruEntry && ( lruEntry == freshEnd && ( freshEnd = lruEntry . p ) , lruEntry == staleEnd && ( staleEnd = lruEntry . n ) , link ( lruEntry . n , lruEntry . p ) , delete lruHash [ key ] , delete data [ key ] , size -- ) ;
2021-07-30 04:11:27 +03:00
} ,
removeAll : function ( ) {
2022-01-02 23:54:58 +03:00
data = { } , size = 0 , lruHash = { } , freshEnd = staleEnd = null ;
2021-07-30 04:11:27 +03:00
} ,
destroy : function ( ) {
data = null , stats = null , lruHash = null , delete caches [ cacheId ] ;
} ,
info : function ( ) {
2022-01-02 23:54:58 +03:00
return extend ( { } , stats , {
2021-07-30 04:11:27 +03:00
size : size
} ) ;
}
} ;
2022-05-18 10:25:25 +03:00
function refresh ( entry ) {
entry != freshEnd && ( staleEnd ? staleEnd == entry && ( staleEnd = entry . n ) : staleEnd = entry , link ( entry . n , entry . p ) , link ( entry , freshEnd ) , ( freshEnd = entry ) . n = null ) ;
}
function link ( nextEntry , prevEntry ) {
nextEntry != prevEntry && ( nextEntry && ( nextEntry . p = prevEntry ) , prevEntry && ( prevEntry . n = nextEntry ) ) ;
}
2021-07-30 04:11:27 +03:00
}
return cacheFactory . info = function ( ) {
2022-01-02 23:54:58 +03:00
var info = { } ;
2021-07-30 04:11:27 +03:00
return forEach ( caches , function ( cache , cacheId ) {
info [ cacheId ] = cache . info ( ) ;
} ) , info ;
} , cacheFactory . get = function ( cacheId ) {
return caches [ cacheId ] ;
} , cacheFactory ;
} ;
}
function $TemplateCacheProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$cacheFactory" ,
2021-10-21 08:12:50 +03:00
function ( $cacheFactory ) {
2022-05-04 17:25:28 +03:00
return $cacheFactory ( "templates" ) ;
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
var $compileMinErr = minErr ( "$compile" ) ;
2021-07-30 04:11:27 +03:00
function $CompileProvider ( $provide , $$sanitizeUriProvider ) {
2022-05-04 17:25:28 +03:00
var hasDirectives = { } , Suffix = "Directive" , COMMENT _DIRECTIVE _REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/ , CLASS _DIRECTIVE _REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/ , EVENT _HANDLER _ATTR _REGEXP = /^(on[a-z]+|formaction)$/ ;
2022-06-15 17:36:57 +03:00
this . directive = function registerDirective ( name , directiveFactory ) {
return assertNotHasOwnProperty ( name , "directive" ) , isString ( name ) ? ( assertArg ( directiveFactory , "directiveFactory" ) , hasDirectives . hasOwnProperty ( name ) || ( hasDirectives [ name ] = [ ] , $provide . factory ( name + Suffix , [
2022-05-04 17:25:28 +03:00
"$injector" ,
"$exceptionHandler" ,
2021-10-21 08:12:50 +03:00
function ( $injector , $exceptionHandler ) {
2021-07-30 04:11:27 +03:00
var directives = [ ] ;
return forEach ( hasDirectives [ name ] , function ( directiveFactory , index ) {
try {
var directive = $injector . invoke ( directiveFactory ) ;
isFunction ( directive ) ? directive = {
2022-06-15 17:36:57 +03:00
compile : valueFn ( directive )
} : ! directive . compile && directive . link && ( directive . compile = valueFn ( directive . link ) ) , directive . priority = directive . priority || 0 , directive . index = index , directive . name = directive . name || name , directive . require = directive . require || directive . controller && directive . name , directive . restrict = directive . restrict || "A" , directives . push ( directive ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
$exceptionHandler ( e ) ;
}
} ) , directives ;
2022-05-04 17:25:28 +03:00
} ,
2022-06-15 17:36:57 +03:00
] ) ) , hasDirectives [ name ] . push ( directiveFactory ) ) : forEach ( name , reverseParams ( registerDirective ) ) , this ;
2021-07-30 04:11:27 +03:00
} , this . aHrefSanitizationWhitelist = function ( regexp ) {
return isDefined ( regexp ) ? ( $$sanitizeUriProvider . aHrefSanitizationWhitelist ( regexp ) , this ) : $$sanitizeUriProvider . aHrefSanitizationWhitelist ( ) ;
} , this . imgSrcSanitizationWhitelist = function ( regexp ) {
return isDefined ( regexp ) ? ( $$sanitizeUriProvider . imgSrcSanitizationWhitelist ( regexp ) , this ) : $$sanitizeUriProvider . imgSrcSanitizationWhitelist ( ) ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$injector" ,
"$interpolate" ,
"$exceptionHandler" ,
"$http" ,
"$templateCache" ,
"$parse" ,
"$controller" ,
"$rootScope" ,
"$document" ,
"$sce" ,
"$animate" ,
"$$sanitizeUri" ,
2021-10-21 08:12:50 +03:00
function ( $injector , $interpolate , $exceptionHandler , $http , $templateCache , $parse , $controller , $rootScope , $document , $sce , $animate , $$sanitizeUri ) {
2022-05-18 10:25:25 +03:00
var Attributes = function ( element , attr ) {
this . $$element = element , this . $attr = attr || { } ;
} ;
Attributes . prototype = {
$normalize : directiveNormalize ,
$addClass : function ( classVal ) {
classVal && classVal . length > 0 && $animate . addClass ( this . $$element , classVal ) ;
} ,
$removeClass : function ( classVal ) {
classVal && classVal . length > 0 && $animate . removeClass ( this . $$element , classVal ) ;
} ,
$updateClass : function ( newClasses , oldClasses ) {
this . $removeClass ( tokenDifference ( oldClasses , newClasses ) ) , this . $addClass ( tokenDifference ( newClasses , oldClasses ) ) ;
} ,
$set : function ( key , value , writeAttr , attrName ) {
var nodeName , booleanKey = getBooleanAttrName ( this . $$element [ 0 ] , key ) ;
booleanKey && ( this . $$element . prop ( key , value ) , attrName = booleanKey ) , this [ key ] = value , attrName ? this . $attr [ key ] = attrName : ( attrName = this . $attr [ key ] ) || ( this . $attr [ key ] = attrName = snake _case ( key , "-" ) ) , ( "A" === ( nodeName = nodeName _ ( this . $$element ) ) && "href" === key || "IMG" === nodeName && "src" === key ) && ( this [ key ] = value = $$sanitizeUri ( value , "src" === key ) ) , ! 1 !== writeAttr && ( null === value || value === undefined ? this . $$element . removeAttr ( attrName ) : this . $$element . attr ( attrName , value ) ) ;
var $$observers = this . $$observers ;
$$observers && forEach ( $$observers [ key ] , function ( fn ) {
try {
fn ( value ) ;
} catch ( e ) {
$exceptionHandler ( e ) ;
}
} ) ;
} ,
$observe : function ( key , fn ) {
var attrs = this , $$observers = attrs . $$observers || ( attrs . $$observers = { } ) , listeners = $$observers [ key ] || ( $$observers [ key ] = [ ] ) ;
return listeners . push ( fn ) , $rootScope . $evalAsync ( function ( ) {
listeners . $$inter || fn ( attrs [ key ] ) ;
} ) , fn ;
}
} ;
var startSymbol = $interpolate . startSymbol ( ) , endSymbol = $interpolate . endSymbol ( ) , denormalizeTemplate = "{{" == startSymbol || "}}" == endSymbol ? identity : function ( template ) {
return template . replace ( /\{\{/g , startSymbol ) . replace ( /}}/g , endSymbol ) ;
} , NG _ATTR _BINDING = /^ngAttr[A-Z]/ ;
return compile ;
2021-07-30 04:11:27 +03:00
function compile ( $compileNodes , transcludeFn , maxPriority , ignoreDirective , previousCompileContext ) {
$compileNodes instanceof jqLite || ( $compileNodes = jqLite ( $compileNodes ) ) , forEach ( $compileNodes , function ( node , index ) {
2022-05-04 17:25:28 +03:00
3 == node . nodeType && node . nodeValue . match ( /\S+/ ) && ( $compileNodes [ index ] = node = jqLite ( node ) . wrap ( "<span></span>" ) . parent ( ) [ 0 ] ) ;
2021-07-30 04:11:27 +03:00
} ) ;
var compositeLinkFn = compileNodes ( $compileNodes , transcludeFn , $compileNodes , maxPriority , ignoreDirective , previousCompileContext ) ;
return function ( scope , cloneConnectFn , transcludeControllers ) {
2022-05-04 17:25:28 +03:00
assertArg ( scope , "scope" ) ;
2021-07-30 04:11:27 +03:00
var $linkNode = cloneConnectFn ? JQLitePrototype . clone . call ( $compileNodes ) : $compileNodes ;
forEach ( transcludeControllers , function ( instance , name ) {
2022-05-04 17:25:28 +03:00
$linkNode . data ( "$" + name + "Controller" , instance ) ;
2021-07-30 04:11:27 +03:00
} ) ;
for ( var i = 0 , ii = $linkNode . length ; i < ii ; i ++ ) {
var node = $linkNode [ i ] ;
2022-05-04 17:25:28 +03:00
( 1 == node . nodeType || 9 == node . nodeType ) && $linkNode . eq ( i ) . data ( "$scope" , scope ) ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
return safeAddClass ( $linkNode , "ng-scope" ) , cloneConnectFn && cloneConnectFn ( $linkNode , scope ) , compositeLinkFn && compositeLinkFn ( scope , $linkNode , $linkNode ) , $linkNode ;
2021-07-30 04:11:27 +03:00
} ;
}
function safeAddClass ( $element , className ) {
try {
$element . addClass ( className ) ;
2022-01-02 23:54:58 +03:00
} catch ( e ) { }
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function compileNodes ( nodeList , transcludeFn , $rootElement , maxPriority , ignoreDirective , previousCompileContext ) {
2022-08-30 06:22:18 +03:00
for ( var nodeLinkFn , childLinkFn , directives , attrs , linkFnFound , linkFns = [ ] , i = 0 ; i < nodeList . length ; i ++ ) attrs = new Attributes ( ) , childLinkFn = ( nodeLinkFn = ( directives = collectDirectives ( nodeList [ i ] , [ ] , attrs , 0 === i ? maxPriority : undefined , ignoreDirective ) ) . length ? applyDirectivesToNode ( directives , nodeList [ i ] , attrs , transcludeFn , $rootElement , null , [ ] , [ ] , previousCompileContext ) : null ) && nodeLinkFn . terminal || ! nodeList [ i ] . childNodes || ! nodeList [ i ] . childNodes . length ? null : compileNodes ( nodeList [ i ] . childNodes , nodeLinkFn ? nodeLinkFn . transclude : transcludeFn ) , linkFns . push ( nodeLinkFn ) , linkFns . push ( childLinkFn ) , linkFnFound = linkFnFound || nodeLinkFn || childLinkFn , previousCompileContext = null ;
2021-07-30 04:11:27 +03:00
return linkFnFound ? function ( scope , nodeList , $rootElement , boundTranscludeFn ) {
2021-10-21 08:12:50 +03:00
var nodeLinkFn , childLinkFn , node , $node , childScope , childTranscludeFn , i , ii , n , stableNodeList = [ ] ;
for ( i = 0 , ii = nodeList . length ; i < ii ; i ++ ) stableNodeList . push ( nodeList [ i ] ) ;
2022-05-04 17:25:28 +03:00
for ( i = 0 , n = 0 , ii = linkFns . length ; i < ii ; n ++ ) node = stableNodeList [ n ] , nodeLinkFn = linkFns [ i ++ ] , childLinkFn = linkFns [ i ++ ] , $node = jqLite ( node ) , nodeLinkFn ? ( nodeLinkFn . scope ? ( childScope = scope . $new ( ) , $node . data ( "$scope" , childScope ) , safeAddClass ( $node , "ng-scope" ) ) : childScope = scope , childTranscludeFn = nodeLinkFn . transclude , nodeLinkFn ( childLinkFn , childScope , node , $rootElement , childTranscludeFn || ! boundTranscludeFn && transcludeFn ? createBoundTranscludeFn ( scope , childTranscludeFn || transcludeFn ) : boundTranscludeFn ) ) : childLinkFn && childLinkFn ( scope , node . childNodes , undefined , boundTranscludeFn ) ;
2021-07-30 04:11:27 +03:00
} : null ;
}
function createBoundTranscludeFn ( scope , transcludeFn ) {
return function ( transcludedScope , cloneFn , controllers ) {
var scopeCreated = ! 1 ;
transcludedScope || ( ( transcludedScope = scope . $new ( ) ) . $$transcluded = ! 0 , scopeCreated = ! 0 ) ;
var clone = transcludeFn ( transcludedScope , cloneFn , controllers ) ;
2022-05-04 17:25:28 +03:00
return scopeCreated && clone . on ( "$destroy" , bind ( transcludedScope , transcludedScope . $destroy ) ) , clone ;
2021-07-30 04:11:27 +03:00
} ;
}
function collectDirectives ( node , directives , attrs , maxPriority , ignoreDirective ) {
2022-09-01 13:36:16 +03:00
var directives1 , text , interpolateFn , match , className , nodeType = node . nodeType , attrsMap = attrs . $attr ;
2021-07-30 04:11:27 +03:00
switch ( nodeType ) {
case 1 :
2022-05-04 17:25:28 +03:00
addDirective ( directives , directiveNormalize ( nodeName _ ( node ) . toLowerCase ( ) ) , "E" , maxPriority , ignoreDirective ) ;
2021-07-30 04:11:27 +03:00
for ( var attr , name , nName , ngAttrName , value , nAttrs = node . attributes , j = 0 , jj = nAttrs && nAttrs . length ; j < jj ; j ++ ) {
var attrStartName = ! 1 , attrEndName = ! 1 ;
2021-10-14 16:48:14 +03:00
if ( attr = nAttrs [ j ] , ! msie || msie >= 8 || attr . specified ) {
2022-05-04 17:25:28 +03:00
ngAttrName = directiveNormalize ( name = attr . name ) , NG _ATTR _BINDING . test ( ngAttrName ) && ( name = snake _case ( ngAttrName . substr ( 6 ) , "-" ) ) ;
var directiveNName = ngAttrName . replace ( /(Start|End)$/ , "" ) ;
2022-06-15 17:36:57 +03:00
ngAttrName === directiveNName + "Start" && ( attrStartName = name , attrEndName = name . substr ( 0 , name . length - 5 ) + "end" , name = name . substr ( 0 , name . length - 6 ) ) , attrsMap [ nName = directiveNormalize ( name . toLowerCase ( ) ) ] = name , attrs [ nName ] = value = trim ( msie && "href" == name ? decodeURIComponent ( node . getAttribute ( name , 2 ) ) : attr . value ) , getBooleanAttrName ( node , nName ) && ( attrs [ nName ] = ! 0 ) , addAttrInterpolateDirective ( node , directives , value , nName ) , addDirective ( directives , nName , "A" , maxPriority , ignoreDirective , attrStartName , attrEndName ) ;
2021-10-14 16:48:14 +03:00
}
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
if ( isString ( className = node . className ) && "" !== className ) for ( ; match = CLASS _DIRECTIVE _REGEXP . exec ( className ) ; ) addDirective ( directives , nName = directiveNormalize ( match [ 2 ] ) , "C" , maxPriority , ignoreDirective ) && ( attrs [ nName ] = trim ( match [ 3 ] ) ) , className = className . substr ( match . index + match [ 0 ] . length ) ;
2021-07-30 04:11:27 +03:00
break ;
case 3 :
2022-09-13 06:52:47 +03:00
( interpolateFn = $interpolate ( text = node . nodeValue , ! 0 ) ) && directives . push ( {
2022-09-01 13:36:16 +03:00
priority : 0 ,
compile : valueFn ( function ( scope , node ) {
var parent = node . parent ( ) , bindings = parent . data ( "$binding" ) || [ ] ;
bindings . push ( interpolateFn ) , safeAddClass ( parent . data ( "$binding" , bindings ) , "ng-binding" ) , scope . $watch ( interpolateFn , function ( value ) {
node [ 0 ] . nodeValue = value ;
} ) ;
} )
} ) ;
2021-07-30 04:11:27 +03:00
break ;
case 8 :
try {
2022-06-15 17:36:57 +03:00
( match = COMMENT _DIRECTIVE _REGEXP . exec ( node . nodeValue ) ) && ( nName = directiveNormalize ( match [ 1 ] ) , addDirective ( directives , nName , "M" , maxPriority , ignoreDirective ) && ( attrs [ nName ] = trim ( match [ 2 ] ) ) ) ;
2022-01-02 23:54:58 +03:00
} catch ( e ) { }
2021-07-30 04:11:27 +03:00
}
return directives . sort ( byPriority ) , directives ;
}
function groupScan ( node , attrStart , attrEnd ) {
var nodes = [ ] , depth = 0 ;
if ( attrStart && node . hasAttribute && node . hasAttribute ( attrStart ) ) do {
2022-05-04 17:25:28 +03:00
if ( ! node ) throw $compileMinErr ( "uterdir" , "Unterminated attribute, found '{0}' but no matching '{1}' found." , attrStart , attrEnd ) ;
2021-07-30 04:11:27 +03:00
1 == node . nodeType && ( node . hasAttribute ( attrStart ) && depth ++ , node . hasAttribute ( attrEnd ) && depth -- ) , nodes . push ( node ) , node = node . nextSibling ;
} while ( depth > 0 )
else nodes . push ( node ) ;
return jqLite ( nodes ) ;
}
function groupElementsLinkFnWrapper ( linkFn , attrStart , attrEnd ) {
return function ( scope , element , attrs , controllers , transcludeFn ) {
2022-08-26 11:45:49 +03:00
return element = groupScan ( element [ 0 ] , attrStart , attrEnd ) , linkFn ( scope , element , attrs , controllers , transcludeFn ) ;
2021-07-30 04:11:27 +03:00
} ;
}
2022-06-15 17:36:57 +03:00
function applyDirectivesToNode ( directives , compileNode , templateAttrs , transcludeFn , jqCollection , originalReplaceDirective , preLinkFns , postLinkFns , previousCompileContext ) {
for ( var newScopeDirective , directive , directiveName , $template , linkFn , directiveValue , terminalPriority = - Number . MAX _VALUE , controllerDirectives = ( previousCompileContext = previousCompileContext || { } ) . controllerDirectives , newIsolateScopeDirective = previousCompileContext . newIsolateScopeDirective , templateDirective = previousCompileContext . templateDirective , nonTlbTranscludeDirective = previousCompileContext . nonTlbTranscludeDirective , hasTranscludeDirective = ! 1 , hasElementTranscludeDirective = ! 1 , $compileNode = templateAttrs . $$element = jqLite ( compileNode ) , replaceDirective = originalReplaceDirective , childTranscludeFn = transcludeFn , i = 0 , ii = directives . length ; i < ii ; i ++ ) {
var attrStart = ( directive = directives [ i ] ) . $$start , attrEnd = directive . $$end ;
if ( attrStart && ( $compileNode = groupScan ( compileNode , attrStart , attrEnd ) ) , $template = undefined , terminalPriority > directive . priority ) break ;
2022-08-30 06:22:18 +03:00
if ( ( directiveValue = directive . scope ) && ( newScopeDirective = newScopeDirective || directive , ! directive . templateUrl && ( assertNoDuplicate ( "new/isolated scope" , newIsolateScopeDirective , directive , $compileNode ) , isObject ( directiveValue ) && ( newIsolateScopeDirective = directive ) ) ) , directiveName = directive . name , ! directive . templateUrl && directive . controller && ( directiveValue = directive . controller , assertNoDuplicate ( "'" + directiveName + "' controller" , ( controllerDirectives = controllerDirectives || { } ) [ directiveName ] , directive , $compileNode ) , controllerDirectives [ directiveName ] = directive ) , ( directiveValue = directive . transclude ) && ( hasTranscludeDirective = ! 0 , directive . $$tlb || ( assertNoDuplicate ( "transclusion" , nonTlbTranscludeDirective , directive , $compileNode ) , nonTlbTranscludeDirective = directive ) , "element" == directiveValue ? ( hasElementTranscludeDirective = ! 0 , terminalPriority = directive . priority , $template = groupScan ( compileNode , attrStart , attrEnd ) , compileNode = ( $compileNode = templateAttrs . $$element = jqLite ( document1 . createComment ( " " + directiveName + ": " + templateAttrs [ directiveName ] + " " ) ) ) [ 0 ] , replaceWith ( jqCollection , jqLite ( sliceArgs ( $template ) ) , compileNode ) , childTranscludeFn = compile ( $template , transcludeFn , terminalPriority , replaceDirective && replaceDirective . name , {
2022-05-18 10:25:25 +03:00
nonTlbTranscludeDirective : nonTlbTranscludeDirective
2022-09-04 10:33:26 +03:00
} ) ) : ( $template = jqLite ( jqLiteClone ( compileNode ) ) . contents ( ) , $compileNode . empty ( ) , childTranscludeFn = compile ( $template , transcludeFn ) ) ) , directive . template ) {
if ( assertNoDuplicate ( "template" , templateDirective , directive , $compileNode ) , templateDirective = directive , directiveValue = isFunction ( directive . template ) ? directive . template ( $compileNode , templateAttrs ) : directive . template , directiveValue = denormalizeTemplate ( directiveValue ) , directive . replace ) {
if ( replaceDirective = directive , compileNode = ( $template = jqLite ( "<div>" + trim ( directiveValue ) + "</div>" ) . contents ( ) ) [ 0 ] , 1 != $template . length || 1 !== compileNode . nodeType ) throw $compileMinErr ( "tplrt" , "Template for directive '{0}' must have exactly one root element. {1}" , directiveName , "" ) ;
replaceWith ( jqCollection , $compileNode , compileNode ) ;
var newTemplateAttrs = {
$attr : { }
} , templateDirectives = collectDirectives ( compileNode , [ ] , newTemplateAttrs ) , unprocessedDirectives = directives . splice ( i + 1 , directives . length - ( i + 1 ) ) ;
newIsolateScopeDirective && markDirectivesAsIsolate ( templateDirectives ) , directives = directives . concat ( templateDirectives ) . concat ( unprocessedDirectives ) , mergeTemplateAttributes ( templateAttrs , newTemplateAttrs ) , ii = directives . length ;
} else $compileNode . html ( directiveValue ) ;
}
2022-06-15 17:36:57 +03:00
if ( directive . templateUrl ) assertNoDuplicate ( "template" , templateDirective , directive , $compileNode ) , templateDirective = directive , directive . replace && ( replaceDirective = directive ) , nodeLinkFn = compileTemplateUrl ( directives . splice ( i , directives . length - i ) , $compileNode , templateAttrs , jqCollection , childTranscludeFn , preLinkFns , postLinkFns , {
2022-05-18 10:25:25 +03:00
controllerDirectives : controllerDirectives ,
newIsolateScopeDirective : newIsolateScopeDirective ,
templateDirective : templateDirective ,
nonTlbTranscludeDirective : nonTlbTranscludeDirective
2022-06-15 17:36:57 +03:00
} ) , ii = directives . length ;
else if ( directive . compile ) try {
linkFn = directive . compile ( $compileNode , templateAttrs , childTranscludeFn ) , isFunction ( linkFn ) ? addLinkFns ( null , linkFn , attrStart , attrEnd ) : linkFn && addLinkFns ( linkFn . pre , linkFn . post , attrStart , attrEnd ) ;
2022-05-18 10:25:25 +03:00
} catch ( e ) {
$exceptionHandler ( e , startingTag ( $compileNode ) ) ;
}
2022-06-15 17:36:57 +03:00
directive . terminal && ( nodeLinkFn . terminal = ! 0 , terminalPriority = Math . max ( terminalPriority , directive . priority ) ) ;
2022-05-18 10:25:25 +03:00
}
return nodeLinkFn . scope = newScopeDirective && ! 0 === newScopeDirective . scope , nodeLinkFn . transclude = hasTranscludeDirective && childTranscludeFn , nodeLinkFn ;
2021-07-30 04:11:27 +03:00
function addLinkFns ( pre , post , attrStart , attrEnd ) {
2022-06-15 17:36:57 +03:00
pre && ( attrStart && ( pre = groupElementsLinkFnWrapper ( pre , attrStart , attrEnd ) ) , pre . require = directive . require , ( newIsolateScopeDirective === directive || directive . $$isolateScope ) && ( pre = cloneAndAnnotateFn ( pre , {
2021-07-30 04:11:27 +03:00
isolateScope : ! 0
2022-06-15 17:36:57 +03:00
} ) ) , preLinkFns . push ( pre ) ) , post && ( attrStart && ( post = groupElementsLinkFnWrapper ( post , attrStart , attrEnd ) ) , post . require = directive . require , ( newIsolateScopeDirective === directive || directive . $$isolateScope ) && ( post = cloneAndAnnotateFn ( post , {
2021-07-30 04:11:27 +03:00
isolateScope : ! 0
} ) ) , postLinkFns . push ( post ) ) ;
}
2022-06-15 17:36:57 +03:00
function getControllers ( require , $element , elementControllers ) {
2022-05-04 17:25:28 +03:00
var value , retrievalMethod = "data" , optional = ! 1 ;
2022-06-15 17:36:57 +03:00
if ( isString ( require ) ) {
for ( ; "^" == ( value = require . charAt ( 0 ) ) || "?" == value ; ) require = require . substr ( 1 ) , "^" == value && ( retrievalMethod = "inheritedData" ) , optional = optional || "?" == value ;
if ( value = null , elementControllers && "data" === retrievalMethod && ( value = elementControllers [ require ] ) , ! ( value = value || $element [ retrievalMethod ] ( "$" + require + "Controller" ) ) && ! optional ) throw $compileMinErr ( "ctreq" , "Controller '{0}', required by directive '{1}', can't be found!" , require , directiveName ) ;
} else isArray ( require ) && ( value = [ ] , forEach ( require , function ( require ) {
2021-10-10 06:47:11 +03:00
value . push ( getControllers ( require , $element , elementControllers ) ) ;
2022-05-08 07:07:58 +03:00
} ) ) ;
return value ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function nodeLinkFn ( childLinkFn , scope , linkNode , $rootElement , boundTranscludeFn ) {
2022-01-02 23:54:58 +03:00
var attrs , $element , i , ii , linkFn , controller , isolateScope , transcludeFn , elementControllers = { } ;
2022-08-30 06:22:18 +03:00
if ( $element = ( attrs = compileNode === linkNode ? templateAttrs : function ( src , dst ) {
2022-05-04 17:25:28 +03:00
for ( var key in dst = dst || { } , src ) src . hasOwnProperty ( key ) && "$$" !== key . substr ( 0 , 2 ) && ( dst [ key ] = src [ key ] ) ;
2021-09-08 12:45:39 +03:00
return dst ;
2022-08-30 06:22:18 +03:00
} ( templateAttrs , new Attributes ( jqLite ( linkNode ) , templateAttrs . $attr ) ) ) . $$element , newIsolateScopeDirective ) {
2021-07-30 04:11:27 +03:00
var LOCAL _REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/ , $linkNode = jqLite ( linkNode ) ;
2022-06-15 17:36:57 +03:00
isolateScope = scope . $new ( ! 0 ) , templateDirective && templateDirective === newIsolateScopeDirective . $$originalDirective ? $linkNode . data ( "$isolateScope" , isolateScope ) : $linkNode . data ( "$isolateScopeNoTemplate" , isolateScope ) , safeAddClass ( $linkNode , "ng-isolate-scope" ) , forEach ( newIsolateScopeDirective . scope , function ( definition , scopeName ) {
2022-05-04 17:25:28 +03:00
var lastValue , parentGet , parentSet , compare , match = definition . match ( LOCAL _REGEXP ) || [ ] , attrName = match [ 3 ] || scopeName , optional = "?" == match [ 2 ] , mode = match [ 1 ] ;
2021-07-30 04:11:27 +03:00
switch ( isolateScope . $$isolateBindings [ scopeName ] = mode + attrName , mode ) {
2022-05-04 17:25:28 +03:00
case "@" :
2021-07-30 04:11:27 +03:00
attrs . $observe ( attrName , function ( value ) {
isolateScope [ scopeName ] = value ;
2022-06-15 17:36:57 +03:00
} ) , attrs . $$observers [ attrName ] . $$scope = scope , attrs [ attrName ] && ( isolateScope [ scopeName ] = $interpolate ( attrs [ attrName ] ) ( scope ) ) ;
2021-07-30 04:11:27 +03:00
break ;
2022-05-04 17:25:28 +03:00
case "=" :
2021-07-30 04:11:27 +03:00
if ( optional && ! attrs [ attrName ] ) return ;
compare = ( parentGet = $parse ( attrs [ attrName ] ) ) . literal ? equals : function ( a , b ) {
return a === b ;
} , parentSet = parentGet . assign || function ( ) {
2022-06-15 17:36:57 +03:00
throw lastValue = isolateScope [ scopeName ] = parentGet ( scope ) , $compileMinErr ( "nonassign" , "Expression '{0}' used with directive '{1}' is non-assignable!" , attrs [ attrName ] , newIsolateScopeDirective . name ) ;
} , lastValue = isolateScope [ scopeName ] = parentGet ( scope ) , isolateScope . $watch ( function ( ) {
var parentValue = parentGet ( scope ) ;
return compare ( parentValue , isolateScope [ scopeName ] ) || ( compare ( parentValue , lastValue ) ? parentSet ( scope , parentValue = isolateScope [ scopeName ] ) : isolateScope [ scopeName ] = parentValue ) , lastValue = parentValue ;
2021-07-30 04:11:27 +03:00
} , null , parentGet . literal ) ;
break ;
2022-05-04 17:25:28 +03:00
case "&" :
2021-07-30 04:11:27 +03:00
parentGet = $parse ( attrs [ attrName ] ) , isolateScope [ scopeName ] = function ( locals ) {
2022-06-15 17:36:57 +03:00
return parentGet ( scope , locals ) ;
2021-07-30 04:11:27 +03:00
} ;
break ;
2021-08-03 18:52:47 +03:00
default :
2022-05-04 17:25:28 +03:00
throw $compileMinErr ( "iscp" , "Invalid isolate scope definition for directive '{0}'. Definition: {... {1}: '{2}' ...}" , newIsolateScopeDirective . name , scopeName , definition ) ;
2021-07-30 04:11:27 +03:00
}
} ) ;
}
2021-10-21 08:12:50 +03:00
for ( transcludeFn = boundTranscludeFn && function ( scope , cloneAttachFn ) {
2021-07-30 04:11:27 +03:00
var transcludeControllers ;
return arguments . length < 2 && ( cloneAttachFn = scope , scope = undefined ) , hasElementTranscludeDirective && ( transcludeControllers = elementControllers ) , boundTranscludeFn ( scope , cloneAttachFn , transcludeControllers ) ;
} , controllerDirectives && forEach ( controllerDirectives , function ( directive ) {
var controllerInstance , locals = {
2022-06-15 17:36:57 +03:00
$scope : directive === newIsolateScopeDirective || directive . $$isolateScope ? isolateScope : scope ,
2021-07-30 04:11:27 +03:00
$element : $element ,
$attrs : attrs ,
2021-10-21 08:12:50 +03:00
$transclude : transcludeFn
2021-07-30 04:11:27 +03:00
} ;
2022-05-04 17:25:28 +03:00
"@" == ( controller = directive . controller ) && ( controller = attrs [ directive . name ] ) , controllerInstance = $controller ( controller , locals ) , elementControllers [ directive . name ] = controllerInstance , hasElementTranscludeDirective || $element . data ( "$" + directive . name + "Controller" , controllerInstance ) , directive . controllerAs && ( locals . $scope [ directive . controllerAs ] = controllerInstance ) ;
2021-10-21 08:12:50 +03:00
} ) , i = 0 , ii = preLinkFns . length ; i < ii ; i ++ ) try {
2022-06-15 17:36:57 +03:00
( linkFn = preLinkFns [ i ] ) ( linkFn . isolateScope ? isolateScope : scope , $element , attrs , linkFn . require && getControllers ( linkFn . require , $element , elementControllers ) , transcludeFn ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
$exceptionHandler ( e , startingTag ( $element ) ) ;
}
2022-06-15 17:36:57 +03:00
var scopeToChild = scope ;
2021-10-21 08:12:50 +03:00
for ( newIsolateScopeDirective && ( newIsolateScopeDirective . template || null === newIsolateScopeDirective . templateUrl ) && ( scopeToChild = isolateScope ) , childLinkFn && childLinkFn ( scopeToChild , linkNode . childNodes , undefined , boundTranscludeFn ) , i = postLinkFns . length - 1 ; i >= 0 ; i -- ) try {
2022-06-15 17:36:57 +03:00
( linkFn = postLinkFns [ i ] ) ( linkFn . isolateScope ? isolateScope : scope , $element , attrs , linkFn . require && getControllers ( linkFn . require , $element , elementControllers ) , transcludeFn ) ;
} catch ( e1 ) {
$exceptionHandler ( e1 , startingTag ( $element ) ) ;
2021-07-30 04:11:27 +03:00
}
}
}
function markDirectivesAsIsolate ( directives ) {
for ( var j = 0 , jj = directives . length ; j < jj ; j ++ ) directives [ j ] = inherit ( directives [ j ] , {
$$isolateScope : ! 0
} ) ;
}
function addDirective ( tDirectives , name , location , maxPriority , ignoreDirective , startAttrName , endAttrName ) {
if ( name === ignoreDirective ) return null ;
var match = null ;
2021-11-15 08:03:03 +03:00
if ( hasDirectives . hasOwnProperty ( name ) ) for ( var directive , directives = $injector . get ( name + Suffix ) , i = 0 , ii = directives . length ; i < ii ; i ++ ) try {
2021-07-30 04:11:27 +03:00
directive = directives [ i ] , ( maxPriority === undefined || maxPriority > directive . priority ) && - 1 != directive . restrict . indexOf ( location ) && ( startAttrName && ( directive = inherit ( directive , {
$$start : startAttrName ,
$$end : endAttrName
} ) ) , tDirectives . push ( directive ) , match = directive ) ;
} catch ( e ) {
$exceptionHandler ( e ) ;
}
return match ;
}
function mergeTemplateAttributes ( dst , src ) {
var srcAttr = src . $attr , dstAttr = dst . $attr , $element = dst . $$element ;
forEach ( dst , function ( value , key ) {
2022-05-04 17:25:28 +03:00
"$" != key . charAt ( 0 ) && ( src [ key ] && ( value += ( "style" === key ? ";" : " " ) + src [ key ] ) , dst . $set ( key , value , ! 0 , srcAttr [ key ] ) ) ;
2021-07-30 04:11:27 +03:00
} ) , forEach ( src , function ( value , key ) {
2022-05-04 17:25:28 +03:00
"class" == key ? ( safeAddClass ( $element , value ) , dst . class = ( dst . class ? dst . class + " " : "" ) + value ) : "style" == key ? ( $element . attr ( "style" , $element . attr ( "style" ) + ";" + value ) , dst . style = ( dst . style ? dst . style + ";" : "" ) + value ) : "$" == key . charAt ( 0 ) || dst . hasOwnProperty ( key ) || ( dst [ key ] = value , dstAttr [ key ] = srcAttr [ key ] ) ;
2021-07-30 04:11:27 +03:00
} ) ;
}
function compileTemplateUrl ( directives , $compileNode , tAttrs , $rootElement , childTranscludeFn , preLinkFns , postLinkFns , previousCompileContext ) {
2022-01-02 23:54:58 +03:00
var afterTemplateNodeLinkFn , afterTemplateChildLinkFn , linkQueue = [ ] , beforeTemplateCompileNode = $compileNode [ 0 ] , origAsyncDirective = directives . shift ( ) , derivedSyncDirective = extend ( { } , origAsyncDirective , {
2021-07-30 04:11:27 +03:00
templateUrl : null ,
transclude : null ,
replace : null ,
$$originalDirective : origAsyncDirective
} ) , templateUrl = isFunction ( origAsyncDirective . templateUrl ) ? origAsyncDirective . templateUrl ( $compileNode , tAttrs ) : origAsyncDirective . templateUrl ;
return $compileNode . empty ( ) , $http . get ( $sce . getTrustedResourceUrl ( templateUrl ) , {
cache : $templateCache
} ) . success ( function ( content ) {
2021-10-14 16:48:14 +03:00
var compileNode , tempTemplateAttrs , $template , childBoundTranscludeFn ;
2021-07-30 04:11:27 +03:00
if ( content = denormalizeTemplate ( content ) , origAsyncDirective . replace ) {
2022-08-30 06:22:18 +03:00
if ( compileNode = ( $template = jqLite ( "<div>" + trim ( content ) + "</div>" ) . contents ( ) ) [ 0 ] , 1 != $template . length || 1 !== compileNode . nodeType ) throw $compileMinErr ( "tplrt" , "Template for directive '{0}' must have exactly one root element. {1}" , origAsyncDirective . name , templateUrl ) ;
2021-07-30 04:11:27 +03:00
tempTemplateAttrs = {
2022-01-02 23:54:58 +03:00
$attr : { }
2021-07-30 04:11:27 +03:00
} , replaceWith ( $rootElement , $compileNode , compileNode ) ;
var templateDirectives = collectDirectives ( compileNode , [ ] , tempTemplateAttrs ) ;
isObject ( origAsyncDirective . scope ) && markDirectivesAsIsolate ( templateDirectives ) , directives = templateDirectives . concat ( directives ) , mergeTemplateAttributes ( tAttrs , tempTemplateAttrs ) ;
} else compileNode = beforeTemplateCompileNode , $compileNode . html ( content ) ;
for ( directives . unshift ( derivedSyncDirective ) , afterTemplateNodeLinkFn = applyDirectivesToNode ( directives , compileNode , tAttrs , childTranscludeFn , $compileNode , origAsyncDirective , preLinkFns , postLinkFns , previousCompileContext ) , forEach ( $rootElement , function ( node , i ) {
node == compileNode && ( $rootElement [ i ] = $compileNode [ 0 ] ) ;
} ) , afterTemplateChildLinkFn = compileNodes ( $compileNode [ 0 ] . childNodes , childTranscludeFn ) ; linkQueue . length ; ) {
var scope = linkQueue . shift ( ) , beforeTemplateLinkNode = linkQueue . shift ( ) , linkRootElement = linkQueue . shift ( ) , boundTranscludeFn = linkQueue . shift ( ) , linkNode = $compileNode [ 0 ] ;
2021-10-14 16:48:14 +03:00
beforeTemplateLinkNode !== beforeTemplateCompileNode && ( linkNode = jqLiteClone ( compileNode ) , replaceWith ( linkRootElement , jqLite ( beforeTemplateLinkNode ) , linkNode ) ) , childBoundTranscludeFn = afterTemplateNodeLinkFn . transclude ? createBoundTranscludeFn ( scope , afterTemplateNodeLinkFn . transclude ) : boundTranscludeFn , afterTemplateNodeLinkFn ( afterTemplateChildLinkFn , scope , linkNode , $rootElement , childBoundTranscludeFn ) ;
2021-07-30 04:11:27 +03:00
}
linkQueue = null ;
} ) . error ( function ( response , code , headers , config ) {
2022-05-04 17:25:28 +03:00
throw $compileMinErr ( "tpload" , "Failed to load template: {0}" , config . url ) ;
2021-07-30 04:11:27 +03:00
} ) , function ( ignoreChildLinkFn , scope , node , rootElement , boundTranscludeFn ) {
linkQueue ? ( linkQueue . push ( scope ) , linkQueue . push ( node ) , linkQueue . push ( rootElement ) , linkQueue . push ( boundTranscludeFn ) ) : afterTemplateNodeLinkFn ( afterTemplateChildLinkFn , scope , node , rootElement , boundTranscludeFn ) ;
} ;
}
function byPriority ( a , b ) {
var diff = b . priority - a . priority ;
return 0 !== diff ? diff : a . name !== b . name ? a . name < b . name ? - 1 : 1 : a . index - b . index ;
}
function assertNoDuplicate ( what , previousDirective , directive , element ) {
2022-05-04 17:25:28 +03:00
if ( previousDirective ) throw $compileMinErr ( "multidir" , "Multiple directives [{0}, {1}] asking for {2} on: {3}" , previousDirective . name , directive . name , what , startingTag ( element ) ) ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
function addAttrInterpolateDirective ( node , directives , value , name ) {
2021-07-30 04:11:27 +03:00
var interpolateFn = $interpolate ( value , ! 0 ) ;
if ( interpolateFn ) {
2022-06-15 17:36:57 +03:00
if ( "multiple" === name && "SELECT" === nodeName _ ( node ) ) throw $compileMinErr ( "selmulti" , "Binding to the 'multiple' attribute is not supported. Element: {0}" , startingTag ( node ) ) ;
2021-07-30 04:11:27 +03:00
directives . push ( {
priority : 100 ,
compile : function ( ) {
return {
pre : function ( scope , element , attr ) {
2022-01-02 23:54:58 +03:00
var $$observers = attr . $$observers || ( attr . $$observers = { } ) ;
2022-05-04 17:25:28 +03:00
if ( EVENT _HANDLER _ATTR _REGEXP . test ( name ) ) throw $compileMinErr ( "nodomevents" , "Interpolations for HTML DOM event attributes are disallowed. Please use the ng- versions (such as ng-click instead of onclick) instead." ) ;
2021-10-06 10:12:11 +03:00
( interpolateFn = $interpolate ( attr [ name ] , ! 0 , function ( node , attrNormalizedName ) {
2021-09-08 12:45:39 +03:00
if ( "srcdoc" == attrNormalizedName ) return $sce . HTML ;
var tag = nodeName _ ( node ) ;
if ( "xlinkHref" == attrNormalizedName || "FORM" == tag && "action" == attrNormalizedName || "IMG" != tag && ( "src" == attrNormalizedName || "ngSrc" == attrNormalizedName ) ) return $sce . RESOURCE _URL ;
2022-06-15 17:36:57 +03:00
} ( node , name ) ) ) && ( attr [ name ] = interpolateFn ( scope ) , ( $$observers [ name ] || ( $$observers [ name ] = [ ] ) ) . $$inter = ! 0 , ( attr . $$observers && attr . $$observers [ name ] . $$scope || scope ) . $watch ( interpolateFn , function ( newValue , oldValue ) {
2022-05-04 17:25:28 +03:00
"class" === name && newValue != oldValue ? attr . $updateClass ( newValue , oldValue ) : attr . $set ( name , newValue ) ;
2021-07-30 04:11:27 +03:00
} ) ) ;
}
} ;
}
} ) ;
}
}
function replaceWith ( $rootElement , elementsToRemove , newNode ) {
var i , ii , firstElementToRemove = elementsToRemove [ 0 ] , removeCount = elementsToRemove . length , parent = firstElementToRemove . parentNode ;
if ( $rootElement ) {
for ( i = 0 , ii = $rootElement . length ; i < ii ; i ++ ) if ( $rootElement [ i ] == firstElementToRemove ) {
$rootElement [ i ++ ] = newNode ;
for ( var j = i , j2 = j + removeCount - 1 , jj = $rootElement . length ; j < jj ; j ++ , j2 ++ ) j2 < jj ? $rootElement [ j ] = $rootElement [ j2 ] : delete $rootElement [ j ] ;
$rootElement . length -= removeCount - 1 ;
break ;
}
}
parent && parent . replaceChild ( newNode , firstElementToRemove ) ;
2021-10-21 08:12:50 +03:00
var fragment = document1 . createDocumentFragment ( ) ;
2021-07-30 04:11:27 +03:00
fragment . appendChild ( firstElementToRemove ) , newNode [ jqLite . expando ] = firstElementToRemove [ jqLite . expando ] ;
for ( var k = 1 , kk = elementsToRemove . length ; k < kk ; k ++ ) {
var element = elementsToRemove [ k ] ;
jqLite ( element ) . remove ( ) , fragment . appendChild ( element ) , delete elementsToRemove [ k ] ;
}
elementsToRemove [ 0 ] = newNode , elementsToRemove . length = 1 ;
}
function cloneAndAnnotateFn ( fn , annotation ) {
return extend ( function ( ) {
return fn . apply ( null , arguments ) ;
} , fn , annotation ) ;
}
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2021-08-04 13:27:17 +03:00
$CompileProvider . $inject = [
2022-05-04 17:25:28 +03:00
"$provide" ,
"$$sanitizeUriProvider"
2021-08-04 13:27:17 +03:00
] ;
2021-07-30 04:11:27 +03:00
var PREFIX _REGEXP = /^(x[\:\-_]|data[\:\-_])/i ;
function directiveNormalize ( name ) {
2022-05-04 17:25:28 +03:00
return camelCase ( name . replace ( PREFIX _REGEXP , "" ) ) ;
2021-07-30 04:11:27 +03:00
}
function tokenDifference ( str1 , str2 ) {
2022-05-04 17:25:28 +03:00
var values = "" , tokens1 = str1 . split ( /\s+/ ) , tokens2 = str2 . split ( /\s+/ ) ;
2021-07-30 04:11:27 +03:00
outer : for ( var i = 0 ; i < tokens1 . length ; i ++ ) {
for ( var token = tokens1 [ i ] , j = 0 ; j < tokens2 . length ; j ++ ) if ( token == tokens2 [ j ] ) continue outer ;
2022-05-04 17:25:28 +03:00
values += ( values . length > 0 ? " " : "" ) + token ;
2021-07-30 04:11:27 +03:00
}
return values ;
}
function $ControllerProvider ( ) {
2022-01-02 23:54:58 +03:00
var controllers = { } , CNTRL _REG = /^(\S+)(\s+as\s+(\w+))?$/ ;
2021-07-30 04:11:27 +03:00
this . register = function ( name , constructor ) {
2022-05-04 17:25:28 +03:00
assertNotHasOwnProperty ( name , "controller" ) , isObject ( name ) ? extend ( controllers , name ) : controllers [ name ] = constructor ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$injector" ,
"$window" ,
2021-10-21 08:12:50 +03:00
function ( $injector , $window ) {
2021-07-30 04:11:27 +03:00
return function ( expression , locals ) {
var instance , match , constructor , identifier ;
2022-08-26 11:45:49 +03:00
if ( isString ( expression ) && ( constructor = ( match = expression . match ( CNTRL _REG ) ) [ 1 ] , identifier = match [ 3 ] , expression = controllers . hasOwnProperty ( constructor ) ? controllers [ constructor ] : getter ( locals . $scope , constructor , ! 0 ) || getter ( $window , constructor , ! 0 ) , assertArgFn ( expression , constructor , ! 0 ) ) , instance = $injector . instantiate ( expression , locals ) , identifier ) {
2022-05-04 17:25:28 +03:00
if ( ! ( locals && "object" == typeof locals . $scope ) ) throw minErr ( "$controller" ) ( "noscp" , "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`." , constructor || expression . name , identifier ) ;
2021-07-30 04:11:27 +03:00
locals . $scope [ identifier ] = instance ;
}
return instance ;
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $DocumentProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$window" ,
2022-06-15 17:36:57 +03:00
function ( window1 ) {
return jqLite ( window1 . document ) ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $ExceptionHandlerProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$log" ,
2021-10-21 08:12:50 +03:00
function ( $log ) {
2021-07-30 04:11:27 +03:00
return function ( exception , cause ) {
$log . error . apply ( $log , arguments ) ;
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function parseHeaders ( headers ) {
2022-01-02 23:54:58 +03:00
var key , val , i , parsed = { } ;
2022-05-04 17:25:28 +03:00
return headers && forEach ( headers . split ( "\n" ) , function ( line ) {
2022-06-15 17:36:57 +03:00
i = line . indexOf ( ":" ) , key = lowercase ( trim ( line . substr ( 0 , i ) ) ) , val = trim ( line . substr ( i + 1 ) ) , key && ( parsed [ key ] ? parsed [ key ] += ", " + val : parsed [ key ] = val ) ;
2021-07-30 04:11:27 +03:00
} ) , parsed ;
}
function headersGetter ( headers ) {
var headersObj = isObject ( headers ) ? headers : undefined ;
return function ( name ) {
return ( headersObj || ( headersObj = parseHeaders ( headers ) ) , name ) ? headersObj [ lowercase ( name ) ] || null : headersObj ;
} ;
}
function transformData ( data , headers , fns ) {
return isFunction ( fns ) ? fns ( data , headers ) : ( forEach ( fns , function ( fn ) {
data = fn ( data , headers ) ;
} ) , data ) ;
}
2022-04-29 08:58:59 +03:00
function isSuccess ( status ) {
return 200 <= status && status < 300 ;
}
2021-07-30 04:11:27 +03:00
function $HttpProvider ( ) {
var JSON _START = /^\s*(\[|\{[^\{])/ , JSON _END = /[\}\]]\s*$/ , PROTECTION _PREFIX = /^\)\]\}',?\n/ , CONTENT _TYPE _APPLICATION _JSON = {
2022-05-04 17:25:28 +03:00
"Content-Type" : "application/json;charset=utf-8"
2021-07-30 04:11:27 +03:00
} , defaults = this . defaults = {
2021-10-21 08:12:50 +03:00
transformResponse : [
function ( data ) {
2022-05-04 17:25:28 +03:00
return isString ( data ) && ( data = data . replace ( PROTECTION _PREFIX , "" ) , JSON _START . test ( data ) && JSON _END . test ( data ) && ( data = fromJson ( data ) ) ) , data ;
} ,
2021-10-21 08:12:50 +03:00
] ,
transformRequest : [
function ( d ) {
2022-09-08 11:07:43 +03:00
return isObject ( d ) && "[object File]" !== toString . call ( d ) ? toJson ( d ) : d ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ,
2021-07-30 04:11:27 +03:00
headers : {
common : {
2022-05-04 17:25:28 +03:00
Accept : "application/json, text/plain, */*"
2021-07-30 04:11:27 +03:00
} ,
post : CONTENT _TYPE _APPLICATION _JSON ,
put : CONTENT _TYPE _APPLICATION _JSON ,
patch : CONTENT _TYPE _APPLICATION _JSON
} ,
2022-05-04 17:25:28 +03:00
xsrfCookieName : "XSRF-TOKEN" ,
xsrfHeaderName : "X-XSRF-TOKEN"
2021-07-30 04:11:27 +03:00
} , interceptorFactories = this . interceptors = [ ] , responseInterceptorFactories = this . responseInterceptors = [ ] ;
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$httpBackend" ,
"$browser" ,
"$cacheFactory" ,
"$rootScope" ,
"$q" ,
"$injector" ,
2021-10-21 08:12:50 +03:00
function ( $httpBackend , $browser , $cacheFactory , $rootScope , $q , $injector ) {
2022-05-04 17:25:28 +03:00
var defaultCache = $cacheFactory ( "$http" ) , reversedInterceptors = [ ] ;
2021-07-30 04:11:27 +03:00
function $http ( requestConfig ) {
2022-06-15 17:36:57 +03:00
var config = {
2021-07-30 04:11:27 +03:00
transformRequest : defaults . transformRequest ,
transformResponse : defaults . transformResponse
2022-06-15 17:36:57 +03:00
} , headers = function ( config ) {
2022-01-02 23:54:58 +03:00
var defHeaderName , lowercaseDefHeaderName , reqHeaderName , defHeaders = defaults . headers , reqHeaders = extend ( { } , config . headers ) ;
2022-05-09 19:36:40 +03:00
defHeaders = extend ( { } , defHeaders . common , defHeaders [ lowercase ( config . method ) ] ) , execHeaders ( defHeaders ) , execHeaders ( reqHeaders ) ;
2021-07-30 04:11:27 +03:00
defaultHeadersIteration : for ( defHeaderName in defHeaders ) {
for ( reqHeaderName in lowercaseDefHeaderName = lowercase ( defHeaderName ) , reqHeaders ) if ( lowercase ( reqHeaderName ) === lowercaseDefHeaderName ) continue defaultHeadersIteration ;
reqHeaders [ defHeaderName ] = defHeaders [ defHeaderName ] ;
}
return reqHeaders ;
2022-05-18 10:25:25 +03:00
function execHeaders ( headers ) {
var headerContent ;
forEach ( headers , function ( headerFn , header ) {
isFunction ( headerFn ) && ( null != ( headerContent = headerFn ( ) ) ? headers [ header ] = headerContent : delete headers [ header ] ) ;
} ) ;
}
2021-08-04 13:27:17 +03:00
} ( requestConfig ) ;
2022-06-15 17:36:57 +03:00
extend ( config , requestConfig ) , config . headers = headers , config . method = uppercase ( config . method ) ;
var xsrfValue = urlIsSameOrigin ( config . url ) ? $browser . cookies ( ) [ config . xsrfCookieName || defaults . xsrfCookieName ] : undefined ;
xsrfValue && ( headers [ config . xsrfHeaderName || defaults . xsrfHeaderName ] = xsrfValue ) ;
2021-10-21 08:12:50 +03:00
var chain = [
2022-05-18 10:25:25 +03:00
function ( config ) {
2022-06-15 17:36:57 +03:00
headers = config . headers ;
var reqData = transformData ( config . data , headersGetter ( headers ) , config . transformRequest ) ;
return isUndefined ( config . data ) && forEach ( headers , function ( value , header ) {
"content-type" === lowercase ( header ) && delete headers [ header ] ;
2022-09-01 13:36:16 +03:00
} ) , isUndefined ( config . withCredentials ) && ! isUndefined ( defaults . withCredentials ) && ( config . withCredentials = defaults . withCredentials ) , ( function ( config , reqData , reqHeaders ) {
var cache , cachedResp , deferred = $q . defer ( ) , promise = deferred . promise , url = function ( url , params ) {
if ( ! params ) return url ;
var parts = [ ] ;
return function ( obj , iterator , context ) {
for ( var keys = sortedKeys ( obj ) , i = 0 ; i < keys . length ; i ++ ) iterator . call ( void 0 , obj [ keys [ i ] ] , keys [ i ] ) ;
} ( params , function ( value , key ) {
null === value || isUndefined ( value ) || ( isArray ( value ) || ( value = [
value
] ) , forEach ( value , function ( v ) {
isObject ( v ) && ( v = toJson ( v ) ) , parts . push ( encodeUriQuery ( key ) + "=" + encodeUriQuery ( v ) ) ;
} ) ) ;
} ) , url + ( - 1 == url . indexOf ( "?" ) ? "?" : "&" ) + parts . join ( "&" ) ;
} ( config . url , config . params ) ;
if ( $http . pendingRequests . push ( config ) , promise . then ( removePendingReq , removePendingReq ) , ( config . cache || defaults . cache ) && ! 1 !== config . cache && "GET" == config . method && ( cache = isObject ( config . cache ) ? config . cache : isObject ( defaults . cache ) ? defaults . cache : defaultCache ) , cache ) {
if ( cachedResp = cache . get ( url ) , isDefined ( cachedResp ) ) {
if ( cachedResp . then ) return cachedResp . then ( removePendingReq , removePendingReq ) , cachedResp ;
isArray ( cachedResp ) ? resolvePromise ( cachedResp [ 1 ] , cachedResp [ 0 ] , copy ( cachedResp [ 2 ] ) ) : resolvePromise ( cachedResp , 200 , { } ) ;
} else cache . put ( url , promise ) ;
}
return isUndefined ( cachedResp ) && $httpBackend ( config . method , url , reqData , function ( status , response , headersString ) {
cache && ( isSuccess ( status ) ? cache . put ( url , [
status ,
response ,
parseHeaders ( headersString )
] ) : cache . remove ( url ) ) , resolvePromise ( response , status , headersString ) , $rootScope . $$phase || $rootScope . $apply ( ) ;
} , reqHeaders , config . timeout , config . withCredentials , config . responseType ) , promise ;
function resolvePromise ( response , status , headers ) {
( isSuccess ( status = Math . max ( status , 0 ) ) ? deferred . resolve : deferred . reject ) ( {
data : response ,
status : status ,
headers : headersGetter ( headers ) ,
config : config
} ) ;
}
function removePendingReq ( ) {
var idx = indexOf ( $http . pendingRequests , config ) ;
- 1 !== idx && $http . pendingRequests . splice ( idx , 1 ) ;
}
} ) ( config , reqData , headers ) . then ( transformResponse , transformResponse ) ;
2021-10-21 08:12:50 +03:00
} ,
undefined
2022-06-15 17:36:57 +03:00
] , promise = $q . when ( config ) ;
2021-08-04 13:27:17 +03:00
for ( forEach ( reversedInterceptors , function ( interceptor ) {
2021-07-30 04:11:27 +03:00
( interceptor . request || interceptor . requestError ) && chain . unshift ( interceptor . request , interceptor . requestError ) , ( interceptor . response || interceptor . responseError ) && chain . push ( interceptor . response , interceptor . responseError ) ;
} ) ; chain . length ; ) {
var thenFn = chain . shift ( ) , rejectFn = chain . shift ( ) ;
2022-05-18 10:25:25 +03:00
promise = promise . then ( thenFn , rejectFn ) ;
2021-07-30 04:11:27 +03:00
}
2022-05-18 10:25:25 +03:00
return promise . success = function ( fn ) {
return promise . then ( function ( response ) {
2022-06-15 17:36:57 +03:00
fn ( response . data , response . status , response . headers , config ) ;
2022-05-18 10:25:25 +03:00
} ) , promise ;
} , promise . error = function ( fn ) {
return promise . then ( null , function ( response ) {
2022-06-15 17:36:57 +03:00
fn ( response . data , response . status , response . headers , config ) ;
2022-05-18 10:25:25 +03:00
} ) , promise ;
} , promise ;
function transformResponse ( response ) {
var resp = extend ( { } , response , {
2022-06-15 17:36:57 +03:00
data : transformData ( response . data , response . headers , config . transformResponse )
2022-05-18 10:25:25 +03:00
} ) ;
return isSuccess ( response . status ) ? resp : $q . reject ( resp ) ;
}
2021-07-30 04:11:27 +03:00
}
return forEach ( interceptorFactories , function ( interceptorFactory ) {
reversedInterceptors . unshift ( isString ( interceptorFactory ) ? $injector . get ( interceptorFactory ) : $injector . invoke ( interceptorFactory ) ) ;
} ) , forEach ( responseInterceptorFactories , function ( interceptorFactory , index ) {
var responseFn = isString ( interceptorFactory ) ? $injector . get ( interceptorFactory ) : $injector . invoke ( interceptorFactory ) ;
reversedInterceptors . splice ( index , 0 , {
response : function ( response ) {
return responseFn ( $q . when ( response ) ) ;
} ,
responseError : function ( response ) {
return responseFn ( $q . reject ( response ) ) ;
}
} ) ;
2022-03-07 06:51:57 +03:00
} ) , $http . pendingRequests = [ ] , function ( names ) {
2021-07-30 04:11:27 +03:00
forEach ( arguments , function ( name ) {
$http [ name ] = function ( url , config ) {
2022-01-02 23:54:58 +03:00
return $http ( extend ( config || { } , {
2021-07-30 04:11:27 +03:00
method : name ,
url : url
} ) ) ;
} ;
} ) ;
2022-06-15 17:36:57 +03:00
} ( "get" , "delete" , "head" , "jsonp" ) , function ( name ) {
2021-07-30 04:11:27 +03:00
forEach ( arguments , function ( name ) {
$http [ name ] = function ( url , data , config ) {
2022-01-02 23:54:58 +03:00
return $http ( extend ( config || { } , {
2021-07-30 04:11:27 +03:00
method : name ,
url : url ,
data : data
} ) ) ;
} ;
} ) ;
2022-05-04 17:25:28 +03:00
} ( "post" , "put" ) , $http . defaults = defaults , $http ;
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
var XHR = window1 . XMLHttpRequest || function ( ) {
2021-07-30 04:11:27 +03:00
try {
return new ActiveXObject ( "Msxml2.XMLHTTP.6.0" ) ;
2022-01-02 23:54:58 +03:00
} catch ( e1 ) { }
2021-07-30 04:11:27 +03:00
try {
return new ActiveXObject ( "Msxml2.XMLHTTP.3.0" ) ;
2022-01-02 23:54:58 +03:00
} catch ( e2 ) { }
2021-07-30 04:11:27 +03:00
try {
return new ActiveXObject ( "Msxml2.XMLHTTP" ) ;
2022-01-02 23:54:58 +03:00
} catch ( e3 ) { }
2022-05-04 17:25:28 +03:00
throw minErr ( "$httpBackend" ) ( "noxhr" , "This browser does not support XMLHttpRequest." ) ;
2021-07-30 04:11:27 +03:00
} ;
function $HttpBackendProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$browser" ,
"$window" ,
"$document" ,
2021-10-21 08:12:50 +03:00
function ( $browser , $window , $document ) {
2022-09-01 13:36:16 +03:00
var $browser1 , XHR1 , $browserDefer , callbacks , rawDocument ;
2022-09-13 06:52:47 +03:00
return $browserDefer = $browser . defer , callbacks = $window . angular . callbacks , rawDocument = $document [ 0 ] , function ( method , url , post , callback , headers , timeout , withCredentials , responseType ) {
2022-09-01 13:36:16 +03:00
var status ;
2022-09-13 06:52:47 +03:00
if ( $browser . $$incOutstandingRequestCount ( ) , url = url || $browser . url ( ) , "jsonp" == lowercase ( method ) ) {
2022-09-03 10:33:31 +03:00
var url1 , done , script , doneWrapper , callbackId = "_" + ( callbacks . counter ++ ) . toString ( 36 ) ;
2022-09-01 13:36:16 +03:00
callbacks [ callbackId ] = function ( data ) {
callbacks [ callbackId ] . data = data ;
} ;
2022-09-03 10:33:31 +03:00
var jsonpDone = ( url1 = url . replace ( "JSON_CALLBACK" , "angular.callbacks." + callbackId ) , done = function ( ) {
2022-09-01 13:36:16 +03:00
callbacks [ callbackId ] . data ? completeRequest ( callback , 200 , callbacks [ callbackId ] . data ) : completeRequest ( callback , status || - 2 ) , delete callbacks [ callbackId ] ;
2022-09-03 10:33:31 +03:00
} , script = rawDocument . createElement ( "script" ) , doneWrapper = function ( ) {
script . onreadystatechange = script . onload = script . onerror = null , rawDocument . body . removeChild ( script ) , done && done ( ) ;
} , script . type = "text/javascript" , script . src = url1 , msie && msie <= 8 ? script . onreadystatechange = function ( ) {
/loaded|complete/ . test ( script . readyState ) && doneWrapper ( ) ;
} : script . onload = script . onerror = function ( ) {
doneWrapper ( ) ;
} , rawDocument . body . appendChild ( script ) , doneWrapper ) ;
2022-09-01 13:36:16 +03:00
} else {
2022-09-13 06:52:47 +03:00
var xhr = new XHR ( ) ;
2022-09-01 13:36:16 +03:00
xhr . open ( method , url , ! 0 ) , forEach ( headers , function ( value , key ) {
isDefined ( value ) && xhr . setRequestHeader ( key , value ) ;
} ) , xhr . onreadystatechange = function ( ) {
if ( 4 == xhr . readyState ) {
var responseHeaders = null , response = null ;
- 1 !== status && ( responseHeaders = xhr . getAllResponseHeaders ( ) , response = xhr . responseType ? xhr . response : xhr . responseText ) , completeRequest ( callback , status || xhr . status , response , responseHeaders ) ;
}
} , withCredentials && ( xhr . withCredentials = ! 0 ) , responseType && ( xhr . responseType = responseType ) , xhr . send ( post || null ) ;
}
if ( timeout > 0 ) var timeoutId = $browserDefer ( timeoutRequest , timeout ) ;
else timeout && timeout . then && timeout . then ( timeoutRequest ) ;
function timeoutRequest ( ) {
status = - 1 , jsonpDone && jsonpDone ( ) , xhr && xhr . abort ( ) ;
}
function completeRequest ( callback , status , response , headersString ) {
var protocol = urlResolve ( url ) . protocol ;
2022-09-13 06:52:47 +03:00
timeoutId && $browserDefer . cancel ( timeoutId ) , jsonpDone = xhr = null , callback ( status = 1223 == ( status = "file" == protocol && 0 === status ? response ? 200 : 404 : status ) ? 204 : status , response , headersString ) , $browser . $$completeOutstandingRequest ( noop ) ;
2022-09-01 13:36:16 +03:00
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
var $interpolateMinErr = minErr ( "$interpolate" ) ;
2021-08-04 13:27:17 +03:00
function $InterpolateProvider ( ) {
2022-05-04 17:25:28 +03:00
var startSymbol = "{{" , endSymbol = "}}" ;
2021-07-30 04:11:27 +03:00
this . startSymbol = function ( value ) {
return value ? ( startSymbol = value , this ) : startSymbol ;
} , this . endSymbol = function ( value ) {
return value ? ( endSymbol = value , this ) : endSymbol ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$parse" ,
"$exceptionHandler" ,
"$sce" ,
2021-10-21 08:12:50 +03:00
function ( $parse , $exceptionHandler , $sce ) {
2021-07-30 04:11:27 +03:00
var startSymbolLength = startSymbol . length , endSymbolLength = endSymbol . length ;
function $interpolate ( text , mustHaveExpression , trustedContext ) {
for ( var startIndex , endIndex , fn , exp , index = 0 , parts = [ ] , length = text . length , hasInterpolation = ! 1 , concat = [ ] ; index < length ; ) - 1 != ( startIndex = text . indexOf ( startSymbol , index ) ) && - 1 != ( endIndex = text . indexOf ( endSymbol , startIndex + startSymbolLength ) ) ? ( index != startIndex && parts . push ( text . substring ( index , startIndex ) ) , parts . push ( fn = $parse ( exp = text . substring ( startIndex + startSymbolLength , endIndex ) ) ) , fn . exp = exp , index = endIndex + endSymbolLength , hasInterpolation = ! 0 ) : ( index != length && parts . push ( text . substring ( index ) ) , index = length ) ;
2022-05-04 17:25:28 +03:00
if ( ( length = parts . length ) || ( parts . push ( "" ) , length = 1 ) , trustedContext && parts . length > 1 ) throw $interpolateMinErr ( "noconcat" , "Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce" , text ) ;
2021-07-30 04:11:27 +03:00
if ( ! mustHaveExpression || hasInterpolation ) return concat . length = length , ( fn = function ( context ) {
try {
2022-05-04 17:25:28 +03:00
for ( var part , i = 0 , ii = length ; i < ii ; i ++ ) "function" == typeof ( part = parts [ i ] ) && ( part = part ( context ) , part = trustedContext ? $sce . getTrusted ( trustedContext , part ) : $sce . valueOf ( part ) , null === part || isUndefined ( part ) ? part = "" : "string" != typeof part && ( part = toJson ( part ) ) ) , concat [ i ] = part ;
return concat . join ( "" ) ;
2021-07-30 04:11:27 +03:00
} catch ( err ) {
2022-08-26 11:45:49 +03:00
var newErr = $interpolateMinErr ( "interr" , "Can't interpolate: {0}\n{1}" , text , err . toString ( ) ) ;
$exceptionHandler ( newErr ) ;
2021-07-30 04:11:27 +03:00
}
} ) . exp = text , fn . parts = parts , fn ;
}
return $interpolate . startSymbol = function ( ) {
return startSymbol ;
} , $interpolate . endSymbol = function ( ) {
return endSymbol ;
} , $interpolate ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $IntervalProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$rootScope" ,
"$window" ,
"$q" ,
2021-10-21 08:12:50 +03:00
function ( $rootScope , $window , $q ) {
2022-01-02 23:54:58 +03:00
var intervals = { } ;
2021-07-30 04:11:27 +03:00
function interval ( fn , delay , count , invokeApply ) {
2022-06-15 17:36:57 +03:00
var setInterval = $window . setInterval , clearInterval1 = $window . clearInterval , deferred = $q . defer ( ) , promise = deferred . promise , iteration = 0 , skipApply = isDefined ( invokeApply ) && ! invokeApply ;
2021-07-30 04:11:27 +03:00
return count = isDefined ( count ) ? count : 0 , promise . then ( null , null , fn ) , promise . $$intervalId = setInterval ( function ( ) {
2022-06-15 17:36:57 +03:00
deferred . notify ( iteration ++ ) , count > 0 && iteration >= count && ( deferred . resolve ( iteration ) , clearInterval1 ( promise . $$intervalId ) , delete intervals [ promise . $$intervalId ] ) , skipApply || $rootScope . $apply ( ) ;
2021-07-30 04:11:27 +03:00
} , delay ) , intervals [ promise . $$intervalId ] = deferred , promise ;
}
return interval . cancel = function ( promise ) {
2022-05-04 17:25:28 +03:00
return ! ! promise && promise . $$intervalId in intervals && ( intervals [ promise . $$intervalId ] . reject ( "canceled" ) , clearInterval ( promise . $$intervalId ) , delete intervals [ promise . $$intervalId ] , ! 0 ) ;
2021-07-30 04:11:27 +03:00
} , interval ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $LocaleProvider ( ) {
this . $get = function ( ) {
return {
2022-05-04 17:25:28 +03:00
id : "en-us" ,
2021-07-30 04:11:27 +03:00
NUMBER _FORMATS : {
2022-05-04 17:25:28 +03:00
DECIMAL _SEP : "." ,
GROUP _SEP : "," ,
2021-08-03 18:52:47 +03:00
PATTERNS : [
{
2021-07-30 04:11:27 +03:00
minInt : 1 ,
minFrac : 0 ,
maxFrac : 3 ,
2022-05-04 17:25:28 +03:00
posPre : "" ,
posSuf : "" ,
negPre : "-" ,
negSuf : "" ,
2021-07-30 04:11:27 +03:00
gSize : 3 ,
lgSize : 3
2021-08-03 18:52:47 +03:00
} ,
{
2021-07-30 04:11:27 +03:00
minInt : 1 ,
minFrac : 2 ,
maxFrac : 2 ,
2022-05-04 17:25:28 +03:00
posPre : "\u00A4" ,
posSuf : "" ,
negPre : "(\u00A4" ,
negSuf : ")" ,
2021-07-30 04:11:27 +03:00
gSize : 3 ,
lgSize : 3
2022-05-04 17:25:28 +03:00
} ,
2021-08-03 18:52:47 +03:00
] ,
2022-05-04 17:25:28 +03:00
CURRENCY _SYM : "$"
2021-07-30 04:11:27 +03:00
} ,
DATETIME _FORMATS : {
2022-05-04 17:25:28 +03:00
MONTH : "January,February,March,April,May,June,July,August,September,October,November,December" . split ( "," ) ,
SHORTMONTH : "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" . split ( "," ) ,
DAY : "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday" . split ( "," ) ,
SHORTDAY : "Sun,Mon,Tue,Wed,Thu,Fri,Sat" . split ( "," ) ,
2021-08-03 18:52:47 +03:00
AMPMS : [
2022-05-04 17:25:28 +03:00
"AM" ,
"PM"
2021-08-03 18:52:47 +03:00
] ,
2022-05-04 17:25:28 +03:00
medium : "MMM d, y h:mm:ss a" ,
short : "M/d/yy h:mm a" ,
fullDate : "EEEE, MMMM d, y" ,
longDate : "MMMM d, y" ,
mediumDate : "MMM d, y" ,
shortDate : "M/d/yy" ,
mediumTime : "h:mm:ss a" ,
shortTime : "h:mm a"
2021-07-30 04:11:27 +03:00
} ,
pluralCat : function ( num ) {
2022-05-04 17:25:28 +03:00
return 1 === num ? "one" : "other" ;
2021-07-30 04:11:27 +03:00
}
} ;
} ;
}
var PATH _MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/ , DEFAULT _PORTS = {
http : 80 ,
https : 443 ,
ftp : 21
2022-05-04 17:25:28 +03:00
} , $locationMinErr = minErr ( "$location" ) ;
2021-07-30 04:11:27 +03:00
function encodePath ( path ) {
2022-05-04 17:25:28 +03:00
for ( var segments = path . split ( "/" ) , i = segments . length ; i -- ; ) segments [ i ] = encodeUriSegment ( segments [ i ] ) ;
return segments . join ( "/" ) ;
2021-07-30 04:11:27 +03:00
}
function parseAbsoluteUrl ( absoluteUrl , locationObj , appBase ) {
var parsedUrl = urlResolve ( absoluteUrl , appBase ) ;
locationObj . $$protocol = parsedUrl . protocol , locationObj . $$host = parsedUrl . hostname , locationObj . $$port = int ( parsedUrl . port ) || DEFAULT _PORTS [ parsedUrl . protocol ] || null ;
}
function parseAppUrl ( relativeUrl , locationObj , appBase ) {
2022-05-04 17:25:28 +03:00
var prefixed = "/" !== relativeUrl . charAt ( 0 ) ;
prefixed && ( relativeUrl = "/" + relativeUrl ) ;
2021-07-30 04:11:27 +03:00
var match = urlResolve ( relativeUrl , appBase ) ;
2022-05-04 17:25:28 +03:00
locationObj . $$path = decodeURIComponent ( prefixed && "/" === match . pathname . charAt ( 0 ) ? match . pathname . substring ( 1 ) : match . pathname ) , locationObj . $$search = parseKeyValue ( match . search ) , locationObj . $$hash = decodeURIComponent ( match . hash ) , locationObj . $$path && "/" != locationObj . $$path . charAt ( 0 ) && ( locationObj . $$path = "/" + locationObj . $$path ) ;
2021-07-30 04:11:27 +03:00
}
function beginsWith ( begin , whole ) {
if ( 0 === whole . indexOf ( begin ) ) return whole . substr ( begin . length ) ;
}
function stripHash ( url ) {
2022-05-04 17:25:28 +03:00
var index = url . indexOf ( "#" ) ;
2021-07-30 04:11:27 +03:00
return - 1 == index ? url : url . substr ( 0 , index ) ;
}
function stripFile ( url ) {
2022-05-04 17:25:28 +03:00
return url . substr ( 0 , stripHash ( url ) . lastIndexOf ( "/" ) + 1 ) ;
2021-07-30 04:11:27 +03:00
}
function LocationHtml5Url ( appBase , basePrefix ) {
2022-05-04 17:25:28 +03:00
this . $$html5 = ! 0 , basePrefix = basePrefix || "" ;
2021-07-30 04:11:27 +03:00
var appBaseNoFile = stripFile ( appBase ) ;
parseAbsoluteUrl ( appBase , this , appBase ) , this . $$parse = function ( url ) {
var pathUrl = beginsWith ( appBaseNoFile , url ) ;
2022-05-04 17:25:28 +03:00
if ( ! isString ( pathUrl ) ) throw $locationMinErr ( "ipthprfx" , 'Invalid url "{0}", missing path prefix "{1}".' , url , appBaseNoFile ) ;
parseAppUrl ( pathUrl , this , appBase ) , this . $$path || ( this . $$path = "/" ) , this . $$compose ( ) ;
2021-07-30 04:11:27 +03:00
} , this . $$compose = function ( ) {
2022-05-04 17:25:28 +03:00
var search = toKeyValue ( this . $$search ) , hash = this . $$hash ? "#" + encodeUriSegment ( this . $$hash ) : "" ;
this . $$url = encodePath ( this . $$path ) + ( search ? "?" + search : "" ) + hash , this . $$absUrl = appBaseNoFile + this . $$url . substr ( 1 ) ;
2021-07-30 04:11:27 +03:00
} , this . $$rewrite = function ( url ) {
var appUrl , prevAppUrl ;
2022-05-04 17:25:28 +03:00
return undefined !== ( appUrl = beginsWith ( appBase , url ) ) ? ( prevAppUrl = appUrl , undefined !== ( appUrl = beginsWith ( basePrefix , appUrl ) ) ) ? appBaseNoFile + ( beginsWith ( "/" , appUrl ) || appUrl ) : appBase + prevAppUrl : undefined !== ( appUrl = beginsWith ( appBaseNoFile , url ) ) ? appBaseNoFile + appUrl : appBaseNoFile == url + "/" ? appBaseNoFile : void 0 ;
2021-07-30 04:11:27 +03:00
} ;
}
function LocationHashbangUrl ( appBase , hashPrefix ) {
var appBaseNoFile = stripFile ( appBase ) ;
parseAbsoluteUrl ( appBase , this , appBase ) , this . $$parse = function ( url ) {
2022-05-18 10:25:25 +03:00
var path , url1 , base , firstPathSegmentMatch , windowsFilePathExp , withoutBaseUrl = beginsWith ( appBase , url ) || beginsWith ( appBaseNoFile , url ) , withoutHashUrl = "#" == withoutBaseUrl . charAt ( 0 ) ? beginsWith ( hashPrefix , withoutBaseUrl ) : this . $$html5 ? withoutBaseUrl : "" ;
2022-05-04 17:25:28 +03:00
if ( ! isString ( withoutHashUrl ) ) throw $locationMinErr ( "ihshprfx" , 'Invalid url "{0}", missing hash prefix "{1}".' , url , hashPrefix ) ;
2022-09-14 15:57:18 +03:00
parseAppUrl ( withoutHashUrl , this , appBase ) , this . $$path = ( path = this . $$path , windowsFilePathExp = /^\/?.*?:(\/.*)/ , ( 0 === ( url1 = withoutHashUrl ) . indexOf ( appBase ) && ( url1 = url1 . replace ( appBase , "" ) ) , windowsFilePathExp . exec ( url1 ) ) ? path : ( firstPathSegmentMatch = windowsFilePathExp . exec ( path ) ) ? firstPathSegmentMatch [ 1 ] : path ) , this . $$compose ( ) ;
2021-07-30 04:11:27 +03:00
} , this . $$compose = function ( ) {
2022-05-04 17:25:28 +03:00
var search = toKeyValue ( this . $$search ) , hash = this . $$hash ? "#" + encodeUriSegment ( this . $$hash ) : "" ;
this . $$url = encodePath ( this . $$path ) + ( search ? "?" + search : "" ) + hash , this . $$absUrl = appBase + ( this . $$url ? hashPrefix + this . $$url : "" ) ;
2021-07-30 04:11:27 +03:00
} , this . $$rewrite = function ( url ) {
if ( stripHash ( appBase ) == stripHash ( url ) ) return url ;
} ;
}
function LocationHashbangInHtml5Url ( appBase , hashPrefix ) {
this . $$html5 = ! 0 , LocationHashbangUrl . apply ( this , arguments ) ;
var appBaseNoFile = stripFile ( appBase ) ;
this . $$rewrite = function ( url ) {
var appUrl ;
2022-05-04 17:25:28 +03:00
return appBase == stripHash ( url ) ? url : ( appUrl = beginsWith ( appBaseNoFile , url ) ) ? appBase + hashPrefix + appUrl : appBaseNoFile === url + "/" ? appBaseNoFile : void 0 ;
2021-07-30 04:11:27 +03:00
} ;
}
function locationGetter ( property ) {
return function ( ) {
return this [ property ] ;
} ;
}
function locationGetterSetter ( property , preprocess ) {
return function ( value ) {
return isUndefined ( value ) ? this [ property ] : ( this [ property ] = preprocess ( value ) , this . $$compose ( ) , this ) ;
} ;
}
function $LocationProvider ( ) {
2022-05-04 17:25:28 +03:00
var hashPrefix = "" , html5Mode = ! 1 ;
2021-07-30 04:11:27 +03:00
this . hashPrefix = function ( prefix ) {
return isDefined ( prefix ) ? ( hashPrefix = prefix , this ) : hashPrefix ;
} , this . html5Mode = function ( mode ) {
return isDefined ( mode ) ? ( html5Mode = mode , this ) : html5Mode ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$rootScope" ,
"$browser" ,
"$sniffer" ,
"$rootElement" ,
2021-10-21 08:12:50 +03:00
function ( $rootScope , $browser , $sniffer , $rootElement ) {
2021-09-08 12:45:39 +03:00
var url , $location , LocationMode , appBase , baseHref = $browser . baseHref ( ) , initialUrl = $browser . url ( ) ;
2022-09-13 06:52:47 +03:00
html5Mode ? ( appBase = initialUrl . substring ( 0 , initialUrl . indexOf ( "/" , initialUrl . indexOf ( "//" ) + 2 ) ) + ( baseHref || "/" ) , LocationMode = $sniffer . history ? LocationHtml5Url : LocationHashbangInHtml5Url ) : ( appBase = stripHash ( initialUrl ) , LocationMode = LocationHashbangUrl ) , ( $location = new LocationMode ( appBase , "#" + hashPrefix ) ) . $$parse ( $location . $$rewrite ( initialUrl ) ) , $rootElement . on ( "click" , function ( event ) {
2021-07-30 04:11:27 +03:00
if ( ! event . ctrlKey && ! event . metaKey && 2 != event . which ) {
2022-05-04 17:25:28 +03:00
for ( var elm = jqLite ( event . target ) ; "a" !== lowercase ( elm [ 0 ] . nodeName ) ; ) if ( elm [ 0 ] === $rootElement [ 0 ] || ! ( elm = elm . parent ( ) ) [ 0 ] ) return ;
var absHref = elm . prop ( "href" ) , rewrittenUrl = $location . $$rewrite ( absHref ) ;
absHref && ! elm . attr ( "target" ) && rewrittenUrl && ! event . isDefaultPrevented ( ) && ( event . preventDefault ( ) , rewrittenUrl != $browser . url ( ) && ( $location . $$parse ( rewrittenUrl ) , $rootScope . $apply ( ) , window1 . angular [ "ff-684208-preventDefault" ] = ! 0 ) ) ;
2021-07-30 04:11:27 +03:00
}
} ) , $location . absUrl ( ) != initialUrl && $browser . url ( $location . absUrl ( ) , ! 0 ) , $browser . onUrlChange ( function ( newUrl ) {
2021-08-03 18:52:47 +03:00
if ( $location . absUrl ( ) != newUrl ) {
2022-05-04 17:25:28 +03:00
if ( $rootScope . $broadcast ( "$locationChangeStart" , newUrl , $location . absUrl ( ) ) . defaultPrevented ) {
2021-09-16 07:23:33 +03:00
$browser . url ( $location . absUrl ( ) ) ;
return ;
}
2021-08-03 18:52:47 +03:00
$rootScope . $evalAsync ( function ( ) {
var oldUrl = $location . absUrl ( ) ;
$location . $$parse ( newUrl ) , afterLocationChange ( oldUrl ) ;
} ) , $rootScope . $$phase || $rootScope . $digest ( ) ;
}
2021-08-04 13:27:17 +03:00
} ) ;
var changeCounter = 0 ;
return $rootScope . $watch ( function ( ) {
2021-07-30 04:11:27 +03:00
var oldUrl = $browser . url ( ) , currentReplace = $location . $$replace ;
return changeCounter && oldUrl == $location . absUrl ( ) || ( changeCounter ++ , $rootScope . $evalAsync ( function ( ) {
2022-05-04 17:25:28 +03:00
$rootScope . $broadcast ( "$locationChangeStart" , $location . absUrl ( ) , oldUrl ) . defaultPrevented ? $location . $$parse ( oldUrl ) : ( $browser . url ( $location . absUrl ( ) , currentReplace ) , afterLocationChange ( oldUrl ) ) ;
2021-07-30 04:11:27 +03:00
} ) ) , $location . $$replace = ! 1 , changeCounter ;
} ) , $location ;
2022-05-18 10:25:25 +03:00
function afterLocationChange ( oldUrl ) {
$rootScope . $broadcast ( "$locationChangeSuccess" , $location . absUrl ( ) , oldUrl ) ;
}
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $LogProvider ( ) {
var debug = ! 0 , self = this ;
this . debugEnabled = function ( flag ) {
return isDefined ( flag ) ? ( debug = flag , this ) : debug ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$window" ,
2021-10-21 08:12:50 +03:00
function ( $window ) {
2022-01-19 11:39:24 +03:00
var fn ;
2022-05-18 10:25:25 +03:00
return {
log : consoleLog ( "log" ) ,
info : consoleLog ( "info" ) ,
warn : consoleLog ( "warn" ) ,
error : consoleLog ( "error" ) ,
debug : ( fn = consoleLog ( "debug" ) , function ( ) {
debug && fn . apply ( self , arguments ) ;
} )
} ;
2021-07-30 04:11:27 +03:00
function consoleLog ( type ) {
2022-01-02 23:54:58 +03:00
var console = $window . console || { } , logFn = console [ type ] || console . log || noop ;
2021-07-30 04:11:27 +03:00
return logFn . apply ? function ( ) {
var args = [ ] ;
return forEach ( arguments , function ( arg ) {
2022-06-15 17:36:57 +03:00
var arg1 ;
args . push ( ( ( arg1 = arg ) instanceof Error && ( arg1 . stack ? arg1 = arg1 . message && - 1 === arg1 . stack . indexOf ( arg1 . message ) ? "Error: " + arg1 . message + "\n" + arg1 . stack : arg1 . stack : arg1 . sourceURL && ( arg1 = arg1 . message + "\n" + arg1 . sourceURL + ":" + arg1 . line ) ) , arg1 ) ) ;
2021-07-30 04:11:27 +03:00
} ) , logFn . apply ( console , args ) ;
} : function ( arg1 , arg2 ) {
2022-05-04 17:25:28 +03:00
logFn ( arg1 , null == arg2 ? "" : arg2 ) ;
2021-07-30 04:11:27 +03:00
} ;
}
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2021-08-04 13:27:17 +03:00
LocationHashbangInHtml5Url . prototype = LocationHashbangUrl . prototype = LocationHtml5Url . prototype = {
$$html5 : ! 1 ,
$$replace : ! 1 ,
2022-05-04 17:25:28 +03:00
absUrl : locationGetter ( "$$absUrl" ) ,
2021-08-04 13:27:17 +03:00
url : function ( url , replace ) {
if ( isUndefined ( url ) ) return this . $$url ;
var match = PATH _MATCH . exec ( url ) ;
2022-05-04 17:25:28 +03:00
return match [ 1 ] && this . path ( decodeURIComponent ( match [ 1 ] ) ) , ( match [ 2 ] || match [ 1 ] ) && this . search ( match [ 3 ] || "" ) , this . hash ( match [ 5 ] || "" , replace ) , this ;
2021-08-04 13:27:17 +03:00
} ,
2022-05-04 17:25:28 +03:00
protocol : locationGetter ( "$$protocol" ) ,
host : locationGetter ( "$$host" ) ,
port : locationGetter ( "$$port" ) ,
path : locationGetterSetter ( "$$path" , function ( path ) {
return "/" == path . charAt ( 0 ) ? path : "/" + path ;
2021-08-04 13:27:17 +03:00
} ) ,
search : function ( search , paramValue ) {
switch ( arguments . length ) {
case 0 :
return this . $$search ;
case 1 :
if ( isString ( search ) ) this . $$search = parseKeyValue ( search ) ;
else if ( isObject ( search ) ) this . $$search = search ;
2022-05-04 17:25:28 +03:00
else throw $locationMinErr ( "isrcharg" , "The first argument of the `$location#search()` call must be a string or an object." ) ;
2021-08-04 13:27:17 +03:00
break ;
2021-10-21 08:12:50 +03:00
default :
isUndefined ( paramValue ) || null === paramValue ? delete this . $$search [ search ] : this . $$search [ search ] = paramValue ;
2021-08-04 13:27:17 +03:00
}
return this . $$compose ( ) , this ;
} ,
2022-05-04 17:25:28 +03:00
hash : locationGetterSetter ( "$$hash" , identity ) ,
2021-08-04 13:27:17 +03:00
replace : function ( ) {
return this . $$replace = ! 0 , this ;
}
} ;
2022-05-04 17:25:28 +03:00
var $parseMinErr = minErr ( "$parse" ) , promiseWarningCache = { } ;
2021-07-30 04:11:27 +03:00
function ensureSafeMemberName ( name , fullExpression ) {
2022-05-04 17:25:28 +03:00
if ( "constructor" === name ) throw $parseMinErr ( "isecfld" , 'Referencing "constructor" field in Angular expressions is disallowed! Expression: {0}' , fullExpression ) ;
2021-07-30 04:11:27 +03:00
return name ;
}
function ensureSafeObject ( obj , fullExpression ) {
if ( obj ) {
2022-05-04 17:25:28 +03:00
if ( obj . constructor === obj ) throw $parseMinErr ( "isecfn" , "Referencing Function in Angular expressions is disallowed! Expression: {0}" , fullExpression ) ;
if ( obj . document && obj . location && obj . alert && obj . setInterval ) throw $parseMinErr ( "isecwindow" , "Referencing the Window in Angular expressions is disallowed! Expression: {0}" , fullExpression ) ;
if ( obj . children && ( obj . nodeName || obj . on && obj . find ) ) throw $parseMinErr ( "isecdom" , "Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}" , fullExpression ) ;
2021-07-30 04:11:27 +03:00
}
return obj ;
}
var OPERATORS = {
2022-05-04 17:25:28 +03:00
null : function ( ) {
2021-07-30 04:11:27 +03:00
return null ;
} ,
2022-05-04 17:25:28 +03:00
true : function ( ) {
2021-07-30 04:11:27 +03:00
return ! 0 ;
} ,
2022-05-04 17:25:28 +03:00
false : function ( ) {
2021-07-30 04:11:27 +03:00
return ! 1 ;
} ,
undefined : noop ,
2022-05-04 17:25:28 +03:00
"+" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return ( a = a ( self , locals ) , b = b ( self , locals ) , isDefined ( a ) ) ? isDefined ( b ) ? a + b : a : isDefined ( b ) ? b : undefined ;
} ,
2022-05-04 17:25:28 +03:00
"-" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a = a ( self , locals ) , b = b ( self , locals ) , ( isDefined ( a ) ? a : 0 ) - ( isDefined ( b ) ? b : 0 ) ;
} ,
2022-05-04 17:25:28 +03:00
"*" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) * b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"/" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) / b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"%" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) % b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"^" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) ^ b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"=" : noop ,
"===" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) === b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"!==" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) !== b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"==" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) == b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"!=" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) != b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"<" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) < b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
">" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) > b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"<=" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) <= b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
">=" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) >= b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"&&" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) && b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"||" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) || b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"&" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return a ( self , locals ) & b ( self , locals ) ;
} ,
2022-05-04 17:25:28 +03:00
"|" : function ( self , locals , a , b ) {
2021-07-30 04:11:27 +03:00
return b ( self , locals ) ( self , locals , a ( self , locals ) ) ;
} ,
2022-05-04 17:25:28 +03:00
"!" : function ( self , locals , a ) {
2021-07-30 04:11:27 +03:00
return ! a ( self , locals ) ;
}
} , ESCAPE = {
n : "\n" ,
f : "\f" ,
r : "\r" ,
t : "\t" ,
v : "\v" ,
"'" : "'" ,
2022-03-16 17:25:26 +03:00
'"' : '"'
2021-07-30 04:11:27 +03:00
} , Lexer = function ( options ) {
this . options = options ;
2021-08-04 13:27:17 +03:00
} ;
Lexer . prototype = {
constructor : Lexer ,
lex : function ( text ) {
2022-05-04 17:25:28 +03:00
this . text = text , this . index = 0 , this . ch = undefined , this . lastCh = ":" , this . tokens = [ ] ;
2021-08-04 13:27:17 +03:00
for ( var token , json = [ ] ; this . index < this . text . length ; ) {
2022-05-04 17:25:28 +03:00
if ( this . ch = this . text . charAt ( this . index ) , this . is ( "\"'" ) ) this . readString ( this . ch ) ;
else if ( this . isNumber ( this . ch ) || this . is ( "." ) && this . isNumber ( this . peek ( ) ) ) this . readNumber ( ) ;
else if ( this . isIdent ( this . ch ) ) this . readIdent ( ) , this . was ( "{," ) && "{" === json [ 0 ] && ( token = this . tokens [ this . tokens . length - 1 ] ) && ( token . json = - 1 === token . text . indexOf ( "." ) ) ;
else if ( this . is ( "(){}[].,;:?" ) ) this . tokens . push ( {
2021-08-04 13:27:17 +03:00
index : this . index ,
text : this . ch ,
2022-05-04 17:25:28 +03:00
json : this . was ( ":[," ) && this . is ( "{[" ) || this . is ( "}]:," )
} ) , this . is ( "{[" ) && json . unshift ( this . ch ) , this . is ( "}]" ) && json . shift ( ) , this . index ++ ;
2021-08-04 13:27:17 +03:00
else if ( this . isWhitespace ( this . ch ) ) {
this . index ++ ;
continue ;
} else {
var ch2 = this . ch + this . peek ( ) , ch3 = ch2 + this . peek ( 2 ) , fn = OPERATORS [ this . ch ] , fn2 = OPERATORS [ ch2 ] , fn3 = OPERATORS [ ch3 ] ;
fn3 ? ( this . tokens . push ( {
index : this . index ,
text : ch3 ,
fn : fn3
} ) , this . index += 3 ) : fn2 ? ( this . tokens . push ( {
index : this . index ,
text : ch2 ,
fn : fn2
} ) , this . index += 2 ) : fn ? ( this . tokens . push ( {
index : this . index ,
text : this . ch ,
fn : fn ,
2022-05-04 17:25:28 +03:00
json : this . was ( "[,:" ) && this . is ( "+-" )
} ) , this . index += 1 ) : this . throwError ( "Unexpected next character " , this . index , this . index + 1 ) ;
2021-08-04 13:27:17 +03:00
}
this . lastCh = this . ch ;
}
return this . tokens ;
} ,
is : function ( chars ) {
return - 1 !== chars . indexOf ( this . ch ) ;
} ,
was : function ( chars ) {
return - 1 !== chars . indexOf ( this . lastCh ) ;
} ,
peek : function ( i ) {
var num = i || 1 ;
return this . index + num < this . text . length && this . text . charAt ( this . index + num ) ;
} ,
isNumber : function ( ch ) {
2022-05-04 17:25:28 +03:00
return "0" <= ch && ch <= "9" ;
2021-08-04 13:27:17 +03:00
} ,
isWhitespace : function ( ch ) {
2022-05-04 17:25:28 +03:00
return " " === ch || "\r" === ch || "\t" === ch || "\n" === ch || "\v" === ch || "\u00A0" === ch ;
2021-08-04 13:27:17 +03:00
} ,
isIdent : function ( ch ) {
2022-05-04 17:25:28 +03:00
return "a" <= ch && ch <= "z" || "A" <= ch && ch <= "Z" || "_" === ch || "$" === ch ;
2021-08-04 13:27:17 +03:00
} ,
isExpOperator : function ( ch ) {
2022-05-04 17:25:28 +03:00
return "-" === ch || "+" === ch || this . isNumber ( ch ) ;
2021-08-04 13:27:17 +03:00
} ,
throwError : function ( error , start , end ) {
2022-08-26 11:45:49 +03:00
end = end || this . index ;
var colStr = isDefined ( start ) ? "s " + start + "-" + this . index + " [" + this . text . substring ( start , end ) + "]" : " " + end ;
throw $parseMinErr ( "lexerr" , "Lexer Error: {0} at column{1} in expression [{2}]." , error , colStr , this . text ) ;
2021-08-04 13:27:17 +03:00
} ,
readNumber : function ( ) {
2022-05-04 17:25:28 +03:00
for ( var number = "" , start = this . index ; this . index < this . text . length ; ) {
2021-08-04 13:27:17 +03:00
var ch = lowercase ( this . text . charAt ( this . index ) ) ;
2022-05-04 17:25:28 +03:00
if ( "." == ch || this . isNumber ( ch ) ) number += ch ;
2021-08-04 13:27:17 +03:00
else {
var peekCh = this . peek ( ) ;
2022-05-04 17:25:28 +03:00
if ( "e" == ch && this . isExpOperator ( peekCh ) ) number += ch ;
else if ( this . isExpOperator ( ch ) && peekCh && this . isNumber ( peekCh ) && "e" == number . charAt ( number . length - 1 ) ) number += ch ;
else if ( ! this . isExpOperator ( ch ) || peekCh && this . isNumber ( peekCh ) || "e" != number . charAt ( number . length - 1 ) ) break ;
else this . throwError ( "Invalid exponent" ) ;
2021-08-04 13:27:17 +03:00
}
this . index ++ ;
}
number *= 1 , this . tokens . push ( {
index : start ,
text : number ,
json : ! 0 ,
fn : function ( ) {
return number ;
}
} ) ;
} ,
readIdent : function ( ) {
2022-05-04 17:25:28 +03:00
for ( var lastDot , peekIndex , methodName , ch , parser = this , ident = "" , start = this . index ; this . index < this . text . length && ( "." === ( ch = this . text . charAt ( this . index ) ) || this . isIdent ( ch ) || this . isNumber ( ch ) ) ; ) "." === ch && ( lastDot = this . index ) , ident += ch , this . index ++ ;
2021-08-04 13:27:17 +03:00
if ( lastDot ) for ( peekIndex = this . index ; peekIndex < this . text . length ; ) {
2022-05-04 17:25:28 +03:00
if ( "(" === ( ch = this . text . charAt ( peekIndex ) ) ) {
2021-08-04 13:27:17 +03:00
methodName = ident . substr ( lastDot - start + 1 ) , ident = ident . substr ( 0 , lastDot - start ) , this . index = peekIndex ;
break ;
}
if ( this . isWhitespace ( ch ) ) peekIndex ++ ;
else break ;
}
var token = {
index : start ,
text : ident
} ;
if ( OPERATORS . hasOwnProperty ( ident ) ) token . fn = OPERATORS [ ident ] , token . json = OPERATORS [ ident ] ;
else {
2021-09-01 16:11:55 +03:00
var getter = getterFn ( ident , this . options , this . text ) ;
2021-08-04 13:27:17 +03:00
token . fn = extend ( function ( self , locals ) {
2021-09-01 16:11:55 +03:00
return getter ( self , locals ) ;
2021-08-04 13:27:17 +03:00
} , {
assign : function ( self , value ) {
return setter ( self , ident , value , parser . text , parser . options ) ;
}
} ) ;
}
this . tokens . push ( token ) , methodName && ( this . tokens . push ( {
index : lastDot ,
2022-05-04 17:25:28 +03:00
text : "." ,
2021-08-04 13:27:17 +03:00
json : ! 1
} ) , this . tokens . push ( {
index : lastDot + 1 ,
text : methodName ,
json : ! 1
} ) ) ;
} ,
readString : function ( quote ) {
var start = this . index ;
this . index ++ ;
2022-06-15 17:36:57 +03:00
for ( var string = "" , rawString = quote , escape1 = ! 1 ; this . index < this . text . length ; ) {
2021-08-04 13:27:17 +03:00
var ch = this . text . charAt ( this . index ) ;
2022-06-15 17:36:57 +03:00
if ( rawString += ch , escape1 ) {
2022-05-04 17:25:28 +03:00
if ( "u" === ch ) {
2021-08-04 13:27:17 +03:00
var hex = this . text . substring ( this . index + 1 , this . index + 5 ) ;
2022-05-04 17:25:28 +03:00
hex . match ( /[\da-f]{4}/i ) || this . throwError ( "Invalid unicode escape [\\u" + hex + "]" ) , this . index += 4 , string += String . fromCharCode ( parseInt ( hex , 16 ) ) ;
2021-08-04 13:27:17 +03:00
} else {
var rep = ESCAPE [ ch ] ;
rep ? string += rep : string += ch ;
}
2022-06-15 17:36:57 +03:00
escape1 = ! 1 ;
} else if ( "\\" === ch ) escape1 = ! 0 ;
2021-09-16 07:23:33 +03:00
else if ( ch === quote ) {
this . index ++ , this . tokens . push ( {
2021-08-04 13:27:17 +03:00
index : start ,
text : rawString ,
string : string ,
json : ! 0 ,
fn : function ( ) {
return string ;
}
} ) ;
2021-09-16 07:23:33 +03:00
return ;
} else string += ch ;
2021-08-04 13:27:17 +03:00
this . index ++ ;
}
2022-05-04 17:25:28 +03:00
this . throwError ( "Unterminated quote" , start ) ;
2021-08-04 13:27:17 +03:00
}
} ;
var Parser = function ( lexer , $filter , options ) {
2021-07-30 04:11:27 +03:00
this . lexer = lexer , this . $filter = $filter , this . options = options ;
} ;
function setter ( obj , path , setValue , fullExp , options ) {
2022-01-02 23:54:58 +03:00
options = options || { } ;
2022-05-04 17:25:28 +03:00
for ( var key , element = path . split ( "." ) , i = 0 ; element . length > 1 ; i ++ ) {
2022-08-30 06:22:18 +03:00
var propertyObj = obj [ key = ensureSafeMemberName ( element . shift ( ) , fullExp ) ] ;
2022-03-07 06:51:57 +03:00
propertyObj || ( propertyObj = { } , obj [ key ] = propertyObj ) , ( obj = propertyObj ) . then && options . unwrapPromises && ( promiseWarning ( fullExp ) , "$$v" in obj || function ( promise ) {
2021-07-30 04:11:27 +03:00
promise . then ( function ( val ) {
promise . $$v = val ;
} ) ;
2022-03-07 06:51:57 +03:00
} ( obj ) , undefined === obj . $$v && ( obj . $$v = { } ) , obj = obj . $$v ) ;
2021-07-30 04:11:27 +03:00
}
2022-08-30 06:22:18 +03:00
return obj [ key = ensureSafeMemberName ( element . shift ( ) , fullExp ) ] = setValue , setValue ;
2021-07-30 04:11:27 +03:00
}
2021-08-04 13:27:17 +03:00
Parser . ZERO = function ( ) {
return 0 ;
} , Parser . prototype = {
constructor : Parser ,
parse : function ( text , json ) {
this . text = text , this . json = json , this . tokens = this . lexer . lex ( text ) , json && ( this . assignment = this . logicalOR , this . functionCall = this . fieldAccess = this . objectIndex = this . filterChain = function ( ) {
2022-05-04 17:25:28 +03:00
this . throwError ( "is not valid json" , {
2021-08-04 13:27:17 +03:00
text : text ,
index : 0
} ) ;
} ) ;
var value = json ? this . primary ( ) : this . statements ( ) ;
2022-05-04 17:25:28 +03:00
return 0 !== this . tokens . length && this . throwError ( "is an unexpected token" , this . tokens [ 0 ] ) , value . literal = ! ! value . literal , value . constant = ! ! value . constant , value ;
2021-08-04 13:27:17 +03:00
} ,
primary : function ( ) {
2022-05-04 17:25:28 +03:00
if ( this . expect ( "(" ) ) primary = this . filterChain ( ) , this . consume ( ")" ) ;
else if ( this . expect ( "[" ) ) primary = this . arrayDeclaration ( ) ;
else if ( this . expect ( "{" ) ) primary = this . object ( ) ;
2021-08-04 13:27:17 +03:00
else {
var primary , next , context , token = this . expect ( ) ;
2022-05-04 17:25:28 +03:00
( primary = token . fn ) || this . throwError ( "not a primary expression" , token ) , token . json && ( primary . constant = ! 0 , primary . literal = ! 0 ) ;
2021-08-04 13:27:17 +03:00
}
2022-05-04 17:25:28 +03:00
for ( ; next = this . expect ( "(" , "[" , "." ) ; ) "(" === next . text ? ( primary = this . functionCall ( primary , context ) , context = null ) : "[" === next . text ? ( context = primary , primary = this . objectIndex ( primary ) ) : "." === next . text ? ( context = primary , primary = this . fieldAccess ( primary ) ) : this . throwError ( "IMPOSSIBLE" ) ;
2021-08-04 13:27:17 +03:00
return primary ;
} ,
throwError : function ( msg , token ) {
2022-05-04 17:25:28 +03:00
throw $parseMinErr ( "syntax" , "Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}]." , token . text , msg , token . index + 1 , this . text , this . text . substring ( token . index ) ) ;
2021-08-04 13:27:17 +03:00
} ,
peekToken : function ( ) {
2022-05-04 17:25:28 +03:00
if ( 0 === this . tokens . length ) throw $parseMinErr ( "ueoe" , "Unexpected end of expression: {0}" , this . text ) ;
2021-08-04 13:27:17 +03:00
return this . tokens [ 0 ] ;
} ,
peek : function ( e1 , e2 , e3 , e4 ) {
if ( this . tokens . length > 0 ) {
var token = this . tokens [ 0 ] , t = token . text ;
if ( t === e1 || t === e2 || t === e3 || t === e4 || ! e1 && ! e2 && ! e3 && ! e4 ) return token ;
}
return ! 1 ;
} ,
expect : function ( e1 , e2 , e3 , e4 ) {
var token = this . peek ( e1 , e2 , e3 , e4 ) ;
2022-05-04 17:25:28 +03:00
return ! ! token && ( this . json && ! token . json && this . throwError ( "is not valid json" , token ) , this . tokens . shift ( ) , token ) ;
2021-08-04 13:27:17 +03:00
} ,
consume : function ( e1 ) {
2022-05-04 17:25:28 +03:00
this . expect ( e1 ) || this . throwError ( "is unexpected, expecting [" + e1 + "]" , this . peek ( ) ) ;
2021-08-04 13:27:17 +03:00
} ,
unaryFn : function ( fn , right ) {
return extend ( function ( self , locals ) {
return fn ( self , locals , right ) ;
} , {
constant : right . constant
} ) ;
} ,
ternaryFn : function ( left , middle , right ) {
return extend ( function ( self , locals ) {
return left ( self , locals ) ? middle ( self , locals ) : right ( self , locals ) ;
} , {
constant : left . constant && middle . constant && right . constant
} ) ;
} ,
binaryFn : function ( left , fn , right ) {
return extend ( function ( self , locals ) {
return fn ( self , locals , left , right ) ;
} , {
constant : left . constant && right . constant
} ) ;
} ,
statements : function ( ) {
2022-05-04 17:25:28 +03:00
for ( var statements = [ ] ; ; ) if ( this . tokens . length > 0 && ! this . peek ( "}" , ")" , ";" , "]" ) && statements . push ( this . filterChain ( ) ) , ! this . expect ( ";" ) ) return 1 === statements . length ? statements [ 0 ] : function ( self , locals ) {
2021-08-04 13:27:17 +03:00
for ( var value , i = 0 ; i < statements . length ; i ++ ) {
var statement = statements [ i ] ;
statement && ( value = statement ( self , locals ) ) ;
}
return value ;
} ;
} ,
filterChain : function ( ) {
for ( var token , left = this . expression ( ) ; ; ) {
2022-05-04 17:25:28 +03:00
if ( ! ( token = this . expect ( "|" ) ) ) return left ;
2021-08-04 13:27:17 +03:00
left = this . binaryFn ( left , token . fn , this . filter ( ) ) ;
}
} ,
filter : function ( ) {
2022-05-04 17:25:28 +03:00
for ( var token = this . expect ( ) , fn = this . $filter ( token . text ) , argsFn = [ ] ; ; ) if ( token = this . expect ( ":" ) ) argsFn . push ( this . expression ( ) ) ;
2021-08-04 13:27:17 +03:00
else {
var fnInvoke = function ( self , locals , input ) {
for ( var args = [
input
] , i = 0 ; i < argsFn . length ; i ++ ) args . push ( argsFn [ i ] ( self , locals ) ) ;
return fn . apply ( self , args ) ;
} ;
return function ( ) {
return fnInvoke ;
} ;
}
} ,
expression : function ( ) {
return this . assignment ( ) ;
} ,
assignment : function ( ) {
var right , token , left = this . ternary ( ) ;
2022-05-04 17:25:28 +03:00
return ( token = this . expect ( "=" ) ) ? ( left . assign || this . throwError ( "implies assignment but [" + this . text . substring ( 0 , token . index ) + "] can not be assigned to" , token ) , right = this . ternary ( ) , function ( scope , locals ) {
2021-10-10 06:47:11 +03:00
return left . assign ( scope , right ( scope , locals ) , locals ) ;
2021-08-04 13:27:17 +03:00
} ) : left ;
} ,
ternary : function ( ) {
var middle , token , left = this . logicalOR ( ) ;
2022-05-04 17:25:28 +03:00
return ( token = this . expect ( "?" ) ) ? ( middle = this . ternary ( ) , token = this . expect ( ":" ) ) ? this . ternaryFn ( left , middle , this . ternary ( ) ) : void this . throwError ( "expected :" , token ) : left ;
2021-08-04 13:27:17 +03:00
} ,
logicalOR : function ( ) {
for ( var token , left = this . logicalAND ( ) ; ; ) {
2022-05-04 17:25:28 +03:00
if ( ! ( token = this . expect ( "||" ) ) ) return left ;
2021-08-04 13:27:17 +03:00
left = this . binaryFn ( left , token . fn , this . logicalAND ( ) ) ;
}
} ,
logicalAND : function ( ) {
var token , left = this . equality ( ) ;
2022-05-04 17:25:28 +03:00
return ( token = this . expect ( "&&" ) ) && ( left = this . binaryFn ( left , token . fn , this . logicalAND ( ) ) ) , left ;
2021-08-04 13:27:17 +03:00
} ,
equality : function ( ) {
var token , left = this . relational ( ) ;
2022-05-04 17:25:28 +03:00
return ( token = this . expect ( "==" , "!=" , "===" , "!==" ) ) && ( left = this . binaryFn ( left , token . fn , this . equality ( ) ) ) , left ;
2021-08-04 13:27:17 +03:00
} ,
relational : function ( ) {
var token , left = this . additive ( ) ;
2022-05-04 17:25:28 +03:00
return ( token = this . expect ( "<" , ">" , "<=" , ">=" ) ) && ( left = this . binaryFn ( left , token . fn , this . relational ( ) ) ) , left ;
2021-08-04 13:27:17 +03:00
} ,
additive : function ( ) {
2022-05-04 17:25:28 +03:00
for ( var token , left = this . multiplicative ( ) ; token = this . expect ( "+" , "-" ) ; ) left = this . binaryFn ( left , token . fn , this . multiplicative ( ) ) ;
2021-08-04 13:27:17 +03:00
return left ;
} ,
multiplicative : function ( ) {
2022-05-04 17:25:28 +03:00
for ( var token , left = this . unary ( ) ; token = this . expect ( "*" , "/" , "%" ) ; ) left = this . binaryFn ( left , token . fn , this . unary ( ) ) ;
2021-08-04 13:27:17 +03:00
return left ;
} ,
unary : function ( ) {
var token ;
2022-05-04 17:25:28 +03:00
return this . expect ( "+" ) ? this . primary ( ) : ( token = this . expect ( "-" ) ) ? this . binaryFn ( Parser . ZERO , token . fn , this . unary ( ) ) : ( token = this . expect ( "!" ) ) ? this . unaryFn ( token . fn , this . unary ( ) ) : this . primary ( ) ;
2021-08-04 13:27:17 +03:00
} ,
fieldAccess : function ( object ) {
2021-09-01 16:11:55 +03:00
var parser = this , field = this . expect ( ) . text , getter = getterFn ( field , this . options , this . text ) ;
2021-08-04 13:27:17 +03:00
return extend ( function ( scope , locals , self ) {
2021-09-01 16:11:55 +03:00
return getter ( self || object ( scope , locals ) , locals ) ;
2021-08-04 13:27:17 +03:00
} , {
assign : function ( scope , value , locals ) {
return setter ( object ( scope , locals ) , field , value , parser . text , parser . options ) ;
}
} ) ;
} ,
objectIndex : function ( obj ) {
var parser = this , indexFn = this . expression ( ) ;
2022-05-04 17:25:28 +03:00
return this . consume ( "]" ) , extend ( function ( self , locals ) {
2021-08-04 13:27:17 +03:00
var v , p , o = obj ( self , locals ) , i = indexFn ( self , locals ) ;
2022-08-30 06:22:18 +03:00
if ( o ) return ( v = ensureSafeObject ( o [ i ] , parser . text ) ) && v . then && parser . options . unwrapPromises && ( p = v , "$$v" in v || ( p . $$v = undefined , p . then ( function ( val ) {
2021-08-04 13:27:17 +03:00
p . $$v = val ;
} ) ) , v = v . $$v ) , v ;
} , {
assign : function ( self , value , locals ) {
2022-08-30 06:22:18 +03:00
var key = indexFn ( self , locals ) ;
return ensureSafeObject ( obj ( self , locals ) , parser . text ) [ key ] = value ;
2021-08-04 13:27:17 +03:00
}
} ) ;
} ,
functionCall : function ( fn , contextGetter ) {
var argsFn = [ ] ;
2022-05-04 17:25:28 +03:00
if ( ")" !== this . peekToken ( ) . text ) do argsFn . push ( this . expression ( ) ) ;
while ( this . expect ( "," ) )
this . consume ( ")" ) ;
2021-08-04 13:27:17 +03:00
var parser = this ;
return function ( scope , locals ) {
for ( var args = [ ] , context = contextGetter ? contextGetter ( scope , locals ) : scope , i = 0 ; i < argsFn . length ; i ++ ) args . push ( argsFn [ i ] ( scope , locals ) ) ;
var fnPtr = fn ( scope , locals , context ) || noop ;
2022-08-26 11:45:49 +03:00
ensureSafeObject ( context , parser . text ) , ensureSafeObject ( fnPtr , parser . text ) ;
var v = fnPtr . apply ? fnPtr . apply ( context , args ) : fnPtr ( args [ 0 ] , args [ 1 ] , args [ 2 ] , args [ 3 ] , args [ 4 ] ) ;
return ensureSafeObject ( v , parser . text ) ;
2021-08-04 13:27:17 +03:00
} ;
} ,
arrayDeclaration : function ( ) {
var elementFns = [ ] , allConstant = ! 0 ;
2022-05-04 17:25:28 +03:00
if ( "]" !== this . peekToken ( ) . text ) do {
2021-08-04 13:27:17 +03:00
var elementFn = this . expression ( ) ;
elementFns . push ( elementFn ) , elementFn . constant || ( allConstant = ! 1 ) ;
2022-05-04 17:25:28 +03:00
} while ( this . expect ( "," ) )
return this . consume ( "]" ) , extend ( function ( self , locals ) {
2021-08-04 13:27:17 +03:00
for ( var array = [ ] , i = 0 ; i < elementFns . length ; i ++ ) array . push ( elementFns [ i ] ( self , locals ) ) ;
return array ;
} , {
literal : ! 0 ,
constant : allConstant
} ) ;
} ,
object : function ( ) {
var keyValues = [ ] , allConstant = ! 0 ;
2022-05-04 17:25:28 +03:00
if ( "}" !== this . peekToken ( ) . text ) do {
2021-08-04 13:27:17 +03:00
var token = this . expect ( ) , key = token . string || token . text ;
2022-05-04 17:25:28 +03:00
this . consume ( ":" ) ;
2021-08-04 13:27:17 +03:00
var value = this . expression ( ) ;
keyValues . push ( {
key : key ,
value : value
} ) , value . constant || ( allConstant = ! 1 ) ;
2022-05-04 17:25:28 +03:00
} while ( this . expect ( "," ) )
return this . consume ( "}" ) , extend ( function ( self , locals ) {
2022-01-02 23:54:58 +03:00
for ( var object = { } , i = 0 ; i < keyValues . length ; i ++ ) {
2021-08-04 13:27:17 +03:00
var keyValue = keyValues [ i ] ;
object [ keyValue . key ] = keyValue . value ( self , locals ) ;
}
return object ;
} , {
literal : ! 0 ,
constant : allConstant
} ) ;
}
} ;
2022-01-02 23:54:58 +03:00
var getterFnCache = { } ;
2021-08-04 13:27:17 +03:00
function cspSafeGetterFn ( key0 , key1 , key2 , key3 , key4 , fullExp , options ) {
return ensureSafeMemberName ( key0 , fullExp ) , ensureSafeMemberName ( key1 , fullExp ) , ensureSafeMemberName ( key2 , fullExp ) , ensureSafeMemberName ( key3 , fullExp ) , ensureSafeMemberName ( key4 , fullExp ) , options . unwrapPromises ? function ( scope , locals ) {
var promise , pathVal = locals && locals . hasOwnProperty ( key0 ) ? locals : scope ;
return null === pathVal || pathVal === undefined || ( ( pathVal = pathVal [ key0 ] ) && pathVal . then && ( promiseWarning ( fullExp ) , "$$v" in pathVal || ( ( promise = pathVal ) . $$v = undefined , promise . then ( function ( val ) {
promise . $$v = val ;
2022-02-28 15:07:12 +03:00
} ) ) , pathVal = pathVal . $$v ) , key1 && null !== pathVal && pathVal !== undefined && ( ( pathVal = pathVal [ key1 ] ) && pathVal . then && ( promiseWarning ( fullExp ) , "$$v" in pathVal || ( ( promise = pathVal ) . $$v = undefined , promise . then ( function ( val ) {
2021-08-04 13:27:17 +03:00
promise . $$v = val ;
2022-02-28 15:07:12 +03:00
} ) ) , pathVal = pathVal . $$v ) , key2 && null !== pathVal && pathVal !== undefined && ( ( pathVal = pathVal [ key2 ] ) && pathVal . then && ( promiseWarning ( fullExp ) , "$$v" in pathVal || ( ( promise = pathVal ) . $$v = undefined , promise . then ( function ( val ) {
2021-08-04 13:27:17 +03:00
promise . $$v = val ;
2022-02-28 15:07:12 +03:00
} ) ) , pathVal = pathVal . $$v ) , key3 && null !== pathVal && pathVal !== undefined && ( ( pathVal = pathVal [ key3 ] ) && pathVal . then && ( promiseWarning ( fullExp ) , "$$v" in pathVal || ( ( promise = pathVal ) . $$v = undefined , promise . then ( function ( val ) {
2021-08-04 13:27:17 +03:00
promise . $$v = val ;
2022-02-28 15:07:12 +03:00
} ) ) , pathVal = pathVal . $$v ) , key4 && null !== pathVal && pathVal !== undefined && ( pathVal = pathVal [ key4 ] ) && pathVal . then && ( promiseWarning ( fullExp ) , "$$v" in pathVal || ( ( promise = pathVal ) . $$v = undefined , promise . then ( function ( val ) {
2021-07-30 04:11:27 +03:00
promise . $$v = val ;
2021-08-07 11:27:52 +03:00
} ) ) , pathVal = pathVal . $$v ) ) ) ) ) , pathVal ;
2021-07-30 04:11:27 +03:00
} : function ( scope , locals ) {
var pathVal = locals && locals . hasOwnProperty ( key0 ) ? locals : scope ;
return null === pathVal || pathVal === undefined ? pathVal : ( pathVal = pathVal [ key0 ] , key1 && null !== pathVal && pathVal !== undefined && ( pathVal = pathVal [ key1 ] , key2 && null !== pathVal && pathVal !== undefined && ( pathVal = pathVal [ key2 ] , key3 && null !== pathVal && pathVal !== undefined && ( pathVal = pathVal [ key3 ] , key4 && null !== pathVal && pathVal !== undefined ) ) ) ) ? pathVal = pathVal [ key4 ] : pathVal ;
} ;
}
function getterFn ( path , options , fullExp ) {
if ( getterFnCache . hasOwnProperty ( path ) ) return getterFnCache [ path ] ;
2022-05-04 17:25:28 +03:00
var fn , pathKeys = path . split ( "." ) , pathKeysLength = pathKeys . length ;
2021-07-30 04:11:27 +03:00
if ( options . csp ) fn = pathKeysLength < 6 ? cspSafeGetterFn ( pathKeys [ 0 ] , pathKeys [ 1 ] , pathKeys [ 2 ] , pathKeys [ 3 ] , pathKeys [ 4 ] , fullExp , options ) : function ( scope , locals ) {
var val , i = 0 ;
do val = cspSafeGetterFn ( pathKeys [ i ++ ] , pathKeys [ i ++ ] , pathKeys [ i ++ ] , pathKeys [ i ++ ] , pathKeys [ i ++ ] , fullExp , options ) ( scope , locals ) , locals = undefined , scope = val ;
while ( i < pathKeysLength )
return val ;
} ;
else {
2022-05-04 17:25:28 +03:00
var code = "var l, fn, p;\n" ;
2021-07-30 04:11:27 +03:00
forEach ( pathKeys , function ( key , index ) {
2022-05-04 17:25:28 +03:00
ensureSafeMemberName ( key , fullExp ) , code += "if(s === null || s === undefined) return s;\nl=s;\ns=" + ( index ? "s" : '((k&&k.hasOwnProperty("' + key + '"))?k:s)' ) + '["' + key + '"];\n' + ( options . unwrapPromises ? 'if (s && s.then) {\n pw("' + fullExp . replace ( /(["\r\n])/g , "\\$1" ) + '");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n' : "" ) ;
2022-06-11 08:27:13 +03:00
} ) ;
var evaledFnGetter = Function ( "s" , "k" , "pw" , code += "return s;" ) ;
2021-07-30 04:11:27 +03:00
evaledFnGetter . toString = function ( ) {
return code ;
} , fn = function ( scope , locals ) {
return evaledFnGetter ( scope , locals , promiseWarning ) ;
} ;
}
2022-05-04 17:25:28 +03:00
return "hasOwnProperty" !== path && ( getterFnCache [ path ] = fn ) , fn ;
2021-07-30 04:11:27 +03:00
}
function $ParseProvider ( ) {
2022-01-02 23:54:58 +03:00
var cache = { } , $parseOptions = {
2021-07-30 04:11:27 +03:00
csp : ! 1 ,
unwrapPromises : ! 1 ,
logPromiseWarnings : ! 0
} ;
this . unwrapPromises = function ( value ) {
return isDefined ( value ) ? ( $parseOptions . unwrapPromises = ! ! value , this ) : $parseOptions . unwrapPromises ;
} , this . logPromiseWarnings = function ( value ) {
return isDefined ( value ) ? ( $parseOptions . logPromiseWarnings = value , this ) : $parseOptions . logPromiseWarnings ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$filter" ,
"$sniffer" ,
"$log" ,
2021-10-21 08:12:50 +03:00
function ( $filter , $sniffer , $log ) {
2021-07-30 04:11:27 +03:00
return $parseOptions . csp = $sniffer . csp , promiseWarning = function ( fullExp ) {
2022-05-04 17:25:28 +03:00
! $parseOptions . logPromiseWarnings || promiseWarningCache . hasOwnProperty ( fullExp ) || ( promiseWarningCache [ fullExp ] = ! 0 , $log . warn ( "[$parse] Promise found in the expression `" + fullExp + "`. Automatic unwrapping of promises in Angular expressions is deprecated." ) ) ;
2021-07-30 04:11:27 +03:00
} , function ( exp ) {
var parsedExpression ;
switch ( typeof exp ) {
2022-05-04 17:25:28 +03:00
case "string" :
2021-07-30 04:11:27 +03:00
if ( cache . hasOwnProperty ( exp ) ) return cache [ exp ] ;
2022-08-30 06:22:18 +03:00
var lexer = new Lexer ( $parseOptions ) ;
return parsedExpression = new Parser ( lexer , $filter , $parseOptions ) . parse ( exp , ! 1 ) , "hasOwnProperty" !== exp && ( cache [ exp ] = parsedExpression ) , parsedExpression ;
2022-05-04 17:25:28 +03:00
case "function" :
2021-08-03 18:52:47 +03:00
return exp ;
default :
return noop ;
2021-07-30 04:11:27 +03:00
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $QProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$rootScope" ,
"$exceptionHandler" ,
2021-10-21 08:12:50 +03:00
function ( $rootScope , $exceptionHandler ) {
2022-09-01 13:36:16 +03:00
return function ( nextTick , exceptionHandler ) {
var defer = function ( ) {
var value , deferred , pending = [ ] ;
return deferred = {
resolve : function ( val ) {
if ( pending ) {
var callbacks = pending ;
pending = undefined , value = ref ( val ) , callbacks . length && nextTick ( function ( ) {
for ( var callback , i = 0 , ii = callbacks . length ; i < ii ; i ++ ) callback = callbacks [ i ] , value . then ( callback [ 0 ] , callback [ 1 ] , callback [ 2 ] ) ;
} ) ;
}
} ,
reject : function ( reason ) {
deferred . resolve ( reject ( reason ) ) ;
} ,
notify : function ( progress ) {
if ( pending ) {
var callbacks = pending ;
pending . length && nextTick ( function ( ) {
for ( var i = 0 , ii = callbacks . length ; i < ii ; i ++ ) ( 0 , callbacks [ i ] ) [ 2 ] ( progress ) ;
} ) ;
}
} ,
promise : {
then : function ( callback , errback , progressback ) {
var result = defer ( ) , wrappedCallback = function ( value ) {
try {
result . resolve ( ( isFunction ( callback ) ? callback : defaultCallback ) ( value ) ) ;
} catch ( e ) {
result . reject ( e ) , exceptionHandler ( e ) ;
}
} , wrappedErrback = function ( reason ) {
try {
result . resolve ( ( isFunction ( errback ) ? errback : defaultErrback ) ( reason ) ) ;
} catch ( e ) {
result . reject ( e ) , exceptionHandler ( e ) ;
}
} , wrappedProgressback = function ( progress ) {
try {
result . notify ( ( isFunction ( progressback ) ? progressback : defaultCallback ) ( progress ) ) ;
} catch ( e ) {
exceptionHandler ( e ) ;
}
} ;
return pending ? pending . push ( [
wrappedCallback ,
wrappedErrback ,
wrappedProgressback ,
] ) : value . then ( wrappedCallback , wrappedErrback , wrappedProgressback ) , result . promise ;
} ,
catch : function ( callback ) {
return this . then ( null , callback ) ;
} ,
finally : function ( callback ) {
function makePromise ( value , resolved ) {
var result = defer ( ) ;
return resolved ? result . resolve ( value ) : result . reject ( value ) , result . promise ;
}
function handleCallback ( value , isResolved ) {
var callbackOutput = null ;
try {
callbackOutput = ( callback || defaultCallback ) ( ) ;
} catch ( e ) {
return makePromise ( e , ! 1 ) ;
}
return callbackOutput && isFunction ( callbackOutput . then ) ? callbackOutput . then ( function ( ) {
return makePromise ( value , isResolved ) ;
} , function ( error ) {
return makePromise ( error , ! 1 ) ;
} ) : makePromise ( value , isResolved ) ;
}
return this . then ( function ( value ) {
return handleCallback ( value , ! 0 ) ;
} , function ( error ) {
return handleCallback ( error , ! 1 ) ;
} ) ;
}
}
} ;
} , ref = function ( value ) {
return value && isFunction ( value . then ) ? value : {
then : function ( callback ) {
var result = defer ( ) ;
return nextTick ( function ( ) {
result . resolve ( callback ( value ) ) ;
} ) , result . promise ;
}
} ;
} , reject = function ( reason ) {
return {
then : function ( callback , errback ) {
var result = defer ( ) ;
return nextTick ( function ( ) {
try {
result . resolve ( ( isFunction ( errback ) ? errback : defaultErrback ) ( reason ) ) ;
} catch ( e ) {
result . reject ( e ) , exceptionHandler ( e ) ;
}
} ) , result . promise ;
}
} ;
} , when = function ( value , callback , errback , progressback ) {
var done , result = defer ( ) , wrappedCallback = function ( value ) {
2021-07-30 04:11:27 +03:00
try {
2022-09-01 13:36:16 +03:00
return ( isFunction ( callback ) ? callback : defaultCallback ) ( value ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
2022-09-01 13:36:16 +03:00
return exceptionHandler ( e ) , reject ( e ) ;
2021-07-30 04:11:27 +03:00
}
} , wrappedErrback = function ( reason ) {
try {
2022-09-01 13:36:16 +03:00
return ( isFunction ( errback ) ? errback : defaultErrback ) ( reason ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
2022-09-01 13:36:16 +03:00
return exceptionHandler ( e ) , reject ( e ) ;
2021-07-30 04:11:27 +03:00
}
} , wrappedProgressback = function ( progress ) {
try {
2022-09-01 13:36:16 +03:00
return ( isFunction ( progressback ) ? progressback : defaultCallback ) ( progress ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
exceptionHandler ( e ) ;
}
} ;
2022-09-01 13:36:16 +03:00
return nextTick ( function ( ) {
ref ( value ) . then ( function ( value ) {
done || ( done = ! 0 , result . resolve ( ref ( value ) . then ( wrappedCallback , wrappedErrback , wrappedProgressback ) ) ) ;
} , function ( reason ) {
done || ( done = ! 0 , result . resolve ( wrappedErrback ( reason ) ) ) ;
} , function ( progress ) {
done || result . notify ( wrappedProgressback ( progress ) ) ;
} ) ;
} ) , result . promise ;
} ;
function defaultCallback ( value ) {
return value ;
2021-07-30 04:11:27 +03:00
}
2022-09-01 13:36:16 +03:00
function defaultErrback ( reason ) {
return reject ( reason ) ;
}
return {
defer : defer ,
reject : reject ,
when : when ,
all : function ( promises ) {
var deferred = defer ( ) , counter = 0 , results = isArray ( promises ) ? [ ] : { } ;
return forEach ( promises , function ( promise , key ) {
counter ++ , ref ( promise ) . then ( function ( value ) {
results . hasOwnProperty ( key ) || ( results [ key ] = value , -- counter || deferred . resolve ( results ) ) ;
} , function ( reason ) {
results . hasOwnProperty ( key ) || deferred . reject ( reason ) ;
} ) ;
} ) , 0 === counter && deferred . resolve ( results ) , deferred . promise ;
2021-07-30 04:11:27 +03:00
}
2022-09-01 13:36:16 +03:00
} ;
} ( function ( callback ) {
$rootScope . $evalAsync ( callback ) ;
} , $exceptionHandler ) ;
} ,
] ;
2021-07-30 04:11:27 +03:00
}
function $RootScopeProvider ( ) {
2022-05-04 17:25:28 +03:00
var TTL = 10 , $rootScopeMinErr = minErr ( "$rootScope" ) , lastDirtyWatch = null ;
2021-07-30 04:11:27 +03:00
this . digestTtl = function ( value ) {
return arguments . length && ( TTL = value ) , TTL ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$injector" ,
"$exceptionHandler" ,
"$parse" ,
"$browser" ,
2021-10-21 08:12:50 +03:00
function ( $injector , $exceptionHandler , $parse , $browser ) {
2021-07-30 04:11:27 +03:00
function Scope ( ) {
2022-01-02 23:54:58 +03:00
this . $id = nextUid ( ) , this . $$phase = this . $parent = this . $$watchers = this . $$nextSibling = this . $$prevSibling = this . $$childHead = this . $$childTail = null , this . this = this . $root = this , this . $$destroyed = ! 1 , this . $$asyncQueue = [ ] , this . $$postDigestQueue = [ ] , this . $$listeners = { } , this . $$isolateBindings = { } ;
2021-07-30 04:11:27 +03:00
}
2021-08-04 13:27:17 +03:00
Scope . prototype = {
2021-07-30 04:11:27 +03:00
constructor : Scope ,
$new : function ( isolate ) {
var ChildScope , child ;
2022-01-02 23:54:58 +03:00
return isolate ? ( ( child = new Scope ( ) ) . $root = this . $root , child . $$asyncQueue = this . $$asyncQueue , child . $$postDigestQueue = this . $$postDigestQueue ) : ( ( ChildScope = function ( ) { } ) . prototype = this , ( child = new ChildScope ( ) ) . $id = nextUid ( ) ) , child . this = child , child . $$listeners = { } , child . $parent = this , child . $$watchers = child . $$nextSibling = child . $$childHead = child . $$childTail = null , child . $$prevSibling = this . $$childTail , this . $$childHead ? ( this . $$childTail . $$nextSibling = child , this . $$childTail = child ) : this . $$childHead = this . $$childTail = child , child ;
2021-07-30 04:11:27 +03:00
} ,
$watch : function ( watchExp , listener , objectEquality ) {
2022-06-15 17:36:57 +03:00
var scope = this , get = compileToFn ( watchExp , "watch" ) , array = scope . $$watchers , watcher = {
2021-07-30 04:11:27 +03:00
fn : listener ,
last : initWatchVal ,
get : get ,
exp : watchExp ,
eq : ! ! objectEquality
} ;
if ( lastDirtyWatch = null , ! isFunction ( listener ) ) {
2022-05-04 17:25:28 +03:00
var listenFn = compileToFn ( listener || noop , "listener" ) ;
2021-07-30 04:11:27 +03:00
watcher . fn = function ( newVal , oldVal , scope ) {
listenFn ( scope ) ;
} ;
}
2022-05-04 17:25:28 +03:00
if ( "string" == typeof watchExp && get . constant ) {
2021-07-30 04:11:27 +03:00
var originalFn = watcher . fn ;
watcher . fn = function ( newVal , oldVal , scope ) {
originalFn . call ( this , newVal , oldVal , scope ) , arrayRemove ( array , watcher ) ;
} ;
}
2022-06-15 17:36:57 +03:00
return array || ( array = scope . $$watchers = [ ] ) , array . unshift ( watcher ) , function ( ) {
2021-07-30 04:11:27 +03:00
arrayRemove ( array , watcher ) ;
} ;
} ,
$watchCollection : function ( obj , listener ) {
2022-01-02 23:54:58 +03:00
var oldValue , newValue , self = this , changeDetected = 0 , objGetter = $parse ( obj ) , internalArray = [ ] , internalObject = { } , oldLength = 0 ;
2021-07-30 04:11:27 +03:00
return this . $watch ( function ( ) {
2022-04-12 05:12:10 +03:00
if ( isObject ( newValue = objGetter ( self ) ) ) {
if ( isArrayLike ( newValue ) ) {
oldValue !== internalArray && ( oldLength = ( oldValue = internalArray ) . length = 0 , changeDetected ++ ) , oldLength !== ( newLength = newValue . length ) && ( changeDetected ++ , oldValue . length = oldLength = newLength ) ;
for ( var newLength , key , i = 0 ; i < newLength ; i ++ ) oldValue [ i ] !== newValue [ i ] && ( changeDetected ++ , oldValue [ i ] = newValue [ i ] ) ;
} else {
for ( key in oldValue !== internalObject && ( oldValue = internalObject = { } , oldLength = 0 , changeDetected ++ ) , newLength = 0 , newValue ) newValue . hasOwnProperty ( key ) && ( newLength ++ , oldValue . hasOwnProperty ( key ) ? oldValue [ key ] !== newValue [ key ] && ( changeDetected ++ , oldValue [ key ] = newValue [ key ] ) : ( oldLength ++ , oldValue [ key ] = newValue [ key ] , changeDetected ++ ) ) ;
if ( oldLength > newLength ) for ( key in changeDetected ++ , oldValue ) oldValue . hasOwnProperty ( key ) && ! newValue . hasOwnProperty ( key ) && ( oldLength -- , delete oldValue [ key ] ) ;
}
} else oldValue !== newValue && ( oldValue = newValue , changeDetected ++ ) ;
2021-07-30 04:11:27 +03:00
return changeDetected ;
} , function ( ) {
listener ( newValue , oldValue , self ) ;
} ) ;
} ,
$digest : function ( ) {
var watch , value , last , watchers , length , dirty , next , current , logIdx , logMsg , asyncTask , asyncQueue = this . $$asyncQueue , postDigestQueue = this . $$postDigestQueue , ttl = TTL , watchLog = [ ] ;
2022-05-04 17:25:28 +03:00
beginPhase ( "$digest" ) , lastDirtyWatch = null ;
2021-07-30 04:11:27 +03:00
do {
for ( dirty = ! 1 , current = this ; asyncQueue . length ; ) {
try {
( asyncTask = asyncQueue . shift ( ) ) . scope . $eval ( asyncTask . expression ) ;
} catch ( e ) {
clearPhase ( ) , $exceptionHandler ( e ) ;
}
lastDirtyWatch = null ;
}
traverseScopesLoop : do {
if ( watchers = current . $$watchers ) for ( length = watchers . length ; length -- ; ) try {
2022-04-12 05:12:10 +03:00
if ( watch = watchers [ length ] ) {
2022-05-04 17:25:28 +03:00
if ( ( value = watch . get ( current ) ) === ( last = watch . last ) || ( watch . eq ? equals ( value , last ) : "number" == typeof value && "number" == typeof last && isNaN ( value ) && isNaN ( last ) ) ) {
2022-04-12 05:12:10 +03:00
if ( watch === lastDirtyWatch ) {
dirty = ! 1 ;
break traverseScopesLoop ;
}
2022-05-04 17:25:28 +03:00
} else dirty = ! 0 , lastDirtyWatch = watch , watch . last = watch . eq ? copy ( value ) : value , watch . fn ( value , last === initWatchVal ? value : last , current ) , ttl < 5 && ( watchLog [ logIdx = 4 - ttl ] || ( watchLog [ logIdx ] = [ ] ) , logMsg = isFunction ( watch . exp ) ? "fn: " + ( watch . exp . name || watch . exp . toString ( ) ) : watch . exp , logMsg += "; newVal: " + toJson ( value ) + "; oldVal: " + toJson ( last ) , watchLog [ logIdx ] . push ( logMsg ) ) ;
2022-04-12 05:12:10 +03:00
}
2022-06-15 17:36:57 +03:00
} catch ( e1 ) {
clearPhase ( ) , $exceptionHandler ( e1 ) ;
2021-07-30 04:11:27 +03:00
}
if ( ! ( next = current . $$childHead || current !== this && current . $$nextSibling ) ) for ( ; current !== this && ! ( next = current . $$nextSibling ) ; ) current = current . $parent ;
} while ( current = next )
2022-05-04 17:25:28 +03:00
if ( dirty && ! ttl -- ) throw clearPhase ( ) , $rootScopeMinErr ( "infdig" , "{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}" , TTL , toJson ( watchLog ) ) ;
2021-07-30 04:11:27 +03:00
} while ( dirty || asyncQueue . length )
for ( clearPhase ( ) ; postDigestQueue . length ; ) try {
postDigestQueue . shift ( ) ( ) ;
2022-06-15 17:36:57 +03:00
} catch ( e2 ) {
$exceptionHandler ( e2 ) ;
2021-07-30 04:11:27 +03:00
}
} ,
$destroy : function ( ) {
if ( ! this . $$destroyed ) {
var parent = this . $parent ;
2022-05-04 17:25:28 +03:00
this . $broadcast ( "$destroy" ) , this . $$destroyed = ! 0 , this !== $rootScope && ( parent . $$childHead == this && ( parent . $$childHead = this . $$nextSibling ) , parent . $$childTail == this && ( parent . $$childTail = this . $$prevSibling ) , this . $$prevSibling && ( this . $$prevSibling . $$nextSibling = this . $$nextSibling ) , this . $$nextSibling && ( this . $$nextSibling . $$prevSibling = this . $$prevSibling ) , this . $parent = this . $$nextSibling = this . $$prevSibling = this . $$childHead = this . $$childTail = null ) ;
2021-07-30 04:11:27 +03:00
}
} ,
$eval : function ( expr , locals ) {
return $parse ( expr ) ( this , locals ) ;
} ,
$evalAsync : function ( expr ) {
$rootScope . $$phase || $rootScope . $$asyncQueue . length || $browser . defer ( function ( ) {
$rootScope . $$asyncQueue . length && $rootScope . $digest ( ) ;
} ) , this . $$asyncQueue . push ( {
scope : this ,
expression : expr
} ) ;
} ,
$$postDigest : function ( fn ) {
this . $$postDigestQueue . push ( fn ) ;
} ,
$apply : function ( expr ) {
try {
2022-05-04 17:25:28 +03:00
return beginPhase ( "$apply" ) , this . $eval ( expr ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
$exceptionHandler ( e ) ;
} finally {
clearPhase ( ) ;
try {
$rootScope . $digest ( ) ;
2022-06-15 17:36:57 +03:00
} catch ( e1 ) {
throw $exceptionHandler ( e1 ) , e1 ;
2021-07-30 04:11:27 +03:00
}
}
} ,
$on : function ( name , listener ) {
var namedListeners = this . $$listeners [ name ] ;
return namedListeners || ( this . $$listeners [ name ] = namedListeners = [ ] ) , namedListeners . push ( listener ) , function ( ) {
namedListeners [ indexOf ( namedListeners , listener ) ] = null ;
} ;
} ,
$emit : function ( name , args ) {
var namedListeners , i , length , empty = [ ] , scope = this , stopPropagation = ! 1 , event = {
name : name ,
targetScope : scope ,
stopPropagation : function ( ) {
stopPropagation = ! 0 ;
} ,
preventDefault : function ( ) {
event . defaultPrevented = ! 0 ;
} ,
defaultPrevented : ! 1
2022-06-15 17:36:57 +03:00
} , listenerArgs = concat ( [
2021-08-03 18:52:47 +03:00
event
] , arguments , 1 ) ;
2021-07-30 04:11:27 +03:00
do {
for ( i = 0 , namedListeners = scope . $$listeners [ name ] || empty , event . currentScope = scope , length = namedListeners . length ; i < length ; i ++ ) {
if ( ! namedListeners [ i ] ) {
namedListeners . splice ( i , 1 ) , i -- , length -- ;
continue ;
}
try {
namedListeners [ i ] . apply ( null , listenerArgs ) ;
} catch ( e ) {
$exceptionHandler ( e ) ;
}
}
2022-05-08 07:07:58 +03:00
if ( stopPropagation ) break ;
2021-07-30 04:11:27 +03:00
scope = scope . $parent ;
} while ( scope )
return event ;
} ,
$broadcast : function ( name , args ) {
2022-09-07 06:51:42 +03:00
var listeners , i , length , current = this , next = this , event = {
2021-07-30 04:11:27 +03:00
name : name ,
2022-09-07 06:51:42 +03:00
targetScope : this ,
2021-07-30 04:11:27 +03:00
preventDefault : function ( ) {
event . defaultPrevented = ! 0 ;
} ,
defaultPrevented : ! 1
2022-06-15 17:36:57 +03:00
} , listenerArgs = concat ( [
2021-08-03 18:52:47 +03:00
event
] , arguments , 1 ) ;
2021-07-30 04:11:27 +03:00
do {
2022-08-30 06:22:18 +03:00
for ( i = 0 , current = next , event . currentScope = current , length = ( listeners = current . $$listeners [ name ] || [ ] ) . length ; i < length ; i ++ ) {
2021-07-30 04:11:27 +03:00
if ( ! listeners [ i ] ) {
listeners . splice ( i , 1 ) , i -- , length -- ;
continue ;
}
try {
listeners [ i ] . apply ( null , listenerArgs ) ;
} catch ( e ) {
$exceptionHandler ( e ) ;
}
}
2022-09-07 06:51:42 +03:00
if ( ! ( next = current . $$childHead || current !== this && current . $$nextSibling ) ) for ( ; current !== this && ! ( next = current . $$nextSibling ) ; ) current = current . $parent ;
2021-07-30 04:11:27 +03:00
} while ( current = next )
return event ;
}
2021-08-04 13:27:17 +03:00
} ;
var $rootScope = new Scope ( ) ;
return $rootScope ;
2022-05-18 10:25:25 +03:00
function beginPhase ( phase ) {
if ( $rootScope . $$phase ) throw $rootScopeMinErr ( "inprog" , "{0} already in progress" , $rootScope . $$phase ) ;
$rootScope . $$phase = phase ;
}
function clearPhase ( ) {
$rootScope . $$phase = null ;
}
function compileToFn ( exp , name ) {
var fn = $parse ( exp ) ;
return assertArgFn ( fn , name ) , fn ;
}
function initWatchVal ( ) { }
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $$SanitizeUriProvider ( ) {
var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/ , imgSrcSanitizationWhitelist = /^\s*(https?|ftp|file):|data:image\// ;
this . aHrefSanitizationWhitelist = function ( regexp ) {
return isDefined ( regexp ) ? ( aHrefSanitizationWhitelist = regexp , this ) : aHrefSanitizationWhitelist ;
} , this . imgSrcSanitizationWhitelist = function ( regexp ) {
return isDefined ( regexp ) ? ( imgSrcSanitizationWhitelist = regexp , this ) : imgSrcSanitizationWhitelist ;
} , this . $get = function ( ) {
return function ( uri , isImage ) {
2022-05-20 07:57:38 +03:00
var normalizedVal , regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist ;
2022-08-30 06:22:18 +03:00
return msie && ! ( msie >= 8 ) || "" === ( normalizedVal = urlResolve ( uri ) . href ) || normalizedVal . match ( regex ) ? uri : "unsafe:" + normalizedVal ;
2021-07-30 04:11:27 +03:00
} ;
} ;
}
2022-05-04 17:25:28 +03:00
var $sceMinErr = minErr ( "$sce" ) , SCE _CONTEXTS = {
HTML : "html" ,
CSS : "css" ,
URL : "url" ,
RESOURCE _URL : "resourceUrl" ,
JS : "js"
2021-07-30 04:11:27 +03:00
} ;
function adjustMatchers ( matchers ) {
var adjustedMatchers = [ ] ;
2022-06-15 17:36:57 +03:00
return isDefined ( matchers ) && forEach ( matchers , function ( matcher ) {
2021-09-08 12:45:39 +03:00
adjustedMatchers . push ( function ( matcher ) {
2022-05-04 17:25:28 +03:00
if ( "self" === matcher ) return matcher ;
2021-09-08 12:45:39 +03:00
if ( isString ( matcher ) ) {
2022-05-04 17:25:28 +03:00
if ( matcher . indexOf ( "***" ) > - 1 ) throw $sceMinErr ( "iwcard" , "Illegal sequence *** in string matcher. String: {0}" , matcher ) ;
2022-06-11 08:27:13 +03:00
return RegExp ( "^" + ( matcher = matcher . replace ( /([-()\[\]{}+?*.$\^|,:#<!\\])/g , "\\$1" ) . replace ( /\x08/g , "\\x08" ) . replace ( "\\*\\*" , ".*" ) . replace ( "\\*" , "[^:/.?&;]*" ) ) + "$" ) ;
2021-09-08 12:45:39 +03:00
}
2022-06-11 08:27:13 +03:00
if ( isRegExp ( matcher ) ) return RegExp ( "^" + matcher . source + "$" ) ;
2022-05-04 17:25:28 +03:00
throw $sceMinErr ( "imatcher" , 'Matchers may only be "self", string patterns or RegExp objects' ) ;
2022-06-15 17:36:57 +03:00
} ( matcher ) ) ;
2021-07-30 04:11:27 +03:00
} ) , adjustedMatchers ;
}
function $SceDelegateProvider ( ) {
this . SCE _CONTEXTS = SCE _CONTEXTS ;
2021-08-03 18:52:47 +03:00
var resourceUrlWhitelist = [
2022-05-04 17:25:28 +03:00
"self"
2021-08-03 18:52:47 +03:00
] , resourceUrlBlacklist = [ ] ;
2021-07-30 04:11:27 +03:00
this . resourceUrlWhitelist = function ( value ) {
return arguments . length && ( resourceUrlWhitelist = adjustMatchers ( value ) ) , resourceUrlWhitelist ;
} , this . resourceUrlBlacklist = function ( value ) {
return arguments . length && ( resourceUrlBlacklist = adjustMatchers ( value ) ) , resourceUrlBlacklist ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$injector" ,
2021-10-21 08:12:50 +03:00
function ( $injector ) {
2021-07-30 04:11:27 +03:00
var htmlSanitizer = function ( html ) {
2022-05-04 17:25:28 +03:00
throw $sceMinErr ( "unsafe" , "Attempting to use an unsafe value in a safe context." ) ;
2021-07-30 04:11:27 +03:00
} ;
function matchUrl ( matcher , parsedUrl ) {
2022-05-04 17:25:28 +03:00
return "self" === matcher ? urlIsSameOrigin ( parsedUrl ) : ! ! matcher . exec ( parsedUrl . href ) ;
2021-07-30 04:11:27 +03:00
}
function generateHolderType ( Base ) {
var holderType = function ( trustedValue ) {
this . $$unwrapTrustedValue = function ( ) {
return trustedValue ;
} ;
} ;
return Base && ( holderType . prototype = new Base ( ) ) , holderType . prototype . valueOf = function ( ) {
return this . $$unwrapTrustedValue ( ) ;
} , holderType . prototype . toString = function ( ) {
return this . $$unwrapTrustedValue ( ) . toString ( ) ;
} , holderType ;
}
2022-05-04 17:25:28 +03:00
$injector . has ( "$sanitize" ) && ( htmlSanitizer = $injector . get ( "$sanitize" ) ) ;
2022-01-02 23:54:58 +03:00
var trustedValueHolderBase = generateHolderType ( ) , byType = { } ;
2021-08-04 13:27:17 +03:00
return byType [ SCE _CONTEXTS . HTML ] = generateHolderType ( trustedValueHolderBase ) , byType [ SCE _CONTEXTS . CSS ] = generateHolderType ( trustedValueHolderBase ) , byType [ SCE _CONTEXTS . URL ] = generateHolderType ( trustedValueHolderBase ) , byType [ SCE _CONTEXTS . JS ] = generateHolderType ( trustedValueHolderBase ) , byType [ SCE _CONTEXTS . RESOURCE _URL ] = generateHolderType ( byType [ SCE _CONTEXTS . URL ] ) , {
2021-07-30 04:11:27 +03:00
trustAs : function ( type , trustedValue ) {
var Constructor = byType . hasOwnProperty ( type ) ? byType [ type ] : null ;
2022-05-04 17:25:28 +03:00
if ( ! Constructor ) throw $sceMinErr ( "icontext" , "Attempted to trust a value in invalid context. Context: {0}; Value: {1}" , type , trustedValue ) ;
if ( null === trustedValue || trustedValue === undefined || "" === trustedValue ) return trustedValue ;
if ( "string" != typeof trustedValue ) throw $sceMinErr ( "itype" , "Attempted to trust a non-string value in a content requiring a string: Context: {0}" , type ) ;
2021-07-30 04:11:27 +03:00
return new Constructor ( trustedValue ) ;
} ,
getTrusted : function ( type , maybeTrusted ) {
2022-05-04 17:25:28 +03:00
if ( null === maybeTrusted || maybeTrusted === undefined || "" === maybeTrusted ) return maybeTrusted ;
2021-07-30 04:11:27 +03:00
var constructor = byType . hasOwnProperty ( type ) ? byType [ type ] : null ;
if ( constructor && maybeTrusted instanceof constructor ) return maybeTrusted . $$unwrapTrustedValue ( ) ;
if ( type === SCE _CONTEXTS . RESOURCE _URL ) {
2022-03-08 17:35:18 +03:00
if ( function ( url ) {
2021-10-06 10:12:11 +03:00
var i , n , parsedUrl = urlResolve ( url . toString ( ) ) , allowed = ! 1 ;
2021-09-08 12:45:39 +03:00
for ( i = 0 , n = resourceUrlWhitelist . length ; i < n ; i ++ ) if ( matchUrl ( resourceUrlWhitelist [ i ] , parsedUrl ) ) {
allowed = ! 0 ;
break ;
}
if ( allowed ) {
for ( i = 0 , n = resourceUrlBlacklist . length ; i < n ; i ++ ) if ( matchUrl ( resourceUrlBlacklist [ i ] , parsedUrl ) ) {
allowed = ! 1 ;
break ;
}
}
return allowed ;
2022-03-08 17:35:18 +03:00
} ( maybeTrusted ) ) return maybeTrusted ;
2022-05-04 17:25:28 +03:00
throw $sceMinErr ( "insecurl" , "Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}" , maybeTrusted . toString ( ) ) ;
2021-07-30 04:11:27 +03:00
}
if ( type === SCE _CONTEXTS . HTML ) return htmlSanitizer ( maybeTrusted ) ;
2022-05-04 17:25:28 +03:00
throw $sceMinErr ( "unsafe" , "Attempting to use an unsafe value in a safe context." ) ;
2021-07-30 04:11:27 +03:00
} ,
valueOf : function ( maybeTrusted ) {
return maybeTrusted instanceof trustedValueHolderBase ? maybeTrusted . $$unwrapTrustedValue ( ) : maybeTrusted ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $SceProvider ( ) {
var enabled = ! 0 ;
this . enabled = function ( value ) {
return arguments . length && ( enabled = ! ! value ) , enabled ;
2021-08-03 18:52:47 +03:00
} , this . $get = [
2022-05-04 17:25:28 +03:00
"$parse" ,
"$sniffer" ,
"$sceDelegate" ,
2021-10-21 08:12:50 +03:00
function ( $parse , $sniffer , $sceDelegate ) {
2022-05-04 17:25:28 +03:00
if ( enabled && $sniffer . msie && $sniffer . msieDocumentMode < 8 ) throw $sceMinErr ( "iequirks" , "Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information." ) ;
2021-07-30 04:11:27 +03:00
var sce = copy ( SCE _CONTEXTS ) ;
sce . isEnabled = function ( ) {
return enabled ;
} , sce . trustAs = $sceDelegate . trustAs , sce . getTrusted = $sceDelegate . getTrusted , sce . valueOf = $sceDelegate . valueOf , enabled || ( sce . trustAs = sce . getTrusted = function ( type , value ) {
return value ;
} , sce . valueOf = identity ) , sce . parseAs = function ( type , expr ) {
var parsed = $parse ( expr ) ;
return parsed . literal && parsed . constant ? parsed : function ( self , locals ) {
return sce . getTrusted ( type , parsed ( self , locals ) ) ;
} ;
} ;
var parse = sce . parseAs , getTrusted = sce . getTrusted , trustAs = sce . trustAs ;
return forEach ( SCE _CONTEXTS , function ( enumValue , name ) {
var lName = lowercase ( name ) ;
sce [ camelCase ( "parse_as_" + lName ) ] = function ( expr ) {
return parse ( enumValue , expr ) ;
} , sce [ camelCase ( "get_trusted_" + lName ) ] = function ( value ) {
return getTrusted ( enumValue , value ) ;
} , sce [ camelCase ( "trust_as_" + lName ) ] = function ( value ) {
return trustAs ( enumValue , value ) ;
} ;
} ) , sce ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $SnifferProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$window" ,
"$document" ,
2021-10-21 08:12:50 +03:00
function ( $window , $document ) {
2022-06-15 17:36:57 +03:00
var vendorPrefix , match , eventSupport = { } , android = int ( ( /android (\d+)/ . exec ( lowercase ( ( $window . navigator || { } ) . userAgent ) ) || [ ] ) [ 1 ] ) , boxee = /Boxee/i . test ( ( $window . navigator || { } ) . userAgent ) , document1 = $document [ 0 ] || { } , documentMode = document1 . documentMode , vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/ , bodyStyle = document1 . body && document1 . body . style , transitions = ! 1 , animations = ! 1 ;
2021-07-30 04:11:27 +03:00
if ( bodyStyle ) {
for ( var prop in bodyStyle ) if ( match = vendorRegex . exec ( prop ) ) {
vendorPrefix = ( vendorPrefix = match [ 0 ] ) . substr ( 0 , 1 ) . toUpperCase ( ) + vendorPrefix . substr ( 1 ) ;
break ;
}
2022-06-15 17:36:57 +03:00
vendorPrefix || ( vendorPrefix = "WebkitOpacity" in bodyStyle && "webkit" ) , transitions = ! ! ( "transition" in bodyStyle || vendorPrefix + "Transition" in bodyStyle ) , animations = ! ! ( "animation" in bodyStyle || vendorPrefix + "Animation" in bodyStyle ) , ! android || transitions && animations || ( transitions = isString ( document1 . body . style . webkitTransition ) , animations = isString ( document1 . body . style . webkitAnimation ) ) ;
2021-07-30 04:11:27 +03:00
}
return {
history : ! ! ( $window . history && $window . history . pushState && ! ( android < 4 ) && ! boxee ) ,
2022-05-04 17:25:28 +03:00
hashchange : "onhashchange" in $window && ( ! documentMode || documentMode > 7 ) ,
2021-07-30 04:11:27 +03:00
hasEvent : function ( event ) {
2022-05-04 17:25:28 +03:00
if ( "input" == event && 9 == msie ) return ! 1 ;
2021-07-30 04:11:27 +03:00
if ( isUndefined ( eventSupport [ event ] ) ) {
2022-06-15 17:36:57 +03:00
var divElm = document1 . createElement ( "div" ) ;
2022-05-04 17:25:28 +03:00
eventSupport [ event ] = "on" + event in divElm ;
2021-07-30 04:11:27 +03:00
}
return eventSupport [ event ] ;
} ,
csp : csp ( ) ,
vendorPrefix : vendorPrefix ,
transitions : transitions ,
animations : animations ,
msie : msie ,
msieDocumentMode : documentMode
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
function $TimeoutProvider ( ) {
2021-08-03 18:52:47 +03:00
this . $get = [
2022-05-04 17:25:28 +03:00
"$rootScope" ,
"$browser" ,
"$q" ,
"$exceptionHandler" ,
2021-10-21 08:12:50 +03:00
function ( $rootScope , $browser , $q , $exceptionHandler ) {
2022-01-02 23:54:58 +03:00
var deferreds = { } ;
2021-07-30 04:11:27 +03:00
function timeout ( fn , delay , invokeApply ) {
var timeoutId , deferred = $q . defer ( ) , promise = deferred . promise , skipApply = isDefined ( invokeApply ) && ! invokeApply ;
return timeoutId = $browser . defer ( function ( ) {
try {
deferred . resolve ( fn ( ) ) ;
} catch ( e ) {
deferred . reject ( e ) , $exceptionHandler ( e ) ;
} finally {
delete deferreds [ promise . $$timeoutId ] ;
}
skipApply || $rootScope . $apply ( ) ;
} , delay ) , promise . $$timeoutId = timeoutId , deferreds [ timeoutId ] = deferred , promise ;
}
return timeout . cancel = function ( promise ) {
2022-05-04 17:25:28 +03:00
return ! ! promise && promise . $$timeoutId in deferreds && ( deferreds [ promise . $$timeoutId ] . reject ( "canceled" ) , delete deferreds [ promise . $$timeoutId ] , $browser . defer . cancel ( promise . $$timeoutId ) ) ;
2021-07-30 04:11:27 +03:00
} , timeout ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
}
2021-10-21 08:12:50 +03:00
var urlParsingNode = document1 . createElement ( "a" ) , originUrl = urlResolve ( window1 . location . href , ! 0 ) ;
2021-07-30 04:11:27 +03:00
function urlResolve ( url , base ) {
var href = url ;
2022-05-04 17:25:28 +03:00
return msie && ( urlParsingNode . setAttribute ( "href" , href ) , href = urlParsingNode . href ) , urlParsingNode . setAttribute ( "href" , href ) , {
2021-07-30 04:11:27 +03:00
href : urlParsingNode . href ,
2022-05-04 17:25:28 +03:00
protocol : urlParsingNode . protocol ? urlParsingNode . protocol . replace ( /:$/ , "" ) : "" ,
2021-07-30 04:11:27 +03:00
host : urlParsingNode . host ,
2022-05-04 17:25:28 +03:00
search : urlParsingNode . search ? urlParsingNode . search . replace ( /^\?/ , "" ) : "" ,
hash : urlParsingNode . hash ? urlParsingNode . hash . replace ( /^#/ , "" ) : "" ,
2021-07-30 04:11:27 +03:00
hostname : urlParsingNode . hostname ,
port : urlParsingNode . port ,
2022-05-04 17:25:28 +03:00
pathname : "/" === urlParsingNode . pathname . charAt ( 0 ) ? urlParsingNode . pathname : "/" + urlParsingNode . pathname
2021-07-30 04:11:27 +03:00
} ;
}
function urlIsSameOrigin ( requestUrl ) {
var parsed = isString ( requestUrl ) ? urlResolve ( requestUrl ) : requestUrl ;
return parsed . protocol === originUrl . protocol && parsed . host === originUrl . host ;
}
function $WindowProvider ( ) {
2022-06-15 17:36:57 +03:00
this . $get = valueFn ( window1 ) ;
2021-07-30 04:11:27 +03:00
}
function $FilterProvider ( $provide ) {
2022-05-04 17:25:28 +03:00
var suffix = "Filter" ;
2021-07-30 04:11:27 +03:00
function register ( name , factory ) {
2021-11-15 08:03:03 +03:00
if ( ! isObject ( name ) ) return $provide . factory ( name + suffix , factory ) ;
2022-01-02 23:54:58 +03:00
var filters = { } ;
2021-07-30 04:11:27 +03:00
return forEach ( name , function ( filter , key ) {
filters [ key ] = register ( key , filter ) ;
} ) , filters ;
}
2021-08-03 18:52:47 +03:00
this . register = register , this . $get = [
2022-05-04 17:25:28 +03:00
"$injector" ,
2021-10-21 08:12:50 +03:00
function ( $injector ) {
2021-07-30 04:11:27 +03:00
return function ( name ) {
2021-11-15 08:03:03 +03:00
return $injector . get ( name + suffix ) ;
2021-07-30 04:11:27 +03:00
} ;
2022-05-04 17:25:28 +03:00
} ,
] , register ( "currency" , currencyFilter ) , register ( "date" , dateFilter ) , register ( "filter" , filterFilter ) , register ( "json" , jsonFilter ) , register ( "limitTo" , limitToFilter ) , register ( "lowercase" , lowercaseFilter ) , register ( "number" , numberFilter ) , register ( "orderBy" , orderByFilter ) , register ( "uppercase" , uppercaseFilter ) ;
2021-07-30 04:11:27 +03:00
}
function filterFilter ( ) {
return function ( array , expression , comparator ) {
if ( ! isArray ( array ) ) return array ;
var comparatorType = typeof comparator , predicates = [ ] ;
predicates . check = function ( value ) {
for ( var j = 0 ; j < predicates . length ; j ++ ) if ( ! predicates [ j ] ( value ) ) return ! 1 ;
return ! 0 ;
2022-05-04 17:25:28 +03:00
} , "function" !== comparatorType && ( comparator = "boolean" === comparatorType && comparator ? function ( obj , text ) {
2021-10-21 08:12:50 +03:00
return angular1 . equals ( obj , text ) ;
2021-07-30 04:11:27 +03:00
} : function ( obj , text ) {
2022-05-04 17:25:28 +03:00
return text = ( "" + text ) . toLowerCase ( ) , ( "" + obj ) . toLowerCase ( ) . indexOf ( text ) > - 1 ;
2021-07-30 04:11:27 +03:00
} ) ;
var search = function ( obj , text ) {
2022-05-04 17:25:28 +03:00
if ( "string" == typeof text && "!" === text . charAt ( 0 ) ) return ! search ( obj , text . substr ( 1 ) ) ;
2021-07-30 04:11:27 +03:00
switch ( typeof obj ) {
case "boolean" :
case "number" :
2021-08-03 18:52:47 +03:00
case "string" :
return comparator ( obj , text ) ;
2021-07-30 04:11:27 +03:00
case "object" :
2022-04-21 13:00:25 +03:00
if ( "object" == typeof text ) return comparator ( obj , text ) ;
2022-05-04 17:25:28 +03:00
for ( var objKey in obj ) if ( "$" !== objKey . charAt ( 0 ) && search ( obj [ objKey ] , text ) ) return ! 0 ;
2021-07-30 04:11:27 +03:00
return ! 1 ;
case "array" :
for ( var i = 0 ; i < obj . length ; i ++ ) if ( search ( obj [ i ] , text ) ) return ! 0 ;
return ! 1 ;
2021-08-03 18:52:47 +03:00
default :
return ! 1 ;
2021-07-30 04:11:27 +03:00
}
} ;
switch ( typeof expression ) {
case "boolean" :
case "number" :
2021-08-03 18:52:47 +03:00
case "string" :
expression = {
$ : expression
} ;
2021-07-30 04:11:27 +03:00
case "object" :
2022-05-04 17:25:28 +03:00
for ( var key in expression ) "$" == key ? function ( ) {
2021-07-30 04:11:27 +03:00
if ( expression [ key ] ) {
var path = key ;
predicates . push ( function ( value ) {
return search ( value , expression [ path ] ) ;
} ) ;
}
2022-03-07 06:51:57 +03:00
} ( ) : function ( ) {
2021-07-30 04:11:27 +03:00
if ( void 0 !== expression [ key ] ) {
var path = key ;
predicates . push ( function ( value ) {
2022-06-15 17:36:57 +03:00
return search ( getter ( value , path ) , expression [ path ] ) ;
2021-07-30 04:11:27 +03:00
} ) ;
}
2022-03-07 06:51:57 +03:00
} ( ) ;
2021-07-30 04:11:27 +03:00
break ;
2022-05-04 17:25:28 +03:00
case "function" :
2021-07-30 04:11:27 +03:00
predicates . push ( expression ) ;
break ;
2021-08-03 18:52:47 +03:00
default :
return array ;
2021-07-30 04:11:27 +03:00
}
2022-06-15 17:36:57 +03:00
for ( var filtered = [ ] , j = 0 ; j < array . length ; j ++ ) {
var value = array [ j ] ;
predicates . check ( value ) && filtered . push ( value ) ;
2021-07-30 04:11:27 +03:00
}
return filtered ;
} ;
}
function currencyFilter ( $locale ) {
var formats = $locale . NUMBER _FORMATS ;
return function ( amount , currencySymbol ) {
return isUndefined ( currencySymbol ) && ( currencySymbol = formats . CURRENCY _SYM ) , formatNumber ( amount , formats . PATTERNS [ 1 ] , formats . GROUP _SEP , formats . DECIMAL _SEP , 2 ) . replace ( /\u00A4/g , currencySymbol ) ;
} ;
}
function numberFilter ( $locale ) {
var formats = $locale . NUMBER _FORMATS ;
return function ( number , fractionSize ) {
return formatNumber ( number , formats . PATTERNS [ 0 ] , formats . GROUP _SEP , formats . DECIMAL _SEP , fractionSize ) ;
} ;
}
function formatNumber ( number , pattern , groupSep , decimalSep , fractionSize ) {
2022-05-04 17:25:28 +03:00
if ( isNaN ( number ) || ! isFinite ( number ) ) return "" ;
var isNegative = number < 0 , numStr = ( number = Math . abs ( number ) ) + "" , formatedText = "" , parts = [ ] , hasExponent = ! 1 ;
if ( - 1 !== numStr . indexOf ( "e" ) ) {
2021-07-30 04:11:27 +03:00
var match = numStr . match ( /([\d\.]+)e(-?)(\d+)/ ) ;
2022-05-04 17:25:28 +03:00
match && "-" == match [ 2 ] && match [ 3 ] > fractionSize + 1 ? numStr = "0" : ( formatedText = numStr , hasExponent = ! 0 ) ;
2021-07-30 04:11:27 +03:00
}
if ( hasExponent ) fractionSize > 0 && number > - 1 && number < 1 && ( formatedText = number . toFixed ( fractionSize ) ) ;
else {
2022-09-07 06:51:42 +03:00
var fractionLen = ( numStr . split ( "." ) [ 1 ] || "" ) . length ;
2021-07-30 04:11:27 +03:00
isUndefined ( fractionSize ) && ( fractionSize = Math . min ( Math . max ( pattern . minFrac , fractionLen ) , pattern . maxFrac ) ) ;
2022-09-07 06:51:42 +03:00
var pow = Math . pow ( 10 , fractionSize ) , fraction = ( "" + ( number = Math . round ( number * pow ) / pow ) ) . split ( "." ) , whole = fraction [ 0 ] ;
2022-05-04 17:25:28 +03:00
fraction = fraction [ 1 ] || "" ;
2021-07-30 04:11:27 +03:00
var i , pos = 0 , lgroup = pattern . lgSize , group = pattern . gSize ;
if ( whole . length >= lgroup + group ) for ( i = 0 , pos = whole . length - lgroup ; i < pos ; i ++ ) ( pos - i ) % group == 0 && 0 !== i && ( formatedText += groupSep ) , formatedText += whole . charAt ( i ) ;
for ( i = pos ; i < whole . length ; i ++ ) ( whole . length - i ) % lgroup == 0 && 0 !== i && ( formatedText += groupSep ) , formatedText += whole . charAt ( i ) ;
2022-05-04 17:25:28 +03:00
for ( ; fraction . length < fractionSize ; ) fraction += "0" ;
2021-07-30 04:11:27 +03:00
fractionSize && "0" !== fractionSize && ( formatedText += decimalSep + fraction . substr ( 0 , fractionSize ) ) ;
}
2022-05-04 17:25:28 +03:00
return parts . push ( isNegative ? pattern . negPre : pattern . posPre ) , parts . push ( formatedText ) , parts . push ( isNegative ? pattern . negSuf : pattern . posSuf ) , parts . join ( "" ) ;
2021-07-30 04:11:27 +03:00
}
function padNumber ( num , digits , trim ) {
2022-05-04 17:25:28 +03:00
var neg = "" ;
for ( num < 0 && ( neg = "-" , num = - num ) , num = "" + num ; num . length < digits ; ) num = "0" + num ;
2021-07-30 04:11:27 +03:00
return trim && ( num = num . substr ( num . length - digits ) ) , neg + num ;
}
function dateGetter ( name , size , offset , trim ) {
return offset = offset || 0 , function ( date ) {
2022-05-04 17:25:28 +03:00
var value = date [ "get" + name ] ( ) ;
2021-07-30 04:11:27 +03:00
return ( offset > 0 || value > - offset ) && ( value += offset ) , 0 === value && - 12 == offset && ( value = 12 ) , padNumber ( value , size , trim ) ;
} ;
}
function dateStrGetter ( name , shortForm ) {
return function ( date , formats ) {
2022-08-30 06:22:18 +03:00
var value = date [ "get" + name ] ( ) ;
return formats [ uppercase ( shortForm ? "SHORT" + name : name ) ] [ value ] ;
2021-07-30 04:11:27 +03:00
} ;
}
2022-09-07 06:51:42 +03:00
$FilterProvider . $inject = [
"$provide"
] , currencyFilter . $inject = [
"$locale"
] , numberFilter . $inject = [
"$locale"
] ;
2021-07-30 04:11:27 +03:00
var DATE _FORMATS = {
2022-05-04 17:25:28 +03:00
yyyy : dateGetter ( "FullYear" , 4 ) ,
yy : dateGetter ( "FullYear" , 2 , 0 , ! 0 ) ,
y : dateGetter ( "FullYear" , 1 ) ,
MMMM : dateStrGetter ( "Month" ) ,
MMM : dateStrGetter ( "Month" , ! 0 ) ,
MM : dateGetter ( "Month" , 2 , 1 ) ,
M : dateGetter ( "Month" , 1 , 1 ) ,
dd : dateGetter ( "Date" , 2 ) ,
d : dateGetter ( "Date" , 1 ) ,
HH : dateGetter ( "Hours" , 2 ) ,
H : dateGetter ( "Hours" , 1 ) ,
hh : dateGetter ( "Hours" , 2 , - 12 ) ,
h : dateGetter ( "Hours" , 1 , - 12 ) ,
mm : dateGetter ( "Minutes" , 2 ) ,
m : dateGetter ( "Minutes" , 1 ) ,
ss : dateGetter ( "Seconds" , 2 ) ,
s : dateGetter ( "Seconds" , 1 ) ,
sss : dateGetter ( "Milliseconds" , 3 ) ,
EEEE : dateStrGetter ( "Day" ) ,
EEE : dateStrGetter ( "Day" , ! 0 ) ,
2021-08-10 11:52:28 +03:00
a : function ( date , formats ) {
2021-07-30 04:11:27 +03:00
return 12 > date . getHours ( ) ? formats . AMPMS [ 0 ] : formats . AMPMS [ 1 ] ;
} ,
2021-08-10 11:52:28 +03:00
Z : function ( date ) {
2022-04-12 06:40:10 +03:00
var zone = - 1 * date . getTimezoneOffset ( ) ;
2022-05-04 17:25:28 +03:00
return ( zone >= 0 ? "+" : "" ) + ( padNumber ( Math [ zone > 0 ? "floor" : "ceil" ] ( zone / 60 ) , 2 ) + padNumber ( Math . abs ( zone % 60 ) , 2 ) ) ;
2021-07-30 04:11:27 +03:00
}
} , DATE _FORMATS _SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/ , NUMBER _STRING = /^\-?\d+$/ ;
function dateFilter ( $locale ) {
var R _ISO8601 _STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/ ;
2022-06-15 17:36:57 +03:00
return function ( date , format ) {
var fn , match , text = "" , parts = [ ] ;
if ( format = format || "mediumDate" , format = $locale . DATETIME _FORMATS [ format ] || format , isString ( date ) && ( date = NUMBER _STRING . test ( date ) ? int ( date ) : function ( string ) {
2021-10-21 08:12:50 +03:00
var match ;
if ( match = string . match ( R _ISO8601 _STR ) ) {
var date = new Date ( 0 ) , tzHour = 0 , tzMin = 0 , dateSetter = match [ 8 ] ? date . setUTCFullYear : date . setFullYear , timeSetter = match [ 8 ] ? date . setUTCHours : date . setHours ;
match [ 9 ] && ( tzHour = int ( match [ 9 ] + match [ 10 ] ) , tzMin = int ( match [ 9 ] + match [ 11 ] ) ) , dateSetter . call ( date , int ( match [ 1 ] ) , int ( match [ 2 ] ) - 1 , int ( match [ 3 ] ) ) ;
2022-05-04 17:25:28 +03:00
var h = int ( match [ 4 ] || 0 ) - tzHour , m = int ( match [ 5 ] || 0 ) - tzMin , s = int ( match [ 6 ] || 0 ) , ms = Math . round ( 1000 * parseFloat ( "0." + ( match [ 7 ] || 0 ) ) ) ;
2021-09-08 12:45:39 +03:00
return timeSetter . call ( date , h , m , s , ms ) , date ;
}
return string ;
2022-06-15 17:36:57 +03:00
} ( date ) ) , isNumber ( date ) && ( date = new Date ( date ) ) , ! isDate ( date ) ) return date ;
for ( ; format ; ) ( match = DATE _FORMATS _SPLIT . exec ( format ) ) ? format = ( parts = concat ( parts , match , 1 ) ) . pop ( ) : ( parts . push ( format ) , format = null ) ;
2021-07-30 04:11:27 +03:00
return forEach ( parts , function ( value ) {
2022-08-30 06:22:18 +03:00
text += ( fn = DATE _FORMATS [ value ] ) ? fn ( date , $locale . DATETIME _FORMATS ) : value . replace ( /(^'|'$)/g , "" ) . replace ( /''/g , "'" ) ;
2021-07-30 04:11:27 +03:00
} ) , text ;
} ;
}
function jsonFilter ( ) {
return function ( object ) {
return toJson ( object , ! 0 ) ;
} ;
}
2021-08-04 13:27:17 +03:00
dateFilter . $inject = [
2022-05-04 17:25:28 +03:00
"$locale"
2021-08-04 13:27:17 +03:00
] ;
2022-06-15 17:36:57 +03:00
var lowercaseFilter = valueFn ( lowercase ) , uppercaseFilter = valueFn ( uppercase ) ;
2021-07-30 04:11:27 +03:00
function limitToFilter ( ) {
return function ( input , limit ) {
if ( ! isArray ( input ) && ! isString ( input ) ) return input ;
if ( limit = int ( limit ) , isString ( input ) ) return limit ? limit >= 0 ? input . slice ( 0 , limit ) : input . slice ( limit , input . length ) : "" ;
var i , n , out = [ ] ;
for ( limit > input . length ? limit = input . length : limit < - input . length && ( limit = - input . length ) , limit > 0 ? ( i = 0 , n = limit ) : ( i = input . length + limit , n = input . length ) ; i < n ; i ++ ) out . push ( input [ i ] ) ;
return out ;
} ;
}
function orderByFilter ( $parse ) {
return function ( array , sortPredicate , reverseOrder ) {
2022-05-17 10:34:47 +03:00
if ( ! isArray ( array ) || ! sortPredicate ) return array ;
2022-09-14 15:57:18 +03:00
obj = sortPredicate = isArray ( sortPredicate ) ? sortPredicate : [
2022-08-30 06:22:18 +03:00
sortPredicate
2022-09-03 10:33:31 +03:00
] , iterator = function ( predicate ) {
2021-07-30 04:11:27 +03:00
var descending = ! 1 , get = predicate || identity ;
2022-05-04 17:25:28 +03:00
return isString ( predicate ) && ( ( "+" == predicate . charAt ( 0 ) || "-" == predicate . charAt ( 0 ) ) && ( descending = "-" == predicate . charAt ( 0 ) , predicate = predicate . substring ( 1 ) ) , get = $parse ( predicate ) ) , reverseComparator ( function ( a , b ) {
2022-09-01 13:36:16 +03:00
var v1 , v2 , t1 , t2 ;
return v1 = get ( a ) , v2 = get ( b ) , t1 = typeof v1 , t1 != ( t2 = typeof v2 ) ? t1 < t2 ? - 1 : 1 : ( "string" == t1 && ( v1 = v1 . toLowerCase ( ) , v2 = v2 . toLowerCase ( ) ) , v1 === v2 ) ? 0 : v1 < v2 ? - 1 : 1 ;
2021-07-30 04:11:27 +03:00
} , descending ) ;
2022-09-03 10:33:31 +03:00
} , results = [ ] , forEach ( obj , function ( value , index , list ) {
results . push ( iterator . call ( void 0 , value , index , list ) ) ;
2022-09-14 15:57:18 +03:00
} ) , sortPredicate = results ;
2022-09-03 10:33:31 +03:00
for ( var obj , iterator , results , arrayCopy = [ ] , i = 0 ; i < array . length ; i ++ ) arrayCopy . push ( array [ i ] ) ;
2021-07-30 04:11:27 +03:00
return arrayCopy . sort ( reverseComparator ( function ( o1 , o2 ) {
2021-10-21 08:12:50 +03:00
for ( var i = 0 ; i < sortPredicate . length ; i ++ ) {
var comp = sortPredicate [ i ] ( o1 , o2 ) ;
2021-07-30 04:11:27 +03:00
if ( 0 !== comp ) return comp ;
}
return 0 ;
} , reverseOrder ) ) ;
2022-05-18 10:25:25 +03:00
function reverseComparator ( comp , descending ) {
return toBoolean ( descending ) ? function ( a , b ) {
return comp ( b , a ) ;
} : comp ;
}
2021-07-30 04:11:27 +03:00
} ;
}
function ngDirective ( directive ) {
return isFunction ( directive ) && ( directive = {
link : directive
2022-06-15 17:36:57 +03:00
} ) , directive . restrict = directive . restrict || "AC" , valueFn ( directive ) ;
2021-07-30 04:11:27 +03:00
}
2021-08-04 13:27:17 +03:00
orderByFilter . $inject = [
2022-05-04 17:25:28 +03:00
"$parse"
2021-08-04 13:27:17 +03:00
] ;
2022-06-15 17:36:57 +03:00
var htmlAnchorDirective = valueFn ( {
2022-05-04 17:25:28 +03:00
restrict : "E" ,
2022-06-15 17:36:57 +03:00
compile : function ( element , attr ) {
if ( msie <= 8 && ( attr . href || attr . name || attr . $set ( "href" , "" ) , element . append ( document1 . createComment ( "IE fix" ) ) ) , ! attr . href && ! attr . name ) return function ( scope , element ) {
2022-05-04 17:25:28 +03:00
element . on ( "click" , function ( event ) {
element . attr ( "href" ) || event . preventDefault ( ) ;
2021-07-30 04:11:27 +03:00
} ) ;
} ;
}
2022-01-02 23:54:58 +03:00
} ) , ngAttributeAliasDirectives = { } ;
2021-08-04 13:27:17 +03:00
forEach ( BOOLEAN _ATTR , function ( propName , attrName ) {
if ( "multiple" != propName ) {
2022-05-04 17:25:28 +03:00
var normalized = directiveNormalize ( "ng-" + attrName ) ;
2021-08-04 13:27:17 +03:00
ngAttributeAliasDirectives [ normalized ] = function ( ) {
return {
priority : 100 ,
compile : function ( ) {
return function ( scope , element , attr ) {
scope . $watch ( attr [ normalized ] , function ( value ) {
attr . $set ( attrName , ! ! value ) ;
} ) ;
} ;
}
} ;
} ;
}
} ) , forEach ( [
2022-05-04 17:25:28 +03:00
"src" ,
"srcset" ,
"href"
2021-08-04 13:27:17 +03:00
] , function ( attrName ) {
2022-05-04 17:25:28 +03:00
var normalized = directiveNormalize ( "ng-" + attrName ) ;
2021-08-04 13:27:17 +03:00
ngAttributeAliasDirectives [ normalized ] = function ( ) {
return {
priority : 99 ,
link : function ( scope , element , attr ) {
attr . $observe ( normalized , function ( value ) {
2022-03-21 14:06:25 +03:00
value && ( attr . $set ( attrName , value ) , msie && element . prop ( attrName , attr [ attrName ] ) ) ;
2021-08-04 13:27:17 +03:00
} ) ;
}
} ;
} ;
} ) ;
var nullFormCtrl = {
2021-07-30 04:11:27 +03:00
$addControl : noop ,
$removeControl : noop ,
$setValidity : noop ,
$setDirty : noop ,
$setPristine : noop
} ;
function FormController ( element , attrs ) {
2022-05-04 17:25:28 +03:00
var form = this , parentForm = element . parent ( ) . controller ( "form" ) || nullFormCtrl , invalidCount = 0 , errors = form . $error = { } , controls = [ ] ;
2021-07-30 04:11:27 +03:00
function toggleValidCss ( isValid , validationErrorKey ) {
2022-05-04 17:25:28 +03:00
validationErrorKey = validationErrorKey ? "-" + snake _case ( validationErrorKey , "-" ) : "" , element . removeClass ( ( isValid ? INVALID _CLASS : VALID _CLASS ) + validationErrorKey ) . addClass ( ( isValid ? VALID _CLASS : INVALID _CLASS ) + validationErrorKey ) ;
2021-07-30 04:11:27 +03:00
}
form . $name = attrs . name || attrs . ngForm , form . $dirty = ! 1 , form . $pristine = ! 0 , form . $valid = ! 0 , form . $invalid = ! 1 , parentForm . $addControl ( form ) , element . addClass ( PRISTINE _CLASS ) , toggleValidCss ( ! 0 ) , form . $addControl = function ( control ) {
2022-05-04 17:25:28 +03:00
assertNotHasOwnProperty ( control . $name , "input" ) , controls . push ( control ) , control . $name && ( form [ control . $name ] = control ) ;
2021-07-30 04:11:27 +03:00
} , form . $removeControl = function ( control ) {
control . $name && form [ control . $name ] === control && delete form [ control . $name ] , forEach ( errors , function ( queue , validationToken ) {
form . $setValidity ( validationToken , ! 0 , control ) ;
} ) , arrayRemove ( controls , control ) ;
} , form . $setValidity = function ( validationToken , isValid , control ) {
2022-09-01 19:30:21 +03:00
var array , queue = errors [ validationToken ] ;
2022-04-03 16:13:15 +03:00
if ( isValid ) queue && ( arrayRemove ( queue , control ) , queue . length || ( -- invalidCount || ( toggleValidCss ( isValid ) , form . $valid = ! 0 , form . $invalid = ! 1 ) , errors [ validationToken ] = ! 1 , toggleValidCss ( ! 0 , validationToken ) , parentForm . $setValidity ( validationToken , ! 0 , form ) ) ) ;
2021-07-30 04:11:27 +03:00
else {
if ( invalidCount || toggleValidCss ( isValid ) , queue ) {
2022-04-29 08:58:59 +03:00
if ( - 1 != indexOf ( array = queue , control ) ) return ;
2021-07-30 04:11:27 +03:00
} else errors [ validationToken ] = queue = [ ] , invalidCount ++ , toggleValidCss ( ! 1 , validationToken ) , parentForm . $setValidity ( validationToken , ! 1 , form ) ;
queue . push ( control ) , form . $valid = ! 1 , form . $invalid = ! 0 ;
}
} , form . $setDirty = function ( ) {
element . removeClass ( PRISTINE _CLASS ) . addClass ( DIRTY _CLASS ) , form . $dirty = ! 0 , form . $pristine = ! 1 , parentForm . $setDirty ( ) ;
} , form . $setPristine = function ( ) {
element . removeClass ( DIRTY _CLASS ) . addClass ( PRISTINE _CLASS ) , form . $dirty = ! 1 , form . $pristine = ! 0 , forEach ( controls , function ( control ) {
control . $setPristine ( ) ;
} ) ;
} ;
}
2021-08-04 13:27:17 +03:00
FormController . $inject = [
2022-05-04 17:25:28 +03:00
"$element" ,
"$attrs" ,
"$scope"
2021-08-04 13:27:17 +03:00
] ;
2021-07-30 04:11:27 +03:00
var formDirectiveFactory = function ( isNgForm ) {
2021-08-03 18:52:47 +03:00
return [
2022-05-04 17:25:28 +03:00
"$timeout" ,
2021-10-21 08:12:50 +03:00
function ( $timeout ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
name : "form" ,
restrict : isNgForm ? "EAC" : "E" ,
2021-07-30 04:11:27 +03:00
controller : FormController ,
compile : function ( ) {
return {
pre : function ( scope , formElement , attr , controller ) {
if ( ! attr . action ) {
var preventDefaultListener = function ( event ) {
event . preventDefault ? event . preventDefault ( ) : event . returnValue = ! 1 ;
} ;
2022-05-04 17:25:28 +03:00
addEventListenerFn ( formElement [ 0 ] , "submit" , preventDefaultListener ) , formElement . on ( "$destroy" , function ( ) {
2021-07-30 04:11:27 +03:00
$timeout ( function ( ) {
2022-05-04 17:25:28 +03:00
removeEventListenerFn ( formElement [ 0 ] , "submit" , preventDefaultListener ) ;
2021-07-30 04:11:27 +03:00
} , 0 , ! 1 ) ;
} ) ;
}
2022-05-04 17:25:28 +03:00
var parentFormCtrl = formElement . parent ( ) . controller ( "form" ) , alias = attr . name || attr . ngForm ;
alias && setter ( scope , alias , controller , alias ) , parentFormCtrl && formElement . on ( "$destroy" , function ( ) {
2021-07-30 04:11:27 +03:00
parentFormCtrl . $removeControl ( controller ) , alias && setter ( scope , alias , undefined , alias ) , extend ( controller , nullFormCtrl ) ;
} ) ;
}
} ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
} , formDirective = formDirectiveFactory ( ) , ngFormDirective = formDirectiveFactory ( ! 0 ) , URL _REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/ , EMAIL _REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/ , NUMBER _REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/ , inputType = {
text : textInputType ,
2021-08-10 11:52:28 +03:00
number : function ( scope , element , attr , ctrl , $sniffer , $browser ) {
2021-08-03 18:52:47 +03:00
if ( textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) , ctrl . $parsers . push ( function ( value ) {
var empty = ctrl . $isEmpty ( value ) ;
2022-05-04 17:25:28 +03:00
if ( empty || NUMBER _REGEXP . test ( value ) ) return ctrl . $setValidity ( "number" , ! 0 ) , "" === value ? null : empty ? value : parseFloat ( value ) ;
ctrl . $setValidity ( "number" , ! 1 ) ;
2021-08-03 18:52:47 +03:00
} ) , ctrl . $formatters . push ( function ( value ) {
2022-05-04 17:25:28 +03:00
return ctrl . $isEmpty ( value ) ? "" : "" + value ;
2021-08-03 18:52:47 +03:00
} ) , attr . min ) {
var minValidator = function ( value ) {
var min = parseFloat ( attr . min ) ;
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || ! ( value < min ) ) return ctrl . $setValidity ( "min" , ! 0 ) , value ;
ctrl . $setValidity ( "min" , ! 1 ) ;
2021-08-03 18:52:47 +03:00
} ;
ctrl . $parsers . push ( minValidator ) , ctrl . $formatters . push ( minValidator ) ;
}
if ( attr . max ) {
var maxValidator = function ( value ) {
var max = parseFloat ( attr . max ) ;
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || ! ( value > max ) ) return ctrl . $setValidity ( "max" , ! 0 ) , value ;
ctrl . $setValidity ( "max" , ! 1 ) ;
2021-08-03 18:52:47 +03:00
} ;
ctrl . $parsers . push ( maxValidator ) , ctrl . $formatters . push ( maxValidator ) ;
}
ctrl . $formatters . push ( function ( value ) {
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || isNumber ( value ) ) return ctrl . $setValidity ( "number" , ! 0 ) , value ;
ctrl . $setValidity ( "number" , ! 1 ) ;
2021-08-03 18:52:47 +03:00
} ) ;
} ,
2021-08-10 11:52:28 +03:00
url : function ( scope , element , attr , ctrl , $sniffer , $browser ) {
2021-08-03 18:52:47 +03:00
textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
var urlValidator = function ( value ) {
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || URL _REGEXP . test ( value ) ) return ctrl . $setValidity ( "url" , ! 0 ) , value ;
ctrl . $setValidity ( "url" , ! 1 ) ;
2021-08-03 18:52:47 +03:00
} ;
ctrl . $formatters . push ( urlValidator ) , ctrl . $parsers . push ( urlValidator ) ;
} ,
2021-08-10 11:52:28 +03:00
email : function ( scope , element , attr , ctrl , $sniffer , $browser ) {
2021-08-03 18:52:47 +03:00
textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) ;
var emailValidator = function ( value ) {
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || EMAIL _REGEXP . test ( value ) ) return ctrl . $setValidity ( "email" , ! 0 ) , value ;
ctrl . $setValidity ( "email" , ! 1 ) ;
2021-08-03 18:52:47 +03:00
} ;
ctrl . $formatters . push ( emailValidator ) , ctrl . $parsers . push ( emailValidator ) ;
} ,
2021-08-10 11:52:28 +03:00
radio : function ( scope , element , attr , ctrl ) {
2022-05-04 17:25:28 +03:00
isUndefined ( attr . name ) && element . attr ( "name" , nextUid ( ) ) , element . on ( "click" , function ( ) {
2021-08-03 18:52:47 +03:00
element [ 0 ] . checked && scope . $apply ( function ( ) {
ctrl . $setViewValue ( attr . value ) ;
} ) ;
} ) , ctrl . $render = function ( ) {
var value = attr . value ;
element [ 0 ] . checked = value == ctrl . $viewValue ;
2022-05-04 17:25:28 +03:00
} , attr . $observe ( "value" , ctrl . $render ) ;
2021-08-03 18:52:47 +03:00
} ,
2021-08-10 11:52:28 +03:00
checkbox : function ( scope , element , attr , ctrl ) {
2021-08-03 18:52:47 +03:00
var trueValue = attr . ngTrueValue , falseValue = attr . ngFalseValue ;
2022-05-04 17:25:28 +03:00
isString ( trueValue ) || ( trueValue = ! 0 ) , isString ( falseValue ) || ( falseValue = ! 1 ) , element . on ( "click" , function ( ) {
2021-08-03 18:52:47 +03:00
scope . $apply ( function ( ) {
ctrl . $setViewValue ( element [ 0 ] . checked ) ;
} ) ;
} ) , ctrl . $render = function ( ) {
element [ 0 ] . checked = ctrl . $viewValue ;
} , ctrl . $isEmpty = function ( value ) {
return value !== trueValue ;
} , ctrl . $formatters . push ( function ( value ) {
return value === trueValue ;
} ) , ctrl . $parsers . push ( function ( value ) {
return value ? trueValue : falseValue ;
} ) ;
} ,
2021-07-30 04:11:27 +03:00
hidden : noop ,
button : noop ,
submit : noop ,
reset : noop
} ;
function textInputType ( scope , element , attr , ctrl , $sniffer , $browser ) {
var composing = ! 1 ;
2022-05-04 17:25:28 +03:00
element . on ( "compositionstart" , function ( ) {
2021-07-30 04:11:27 +03:00
composing = ! 0 ;
2022-05-04 17:25:28 +03:00
} ) , element . on ( "compositionend" , function ( ) {
2021-07-30 04:11:27 +03:00
composing = ! 1 ;
} ) ;
var listener = function ( ) {
if ( ! composing ) {
var value = element . val ( ) ;
2022-06-15 17:36:57 +03:00
toBoolean ( attr . ngTrim || "T" ) && ( value = trim ( value ) ) , ctrl . $viewValue !== value && scope . $apply ( function ( ) {
2021-07-30 04:11:27 +03:00
ctrl . $setViewValue ( value ) ;
} ) ;
}
} ;
2022-05-04 17:25:28 +03:00
if ( $sniffer . hasEvent ( "input" ) ) element . on ( "input" , listener ) ;
2021-07-30 04:11:27 +03:00
else {
2022-01-27 09:36:22 +03:00
var timeout , deferListener = function ( ) {
2021-07-30 04:11:27 +03:00
timeout || ( timeout = $browser . defer ( function ( ) {
listener ( ) , timeout = null ;
} ) ) ;
} ;
2022-05-04 17:25:28 +03:00
element . on ( "keydown" , function ( event ) {
2021-07-30 04:11:27 +03:00
var key = event . keyCode ;
91 === key || 15 < key && key < 19 || 37 <= key && key <= 40 || deferListener ( ) ;
2022-05-04 17:25:28 +03:00
} ) , $sniffer . hasEvent ( "paste" ) && element . on ( "paste cut" , deferListener ) ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
element . on ( "change" , listener ) , ctrl . $render = function ( ) {
element . val ( ctrl . $isEmpty ( ctrl . $viewValue ) ? "" : ctrl . $viewValue ) ;
2021-07-30 04:11:27 +03:00
} ;
2022-01-27 09:36:22 +03:00
var patternValidator , match , pattern = attr . ngPattern , validate = function ( regexp , value ) {
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || regexp . test ( value ) ) return ctrl . $setValidity ( "pattern" , ! 0 ) , value ;
ctrl . $setValidity ( "pattern" , ! 1 ) ;
2021-07-30 04:11:27 +03:00
} ;
2022-06-11 08:27:13 +03:00
if ( pattern && ( ( match = pattern . match ( /^\/(.*)\/([gim]*)$/ ) ) ? ( pattern = RegExp ( match [ 1 ] , match [ 2 ] ) , patternValidator = function ( value ) {
2021-10-10 06:47:11 +03:00
return validate ( pattern , value ) ;
} ) : patternValidator = function ( value ) {
2021-07-30 04:11:27 +03:00
var patternObj = scope . $eval ( pattern ) ;
2022-05-04 17:25:28 +03:00
if ( ! patternObj || ! patternObj . test ) throw minErr ( "ngPattern" ) ( "noregexp" , "Expected {0} to be a RegExp but was {1}. Element: {2}" , pattern , patternObj , startingTag ( element ) ) ;
2021-07-30 04:11:27 +03:00
return validate ( patternObj , value ) ;
} , ctrl . $formatters . push ( patternValidator ) , ctrl . $parsers . push ( patternValidator ) ) , attr . ngMinlength ) {
var minlength = int ( attr . ngMinlength ) , minLengthValidator = function ( value ) {
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || ! ( value . length < minlength ) ) return ctrl . $setValidity ( "minlength" , ! 0 ) , value ;
ctrl . $setValidity ( "minlength" , ! 1 ) ;
2021-07-30 04:11:27 +03:00
} ;
ctrl . $parsers . push ( minLengthValidator ) , ctrl . $formatters . push ( minLengthValidator ) ;
}
if ( attr . ngMaxlength ) {
var maxlength = int ( attr . ngMaxlength ) , maxLengthValidator = function ( value ) {
2022-05-04 17:25:28 +03:00
if ( ctrl . $isEmpty ( value ) || ! ( value . length > maxlength ) ) return ctrl . $setValidity ( "maxlength" , ! 0 ) , value ;
ctrl . $setValidity ( "maxlength" , ! 1 ) ;
2021-07-30 04:11:27 +03:00
} ;
ctrl . $parsers . push ( maxLengthValidator ) , ctrl . $formatters . push ( maxLengthValidator ) ;
}
}
2021-08-03 18:52:47 +03:00
var inputDirective = [
2022-05-04 17:25:28 +03:00
"$browser" ,
"$sniffer" ,
2021-10-21 08:12:50 +03:00
function ( $browser , $sniffer ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
restrict : "E" ,
require : "?ngModel" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr , ctrl ) {
ctrl && ( inputType [ lowercase ( attr . type ) ] || inputType . text ) ( scope , element , attr , ctrl , $sniffer , $browser ) ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
] , VALID _CLASS = "ng-valid" , INVALID _CLASS = "ng-invalid" , PRISTINE _CLASS = "ng-pristine" , DIRTY _CLASS = "ng-dirty" , NgModelController = [
"$scope" ,
"$exceptionHandler" ,
"$attrs" ,
"$element" ,
"$parse" ,
2021-10-21 08:12:50 +03:00
function ( $scope , $exceptionHandler , $attr , $element , $parse ) {
2021-08-04 13:27:17 +03:00
this . $viewValue = Number . NaN , this . $modelValue = Number . NaN , this . $parsers = [ ] , this . $formatters = [ ] , this . $viewChangeListeners = [ ] , this . $pristine = ! 0 , this . $dirty = ! 1 , this . $valid = ! 0 , this . $invalid = ! 1 , this . $name = $attr . name ;
var ngModelGet = $parse ( $attr . ngModel ) , ngModelSet = ngModelGet . assign ;
2022-05-04 17:25:28 +03:00
if ( ! ngModelSet ) throw minErr ( "ngModel" ) ( "nonassign" , "Expression '{0}' is non-assignable. Element: {1}" , $attr . ngModel , startingTag ( $element ) ) ;
2021-08-04 13:27:17 +03:00
this . $render = noop , this . $isEmpty = function ( value ) {
2022-05-04 17:25:28 +03:00
return isUndefined ( value ) || "" === value || null === value || value != value ;
2021-08-04 13:27:17 +03:00
} ;
2022-05-04 17:25:28 +03:00
var parentForm = $element . inheritedData ( "$formController" ) || nullFormCtrl , invalidCount = 0 , $error = this . $error = { } ;
2021-07-30 04:11:27 +03:00
function toggleValidCss ( isValid , validationErrorKey ) {
2022-05-04 17:25:28 +03:00
validationErrorKey = validationErrorKey ? "-" + snake _case ( validationErrorKey , "-" ) : "" , $element . removeClass ( ( isValid ? INVALID _CLASS : VALID _CLASS ) + validationErrorKey ) . addClass ( ( isValid ? VALID _CLASS : INVALID _CLASS ) + validationErrorKey ) ;
2021-07-30 04:11:27 +03:00
}
2021-08-04 13:27:17 +03:00
$element . addClass ( PRISTINE _CLASS ) , toggleValidCss ( ! 0 ) , this . $setValidity = function ( validationErrorKey , isValid ) {
2021-07-30 04:11:27 +03:00
! isValid !== $error [ validationErrorKey ] && ( isValid ? ( $error [ validationErrorKey ] && invalidCount -- , invalidCount || ( toggleValidCss ( ! 0 ) , this . $valid = ! 0 , this . $invalid = ! 1 ) ) : ( toggleValidCss ( ! 1 ) , this . $invalid = ! 0 , this . $valid = ! 1 , invalidCount ++ ) , $error [ validationErrorKey ] = ! isValid , toggleValidCss ( isValid , validationErrorKey ) , parentForm . $setValidity ( validationErrorKey , isValid , this ) ) ;
} , this . $setPristine = function ( ) {
this . $dirty = ! 1 , this . $pristine = ! 0 , $element . removeClass ( DIRTY _CLASS ) . addClass ( PRISTINE _CLASS ) ;
} , this . $setViewValue = function ( value ) {
this . $viewValue = value , this . $pristine && ( this . $dirty = ! 0 , this . $pristine = ! 1 , $element . removeClass ( PRISTINE _CLASS ) . addClass ( DIRTY _CLASS ) , parentForm . $setDirty ( ) ) , forEach ( this . $parsers , function ( fn ) {
value = fn ( value ) ;
} ) , this . $modelValue !== value && ( this . $modelValue = value , ngModelSet ( $scope , value ) , forEach ( this . $viewChangeListeners , function ( listener ) {
try {
listener ( ) ;
} catch ( e ) {
$exceptionHandler ( e ) ;
}
} ) ) ;
2021-08-04 13:27:17 +03:00
} ;
var ctrl = this ;
$scope . $watch ( function ( ) {
2021-07-30 04:11:27 +03:00
var value = ngModelGet ( $scope ) ;
if ( ctrl . $modelValue !== value ) {
var formatters = ctrl . $formatters , idx = formatters . length ;
for ( ctrl . $modelValue = value ; idx -- ; ) value = formatters [ idx ] ( value ) ;
ctrl . $viewValue !== value && ( ctrl . $viewValue = value , ctrl . $render ( ) ) ;
}
return value ;
} ) ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngModelDirective = function ( ) {
2021-07-30 04:11:27 +03:00
return {
2021-08-03 18:52:47 +03:00
require : [
2022-05-04 17:25:28 +03:00
"ngModel" ,
"^?form"
2021-08-03 18:52:47 +03:00
] ,
2021-07-30 04:11:27 +03:00
controller : NgModelController ,
link : function ( scope , element , attr , ctrls ) {
var modelCtrl = ctrls [ 0 ] , formCtrl = ctrls [ 1 ] || nullFormCtrl ;
2022-05-04 17:25:28 +03:00
formCtrl . $addControl ( modelCtrl ) , scope . $on ( "$destroy" , function ( ) {
2021-07-30 04:11:27 +03:00
formCtrl . $removeControl ( modelCtrl ) ;
} ) ;
}
} ;
2022-06-15 17:36:57 +03:00
} , ngChangeDirective = valueFn ( {
2022-05-04 17:25:28 +03:00
require : "ngModel" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr , ctrl ) {
ctrl . $viewChangeListeners . push ( function ( ) {
scope . $eval ( attr . ngChange ) ;
} ) ;
}
} ) , requiredDirective = function ( ) {
return {
2022-05-04 17:25:28 +03:00
require : "?ngModel" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , elm , attr , ctrl ) {
if ( ctrl ) {
attr . required = ! 0 ;
var validator = function ( value ) {
2022-05-04 17:25:28 +03:00
if ( ! ( attr . required && ctrl . $isEmpty ( value ) ) ) return ctrl . $setValidity ( "required" , ! 0 ) , value ;
ctrl . $setValidity ( "required" , ! 1 ) ;
2021-07-30 04:11:27 +03:00
} ;
2022-05-04 17:25:28 +03:00
ctrl . $formatters . push ( validator ) , ctrl . $parsers . unshift ( validator ) , attr . $observe ( "required" , function ( ) {
2021-07-30 04:11:27 +03:00
validator ( ctrl . $viewValue ) ;
} ) ;
}
}
} ;
} , ngListDirective = function ( ) {
return {
2022-05-04 17:25:28 +03:00
require : "ngModel" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr , ctrl ) {
2022-07-06 06:53:11 +03:00
var match = /\/(.*)\// . exec ( attr . ngList ) , separator = match && RegExp ( match [ 1 ] ) || attr . ngList || "," , parse = function ( viewValue ) {
2021-07-30 04:11:27 +03:00
if ( ! isUndefined ( viewValue ) ) {
var list = [ ] ;
return viewValue && forEach ( viewValue . split ( separator ) , function ( value ) {
2022-06-15 17:36:57 +03:00
value && list . push ( trim ( value ) ) ;
2021-07-30 04:11:27 +03:00
} ) , list ;
}
2022-07-06 06:53:11 +03:00
} ;
ctrl . $parsers . push ( parse ) , ctrl . $formatters . push ( function ( value ) {
2022-05-04 17:25:28 +03:00
if ( isArray ( value ) ) return value . join ( ", " ) ;
2021-07-30 04:11:27 +03:00
} ) , ctrl . $isEmpty = function ( value ) {
return ! value || ! value . length ;
} ;
}
} ;
2022-07-06 06:53:11 +03:00
} , CONSTANT _VALUE _REGEXP = /^(true|false|\d+)$/ , ngValueDirective = function ( ) {
return {
priority : 100 ,
compile : function ( tpl , tplAttr ) {
return CONSTANT _VALUE _REGEXP . test ( tplAttr . ngValue ) ? function ( scope , elm , attr ) {
attr . $set ( "value" , scope . $eval ( attr . ngValue ) ) ;
} : function ( scope , elm , attr ) {
scope . $watch ( attr . ngValue , function ( value ) {
attr . $set ( "value" , value ) ;
} ) ;
} ;
}
} ;
} , ngBindDirective = ngDirective ( function ( scope , element , attr ) {
2022-05-04 17:25:28 +03:00
element . addClass ( "ng-binding" ) . data ( "$binding" , attr . ngBind ) , scope . $watch ( attr . ngBind , function ( value ) {
element . text ( value == undefined ? "" : value ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2021-08-03 18:52:47 +03:00
} ) , ngBindTemplateDirective = [
2022-05-04 17:25:28 +03:00
"$interpolate" ,
2021-10-21 08:12:50 +03:00
function ( $interpolate ) {
2021-07-30 04:11:27 +03:00
return function ( scope , element , attr ) {
var interpolateFn = $interpolate ( element . attr ( attr . $attr . ngBindTemplate ) ) ;
2022-05-04 17:25:28 +03:00
element . addClass ( "ng-binding" ) . data ( "$binding" , interpolateFn ) , attr . $observe ( "ngBindTemplate" , function ( value ) {
2021-07-30 04:11:27 +03:00
element . text ( value ) ;
} ) ;
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngBindHtmlDirective = [
2022-05-04 17:25:28 +03:00
"$sce" ,
"$parse" ,
2021-10-21 08:12:50 +03:00
function ( $sce , $parse ) {
2021-07-30 04:11:27 +03:00
return function ( scope , element , attr ) {
2022-05-04 17:25:28 +03:00
element . addClass ( "ng-binding" ) . data ( "$binding" , attr . ngBindHtml ) ;
2021-07-30 04:11:27 +03:00
var parsed = $parse ( attr . ngBindHtml ) ;
scope . $watch ( function ( ) {
2022-05-04 17:25:28 +03:00
return ( parsed ( scope ) || "" ) . toString ( ) ;
2021-07-30 04:11:27 +03:00
} , function ( value ) {
2022-05-04 17:25:28 +03:00
element . html ( $sce . getTrustedHtml ( parsed ( scope ) ) || "" ) ;
2021-07-30 04:11:27 +03:00
} ) ;
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-07-30 04:11:27 +03:00
function classDirective ( name , selector ) {
2022-05-04 17:25:28 +03:00
return name = "ngClass" + name , function ( ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
restrict : "AC" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr ) {
var oldVal ;
function ngClassWatchAction ( newVal ) {
if ( ! 0 === selector || scope . $index % 2 === selector ) {
2022-05-04 17:25:28 +03:00
var newClasses = flattenClasses ( newVal || "" ) ;
2021-07-30 04:11:27 +03:00
oldVal ? equals ( newVal , oldVal ) || attr . $updateClass ( newClasses , flattenClasses ( oldVal ) ) : attr . $addClass ( newClasses ) ;
}
oldVal = copy ( newVal ) ;
}
function flattenClasses ( classVal ) {
2022-05-04 17:25:28 +03:00
if ( isArray ( classVal ) ) return classVal . join ( " " ) ;
2021-07-30 04:11:27 +03:00
if ( isObject ( classVal ) ) {
var classes = [ ] ;
return forEach ( classVal , function ( v , k ) {
v && classes . push ( k ) ;
2022-05-04 17:25:28 +03:00
} ) , classes . join ( " " ) ;
2021-07-30 04:11:27 +03:00
}
return classVal ;
}
2022-05-04 17:25:28 +03:00
scope . $watch ( attr [ name ] , ngClassWatchAction , ! 0 ) , attr . $observe ( "class" , function ( value ) {
2021-07-30 04:11:27 +03:00
ngClassWatchAction ( scope . $eval ( attr [ name ] ) ) ;
2022-05-04 17:25:28 +03:00
} ) , "ngClass" !== name && scope . $watch ( "$index" , function ( $index , old$index ) {
2021-07-30 04:11:27 +03:00
var mod = 1 & $index ;
if ( mod !== old$index & 1 ) {
var classes = flattenClasses ( scope . $eval ( attr [ name ] ) ) ;
mod === selector ? attr . $addClass ( classes ) : attr . $removeClass ( classes ) ;
}
} ) ;
}
} ;
} ;
}
2022-05-04 17:25:28 +03:00
var ngClassDirective = classDirective ( "" , ! 0 ) , ngClassOddDirective = classDirective ( "Odd" , 0 ) , ngClassEvenDirective = classDirective ( "Even" , 1 ) , ngCloakDirective = ngDirective ( {
2021-07-30 04:11:27 +03:00
compile : function ( element , attr ) {
2022-05-04 17:25:28 +03:00
attr . $set ( "ngCloak" , undefined ) , element . removeClass ( "ng-cloak" ) ;
2021-07-30 04:11:27 +03:00
}
2021-10-21 08:12:50 +03:00
} ) , ngControllerDirective = [
function ( ) {
2021-07-30 04:11:27 +03:00
return {
scope : ! 0 ,
2022-05-04 17:25:28 +03:00
controller : "@" ,
2021-07-30 04:11:27 +03:00
priority : 500
} ;
2022-05-04 17:25:28 +03:00
} ,
2022-01-02 23:54:58 +03:00
] , ngEventDirectives = { } ;
2022-05-04 17:25:28 +03:00
forEach ( "click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste" . split ( " " ) , function ( name ) {
var directiveName = directiveNormalize ( "ng-" + name ) ;
2021-08-04 13:27:17 +03:00
ngEventDirectives [ directiveName ] = [
2022-05-04 17:25:28 +03:00
"$parse" ,
2021-10-21 08:12:50 +03:00
function ( $parse ) {
2021-08-04 13:27:17 +03:00
return {
compile : function ( $element , attr ) {
var fn = $parse ( attr [ directiveName ] ) ;
return function ( scope , element , attr ) {
element . on ( lowercase ( name ) , function ( event ) {
scope . $apply ( function ( ) {
fn ( scope , {
$event : event
} ) ;
} ) ;
} ) ;
} ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ;
2021-08-04 13:27:17 +03:00
} ) ;
var ngIfDirective = [
2022-05-04 17:25:28 +03:00
"$animate" ,
2021-10-21 08:12:50 +03:00
function ( $animate ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
transclude : "element" ,
2021-07-30 04:11:27 +03:00
priority : 600 ,
terminal : ! 0 ,
2022-05-04 17:25:28 +03:00
restrict : "A" ,
2021-07-30 04:11:27 +03:00
$$tlb : ! 0 ,
link : function ( $scope , $element , $attr , ctrl , $transclude ) {
var block , childScope ;
$scope . $watch ( $attr . ngIf , function ( value ) {
toBoolean ( value ) ? childScope || $transclude ( childScope = $scope . $new ( ) , function ( clone ) {
2022-05-04 17:25:28 +03:00
clone [ clone . length ++ ] = document1 . createComment ( " end ngIf: " + $attr . ngIf + " " ) , block = {
2021-07-30 04:11:27 +03:00
clone : clone
} , $animate . enter ( clone , $element . parent ( ) , $element ) ;
} ) : ( childScope && ( childScope . $destroy ( ) , childScope = null ) , block && ( $animate . leave ( getBlockElements ( block . clone ) ) , block = null ) ) ;
} ) ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngIncludeDirective = [
2022-05-04 17:25:28 +03:00
"$http" ,
"$templateCache" ,
"$anchorScroll" ,
"$animate" ,
"$sce" ,
2021-10-21 08:12:50 +03:00
function ( $http , $templateCache , $anchorScroll , $animate , $sce ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
restrict : "ECA" ,
2021-07-30 04:11:27 +03:00
priority : 400 ,
terminal : ! 0 ,
2022-05-04 17:25:28 +03:00
transclude : "element" ,
2021-10-21 08:12:50 +03:00
controller : angular1 . noop ,
2021-07-30 04:11:27 +03:00
compile : function ( element , attr ) {
2022-05-04 17:25:28 +03:00
var srcExp = attr . ngInclude || attr . src , onloadExp = attr . onload || "" , autoScrollExp = attr . autoscroll ;
2021-07-30 04:11:27 +03:00
return function ( scope , $element , $attr , ctrl , $transclude ) {
var currentScope , currentElement , changeCounter = 0 , cleanupLastIncludeContent = function ( ) {
currentScope && ( currentScope . $destroy ( ) , currentScope = null ) , currentElement && ( $animate . leave ( currentElement ) , currentElement = null ) ;
} ;
scope . $watch ( $sce . parseAsResourceUrl ( srcExp ) , function ( src ) {
var afterAnimation = function ( ) {
isDefined ( autoScrollExp ) && ( ! autoScrollExp || scope . $eval ( autoScrollExp ) ) && $anchorScroll ( ) ;
} , thisChangeId = ++ changeCounter ;
src ? ( $http . get ( src , {
cache : $templateCache
} ) . success ( function ( response ) {
if ( thisChangeId === changeCounter ) {
var newScope = scope . $new ( ) ;
ctrl . template = response ;
2022-06-15 17:36:57 +03:00
var clone = $transclude ( newScope , function ( clone ) {
2021-07-30 04:11:27 +03:00
cleanupLastIncludeContent ( ) , $animate . enter ( clone , null , $element , afterAnimation ) ;
} ) ;
2022-06-15 17:36:57 +03:00
currentScope = newScope , currentElement = clone , currentScope . $emit ( "$includeContentLoaded" ) , scope . $eval ( onloadExp ) ;
2021-07-30 04:11:27 +03:00
}
} ) . error ( function ( ) {
thisChangeId === changeCounter && cleanupLastIncludeContent ( ) ;
2022-05-04 17:25:28 +03:00
} ) , scope . $emit ( "$includeContentRequested" ) ) : ( cleanupLastIncludeContent ( ) , ctrl . template = null ) ;
2021-07-30 04:11:27 +03:00
} ) ;
} ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngIncludeFillContentDirective = [
2022-05-04 17:25:28 +03:00
"$compile" ,
2021-10-21 08:12:50 +03:00
function ( $compile ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
restrict : "ECA" ,
2021-07-30 04:11:27 +03:00
priority : - 400 ,
2022-05-04 17:25:28 +03:00
require : "ngInclude" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , $element , $attr , ctrl ) {
$element . html ( ctrl . template ) , $compile ( $element . contents ( ) ) ( scope ) ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngInitDirective = ngDirective ( {
2021-07-30 04:11:27 +03:00
priority : 450 ,
compile : function ( ) {
return {
pre : function ( scope , element , attrs ) {
scope . $eval ( attrs . ngInit ) ;
}
} ;
}
} ) , ngNonBindableDirective = ngDirective ( {
terminal : ! 0 ,
priority : 1000
2021-08-03 18:52:47 +03:00
} ) , ngPluralizeDirective = [
2022-05-04 17:25:28 +03:00
"$locale" ,
"$interpolate" ,
2021-10-21 08:12:50 +03:00
function ( $locale , $interpolate ) {
2021-07-30 04:11:27 +03:00
var BRACE = /{}/g ;
return {
2022-05-04 17:25:28 +03:00
restrict : "EA" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr ) {
2022-01-02 23:54:58 +03:00
var numberExp = attr . count , whenExp = attr . $attr . when && element . attr ( attr . $attr . when ) , offset = attr . offset || 0 , whens = scope . $eval ( whenExp ) || { } , whensExpFns = { } , startSymbol = $interpolate . startSymbol ( ) , endSymbol = $interpolate . endSymbol ( ) , isWhen = /^when(Minus)?(.+)$/ ;
2021-07-30 04:11:27 +03:00
forEach ( attr , function ( expression , attributeName ) {
2022-05-04 17:25:28 +03:00
isWhen . test ( attributeName ) && ( whens [ lowercase ( attributeName . replace ( "when" , "" ) . replace ( "Minus" , "-" ) ) ] = element . attr ( attr . $attr [ attributeName ] ) ) ;
2021-07-30 04:11:27 +03:00
} ) , forEach ( whens , function ( expression , key ) {
2022-05-04 17:25:28 +03:00
whensExpFns [ key ] = $interpolate ( expression . replace ( BRACE , startSymbol + numberExp + "-" + offset + endSymbol ) ) ;
2021-07-30 04:11:27 +03:00
} ) , scope . $watch ( function ( ) {
var value = parseFloat ( scope . $eval ( numberExp ) ) ;
2022-05-04 17:25:28 +03:00
return isNaN ( value ) ? "" : ( value in whens || ( value = $locale . pluralCat ( value - offset ) ) , whensExpFns [ value ] ( scope , element , ! 0 ) ) ;
2021-07-30 04:11:27 +03:00
} , function ( newVal ) {
element . text ( newVal ) ;
} ) ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngRepeatDirective = [
2022-05-04 17:25:28 +03:00
"$parse" ,
"$animate" ,
2021-10-21 08:12:50 +03:00
function ( $parse , $animate ) {
2022-05-04 17:25:28 +03:00
var NG _REMOVED = "$$NG_REMOVED" , ngRepeatMinErr = minErr ( "ngRepeat" ) ;
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
transclude : "element" ,
2021-07-30 04:11:27 +03:00
priority : 1000 ,
terminal : ! 0 ,
$$tlb : ! 0 ,
link : function ( $scope , $element , $attr , ctrl , $transclude ) {
var trackByExp , trackByExpGetter , trackByIdExpFn , trackByIdArrayFn , trackByIdObjFn , lhs , rhs , valueIdentifier , keyIdentifier , expression = $attr . ngRepeat , match = expression . match ( /^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/ ) , hashFnLocals = {
$id : hashKey
} ;
2022-05-04 17:25:28 +03:00
if ( ! match ) throw ngRepeatMinErr ( "iexp" , "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'." , expression ) ;
2022-08-30 06:22:18 +03:00
if ( lhs = match [ 1 ] , rhs = match [ 2 ] , ( trackByExp = match [ 4 ] ) ? ( trackByExpGetter = $parse ( trackByExp ) , trackByIdExpFn = function ( key , value , index ) {
2021-10-10 06:47:11 +03:00
return keyIdentifier && ( hashFnLocals [ keyIdentifier ] = key ) , hashFnLocals [ valueIdentifier ] = value , hashFnLocals . $index = index , trackByExpGetter ( $scope , hashFnLocals ) ;
} ) : ( trackByIdArrayFn = function ( key , value ) {
2021-07-30 04:11:27 +03:00
return hashKey ( value ) ;
} , trackByIdObjFn = function ( key ) {
return key ;
2022-08-30 06:22:18 +03:00
} ) , ! ( match = lhs . match ( /^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/ ) ) ) throw ngRepeatMinErr ( "iidexp" , "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'." , lhs ) ;
2021-07-30 04:11:27 +03:00
valueIdentifier = match [ 3 ] || match [ 1 ] , keyIdentifier = match [ 2 ] ;
2022-01-02 23:54:58 +03:00
var lastBlockMap = { } ;
2021-07-30 04:11:27 +03:00
$scope . $watchCollection ( rhs , function ( collection ) {
2022-06-15 17:36:57 +03:00
var index , length , nextNode , arrayLength , childScope , key , value , trackById , trackByIdFn , collectionKeys , block , elementsToRemove , previousNode = $element [ 0 ] , nextBlockMap = { } , nextBlockOrder = [ ] ;
2021-07-30 04:11:27 +03:00
if ( isArrayLike ( collection ) ) collectionKeys = collection , trackByIdFn = trackByIdExpFn || trackByIdArrayFn ;
else {
2022-05-04 17:25:28 +03:00
for ( key in trackByIdFn = trackByIdExpFn || trackByIdObjFn , collectionKeys = [ ] , collection ) collection . hasOwnProperty ( key ) && "$" != key . charAt ( 0 ) && collectionKeys . push ( key ) ;
2021-07-30 04:11:27 +03:00
collectionKeys . sort ( ) ;
}
2022-08-30 06:22:18 +03:00
for ( index = 0 , arrayLength = collectionKeys . length , length = nextBlockOrder . length = collectionKeys . length ; index < length ; index ++ ) if ( value = collection [ key = collection === collectionKeys ? index : collectionKeys [ index ] ] , assertNotHasOwnProperty ( trackById = trackByIdFn ( key , value , index ) , "`track by` id" ) , lastBlockMap . hasOwnProperty ( trackById ) ) block = lastBlockMap [ trackById ] , delete lastBlockMap [ trackById ] , nextBlockMap [ trackById ] = block , nextBlockOrder [ index ] = block ;
2021-07-30 04:11:27 +03:00
else if ( nextBlockMap . hasOwnProperty ( trackById ) ) throw forEach ( nextBlockOrder , function ( block ) {
block && block . scope && ( lastBlockMap [ block . id ] = block ) ;
2022-05-04 17:25:28 +03:00
} ) , ngRepeatMinErr ( "dupes" , "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}" , expression , trackById ) ;
2021-07-30 04:11:27 +03:00
else nextBlockOrder [ index ] = {
id : trackById
} , nextBlockMap [ trackById ] = ! 1 ;
2022-06-15 17:36:57 +03:00
for ( key in lastBlockMap ) lastBlockMap . hasOwnProperty ( key ) && ( elementsToRemove = getBlockElements ( ( block = lastBlockMap [ key ] ) . clone ) , $animate . leave ( elementsToRemove ) , forEach ( elementsToRemove , function ( element ) {
2021-11-15 08:03:03 +03:00
element [ NG _REMOVED ] = ! 0 ;
2022-06-15 17:36:57 +03:00
} ) , block . scope . $destroy ( ) ) ;
2021-07-30 04:11:27 +03:00
for ( index = 0 , length = collectionKeys . length ; index < length ; index ++ ) {
2022-08-30 06:22:18 +03:00
if ( value = collection [ key = collection === collectionKeys ? index : collectionKeys [ index ] ] , block = nextBlockOrder [ index ] , nextBlockOrder [ index - 1 ] && ( previousNode = getBlockEnd ( nextBlockOrder [ index - 1 ] ) ) , block . scope ) {
2022-06-15 17:36:57 +03:00
childScope = block . scope , nextNode = previousNode ;
2021-07-30 04:11:27 +03:00
do nextNode = nextNode . nextSibling ;
2021-11-15 08:03:03 +03:00
while ( nextNode && nextNode [ NG _REMOVED ] )
2022-06-15 17:36:57 +03:00
getBlockStart ( block ) != nextNode && $animate . move ( getBlockElements ( block . clone ) , null , jqLite ( previousNode ) ) , previousNode = getBlockEnd ( block ) ;
2021-07-30 04:11:27 +03:00
} else childScope = $scope . $new ( ) ;
2022-06-15 17:36:57 +03:00
childScope [ valueIdentifier ] = value , keyIdentifier && ( childScope [ keyIdentifier ] = key ) , childScope . $index = index , childScope . $first = 0 === index , childScope . $last = index === arrayLength - 1 , childScope . $middle = ! ( childScope . $first || childScope . $last ) , childScope . $odd = ! ( childScope . $even = ( 1 & index ) == 0 ) , block . scope || $transclude ( childScope , function ( clone ) {
clone [ clone . length ++ ] = document1 . createComment ( " end ngRepeat: " + expression + " " ) , $animate . enter ( clone , null , jqLite ( previousNode ) ) , previousNode = clone , block . scope = childScope , block . clone = clone , nextBlockMap [ block . id ] = block ;
2021-07-30 04:11:27 +03:00
} ) ;
}
lastBlockMap = nextBlockMap ;
} ) ;
}
} ;
2022-05-18 10:25:25 +03:00
function getBlockStart ( block ) {
return block . clone [ 0 ] ;
}
function getBlockEnd ( block ) {
return block . clone [ block . clone . length - 1 ] ;
}
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngShowDirective = [
2022-05-04 17:25:28 +03:00
"$animate" ,
2021-10-21 08:12:50 +03:00
function ( $animate ) {
2021-07-30 04:11:27 +03:00
return function ( scope , element , attr ) {
scope . $watch ( attr . ngShow , function ( value ) {
2022-05-04 17:25:28 +03:00
$animate [ toBoolean ( value ) ? "removeClass" : "addClass" ] ( element , "ng-hide" ) ;
2021-07-30 04:11:27 +03:00
} ) ;
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngHideDirective = [
2022-05-04 17:25:28 +03:00
"$animate" ,
2021-10-21 08:12:50 +03:00
function ( $animate ) {
2021-07-30 04:11:27 +03:00
return function ( scope , element , attr ) {
scope . $watch ( attr . ngHide , function ( value ) {
2022-05-04 17:25:28 +03:00
$animate [ toBoolean ( value ) ? "addClass" : "removeClass" ] ( element , "ng-hide" ) ;
2021-07-30 04:11:27 +03:00
} ) ;
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngStyleDirective = ngDirective ( function ( scope , element , attr ) {
2021-07-30 04:11:27 +03:00
scope . $watch ( attr . ngStyle , function ( newStyles , oldStyles ) {
oldStyles && newStyles !== oldStyles && forEach ( oldStyles , function ( val , style ) {
2022-05-04 17:25:28 +03:00
element . css ( style , "" ) ;
2021-07-30 04:11:27 +03:00
} ) , newStyles && element . css ( newStyles ) ;
} , ! 0 ) ;
2021-08-03 18:52:47 +03:00
} ) , ngSwitchDirective = [
2022-05-04 17:25:28 +03:00
"$animate" ,
2021-10-21 08:12:50 +03:00
function ( $animate ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
restrict : "EA" ,
require : "ngSwitch" ,
2021-08-03 18:52:47 +03:00
controller : [
2022-05-04 17:25:28 +03:00
"$scope" ,
2021-10-21 08:12:50 +03:00
function ( ) {
2022-01-02 23:54:58 +03:00
this . cases = { } ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr , ngSwitchController ) {
var selectedTranscludes , selectedElements , watchExpr = attr . ngSwitch || attr . on , selectedScopes = [ ] ;
scope . $watch ( watchExpr , function ( value ) {
for ( var i = 0 , ii = selectedScopes . length ; i < ii ; i ++ ) selectedScopes [ i ] . $destroy ( ) , $animate . leave ( selectedElements [ i ] ) ;
2022-05-04 17:25:28 +03:00
selectedElements = [ ] , selectedScopes = [ ] , ( selectedTranscludes = ngSwitchController . cases [ "!" + value ] || ngSwitchController . cases [ "?" ] ) && ( scope . $eval ( attr . change ) , forEach ( selectedTranscludes , function ( selectedTransclude ) {
2021-07-30 04:11:27 +03:00
var selectedScope = scope . $new ( ) ;
selectedScopes . push ( selectedScope ) , selectedTransclude . transclude ( selectedScope , function ( caseElement ) {
var anchor = selectedTransclude . element ;
selectedElements . push ( caseElement ) , $animate . enter ( caseElement , anchor . parent ( ) , anchor ) ;
} ) ;
} ) ) ;
} ) ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , ngSwitchWhenDirective = ngDirective ( {
2022-05-04 17:25:28 +03:00
transclude : "element" ,
2021-07-30 04:11:27 +03:00
priority : 800 ,
2022-05-04 17:25:28 +03:00
require : "^ngSwitch" ,
2022-06-15 17:36:57 +03:00
compile : function ( element , attrs ) {
2021-07-30 04:11:27 +03:00
return function ( scope , element , attr , ctrl , $transclude ) {
2022-05-04 17:25:28 +03:00
ctrl . cases [ "!" + attrs . ngSwitchWhen ] = ctrl . cases [ "!" + attrs . ngSwitchWhen ] || [ ] , ctrl . cases [ "!" + attrs . ngSwitchWhen ] . push ( {
2021-07-30 04:11:27 +03:00
transclude : $transclude ,
element : element
} ) ;
} ;
}
} ) , ngSwitchDefaultDirective = ngDirective ( {
2022-05-04 17:25:28 +03:00
transclude : "element" ,
2021-07-30 04:11:27 +03:00
priority : 800 ,
2022-05-04 17:25:28 +03:00
require : "^ngSwitch" ,
2021-07-30 04:11:27 +03:00
link : function ( scope , element , attr , ctrl , $transclude ) {
2022-05-04 17:25:28 +03:00
ctrl . cases [ "?" ] = ctrl . cases [ "?" ] || [ ] , ctrl . cases [ "?" ] . push ( {
2021-07-30 04:11:27 +03:00
transclude : $transclude ,
element : element
} ) ;
}
} ) , ngTranscludeDirective = ngDirective ( {
2021-08-03 18:52:47 +03:00
controller : [
2022-05-04 17:25:28 +03:00
"$element" ,
"$transclude" ,
2021-10-21 08:12:50 +03:00
function ( $element , $transclude ) {
2022-05-04 17:25:28 +03:00
if ( ! $transclude ) throw minErr ( "ngTransclude" ) ( "orphan" , "Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}" , startingTag ( $element ) ) ;
2021-07-30 04:11:27 +03:00
this . $transclude = $transclude ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ,
2021-07-30 04:11:27 +03:00
link : function ( $scope , $element , $attrs , controller ) {
controller . $transclude ( function ( clone ) {
$element . empty ( ) , $element . append ( clone ) ;
} ) ;
}
2021-08-03 18:52:47 +03:00
} ) , scriptDirective = [
2022-05-04 17:25:28 +03:00
"$templateCache" ,
2021-10-21 08:12:50 +03:00
function ( $templateCache ) {
2021-07-30 04:11:27 +03:00
return {
2022-05-04 17:25:28 +03:00
restrict : "E" ,
2021-07-30 04:11:27 +03:00
terminal : ! 0 ,
compile : function ( element , attr ) {
2022-05-04 17:25:28 +03:00
if ( "text/ng-template" == attr . type ) {
2021-07-30 04:11:27 +03:00
var templateUrl = attr . id , text = element [ 0 ] . text ;
$templateCache . put ( templateUrl , text ) ;
}
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2022-06-15 17:36:57 +03:00
] , ngOptionsMinErr = minErr ( "ngOptions" ) , ngOptionsDirective = valueFn ( {
2021-07-30 04:11:27 +03:00
terminal : ! 0
2021-08-03 18:52:47 +03:00
} ) , selectDirective = [
2022-05-04 17:25:28 +03:00
"$compile" ,
"$parse" ,
2021-10-21 08:12:50 +03:00
function ( $compile , $parse ) {
2021-07-30 04:11:27 +03:00
var NG _OPTIONS _REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/ , nullModelCtrl = {
$setViewValue : noop
} ;
return {
2022-05-04 17:25:28 +03:00
restrict : "E" ,
2021-08-03 18:52:47 +03:00
require : [
2022-05-04 17:25:28 +03:00
"select" ,
"?ngModel"
2021-08-03 18:52:47 +03:00
] ,
controller : [
2022-05-04 17:25:28 +03:00
"$element" ,
"$scope" ,
"$attrs" ,
2021-10-21 08:12:50 +03:00
function ( $element , $scope , $attrs ) {
2022-09-01 19:30:21 +03:00
var unknownOption , self = this , optionsMap = { } , ngModelCtrl = nullModelCtrl ;
2021-07-30 04:11:27 +03:00
self . databound = $attrs . ngModel , self . init = function ( ngModelCtrl _ , nullOption _ , unknownOption _ ) {
2022-09-01 19:30:21 +03:00
ngModelCtrl = ngModelCtrl _ , unknownOption = unknownOption _ ;
2021-07-30 04:11:27 +03:00
} , self . addOption = function ( value ) {
2022-03-16 17:25:26 +03:00
assertNotHasOwnProperty ( value , '"option value"' ) , optionsMap [ value ] = ! 0 , ngModelCtrl . $viewValue == value && ( $element . val ( value ) , unknownOption . parent ( ) && unknownOption . remove ( ) ) ;
2021-07-30 04:11:27 +03:00
} , self . removeOption = function ( value ) {
this . hasOption ( value ) && ( delete optionsMap [ value ] , ngModelCtrl . $viewValue == value && this . renderUnknownOption ( value ) ) ;
} , self . renderUnknownOption = function ( val ) {
2022-05-04 17:25:28 +03:00
var unknownVal = "? " + hashKey ( val ) + " ?" ;
unknownOption . val ( unknownVal ) , $element . prepend ( unknownOption ) , $element . val ( unknownVal ) , unknownOption . prop ( "selected" , ! 0 ) ;
2021-07-30 04:11:27 +03:00
} , self . hasOption = function ( value ) {
return optionsMap . hasOwnProperty ( value ) ;
2022-05-04 17:25:28 +03:00
} , $scope . $on ( "$destroy" , function ( ) {
2021-07-30 04:11:27 +03:00
self . renderUnknownOption = noop ;
} ) ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ,
2022-06-15 17:36:57 +03:00
link : function ( scope , element , attr , ctrls ) {
2021-08-03 18:52:47 +03:00
if ( ctrls [ 1 ] ) {
2022-06-15 17:36:57 +03:00
for ( var scope1 , selectElement , ctrl , lastView , scope2 , selectElement1 , ngModelCtrl , selectCtrl , emptyOption , selectCtrl1 = ctrls [ 0 ] , ngModelCtrl1 = ctrls [ 1 ] , multiple = attr . multiple , optionsExp = attr . ngOptions , nullOption = ! 1 , optionTemplate = jqLite ( document1 . createElement ( "option" ) ) , optGroupTemplate = jqLite ( document1 . createElement ( "optgroup" ) ) , unknownOption = optionTemplate . clone ( ) , i = 0 , children = element . children ( ) , ii = children . length ; i < ii ; i ++ ) if ( "" === children [ i ] . value ) {
2021-08-03 18:52:47 +03:00
emptyOption = nullOption = children . eq ( i ) ;
break ;
}
if ( selectCtrl1 . init ( ngModelCtrl1 , nullOption , unknownOption ) , multiple && ( attr . required || attr . ngRequired ) ) {
var requiredValidator = function ( value ) {
2022-05-04 17:25:28 +03:00
return ngModelCtrl1 . $setValidity ( "required" , ! attr . required || value && value . length ) , value ;
2021-08-03 18:52:47 +03:00
} ;
2022-05-04 17:25:28 +03:00
ngModelCtrl1 . $parsers . push ( requiredValidator ) , ngModelCtrl1 . $formatters . unshift ( requiredValidator ) , attr . $observe ( "required" , function ( ) {
2021-08-03 18:52:47 +03:00
requiredValidator ( ngModelCtrl1 . $viewValue ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2021-08-03 18:52:47 +03:00
}
2022-03-07 06:51:57 +03:00
optionsExp ? function ( scope , selectElement , ctrl ) {
2022-05-04 17:25:28 +03:00
if ( ! ( match = optionsExp . match ( NG _OPTIONS _REGEXP ) ) ) throw ngOptionsMinErr ( "iexp" , "Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}" , optionsExp , startingTag ( selectElement ) ) ;
var match , displayFn = $parse ( match [ 2 ] || match [ 1 ] ) , valueName = match [ 4 ] || match [ 6 ] , keyName = match [ 5 ] , groupByFn = $parse ( match [ 3 ] || "" ) , valueFn = $parse ( match [ 2 ] ? match [ 1 ] : valueName ) , valuesFn = $parse ( match [ 7 ] ) , trackFn = match [ 8 ] ? $parse ( match [ 8 ] ) : null , optionGroupsCache = [
2021-08-03 18:52:47 +03:00
[
{
2021-09-01 16:11:55 +03:00
element : selectElement ,
2022-05-04 17:25:28 +03:00
label : ""
2021-08-03 18:52:47 +03:00
}
]
] ;
function render ( ) {
var optionGroupName , optionGroup , option , existingParent , existingOptions , existingOption , key , groupLength , length , groupIndex , index , selected , lastElement , element , label , optionGroups = {
2022-05-04 17:25:28 +03:00
"" : [ ]
2021-08-03 18:52:47 +03:00
} , optionGroupNames = [
2022-05-04 17:25:28 +03:00
""
2022-01-02 23:54:58 +03:00
] , modelValue = ctrl . $modelValue , values = valuesFn ( scope ) || [ ] , keys = keyName ? sortedKeys ( values ) : values , locals = { } , selectedSet = ! 1 ;
2022-04-12 05:12:10 +03:00
if ( multiple ) {
if ( trackFn && isArray ( modelValue ) ) {
selectedSet = new HashMap ( [ ] ) ;
for ( var trackIndex = 0 ; trackIndex < modelValue . length ; trackIndex ++ ) locals [ valueName ] = modelValue [ trackIndex ] , selectedSet . put ( trackFn ( scope , locals ) , modelValue [ trackIndex ] ) ;
} else selectedSet = new HashMap ( modelValue ) ;
}
2022-08-30 06:22:18 +03:00
for ( index = 0 ; index < ( length = keys . length ) ; index ++ ) {
2021-08-03 18:52:47 +03:00
if ( key = index , keyName ) {
2022-08-30 06:22:18 +03:00
if ( "$" === ( key = keys [ index ] ) . charAt ( 0 ) ) continue ;
2021-08-03 18:52:47 +03:00
locals [ keyName ] = key ;
}
2022-08-30 06:22:18 +03:00
if ( locals [ valueName ] = values [ key ] , ( optionGroup = optionGroups [ optionGroupName = groupByFn ( scope , locals ) || "" ] ) || ( optionGroup = optionGroups [ optionGroupName ] = [ ] , optionGroupNames . push ( optionGroupName ) ) , multiple ) selected = isDefined ( selectedSet . remove ( trackFn ? trackFn ( scope , locals ) : valueFn ( scope , locals ) ) ) ;
2021-08-03 18:52:47 +03:00
else {
if ( trackFn ) {
2022-01-02 23:54:58 +03:00
var modelCast = { } ;
2021-09-01 16:11:55 +03:00
modelCast [ valueName ] = modelValue , selected = trackFn ( scope , modelCast ) === trackFn ( scope , locals ) ;
} else selected = modelValue === valueFn ( scope , locals ) ;
2021-08-03 18:52:47 +03:00
selectedSet = selectedSet || selected ;
}
2022-08-26 11:45:49 +03:00
label = displayFn ( scope , locals ) , label = isDefined ( label ) ? label : "" , optionGroup . push ( {
2021-09-01 16:11:55 +03:00
id : trackFn ? trackFn ( scope , locals ) : keyName ? keys [ index ] : index ,
2021-08-03 18:52:47 +03:00
label : label ,
selected : selected
} ) ;
}
2022-05-04 17:25:28 +03:00
for ( multiple || ( nullOption || null === modelValue ? optionGroups [ "" ] . unshift ( {
id : "" ,
label : "" ,
2021-08-03 18:52:47 +03:00
selected : ! selectedSet
2022-05-04 17:25:28 +03:00
} ) : selectedSet || optionGroups [ "" ] . unshift ( {
id : "?" ,
label : "" ,
2021-08-03 18:52:47 +03:00
selected : ! 0
} ) ) , groupIndex = 0 , groupLength = optionGroupNames . length ; groupIndex < groupLength ; groupIndex ++ ) {
2022-08-30 06:22:18 +03:00
for ( optionGroup = optionGroups [ optionGroupName = optionGroupNames [ groupIndex ] ] , optionGroupsCache . length <= groupIndex ? ( existingOptions = [
existingParent = {
element : optGroupTemplate . clone ( ) . attr ( "label" , optionGroupName ) ,
label : optionGroup . label
}
2022-05-04 17:25:28 +03:00
] , optionGroupsCache . push ( existingOptions ) , selectElement . append ( existingParent . element ) ) : ( existingParent = ( existingOptions = optionGroupsCache [ groupIndex ] ) [ 0 ] ) . label != optionGroupName && existingParent . element . attr ( "label" , existingParent . label = optionGroupName ) , lastElement = null , index = 0 , length = optionGroup . length ; index < length ; index ++ ) option = optionGroup [ index ] , ( existingOption = existingOptions [ index + 1 ] ) ? ( lastElement = existingOption . element , existingOption . label !== option . label && lastElement . text ( existingOption . label = option . label ) , existingOption . id !== option . id && lastElement . val ( existingOption . id = option . id ) , lastElement [ 0 ] . selected !== option . selected && lastElement . prop ( "selected" , existingOption . selected = option . selected ) ) : ( "" === option . id && nullOption ? element = nullOption : ( element = optionTemplate . clone ( ) ) . val ( option . id ) . attr ( "selected" , option . selected ) . text ( option . label ) , existingOptions . push ( existingOption = {
2021-08-03 18:52:47 +03:00
element : element ,
label : option . label ,
id : option . id ,
selected : option . selected
} ) , lastElement ? lastElement . after ( element ) : existingParent . element . append ( element ) , lastElement = element ) ;
for ( index ++ ; existingOptions . length > index ; ) existingOptions . pop ( ) . element . remove ( ) ;
}
for ( ; optionGroupsCache . length > groupIndex ; ) optionGroupsCache . pop ( ) [ 0 ] . element . remove ( ) ;
}
2022-05-04 17:25:28 +03:00
nullOption && ( $compile ( nullOption ) ( scope ) , nullOption . removeClass ( "ng-scope" ) , nullOption . remove ( ) ) , selectElement . empty ( ) , selectElement . on ( "change" , function ( ) {
2021-09-01 16:11:55 +03:00
scope . $apply ( function ( ) {
2022-01-02 23:54:58 +03:00
var optionGroup , key , value , optionElement , index , groupIndex , length , groupLength , trackIndex , collection = valuesFn ( scope ) || [ ] , locals = { } ;
2021-08-03 18:52:47 +03:00
if ( multiple ) {
for ( groupIndex = 0 , value = [ ] , groupLength = optionGroupsCache . length ; groupIndex < groupLength ; groupIndex ++ ) for ( index = 1 , length = ( optionGroup = optionGroupsCache [ groupIndex ] ) . length ; index < length ; index ++ ) if ( ( optionElement = optionGroup [ index ] . element ) [ 0 ] . selected ) {
2021-09-01 16:11:55 +03:00
if ( key = optionElement . val ( ) , keyName && ( locals [ keyName ] = key ) , trackFn ) for ( trackIndex = 0 ; trackIndex < collection . length && ( locals [ valueName ] = collection [ trackIndex ] , trackFn ( scope , locals ) != key ) ; trackIndex ++ ) ;
2021-08-03 18:52:47 +03:00
else locals [ valueName ] = collection [ key ] ;
2021-09-01 16:11:55 +03:00
value . push ( valueFn ( scope , locals ) ) ;
2021-08-03 18:52:47 +03:00
}
2022-05-04 17:25:28 +03:00
} else if ( "?" == ( key = selectElement . val ( ) ) ) value = undefined ;
else if ( "" === key ) value = null ;
2021-08-03 18:52:47 +03:00
else if ( trackFn ) {
2021-09-01 16:11:55 +03:00
for ( trackIndex = 0 ; trackIndex < collection . length ; trackIndex ++ ) if ( locals [ valueName ] = collection [ trackIndex ] , trackFn ( scope , locals ) == key ) {
value = valueFn ( scope , locals ) ;
2021-08-03 18:52:47 +03:00
break ;
}
2021-09-01 16:11:55 +03:00
} else locals [ valueName ] = collection [ key ] , keyName && ( locals [ keyName ] = key ) , value = valueFn ( scope , locals ) ;
ctrl . $setViewValue ( value ) ;
2021-08-03 18:52:47 +03:00
} ) ;
2021-09-01 16:11:55 +03:00
} ) , ctrl . $render = render , scope . $watch ( render ) ;
2022-09-13 06:52:47 +03:00
} ( scope , element , ngModelCtrl1 ) : multiple ? ( ( ctrl = ngModelCtrl1 ) . $render = function ( ) {
2022-06-15 17:36:57 +03:00
var items = new HashMap ( ctrl . $viewValue ) ;
2022-09-13 06:52:47 +03:00
forEach ( element . find ( "option" ) , function ( option ) {
2021-07-30 04:11:27 +03:00
option . selected = isDefined ( items . get ( option . value ) ) ;
} ) ;
2022-09-13 06:52:47 +03:00
} , scope . $watch ( function ( ) {
2022-06-15 17:36:57 +03:00
equals ( lastView , ctrl . $viewValue ) || ( lastView = copy ( ctrl . $viewValue ) , ctrl . $render ( ) ) ;
2022-09-13 06:52:47 +03:00
} ) , element . on ( "change" , function ( ) {
scope . $apply ( function ( ) {
2021-07-30 04:11:27 +03:00
var array = [ ] ;
2022-09-13 06:52:47 +03:00
forEach ( element . find ( "option" ) , function ( option ) {
2021-07-30 04:11:27 +03:00
option . selected && array . push ( option . value ) ;
2022-06-15 17:36:57 +03:00
} ) , ctrl . $setViewValue ( array ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2022-09-13 06:52:47 +03:00
} ) ) : ( ( ngModelCtrl = ngModelCtrl1 ) . $render = function ( ) {
2021-08-03 18:52:47 +03:00
var viewValue = ngModelCtrl . $viewValue ;
2022-09-13 06:52:47 +03:00
selectCtrl1 . hasOption ( viewValue ) ? ( unknownOption . parent ( ) && unknownOption . remove ( ) , element . val ( viewValue ) , "" === viewValue && emptyOption . prop ( "selected" , ! 0 ) ) : isUndefined ( viewValue ) && emptyOption ? element . val ( "" ) : selectCtrl1 . renderUnknownOption ( viewValue ) ;
} , element . on ( "change" , function ( ) {
scope . $apply ( function ( ) {
unknownOption . parent ( ) && unknownOption . remove ( ) , ngModelCtrl . $setViewValue ( element . val ( ) ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2021-08-03 18:52:47 +03:00
} ) ) ;
2021-07-30 04:11:27 +03:00
}
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] , optionDirective = [
2022-05-04 17:25:28 +03:00
"$interpolate" ,
2021-10-21 08:12:50 +03:00
function ( $interpolate ) {
2021-07-30 04:11:27 +03:00
var nullSelectCtrl = {
addOption : noop ,
removeOption : noop
} ;
return {
2022-05-04 17:25:28 +03:00
restrict : "E" ,
2021-07-30 04:11:27 +03:00
priority : 100 ,
2022-06-15 17:36:57 +03:00
compile : function ( element , attr ) {
if ( isUndefined ( attr . value ) ) {
var interpolateFn = $interpolate ( element . text ( ) , ! 0 ) ;
interpolateFn || attr . $set ( "value" , element . text ( ) ) ;
2021-07-30 04:11:27 +03:00
}
2021-09-01 16:11:55 +03:00
return function ( scope , element , attr ) {
2022-05-04 17:25:28 +03:00
var selectCtrlName = "$selectController" , parent = element . parent ( ) , selectCtrl = parent . data ( selectCtrlName ) || parent . parent ( ) . data ( selectCtrlName ) ;
selectCtrl && selectCtrl . databound ? element . prop ( "selected" , ! 1 ) : selectCtrl = nullSelectCtrl , interpolateFn ? scope . $watch ( interpolateFn , function ( newVal , oldVal ) {
attr . $set ( "value" , newVal ) , newVal !== oldVal && selectCtrl . removeOption ( oldVal ) , selectCtrl . addOption ( newVal ) ;
} ) : selectCtrl . addOption ( attr . value ) , element . on ( "$destroy" , function ( ) {
2021-09-01 16:11:55 +03:00
selectCtrl . removeOption ( attr . value ) ;
2021-07-30 04:11:27 +03:00
} ) ;
} ;
}
} ;
2022-05-04 17:25:28 +03:00
} ,
2022-06-15 17:36:57 +03:00
] , styleDirective = valueFn ( {
2022-05-04 17:25:28 +03:00
restrict : "E" ,
2021-07-30 04:11:27 +03:00
terminal : ! 0
} ) ;
2022-08-30 06:22:18 +03:00
( jQuery = window1 . jQuery ) ? ( jqLite = jQuery , extend ( jQuery . fn , {
2021-07-30 04:11:27 +03:00
scope : JQLitePrototype . scope ,
isolateScope : JQLitePrototype . isolateScope ,
controller : JQLitePrototype . controller ,
injector : JQLitePrototype . injector ,
inheritedData : JQLitePrototype . inheritedData
2022-06-15 17:36:57 +03:00
} ) , jqLitePatchJQueryRemove ( "remove" , ! 0 , ! 0 , ! 1 ) , jqLitePatchJQueryRemove ( "empty" , ! 1 , ! 1 , ! 1 ) , jqLitePatchJQueryRemove ( "html" , ! 1 , ! 1 , ! 0 ) ) : jqLite = JQLite , angular1 . element = jqLite , function ( angular1 ) {
extend ( angular1 , {
bootstrap : bootstrap ,
2021-07-30 04:11:27 +03:00
copy : copy ,
extend : extend ,
equals : equals ,
element : jqLite ,
forEach : forEach ,
injector : createInjector ,
noop : noop ,
bind : bind ,
toJson : toJson ,
fromJson : fromJson ,
identity : identity ,
isUndefined : isUndefined ,
isDefined : isDefined ,
isString : isString ,
isFunction : isFunction ,
isObject : isObject ,
isNumber : isNumber ,
isElement : isElement ,
isArray : isArray ,
version : version ,
isDate : isDate ,
lowercase : lowercase ,
uppercase : uppercase ,
callbacks : {
counter : 0
} ,
2022-05-04 17:25:28 +03:00
$$minErr : minErr ,
$$csp : csp
2022-06-15 17:36:57 +03:00
} ) , angularModule = function ( window1 ) {
2022-05-04 17:25:28 +03:00
var $injectorMinErr = minErr ( "$injector" ) , ngMinErr = minErr ( "ng" ) ;
2021-09-08 12:45:39 +03:00
function ensure ( obj , name , factory ) {
return obj [ name ] || ( obj [ name ] = factory ( ) ) ;
}
2022-06-15 17:36:57 +03:00
var angular1 = ensure ( window1 , "angular" , Object ) ;
return angular1 . $$minErr = angular1 . $$minErr || minErr , ensure ( angular1 , "module" , function ( ) {
2022-01-02 23:54:58 +03:00
var modules = { } ;
2022-06-15 17:36:57 +03:00
return function ( name , requires , configFn ) {
2022-03-08 17:35:18 +03:00
return function ( name , context ) {
2022-05-04 17:25:28 +03:00
if ( "hasOwnProperty" === name ) throw ngMinErr ( "badname" , "hasOwnProperty is not a valid {0} name" , context ) ;
2022-06-15 17:36:57 +03:00
} ( name , "module" ) , requires && modules . hasOwnProperty ( name ) && ( modules [ name ] = null ) , ensure ( modules , name , function ( ) {
if ( ! requires ) throw $injectorMinErr ( "nomod" , "Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument." , name ) ;
2022-05-04 17:25:28 +03:00
var invokeQueue = [ ] , runBlocks = [ ] , config = invokeLater ( "$injector" , "invoke" ) , moduleInstance = {
2021-09-08 12:45:39 +03:00
_invokeQueue : invokeQueue ,
_runBlocks : runBlocks ,
requires : requires ,
2022-06-15 17:36:57 +03:00
name : name ,
2022-05-04 17:25:28 +03:00
provider : invokeLater ( "$provide" , "provider" ) ,
factory : invokeLater ( "$provide" , "factory" ) ,
service : invokeLater ( "$provide" , "service" ) ,
value : invokeLater ( "$provide" , "value" ) ,
constant : invokeLater ( "$provide" , "constant" , "unshift" ) ,
animation : invokeLater ( "$animateProvider" , "register" ) ,
filter : invokeLater ( "$filterProvider" , "register" ) ,
controller : invokeLater ( "$controllerProvider" , "register" ) ,
directive : invokeLater ( "$compileProvider" , "directive" ) ,
2021-09-08 12:45:39 +03:00
config : config ,
run : function ( block ) {
return runBlocks . push ( block ) , this ;
}
} ;
return configFn && config ( configFn ) , moduleInstance ;
2022-05-18 10:25:25 +03:00
function invokeLater ( provider , method , insertMethod ) {
return function ( ) {
return invokeQueue [ insertMethod || "push" ] ( [
provider ,
method ,
arguments ,
] ) , moduleInstance ;
} ;
}
2021-09-08 12:45:39 +03:00
} ) ;
} ;
} ) ;
2022-03-07 06:51:57 +03:00
} ( window1 ) ;
2021-07-30 04:11:27 +03:00
try {
2022-05-04 17:25:28 +03:00
angularModule ( "ngLocale" ) ;
2021-07-30 04:11:27 +03:00
} catch ( e ) {
2022-05-04 17:25:28 +03:00
angularModule ( "ngLocale" , [ ] ) . provider ( "$locale" , $LocaleProvider ) ;
2021-07-30 04:11:27 +03:00
}
2022-05-04 17:25:28 +03:00
angularModule ( "ng" , [
"ngLocale"
2021-08-03 18:52:47 +03:00
] , [
2022-05-04 17:25:28 +03:00
"$provide" ,
2021-10-21 08:12:50 +03:00
function ( $provide ) {
2021-07-30 04:11:27 +03:00
$provide . provider ( {
$$sanitizeUri : $$SanitizeUriProvider
2022-05-04 17:25:28 +03:00
} ) , $provide . provider ( "$compile" , $CompileProvider ) . directive ( {
2021-07-30 04:11:27 +03:00
a : htmlAnchorDirective ,
input : inputDirective ,
textarea : inputDirective ,
form : formDirective ,
script : scriptDirective ,
select : selectDirective ,
style : styleDirective ,
option : optionDirective ,
ngBind : ngBindDirective ,
ngBindHtml : ngBindHtmlDirective ,
ngBindTemplate : ngBindTemplateDirective ,
ngClass : ngClassDirective ,
ngClassEven : ngClassEvenDirective ,
ngClassOdd : ngClassOddDirective ,
ngCloak : ngCloakDirective ,
ngController : ngControllerDirective ,
ngForm : ngFormDirective ,
ngHide : ngHideDirective ,
ngIf : ngIfDirective ,
ngInclude : ngIncludeDirective ,
ngInit : ngInitDirective ,
ngNonBindable : ngNonBindableDirective ,
ngPluralize : ngPluralizeDirective ,
ngRepeat : ngRepeatDirective ,
ngShow : ngShowDirective ,
ngStyle : ngStyleDirective ,
ngSwitch : ngSwitchDirective ,
ngSwitchWhen : ngSwitchWhenDirective ,
ngSwitchDefault : ngSwitchDefaultDirective ,
ngOptions : ngOptionsDirective ,
ngTransclude : ngTranscludeDirective ,
ngModel : ngModelDirective ,
ngList : ngListDirective ,
ngChange : ngChangeDirective ,
required : requiredDirective ,
ngRequired : requiredDirective ,
2022-07-06 06:53:11 +03:00
ngValue : ngValueDirective
2021-07-30 04:11:27 +03:00
} ) . directive ( {
ngInclude : ngIncludeFillContentDirective
} ) . directive ( ngAttributeAliasDirectives ) . directive ( ngEventDirectives ) , $provide . provider ( {
$anchorScroll : $AnchorScrollProvider ,
$animate : $AnimateProvider ,
$browser : $BrowserProvider ,
$cacheFactory : $CacheFactoryProvider ,
$controller : $ControllerProvider ,
$document : $DocumentProvider ,
$exceptionHandler : $ExceptionHandlerProvider ,
$filter : $FilterProvider ,
$interpolate : $InterpolateProvider ,
$interval : $IntervalProvider ,
$http : $HttpProvider ,
$httpBackend : $HttpBackendProvider ,
$location : $LocationProvider ,
$log : $LogProvider ,
$parse : $ParseProvider ,
$rootScope : $RootScopeProvider ,
$q : $QProvider ,
$sce : $SceProvider ,
$sceDelegate : $SceDelegateProvider ,
$sniffer : $SnifferProvider ,
$templateCache : $TemplateCacheProvider ,
$timeout : $TimeoutProvider ,
$window : $WindowProvider
} ) ;
2022-05-04 17:25:28 +03:00
} ,
2021-10-21 08:12:50 +03:00
] ) ;
2022-03-07 06:51:57 +03:00
} ( angular1 ) , jqLite ( document1 ) . ready ( function ( ) {
2022-06-15 17:36:57 +03:00
! function ( element , bootstrap ) {
2021-09-08 12:45:39 +03:00
var appElement , module , elements = [
2022-06-15 17:36:57 +03:00
element
2021-09-08 12:45:39 +03:00
] , names = [
2022-05-04 17:25:28 +03:00
"ng:app" ,
"ng-app" ,
"x-ng-app" ,
"data-ng-app"
2021-09-08 12:45:39 +03:00
] , NG _APP _CLASS _REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/ ;
function append ( element ) {
element && elements . push ( element ) ;
}
forEach ( names , function ( name ) {
2022-06-15 17:36:57 +03:00
names [ name ] = ! 0 , append ( document1 . getElementById ( name ) ) , name = name . replace ( ":" , "\\:" ) , element . querySelectorAll && ( forEach ( element . querySelectorAll ( "." + name ) , append ) , forEach ( element . querySelectorAll ( "." + name + "\\:" ) , append ) , forEach ( element . querySelectorAll ( "[" + name + "]" ) , append ) ) ;
2021-09-08 12:45:39 +03:00
} ) , forEach ( elements , function ( element ) {
if ( ! appElement ) {
2022-05-04 17:25:28 +03:00
var className = " " + element . className + " " , match = NG _APP _CLASS _REGEXP . exec ( className ) ;
match ? ( appElement = element , module = ( match [ 2 ] || "" ) . replace ( /\s+/g , "," ) ) : forEach ( element . attributes , function ( attr ) {
2021-09-08 12:45:39 +03:00
! appElement && names [ attr . name ] && ( appElement = element , module = attr . value ) ;
} ) ;
}
} ) , appElement && bootstrap ( appElement , module ? [
module
] : [ ] ) ;
2022-06-15 17:36:57 +03:00
} ( document1 , bootstrap ) ;
2021-07-30 04:11:27 +03:00
} ) ;
2022-05-04 17:25:28 +03:00
} ( window , document ) , angular . $$csp ( ) || angular . element ( document ) . find ( "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{display:none !important;}ng\\:form{display:block;}.ng-animate-start{border-spacing:1px 1px;-ms-zoom:1.0001;}.ng-animate-active{border-spacing:0px 0px;-ms-zoom:1;}</style>' ) ;