sangja
Version:
JavaScript data structures library
1 lines • 75.1 kB
Source Map (JSON)
{"version":3,"sources":["webpack://sangja/webpack/universalModuleDefinition","webpack://sangja/webpack/bootstrap","webpack://sangja/./src/utils.js","webpack://sangja/./src/queue.js","webpack://sangja/./src/linked-list.js","webpack://sangja/./src/index.js","webpack://sangja/./src/optional.js","webpack://sangja/./src/stack.js","webpack://sangja/./src/heap.js","webpack://sangja/./src/binary-search-tree.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;AClFA;AACA;AACA;AACA;AACA,WAAW,EAAE;AACb,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,eAAe;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1DA,cAAc,mBAAO,CAAC,CAAS;AAC/B,mBAAmB,mBAAO,CAAC,CAAe;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;;;;;;AC1KA,cAAc,mBAAO,CAAC,CAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;AACA,2CAA2C,WAAW;AACtD;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,EAAE;AACf,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,SAAS;AACtB,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB,cAAc,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,EAAE;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,EAAE;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB,cAAc,cAAc;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,EAAE;AACf,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,EAAE;AACf,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,EAAE;AACf,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB,cAAc,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc,EAAE;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,EAAE;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,OAAO;AACpB,aAAa,EAAE;AACf,cAAc,WAAW;AACzB,cAAc,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,cAAc,WAAW;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACvrBA,cAAc,mBAAO,CAAC,CAAS;AAC/B,iBAAiB,mBAAO,CAAC,CAAY;AACrC,cAAc,mBAAO,CAAC,CAAS;AAC/B,cAAc,mBAAO,CAAC,CAAS;AAC/B,mBAAmB,mBAAO,CAAC,CAAe;AAC1C,aAAa,mBAAO,CAAC,CAAQ;AAC7B,yBAAyB,mBAAO,CAAC,CAAsB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxKA,cAAc,mBAAO,CAAC,CAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,eAAe;AACf;AACA;AACA;AACA;;AAEA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;;AAEA;;;;;;;AC7KA,cAAc,mBAAO,CAAC,CAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO,MAAM;AAC1B,aAAa,SAAS;AACtB;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E,QAAQ,wBAAwB;AAChC,KAAK;AACL;AACA,8EAA8E;AAC9E,QAAQ,wBAAwB;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,cAAc,KAAK;AACnB;AACA;AACA,8CAA8C,kCAAkC;AAChF;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,eAAe;AACf;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA,OAAO;AACP;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;;AAEA;;;;;;;AClUA,cAAc,mBAAO,CAAC,CAAS;AAC/B,cAAc,mBAAO,CAAC,CAAS;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO,MAAM;AAC1B,aAAa,SAAS;AACtB;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0EAA0E;AAC1E,QAAQ,wBAAwB;AAChC,KAAK;AACL;AACA,8EAA8E;AAC9E,QAAQ,wBAAwB;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,cAAc;AAC7B,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,EAAE;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA,0BAA0B,kCAAkC;AAC5D;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,EAAE;AACf,eAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB;AAChB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA","file":"sangja.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"sangja\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sangja\"] = factory();\n\telse\n\t\troot[\"sangja\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","/**\n * Check if given object is iterable\n * @function\n * @memberof sangja\n * @param {*} obj - An object to check if iterable\n * @return {boolean} True if obj is iterable else false\n */\nfunction isIterable(obj) {\n // checks for null and undefined\n if (obj == null) {\n return false;\n }\n return typeof obj[Symbol.iterator] === 'function';\n}\n\n/**\n * Default key function.<br>\n * Data structures that require compare will use this function as a default key function.<br>\n * Returns the input argument as it is.\n * @function\n * @memberof sangja\n */\nconst defaultKey = x => x;\n\n/**\n * Default compare function.<br>\n * Data structures that require compare will use this function as a default compare function.<br>\n * Compare 2 given operands and return the result. This function can compare number, string.\n * @function\n * @memberof sangja\n */\nconst defaultCompare = (x, y) => {\n if (x < y) {\n return -1;\n }\n if (x > y) {\n return 1;\n }\n return 0;\n};\n\nfunction mergeOptions(given = {}, original = {}) {\n if (!given) {\n return original;\n }\n\n const merged = {};\n Object.keys(original).forEach((key) => {\n merged[key] = given[key] || original[key];\n });\n return merged;\n}\n\nmodule.exports = {\n isIterable,\n defaultKey,\n defaultCompare,\n mergeOptions,\n};\n","const Utils = require('./utils');\nconst LinkedList = require('./linked-list');\n\n/**\n * @class\n * @memberof sangja\n */\nclass Queue {\n /**\n * Creates a new Queue.\n * Iterable parameter is optional.\n * @constructor\n * @param {iterable} [iterable] - Iterator for initialize the queue.\n * @throws {TypeError} When given parameter is not queue.\n */\n constructor(iterable = []) {\n if (!Utils.isIterable(iterable)) {\n throw TypeError();\n }\n this._linkedList = new LinkedList(iterable);\n }\n\n /**\n * Add value at the rear of the queue.\n * @param {*} value - The value to enqueue to the queue.\n */\n enqueue(value) {\n this._linkedList.addLast(value);\n }\n\n /**\n * Add values in the given iterator at the rear of the queue.\n * @param {iterable} iterable - The iterable values to enqueue\n */\n enqueueAll(iterable) {\n [...iterable].forEach(v => this._linkedList.addLast(v));\n }\n\n /**\n * Removes the front of the queue and returns the value at the front of the queue.\n * @returns {*} The value at the front of the queue. If empty, return undefined.\n */\n dequeue() {\n if (this._linkedList.size() === 0) {\n return undefined;\n }\n\n return this._linkedList.popFirst();\n }\n\n /**\n * Returns the value at the front of the queue without changing the state of the queue.\n * @returns {*} The value at the front of the queue. If empty, return undefined.\n */\n peek() {\n if (this._linkedList.size() === 0) {\n return undefined;\n }\n\n return this._linkedList.getFirst();\n }\n\n /**\n * Returns the number of elements in the queue.\n * @returns {number} The number of elements in the queue.\n */\n size() {\n return this._linkedList.size();\n }\n\n /**\n * Returns whether the queue is empty.\n * @returns {boolean} True if the queue is empty.\n */\n isEmpty() {\n return this._linkedList.isEmpty();\n }\n\n /**\n * Removes all values in the queue.\n */\n clear() {\n this._linkedList = new LinkedList();\n }\n\n /**\n * For each values in the queue, execute the given procedure f.\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n this._linkedList.forEach(f);\n }\n\n /**\n * Returns a new Queue whose values are mapped with given function f.\n * @param {function} f - Function to map values\n * @return {Stack} Queue([mapped values])\n */\n map(f) {\n const queue = new Queue();\n queue._linkedList = this._linkedList.map(f);\n return queue;\n }\n\n /**\n * Returns a new Queue whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @return {Stack} Queue([mapped and flattened values])\n */\n flatMap(f) {\n const queue = new Queue();\n queue._linkedList = this._linkedList.flatMap(f);\n return queue;\n }\n\n /**\n * Returns a new Queue whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @return {Stack} Queue([filtered values])\n */\n filter(f) {\n const queue = new Queue();\n queue._linkedList = this._linkedList.filter(f);\n return queue;\n }\n\n /**\n * Returns a new Queue whose values are reversed in order.\n * @return {Stack} Queue([reversed values])\n */\n reversed() {\n const queue = new Queue();\n queue._linkedList = this._linkedList.reversed();\n return queue;\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n return this._linkedList.some(f);\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n return this._linkedList.every(f);\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n return this._linkedList.includes(v);\n }\n\n * [Symbol.iterator]() {\n yield* this._linkedList;\n }\n}\n\nmodule.exports = Queue;\n","const Utils = require('./utils');\n\n/**\n * @class\n * @memberof sangja\n */\nclass LinkedList {\n /**\n * Creates a new LinkedList.\n * Iterable parameter is optional.\n * @constructor\n * @param {iterable} [iterable] - Iterator for initialize the list.\n * @throws {TypeError} When given parameter is not iterable.\n */\n constructor(iterable = []) {\n this._linkedList = {\n size: 0,\n front: null,\n end: null,\n };\n if (!Utils.isIterable(iterable)) {\n throw TypeError();\n }\n [...iterable].forEach(v => this.addLast(v));\n }\n\n /**\n * Return the node at the given index of the linked list.\n * @param {number} index - The index to get node.\n * @private\n * @return {node} The node at the given index.\n * When the given index < 0 or index >= size of the linked list, return undefined.\n */\n _getNode(index) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n if (index < this._linkedList.size / 2) {\n let now = this._linkedList.front;\n for (let i = 0; i < index; i += 1) {\n now = now.next;\n }\n return now;\n }\n let now = this._linkedList.end;\n for (let i = this._linkedList.size - 1; i > index; i -= 1) {\n now = now.prev;\n }\n return now;\n }\n\n /**\n * Add value at the given index of the linked list.\n * @param {number} [index] - The index to add the value.\n * @param {*} value - The value to add.\n * @throws {RangeError} When the given index < 0 or index > size of the linked list.\n */\n add(index, value) {\n // Index not given. index is the value to add.\n if (value === undefined) {\n this.addLast(index);\n return;\n }\n if (typeof index !== 'number' || index < 0 || index > this._linkedList.size) {\n throw RangeError();\n }\n\n if (index === 0) {\n const item = {\n prev: null,\n next: this._linkedList.front,\n value,\n };\n if (this._linkedList.front) {\n this._linkedList.front.prev = item;\n } else {\n // No elements until now.\n this._linkedList.end = item;\n }\n this._linkedList.front = item;\n } else if (index === this._linkedList.size) {\n const item = {\n prev: this._linkedList.end,\n next: null,\n value,\n };\n if (this._linkedList.end) {\n this._linkedList.end.next = item;\n }\n this._linkedList.end = item;\n } else {\n const original = this._getNode(index);\n\n const item = {\n prev: original.prev,\n next: original,\n value,\n };\n item.prev.next = item;\n item.next.prev = item;\n }\n this._linkedList.size += 1;\n }\n\n /**\n * Add values in given iterator at the given index of the linked list.\n * @param {number} [index] - The index to add the value.\n * @param {iterable} iterable - The iterable object that contain values to add.\n * @throws {RangeError} When the given index < 0 or index > size of the linked list.\n */\n addAll(index, iterable) {\n // Index not given. index is iterable object.\n if (iterable === undefined) {\n this.addAllLast(index);\n return;\n }\n const values = [...iterable];\n for (let i = values.length - 1; i >= 0; i -= 1) {\n this.add(index, values[i]);\n }\n }\n\n /**\n * Add value at the front of the linked list.\n * @param {*} value - The value to add.\n */\n addFirst(value) {\n this.add(0, value);\n }\n\n /**\n * Add values in given iterator at the front of the linked list.\n * @param {iterable} iterable - The iterable object that contain values to add.\n */\n addAllFirst(iterable) {\n const values = [...iterable];\n for (let i = values.length - 1; i >= 0; i -= 1) {\n this.add(0, values[i]);\n }\n }\n\n /**\n * Add value at the end of the linked list.\n * @param {*} value - The value to add.\n */\n addLast(value) {\n this.add(this.size(), value);\n }\n\n /**\n * Add values in given iterator at the end of the linked list.\n * @param {iterable} iterable - The iterable object that contain values to add.\n */\n addAllLast(iterable) {\n const values = [...iterable];\n for (let i = 0; i < values.length; i += 1) {\n this.addLast(values[i]);\n }\n }\n\n /**\n * Removes the given index of the linked list and\n * returns the value at the given index of the linked list.\n * @param {number} [index] - The index to remove the value.\n * @return {*} The value at the given index of the linked list. If not found, return undefined.\n */\n pop(index) {\n if (index === undefined) {\n return this.popLast();\n }\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n const now = this._getNode(index);\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return now.value;\n }\n\n /**\n * Removes the first of the linked list and\n * returns the value at the first of the linked list.\n * @return {*} The value at the front of the linked list. If empty, return undefined.\n */\n popFirst() {\n return this.pop(0);\n }\n\n /**\n * Removes the end of the linked list and\n * returns the value at the end of the linked list.\n * @return {*} The value at the end of the linked list. If empty, return undefined.\n */\n popLast() {\n return this.pop(this.size() - 1);\n }\n\n /**\n * Same with pop(i) except that index is required.\n * @param {number} index - The index to remove the value.\n * @return {(*|undefined)} The value at the given index of the linked list.\n * If not found, return undefined.\n */\n removeAt(index) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n return this.pop(index);\n }\n\n /**\n * Removes the first occurance of the given value in the linked list and\n * returns true if the given value is in the linked list.\n * @param {*} value - The value to remove\n * @return {boolean} True if the given value is in the linked list else false.\n */\n remove(value) {\n let now = this._linkedList.front;\n while (now) {\n if (now.value === value) {\n break;\n }\n now = now.next;\n }\n\n if (!now) {\n return false;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return true;\n }\n\n /**\n * Removes the every occurance of the given value in the linked list and\n * returns the number of removed values.\n * @param {*} value - The value to remove\n * @return {number} The number of removed values.\n */\n removeAll(value) {\n let now = this._linkedList.front;\n let result = 0;\n while (now) {\n if (now.value === value) {\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n result += 1;\n }\n now = now.next;\n }\n\n return result;\n }\n\n /**\n * Same with remove(value) if value is given.\n * If value is not given, same with popFirst().\n * @param {*} [value] - The value to remove\n * @return {(*|undefined|boolean)} If remove success, return true.\n * If value not given, return popFirst().\n */\n removeFirst(value) {\n if (value === undefined) {\n return this.popFirst();\n }\n return this.remove(value);\n }\n\n /**\n * Same with remove(value) but find from start searching from last.\n * @param {*} [value] - The value to remove\n * @return {(*|undefined|boolean)} If remove success, return true.\n * If value not given, return popLast().\n */\n removeLast(value) {\n let now = this._linkedList.end;\n while (now) {\n if (now.value === value) {\n break;\n }\n now = now.prev;\n }\n\n if (!now) {\n return false;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return true;\n }\n\n /**\n * Removes the first value that matches given predicate f and\n * returns value in the linked list.\n * @param {Function} f - Predicate\n * @return {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatch(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n let now = this._linkedList.front;\n while (now) {\n if (f(now.value)) {\n break;\n }\n now = now.next;\n }\n\n if (!now) {\n return undefined;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return now.value;\n }\n\n /**\n * Removes all values that matches given predicate f and\n * returns the removed values.\n * @param {Function} f - Predicate\n * @return {any[]} Removed values.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatchAll(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n let now = this._linkedList.front;\n const result = [];\n while (now) {\n if (f(now.value)) {\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n result.push(now.value);\n }\n now = now.next;\n }\n\n return result;\n }\n\n /**\n * Same with removeMatch(f)\n * @param {Function} f - Predicate\n * @return {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatchFirst(f) {\n return this.removeMatch(f);\n }\n\n /**\n * Same with removeMatch(f) but find from start searching from last.\n * @param {Function} f - Predicate\n * @return {(*|undefined)} Found value. If not found, return undefined.\n * @throws {TypeError} When the given predicate is not a function.\n */\n removeMatchLast(f) {\n if (typeof f !== 'function') {\n throw TypeError();\n }\n\n let now = this._linkedList.end;\n while (now) {\n if (f(now.value)) {\n break;\n }\n now = now.prev;\n }\n\n if (!now) {\n return undefined;\n }\n\n if (now.prev) {\n now.prev.next = now.next;\n } else {\n // now is front\n this._linkedList.front = now.next;\n }\n\n if (now.next) {\n now.next.prev = now.prev;\n } else {\n // now is end\n this._linkedList.end = now.prev;\n }\n\n this._linkedList.size -= 1;\n return now.value;\n }\n\n /**\n * Removes all values in the linked list.\n */\n clear() {\n this._linkedList = {\n size: 0,\n front: null,\n end: null,\n };\n }\n\n /**\n * Returns the value at the given index of the linked list.\n * @param {number} index - The index to get the value.\n * @return {*} The value at the given index of the linked list.\n * When the given index < 0 or index >= size of the linked list, return undefined.\n */\n get(index) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n return undefined;\n }\n const now = this._getNode(index);\n\n return now.value;\n }\n\n /**\n * Returns the value at the first of the linked list.\n * @return {*} The value at the front of the linked list. If empty, return undefined.\n */\n getFirst() {\n return this.get(0);\n }\n\n /**\n * Returns the value at the end of the linked list.\n * @return {*} The value at the end of the linked list. If empty, return undefined.\n */\n getLast() {\n return this.get(this.size() - 1);\n }\n\n /**\n * Updates the value at the given index of the linked list and\n * returns the value at the given index of the linked list.\n * @param {number} index - The index to update the value.\n * @param {*} value - The value to update.\n * @throws {RangeError} When the given index < 0 or index >= size of the linked list.\n * @return {*} The value at the given index of the linked list.\n */\n set(index, value) {\n if (typeof index !== 'number' || index < 0 || index >= this._linkedList.size) {\n throw RangeError();\n }\n const now = this._getNode(index);\n\n const ret = now.value;\n now.value = value;\n\n return ret;\n }\n\n /**\n * Returns the value of the first element in the linked list\n * that satisfies the provided testing function.\n * @param {function} f - Testing function.\n * @return {*} The the first value in the linked list\n * that satisfies the provided testing function.\n * When no element in the linked list satisfies the provided testing function, return undefined.\n */\n find(f) {\n let now = this._linkedList.front;\n while (now && !f(now.value)) {\n now = now.next;\n }\n if (now) {\n return now.value;\n }\n return undefined;\n }\n\n /**\n * Returns the number of elements in the linked list.\n * @return {number} The number of elements in the linked list.\n */\n size() {\n return this._linkedList.size;\n }\n\n /**\n * Returns whether the linked list is empty.\n * @return {boolean} True if the linked list is empty.\n */\n isEmpty() {\n return this._linkedList.size === 0;\n }\n\n /**\n * For each values in the list, execute the given procedure f.\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n let now = this._linkedList.front;\n while (now) {\n f(now.value);\n now = now.next;\n }\n }\n\n /**\n * Returns a new LinkedList whose values are mapped with given function f.\n * @param {function} f - Function to map values\n * @return {LinkedList} LinkedList([mapped values])\n */\n map(f) {\n const list = new LinkedList();\n this.forEach(v => list.addLast(f(v)));\n return list;\n }\n\n /**\n * Returns a new LinkedList whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @return {LinkedList} LinkedList([mapped and flattened values])\n */\n flatMap(f) {\n const list = new LinkedList();\n this.forEach(v => list.addAllLast([...f(v)]));\n return list;\n }\n\n /**\n * Returns a new LinkedList whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @return {LinkedList} LinkedList([filtered values])\n */\n filter(f) {\n const list = new LinkedList();\n this.forEach((v) => {\n if (f(v)) {\n list.addLast(v);\n }\n });\n return list;\n }\n\n /**\n * Returns a new LinkedList whose values are reversed in order.\n * @return {LinkedList} LinkedList([reversed values])\n */\n reversed() {\n const list = new LinkedList();\n this.forEach(v => list.addFirst(v));\n return list;\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @return {boolean}\n */\n some(f) {\n if (this.size() === 0) {\n return false;\n }\n\n let now = this._linkedList.front;\n while (now) {\n if (f(now.value)) {\n return true;\n }\n now = now.next;\n }\n return false;\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @return {boolean}\n */\n every(f) {\n let now = this._linkedList.front;\n while (now) {\n if (!f(now.value)) {\n return false;\n }\n now = now.next;\n }\n return true;\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @return {boolean}\n */\n includes(v) {\n let now = this._linkedList.front;\n while (now) {\n if (now.value === v) {\n return true;\n }\n now = now.next;\n }\n return false;\n }\n\n * [Symbol.iterator]() {\n let now = this._linkedList.front;\n while (now) {\n yield now.value;\n now = now.next;\n }\n }\n}\n\nmodule.exports = LinkedList;\n","const Utils = require('./utils');\nconst Optional = require('./optional');\nconst Stack = require('./stack');\nconst Queue = require('./queue');\nconst LinkedList = require('./linked-list');\nconst Heap = require('./heap');\nconst BinarySearchTree = require('./binary-search-tree');\n\n/**\n * @namespace sangja\n */\nmodule.exports = {\n Optional,\n Stack,\n Queue,\n LinkedList,\n Heap,\n BinarySearchTree,\n isIterable: Utils.isIterable,\n defaultKey: Utils.defaultKey,\n defaultCompare: Utils.defaultCompare,\n};\n","/**\n * @class\n * @memberof sangja\n */\nclass Optional {\n /**\n * Creates a new Optional.\n * Value parameter is optional. Undefeined for value is not allowed.(Not work well)\n * @constructor\n * @param {*} [value=undefined] - Value to contain\n */\n constructor(value = undefined) {\n this.value = value;\n }\n\n /**\n * Returns the containing value.\n * @returns {*|undefined} The containing value. If it does not contain a value, return undefined\n */\n get() {\n return this.value;\n }\n\n /**\n * Returns the containing value.\n * @returns {*} The containing value. If it does not contain a value, return undefined\n */\n getOrElse(value) {\n if (this.value === undefined) {\n return value;\n }\n return this.value;\n }\n\n /**\n * If the optional contains a value, returns 1 else 0.\n * @returns {number} The number of elements in the optional(0 or 1)\n */\n size() {\n if (this.value === undefined) {\n return 0;\n }\n return 1;\n }\n\n /**\n * If the optional is empty, returns true else returns false.\n * @returns {boolean} True if the optional is empty else false\n */\n isEmpty() {\n if (this.value === undefined) {\n return true;\n }\n return false;\n }\n\n /**\n * If the optional contains a value, execute the given function f.\n * @param {function} f - Function to execute\n */\n forEach(f) {\n if (this.value === undefined) {\n return;\n }\n f(this.value);\n }\n\n /**\n * If the optional contains a value, execute the given function f\n * and returns the new optional containing f(this.value).<br>\n * If the optional is empty or catch error while executing f, returns empty optional.\n * @param {function} f - Function to execute with this.value\n * @return {Optional} Optional(f(this.value)) or Optional()\n */\n map(f) {\n if (this.value === undefined) {\n return new Optional();\n }\n\n try {\n return new Optional(f(this.value));\n } catch (err) {\n return new Optional();\n }\n }\n\n /**\n * If the optional contains a value, execute the given function f\n * and flatten the result.<br>\n * Returns the new optional containing flatten result of f(this.value)<br>\n * If the optional is empty or catch error while executing f, returns empty optional.\n * @param {function} f - (this.value) => Optional\n * @return {Optional} Optional(...f(this.value)) or Optional()\n */\n flatMap(f) {\n if (this.value === undefined) {\n return new Optional();\n }\n\n try {\n return new Optional(...f(this.value));\n } catch (err) {\n return new Optional();\n }\n }\n\n /**\n * If the contained value satisfies the predicate, return this.\n * If the optional is empty or given predicate returns false, returns empty optional.\n * @param {function} f - Predicate\n * @return {Optional} Optional(this.value) or Optional()\n */\n filter(f) {\n if (this.value === undefined) {\n return new Optional();\n }\n\n if (f(this.value)) {\n return this;\n }\n return new Optional();\n }\n\n /**\n * If containing value satisfies given f, return true.\n * If not satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n if (this.value === undefined) {\n return false;\n }\n return Boolean(f(this.value));\n }\n\n /**\n * If not contain any value or containing value satisfies given f, return true.\n * If not satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n if (this.value === undefined) {\n return true;\n }\n return Boolean(f(this.value));\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n if (this.value !== undefined && this.value === v) {\n return true;\n }\n return false;\n }\n\n * [Symbol.iterator]() {\n if (this.value !== undefined) {\n yield this.value;\n }\n }\n}\n\nmodule.exports = Optional;\n","const Utils = require('./utils');\n\n/**\n * @class\n * @memberof sangja\n */\nclass Stack {\n /**\n * Creates a new Stack.\n * Iterable parameter is optional.\n * @constructor\n * @param {iterable} [iterable] - Iterator for initialize the stack.\n * @throws {TypeError} When given parameter is not stack.\n */\n constructor(iterable = []) {\n if (!Utils.isIterable(iterable)) {\n throw TypeError();\n }\n this._stack = [...iterable];\n }\n\n /**\n * Add value at the top of the stack.\n * @param {*} value - The value to push to the stack.\n */\n push(value) {\n this._stack.push(value);\n }\n\n /**\n * Add values in the given iterator at the top of the stack.\n * @param {iterable} iterable - The iterable values to push to the stack.\n */\n pushAll(iterable) {\n [...iterable].forEach(v => this._stack.push(v));\n }\n\n /**\n * Removes the top of the stack and returns the value at the top of the stack.\n * @returns {*} The value at the top of the stack. If empty, return undefined.\n */\n pop() {\n if (this._stack.length === 0) {\n return undefined;\n }\n\n return this._stack.pop();\n }\n\n /**\n * Returns the value at the top of the stack without changing the state of the stack.\n * @returns {*} The value at the top of the stack. If empty, return undefined.\n */\n top() {\n if (this._stack.length === 0) {\n return undefined;\n }\n\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * Removes all values in the stack.\n */\n clear() {\n this._stack = [];\n }\n\n /**\n * Returns the number of elements in the stack.\n * @returns {number} The number of elements in the stack.\n */\n size() {\n return this._stack.length;\n }\n\n /**\n * Returns whether the stack is empty.\n * @returns {boolean} True if the stack is empty.\n */\n isEmpty() {\n return this._stack.length === 0;\n }\n\n /**\n * For each values in the stack, execute the given procedure f.<br>\n * *Executing order is top to bottom*\n * @param {function} f - Procedure to execute\n */\n forEach(f) {\n for (let i = this._stack.length - 1; i >= 0; i -= 1) {\n f(this._stack[i]);\n }\n }\n\n /**\n * Returns a stack whose values are mapped with given function f.\n * @param {function} f - Function to map values\n * @return {Stack} Stack([mapped values])\n */\n map(f) {\n const stack = new Stack();\n stack._stack = this._stack.map(f);\n return stack;\n }\n\n /**\n * Returns a stack whose values are mapped with given function f and flattened.\n * @param {function} f - Function (this.value) => iterable\n * @return {Stack} Stack([mapped and flattened values])\n */\n flatMap(f) {\n const stack = new Stack();\n // [...this._stack.map(f)].forEach(arr => arr.forEach(v => stack.push(v)));\n this._stack.map(f).forEach(arr => stack.pushAll(arr));\n return stack;\n }\n\n /**\n * Returns a stack whose values are filtered with given predicate f.\n * @param {function} f - Predicate (this.value) => boolean\n * @return {Stack} Stack([filtered values])\n */\n filter(f) {\n const stack = new Stack();\n stack._stack = this._stack.filter(f);\n return stack;\n }\n\n /**\n * Returns a stack whose values are reversed in order.\n * @return {Stack} Stack([reversed values])\n */\n reversed() {\n return new Stack(this);\n }\n\n /**\n * If any of containing values satisfies given f, return true.\n * If none of values satisfy f or not contain any value, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n some(f) {\n return this._stack.some(f);\n }\n\n /**\n * If all of containing values satisfies given f or not contain any value, return true.\n * If any of value doesn't satisfy f, return false.\n * @param {function} f - Predicate\n * @returns {boolean}\n */\n every(f) {\n return this._stack.every(f);\n }\n\n /**\n * If contains given value v, return true.\n * @param {*} v\n * @returns {boolean}\n */\n includes(v) {\n return this._stack.includes(v);\n }\n\n * [Symbol.iterator]() {\n for (let i = this._stack.length - 1; i >= 0; i -= 1) {\n yield this._stack[i];\n }\n }\n}\n\nmodule.exports = Stack;\n","const Utils = require('./utils');\n\n/**\n * @class\n * @membe