2020-08-11 10:09:55 +03:00
! function ( e ) { var t = { } ; function r ( n ) { if ( t [ n ] ) return t [ n ] . exports ; var i = t [ n ] = { i : n , l : ! 1 , exports : { } } ; return e [ n ] . call ( i . exports , i , i . exports , r ) , i . l = ! 0 , i . exports } r . m = e , r . c = t , r . d = function ( e , t , n ) { r . o ( e , t ) || Object . defineProperty ( e , t , { enumerable : ! 0 , get : n } ) } , r . r = function ( e ) { "undefined" != typeof Symbol && Symbol . toStringTag && Object . defineProperty ( e , Symbol . toStringTag , { value : "Module" } ) , Object . defineProperty ( e , "__esModule" , { value : ! 0 } ) } , r . t = function ( e , t ) { if ( 1 & t && ( e = r ( e ) ) , 8 & t ) return e ; if ( 4 & t && "object" == typeof e && e && e . _ _esModule ) return e ; var n = Object . create ( null ) ; if ( r . r ( n ) , Object . defineProperty ( n , "default" , { enumerable : ! 0 , value : e } ) , 2 & t && "string" != typeof e ) for ( var i in e ) r . d ( n , i , function ( t ) { return e [ t ] } . bind ( null , i ) ) ; return n } , r . n = function ( e ) { var t = e && e . _ _esModule ? function ( ) { return e . default } : function ( ) { return e } ; return r . d ( t , "a" , t ) , t } , r . o = function ( e , t ) { return Object . prototype . hasOwnProperty . call ( e , t ) } , r . p = "" , r ( r . s = 5 ) } ( [ function ( e , t , r ) { "use strict" ;
/ * !
* escape - html
* Copyright ( c ) 2012 - 2013 TJ Holowaychuk
* Copyright ( c ) 2015 Andreas Lubbe
* Copyright ( c ) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
* /var n=/ [ "'&<>]/;e.exports=function(e){var t,r=" "+e,i=n.exec(r);if(!i)return r;var s=" ",o=0,a=0;for(o=i.index;o<r.length;o++){switch(r.charCodeAt(o)){case 34:t=" & quot ; ";break;case 38:t=" & amp ; ";break;case 39:t=" & # 39 ; ";break;case 60:t=" & lt ; ";break;case 62:t=" & gt ; " ; break ; default : continue } a !== o && ( s += r . substring ( a , o ) ) , a = o + 1 , s += t } return a !== o ? s + r . substring ( a , o ) : s } } , function ( e , t , r ) { var n = r ( 2 ) , i = r ( 3 ) ; void 0 === i . lunr && ( i . lunr = n ) , e . exports = n } , function ( e , t , r ) { var n , i ;
/ * *
2020-09-04 10:17:38 +03:00
* lunr - http : //lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* @ license MIT
2020-09-04 10:17:38 +03:00
* / ! f u n c t i o n ( ) { v a r s , o , a , u , l , c , h , d , f , p , y , m , g , v , x , w , Q , b , S , E , k , L , P , T , O , R , I = f u n c t i o n ( e ) { v a r t = n e w I . B u i l d e r ; r e t u r n t . p i p e l i n e . a d d ( I . t r i m m e r , I . s t o p W o r d F i l t e r , I . s t e m m e r ) , t . s e a r c h P i p e l i n e . a d d ( I . s t e m m e r ) , e . c a l l ( t , t ) , t . b u i l d ( ) } ; I . v e r s i o n = " 2 . 3 . 9 "
2020-08-11 10:09:55 +03:00
/ * !
* lunr . utils
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* /,I.utils={},I.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),I.utils.asString=function(e){return null==e?"":e.toString()},I.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],s=e[i];if(Array.isArray(s))t[i]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[i]=s}}return t},I.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},I.FieldRef.joiner="/ ",I.FieldRef.fromString=function(e){var t=e.indexOf(I.FieldRef.joiner);if(-1===t)throw" malformed field ref string " ; var r = e . slice ( 0 , t ) , n = e . slice ( t + 1 ) ; return new I . FieldRef ( n , r , e ) } , I . FieldRef . prototype . toString = function ( ) { return null == this . _stringValue && ( this . _stringValue = this . fieldName + I . FieldRef . joiner + this . docRef ) , this . _stringValue }
/ * !
* lunr . Set
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
* /,I.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},I.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},I.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},I.Set.prototype.contains=function(e){return!!this.elements[e]},I.Set.prototype.intersect=function(e){var t,r,n,i=[];if(e===I.Set.complete)return this;if(e===I.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),n=Object.keys(t.elements);for(var s=0;s<n.length;s++){var o=n[s];o in r.elements&&i.push(o)}return new I.Set(i)},I.Set.prototype.union=function(e){return e===I.Set.complete?I.Set.complete:e===I.Set.empty?this:new I.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},I.idf=function(e,t){var r=0;for(var n in e)"_index"!=n&&(r+=Object.keys(e[n]).length);var i=(t-r+.5)/ ( r + . 5 ) ; return Math . log ( 1 + Math . abs ( i ) ) } , I . Token = function ( e , t ) { this . str = e || "" , this . metadata = t || { } } , I . Token . prototype . toString = function ( ) { return this . str } , I . Token . prototype . update = function ( e ) { return this . str = e ( this . str , this . metadata ) , this } , I . Token . prototype . clone = function ( e ) { return e = e || function ( e ) { return e } , new I . Token ( e ( this . str , this . metadata ) , this . metadata ) }
2020-08-11 10:09:55 +03:00
/ * !
* lunr . tokenizer
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* /,I.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new I.Token(I.utils.asString(e).toLowerCase(),I.utils.clone(t))}));for(var r=e.toString().toLowerCase(),n=r.length,i=[],s=0,o=0;s<=n;s++){var a=s-o;if(r.charAt(s).match(I.tokenizer.separator)||s==n){if(a>0){var u=I.utils.clone(t)||{};u.position=[o,a],u.index=i.length,i.push(new I.Token(r.slice(o,s),u))}o=s+1}}return i},I.tokenizer.separator=/ [ \ s \ - ] + /
/ * !
* lunr . Pipeline
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* / , I . P i p e l i n e = f u n c t i o n ( ) { t h i s . _ s t a c k = [ ] } , I . P i p e l i n e . r e g i s t e r e d F u n c t i o n s = O b j e c t . c r e a t e ( n u l l ) , I . P i p e l i n e . r e g i s t e r F u n c t i o n = f u n c t i o n ( e , t ) { t i n t h i s . r e g i s t e r e d F u n c t i o n s & & I . u t i l s . w a r n ( " O v e r w r i t i n g e x i s t i n g r e g i s t e r e d f u n c t i o n : " + t ) , e . l a b e l = t , I . P i p e l i n e . r e g i s t e r e d F u n c t i o n s [ e . l a b e l ] = e } , I . P i p e l i n e . w a r n I f F u n c t i o n N o t R e g i s t e r e d = f u n c t i o n ( e ) { e . l a b e l & & e . l a b e l i n t h i s . r e g i s t e r e d F u n c t i o n s | | I . u t i l s . w a r n ( " F u n c t i o n i s n o t r e g i s t e r e d w i t h p i p e l i n e . T h i s m a y c a u s e p r o b l e m s w h e n s e r i a l i s i n g t h e i n d e x . \ n " , e ) } , I . P i p e l i n e . l o a d = f u n c t i o n ( e ) { v a r t = n e w I . P i p e l i n e ; r e t u r n e . f o r E a c h ( ( f u n c t i o n ( e ) { v a r r = I . P i p e l i n e . r e g i s t e r e d F u n c t i o n s [ e ] ; i f ( ! r ) t h r o w n e w E r r o r ( " C a n n o t l o a d u n r e g i s t e r e d f u n c t i o n : " + e ) ; t . a d d ( r ) } ) ) , t } , I . P i p e l i n e . p r o t o t y p e . a d d = f u n c t i o n ( ) { v a r e = A r r a y . p r o t o t y p e . s l i c e . c a l l ( a r g u m e n t s ) ; e . f o r E a c h ( ( f u n c t i o n ( e ) { I . P i p e l i n e . w a r n I f F u n c t i o n N o t R e g i s t e r e d ( e ) , t h i s . _ s t a c k . p u s h ( e ) } ) , t h i s ) } , I . P i p e l i n e . p r o t o t y p e . a f t e r = f u n c t i o n ( e , t ) { I . P i p e l i n e . w a r n I f F u n c t i o n N o t R e g i s t e r e d ( t ) ; v a r r = t h i s . _ s t a c k . i n d e x O f ( e ) ; i f ( - 1 = = r ) t h r o w n e w E r r o r ( " C a n n o t f i n d e x i s t i n g F n " ) ; r + = 1 , t h i s . _ s t a c k . s p l i c e ( r , 0 , t ) } , I . P i p e l i n e . p r o t o t y p e . b e f o r e = f u n c t i o n ( e , t ) { I . P i p e l i n e . w a r n I f F u n c t i o n N o t R e g i s t e r e d ( t ) ; v a r r = t h i s . _ s t a c k . i n d e x O f ( e ) ; i f ( - 1 = = r ) t h r o w n e w E r r o r ( " C a n n o t f i n d e x i s t i n g F n " ) ; t h i s . _ s t a c k . s p l i c e ( r , 0 , t ) } , I . P i p e l i n e . p r o t o t y p e . r e m o v e = f u n c t i o n ( e ) { v a r t = t h i s . _ s t a c k . i n d e x O f ( e ) ; - 1 ! = t & & t h i s . _ s t a c k . s p l i c e ( t , 1 ) } , I . P i p e l i n e . p r o t o t y p e . r u n = f u n c t i o n ( e ) { f o r ( v a r t = t h i s . _ s t a c k . l e n g t h , r = 0 ; r < t ; r + + ) { f o r ( v a r n = t h i s . _ s t a c k [ r ] , i = [ ] , s = 0 ; s < e . l e n g t h ; s + + ) { v a r o = n ( e [ s ] , s , e ) ; i f ( n u l l ! = o & & " " ! = = o ) i f ( A r r a y . i s A r r a y ( o ) ) f o r ( v a r a = 0 ; a < o . l e n g t h ; a + + ) i . p u s h ( o [ a ] ) ; e l s e i . p u s h ( o ) } e = i } r e t u r n e } , I . P i p e l i n e . p r o t o t y p e . r u n S t r i n g = f u n c t i o n ( e , t ) { v a r r = n e w I . T o k e n ( e , t ) ; r e t u r n t h i s . r u n ( [ r ] ) . m a p ( ( f u n c t i o n ( e ) { r e t u r n e . t o S t r i n g ( ) } ) ) } , I . P i p e l i n e . p r o t o t y p e . r e s e t = f u n c t i o n ( ) { t h i s . _ s t a c k = [ ] } , I . P i p e l i n e . p r o t o t y p e . t o J S O N = f u n c t i o n ( ) { r e t u r n t h i s . _ s t a c k . m a p ( ( f u n c t i o n ( e ) { r e t u r n I . P i p e l i n e . w a r n I f F u n c t i o n N o t R e g i s t e r e d ( e ) , e . l a b e l } ) ) }
/ * !
* lunr . Vector
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* / , I . V e c t o r = f u n c t i o n ( e ) { t h i s . _ m a g n i t u d e = 0 , t h i s . e l e m e n t s = e | | [ ] } , I . V e c t o r . p r o t o t y p e . p o s i t i o n F o r I n d e x = f u n c t i o n ( e ) { i f ( 0 = = t h i s . e l e m e n t s . l e n g t h ) r e t u r n 0 ; f o r ( v a r t = 0 , r = t h i s . e l e m e n t s . l e n g t h / 2 , n = r - t , i = M a t h . f l o o r ( n / 2 ) , s = t h i s . e l e m e n t s [ 2 * i ] ; n > 1 & & ( s < e & & ( t = i ) , s > e & & ( r = i ) , s ! = e ) ; ) n = r - t , i = t + M a t h . f l o o r ( n / 2 ) , s = t h i s . e l e m e n t s [ 2 * i ] ; r e t u r n s = = e | | s > e ? 2 * i : s < e ? 2 * ( i + 1 ) : v o i d 0 } , I . V e c t o r . p r o t o t y p e . i n s e r t = f u n c t i o n ( e , t ) { t h i s . u p s e r t ( e , t , ( f u n c t i o n ( ) { t h r o w " d u p l i c a t e i n d e x " } ) ) } , I . V e c t o r . p r o t o t y p e . u p s e r t = f u n c t i o n ( e , t , r ) { t h i s . _ m a g n i t u d e = 0 ; v a r n = t h i s . p o s i t i o n F o r I n d e x ( e ) ; t h i s . e l e m e n t s [ n ] = = e ? t h i s . e l e m e n t s [ n + 1 ] = r ( t h i s . e l e m e n t s [ n + 1 ] , t ) : t h i s . e l e m e n t s . s p l i c e ( n , 0 , e , t ) } , I . V e c t o r . p r o t o t y p e . m a g n i t u d e = f u n c t i o n ( ) { i f ( t h i s . _ m a g n i t u d e ) r e t u r n t h i s . _ m a g n i t u d e ; f o r ( v a r e = 0 , t = t h i s . e l e m e n t s . l e n g t h , r = 1 ; r < t ; r + = 2 ) { v a r n = t h i s . e l e m e n t s [ r ] ; e + = n * n } r e t u r n t h i s . _ m a g n i t u d e = M a t h . s q r t ( e ) } , I . V e c t o r . p r o t o t y p e . d o t = f u n c t i o n ( e ) { f o r ( v a r t = 0 , r = t h i s . e l e m e n t s , n = e . e l e m e n t s , i = r . l e n g t h , s = n . l e n g t h , o = 0 , a = 0 , u = 0 , l = 0 ; u < i & & l < s ; ) ( o = r [ u ] ) < ( a = n [ l ] ) ? u + = 2 : o > a ? l + = 2 : o = = a & & ( t + = r [ u + 1 ] * n [ l + 1 ] , u + = 2 , l + = 2 ) ; r e t u r n t } , I . V e c t o r . p r o t o t y p e . s i m i l a r i t y = f u n c t i o n ( e ) { r e t u r n t h i s . d o t ( e ) / t h i s . m a g n i t u d e ( ) | | 0 } , I . V e c t o r . p r o t o t y p e . t o A r r a y = f u n c t i o n ( ) { f o r ( v a r e = n e w A r r a y ( t h i s . e l e m e n t s . l e n g t h / 2 ) , t = 1 , r = 0 ; t < t h i s . e l e m e n t s . l e n g t h ; t + = 2 , r + + ) e [ r ] = t h i s . e l e m e n t s [ t ] ; r e t u r n e } , I . V e c t o r . p r o t o t y p e . t o J S O N = f u n c t i o n ( ) { r e t u r n t h i s . e l e m e n t s }
/ * !
* lunr . stemmer
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* Includes code from - http : //tartarus.org/~martin/PorterStemmer/js.txt
* /,I.stemmer=(o={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/ ^ ( . + ? ) ( ss | i ) es$ / , y = /^(.+?)([^s])s$/ , m = /^(.+?)eed$/ , g = /^(.+?)(ed|ing)$/ , v = /.$/ , x = /(at|bl|iz)$/ , w = new RegExp ( "([^aeiouylsz])\\1$" ) , Q = new RegExp ( "^" + l + u + "[^aeiouwxy]$" ) , b = /^(.+?[^aeiou])y$/ , S = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/ , E = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/ , k = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/ , L = /^(.+?)(s|t)(ion)$/ , P = /^(.+?)e$/ , T = /ll$/ , O = new RegExp ( "^" + l + u + "[^aeiouwxy]$" ) , R = function ( e ) { var t , r , n , i , s , u , l ; if ( e . length < 3 ) return e ; if ( "y" == ( n = e . substr ( 0 , 1 ) ) && ( e = n . toUpperCase ( ) + e . substr ( 1 ) ) , s = y , ( i = p ) . test ( e ) ? e = e . replace ( i , "$1$2" ) : s . test ( e ) && ( e = e . replace ( s , "$1$2" ) ) , s = g , ( i = m ) . test ( e ) ) { var R = i . exec ( e ) ; ( i = c ) . test ( R [ 1 ] ) && ( i = v , e = e . replace ( i , "" ) ) } else s . test ( e ) && ( t = ( R = s . exec ( e ) ) [ 1 ] , ( s = f ) . test ( t ) && ( u = w , l = Q , ( s = x ) . test ( e = t ) ? e += "e" : u . test ( e ) ? ( i = v , e = e . replace ( i , "" ) ) : l . test ( e ) && ( e += "e" ) ) ) ; return ( i = b ) . test ( e ) && ( e = ( t = ( R = i . exec ( e ) ) [ 1 ] ) + "i" ) , ( i = S ) . test ( e ) && ( t = ( R = i . exec ( e ) ) [ 1 ] , r = R [ 2 ] , ( i = c ) . test ( t ) && ( e = t + o [ r ] ) ) , ( i = E ) . test ( e ) && ( t = ( R = i . exec ( e ) ) [ 1 ] , r = R [ 2 ] , ( i = c ) . test ( t ) && ( e = t + a [ r ] ) ) , s = L , ( i = k ) . test ( e ) ? ( t = ( R = i . exec ( e ) ) [ 1 ] , ( i = h ) . test ( t ) && ( e = t ) ) : s . test ( e ) && ( t = ( R = s . exec ( e ) ) [ 1 ] + R [ 2 ] , ( s = h ) . test ( t ) && ( e = t ) ) , ( i = P ) . test ( e ) && ( t = ( R = i . exec ( e ) ) [ 1 ] , s = d , u = O , ( ( i = h ) . test ( t ) || s . test ( t ) && ! u . test ( t ) ) && ( e = t ) ) , s = h , ( i = T ) . test ( e ) && s . test ( e ) && ( i = v , e = e . replace ( i , "" ) ) , "y" == n && ( e = n . toLowerCase ( ) + e . substr ( 1 ) ) , e } , function ( e ) { return e . update ( R ) } ) , I . Pipeline . registerFunction ( I . stemmer , "stemmer" )
/ * !
* lunr . stopWordFilter
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* / , I . g e n e r a t e S t o p W o r d F i l t e r = f u n c t i o n ( e ) { v a r t = e . r e d u c e ( ( f u n c t i o n ( e , t ) { r e t u r n e [ t ] = t , e } ) , { } ) ; r e t u r n f u n c t i o n ( e ) { i f ( e & & t [ e . t o S t r i n g ( ) ] ! = = e . t o S t r i n g ( ) ) r e t u r n e } } , I . s t o p W o r d F i l t e r = I . g e n e r a t e S t o p W o r d F i l t e r ( [ " a " , " a b l e " , " a b o u t " , " a c r o s s " , " a f t e r " , " a l l " , " a l m o s t " , " a l s o " , " a m " , " a m o n g " , " a n " , " a n d " , " a n y " , " a r e " , " a s " , " a t " , " b e " , " b e c a u s e " , " b e e n " , " b u t " , " b y " , " c a n " , " c a n n o t " , " c o u l d " , " d e a r " , " d i d " , " d o " , " d o e s " , " e i t h e r " , " e l s e " , " e v e r " , " e v e r y " , " f o r " , " f r o m " , " g e t " , " g o t " , " h a d " , " h a s " , " h a v e " , " h e " , " h e r " , " h e r s " , " h i m " , " h i s " , " h o w " , " h o w e v e r " , " i " , " i f " , " i n " , " i n t o " , " i s " , " i t " , " i t s " , " j u s t " , " l e a s t " , " l e t " , " l i k e " , " l i k e l y " , " m a y " , " m e " , " m i g h t " , " m o s t " , " m u s t " , " m y " , " n e i t h e r " , " n o " , " n o r " , " n o t " , " o f " , " o f f " , " o f t e n " , " o n " , " o n l y " , " o r " , " o t h e r " , " o u r " , " o w n " , " r a t h e r " , " s a i d " , " s a y " , " s a y s " , " s h e " , " s h o u l d " , " s i n c e " , " s o " , " s o m e " , " t h a n " , " t h a t " , " t h e " , " t h e i r " , " t h e m " , " t h e n " , " t h e r e " , " t h e s e " , " t h e y " , " t h i s " , " t i s " , " t o " , " t o o " , " t w a s " , " u s " , " w a n t s " , " w a s " , " w e " , " w e r e " , " w h a t " , " w h e n " , " w h e r e " , " w h i c h " , " w h i l e " , " w h o " , " w h o m " , " w h y " , " w i l l " , " w i t h " , " w o u l d " , " y e t " , " y o u " , " y o u r " ] ) , I . P i p e l i n e . r e g i s t e r F u n c t i o n ( I . s t o p W o r d F i l t e r , " s t o p W o r d F i l t e r " )
/ * !
* lunr . trimmer
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* /,I.trimmer=function(e){return e.update((function(e){return e.replace(/ ^ \ W + /,"").replace(/ \ W + $ / , "" ) } ) ) } , I . Pipeline . registerFunction ( I . trimmer , "trimmer" )
/ * !
* lunr . TokenSet
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* / , I . T o k e n S e t = f u n c t i o n ( ) { t h i s . f i n a l = ! 1 , t h i s . e d g e s = { } , t h i s . i d = I . T o k e n S e t . _ n e x t I d , I . T o k e n S e t . _ n e x t I d + = 1 } , I . T o k e n S e t . _ n e x t I d = 1 , I . T o k e n S e t . f r o m A r r a y = f u n c t i o n ( e ) { f o r ( v a r t = n e w I . T o k e n S e t . B u i l d e r , r = 0 , n = e . l e n g t h ; r < n ; r + + ) t . i n s e r t ( e [ r ] ) ; r e t u r n t . f i n i s h ( ) , t . r o o t } , I . T o k e n S e t . f r o m C l a u s e = f u n c t i o n ( e ) { r e t u r n " e d i t D i s t a n c e " i n e ? I . T o k e n S e t . f r o m F u z z y S t r i n g ( e . t e r m , e . e d i t D i s t a n c e ) : I . T o k e n S e t . f r o m S t r i n g ( e . t e r m ) } , I . T o k e n S e t . f r o m F u z z y S t r i n g = f u n c t i o n ( e , t ) { f o r ( v a r r = n e w I . T o k e n S e t , n = [ { n o d e : r , e d i t s R e m a i n i n g : t , s t r : e } ] ; n . l e n g t h ; ) { v a r i = n . p o p ( ) ; i f ( i . s t r . l e n g t h > 0 ) { v a r s , o = i . s t r . c h a r A t ( 0 ) ; o i n i . n o d e . e d g e s ? s = i . n o d e . e d g e s [ o ] : ( s = n e w I . T o k e n S e t , i . n o d e . e d g e s [ o ] = s ) , 1 = = i . s t r . l e n g t h & & ( s . f i n a l = ! 0 ) , n . p u s h ( { n o d e : s , e d i t s R e m a i n i n g : i . e d i t s R e m a i n i n g , s t r : i . s t r . s l i c e ( 1 ) } ) } i f ( 0 ! = i . e d i t s R e m a i n i n g ) { i f ( " * " i n i . n o d e . e d g e s ) v a r a = i . n o d e . e d g e s [ " * " ] ; e l s e { a = n e w I . T o k e n S e t ; i . n o d e . e d g e s [ " * " ] = a } i f ( 0 = = i . s t r . l e n g t h & & ( a . f i n a l = ! 0 ) , n . p u s h ( { n o d e : a , e d i t s R e m a i n i n g : i . e d i t s R e m a i n i n g - 1 , s t r : i . s t r } ) , i . s t r . l e n g t h > 1 & & n . p u s h ( { n o d e : i . n o d e , e d i t s R e m a i n i n g : i . e d i t s R e m a i n i n g - 1 , s t r : i . s t r . s l i c e ( 1 ) } ) , 1 = = i . s t r . l e n g t h & & ( i . n o d e . f i n a l = ! 0 ) , i . s t r . l e n g t h > = 1 ) { i f ( " * " i n i . n o d e . e d g e s ) v a r u = i . n o d e . e d g e s [ " * " ] ; e l s e { u = n e w I . T o k e n S e t ; i . n o d e . e d g e s [ " * " ] = u } 1 = = i . s t r . l e n g t h & & ( u . f i n a l = ! 0 ) , n . p u s h ( { n o d e : u , e d i t s R e m a i n i n g : i . e d i t s R e m a i n i n g - 1 , s t r : i . s t r . s l i c e ( 1 ) } ) } i f ( i . s t r . l e n g t h > 1 ) { v a r l , c = i . s t r . c h a r A t ( 0 ) , h = i . s t r . c h a r A t ( 1 ) ; h i n i . n o d e . e d g e s ? l = i . n o d e . e d g e s [ h ] : ( l = n e w I . T o k e n S e t , i . n o d e . e d g e s [ h ] = l ) , 1 = = i . s t r . l e n g t h & & ( l . f i n a l = ! 0 ) , n . p u s h ( { n o d e : l , e d i t s R e m a i n i n g : i . e d i t s R e m a i n i n g - 1 , s t r : c + i . s t r . s l i c e ( 2 ) } ) } } } r e t u r n r } , I . T o k e n S e t . f r o m S t r i n g = f u n c t i o n ( e ) { f o r ( v a r t = n e w I . T o k e n S e t , r = t , n = 0 , i = e . l e n g t h ; n < i ; n + + ) { v a r s = e [ n ] , o = n = = i - 1 ; i f ( " * " = = s ) t . e d g e s [ s ] = t , t . f i n a l = o ; e l s e { v a r a = n e w I . T o k e n S e t ; a . f i n a l = o , t . e d g e s [ s ] = a , t = a } } r e t u r n r } , I . T o k e n S e t . p r o t o t y p e . t o A r r a y = f u n c t i o n ( ) { f o r ( v a r e = [ ] , t = [ { p r e f i x : " " , n o d e : t h i s } ] ; t . l e n g t h ; ) { v a r r = t . p o p ( ) , n = O b j e c t . k e y s ( r . n o d e . e d g e s ) , i = n . l e n g t h ; r . n o d e . f i n a l & & ( r . p r e f i x . c h a r A t ( 0 ) , e . p u s h ( r . p r e f i x ) ) ; f o r ( v a r s = 0 ; s < i ; s + + ) { v a r o = n [ s ] ; t . p u s h ( { p r e f i x : r . p r e f i x . c o n c a t ( o ) , n o d e : r . n o d e . e d g e s [ o ] } ) } } r e t u r n e } , I . T o k e n S e t . p r o t o t y p e . t o S t r i n g = f u n c t i o n ( ) { i f ( t h i s . _ s t r ) r e t u r n t h i s . _ s t r ; f o r ( v a r e = t h i s . f i n a l ? " 1 " : " 0 " , t = O b j e c t . k e y s ( t h i s . e d g e s ) . s o r t ( ) , r = t . l e n g t h , n = 0 ; n < r ; n + + ) { v a r i = t [ n ] ; e = e + i + t h i s . e d g e s [ i ] . i d } r e t u r n e } , I . T o k e n S e t . p r o t o t y p e . i n t e r s e c t = f u n c t i o n ( e ) { f o r ( v a r t = n e w I . T o k e n S e t , r = v o i d 0 , n = [ { q N o d e : e , o u t p u t : t , n o d e : t h i s } ] ; n . l e n g t h ; ) { r = n . p o p ( ) ; f o r ( v a r i = O b j e c t . k e y s ( r . q N o d e . e d g e s ) , s = i . l e n g t h , o = O b j e c t . k e y s ( r . n o d e . e d g e s ) , a = o . l e n g t h , u = 0 ; u < s ; u + + ) f o r ( v a r l = i [ u ] , c = 0 ; c < a ; c + + ) { v a r h = o [ c ] ; i f ( h = = l | | " * " = = l ) { v a r d = r . n o d e . e d g e s [ h ] , f = r . q N o d e . e d g e s [ l ] , p = d . f i n a l & & f . f i n a l , y = v o i d 0 ; h i n r . o u t p u t . e d g e s ? ( y = r . o u t p u t . e d g e s [ h ] ) . f i n a l = y . f i n a l | | p : ( ( y = n e w I . T o k e n S e t ) . f i n a l = p , r . o u t p u t . e d g e s [ h ] = y ) , n . p u s h ( { q N o d e : f , o u t p u t : y , n o d e : d } ) } } } r e t u r n t } , I . T o k e n S e t . B u i l d e r = f u n c t i o n ( ) { t h i s . p r e v i o u s W o r d = " " , t h i s . r o o t = n e w I . T o k e n S e t , t h i s . u n c h e c k e d N o d e s = [ ] , t h i s . m i n i m i z e d N o d e s = { } } , I . T o k e n S e t . B u i l d e r . p r o t o t y p e . i n s e r t = f u n c t i o n ( e ) { v a r t , r = 0 ; i f ( e < t h i s . p r e v i o u s W o r d ) t h r o w n e w E r r o r ( " O u t o f o r d e r w o r d i n s e r t i o n " ) ; f o r ( v a r n = 0 ; n < e . l e n g t h & & n < t h i s . p r e v i o u s W o r d . l e n g t h & & e [ n ] = = t h i s . p r e v i o u s W o r d [ n ] ; n + + ) r + + ; t h i s . m i n i m i z e ( r ) , t = 0 = = t h i s . u n c h e c k e d N o d e s . l e n g t h ? t h i s . r o o t : t h i s . u n c h e c k e d N o d e s [ t h i s . u n c h e c k e d N o d e s . l e n g t h - 1 ] . c h i l d ; f o r ( n = r ; n < e . l e n g t h ; n + + ) { v a r i = n e w I . T o k e n S e t , s = e [ n ] ; t . e d g e s [ s ] = i , t h i s . u n c h e c k e d N o d e s . p u s h ( { p a r e n t : t , c h a r : s , c h i l d : i } ) , t = i } t . f i n a l = ! 0 , t h i s . p r e v i o u s W o r d = e } , I . T o k e n S e t . B u i l d e r . p r o t o t y p e . f i n i s h = f u n c t i o n ( ) { t h i s . m i n i m i z e ( 0 ) } , I . T o k e n S e t . B u i l d e r . p r o t o t y p e . m i n i m i z e = f u n c t i o n ( e ) { f o r ( v a r t = t h i s . u n c h e c k e d N o d e s . l e n g t h - 1 ; t > = e ; t - - ) { v a r r = t h i s . u n c h e c k e d N o d e s [ t ] , n = r . c h i l d . t o S t r i n g ( ) ; n i n t h i s . m i n i m i z e d N o d e s ? r . p a r e n t . e d g e s [ r . c h a r ] = t h i s . m i n i m i z e d N o d e s [ n ] : ( r . c h i l d . _ s t r = n , t h i s . m i n i m i z e d N o d e s [ n ] = r . c h i l d ) , t h i s . u n c h e c k e d N o d e s . p o p ( ) } }
/ * !
* lunr . Index
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
* /,I.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},I.Index.prototype.search=function(e){return this.query((function(t){new I.QueryParser(e,t).parse()}))},I.Index.prototype.query=function(e){for(var t=new I.Query(this.fields),r=Object.create(null),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)n[this.fields[a]]=new I.Vector;e.call(t,t);for(a=0;a<t.clauses.length;a++){var u=t.clauses[a],l=null,c=I.Set.empty;l=u.usePipeline?this.pipeline.runString(u.term,{fields:u.fields}):[u.term];for(var h=0;h<l.length;h++){var d=l[h];u.term=d;var f=I.TokenSet.fromClause(u),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&u.presence===I.Query.presence.REQUIRED){for(var y=0;y<u.fields.length;y++){s[j=u.fields[y]]=I.Set.empty}break}for(var m=0;m<p.length;m++){var g=p[m],v=this.invertedIndex[g],x=v._index;for(y=0;y<u.fields.length;y++){var w=v[j=u.fields[y]],Q=Object.keys(w),b=g+"/ "+j,S=new I.Set(Q);if(u.presence==I.Query.presence.REQUIRED&&(c=c.union(S),void 0===s[j]&&(s[j]=I.Set.complete)),u.presence!=I.Query.presence.PROHIBITED){if(n[j].upsert(x,u.boost,(function(e,t){return e+t})),!i[b]){for(var E=0;E<Q.length;E++){var k,L=Q[E],P=new I.FieldRef(L,j),T=w[L];void 0===(k=r[P])?r[P]=new I.MatchData(g,j,T):k.add(g,j,T)}i[b]=!0}}else void 0===o[j]&&(o[j]=I.Set.empty),o[j]=o[j].union(S)}}}if(u.presence===I.Query.presence.REQUIRED)for(y=0;y<u.fields.length;y++){s[j=u.fields[y]]=s[j].intersect(c)}}var O=I.Set.complete,R=I.Set.empty;for(a=0;a<this.fields.length;a++){var j;s[j=this.fields[a]]&&(O=O.intersect(s[j])),o[j]&&(R=R.union(o[j]))}var F=Object.keys(r),C=[],_=Object.create(null);if(t.isNegated()){F=Object.keys(this.fieldVectors);for(a=0;a<F.length;a++){P=F[a];var N=I.FieldRef.fromString(P);r[P]=new I.MatchData}}for(a=0;a<F.length;a++){var D=(N=I.FieldRef.fromString(F[a])).docRef;if(O.contains(D)&&!R.contains(D)){var A,B=this.fieldVectors[N],z=n[N.fieldName].similarity(B);if(void 0!==(A=_[D]))A.score+=z,A.matchData.combine(r[N]);else{var V={ref:D,score:z,matchData:r[N]};_[D]=V,C.push(V)}}}return C.sort((function(e,t){return t.score-e.score}))},I.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:I.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},I.Index.load=function(e){var t={},r={},n=e.fieldVectors,i=Object.create(null),s=e.invertedIndex,o=new I.TokenSet.Builder,a=I.Pipeline.load(e.pipeline);e.version!=I.version&&I.utils.warn(" Version mismatch when loading serialised index . Current version of lunr '"+I.version+"' does not match serialized index '"+e.version+"' " ) ; for ( var u = 0 ; u < n . length ; u ++ ) { var l = ( h = n [ u ] ) [ 0 ] , c = h [ 1 ] ; r [ l ] = new I . Vector ( c ) } for ( u = 0 ; u < s . length ; u ++ ) { var h , d = ( h = s [ u ] ) [ 0 ] , f = h [ 1 ] ; o . insert ( d ) , i [ d ] = f } return o . finish ( ) , t . fields = e . fields , t . fieldVectors = r , t . invertedIndex = i , t . tokenSet = o . root , t . pipeline = a , new I . Index ( t ) }
2020-08-11 10:09:55 +03:00
/ * !
* lunr . Builder
2020-09-04 10:17:38 +03:00
* Copyright ( C ) 2020 Oliver Nightingale
2020-08-11 10:09:55 +03:00
* /,I.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=I.tokenizer,this.pipeline=new I.Pipeline,this.searchPipeline=new I.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},I.Builder.prototype.ref=function(e){this._ref=e},I.Builder.prototype.field=function(e,t){if(/ \ //.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},I.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},I.Builder.prototype.k1=function(e){this._k1=e},I.Builder.prototype.add=function(e,t){var r=e[this._ref],n=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var i=0;i<n.length;i++){var s=n[i],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new I.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<n.length;y++)p[n[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],v=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(v)}}}},I.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},n={},i=0;i<t;i++){var s=I.FieldRef.fromString(e[i]),o=s.fieldName;n[o]||(n[o]=0),n[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(i=0;i<a.length;i++){var u=a[i];r[u]=r[u]/n[u]}this.averageFieldLength=r},I.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,n=Object.create(null),i=0;i<r;i++){for(var s=I.FieldRef.fromString(t[i]),o=s.fieldName,a=this.fieldLengths[s],u=new I.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,v=c[p],x=l[v],w=this.invertedIndex[v]._index;void 0===n[v]?(y=I.idf(this.invertedIndex[v],this.documentCount),n[v]=y):y=n[v],m=y*((this._k1+1)*x)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+x),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(w,g)}e[s]=u}this.fieldVectors=e},I.Builder.prototype.createTokenSet=function(){this.tokenSet=I.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},I.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new I.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},I.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},I.MatchData=function(e,t,r){for(var n=Object.create(null),i=Object.keys(r||{}),s=0;s<i.length;s++){var o=i[s];n[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=n)},I.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var n=t[r],i=Object.keys(e.metadata[n]);null==this.metadata[n]&&(this.metadata[n]=Object.create(null));for(var s=0;s<i.length;s++){var o=i[s],a=Object.keys(e.metadata[n][o]);null==this.metadata[n][o]&&(this.metadata[n][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[n][o][l]?this.metadata[n][o][l]=e.metadata[n][o][l]:this.metadata[n][o][l]=this.metadata[n][o][l].concat(e.metadata[n][o][l])}}}},I.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in t
2020-09-04 10:17:38 +03:00
//# sourceMappingURL=search.5eca75d3.min.js.map