11( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . PriorityQueue = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
22var AbstractPriorityQueue , ArrayStrategy , BHeapStrategy , BinaryHeapStrategy , PriorityQueue ,
3- __hasProp = { } . hasOwnProperty ,
4- __extends = function ( child , parent ) { for ( var key in parent ) { if ( __hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ;
3+ extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
4+ hasProp = { } . hasOwnProperty ;
55
66AbstractPriorityQueue = require ( './PriorityQueue/AbstractPriorityQueue' ) ;
77
@@ -11,8 +11,8 @@ BinaryHeapStrategy = require('./PriorityQueue/BinaryHeapStrategy');
1111
1212BHeapStrategy = require ( './PriorityQueue/BHeapStrategy' ) ;
1313
14- PriorityQueue = ( function ( _super ) {
15- __extends ( PriorityQueue , _super ) ;
14+ PriorityQueue = ( function ( superClass ) {
15+ extend ( PriorityQueue , superClass ) ;
1616
1717function PriorityQueue ( options ) {
1818options || ( options = { } ) ;
@@ -41,14 +41,15 @@ var AbstractPriorityQueue;
4141
4242module . exports = AbstractPriorityQueue = ( function ( ) {
4343function AbstractPriorityQueue ( options ) {
44+ var ref ;
4445if ( ( options != null ?options . strategy :void 0 ) == null ) {
4546throw 'Must pass options.strategy, a strategy' ;
4647}
4748if ( ( options != null ?options . comparator :void 0 ) == null ) {
4849throw 'Must pass options.comparator, a comparator' ;
4950}
5051this . priv = new options . strategy ( options ) ;
51- this . length = 0 ;
52+ this . length = ( options != null ? ( ref = options . initialValues ) != null ? ref . length : void 0 : void 0 ) || 0 ;
5253}
5354
5455AbstractPriorityQueue . prototype . queue = function ( value ) {
@@ -102,10 +103,10 @@ binarySearchForIndexReversed = function(array, value, comparator) {
102103
103104module . exports = ArrayStrategy = ( function ( ) {
104105function ArrayStrategy ( options ) {
105- var _ref ;
106+ var ref ;
106107this . options = options ;
107108this . comparator = this . options . comparator ;
108- this . data = ( ( _ref = this . options . initialValues ) != null ?_ref . slice ( 0 ) :void 0 ) || [ ] ;
109+ this . data = ( ( ref = this . options . initialValues ) != null ?ref . slice ( 0 ) :void 0 ) || [ ] ;
109110this . data . sort ( this . comparator ) . reverse ( ) ;
110111}
111112
@@ -139,7 +140,7 @@ var BHeapStrategy;
139140
140141module . exports = BHeapStrategy = ( function ( ) {
141142function BHeapStrategy ( options ) {
142- var arr , i , shift , value , _i , _j , _len , _ref , _ref1 ;
143+ var arr , i , j , k , len , ref , ref1 , shift , value ;
143144this . comparator = ( options != null ?options . comparator :void 0 ) || function ( a , b ) {
144145return a - b ;
145146} ;
@@ -154,15 +155,15 @@ module.exports = BHeapStrategy = (function() {
154155}
155156this . _shift = shift ;
156157this . _emptyMemoryPageTemplate = arr = [ ] ;
157- for ( i = _i = 0 , _ref = this . pageSize ; 0 <= _ref ?_i < _ref :_i > _ref ; i = 0 <= _ref ?++ _i :-- _i ) {
158+ for ( i = j = 0 , ref = this . pageSize ; 0 <= ref ?j < ref :j > ref ; i = 0 <= ref ?++ j :-- j ) {
158159arr . push ( null ) ;
159160}
160161this . _memory = [ ] ;
161162this . _mask = this . pageSize - 1 ;
162163if ( options . initialValues ) {
163- _ref1 = options . initialValues ;
164- for ( _j = 0 , _len = _ref1 . length ; _j < _len ; _j ++ ) {
165- value = _ref1 [ _j ] ;
164+ ref1 = options . initialValues ;
165+ for ( k = 0 , len = ref1 . length ; k < len ; k ++ ) {
166+ value = ref1 [ k ] ;
166167this . queue ( value ) ;
167168}
168169}
@@ -290,19 +291,19 @@ var BinaryHeapStrategy;
290291
291292module . exports = BinaryHeapStrategy = ( function ( ) {
292293function BinaryHeapStrategy ( options ) {
293- var _ref ;
294+ var ref ;
294295this . comparator = ( options != null ?options . comparator :void 0 ) || function ( a , b ) {
295296return a - b ;
296297} ;
297298this . length = 0 ;
298- this . data = ( ( _ref = options . initialValues ) != null ?_ref . slice ( 0 ) :void 0 ) || [ ] ;
299+ this . data = ( ( ref = options . initialValues ) != null ?ref . slice ( 0 ) :void 0 ) || [ ] ;
299300this . _heapify ( ) ;
300301}
301302
302303BinaryHeapStrategy . prototype . _heapify = function ( ) {
303- var i , _i , _ref ;
304+ var i , j , ref ;
304305if ( this . data . length > 0 ) {
305- for ( i = _i = 1 , _ref = this . data . length ; 1 <= _ref ?_i < _ref :_i > _ref ; i = 1 <= _ref ?++ _i :-- _i ) {
306+ for ( i = j = 1 , ref = this . data . length ; 1 <= ref ?j < ref :j > ref ; i = 1 <= ref ?++ j :-- j ) {
306307this . _bubbleUp ( i ) ;
307308}
308309}