vendor.js 936 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!************************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  6. \************************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  11. var _toString = Object.prototype.toString;
  12. var hasOwnProperty = Object.prototype.hasOwnProperty;
  13. function isFn(fn) {
  14. return typeof fn === 'function';
  15. }
  16. function isStr(str) {
  17. return typeof str === 'string';
  18. }
  19. function isPlainObject(obj) {
  20. return _toString.call(obj) === '[object Object]';
  21. }
  22. function hasOwn(obj, key) {
  23. return hasOwnProperty.call(obj, key);
  24. }
  25. function noop() {}
  26. /**
  27. * Create a cached version of a pure function.
  28. */
  29. function cached(fn) {
  30. var cache = Object.create(null);
  31. return function cachedFn(str) {
  32. var hit = cache[str];
  33. return hit || (cache[str] = fn(str));
  34. };
  35. }
  36. /**
  37. * Camelize a hyphen-delimited string.
  38. */
  39. var camelizeRE = /-(\w)/g;
  40. var camelize = cached(function (str) {
  41. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  42. });
  43. var HOOKS = [
  44. 'invoke',
  45. 'success',
  46. 'fail',
  47. 'complete',
  48. 'returnValue'];
  49. var globalInterceptors = {};
  50. var scopedInterceptors = {};
  51. function mergeHook(parentVal, childVal) {
  52. var res = childVal ?
  53. parentVal ?
  54. parentVal.concat(childVal) :
  55. Array.isArray(childVal) ?
  56. childVal : [childVal] :
  57. parentVal;
  58. return res ?
  59. dedupeHooks(res) :
  60. res;
  61. }
  62. function dedupeHooks(hooks) {
  63. var res = [];
  64. for (var i = 0; i < hooks.length; i++) {
  65. if (res.indexOf(hooks[i]) === -1) {
  66. res.push(hooks[i]);
  67. }
  68. }
  69. return res;
  70. }
  71. function removeHook(hooks, hook) {
  72. var index = hooks.indexOf(hook);
  73. if (index !== -1) {
  74. hooks.splice(index, 1);
  75. }
  76. }
  77. function mergeInterceptorHook(interceptor, option) {
  78. Object.keys(option).forEach(function (hook) {
  79. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  80. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  81. }
  82. });
  83. }
  84. function removeInterceptorHook(interceptor, option) {
  85. if (!interceptor || !option) {
  86. return;
  87. }
  88. Object.keys(option).forEach(function (hook) {
  89. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  90. removeHook(interceptor[hook], option[hook]);
  91. }
  92. });
  93. }
  94. function addInterceptor(method, option) {
  95. if (typeof method === 'string' && isPlainObject(option)) {
  96. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  97. } else if (isPlainObject(method)) {
  98. mergeInterceptorHook(globalInterceptors, method);
  99. }
  100. }
  101. function removeInterceptor(method, option) {
  102. if (typeof method === 'string') {
  103. if (isPlainObject(option)) {
  104. removeInterceptorHook(scopedInterceptors[method], option);
  105. } else {
  106. delete scopedInterceptors[method];
  107. }
  108. } else if (isPlainObject(method)) {
  109. removeInterceptorHook(globalInterceptors, method);
  110. }
  111. }
  112. function wrapperHook(hook) {
  113. return function (data) {
  114. return hook(data) || data;
  115. };
  116. }
  117. function isPromise(obj) {
  118. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  119. }
  120. function queue(hooks, data) {
  121. var promise = false;
  122. for (var i = 0; i < hooks.length; i++) {
  123. var hook = hooks[i];
  124. if (promise) {
  125. promise = Promise.resolve(wrapperHook(hook));
  126. } else {
  127. var res = hook(data);
  128. if (isPromise(res)) {
  129. promise = Promise.resolve(res);
  130. }
  131. if (res === false) {
  132. return {
  133. then: function then() {} };
  134. }
  135. }
  136. }
  137. return promise || {
  138. then: function then(callback) {
  139. return callback(data);
  140. } };
  141. }
  142. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  143. ['success', 'fail', 'complete'].forEach(function (name) {
  144. if (Array.isArray(interceptor[name])) {
  145. var oldCallback = options[name];
  146. options[name] = function callbackInterceptor(res) {
  147. queue(interceptor[name], res).then(function (res) {
  148. /* eslint-disable no-mixed-operators */
  149. return isFn(oldCallback) && oldCallback(res) || res;
  150. });
  151. };
  152. }
  153. });
  154. return options;
  155. }
  156. function wrapperReturnValue(method, returnValue) {
  157. var returnValueHooks = [];
  158. if (Array.isArray(globalInterceptors.returnValue)) {
  159. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  160. }
  161. var interceptor = scopedInterceptors[method];
  162. if (interceptor && Array.isArray(interceptor.returnValue)) {
  163. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  164. }
  165. returnValueHooks.forEach(function (hook) {
  166. returnValue = hook(returnValue) || returnValue;
  167. });
  168. return returnValue;
  169. }
  170. function getApiInterceptorHooks(method) {
  171. var interceptor = Object.create(null);
  172. Object.keys(globalInterceptors).forEach(function (hook) {
  173. if (hook !== 'returnValue') {
  174. interceptor[hook] = globalInterceptors[hook].slice();
  175. }
  176. });
  177. var scopedInterceptor = scopedInterceptors[method];
  178. if (scopedInterceptor) {
  179. Object.keys(scopedInterceptor).forEach(function (hook) {
  180. if (hook !== 'returnValue') {
  181. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  182. }
  183. });
  184. }
  185. return interceptor;
  186. }
  187. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  188. var interceptor = getApiInterceptorHooks(method);
  189. if (interceptor && Object.keys(interceptor).length) {
  190. if (Array.isArray(interceptor.invoke)) {
  191. var res = queue(interceptor.invoke, options);
  192. return res.then(function (options) {
  193. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  194. });
  195. } else {
  196. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  197. }
  198. }
  199. return api.apply(void 0, [options].concat(params));
  200. }
  201. var promiseInterceptor = {
  202. returnValue: function returnValue(res) {
  203. if (!isPromise(res)) {
  204. return res;
  205. }
  206. return res.then(function (res) {
  207. return res[1];
  208. }).catch(function (res) {
  209. return res[0];
  210. });
  211. } };
  212. var SYNC_API_RE =
  213. /^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
  214. var CONTEXT_API_RE = /^create|Manager$/;
  215. // Context例外情况
  216. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  217. // 同步例外情况
  218. var ASYNC_API = ['createBLEConnection'];
  219. var CALLBACK_API_RE = /^on|^off/;
  220. function isContextApi(name) {
  221. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  222. }
  223. function isSyncApi(name) {
  224. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  225. }
  226. function isCallbackApi(name) {
  227. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  228. }
  229. function handlePromise(promise) {
  230. return promise.then(function (data) {
  231. return [null, data];
  232. }).
  233. catch(function (err) {return [err];});
  234. }
  235. function shouldPromise(name) {
  236. if (
  237. isContextApi(name) ||
  238. isSyncApi(name) ||
  239. isCallbackApi(name))
  240. {
  241. return false;
  242. }
  243. return true;
  244. }
  245. /* eslint-disable no-extend-native */
  246. if (!Promise.prototype.finally) {
  247. Promise.prototype.finally = function (callback) {
  248. var promise = this.constructor;
  249. return this.then(
  250. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  251. function (reason) {return promise.resolve(callback()).then(function () {
  252. throw reason;
  253. });});
  254. };
  255. }
  256. function promisify(name, api) {
  257. if (!shouldPromise(name)) {
  258. return api;
  259. }
  260. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  261. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  262. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  263. }
  264. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  265. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  266. success: resolve,
  267. fail: reject })].concat(
  268. params));
  269. })));
  270. };
  271. }
  272. var EPS = 1e-4;
  273. var BASE_DEVICE_WIDTH = 750;
  274. var isIOS = false;
  275. var deviceWidth = 0;
  276. var deviceDPR = 0;
  277. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  278. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  279. deviceWidth = windowWidth;
  280. deviceDPR = pixelRatio;
  281. isIOS = platform === 'ios';
  282. }
  283. function upx2px(number, newDeviceWidth) {
  284. if (deviceWidth === 0) {
  285. checkDeviceWidth();
  286. }
  287. number = Number(number);
  288. if (number === 0) {
  289. return 0;
  290. }
  291. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  292. if (result < 0) {
  293. result = -result;
  294. }
  295. result = Math.floor(result + EPS);
  296. if (result === 0) {
  297. if (deviceDPR === 1 || !isIOS) {
  298. result = 1;
  299. } else {
  300. result = 0.5;
  301. }
  302. }
  303. return number < 0 ? -result : result;
  304. }
  305. var interceptors = {
  306. promiseInterceptor: promiseInterceptor };
  307. var baseApi = /*#__PURE__*/Object.freeze({
  308. __proto__: null,
  309. upx2px: upx2px,
  310. addInterceptor: addInterceptor,
  311. removeInterceptor: removeInterceptor,
  312. interceptors: interceptors });
  313. function findExistsPageIndex(url) {
  314. var pages = getCurrentPages();
  315. var len = pages.length;
  316. while (len--) {
  317. var page = pages[len];
  318. if (page.$page && page.$page.fullPath === url) {
  319. return len;
  320. }
  321. }
  322. return -1;
  323. }
  324. var redirectTo = {
  325. name: function name(fromArgs) {
  326. if (fromArgs.exists === 'back' && fromArgs.delta) {
  327. return 'navigateBack';
  328. }
  329. return 'redirectTo';
  330. },
  331. args: function args(fromArgs) {
  332. if (fromArgs.exists === 'back' && fromArgs.url) {
  333. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  334. if (existsPageIndex !== -1) {
  335. var delta = getCurrentPages().length - 1 - existsPageIndex;
  336. if (delta > 0) {
  337. fromArgs.delta = delta;
  338. }
  339. }
  340. }
  341. } };
  342. var previewImage = {
  343. args: function args(fromArgs) {
  344. var currentIndex = parseInt(fromArgs.current);
  345. if (isNaN(currentIndex)) {
  346. return;
  347. }
  348. var urls = fromArgs.urls;
  349. if (!Array.isArray(urls)) {
  350. return;
  351. }
  352. var len = urls.length;
  353. if (!len) {
  354. return;
  355. }
  356. if (currentIndex < 0) {
  357. currentIndex = 0;
  358. } else if (currentIndex >= len) {
  359. currentIndex = len - 1;
  360. }
  361. if (currentIndex > 0) {
  362. fromArgs.current = urls[currentIndex];
  363. fromArgs.urls = urls.filter(
  364. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  365. } else {
  366. fromArgs.current = urls[0];
  367. }
  368. return {
  369. indicator: false,
  370. loop: false };
  371. } };
  372. var UUID_KEY = '__DC_STAT_UUID';
  373. var deviceId;
  374. function addUuid(result) {
  375. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  376. if (!deviceId) {
  377. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  378. wx.setStorage({
  379. key: UUID_KEY,
  380. data: deviceId });
  381. }
  382. result.deviceId = deviceId;
  383. }
  384. function addSafeAreaInsets(result) {
  385. if (result.safeArea) {
  386. var safeArea = result.safeArea;
  387. result.safeAreaInsets = {
  388. top: safeArea.top,
  389. left: safeArea.left,
  390. right: result.windowWidth - safeArea.right,
  391. bottom: result.windowHeight - safeArea.bottom };
  392. }
  393. }
  394. var getSystemInfo = {
  395. returnValue: function returnValue(result) {
  396. addUuid(result);
  397. addSafeAreaInsets(result);
  398. } };
  399. // import navigateTo from 'uni-helpers/navigate-to'
  400. var protocols = {
  401. redirectTo: redirectTo,
  402. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  403. previewImage: previewImage,
  404. getSystemInfo: getSystemInfo,
  405. getSystemInfoSync: getSystemInfo };
  406. var todos = [
  407. 'vibrate',
  408. 'preloadPage',
  409. 'unPreloadPage',
  410. 'loadSubPackage'];
  411. var canIUses = [];
  412. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  413. function processCallback(methodName, method, returnValue) {
  414. return function (res) {
  415. return method(processReturnValue(methodName, res, returnValue));
  416. };
  417. }
  418. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  419. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  420. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  421. if (isFn(argsOption)) {
  422. argsOption = argsOption(fromArgs, toArgs) || {};
  423. }
  424. for (var key in fromArgs) {
  425. if (hasOwn(argsOption, key)) {
  426. var keyOption = argsOption[key];
  427. if (isFn(keyOption)) {
  428. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  429. }
  430. if (!keyOption) {// 不支持的参数
  431. console.warn("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F ".concat(methodName, "\u6682\u4E0D\u652F\u6301").concat(key));
  432. } else if (isStr(keyOption)) {// 重写参数 key
  433. toArgs[keyOption] = fromArgs[key];
  434. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  435. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  436. }
  437. } else if (CALLBACKS.indexOf(key) !== -1) {
  438. if (isFn(fromArgs[key])) {
  439. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  440. }
  441. } else {
  442. if (!keepFromArgs) {
  443. toArgs[key] = fromArgs[key];
  444. }
  445. }
  446. }
  447. return toArgs;
  448. } else if (isFn(fromArgs)) {
  449. fromArgs = processCallback(methodName, fromArgs, returnValue);
  450. }
  451. return fromArgs;
  452. }
  453. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  454. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  455. res = protocols.returnValue(methodName, res);
  456. }
  457. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  458. }
  459. function wrapper(methodName, method) {
  460. if (hasOwn(protocols, methodName)) {
  461. var protocol = protocols[methodName];
  462. if (!protocol) {// 暂不支持的 api
  463. return function () {
  464. console.error("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F \u6682\u4E0D\u652F\u6301".concat(methodName));
  465. };
  466. }
  467. return function (arg1, arg2) {// 目前 api 最多两个参数
  468. var options = protocol;
  469. if (isFn(protocol)) {
  470. options = protocol(arg1);
  471. }
  472. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  473. var args = [arg1];
  474. if (typeof arg2 !== 'undefined') {
  475. args.push(arg2);
  476. }
  477. if (isFn(options.name)) {
  478. methodName = options.name(arg1);
  479. } else if (isStr(options.name)) {
  480. methodName = options.name;
  481. }
  482. var returnValue = wx[methodName].apply(wx, args);
  483. if (isSyncApi(methodName)) {// 同步 api
  484. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  485. }
  486. return returnValue;
  487. };
  488. }
  489. return method;
  490. }
  491. var todoApis = Object.create(null);
  492. var TODOS = [
  493. 'onTabBarMidButtonTap',
  494. 'subscribePush',
  495. 'unsubscribePush',
  496. 'onPush',
  497. 'offPush',
  498. 'share'];
  499. function createTodoApi(name) {
  500. return function todoApi(_ref)
  501. {var fail = _ref.fail,complete = _ref.complete;
  502. var res = {
  503. errMsg: "".concat(name, ":fail:\u6682\u4E0D\u652F\u6301 ").concat(name, " \u65B9\u6CD5") };
  504. isFn(fail) && fail(res);
  505. isFn(complete) && complete(res);
  506. };
  507. }
  508. TODOS.forEach(function (name) {
  509. todoApis[name] = createTodoApi(name);
  510. });
  511. var providers = {
  512. oauth: ['weixin'],
  513. share: ['weixin'],
  514. payment: ['wxpay'],
  515. push: ['weixin'] };
  516. function getProvider(_ref2)
  517. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  518. var res = false;
  519. if (providers[service]) {
  520. res = {
  521. errMsg: 'getProvider:ok',
  522. service: service,
  523. provider: providers[service] };
  524. isFn(success) && success(res);
  525. } else {
  526. res = {
  527. errMsg: 'getProvider:fail:服务[' + service + ']不存在' };
  528. isFn(fail) && fail(res);
  529. }
  530. isFn(complete) && complete(res);
  531. }
  532. var extraApi = /*#__PURE__*/Object.freeze({
  533. __proto__: null,
  534. getProvider: getProvider });
  535. var getEmitter = function () {
  536. var Emitter;
  537. return function getUniEmitter() {
  538. if (!Emitter) {
  539. Emitter = new _vue.default();
  540. }
  541. return Emitter;
  542. };
  543. }();
  544. function apply(ctx, method, args) {
  545. return ctx[method].apply(ctx, args);
  546. }
  547. function $on() {
  548. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  549. }
  550. function $off() {
  551. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  552. }
  553. function $once() {
  554. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  555. }
  556. function $emit() {
  557. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  558. }
  559. var eventApi = /*#__PURE__*/Object.freeze({
  560. __proto__: null,
  561. $on: $on,
  562. $off: $off,
  563. $once: $once,
  564. $emit: $emit });
  565. var api = /*#__PURE__*/Object.freeze({
  566. __proto__: null });
  567. var MPPage = Page;
  568. var MPComponent = Component;
  569. var customizeRE = /:/g;
  570. var customize = cached(function (str) {
  571. return camelize(str.replace(customizeRE, '-'));
  572. });
  573. function initTriggerEvent(mpInstance) {
  574. {
  575. if (!wx.canIUse('nextTick')) {
  576. return;
  577. }
  578. }
  579. var oldTriggerEvent = mpInstance.triggerEvent;
  580. mpInstance.triggerEvent = function (event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  581. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  582. };
  583. }
  584. function initHook(name, options) {
  585. var oldHook = options[name];
  586. if (!oldHook) {
  587. options[name] = function () {
  588. initTriggerEvent(this);
  589. };
  590. } else {
  591. options[name] = function () {
  592. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  593. return oldHook.apply(this, args);
  594. };
  595. }
  596. }
  597. if (!MPPage.__$wrappered) {
  598. MPPage.__$wrappered = true;
  599. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  600. initHook('onLoad', options);
  601. return MPPage(options);
  602. };
  603. Page.after = MPPage.after;
  604. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  605. initHook('created', options);
  606. return MPComponent(options);
  607. };
  608. }
  609. var PAGE_EVENT_HOOKS = [
  610. 'onPullDownRefresh',
  611. 'onReachBottom',
  612. 'onAddToFavorites',
  613. 'onShareTimeline',
  614. 'onShareAppMessage',
  615. 'onPageScroll',
  616. 'onResize',
  617. 'onTabItemTap'];
  618. function initMocks(vm, mocks) {
  619. var mpInstance = vm.$mp[vm.mpType];
  620. mocks.forEach(function (mock) {
  621. if (hasOwn(mpInstance, mock)) {
  622. vm[mock] = mpInstance[mock];
  623. }
  624. });
  625. }
  626. function hasHook(hook, vueOptions) {
  627. if (!vueOptions) {
  628. return true;
  629. }
  630. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  631. return true;
  632. }
  633. vueOptions = vueOptions.default || vueOptions;
  634. if (isFn(vueOptions)) {
  635. if (isFn(vueOptions.extendOptions[hook])) {
  636. return true;
  637. }
  638. if (vueOptions.super &&
  639. vueOptions.super.options &&
  640. Array.isArray(vueOptions.super.options[hook])) {
  641. return true;
  642. }
  643. return false;
  644. }
  645. if (isFn(vueOptions[hook])) {
  646. return true;
  647. }
  648. var mixins = vueOptions.mixins;
  649. if (Array.isArray(mixins)) {
  650. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  651. }
  652. }
  653. function initHooks(mpOptions, hooks, vueOptions) {
  654. hooks.forEach(function (hook) {
  655. if (hasHook(hook, vueOptions)) {
  656. mpOptions[hook] = function (args) {
  657. return this.$vm && this.$vm.__call_hook(hook, args);
  658. };
  659. }
  660. });
  661. }
  662. function initVueComponent(Vue, vueOptions) {
  663. vueOptions = vueOptions.default || vueOptions;
  664. var VueComponent;
  665. if (isFn(vueOptions)) {
  666. VueComponent = vueOptions;
  667. } else {
  668. VueComponent = Vue.extend(vueOptions);
  669. }
  670. vueOptions = VueComponent.options;
  671. return [VueComponent, vueOptions];
  672. }
  673. function initSlots(vm, vueSlots) {
  674. if (Array.isArray(vueSlots) && vueSlots.length) {
  675. var $slots = Object.create(null);
  676. vueSlots.forEach(function (slotName) {
  677. $slots[slotName] = true;
  678. });
  679. vm.$scopedSlots = vm.$slots = $slots;
  680. }
  681. }
  682. function initVueIds(vueIds, mpInstance) {
  683. vueIds = (vueIds || '').split(',');
  684. var len = vueIds.length;
  685. if (len === 1) {
  686. mpInstance._$vueId = vueIds[0];
  687. } else if (len === 2) {
  688. mpInstance._$vueId = vueIds[0];
  689. mpInstance._$vuePid = vueIds[1];
  690. }
  691. }
  692. function initData(vueOptions, context) {
  693. var data = vueOptions.data || {};
  694. var methods = vueOptions.methods || {};
  695. if (typeof data === 'function') {
  696. try {
  697. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  698. } catch (e) {
  699. if (Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  700. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  701. }
  702. }
  703. } else {
  704. try {
  705. // 对 data 格式化
  706. data = JSON.parse(JSON.stringify(data));
  707. } catch (e) {}
  708. }
  709. if (!isPlainObject(data)) {
  710. data = {};
  711. }
  712. Object.keys(methods).forEach(function (methodName) {
  713. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  714. data[methodName] = methods[methodName];
  715. }
  716. });
  717. return data;
  718. }
  719. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  720. function createObserver(name) {
  721. return function observer(newVal, oldVal) {
  722. if (this.$vm) {
  723. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  724. }
  725. };
  726. }
  727. function initBehaviors(vueOptions, initBehavior) {
  728. var vueBehaviors = vueOptions.behaviors;
  729. var vueExtends = vueOptions.extends;
  730. var vueMixins = vueOptions.mixins;
  731. var vueProps = vueOptions.props;
  732. if (!vueProps) {
  733. vueOptions.props = vueProps = [];
  734. }
  735. var behaviors = [];
  736. if (Array.isArray(vueBehaviors)) {
  737. vueBehaviors.forEach(function (behavior) {
  738. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  739. if (behavior === 'uni://form-field') {
  740. if (Array.isArray(vueProps)) {
  741. vueProps.push('name');
  742. vueProps.push('value');
  743. } else {
  744. vueProps.name = {
  745. type: String,
  746. default: '' };
  747. vueProps.value = {
  748. type: [String, Number, Boolean, Array, Object, Date],
  749. default: '' };
  750. }
  751. }
  752. });
  753. }
  754. if (isPlainObject(vueExtends) && vueExtends.props) {
  755. behaviors.push(
  756. initBehavior({
  757. properties: initProperties(vueExtends.props, true) }));
  758. }
  759. if (Array.isArray(vueMixins)) {
  760. vueMixins.forEach(function (vueMixin) {
  761. if (isPlainObject(vueMixin) && vueMixin.props) {
  762. behaviors.push(
  763. initBehavior({
  764. properties: initProperties(vueMixin.props, true) }));
  765. }
  766. });
  767. }
  768. return behaviors;
  769. }
  770. function parsePropType(key, type, defaultValue, file) {
  771. // [String]=>String
  772. if (Array.isArray(type) && type.length === 1) {
  773. return type[0];
  774. }
  775. return type;
  776. }
  777. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  778. var properties = {};
  779. if (!isBehavior) {
  780. properties.vueId = {
  781. type: String,
  782. value: '' };
  783. // 用于字节跳动小程序模拟抽象节点
  784. properties.generic = {
  785. type: Object,
  786. value: null };
  787. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  788. type: null,
  789. value: [],
  790. observer: function observer(newVal, oldVal) {
  791. var $slots = Object.create(null);
  792. newVal.forEach(function (slotName) {
  793. $slots[slotName] = true;
  794. });
  795. this.setData({
  796. $slots: $slots });
  797. } };
  798. }
  799. if (Array.isArray(props)) {// ['title']
  800. props.forEach(function (key) {
  801. properties[key] = {
  802. type: null,
  803. observer: createObserver(key) };
  804. });
  805. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  806. Object.keys(props).forEach(function (key) {
  807. var opts = props[key];
  808. if (isPlainObject(opts)) {// title:{type:String,default:''}
  809. var value = opts.default;
  810. if (isFn(value)) {
  811. value = value();
  812. }
  813. opts.type = parsePropType(key, opts.type);
  814. properties[key] = {
  815. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  816. value: value,
  817. observer: createObserver(key) };
  818. } else {// content:String
  819. var type = parsePropType(key, opts);
  820. properties[key] = {
  821. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  822. observer: createObserver(key) };
  823. }
  824. });
  825. }
  826. return properties;
  827. }
  828. function wrapper$1(event) {
  829. // TODO 又得兼容 mpvue 的 mp 对象
  830. try {
  831. event.mp = JSON.parse(JSON.stringify(event));
  832. } catch (e) {}
  833. event.stopPropagation = noop;
  834. event.preventDefault = noop;
  835. event.target = event.target || {};
  836. if (!hasOwn(event, 'detail')) {
  837. event.detail = {};
  838. }
  839. if (hasOwn(event, 'markerId')) {
  840. event.detail = typeof event.detail === 'object' ? event.detail : {};
  841. event.detail.markerId = event.markerId;
  842. }
  843. if (isPlainObject(event.detail)) {
  844. event.target = Object.assign({}, event.target, event.detail);
  845. }
  846. return event;
  847. }
  848. function getExtraValue(vm, dataPathsArray) {
  849. var context = vm;
  850. dataPathsArray.forEach(function (dataPathArray) {
  851. var dataPath = dataPathArray[0];
  852. var value = dataPathArray[2];
  853. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  854. var propPath = dataPathArray[1];
  855. var valuePath = dataPathArray[3];
  856. var vFor;
  857. if (Number.isInteger(dataPath)) {
  858. vFor = dataPath;
  859. } else if (!dataPath) {
  860. vFor = context;
  861. } else if (typeof dataPath === 'string' && dataPath) {
  862. if (dataPath.indexOf('#s#') === 0) {
  863. vFor = dataPath.substr(3);
  864. } else {
  865. vFor = vm.__get_value(dataPath, context);
  866. }
  867. }
  868. if (Number.isInteger(vFor)) {
  869. context = value;
  870. } else if (!propPath) {
  871. context = vFor[value];
  872. } else {
  873. if (Array.isArray(vFor)) {
  874. context = vFor.find(function (vForItem) {
  875. return vm.__get_value(propPath, vForItem) === value;
  876. });
  877. } else if (isPlainObject(vFor)) {
  878. context = Object.keys(vFor).find(function (vForKey) {
  879. return vm.__get_value(propPath, vFor[vForKey]) === value;
  880. });
  881. } else {
  882. console.error('v-for 暂不支持循环数据:', vFor);
  883. }
  884. }
  885. if (valuePath) {
  886. context = vm.__get_value(valuePath, context);
  887. }
  888. }
  889. });
  890. return context;
  891. }
  892. function processEventExtra(vm, extra, event) {
  893. var extraObj = {};
  894. if (Array.isArray(extra) && extra.length) {
  895. /**
  896. *[
  897. * ['data.items', 'data.id', item.data.id],
  898. * ['metas', 'id', meta.id]
  899. *],
  900. *[
  901. * ['data.items', 'data.id', item.data.id],
  902. * ['metas', 'id', meta.id]
  903. *],
  904. *'test'
  905. */
  906. extra.forEach(function (dataPath, index) {
  907. if (typeof dataPath === 'string') {
  908. if (!dataPath) {// model,prop.sync
  909. extraObj['$' + index] = vm;
  910. } else {
  911. if (dataPath === '$event') {// $event
  912. extraObj['$' + index] = event;
  913. } else if (dataPath === 'arguments') {
  914. if (event.detail && event.detail.__args__) {
  915. extraObj['$' + index] = event.detail.__args__;
  916. } else {
  917. extraObj['$' + index] = [event];
  918. }
  919. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  920. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  921. } else {
  922. extraObj['$' + index] = vm.__get_value(dataPath);
  923. }
  924. }
  925. } else {
  926. extraObj['$' + index] = getExtraValue(vm, dataPath);
  927. }
  928. });
  929. }
  930. return extraObj;
  931. }
  932. function getObjByArray(arr) {
  933. var obj = {};
  934. for (var i = 1; i < arr.length; i++) {
  935. var element = arr[i];
  936. obj[element[0]] = element[1];
  937. }
  938. return obj;
  939. }
  940. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  941. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  942. if (isCustom) {// 自定义事件
  943. isCustomMPEvent = event.currentTarget &&
  944. event.currentTarget.dataset &&
  945. event.currentTarget.dataset.comType === 'wx';
  946. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  947. if (isCustomMPEvent) {
  948. return [event];
  949. }
  950. return event.detail.__args__ || event.detail;
  951. }
  952. }
  953. var extraObj = processEventExtra(vm, extra, event);
  954. var ret = [];
  955. args.forEach(function (arg) {
  956. if (arg === '$event') {
  957. if (methodName === '__set_model' && !isCustom) {// input v-model value
  958. ret.push(event.target.value);
  959. } else {
  960. if (isCustom && !isCustomMPEvent) {
  961. ret.push(event.detail.__args__[0]);
  962. } else {// wxcomponent 组件或内置组件
  963. ret.push(event);
  964. }
  965. }
  966. } else {
  967. if (Array.isArray(arg) && arg[0] === 'o') {
  968. ret.push(getObjByArray(arg));
  969. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  970. ret.push(extraObj[arg]);
  971. } else {
  972. ret.push(arg);
  973. }
  974. }
  975. });
  976. return ret;
  977. }
  978. var ONCE = '~';
  979. var CUSTOM = '^';
  980. function isMatchEventType(eventType, optType) {
  981. return eventType === optType ||
  982. optType === 'regionchange' && (
  983. eventType === 'begin' ||
  984. eventType === 'end');
  985. }
  986. function getContextVm(vm) {
  987. var $parent = vm.$parent;
  988. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  989. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  990. $parent = $parent.$parent;
  991. }
  992. return $parent && $parent.$parent;
  993. }
  994. function handleEvent(event) {var _this = this;
  995. event = wrapper$1(event);
  996. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  997. var dataset = (event.currentTarget || event.target).dataset;
  998. if (!dataset) {
  999. return console.warn('事件信息不存在');
  1000. }
  1001. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1002. if (!eventOpts) {
  1003. return console.warn('事件信息不存在');
  1004. }
  1005. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1006. var eventType = event.type;
  1007. var ret = [];
  1008. eventOpts.forEach(function (eventOpt) {
  1009. var type = eventOpt[0];
  1010. var eventsArray = eventOpt[1];
  1011. var isCustom = type.charAt(0) === CUSTOM;
  1012. type = isCustom ? type.slice(1) : type;
  1013. var isOnce = type.charAt(0) === ONCE;
  1014. type = isOnce ? type.slice(1) : type;
  1015. if (eventsArray && isMatchEventType(eventType, type)) {
  1016. eventsArray.forEach(function (eventArray) {
  1017. var methodName = eventArray[0];
  1018. if (methodName) {
  1019. var handlerCtx = _this.$vm;
  1020. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1021. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1022. }
  1023. if (methodName === '$emit') {
  1024. handlerCtx.$emit.apply(handlerCtx,
  1025. processEventArgs(
  1026. _this.$vm,
  1027. event,
  1028. eventArray[1],
  1029. eventArray[2],
  1030. isCustom,
  1031. methodName));
  1032. return;
  1033. }
  1034. var handler = handlerCtx[methodName];
  1035. if (!isFn(handler)) {
  1036. throw new Error(" _vm.".concat(methodName, " is not a function"));
  1037. }
  1038. if (isOnce) {
  1039. if (handler.once) {
  1040. return;
  1041. }
  1042. handler.once = true;
  1043. }
  1044. var params = processEventArgs(
  1045. _this.$vm,
  1046. event,
  1047. eventArray[1],
  1048. eventArray[2],
  1049. isCustom,
  1050. methodName);
  1051. params = Array.isArray(params) ? params : [];
  1052. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1053. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1054. // eslint-disable-next-line no-sparse-arrays
  1055. params = params.concat([,,,,,,,,,, event]);
  1056. }
  1057. ret.push(handler.apply(handlerCtx, params));
  1058. }
  1059. });
  1060. }
  1061. });
  1062. if (
  1063. eventType === 'input' &&
  1064. ret.length === 1 &&
  1065. typeof ret[0] !== 'undefined')
  1066. {
  1067. return ret[0];
  1068. }
  1069. }
  1070. var eventChannels = {};
  1071. var eventChannelStack = [];
  1072. function getEventChannel(id) {
  1073. if (id) {
  1074. var eventChannel = eventChannels[id];
  1075. delete eventChannels[id];
  1076. return eventChannel;
  1077. }
  1078. return eventChannelStack.shift();
  1079. }
  1080. var hooks = [
  1081. 'onShow',
  1082. 'onHide',
  1083. 'onError',
  1084. 'onPageNotFound',
  1085. 'onThemeChange',
  1086. 'onUnhandledRejection'];
  1087. function initEventChannel() {
  1088. _vue.default.prototype.getOpenerEventChannel = function () {
  1089. // 微信小程序使用自身getOpenerEventChannel
  1090. {
  1091. return this.$scope.getOpenerEventChannel();
  1092. }
  1093. };
  1094. var callHook = _vue.default.prototype.__call_hook;
  1095. _vue.default.prototype.__call_hook = function (hook, args) {
  1096. if (hook === 'onLoad' && args && args.__id__) {
  1097. this.__eventChannel__ = getEventChannel(args.__id__);
  1098. delete args.__id__;
  1099. }
  1100. return callHook.call(this, hook, args);
  1101. };
  1102. }
  1103. function parseBaseApp(vm, _ref3)
  1104. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1105. initEventChannel();
  1106. if (vm.$options.store) {
  1107. _vue.default.prototype.$store = vm.$options.store;
  1108. }
  1109. _vue.default.prototype.mpHost = "mp-weixin";
  1110. _vue.default.mixin({
  1111. beforeCreate: function beforeCreate() {
  1112. if (!this.$options.mpType) {
  1113. return;
  1114. }
  1115. this.mpType = this.$options.mpType;
  1116. this.$mp = _defineProperty({
  1117. data: {} },
  1118. this.mpType, this.$options.mpInstance);
  1119. this.$scope = this.$options.mpInstance;
  1120. delete this.$options.mpType;
  1121. delete this.$options.mpInstance;
  1122. if (this.mpType !== 'app') {
  1123. initRefs(this);
  1124. initMocks(this, mocks);
  1125. }
  1126. } });
  1127. var appOptions = {
  1128. onLaunch: function onLaunch(args) {
  1129. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1130. return;
  1131. }
  1132. {
  1133. if (!wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1134. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1135. }
  1136. }
  1137. this.$vm = vm;
  1138. this.$vm.$mp = {
  1139. app: this };
  1140. this.$vm.$scope = this;
  1141. // vm 上也挂载 globalData
  1142. this.$vm.globalData = this.globalData;
  1143. this.$vm._isMounted = true;
  1144. this.$vm.__call_hook('mounted', args);
  1145. this.$vm.__call_hook('onLaunch', args);
  1146. } };
  1147. // 兼容旧版本 globalData
  1148. appOptions.globalData = vm.$options.globalData || {};
  1149. // 将 methods 中的方法挂在 getApp() 中
  1150. var methods = vm.$options.methods;
  1151. if (methods) {
  1152. Object.keys(methods).forEach(function (name) {
  1153. appOptions[name] = methods[name];
  1154. });
  1155. }
  1156. initHooks(appOptions, hooks);
  1157. return appOptions;
  1158. }
  1159. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1160. function findVmByVueId(vm, vuePid) {
  1161. var $children = vm.$children;
  1162. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1163. for (var i = $children.length - 1; i >= 0; i--) {
  1164. var childVm = $children[i];
  1165. if (childVm.$scope._$vueId === vuePid) {
  1166. return childVm;
  1167. }
  1168. }
  1169. // 反向递归查找
  1170. var parentVm;
  1171. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1172. parentVm = findVmByVueId($children[_i], vuePid);
  1173. if (parentVm) {
  1174. return parentVm;
  1175. }
  1176. }
  1177. }
  1178. function initBehavior(options) {
  1179. return Behavior(options);
  1180. }
  1181. function isPage() {
  1182. return !!this.route;
  1183. }
  1184. function initRelation(detail) {
  1185. this.triggerEvent('__l', detail);
  1186. }
  1187. function selectAllComponents(mpInstance, selector, $refs) {
  1188. var components = mpInstance.selectAllComponents(selector);
  1189. components.forEach(function (component) {
  1190. var ref = component.dataset.ref;
  1191. $refs[ref] = component.$vm || component;
  1192. {
  1193. if (component.dataset.vueGeneric === 'scoped') {
  1194. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1195. selectAllComponents(scopedComponent, selector, $refs);
  1196. });
  1197. }
  1198. }
  1199. });
  1200. }
  1201. function initRefs(vm) {
  1202. var mpInstance = vm.$scope;
  1203. Object.defineProperty(vm, '$refs', {
  1204. get: function get() {
  1205. var $refs = {};
  1206. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1207. // TODO 暂不考虑 for 中的 scoped
  1208. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1209. forComponents.forEach(function (component) {
  1210. var ref = component.dataset.ref;
  1211. if (!$refs[ref]) {
  1212. $refs[ref] = [];
  1213. }
  1214. $refs[ref].push(component.$vm || component);
  1215. });
  1216. return $refs;
  1217. } });
  1218. }
  1219. function handleLink(event) {var _ref4 =
  1220. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1221. var parentVm;
  1222. if (vuePid) {
  1223. parentVm = findVmByVueId(this.$vm, vuePid);
  1224. }
  1225. if (!parentVm) {
  1226. parentVm = this.$vm;
  1227. }
  1228. vueOptions.parent = parentVm;
  1229. }
  1230. function parseApp(vm) {
  1231. return parseBaseApp(vm, {
  1232. mocks: mocks,
  1233. initRefs: initRefs });
  1234. }
  1235. function createApp(vm) {
  1236. App(parseApp(vm));
  1237. return vm;
  1238. }
  1239. var encodeReserveRE = /[!'()*]/g;
  1240. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1241. var commaRE = /%2C/g;
  1242. // fixed encodeURIComponent which is more conformant to RFC3986:
  1243. // - escapes [!'()*]
  1244. // - preserve commas
  1245. var encode = function encode(str) {return encodeURIComponent(str).
  1246. replace(encodeReserveRE, encodeReserveReplacer).
  1247. replace(commaRE, ',');};
  1248. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1249. var res = obj ? Object.keys(obj).map(function (key) {
  1250. var val = obj[key];
  1251. if (val === undefined) {
  1252. return '';
  1253. }
  1254. if (val === null) {
  1255. return encodeStr(key);
  1256. }
  1257. if (Array.isArray(val)) {
  1258. var result = [];
  1259. val.forEach(function (val2) {
  1260. if (val2 === undefined) {
  1261. return;
  1262. }
  1263. if (val2 === null) {
  1264. result.push(encodeStr(key));
  1265. } else {
  1266. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1267. }
  1268. });
  1269. return result.join('&');
  1270. }
  1271. return encodeStr(key) + '=' + encodeStr(val);
  1272. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1273. return res ? "?".concat(res) : '';
  1274. }
  1275. function parseBaseComponent(vueComponentOptions)
  1276. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1277. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1278. var options = _objectSpread({
  1279. multipleSlots: true,
  1280. addGlobalClass: true },
  1281. vueOptions.options || {});
  1282. {
  1283. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1284. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1285. Object.assign(options, vueOptions['mp-weixin'].options);
  1286. }
  1287. }
  1288. var componentOptions = {
  1289. options: options,
  1290. data: initData(vueOptions, _vue.default.prototype),
  1291. behaviors: initBehaviors(vueOptions, initBehavior),
  1292. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1293. lifetimes: {
  1294. attached: function attached() {
  1295. var properties = this.properties;
  1296. var options = {
  1297. mpType: isPage.call(this) ? 'page' : 'component',
  1298. mpInstance: this,
  1299. propsData: properties };
  1300. initVueIds(properties.vueId, this);
  1301. // 处理父子关系
  1302. initRelation.call(this, {
  1303. vuePid: this._$vuePid,
  1304. vueOptions: options });
  1305. // 初始化 vue 实例
  1306. this.$vm = new VueComponent(options);
  1307. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1308. initSlots(this.$vm, properties.vueSlots);
  1309. // 触发首次 setData
  1310. this.$vm.$mount();
  1311. },
  1312. ready: function ready() {
  1313. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1314. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1315. if (this.$vm) {
  1316. this.$vm._isMounted = true;
  1317. this.$vm.__call_hook('mounted');
  1318. this.$vm.__call_hook('onReady');
  1319. }
  1320. },
  1321. detached: function detached() {
  1322. this.$vm && this.$vm.$destroy();
  1323. } },
  1324. pageLifetimes: {
  1325. show: function show(args) {
  1326. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1327. },
  1328. hide: function hide() {
  1329. this.$vm && this.$vm.__call_hook('onPageHide');
  1330. },
  1331. resize: function resize(size) {
  1332. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1333. } },
  1334. methods: {
  1335. __l: handleLink,
  1336. __e: handleEvent } };
  1337. // externalClasses
  1338. if (vueOptions.externalClasses) {
  1339. componentOptions.externalClasses = vueOptions.externalClasses;
  1340. }
  1341. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1342. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1343. componentOptions.methods[callMethod] = function (args) {
  1344. return this.$vm[callMethod](args);
  1345. };
  1346. });
  1347. }
  1348. if (isPage) {
  1349. return componentOptions;
  1350. }
  1351. return [componentOptions, VueComponent];
  1352. }
  1353. function parseComponent(vueComponentOptions) {
  1354. return parseBaseComponent(vueComponentOptions, {
  1355. isPage: isPage,
  1356. initRelation: initRelation });
  1357. }
  1358. var hooks$1 = [
  1359. 'onShow',
  1360. 'onHide',
  1361. 'onUnload'];
  1362. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1363. function parseBasePage(vuePageOptions, _ref6)
  1364. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1365. var pageOptions = parseComponent(vuePageOptions);
  1366. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1367. pageOptions.methods.onLoad = function (query) {
  1368. this.options = query;
  1369. var copyQuery = Object.assign({}, query);
  1370. delete copyQuery.__id__;
  1371. this.$page = {
  1372. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1373. this.$vm.$mp.query = query; // 兼容 mpvue
  1374. this.$vm.__call_hook('onLoad', query);
  1375. };
  1376. return pageOptions;
  1377. }
  1378. function parsePage(vuePageOptions) {
  1379. return parseBasePage(vuePageOptions, {
  1380. isPage: isPage,
  1381. initRelation: initRelation });
  1382. }
  1383. function createPage(vuePageOptions) {
  1384. {
  1385. return Component(parsePage(vuePageOptions));
  1386. }
  1387. }
  1388. function createComponent(vueOptions) {
  1389. {
  1390. return Component(parseComponent(vueOptions));
  1391. }
  1392. }
  1393. function createSubpackageApp(vm) {
  1394. var appOptions = parseApp(vm);
  1395. var app = getApp({
  1396. allowDefault: true });
  1397. var globalData = app.globalData;
  1398. if (globalData) {
  1399. Object.keys(appOptions.globalData).forEach(function (name) {
  1400. if (!hasOwn(globalData, name)) {
  1401. globalData[name] = appOptions.globalData[name];
  1402. }
  1403. });
  1404. }
  1405. Object.keys(appOptions).forEach(function (name) {
  1406. if (!hasOwn(app, name)) {
  1407. app[name] = appOptions[name];
  1408. }
  1409. });
  1410. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1411. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1412. appOptions.onShow.apply(app, args);
  1413. });
  1414. }
  1415. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1416. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1417. appOptions.onHide.apply(app, args);
  1418. });
  1419. }
  1420. if (isFn(appOptions.onLaunch)) {
  1421. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1422. appOptions.onLaunch.call(app, args);
  1423. }
  1424. return vm;
  1425. }
  1426. todos.forEach(function (todoApi) {
  1427. protocols[todoApi] = false;
  1428. });
  1429. canIUses.forEach(function (canIUseApi) {
  1430. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1431. canIUseApi;
  1432. if (!wx.canIUse(apiName)) {
  1433. protocols[canIUseApi] = false;
  1434. }
  1435. });
  1436. var uni = {};
  1437. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1438. uni = new Proxy({}, {
  1439. get: function get(target, name) {
  1440. if (hasOwn(target, name)) {
  1441. return target[name];
  1442. }
  1443. if (baseApi[name]) {
  1444. return baseApi[name];
  1445. }
  1446. if (api[name]) {
  1447. return promisify(name, api[name]);
  1448. }
  1449. {
  1450. if (extraApi[name]) {
  1451. return promisify(name, extraApi[name]);
  1452. }
  1453. if (todoApis[name]) {
  1454. return promisify(name, todoApis[name]);
  1455. }
  1456. }
  1457. if (eventApi[name]) {
  1458. return eventApi[name];
  1459. }
  1460. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  1461. return;
  1462. }
  1463. return promisify(name, wrapper(name, wx[name]));
  1464. },
  1465. set: function set(target, name, value) {
  1466. target[name] = value;
  1467. return true;
  1468. } });
  1469. } else {
  1470. Object.keys(baseApi).forEach(function (name) {
  1471. uni[name] = baseApi[name];
  1472. });
  1473. {
  1474. Object.keys(todoApis).forEach(function (name) {
  1475. uni[name] = promisify(name, todoApis[name]);
  1476. });
  1477. Object.keys(extraApi).forEach(function (name) {
  1478. uni[name] = promisify(name, todoApis[name]);
  1479. });
  1480. }
  1481. Object.keys(eventApi).forEach(function (name) {
  1482. uni[name] = eventApi[name];
  1483. });
  1484. Object.keys(api).forEach(function (name) {
  1485. uni[name] = promisify(name, api[name]);
  1486. });
  1487. Object.keys(wx).forEach(function (name) {
  1488. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  1489. uni[name] = promisify(name, wrapper(name, wx[name]));
  1490. }
  1491. });
  1492. }
  1493. wx.createApp = createApp;
  1494. wx.createPage = createPage;
  1495. wx.createComponent = createComponent;
  1496. wx.createSubpackageApp = createSubpackageApp;
  1497. var uni$1 = uni;var _default =
  1498. uni$1;exports.default = _default;
  1499. /***/ }),
  1500. /* 2 */
  1501. /*!******************************************************************************************!*\
  1502. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  1503. \******************************************************************************************/
  1504. /*! exports provided: default */
  1505. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1506. "use strict";
  1507. __webpack_require__.r(__webpack_exports__);
  1508. /* WEBPACK VAR INJECTION */(function(global) {/*!
  1509. * Vue.js v2.6.11
  1510. * (c) 2014-2021 Evan You
  1511. * Released under the MIT License.
  1512. */
  1513. /* */
  1514. var emptyObject = Object.freeze({});
  1515. // These helpers produce better VM code in JS engines due to their
  1516. // explicitness and function inlining.
  1517. function isUndef (v) {
  1518. return v === undefined || v === null
  1519. }
  1520. function isDef (v) {
  1521. return v !== undefined && v !== null
  1522. }
  1523. function isTrue (v) {
  1524. return v === true
  1525. }
  1526. function isFalse (v) {
  1527. return v === false
  1528. }
  1529. /**
  1530. * Check if value is primitive.
  1531. */
  1532. function isPrimitive (value) {
  1533. return (
  1534. typeof value === 'string' ||
  1535. typeof value === 'number' ||
  1536. // $flow-disable-line
  1537. typeof value === 'symbol' ||
  1538. typeof value === 'boolean'
  1539. )
  1540. }
  1541. /**
  1542. * Quick object check - this is primarily used to tell
  1543. * Objects from primitive values when we know the value
  1544. * is a JSON-compliant type.
  1545. */
  1546. function isObject (obj) {
  1547. return obj !== null && typeof obj === 'object'
  1548. }
  1549. /**
  1550. * Get the raw type string of a value, e.g., [object Object].
  1551. */
  1552. var _toString = Object.prototype.toString;
  1553. function toRawType (value) {
  1554. return _toString.call(value).slice(8, -1)
  1555. }
  1556. /**
  1557. * Strict object type check. Only returns true
  1558. * for plain JavaScript objects.
  1559. */
  1560. function isPlainObject (obj) {
  1561. return _toString.call(obj) === '[object Object]'
  1562. }
  1563. function isRegExp (v) {
  1564. return _toString.call(v) === '[object RegExp]'
  1565. }
  1566. /**
  1567. * Check if val is a valid array index.
  1568. */
  1569. function isValidArrayIndex (val) {
  1570. var n = parseFloat(String(val));
  1571. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1572. }
  1573. function isPromise (val) {
  1574. return (
  1575. isDef(val) &&
  1576. typeof val.then === 'function' &&
  1577. typeof val.catch === 'function'
  1578. )
  1579. }
  1580. /**
  1581. * Convert a value to a string that is actually rendered.
  1582. */
  1583. function toString (val) {
  1584. return val == null
  1585. ? ''
  1586. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  1587. ? JSON.stringify(val, null, 2)
  1588. : String(val)
  1589. }
  1590. /**
  1591. * Convert an input value to a number for persistence.
  1592. * If the conversion fails, return original string.
  1593. */
  1594. function toNumber (val) {
  1595. var n = parseFloat(val);
  1596. return isNaN(n) ? val : n
  1597. }
  1598. /**
  1599. * Make a map and return a function for checking if a key
  1600. * is in that map.
  1601. */
  1602. function makeMap (
  1603. str,
  1604. expectsLowerCase
  1605. ) {
  1606. var map = Object.create(null);
  1607. var list = str.split(',');
  1608. for (var i = 0; i < list.length; i++) {
  1609. map[list[i]] = true;
  1610. }
  1611. return expectsLowerCase
  1612. ? function (val) { return map[val.toLowerCase()]; }
  1613. : function (val) { return map[val]; }
  1614. }
  1615. /**
  1616. * Check if a tag is a built-in tag.
  1617. */
  1618. var isBuiltInTag = makeMap('slot,component', true);
  1619. /**
  1620. * Check if an attribute is a reserved attribute.
  1621. */
  1622. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1623. /**
  1624. * Remove an item from an array.
  1625. */
  1626. function remove (arr, item) {
  1627. if (arr.length) {
  1628. var index = arr.indexOf(item);
  1629. if (index > -1) {
  1630. return arr.splice(index, 1)
  1631. }
  1632. }
  1633. }
  1634. /**
  1635. * Check whether an object has the property.
  1636. */
  1637. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1638. function hasOwn (obj, key) {
  1639. return hasOwnProperty.call(obj, key)
  1640. }
  1641. /**
  1642. * Create a cached version of a pure function.
  1643. */
  1644. function cached (fn) {
  1645. var cache = Object.create(null);
  1646. return (function cachedFn (str) {
  1647. var hit = cache[str];
  1648. return hit || (cache[str] = fn(str))
  1649. })
  1650. }
  1651. /**
  1652. * Camelize a hyphen-delimited string.
  1653. */
  1654. var camelizeRE = /-(\w)/g;
  1655. var camelize = cached(function (str) {
  1656. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1657. });
  1658. /**
  1659. * Capitalize a string.
  1660. */
  1661. var capitalize = cached(function (str) {
  1662. return str.charAt(0).toUpperCase() + str.slice(1)
  1663. });
  1664. /**
  1665. * Hyphenate a camelCase string.
  1666. */
  1667. var hyphenateRE = /\B([A-Z])/g;
  1668. var hyphenate = cached(function (str) {
  1669. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1670. });
  1671. /**
  1672. * Simple bind polyfill for environments that do not support it,
  1673. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1674. * since native bind is now performant enough in most browsers.
  1675. * But removing it would mean breaking code that was able to run in
  1676. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1677. */
  1678. /* istanbul ignore next */
  1679. function polyfillBind (fn, ctx) {
  1680. function boundFn (a) {
  1681. var l = arguments.length;
  1682. return l
  1683. ? l > 1
  1684. ? fn.apply(ctx, arguments)
  1685. : fn.call(ctx, a)
  1686. : fn.call(ctx)
  1687. }
  1688. boundFn._length = fn.length;
  1689. return boundFn
  1690. }
  1691. function nativeBind (fn, ctx) {
  1692. return fn.bind(ctx)
  1693. }
  1694. var bind = Function.prototype.bind
  1695. ? nativeBind
  1696. : polyfillBind;
  1697. /**
  1698. * Convert an Array-like object to a real Array.
  1699. */
  1700. function toArray (list, start) {
  1701. start = start || 0;
  1702. var i = list.length - start;
  1703. var ret = new Array(i);
  1704. while (i--) {
  1705. ret[i] = list[i + start];
  1706. }
  1707. return ret
  1708. }
  1709. /**
  1710. * Mix properties into target object.
  1711. */
  1712. function extend (to, _from) {
  1713. for (var key in _from) {
  1714. to[key] = _from[key];
  1715. }
  1716. return to
  1717. }
  1718. /**
  1719. * Merge an Array of Objects into a single Object.
  1720. */
  1721. function toObject (arr) {
  1722. var res = {};
  1723. for (var i = 0; i < arr.length; i++) {
  1724. if (arr[i]) {
  1725. extend(res, arr[i]);
  1726. }
  1727. }
  1728. return res
  1729. }
  1730. /* eslint-disable no-unused-vars */
  1731. /**
  1732. * Perform no operation.
  1733. * Stubbing args to make Flow happy without leaving useless transpiled code
  1734. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1735. */
  1736. function noop (a, b, c) {}
  1737. /**
  1738. * Always return false.
  1739. */
  1740. var no = function (a, b, c) { return false; };
  1741. /* eslint-enable no-unused-vars */
  1742. /**
  1743. * Return the same value.
  1744. */
  1745. var identity = function (_) { return _; };
  1746. /**
  1747. * Check if two values are loosely equal - that is,
  1748. * if they are plain objects, do they have the same shape?
  1749. */
  1750. function looseEqual (a, b) {
  1751. if (a === b) { return true }
  1752. var isObjectA = isObject(a);
  1753. var isObjectB = isObject(b);
  1754. if (isObjectA && isObjectB) {
  1755. try {
  1756. var isArrayA = Array.isArray(a);
  1757. var isArrayB = Array.isArray(b);
  1758. if (isArrayA && isArrayB) {
  1759. return a.length === b.length && a.every(function (e, i) {
  1760. return looseEqual(e, b[i])
  1761. })
  1762. } else if (a instanceof Date && b instanceof Date) {
  1763. return a.getTime() === b.getTime()
  1764. } else if (!isArrayA && !isArrayB) {
  1765. var keysA = Object.keys(a);
  1766. var keysB = Object.keys(b);
  1767. return keysA.length === keysB.length && keysA.every(function (key) {
  1768. return looseEqual(a[key], b[key])
  1769. })
  1770. } else {
  1771. /* istanbul ignore next */
  1772. return false
  1773. }
  1774. } catch (e) {
  1775. /* istanbul ignore next */
  1776. return false
  1777. }
  1778. } else if (!isObjectA && !isObjectB) {
  1779. return String(a) === String(b)
  1780. } else {
  1781. return false
  1782. }
  1783. }
  1784. /**
  1785. * Return the first index at which a loosely equal value can be
  1786. * found in the array (if value is a plain object, the array must
  1787. * contain an object of the same shape), or -1 if it is not present.
  1788. */
  1789. function looseIndexOf (arr, val) {
  1790. for (var i = 0; i < arr.length; i++) {
  1791. if (looseEqual(arr[i], val)) { return i }
  1792. }
  1793. return -1
  1794. }
  1795. /**
  1796. * Ensure a function is called only once.
  1797. */
  1798. function once (fn) {
  1799. var called = false;
  1800. return function () {
  1801. if (!called) {
  1802. called = true;
  1803. fn.apply(this, arguments);
  1804. }
  1805. }
  1806. }
  1807. var ASSET_TYPES = [
  1808. 'component',
  1809. 'directive',
  1810. 'filter'
  1811. ];
  1812. var LIFECYCLE_HOOKS = [
  1813. 'beforeCreate',
  1814. 'created',
  1815. 'beforeMount',
  1816. 'mounted',
  1817. 'beforeUpdate',
  1818. 'updated',
  1819. 'beforeDestroy',
  1820. 'destroyed',
  1821. 'activated',
  1822. 'deactivated',
  1823. 'errorCaptured',
  1824. 'serverPrefetch'
  1825. ];
  1826. /* */
  1827. var config = ({
  1828. /**
  1829. * Option merge strategies (used in core/util/options)
  1830. */
  1831. // $flow-disable-line
  1832. optionMergeStrategies: Object.create(null),
  1833. /**
  1834. * Whether to suppress warnings.
  1835. */
  1836. silent: false,
  1837. /**
  1838. * Show production mode tip message on boot?
  1839. */
  1840. productionTip: "development" !== 'production',
  1841. /**
  1842. * Whether to enable devtools
  1843. */
  1844. devtools: "development" !== 'production',
  1845. /**
  1846. * Whether to record perf
  1847. */
  1848. performance: false,
  1849. /**
  1850. * Error handler for watcher errors
  1851. */
  1852. errorHandler: null,
  1853. /**
  1854. * Warn handler for watcher warns
  1855. */
  1856. warnHandler: null,
  1857. /**
  1858. * Ignore certain custom elements
  1859. */
  1860. ignoredElements: [],
  1861. /**
  1862. * Custom user key aliases for v-on
  1863. */
  1864. // $flow-disable-line
  1865. keyCodes: Object.create(null),
  1866. /**
  1867. * Check if a tag is reserved so that it cannot be registered as a
  1868. * component. This is platform-dependent and may be overwritten.
  1869. */
  1870. isReservedTag: no,
  1871. /**
  1872. * Check if an attribute is reserved so that it cannot be used as a component
  1873. * prop. This is platform-dependent and may be overwritten.
  1874. */
  1875. isReservedAttr: no,
  1876. /**
  1877. * Check if a tag is an unknown element.
  1878. * Platform-dependent.
  1879. */
  1880. isUnknownElement: no,
  1881. /**
  1882. * Get the namespace of an element
  1883. */
  1884. getTagNamespace: noop,
  1885. /**
  1886. * Parse the real tag name for the specific platform.
  1887. */
  1888. parsePlatformTagName: identity,
  1889. /**
  1890. * Check if an attribute must be bound using property, e.g. value
  1891. * Platform-dependent.
  1892. */
  1893. mustUseProp: no,
  1894. /**
  1895. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  1896. * This will significantly reduce performance if set to false.
  1897. */
  1898. async: true,
  1899. /**
  1900. * Exposed for legacy reasons
  1901. */
  1902. _lifecycleHooks: LIFECYCLE_HOOKS
  1903. });
  1904. /* */
  1905. /**
  1906. * unicode letters used for parsing html tags, component names and property paths.
  1907. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  1908. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  1909. */
  1910. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  1911. /**
  1912. * Check if a string starts with $ or _
  1913. */
  1914. function isReserved (str) {
  1915. var c = (str + '').charCodeAt(0);
  1916. return c === 0x24 || c === 0x5F
  1917. }
  1918. /**
  1919. * Define a property.
  1920. */
  1921. function def (obj, key, val, enumerable) {
  1922. Object.defineProperty(obj, key, {
  1923. value: val,
  1924. enumerable: !!enumerable,
  1925. writable: true,
  1926. configurable: true
  1927. });
  1928. }
  1929. /**
  1930. * Parse simple path.
  1931. */
  1932. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  1933. function parsePath (path) {
  1934. if (bailRE.test(path)) {
  1935. return
  1936. }
  1937. var segments = path.split('.');
  1938. return function (obj) {
  1939. for (var i = 0; i < segments.length; i++) {
  1940. if (!obj) { return }
  1941. obj = obj[segments[i]];
  1942. }
  1943. return obj
  1944. }
  1945. }
  1946. /* */
  1947. // can we use __proto__?
  1948. var hasProto = '__proto__' in {};
  1949. // Browser environment sniffing
  1950. var inBrowser = typeof window !== 'undefined';
  1951. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  1952. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  1953. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  1954. var isIE = UA && /msie|trident/.test(UA);
  1955. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  1956. var isEdge = UA && UA.indexOf('edge/') > 0;
  1957. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  1958. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  1959. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  1960. var isPhantomJS = UA && /phantomjs/.test(UA);
  1961. var isFF = UA && UA.match(/firefox\/(\d+)/);
  1962. // Firefox has a "watch" function on Object.prototype...
  1963. var nativeWatch = ({}).watch;
  1964. if (inBrowser) {
  1965. try {
  1966. var opts = {};
  1967. Object.defineProperty(opts, 'passive', ({
  1968. get: function get () {
  1969. }
  1970. })); // https://github.com/facebook/flow/issues/285
  1971. window.addEventListener('test-passive', null, opts);
  1972. } catch (e) {}
  1973. }
  1974. // this needs to be lazy-evaled because vue may be required before
  1975. // vue-server-renderer can set VUE_ENV
  1976. var _isServer;
  1977. var isServerRendering = function () {
  1978. if (_isServer === undefined) {
  1979. /* istanbul ignore if */
  1980. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  1981. // detect presence of vue-server-renderer and avoid
  1982. // Webpack shimming the process
  1983. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  1984. } else {
  1985. _isServer = false;
  1986. }
  1987. }
  1988. return _isServer
  1989. };
  1990. // detect devtools
  1991. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  1992. /* istanbul ignore next */
  1993. function isNative (Ctor) {
  1994. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  1995. }
  1996. var hasSymbol =
  1997. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  1998. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  1999. var _Set;
  2000. /* istanbul ignore if */ // $flow-disable-line
  2001. if (typeof Set !== 'undefined' && isNative(Set)) {
  2002. // use native Set when available.
  2003. _Set = Set;
  2004. } else {
  2005. // a non-standard Set polyfill that only works with primitive keys.
  2006. _Set = /*@__PURE__*/(function () {
  2007. function Set () {
  2008. this.set = Object.create(null);
  2009. }
  2010. Set.prototype.has = function has (key) {
  2011. return this.set[key] === true
  2012. };
  2013. Set.prototype.add = function add (key) {
  2014. this.set[key] = true;
  2015. };
  2016. Set.prototype.clear = function clear () {
  2017. this.set = Object.create(null);
  2018. };
  2019. return Set;
  2020. }());
  2021. }
  2022. /* */
  2023. var warn = noop;
  2024. var tip = noop;
  2025. var generateComponentTrace = (noop); // work around flow check
  2026. var formatComponentName = (noop);
  2027. if (true) {
  2028. var hasConsole = typeof console !== 'undefined';
  2029. var classifyRE = /(?:^|[-_])(\w)/g;
  2030. var classify = function (str) { return str
  2031. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  2032. .replace(/[-_]/g, ''); };
  2033. warn = function (msg, vm) {
  2034. var trace = vm ? generateComponentTrace(vm) : '';
  2035. if (config.warnHandler) {
  2036. config.warnHandler.call(null, msg, vm, trace);
  2037. } else if (hasConsole && (!config.silent)) {
  2038. console.error(("[Vue warn]: " + msg + trace));
  2039. }
  2040. };
  2041. tip = function (msg, vm) {
  2042. if (hasConsole && (!config.silent)) {
  2043. console.warn("[Vue tip]: " + msg + (
  2044. vm ? generateComponentTrace(vm) : ''
  2045. ));
  2046. }
  2047. };
  2048. formatComponentName = function (vm, includeFile) {
  2049. if (vm.$root === vm) {
  2050. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  2051. return ('') + vm.$options.__file
  2052. }
  2053. return '<Root>'
  2054. }
  2055. var options = typeof vm === 'function' && vm.cid != null
  2056. ? vm.options
  2057. : vm._isVue
  2058. ? vm.$options || vm.constructor.options
  2059. : vm;
  2060. var name = options.name || options._componentTag;
  2061. var file = options.__file;
  2062. if (!name && file) {
  2063. var match = file.match(/([^/\\]+)\.vue$/);
  2064. name = match && match[1];
  2065. }
  2066. return (
  2067. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  2068. (file && includeFile !== false ? (" at " + file) : '')
  2069. )
  2070. };
  2071. var repeat = function (str, n) {
  2072. var res = '';
  2073. while (n) {
  2074. if (n % 2 === 1) { res += str; }
  2075. if (n > 1) { str += str; }
  2076. n >>= 1;
  2077. }
  2078. return res
  2079. };
  2080. generateComponentTrace = function (vm) {
  2081. if (vm._isVue && vm.$parent) {
  2082. var tree = [];
  2083. var currentRecursiveSequence = 0;
  2084. while (vm && vm.$options.name !== 'PageBody') {
  2085. if (tree.length > 0) {
  2086. var last = tree[tree.length - 1];
  2087. if (last.constructor === vm.constructor) {
  2088. currentRecursiveSequence++;
  2089. vm = vm.$parent;
  2090. continue
  2091. } else if (currentRecursiveSequence > 0) {
  2092. tree[tree.length - 1] = [last, currentRecursiveSequence];
  2093. currentRecursiveSequence = 0;
  2094. }
  2095. }
  2096. !vm.$options.isReserved && tree.push(vm);
  2097. vm = vm.$parent;
  2098. }
  2099. return '\n\nfound in\n\n' + tree
  2100. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  2101. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  2102. : formatComponentName(vm))); })
  2103. .join('\n')
  2104. } else {
  2105. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  2106. }
  2107. };
  2108. }
  2109. /* */
  2110. var uid = 0;
  2111. /**
  2112. * A dep is an observable that can have multiple
  2113. * directives subscribing to it.
  2114. */
  2115. var Dep = function Dep () {
  2116. this.id = uid++;
  2117. this.subs = [];
  2118. };
  2119. Dep.prototype.addSub = function addSub (sub) {
  2120. this.subs.push(sub);
  2121. };
  2122. Dep.prototype.removeSub = function removeSub (sub) {
  2123. remove(this.subs, sub);
  2124. };
  2125. Dep.prototype.depend = function depend () {
  2126. if (Dep.SharedObject.target) {
  2127. Dep.SharedObject.target.addDep(this);
  2128. }
  2129. };
  2130. Dep.prototype.notify = function notify () {
  2131. // stabilize the subscriber list first
  2132. var subs = this.subs.slice();
  2133. if ( true && !config.async) {
  2134. // subs aren't sorted in scheduler if not running async
  2135. // we need to sort them now to make sure they fire in correct
  2136. // order
  2137. subs.sort(function (a, b) { return a.id - b.id; });
  2138. }
  2139. for (var i = 0, l = subs.length; i < l; i++) {
  2140. subs[i].update();
  2141. }
  2142. };
  2143. // The current target watcher being evaluated.
  2144. // This is globally unique because only one watcher
  2145. // can be evaluated at a time.
  2146. // fixed by xxxxxx (nvue shared vuex)
  2147. /* eslint-disable no-undef */
  2148. Dep.SharedObject = {};
  2149. Dep.SharedObject.target = null;
  2150. Dep.SharedObject.targetStack = [];
  2151. function pushTarget (target) {
  2152. Dep.SharedObject.targetStack.push(target);
  2153. Dep.SharedObject.target = target;
  2154. Dep.target = target;
  2155. }
  2156. function popTarget () {
  2157. Dep.SharedObject.targetStack.pop();
  2158. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  2159. Dep.target = Dep.SharedObject.target;
  2160. }
  2161. /* */
  2162. var VNode = function VNode (
  2163. tag,
  2164. data,
  2165. children,
  2166. text,
  2167. elm,
  2168. context,
  2169. componentOptions,
  2170. asyncFactory
  2171. ) {
  2172. this.tag = tag;
  2173. this.data = data;
  2174. this.children = children;
  2175. this.text = text;
  2176. this.elm = elm;
  2177. this.ns = undefined;
  2178. this.context = context;
  2179. this.fnContext = undefined;
  2180. this.fnOptions = undefined;
  2181. this.fnScopeId = undefined;
  2182. this.key = data && data.key;
  2183. this.componentOptions = componentOptions;
  2184. this.componentInstance = undefined;
  2185. this.parent = undefined;
  2186. this.raw = false;
  2187. this.isStatic = false;
  2188. this.isRootInsert = true;
  2189. this.isComment = false;
  2190. this.isCloned = false;
  2191. this.isOnce = false;
  2192. this.asyncFactory = asyncFactory;
  2193. this.asyncMeta = undefined;
  2194. this.isAsyncPlaceholder = false;
  2195. };
  2196. var prototypeAccessors = { child: { configurable: true } };
  2197. // DEPRECATED: alias for componentInstance for backwards compat.
  2198. /* istanbul ignore next */
  2199. prototypeAccessors.child.get = function () {
  2200. return this.componentInstance
  2201. };
  2202. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2203. var createEmptyVNode = function (text) {
  2204. if ( text === void 0 ) text = '';
  2205. var node = new VNode();
  2206. node.text = text;
  2207. node.isComment = true;
  2208. return node
  2209. };
  2210. function createTextVNode (val) {
  2211. return new VNode(undefined, undefined, undefined, String(val))
  2212. }
  2213. // optimized shallow clone
  2214. // used for static nodes and slot nodes because they may be reused across
  2215. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2216. // on their elm reference.
  2217. function cloneVNode (vnode) {
  2218. var cloned = new VNode(
  2219. vnode.tag,
  2220. vnode.data,
  2221. // #7975
  2222. // clone children array to avoid mutating original in case of cloning
  2223. // a child.
  2224. vnode.children && vnode.children.slice(),
  2225. vnode.text,
  2226. vnode.elm,
  2227. vnode.context,
  2228. vnode.componentOptions,
  2229. vnode.asyncFactory
  2230. );
  2231. cloned.ns = vnode.ns;
  2232. cloned.isStatic = vnode.isStatic;
  2233. cloned.key = vnode.key;
  2234. cloned.isComment = vnode.isComment;
  2235. cloned.fnContext = vnode.fnContext;
  2236. cloned.fnOptions = vnode.fnOptions;
  2237. cloned.fnScopeId = vnode.fnScopeId;
  2238. cloned.asyncMeta = vnode.asyncMeta;
  2239. cloned.isCloned = true;
  2240. return cloned
  2241. }
  2242. /*
  2243. * not type checking this file because flow doesn't play well with
  2244. * dynamically accessing methods on Array prototype
  2245. */
  2246. var arrayProto = Array.prototype;
  2247. var arrayMethods = Object.create(arrayProto);
  2248. var methodsToPatch = [
  2249. 'push',
  2250. 'pop',
  2251. 'shift',
  2252. 'unshift',
  2253. 'splice',
  2254. 'sort',
  2255. 'reverse'
  2256. ];
  2257. /**
  2258. * Intercept mutating methods and emit events
  2259. */
  2260. methodsToPatch.forEach(function (method) {
  2261. // cache original method
  2262. var original = arrayProto[method];
  2263. def(arrayMethods, method, function mutator () {
  2264. var args = [], len = arguments.length;
  2265. while ( len-- ) args[ len ] = arguments[ len ];
  2266. var result = original.apply(this, args);
  2267. var ob = this.__ob__;
  2268. var inserted;
  2269. switch (method) {
  2270. case 'push':
  2271. case 'unshift':
  2272. inserted = args;
  2273. break
  2274. case 'splice':
  2275. inserted = args.slice(2);
  2276. break
  2277. }
  2278. if (inserted) { ob.observeArray(inserted); }
  2279. // notify change
  2280. ob.dep.notify();
  2281. return result
  2282. });
  2283. });
  2284. /* */
  2285. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2286. /**
  2287. * In some cases we may want to disable observation inside a component's
  2288. * update computation.
  2289. */
  2290. var shouldObserve = true;
  2291. function toggleObserving (value) {
  2292. shouldObserve = value;
  2293. }
  2294. /**
  2295. * Observer class that is attached to each observed
  2296. * object. Once attached, the observer converts the target
  2297. * object's property keys into getter/setters that
  2298. * collect dependencies and dispatch updates.
  2299. */
  2300. var Observer = function Observer (value) {
  2301. this.value = value;
  2302. this.dep = new Dep();
  2303. this.vmCount = 0;
  2304. def(value, '__ob__', this);
  2305. if (Array.isArray(value)) {
  2306. if (hasProto) {
  2307. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  2308. if(value.push !== value.__proto__.push){
  2309. copyAugment(value, arrayMethods, arrayKeys);
  2310. } else {
  2311. protoAugment(value, arrayMethods);
  2312. }
  2313. }
  2314. } else {
  2315. copyAugment(value, arrayMethods, arrayKeys);
  2316. }
  2317. this.observeArray(value);
  2318. } else {
  2319. this.walk(value);
  2320. }
  2321. };
  2322. /**
  2323. * Walk through all properties and convert them into
  2324. * getter/setters. This method should only be called when
  2325. * value type is Object.
  2326. */
  2327. Observer.prototype.walk = function walk (obj) {
  2328. var keys = Object.keys(obj);
  2329. for (var i = 0; i < keys.length; i++) {
  2330. defineReactive$$1(obj, keys[i]);
  2331. }
  2332. };
  2333. /**
  2334. * Observe a list of Array items.
  2335. */
  2336. Observer.prototype.observeArray = function observeArray (items) {
  2337. for (var i = 0, l = items.length; i < l; i++) {
  2338. observe(items[i]);
  2339. }
  2340. };
  2341. // helpers
  2342. /**
  2343. * Augment a target Object or Array by intercepting
  2344. * the prototype chain using __proto__
  2345. */
  2346. function protoAugment (target, src) {
  2347. /* eslint-disable no-proto */
  2348. target.__proto__ = src;
  2349. /* eslint-enable no-proto */
  2350. }
  2351. /**
  2352. * Augment a target Object or Array by defining
  2353. * hidden properties.
  2354. */
  2355. /* istanbul ignore next */
  2356. function copyAugment (target, src, keys) {
  2357. for (var i = 0, l = keys.length; i < l; i++) {
  2358. var key = keys[i];
  2359. def(target, key, src[key]);
  2360. }
  2361. }
  2362. /**
  2363. * Attempt to create an observer instance for a value,
  2364. * returns the new observer if successfully observed,
  2365. * or the existing observer if the value already has one.
  2366. */
  2367. function observe (value, asRootData) {
  2368. if (!isObject(value) || value instanceof VNode) {
  2369. return
  2370. }
  2371. var ob;
  2372. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2373. ob = value.__ob__;
  2374. } else if (
  2375. shouldObserve &&
  2376. !isServerRendering() &&
  2377. (Array.isArray(value) || isPlainObject(value)) &&
  2378. Object.isExtensible(value) &&
  2379. !value._isVue
  2380. ) {
  2381. ob = new Observer(value);
  2382. }
  2383. if (asRootData && ob) {
  2384. ob.vmCount++;
  2385. }
  2386. return ob
  2387. }
  2388. /**
  2389. * Define a reactive property on an Object.
  2390. */
  2391. function defineReactive$$1 (
  2392. obj,
  2393. key,
  2394. val,
  2395. customSetter,
  2396. shallow
  2397. ) {
  2398. var dep = new Dep();
  2399. var property = Object.getOwnPropertyDescriptor(obj, key);
  2400. if (property && property.configurable === false) {
  2401. return
  2402. }
  2403. // cater for pre-defined getter/setters
  2404. var getter = property && property.get;
  2405. var setter = property && property.set;
  2406. if ((!getter || setter) && arguments.length === 2) {
  2407. val = obj[key];
  2408. }
  2409. var childOb = !shallow && observe(val);
  2410. Object.defineProperty(obj, key, {
  2411. enumerable: true,
  2412. configurable: true,
  2413. get: function reactiveGetter () {
  2414. var value = getter ? getter.call(obj) : val;
  2415. if (Dep.SharedObject.target) { // fixed by xxxxxx
  2416. dep.depend();
  2417. if (childOb) {
  2418. childOb.dep.depend();
  2419. if (Array.isArray(value)) {
  2420. dependArray(value);
  2421. }
  2422. }
  2423. }
  2424. return value
  2425. },
  2426. set: function reactiveSetter (newVal) {
  2427. var value = getter ? getter.call(obj) : val;
  2428. /* eslint-disable no-self-compare */
  2429. if (newVal === value || (newVal !== newVal && value !== value)) {
  2430. return
  2431. }
  2432. /* eslint-enable no-self-compare */
  2433. if ( true && customSetter) {
  2434. customSetter();
  2435. }
  2436. // #7981: for accessor properties without setter
  2437. if (getter && !setter) { return }
  2438. if (setter) {
  2439. setter.call(obj, newVal);
  2440. } else {
  2441. val = newVal;
  2442. }
  2443. childOb = !shallow && observe(newVal);
  2444. dep.notify();
  2445. }
  2446. });
  2447. }
  2448. /**
  2449. * Set a property on an object. Adds the new property and
  2450. * triggers change notification if the property doesn't
  2451. * already exist.
  2452. */
  2453. function set (target, key, val) {
  2454. if ( true &&
  2455. (isUndef(target) || isPrimitive(target))
  2456. ) {
  2457. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2458. }
  2459. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2460. target.length = Math.max(target.length, key);
  2461. target.splice(key, 1, val);
  2462. return val
  2463. }
  2464. if (key in target && !(key in Object.prototype)) {
  2465. target[key] = val;
  2466. return val
  2467. }
  2468. var ob = (target).__ob__;
  2469. if (target._isVue || (ob && ob.vmCount)) {
  2470. true && warn(
  2471. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2472. 'at runtime - declare it upfront in the data option.'
  2473. );
  2474. return val
  2475. }
  2476. if (!ob) {
  2477. target[key] = val;
  2478. return val
  2479. }
  2480. defineReactive$$1(ob.value, key, val);
  2481. ob.dep.notify();
  2482. return val
  2483. }
  2484. /**
  2485. * Delete a property and trigger change if necessary.
  2486. */
  2487. function del (target, key) {
  2488. if ( true &&
  2489. (isUndef(target) || isPrimitive(target))
  2490. ) {
  2491. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2492. }
  2493. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2494. target.splice(key, 1);
  2495. return
  2496. }
  2497. var ob = (target).__ob__;
  2498. if (target._isVue || (ob && ob.vmCount)) {
  2499. true && warn(
  2500. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2501. '- just set it to null.'
  2502. );
  2503. return
  2504. }
  2505. if (!hasOwn(target, key)) {
  2506. return
  2507. }
  2508. delete target[key];
  2509. if (!ob) {
  2510. return
  2511. }
  2512. ob.dep.notify();
  2513. }
  2514. /**
  2515. * Collect dependencies on array elements when the array is touched, since
  2516. * we cannot intercept array element access like property getters.
  2517. */
  2518. function dependArray (value) {
  2519. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2520. e = value[i];
  2521. e && e.__ob__ && e.__ob__.dep.depend();
  2522. if (Array.isArray(e)) {
  2523. dependArray(e);
  2524. }
  2525. }
  2526. }
  2527. /* */
  2528. /**
  2529. * Option overwriting strategies are functions that handle
  2530. * how to merge a parent option value and a child option
  2531. * value into the final value.
  2532. */
  2533. var strats = config.optionMergeStrategies;
  2534. /**
  2535. * Options with restrictions
  2536. */
  2537. if (true) {
  2538. strats.el = strats.propsData = function (parent, child, vm, key) {
  2539. if (!vm) {
  2540. warn(
  2541. "option \"" + key + "\" can only be used during instance " +
  2542. 'creation with the `new` keyword.'
  2543. );
  2544. }
  2545. return defaultStrat(parent, child)
  2546. };
  2547. }
  2548. /**
  2549. * Helper that recursively merges two data objects together.
  2550. */
  2551. function mergeData (to, from) {
  2552. if (!from) { return to }
  2553. var key, toVal, fromVal;
  2554. var keys = hasSymbol
  2555. ? Reflect.ownKeys(from)
  2556. : Object.keys(from);
  2557. for (var i = 0; i < keys.length; i++) {
  2558. key = keys[i];
  2559. // in case the object is already observed...
  2560. if (key === '__ob__') { continue }
  2561. toVal = to[key];
  2562. fromVal = from[key];
  2563. if (!hasOwn(to, key)) {
  2564. set(to, key, fromVal);
  2565. } else if (
  2566. toVal !== fromVal &&
  2567. isPlainObject(toVal) &&
  2568. isPlainObject(fromVal)
  2569. ) {
  2570. mergeData(toVal, fromVal);
  2571. }
  2572. }
  2573. return to
  2574. }
  2575. /**
  2576. * Data
  2577. */
  2578. function mergeDataOrFn (
  2579. parentVal,
  2580. childVal,
  2581. vm
  2582. ) {
  2583. if (!vm) {
  2584. // in a Vue.extend merge, both should be functions
  2585. if (!childVal) {
  2586. return parentVal
  2587. }
  2588. if (!parentVal) {
  2589. return childVal
  2590. }
  2591. // when parentVal & childVal are both present,
  2592. // we need to return a function that returns the
  2593. // merged result of both functions... no need to
  2594. // check if parentVal is a function here because
  2595. // it has to be a function to pass previous merges.
  2596. return function mergedDataFn () {
  2597. return mergeData(
  2598. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2599. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2600. )
  2601. }
  2602. } else {
  2603. return function mergedInstanceDataFn () {
  2604. // instance merge
  2605. var instanceData = typeof childVal === 'function'
  2606. ? childVal.call(vm, vm)
  2607. : childVal;
  2608. var defaultData = typeof parentVal === 'function'
  2609. ? parentVal.call(vm, vm)
  2610. : parentVal;
  2611. if (instanceData) {
  2612. return mergeData(instanceData, defaultData)
  2613. } else {
  2614. return defaultData
  2615. }
  2616. }
  2617. }
  2618. }
  2619. strats.data = function (
  2620. parentVal,
  2621. childVal,
  2622. vm
  2623. ) {
  2624. if (!vm) {
  2625. if (childVal && typeof childVal !== 'function') {
  2626. true && warn(
  2627. 'The "data" option should be a function ' +
  2628. 'that returns a per-instance value in component ' +
  2629. 'definitions.',
  2630. vm
  2631. );
  2632. return parentVal
  2633. }
  2634. return mergeDataOrFn(parentVal, childVal)
  2635. }
  2636. return mergeDataOrFn(parentVal, childVal, vm)
  2637. };
  2638. /**
  2639. * Hooks and props are merged as arrays.
  2640. */
  2641. function mergeHook (
  2642. parentVal,
  2643. childVal
  2644. ) {
  2645. var res = childVal
  2646. ? parentVal
  2647. ? parentVal.concat(childVal)
  2648. : Array.isArray(childVal)
  2649. ? childVal
  2650. : [childVal]
  2651. : parentVal;
  2652. return res
  2653. ? dedupeHooks(res)
  2654. : res
  2655. }
  2656. function dedupeHooks (hooks) {
  2657. var res = [];
  2658. for (var i = 0; i < hooks.length; i++) {
  2659. if (res.indexOf(hooks[i]) === -1) {
  2660. res.push(hooks[i]);
  2661. }
  2662. }
  2663. return res
  2664. }
  2665. LIFECYCLE_HOOKS.forEach(function (hook) {
  2666. strats[hook] = mergeHook;
  2667. });
  2668. /**
  2669. * Assets
  2670. *
  2671. * When a vm is present (instance creation), we need to do
  2672. * a three-way merge between constructor options, instance
  2673. * options and parent options.
  2674. */
  2675. function mergeAssets (
  2676. parentVal,
  2677. childVal,
  2678. vm,
  2679. key
  2680. ) {
  2681. var res = Object.create(parentVal || null);
  2682. if (childVal) {
  2683. true && assertObjectType(key, childVal, vm);
  2684. return extend(res, childVal)
  2685. } else {
  2686. return res
  2687. }
  2688. }
  2689. ASSET_TYPES.forEach(function (type) {
  2690. strats[type + 's'] = mergeAssets;
  2691. });
  2692. /**
  2693. * Watchers.
  2694. *
  2695. * Watchers hashes should not overwrite one
  2696. * another, so we merge them as arrays.
  2697. */
  2698. strats.watch = function (
  2699. parentVal,
  2700. childVal,
  2701. vm,
  2702. key
  2703. ) {
  2704. // work around Firefox's Object.prototype.watch...
  2705. if (parentVal === nativeWatch) { parentVal = undefined; }
  2706. if (childVal === nativeWatch) { childVal = undefined; }
  2707. /* istanbul ignore if */
  2708. if (!childVal) { return Object.create(parentVal || null) }
  2709. if (true) {
  2710. assertObjectType(key, childVal, vm);
  2711. }
  2712. if (!parentVal) { return childVal }
  2713. var ret = {};
  2714. extend(ret, parentVal);
  2715. for (var key$1 in childVal) {
  2716. var parent = ret[key$1];
  2717. var child = childVal[key$1];
  2718. if (parent && !Array.isArray(parent)) {
  2719. parent = [parent];
  2720. }
  2721. ret[key$1] = parent
  2722. ? parent.concat(child)
  2723. : Array.isArray(child) ? child : [child];
  2724. }
  2725. return ret
  2726. };
  2727. /**
  2728. * Other object hashes.
  2729. */
  2730. strats.props =
  2731. strats.methods =
  2732. strats.inject =
  2733. strats.computed = function (
  2734. parentVal,
  2735. childVal,
  2736. vm,
  2737. key
  2738. ) {
  2739. if (childVal && "development" !== 'production') {
  2740. assertObjectType(key, childVal, vm);
  2741. }
  2742. if (!parentVal) { return childVal }
  2743. var ret = Object.create(null);
  2744. extend(ret, parentVal);
  2745. if (childVal) { extend(ret, childVal); }
  2746. return ret
  2747. };
  2748. strats.provide = mergeDataOrFn;
  2749. /**
  2750. * Default strategy.
  2751. */
  2752. var defaultStrat = function (parentVal, childVal) {
  2753. return childVal === undefined
  2754. ? parentVal
  2755. : childVal
  2756. };
  2757. /**
  2758. * Validate component names
  2759. */
  2760. function checkComponents (options) {
  2761. for (var key in options.components) {
  2762. validateComponentName(key);
  2763. }
  2764. }
  2765. function validateComponentName (name) {
  2766. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  2767. warn(
  2768. 'Invalid component name: "' + name + '". Component names ' +
  2769. 'should conform to valid custom element name in html5 specification.'
  2770. );
  2771. }
  2772. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2773. warn(
  2774. 'Do not use built-in or reserved HTML elements as component ' +
  2775. 'id: ' + name
  2776. );
  2777. }
  2778. }
  2779. /**
  2780. * Ensure all props option syntax are normalized into the
  2781. * Object-based format.
  2782. */
  2783. function normalizeProps (options, vm) {
  2784. var props = options.props;
  2785. if (!props) { return }
  2786. var res = {};
  2787. var i, val, name;
  2788. if (Array.isArray(props)) {
  2789. i = props.length;
  2790. while (i--) {
  2791. val = props[i];
  2792. if (typeof val === 'string') {
  2793. name = camelize(val);
  2794. res[name] = { type: null };
  2795. } else if (true) {
  2796. warn('props must be strings when using array syntax.');
  2797. }
  2798. }
  2799. } else if (isPlainObject(props)) {
  2800. for (var key in props) {
  2801. val = props[key];
  2802. name = camelize(key);
  2803. res[name] = isPlainObject(val)
  2804. ? val
  2805. : { type: val };
  2806. }
  2807. } else if (true) {
  2808. warn(
  2809. "Invalid value for option \"props\": expected an Array or an Object, " +
  2810. "but got " + (toRawType(props)) + ".",
  2811. vm
  2812. );
  2813. }
  2814. options.props = res;
  2815. }
  2816. /**
  2817. * Normalize all injections into Object-based format
  2818. */
  2819. function normalizeInject (options, vm) {
  2820. var inject = options.inject;
  2821. if (!inject) { return }
  2822. var normalized = options.inject = {};
  2823. if (Array.isArray(inject)) {
  2824. for (var i = 0; i < inject.length; i++) {
  2825. normalized[inject[i]] = { from: inject[i] };
  2826. }
  2827. } else if (isPlainObject(inject)) {
  2828. for (var key in inject) {
  2829. var val = inject[key];
  2830. normalized[key] = isPlainObject(val)
  2831. ? extend({ from: key }, val)
  2832. : { from: val };
  2833. }
  2834. } else if (true) {
  2835. warn(
  2836. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2837. "but got " + (toRawType(inject)) + ".",
  2838. vm
  2839. );
  2840. }
  2841. }
  2842. /**
  2843. * Normalize raw function directives into object format.
  2844. */
  2845. function normalizeDirectives (options) {
  2846. var dirs = options.directives;
  2847. if (dirs) {
  2848. for (var key in dirs) {
  2849. var def$$1 = dirs[key];
  2850. if (typeof def$$1 === 'function') {
  2851. dirs[key] = { bind: def$$1, update: def$$1 };
  2852. }
  2853. }
  2854. }
  2855. }
  2856. function assertObjectType (name, value, vm) {
  2857. if (!isPlainObject(value)) {
  2858. warn(
  2859. "Invalid value for option \"" + name + "\": expected an Object, " +
  2860. "but got " + (toRawType(value)) + ".",
  2861. vm
  2862. );
  2863. }
  2864. }
  2865. /**
  2866. * Merge two option objects into a new one.
  2867. * Core utility used in both instantiation and inheritance.
  2868. */
  2869. function mergeOptions (
  2870. parent,
  2871. child,
  2872. vm
  2873. ) {
  2874. if (true) {
  2875. checkComponents(child);
  2876. }
  2877. if (typeof child === 'function') {
  2878. child = child.options;
  2879. }
  2880. normalizeProps(child, vm);
  2881. normalizeInject(child, vm);
  2882. normalizeDirectives(child);
  2883. // Apply extends and mixins on the child options,
  2884. // but only if it is a raw options object that isn't
  2885. // the result of another mergeOptions call.
  2886. // Only merged options has the _base property.
  2887. if (!child._base) {
  2888. if (child.extends) {
  2889. parent = mergeOptions(parent, child.extends, vm);
  2890. }
  2891. if (child.mixins) {
  2892. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2893. parent = mergeOptions(parent, child.mixins[i], vm);
  2894. }
  2895. }
  2896. }
  2897. var options = {};
  2898. var key;
  2899. for (key in parent) {
  2900. mergeField(key);
  2901. }
  2902. for (key in child) {
  2903. if (!hasOwn(parent, key)) {
  2904. mergeField(key);
  2905. }
  2906. }
  2907. function mergeField (key) {
  2908. var strat = strats[key] || defaultStrat;
  2909. options[key] = strat(parent[key], child[key], vm, key);
  2910. }
  2911. return options
  2912. }
  2913. /**
  2914. * Resolve an asset.
  2915. * This function is used because child instances need access
  2916. * to assets defined in its ancestor chain.
  2917. */
  2918. function resolveAsset (
  2919. options,
  2920. type,
  2921. id,
  2922. warnMissing
  2923. ) {
  2924. /* istanbul ignore if */
  2925. if (typeof id !== 'string') {
  2926. return
  2927. }
  2928. var assets = options[type];
  2929. // check local registration variations first
  2930. if (hasOwn(assets, id)) { return assets[id] }
  2931. var camelizedId = camelize(id);
  2932. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  2933. var PascalCaseId = capitalize(camelizedId);
  2934. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  2935. // fallback to prototype chain
  2936. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  2937. if ( true && warnMissing && !res) {
  2938. warn(
  2939. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2940. options
  2941. );
  2942. }
  2943. return res
  2944. }
  2945. /* */
  2946. function validateProp (
  2947. key,
  2948. propOptions,
  2949. propsData,
  2950. vm
  2951. ) {
  2952. var prop = propOptions[key];
  2953. var absent = !hasOwn(propsData, key);
  2954. var value = propsData[key];
  2955. // boolean casting
  2956. var booleanIndex = getTypeIndex(Boolean, prop.type);
  2957. if (booleanIndex > -1) {
  2958. if (absent && !hasOwn(prop, 'default')) {
  2959. value = false;
  2960. } else if (value === '' || value === hyphenate(key)) {
  2961. // only cast empty string / same name to boolean if
  2962. // boolean has higher priority
  2963. var stringIndex = getTypeIndex(String, prop.type);
  2964. if (stringIndex < 0 || booleanIndex < stringIndex) {
  2965. value = true;
  2966. }
  2967. }
  2968. }
  2969. // check default value
  2970. if (value === undefined) {
  2971. value = getPropDefaultValue(vm, prop, key);
  2972. // since the default value is a fresh copy,
  2973. // make sure to observe it.
  2974. var prevShouldObserve = shouldObserve;
  2975. toggleObserving(true);
  2976. observe(value);
  2977. toggleObserving(prevShouldObserve);
  2978. }
  2979. if (
  2980. true
  2981. ) {
  2982. assertProp(prop, key, value, vm, absent);
  2983. }
  2984. return value
  2985. }
  2986. /**
  2987. * Get the default value of a prop.
  2988. */
  2989. function getPropDefaultValue (vm, prop, key) {
  2990. // no default, return undefined
  2991. if (!hasOwn(prop, 'default')) {
  2992. return undefined
  2993. }
  2994. var def = prop.default;
  2995. // warn against non-factory defaults for Object & Array
  2996. if ( true && isObject(def)) {
  2997. warn(
  2998. 'Invalid default value for prop "' + key + '": ' +
  2999. 'Props with type Object/Array must use a factory function ' +
  3000. 'to return the default value.',
  3001. vm
  3002. );
  3003. }
  3004. // the raw prop value was also undefined from previous render,
  3005. // return previous default value to avoid unnecessary watcher trigger
  3006. if (vm && vm.$options.propsData &&
  3007. vm.$options.propsData[key] === undefined &&
  3008. vm._props[key] !== undefined
  3009. ) {
  3010. return vm._props[key]
  3011. }
  3012. // call factory function for non-Function types
  3013. // a value is Function if its prototype is function even across different execution context
  3014. return typeof def === 'function' && getType(prop.type) !== 'Function'
  3015. ? def.call(vm)
  3016. : def
  3017. }
  3018. /**
  3019. * Assert whether a prop is valid.
  3020. */
  3021. function assertProp (
  3022. prop,
  3023. name,
  3024. value,
  3025. vm,
  3026. absent
  3027. ) {
  3028. if (prop.required && absent) {
  3029. warn(
  3030. 'Missing required prop: "' + name + '"',
  3031. vm
  3032. );
  3033. return
  3034. }
  3035. if (value == null && !prop.required) {
  3036. return
  3037. }
  3038. var type = prop.type;
  3039. var valid = !type || type === true;
  3040. var expectedTypes = [];
  3041. if (type) {
  3042. if (!Array.isArray(type)) {
  3043. type = [type];
  3044. }
  3045. for (var i = 0; i < type.length && !valid; i++) {
  3046. var assertedType = assertType(value, type[i]);
  3047. expectedTypes.push(assertedType.expectedType || '');
  3048. valid = assertedType.valid;
  3049. }
  3050. }
  3051. if (!valid) {
  3052. warn(
  3053. getInvalidTypeMessage(name, value, expectedTypes),
  3054. vm
  3055. );
  3056. return
  3057. }
  3058. var validator = prop.validator;
  3059. if (validator) {
  3060. if (!validator(value)) {
  3061. warn(
  3062. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  3063. vm
  3064. );
  3065. }
  3066. }
  3067. }
  3068. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  3069. function assertType (value, type) {
  3070. var valid;
  3071. var expectedType = getType(type);
  3072. if (simpleCheckRE.test(expectedType)) {
  3073. var t = typeof value;
  3074. valid = t === expectedType.toLowerCase();
  3075. // for primitive wrapper objects
  3076. if (!valid && t === 'object') {
  3077. valid = value instanceof type;
  3078. }
  3079. } else if (expectedType === 'Object') {
  3080. valid = isPlainObject(value);
  3081. } else if (expectedType === 'Array') {
  3082. valid = Array.isArray(value);
  3083. } else {
  3084. valid = value instanceof type;
  3085. }
  3086. return {
  3087. valid: valid,
  3088. expectedType: expectedType
  3089. }
  3090. }
  3091. /**
  3092. * Use function string name to check built-in types,
  3093. * because a simple equality check will fail when running
  3094. * across different vms / iframes.
  3095. */
  3096. function getType (fn) {
  3097. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  3098. return match ? match[1] : ''
  3099. }
  3100. function isSameType (a, b) {
  3101. return getType(a) === getType(b)
  3102. }
  3103. function getTypeIndex (type, expectedTypes) {
  3104. if (!Array.isArray(expectedTypes)) {
  3105. return isSameType(expectedTypes, type) ? 0 : -1
  3106. }
  3107. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  3108. if (isSameType(expectedTypes[i], type)) {
  3109. return i
  3110. }
  3111. }
  3112. return -1
  3113. }
  3114. function getInvalidTypeMessage (name, value, expectedTypes) {
  3115. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  3116. " Expected " + (expectedTypes.map(capitalize).join(', '));
  3117. var expectedType = expectedTypes[0];
  3118. var receivedType = toRawType(value);
  3119. var expectedValue = styleValue(value, expectedType);
  3120. var receivedValue = styleValue(value, receivedType);
  3121. // check if we need to specify expected value
  3122. if (expectedTypes.length === 1 &&
  3123. isExplicable(expectedType) &&
  3124. !isBoolean(expectedType, receivedType)) {
  3125. message += " with value " + expectedValue;
  3126. }
  3127. message += ", got " + receivedType + " ";
  3128. // check if we need to specify received value
  3129. if (isExplicable(receivedType)) {
  3130. message += "with value " + receivedValue + ".";
  3131. }
  3132. return message
  3133. }
  3134. function styleValue (value, type) {
  3135. if (type === 'String') {
  3136. return ("\"" + value + "\"")
  3137. } else if (type === 'Number') {
  3138. return ("" + (Number(value)))
  3139. } else {
  3140. return ("" + value)
  3141. }
  3142. }
  3143. function isExplicable (value) {
  3144. var explicitTypes = ['string', 'number', 'boolean'];
  3145. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  3146. }
  3147. function isBoolean () {
  3148. var args = [], len = arguments.length;
  3149. while ( len-- ) args[ len ] = arguments[ len ];
  3150. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  3151. }
  3152. /* */
  3153. function handleError (err, vm, info) {
  3154. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3155. // See: https://github.com/vuejs/vuex/issues/1505
  3156. pushTarget();
  3157. try {
  3158. if (vm) {
  3159. var cur = vm;
  3160. while ((cur = cur.$parent)) {
  3161. var hooks = cur.$options.errorCaptured;
  3162. if (hooks) {
  3163. for (var i = 0; i < hooks.length; i++) {
  3164. try {
  3165. var capture = hooks[i].call(cur, err, vm, info) === false;
  3166. if (capture) { return }
  3167. } catch (e) {
  3168. globalHandleError(e, cur, 'errorCaptured hook');
  3169. }
  3170. }
  3171. }
  3172. }
  3173. }
  3174. globalHandleError(err, vm, info);
  3175. } finally {
  3176. popTarget();
  3177. }
  3178. }
  3179. function invokeWithErrorHandling (
  3180. handler,
  3181. context,
  3182. args,
  3183. vm,
  3184. info
  3185. ) {
  3186. var res;
  3187. try {
  3188. res = args ? handler.apply(context, args) : handler.call(context);
  3189. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3190. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3191. // issue #9511
  3192. // avoid catch triggering multiple times when nested calls
  3193. res._handled = true;
  3194. }
  3195. } catch (e) {
  3196. handleError(e, vm, info);
  3197. }
  3198. return res
  3199. }
  3200. function globalHandleError (err, vm, info) {
  3201. if (config.errorHandler) {
  3202. try {
  3203. return config.errorHandler.call(null, err, vm, info)
  3204. } catch (e) {
  3205. // if the user intentionally throws the original error in the handler,
  3206. // do not log it twice
  3207. if (e !== err) {
  3208. logError(e, null, 'config.errorHandler');
  3209. }
  3210. }
  3211. }
  3212. logError(err, vm, info);
  3213. }
  3214. function logError (err, vm, info) {
  3215. if (true) {
  3216. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3217. }
  3218. /* istanbul ignore else */
  3219. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3220. console.error(err);
  3221. } else {
  3222. throw err
  3223. }
  3224. }
  3225. /* */
  3226. var callbacks = [];
  3227. var pending = false;
  3228. function flushCallbacks () {
  3229. pending = false;
  3230. var copies = callbacks.slice(0);
  3231. callbacks.length = 0;
  3232. for (var i = 0; i < copies.length; i++) {
  3233. copies[i]();
  3234. }
  3235. }
  3236. // Here we have async deferring wrappers using microtasks.
  3237. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3238. // However, it has subtle problems when state is changed right before repaint
  3239. // (e.g. #6813, out-in transitions).
  3240. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3241. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3242. // So we now use microtasks everywhere, again.
  3243. // A major drawback of this tradeoff is that there are some scenarios
  3244. // where microtasks have too high a priority and fire in between supposedly
  3245. // sequential events (e.g. #4521, #6690, which have workarounds)
  3246. // or even between bubbling of the same event (#6566).
  3247. var timerFunc;
  3248. // The nextTick behavior leverages the microtask queue, which can be accessed
  3249. // via either native Promise.then or MutationObserver.
  3250. // MutationObserver has wider support, however it is seriously bugged in
  3251. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3252. // completely stops working after triggering a few times... so, if native
  3253. // Promise is available, we will use it:
  3254. /* istanbul ignore next, $flow-disable-line */
  3255. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3256. var p = Promise.resolve();
  3257. timerFunc = function () {
  3258. p.then(flushCallbacks);
  3259. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3260. // it can get stuck in a weird state where callbacks are pushed into the
  3261. // microtask queue but the queue isn't being flushed, until the browser
  3262. // needs to do some other work, e.g. handle a timer. Therefore we can
  3263. // "force" the microtask queue to be flushed by adding an empty timer.
  3264. if (isIOS) { setTimeout(noop); }
  3265. };
  3266. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  3267. isNative(MutationObserver) ||
  3268. // PhantomJS and iOS 7.x
  3269. MutationObserver.toString() === '[object MutationObserverConstructor]'
  3270. )) {
  3271. // Use MutationObserver where native Promise is not available,
  3272. // e.g. PhantomJS, iOS7, Android 4.4
  3273. // (#6466 MutationObserver is unreliable in IE11)
  3274. var counter = 1;
  3275. var observer = new MutationObserver(flushCallbacks);
  3276. var textNode = document.createTextNode(String(counter));
  3277. observer.observe(textNode, {
  3278. characterData: true
  3279. });
  3280. timerFunc = function () {
  3281. counter = (counter + 1) % 2;
  3282. textNode.data = String(counter);
  3283. };
  3284. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3285. // Fallback to setImmediate.
  3286. // Technically it leverages the (macro) task queue,
  3287. // but it is still a better choice than setTimeout.
  3288. timerFunc = function () {
  3289. setImmediate(flushCallbacks);
  3290. };
  3291. } else {
  3292. // Fallback to setTimeout.
  3293. timerFunc = function () {
  3294. setTimeout(flushCallbacks, 0);
  3295. };
  3296. }
  3297. function nextTick (cb, ctx) {
  3298. var _resolve;
  3299. callbacks.push(function () {
  3300. if (cb) {
  3301. try {
  3302. cb.call(ctx);
  3303. } catch (e) {
  3304. handleError(e, ctx, 'nextTick');
  3305. }
  3306. } else if (_resolve) {
  3307. _resolve(ctx);
  3308. }
  3309. });
  3310. if (!pending) {
  3311. pending = true;
  3312. timerFunc();
  3313. }
  3314. // $flow-disable-line
  3315. if (!cb && typeof Promise !== 'undefined') {
  3316. return new Promise(function (resolve) {
  3317. _resolve = resolve;
  3318. })
  3319. }
  3320. }
  3321. /* */
  3322. /* not type checking this file because flow doesn't play well with Proxy */
  3323. var initProxy;
  3324. if (true) {
  3325. var allowedGlobals = makeMap(
  3326. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3327. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3328. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3329. 'require' // for Webpack/Browserify
  3330. );
  3331. var warnNonPresent = function (target, key) {
  3332. warn(
  3333. "Property or method \"" + key + "\" is not defined on the instance but " +
  3334. 'referenced during render. Make sure that this property is reactive, ' +
  3335. 'either in the data option, or for class-based components, by ' +
  3336. 'initializing the property. ' +
  3337. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3338. target
  3339. );
  3340. };
  3341. var warnReservedPrefix = function (target, key) {
  3342. warn(
  3343. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3344. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3345. 'prevent conflicts with Vue internals. ' +
  3346. 'See: https://vuejs.org/v2/api/#data',
  3347. target
  3348. );
  3349. };
  3350. var hasProxy =
  3351. typeof Proxy !== 'undefined' && isNative(Proxy);
  3352. if (hasProxy) {
  3353. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3354. config.keyCodes = new Proxy(config.keyCodes, {
  3355. set: function set (target, key, value) {
  3356. if (isBuiltInModifier(key)) {
  3357. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3358. return false
  3359. } else {
  3360. target[key] = value;
  3361. return true
  3362. }
  3363. }
  3364. });
  3365. }
  3366. var hasHandler = {
  3367. has: function has (target, key) {
  3368. var has = key in target;
  3369. var isAllowed = allowedGlobals(key) ||
  3370. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3371. if (!has && !isAllowed) {
  3372. if (key in target.$data) { warnReservedPrefix(target, key); }
  3373. else { warnNonPresent(target, key); }
  3374. }
  3375. return has || !isAllowed
  3376. }
  3377. };
  3378. var getHandler = {
  3379. get: function get (target, key) {
  3380. if (typeof key === 'string' && !(key in target)) {
  3381. if (key in target.$data) { warnReservedPrefix(target, key); }
  3382. else { warnNonPresent(target, key); }
  3383. }
  3384. return target[key]
  3385. }
  3386. };
  3387. initProxy = function initProxy (vm) {
  3388. if (hasProxy) {
  3389. // determine which proxy handler to use
  3390. var options = vm.$options;
  3391. var handlers = options.render && options.render._withStripped
  3392. ? getHandler
  3393. : hasHandler;
  3394. vm._renderProxy = new Proxy(vm, handlers);
  3395. } else {
  3396. vm._renderProxy = vm;
  3397. }
  3398. };
  3399. }
  3400. /* */
  3401. var seenObjects = new _Set();
  3402. /**
  3403. * Recursively traverse an object to evoke all converted
  3404. * getters, so that every nested property inside the object
  3405. * is collected as a "deep" dependency.
  3406. */
  3407. function traverse (val) {
  3408. _traverse(val, seenObjects);
  3409. seenObjects.clear();
  3410. }
  3411. function _traverse (val, seen) {
  3412. var i, keys;
  3413. var isA = Array.isArray(val);
  3414. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3415. return
  3416. }
  3417. if (val.__ob__) {
  3418. var depId = val.__ob__.dep.id;
  3419. if (seen.has(depId)) {
  3420. return
  3421. }
  3422. seen.add(depId);
  3423. }
  3424. if (isA) {
  3425. i = val.length;
  3426. while (i--) { _traverse(val[i], seen); }
  3427. } else {
  3428. keys = Object.keys(val);
  3429. i = keys.length;
  3430. while (i--) { _traverse(val[keys[i]], seen); }
  3431. }
  3432. }
  3433. var mark;
  3434. var measure;
  3435. if (true) {
  3436. var perf = inBrowser && window.performance;
  3437. /* istanbul ignore if */
  3438. if (
  3439. perf &&
  3440. perf.mark &&
  3441. perf.measure &&
  3442. perf.clearMarks &&
  3443. perf.clearMeasures
  3444. ) {
  3445. mark = function (tag) { return perf.mark(tag); };
  3446. measure = function (name, startTag, endTag) {
  3447. perf.measure(name, startTag, endTag);
  3448. perf.clearMarks(startTag);
  3449. perf.clearMarks(endTag);
  3450. // perf.clearMeasures(name)
  3451. };
  3452. }
  3453. }
  3454. /* */
  3455. var normalizeEvent = cached(function (name) {
  3456. var passive = name.charAt(0) === '&';
  3457. name = passive ? name.slice(1) : name;
  3458. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3459. name = once$$1 ? name.slice(1) : name;
  3460. var capture = name.charAt(0) === '!';
  3461. name = capture ? name.slice(1) : name;
  3462. return {
  3463. name: name,
  3464. once: once$$1,
  3465. capture: capture,
  3466. passive: passive
  3467. }
  3468. });
  3469. function createFnInvoker (fns, vm) {
  3470. function invoker () {
  3471. var arguments$1 = arguments;
  3472. var fns = invoker.fns;
  3473. if (Array.isArray(fns)) {
  3474. var cloned = fns.slice();
  3475. for (var i = 0; i < cloned.length; i++) {
  3476. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  3477. }
  3478. } else {
  3479. // return handler return value for single handlers
  3480. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  3481. }
  3482. }
  3483. invoker.fns = fns;
  3484. return invoker
  3485. }
  3486. function updateListeners (
  3487. on,
  3488. oldOn,
  3489. add,
  3490. remove$$1,
  3491. createOnceHandler,
  3492. vm
  3493. ) {
  3494. var name, def$$1, cur, old, event;
  3495. for (name in on) {
  3496. def$$1 = cur = on[name];
  3497. old = oldOn[name];
  3498. event = normalizeEvent(name);
  3499. if (isUndef(cur)) {
  3500. true && warn(
  3501. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3502. vm
  3503. );
  3504. } else if (isUndef(old)) {
  3505. if (isUndef(cur.fns)) {
  3506. cur = on[name] = createFnInvoker(cur, vm);
  3507. }
  3508. if (isTrue(event.once)) {
  3509. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3510. }
  3511. add(event.name, cur, event.capture, event.passive, event.params);
  3512. } else if (cur !== old) {
  3513. old.fns = cur;
  3514. on[name] = old;
  3515. }
  3516. }
  3517. for (name in oldOn) {
  3518. if (isUndef(on[name])) {
  3519. event = normalizeEvent(name);
  3520. remove$$1(event.name, oldOn[name], event.capture);
  3521. }
  3522. }
  3523. }
  3524. /* */
  3525. /* */
  3526. // fixed by xxxxxx (mp properties)
  3527. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  3528. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  3529. if (isUndef(propOptions)) {
  3530. return res
  3531. }
  3532. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  3533. var attrs = data.attrs;
  3534. var props = data.props;
  3535. if (isDef(attrs) || isDef(props)) {
  3536. for (var key in propOptions) {
  3537. var altKey = hyphenate(key);
  3538. var result = checkProp(res, props, key, altKey, true) ||
  3539. checkProp(res, attrs, key, altKey, false);
  3540. // externalClass
  3541. if (
  3542. result &&
  3543. res[key] &&
  3544. externalClasses.indexOf(altKey) !== -1 &&
  3545. context[camelize(res[key])]
  3546. ) {
  3547. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  3548. res[key] = context[camelize(res[key])];
  3549. }
  3550. }
  3551. }
  3552. return res
  3553. }
  3554. function extractPropsFromVNodeData (
  3555. data,
  3556. Ctor,
  3557. tag,
  3558. context// fixed by xxxxxx
  3559. ) {
  3560. // we are only extracting raw values here.
  3561. // validation and default values are handled in the child
  3562. // component itself.
  3563. var propOptions = Ctor.options.props;
  3564. if (isUndef(propOptions)) {
  3565. // fixed by xxxxxx
  3566. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  3567. }
  3568. var res = {};
  3569. var attrs = data.attrs;
  3570. var props = data.props;
  3571. if (isDef(attrs) || isDef(props)) {
  3572. for (var key in propOptions) {
  3573. var altKey = hyphenate(key);
  3574. if (true) {
  3575. var keyInLowerCase = key.toLowerCase();
  3576. if (
  3577. key !== keyInLowerCase &&
  3578. attrs && hasOwn(attrs, keyInLowerCase)
  3579. ) {
  3580. tip(
  3581. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3582. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3583. " \"" + key + "\". " +
  3584. "Note that HTML attributes are case-insensitive and camelCased " +
  3585. "props need to use their kebab-case equivalents when using in-DOM " +
  3586. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3587. );
  3588. }
  3589. }
  3590. checkProp(res, props, key, altKey, true) ||
  3591. checkProp(res, attrs, key, altKey, false);
  3592. }
  3593. }
  3594. // fixed by xxxxxx
  3595. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  3596. }
  3597. function checkProp (
  3598. res,
  3599. hash,
  3600. key,
  3601. altKey,
  3602. preserve
  3603. ) {
  3604. if (isDef(hash)) {
  3605. if (hasOwn(hash, key)) {
  3606. res[key] = hash[key];
  3607. if (!preserve) {
  3608. delete hash[key];
  3609. }
  3610. return true
  3611. } else if (hasOwn(hash, altKey)) {
  3612. res[key] = hash[altKey];
  3613. if (!preserve) {
  3614. delete hash[altKey];
  3615. }
  3616. return true
  3617. }
  3618. }
  3619. return false
  3620. }
  3621. /* */
  3622. // The template compiler attempts to minimize the need for normalization by
  3623. // statically analyzing the template at compile time.
  3624. //
  3625. // For plain HTML markup, normalization can be completely skipped because the
  3626. // generated render function is guaranteed to return Array<VNode>. There are
  3627. // two cases where extra normalization is needed:
  3628. // 1. When the children contains components - because a functional component
  3629. // may return an Array instead of a single root. In this case, just a simple
  3630. // normalization is needed - if any child is an Array, we flatten the whole
  3631. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3632. // because functional components already normalize their own children.
  3633. function simpleNormalizeChildren (children) {
  3634. for (var i = 0; i < children.length; i++) {
  3635. if (Array.isArray(children[i])) {
  3636. return Array.prototype.concat.apply([], children)
  3637. }
  3638. }
  3639. return children
  3640. }
  3641. // 2. When the children contains constructs that always generated nested Arrays,
  3642. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3643. // with hand-written render functions / JSX. In such cases a full normalization
  3644. // is needed to cater to all possible types of children values.
  3645. function normalizeChildren (children) {
  3646. return isPrimitive(children)
  3647. ? [createTextVNode(children)]
  3648. : Array.isArray(children)
  3649. ? normalizeArrayChildren(children)
  3650. : undefined
  3651. }
  3652. function isTextNode (node) {
  3653. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3654. }
  3655. function normalizeArrayChildren (children, nestedIndex) {
  3656. var res = [];
  3657. var i, c, lastIndex, last;
  3658. for (i = 0; i < children.length; i++) {
  3659. c = children[i];
  3660. if (isUndef(c) || typeof c === 'boolean') { continue }
  3661. lastIndex = res.length - 1;
  3662. last = res[lastIndex];
  3663. // nested
  3664. if (Array.isArray(c)) {
  3665. if (c.length > 0) {
  3666. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3667. // merge adjacent text nodes
  3668. if (isTextNode(c[0]) && isTextNode(last)) {
  3669. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3670. c.shift();
  3671. }
  3672. res.push.apply(res, c);
  3673. }
  3674. } else if (isPrimitive(c)) {
  3675. if (isTextNode(last)) {
  3676. // merge adjacent text nodes
  3677. // this is necessary for SSR hydration because text nodes are
  3678. // essentially merged when rendered to HTML strings
  3679. res[lastIndex] = createTextVNode(last.text + c);
  3680. } else if (c !== '') {
  3681. // convert primitive to vnode
  3682. res.push(createTextVNode(c));
  3683. }
  3684. } else {
  3685. if (isTextNode(c) && isTextNode(last)) {
  3686. // merge adjacent text nodes
  3687. res[lastIndex] = createTextVNode(last.text + c.text);
  3688. } else {
  3689. // default key for nested array children (likely generated by v-for)
  3690. if (isTrue(children._isVList) &&
  3691. isDef(c.tag) &&
  3692. isUndef(c.key) &&
  3693. isDef(nestedIndex)) {
  3694. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3695. }
  3696. res.push(c);
  3697. }
  3698. }
  3699. }
  3700. return res
  3701. }
  3702. /* */
  3703. function initProvide (vm) {
  3704. var provide = vm.$options.provide;
  3705. if (provide) {
  3706. vm._provided = typeof provide === 'function'
  3707. ? provide.call(vm)
  3708. : provide;
  3709. }
  3710. }
  3711. function initInjections (vm) {
  3712. var result = resolveInject(vm.$options.inject, vm);
  3713. if (result) {
  3714. toggleObserving(false);
  3715. Object.keys(result).forEach(function (key) {
  3716. /* istanbul ignore else */
  3717. if (true) {
  3718. defineReactive$$1(vm, key, result[key], function () {
  3719. warn(
  3720. "Avoid mutating an injected value directly since the changes will be " +
  3721. "overwritten whenever the provided component re-renders. " +
  3722. "injection being mutated: \"" + key + "\"",
  3723. vm
  3724. );
  3725. });
  3726. } else {}
  3727. });
  3728. toggleObserving(true);
  3729. }
  3730. }
  3731. function resolveInject (inject, vm) {
  3732. if (inject) {
  3733. // inject is :any because flow is not smart enough to figure out cached
  3734. var result = Object.create(null);
  3735. var keys = hasSymbol
  3736. ? Reflect.ownKeys(inject)
  3737. : Object.keys(inject);
  3738. for (var i = 0; i < keys.length; i++) {
  3739. var key = keys[i];
  3740. // #6574 in case the inject object is observed...
  3741. if (key === '__ob__') { continue }
  3742. var provideKey = inject[key].from;
  3743. var source = vm;
  3744. while (source) {
  3745. if (source._provided && hasOwn(source._provided, provideKey)) {
  3746. result[key] = source._provided[provideKey];
  3747. break
  3748. }
  3749. source = source.$parent;
  3750. }
  3751. if (!source) {
  3752. if ('default' in inject[key]) {
  3753. var provideDefault = inject[key].default;
  3754. result[key] = typeof provideDefault === 'function'
  3755. ? provideDefault.call(vm)
  3756. : provideDefault;
  3757. } else if (true) {
  3758. warn(("Injection \"" + key + "\" not found"), vm);
  3759. }
  3760. }
  3761. }
  3762. return result
  3763. }
  3764. }
  3765. /* */
  3766. /**
  3767. * Runtime helper for resolving raw children VNodes into a slot object.
  3768. */
  3769. function resolveSlots (
  3770. children,
  3771. context
  3772. ) {
  3773. if (!children || !children.length) {
  3774. return {}
  3775. }
  3776. var slots = {};
  3777. for (var i = 0, l = children.length; i < l; i++) {
  3778. var child = children[i];
  3779. var data = child.data;
  3780. // remove slot attribute if the node is resolved as a Vue slot node
  3781. if (data && data.attrs && data.attrs.slot) {
  3782. delete data.attrs.slot;
  3783. }
  3784. // named slots should only be respected if the vnode was rendered in the
  3785. // same context.
  3786. if ((child.context === context || child.fnContext === context) &&
  3787. data && data.slot != null
  3788. ) {
  3789. var name = data.slot;
  3790. var slot = (slots[name] || (slots[name] = []));
  3791. if (child.tag === 'template') {
  3792. slot.push.apply(slot, child.children || []);
  3793. } else {
  3794. slot.push(child);
  3795. }
  3796. } else {
  3797. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  3798. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  3799. (slots['page'] || (slots['page'] = [])).push(child);
  3800. }else{
  3801. (slots.default || (slots.default = [])).push(child);
  3802. }
  3803. }
  3804. }
  3805. // ignore slots that contains only whitespace
  3806. for (var name$1 in slots) {
  3807. if (slots[name$1].every(isWhitespace)) {
  3808. delete slots[name$1];
  3809. }
  3810. }
  3811. return slots
  3812. }
  3813. function isWhitespace (node) {
  3814. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3815. }
  3816. /* */
  3817. function normalizeScopedSlots (
  3818. slots,
  3819. normalSlots,
  3820. prevSlots
  3821. ) {
  3822. var res;
  3823. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  3824. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  3825. var key = slots && slots.$key;
  3826. if (!slots) {
  3827. res = {};
  3828. } else if (slots._normalized) {
  3829. // fast path 1: child component re-render only, parent did not change
  3830. return slots._normalized
  3831. } else if (
  3832. isStable &&
  3833. prevSlots &&
  3834. prevSlots !== emptyObject &&
  3835. key === prevSlots.$key &&
  3836. !hasNormalSlots &&
  3837. !prevSlots.$hasNormal
  3838. ) {
  3839. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  3840. // only need to normalize once
  3841. return prevSlots
  3842. } else {
  3843. res = {};
  3844. for (var key$1 in slots) {
  3845. if (slots[key$1] && key$1[0] !== '$') {
  3846. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  3847. }
  3848. }
  3849. }
  3850. // expose normal slots on scopedSlots
  3851. for (var key$2 in normalSlots) {
  3852. if (!(key$2 in res)) {
  3853. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  3854. }
  3855. }
  3856. // avoriaz seems to mock a non-extensible $scopedSlots object
  3857. // and when that is passed down this would cause an error
  3858. if (slots && Object.isExtensible(slots)) {
  3859. (slots)._normalized = res;
  3860. }
  3861. def(res, '$stable', isStable);
  3862. def(res, '$key', key);
  3863. def(res, '$hasNormal', hasNormalSlots);
  3864. return res
  3865. }
  3866. function normalizeScopedSlot(normalSlots, key, fn) {
  3867. var normalized = function () {
  3868. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  3869. res = res && typeof res === 'object' && !Array.isArray(res)
  3870. ? [res] // single vnode
  3871. : normalizeChildren(res);
  3872. return res && (
  3873. res.length === 0 ||
  3874. (res.length === 1 && res[0].isComment) // #9658
  3875. ) ? undefined
  3876. : res
  3877. };
  3878. // this is a slot using the new v-slot syntax without scope. although it is
  3879. // compiled as a scoped slot, render fn users would expect it to be present
  3880. // on this.$slots because the usage is semantically a normal slot.
  3881. if (fn.proxy) {
  3882. Object.defineProperty(normalSlots, key, {
  3883. get: normalized,
  3884. enumerable: true,
  3885. configurable: true
  3886. });
  3887. }
  3888. return normalized
  3889. }
  3890. function proxyNormalSlot(slots, key) {
  3891. return function () { return slots[key]; }
  3892. }
  3893. /* */
  3894. /**
  3895. * Runtime helper for rendering v-for lists.
  3896. */
  3897. function renderList (
  3898. val,
  3899. render
  3900. ) {
  3901. var ret, i, l, keys, key;
  3902. if (Array.isArray(val) || typeof val === 'string') {
  3903. ret = new Array(val.length);
  3904. for (i = 0, l = val.length; i < l; i++) {
  3905. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  3906. }
  3907. } else if (typeof val === 'number') {
  3908. ret = new Array(val);
  3909. for (i = 0; i < val; i++) {
  3910. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  3911. }
  3912. } else if (isObject(val)) {
  3913. if (hasSymbol && val[Symbol.iterator]) {
  3914. ret = [];
  3915. var iterator = val[Symbol.iterator]();
  3916. var result = iterator.next();
  3917. while (!result.done) {
  3918. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  3919. result = iterator.next();
  3920. }
  3921. } else {
  3922. keys = Object.keys(val);
  3923. ret = new Array(keys.length);
  3924. for (i = 0, l = keys.length; i < l; i++) {
  3925. key = keys[i];
  3926. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  3927. }
  3928. }
  3929. }
  3930. if (!isDef(ret)) {
  3931. ret = [];
  3932. }
  3933. (ret)._isVList = true;
  3934. return ret
  3935. }
  3936. /* */
  3937. /**
  3938. * Runtime helper for rendering <slot>
  3939. */
  3940. function renderSlot (
  3941. name,
  3942. fallback,
  3943. props,
  3944. bindObject
  3945. ) {
  3946. var scopedSlotFn = this.$scopedSlots[name];
  3947. var nodes;
  3948. if (scopedSlotFn) { // scoped slot
  3949. props = props || {};
  3950. if (bindObject) {
  3951. if ( true && !isObject(bindObject)) {
  3952. warn(
  3953. 'slot v-bind without argument expects an Object',
  3954. this
  3955. );
  3956. }
  3957. props = extend(extend({}, bindObject), props);
  3958. }
  3959. // fixed by xxxxxx app-plus scopedSlot
  3960. nodes = scopedSlotFn(props, this, props._i) || fallback;
  3961. } else {
  3962. nodes = this.$slots[name] || fallback;
  3963. }
  3964. var target = props && props.slot;
  3965. if (target) {
  3966. return this.$createElement('template', { slot: target }, nodes)
  3967. } else {
  3968. return nodes
  3969. }
  3970. }
  3971. /* */
  3972. /**
  3973. * Runtime helper for resolving filters
  3974. */
  3975. function resolveFilter (id) {
  3976. return resolveAsset(this.$options, 'filters', id, true) || identity
  3977. }
  3978. /* */
  3979. function isKeyNotMatch (expect, actual) {
  3980. if (Array.isArray(expect)) {
  3981. return expect.indexOf(actual) === -1
  3982. } else {
  3983. return expect !== actual
  3984. }
  3985. }
  3986. /**
  3987. * Runtime helper for checking keyCodes from config.
  3988. * exposed as Vue.prototype._k
  3989. * passing in eventKeyName as last argument separately for backwards compat
  3990. */
  3991. function checkKeyCodes (
  3992. eventKeyCode,
  3993. key,
  3994. builtInKeyCode,
  3995. eventKeyName,
  3996. builtInKeyName
  3997. ) {
  3998. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3999. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  4000. return isKeyNotMatch(builtInKeyName, eventKeyName)
  4001. } else if (mappedKeyCode) {
  4002. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  4003. } else if (eventKeyName) {
  4004. return hyphenate(eventKeyName) !== key
  4005. }
  4006. }
  4007. /* */
  4008. /**
  4009. * Runtime helper for merging v-bind="object" into a VNode's data.
  4010. */
  4011. function bindObjectProps (
  4012. data,
  4013. tag,
  4014. value,
  4015. asProp,
  4016. isSync
  4017. ) {
  4018. if (value) {
  4019. if (!isObject(value)) {
  4020. true && warn(
  4021. 'v-bind without argument expects an Object or Array value',
  4022. this
  4023. );
  4024. } else {
  4025. if (Array.isArray(value)) {
  4026. value = toObject(value);
  4027. }
  4028. var hash;
  4029. var loop = function ( key ) {
  4030. if (
  4031. key === 'class' ||
  4032. key === 'style' ||
  4033. isReservedAttribute(key)
  4034. ) {
  4035. hash = data;
  4036. } else {
  4037. var type = data.attrs && data.attrs.type;
  4038. hash = asProp || config.mustUseProp(tag, type, key)
  4039. ? data.domProps || (data.domProps = {})
  4040. : data.attrs || (data.attrs = {});
  4041. }
  4042. var camelizedKey = camelize(key);
  4043. var hyphenatedKey = hyphenate(key);
  4044. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  4045. hash[key] = value[key];
  4046. if (isSync) {
  4047. var on = data.on || (data.on = {});
  4048. on[("update:" + key)] = function ($event) {
  4049. value[key] = $event;
  4050. };
  4051. }
  4052. }
  4053. };
  4054. for (var key in value) loop( key );
  4055. }
  4056. }
  4057. return data
  4058. }
  4059. /* */
  4060. /**
  4061. * Runtime helper for rendering static trees.
  4062. */
  4063. function renderStatic (
  4064. index,
  4065. isInFor
  4066. ) {
  4067. var cached = this._staticTrees || (this._staticTrees = []);
  4068. var tree = cached[index];
  4069. // if has already-rendered static tree and not inside v-for,
  4070. // we can reuse the same tree.
  4071. if (tree && !isInFor) {
  4072. return tree
  4073. }
  4074. // otherwise, render a fresh tree.
  4075. tree = cached[index] = this.$options.staticRenderFns[index].call(
  4076. this._renderProxy,
  4077. null,
  4078. this // for render fns generated for functional component templates
  4079. );
  4080. markStatic(tree, ("__static__" + index), false);
  4081. return tree
  4082. }
  4083. /**
  4084. * Runtime helper for v-once.
  4085. * Effectively it means marking the node as static with a unique key.
  4086. */
  4087. function markOnce (
  4088. tree,
  4089. index,
  4090. key
  4091. ) {
  4092. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  4093. return tree
  4094. }
  4095. function markStatic (
  4096. tree,
  4097. key,
  4098. isOnce
  4099. ) {
  4100. if (Array.isArray(tree)) {
  4101. for (var i = 0; i < tree.length; i++) {
  4102. if (tree[i] && typeof tree[i] !== 'string') {
  4103. markStaticNode(tree[i], (key + "_" + i), isOnce);
  4104. }
  4105. }
  4106. } else {
  4107. markStaticNode(tree, key, isOnce);
  4108. }
  4109. }
  4110. function markStaticNode (node, key, isOnce) {
  4111. node.isStatic = true;
  4112. node.key = key;
  4113. node.isOnce = isOnce;
  4114. }
  4115. /* */
  4116. function bindObjectListeners (data, value) {
  4117. if (value) {
  4118. if (!isPlainObject(value)) {
  4119. true && warn(
  4120. 'v-on without argument expects an Object value',
  4121. this
  4122. );
  4123. } else {
  4124. var on = data.on = data.on ? extend({}, data.on) : {};
  4125. for (var key in value) {
  4126. var existing = on[key];
  4127. var ours = value[key];
  4128. on[key] = existing ? [].concat(existing, ours) : ours;
  4129. }
  4130. }
  4131. }
  4132. return data
  4133. }
  4134. /* */
  4135. function resolveScopedSlots (
  4136. fns, // see flow/vnode
  4137. res,
  4138. // the following are added in 2.6
  4139. hasDynamicKeys,
  4140. contentHashKey
  4141. ) {
  4142. res = res || { $stable: !hasDynamicKeys };
  4143. for (var i = 0; i < fns.length; i++) {
  4144. var slot = fns[i];
  4145. if (Array.isArray(slot)) {
  4146. resolveScopedSlots(slot, res, hasDynamicKeys);
  4147. } else if (slot) {
  4148. // marker for reverse proxying v-slot without scope on this.$slots
  4149. if (slot.proxy) {
  4150. slot.fn.proxy = true;
  4151. }
  4152. res[slot.key] = slot.fn;
  4153. }
  4154. }
  4155. if (contentHashKey) {
  4156. (res).$key = contentHashKey;
  4157. }
  4158. return res
  4159. }
  4160. /* */
  4161. function bindDynamicKeys (baseObj, values) {
  4162. for (var i = 0; i < values.length; i += 2) {
  4163. var key = values[i];
  4164. if (typeof key === 'string' && key) {
  4165. baseObj[values[i]] = values[i + 1];
  4166. } else if ( true && key !== '' && key !== null) {
  4167. // null is a special value for explicitly removing a binding
  4168. warn(
  4169. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  4170. this
  4171. );
  4172. }
  4173. }
  4174. return baseObj
  4175. }
  4176. // helper to dynamically append modifier runtime markers to event names.
  4177. // ensure only append when value is already string, otherwise it will be cast
  4178. // to string and cause the type check to miss.
  4179. function prependModifier (value, symbol) {
  4180. return typeof value === 'string' ? symbol + value : value
  4181. }
  4182. /* */
  4183. function installRenderHelpers (target) {
  4184. target._o = markOnce;
  4185. target._n = toNumber;
  4186. target._s = toString;
  4187. target._l = renderList;
  4188. target._t = renderSlot;
  4189. target._q = looseEqual;
  4190. target._i = looseIndexOf;
  4191. target._m = renderStatic;
  4192. target._f = resolveFilter;
  4193. target._k = checkKeyCodes;
  4194. target._b = bindObjectProps;
  4195. target._v = createTextVNode;
  4196. target._e = createEmptyVNode;
  4197. target._u = resolveScopedSlots;
  4198. target._g = bindObjectListeners;
  4199. target._d = bindDynamicKeys;
  4200. target._p = prependModifier;
  4201. }
  4202. /* */
  4203. function FunctionalRenderContext (
  4204. data,
  4205. props,
  4206. children,
  4207. parent,
  4208. Ctor
  4209. ) {
  4210. var this$1 = this;
  4211. var options = Ctor.options;
  4212. // ensure the createElement function in functional components
  4213. // gets a unique context - this is necessary for correct named slot check
  4214. var contextVm;
  4215. if (hasOwn(parent, '_uid')) {
  4216. contextVm = Object.create(parent);
  4217. // $flow-disable-line
  4218. contextVm._original = parent;
  4219. } else {
  4220. // the context vm passed in is a functional context as well.
  4221. // in this case we want to make sure we are able to get a hold to the
  4222. // real context instance.
  4223. contextVm = parent;
  4224. // $flow-disable-line
  4225. parent = parent._original;
  4226. }
  4227. var isCompiled = isTrue(options._compiled);
  4228. var needNormalization = !isCompiled;
  4229. this.data = data;
  4230. this.props = props;
  4231. this.children = children;
  4232. this.parent = parent;
  4233. this.listeners = data.on || emptyObject;
  4234. this.injections = resolveInject(options.inject, parent);
  4235. this.slots = function () {
  4236. if (!this$1.$slots) {
  4237. normalizeScopedSlots(
  4238. data.scopedSlots,
  4239. this$1.$slots = resolveSlots(children, parent)
  4240. );
  4241. }
  4242. return this$1.$slots
  4243. };
  4244. Object.defineProperty(this, 'scopedSlots', ({
  4245. enumerable: true,
  4246. get: function get () {
  4247. return normalizeScopedSlots(data.scopedSlots, this.slots())
  4248. }
  4249. }));
  4250. // support for compiled functional template
  4251. if (isCompiled) {
  4252. // exposing $options for renderStatic()
  4253. this.$options = options;
  4254. // pre-resolve slots for renderSlot()
  4255. this.$slots = this.slots();
  4256. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  4257. }
  4258. if (options._scopeId) {
  4259. this._c = function (a, b, c, d) {
  4260. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4261. if (vnode && !Array.isArray(vnode)) {
  4262. vnode.fnScopeId = options._scopeId;
  4263. vnode.fnContext = parent;
  4264. }
  4265. return vnode
  4266. };
  4267. } else {
  4268. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4269. }
  4270. }
  4271. installRenderHelpers(FunctionalRenderContext.prototype);
  4272. function createFunctionalComponent (
  4273. Ctor,
  4274. propsData,
  4275. data,
  4276. contextVm,
  4277. children
  4278. ) {
  4279. var options = Ctor.options;
  4280. var props = {};
  4281. var propOptions = options.props;
  4282. if (isDef(propOptions)) {
  4283. for (var key in propOptions) {
  4284. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4285. }
  4286. } else {
  4287. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4288. if (isDef(data.props)) { mergeProps(props, data.props); }
  4289. }
  4290. var renderContext = new FunctionalRenderContext(
  4291. data,
  4292. props,
  4293. children,
  4294. contextVm,
  4295. Ctor
  4296. );
  4297. var vnode = options.render.call(null, renderContext._c, renderContext);
  4298. if (vnode instanceof VNode) {
  4299. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  4300. } else if (Array.isArray(vnode)) {
  4301. var vnodes = normalizeChildren(vnode) || [];
  4302. var res = new Array(vnodes.length);
  4303. for (var i = 0; i < vnodes.length; i++) {
  4304. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4305. }
  4306. return res
  4307. }
  4308. }
  4309. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  4310. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4311. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4312. // that should not be matched to match.
  4313. var clone = cloneVNode(vnode);
  4314. clone.fnContext = contextVm;
  4315. clone.fnOptions = options;
  4316. if (true) {
  4317. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  4318. }
  4319. if (data.slot) {
  4320. (clone.data || (clone.data = {})).slot = data.slot;
  4321. }
  4322. return clone
  4323. }
  4324. function mergeProps (to, from) {
  4325. for (var key in from) {
  4326. to[camelize(key)] = from[key];
  4327. }
  4328. }
  4329. /* */
  4330. /* */
  4331. /* */
  4332. /* */
  4333. // inline hooks to be invoked on component VNodes during patch
  4334. var componentVNodeHooks = {
  4335. init: function init (vnode, hydrating) {
  4336. if (
  4337. vnode.componentInstance &&
  4338. !vnode.componentInstance._isDestroyed &&
  4339. vnode.data.keepAlive
  4340. ) {
  4341. // kept-alive components, treat as a patch
  4342. var mountedNode = vnode; // work around flow
  4343. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4344. } else {
  4345. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4346. vnode,
  4347. activeInstance
  4348. );
  4349. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4350. }
  4351. },
  4352. prepatch: function prepatch (oldVnode, vnode) {
  4353. var options = vnode.componentOptions;
  4354. var child = vnode.componentInstance = oldVnode.componentInstance;
  4355. updateChildComponent(
  4356. child,
  4357. options.propsData, // updated props
  4358. options.listeners, // updated listeners
  4359. vnode, // new parent vnode
  4360. options.children // new children
  4361. );
  4362. },
  4363. insert: function insert (vnode) {
  4364. var context = vnode.context;
  4365. var componentInstance = vnode.componentInstance;
  4366. if (!componentInstance._isMounted) {
  4367. callHook(componentInstance, 'onServiceCreated');
  4368. callHook(componentInstance, 'onServiceAttached');
  4369. componentInstance._isMounted = true;
  4370. callHook(componentInstance, 'mounted');
  4371. }
  4372. if (vnode.data.keepAlive) {
  4373. if (context._isMounted) {
  4374. // vue-router#1212
  4375. // During updates, a kept-alive component's child components may
  4376. // change, so directly walking the tree here may call activated hooks
  4377. // on incorrect children. Instead we push them into a queue which will
  4378. // be processed after the whole patch process ended.
  4379. queueActivatedComponent(componentInstance);
  4380. } else {
  4381. activateChildComponent(componentInstance, true /* direct */);
  4382. }
  4383. }
  4384. },
  4385. destroy: function destroy (vnode) {
  4386. var componentInstance = vnode.componentInstance;
  4387. if (!componentInstance._isDestroyed) {
  4388. if (!vnode.data.keepAlive) {
  4389. componentInstance.$destroy();
  4390. } else {
  4391. deactivateChildComponent(componentInstance, true /* direct */);
  4392. }
  4393. }
  4394. }
  4395. };
  4396. var hooksToMerge = Object.keys(componentVNodeHooks);
  4397. function createComponent (
  4398. Ctor,
  4399. data,
  4400. context,
  4401. children,
  4402. tag
  4403. ) {
  4404. if (isUndef(Ctor)) {
  4405. return
  4406. }
  4407. var baseCtor = context.$options._base;
  4408. // plain options object: turn it into a constructor
  4409. if (isObject(Ctor)) {
  4410. Ctor = baseCtor.extend(Ctor);
  4411. }
  4412. // if at this stage it's not a constructor or an async component factory,
  4413. // reject.
  4414. if (typeof Ctor !== 'function') {
  4415. if (true) {
  4416. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4417. }
  4418. return
  4419. }
  4420. // async component
  4421. var asyncFactory;
  4422. if (isUndef(Ctor.cid)) {
  4423. asyncFactory = Ctor;
  4424. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4425. if (Ctor === undefined) {
  4426. // return a placeholder node for async component, which is rendered
  4427. // as a comment node but preserves all the raw information for the node.
  4428. // the information will be used for async server-rendering and hydration.
  4429. return createAsyncPlaceholder(
  4430. asyncFactory,
  4431. data,
  4432. context,
  4433. children,
  4434. tag
  4435. )
  4436. }
  4437. }
  4438. data = data || {};
  4439. // resolve constructor options in case global mixins are applied after
  4440. // component constructor creation
  4441. resolveConstructorOptions(Ctor);
  4442. // transform component v-model data into props & events
  4443. if (isDef(data.model)) {
  4444. transformModel(Ctor.options, data);
  4445. }
  4446. // extract props
  4447. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  4448. // functional component
  4449. if (isTrue(Ctor.options.functional)) {
  4450. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4451. }
  4452. // extract listeners, since these needs to be treated as
  4453. // child component listeners instead of DOM listeners
  4454. var listeners = data.on;
  4455. // replace with listeners with .native modifier
  4456. // so it gets processed during parent component patch.
  4457. data.on = data.nativeOn;
  4458. if (isTrue(Ctor.options.abstract)) {
  4459. // abstract components do not keep anything
  4460. // other than props & listeners & slot
  4461. // work around flow
  4462. var slot = data.slot;
  4463. data = {};
  4464. if (slot) {
  4465. data.slot = slot;
  4466. }
  4467. }
  4468. // install component management hooks onto the placeholder node
  4469. installComponentHooks(data);
  4470. // return a placeholder vnode
  4471. var name = Ctor.options.name || tag;
  4472. var vnode = new VNode(
  4473. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4474. data, undefined, undefined, undefined, context,
  4475. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4476. asyncFactory
  4477. );
  4478. return vnode
  4479. }
  4480. function createComponentInstanceForVnode (
  4481. vnode, // we know it's MountedComponentVNode but flow doesn't
  4482. parent // activeInstance in lifecycle state
  4483. ) {
  4484. var options = {
  4485. _isComponent: true,
  4486. _parentVnode: vnode,
  4487. parent: parent
  4488. };
  4489. // check inline-template render functions
  4490. var inlineTemplate = vnode.data.inlineTemplate;
  4491. if (isDef(inlineTemplate)) {
  4492. options.render = inlineTemplate.render;
  4493. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4494. }
  4495. return new vnode.componentOptions.Ctor(options)
  4496. }
  4497. function installComponentHooks (data) {
  4498. var hooks = data.hook || (data.hook = {});
  4499. for (var i = 0; i < hooksToMerge.length; i++) {
  4500. var key = hooksToMerge[i];
  4501. var existing = hooks[key];
  4502. var toMerge = componentVNodeHooks[key];
  4503. if (existing !== toMerge && !(existing && existing._merged)) {
  4504. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4505. }
  4506. }
  4507. }
  4508. function mergeHook$1 (f1, f2) {
  4509. var merged = function (a, b) {
  4510. // flow complains about extra args which is why we use any
  4511. f1(a, b);
  4512. f2(a, b);
  4513. };
  4514. merged._merged = true;
  4515. return merged
  4516. }
  4517. // transform component v-model info (value and callback) into
  4518. // prop and event handler respectively.
  4519. function transformModel (options, data) {
  4520. var prop = (options.model && options.model.prop) || 'value';
  4521. var event = (options.model && options.model.event) || 'input'
  4522. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4523. var on = data.on || (data.on = {});
  4524. var existing = on[event];
  4525. var callback = data.model.callback;
  4526. if (isDef(existing)) {
  4527. if (
  4528. Array.isArray(existing)
  4529. ? existing.indexOf(callback) === -1
  4530. : existing !== callback
  4531. ) {
  4532. on[event] = [callback].concat(existing);
  4533. }
  4534. } else {
  4535. on[event] = callback;
  4536. }
  4537. }
  4538. /* */
  4539. var SIMPLE_NORMALIZE = 1;
  4540. var ALWAYS_NORMALIZE = 2;
  4541. // wrapper function for providing a more flexible interface
  4542. // without getting yelled at by flow
  4543. function createElement (
  4544. context,
  4545. tag,
  4546. data,
  4547. children,
  4548. normalizationType,
  4549. alwaysNormalize
  4550. ) {
  4551. if (Array.isArray(data) || isPrimitive(data)) {
  4552. normalizationType = children;
  4553. children = data;
  4554. data = undefined;
  4555. }
  4556. if (isTrue(alwaysNormalize)) {
  4557. normalizationType = ALWAYS_NORMALIZE;
  4558. }
  4559. return _createElement(context, tag, data, children, normalizationType)
  4560. }
  4561. function _createElement (
  4562. context,
  4563. tag,
  4564. data,
  4565. children,
  4566. normalizationType
  4567. ) {
  4568. if (isDef(data) && isDef((data).__ob__)) {
  4569. true && warn(
  4570. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4571. 'Always create fresh vnode data objects in each render!',
  4572. context
  4573. );
  4574. return createEmptyVNode()
  4575. }
  4576. // object syntax in v-bind
  4577. if (isDef(data) && isDef(data.is)) {
  4578. tag = data.is;
  4579. }
  4580. if (!tag) {
  4581. // in case of component :is set to falsy value
  4582. return createEmptyVNode()
  4583. }
  4584. // warn against non-primitive key
  4585. if ( true &&
  4586. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4587. ) {
  4588. {
  4589. warn(
  4590. 'Avoid using non-primitive value as key, ' +
  4591. 'use string/number value instead.',
  4592. context
  4593. );
  4594. }
  4595. }
  4596. // support single function children as default scoped slot
  4597. if (Array.isArray(children) &&
  4598. typeof children[0] === 'function'
  4599. ) {
  4600. data = data || {};
  4601. data.scopedSlots = { default: children[0] };
  4602. children.length = 0;
  4603. }
  4604. if (normalizationType === ALWAYS_NORMALIZE) {
  4605. children = normalizeChildren(children);
  4606. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4607. children = simpleNormalizeChildren(children);
  4608. }
  4609. var vnode, ns;
  4610. if (typeof tag === 'string') {
  4611. var Ctor;
  4612. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4613. if (config.isReservedTag(tag)) {
  4614. // platform built-in elements
  4615. if ( true && isDef(data) && isDef(data.nativeOn)) {
  4616. warn(
  4617. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  4618. context
  4619. );
  4620. }
  4621. vnode = new VNode(
  4622. config.parsePlatformTagName(tag), data, children,
  4623. undefined, undefined, context
  4624. );
  4625. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4626. // component
  4627. vnode = createComponent(Ctor, data, context, children, tag);
  4628. } else {
  4629. // unknown or unlisted namespaced elements
  4630. // check at runtime because it may get assigned a namespace when its
  4631. // parent normalizes children
  4632. vnode = new VNode(
  4633. tag, data, children,
  4634. undefined, undefined, context
  4635. );
  4636. }
  4637. } else {
  4638. // direct component options / constructor
  4639. vnode = createComponent(tag, data, context, children);
  4640. }
  4641. if (Array.isArray(vnode)) {
  4642. return vnode
  4643. } else if (isDef(vnode)) {
  4644. if (isDef(ns)) { applyNS(vnode, ns); }
  4645. if (isDef(data)) { registerDeepBindings(data); }
  4646. return vnode
  4647. } else {
  4648. return createEmptyVNode()
  4649. }
  4650. }
  4651. function applyNS (vnode, ns, force) {
  4652. vnode.ns = ns;
  4653. if (vnode.tag === 'foreignObject') {
  4654. // use default namespace inside foreignObject
  4655. ns = undefined;
  4656. force = true;
  4657. }
  4658. if (isDef(vnode.children)) {
  4659. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4660. var child = vnode.children[i];
  4661. if (isDef(child.tag) && (
  4662. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4663. applyNS(child, ns, force);
  4664. }
  4665. }
  4666. }
  4667. }
  4668. // ref #5318
  4669. // necessary to ensure parent re-render when deep bindings like :style and
  4670. // :class are used on slot nodes
  4671. function registerDeepBindings (data) {
  4672. if (isObject(data.style)) {
  4673. traverse(data.style);
  4674. }
  4675. if (isObject(data.class)) {
  4676. traverse(data.class);
  4677. }
  4678. }
  4679. /* */
  4680. function initRender (vm) {
  4681. vm._vnode = null; // the root of the child tree
  4682. vm._staticTrees = null; // v-once cached trees
  4683. var options = vm.$options;
  4684. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4685. var renderContext = parentVnode && parentVnode.context;
  4686. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4687. vm.$scopedSlots = emptyObject;
  4688. // bind the createElement fn to this instance
  4689. // so that we get proper render context inside it.
  4690. // args order: tag, data, children, normalizationType, alwaysNormalize
  4691. // internal version is used by render functions compiled from templates
  4692. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4693. // normalization is always applied for the public version, used in
  4694. // user-written render functions.
  4695. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4696. // $attrs & $listeners are exposed for easier HOC creation.
  4697. // they need to be reactive so that HOCs using them are always updated
  4698. var parentData = parentVnode && parentVnode.data;
  4699. /* istanbul ignore else */
  4700. if (true) {
  4701. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4702. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4703. }, true);
  4704. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4705. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4706. }, true);
  4707. } else {}
  4708. }
  4709. var currentRenderingInstance = null;
  4710. function renderMixin (Vue) {
  4711. // install runtime convenience helpers
  4712. installRenderHelpers(Vue.prototype);
  4713. Vue.prototype.$nextTick = function (fn) {
  4714. return nextTick(fn, this)
  4715. };
  4716. Vue.prototype._render = function () {
  4717. var vm = this;
  4718. var ref = vm.$options;
  4719. var render = ref.render;
  4720. var _parentVnode = ref._parentVnode;
  4721. if (_parentVnode) {
  4722. vm.$scopedSlots = normalizeScopedSlots(
  4723. _parentVnode.data.scopedSlots,
  4724. vm.$slots,
  4725. vm.$scopedSlots
  4726. );
  4727. }
  4728. // set parent vnode. this allows render functions to have access
  4729. // to the data on the placeholder node.
  4730. vm.$vnode = _parentVnode;
  4731. // render self
  4732. var vnode;
  4733. try {
  4734. // There's no need to maintain a stack because all render fns are called
  4735. // separately from one another. Nested component's render fns are called
  4736. // when parent component is patched.
  4737. currentRenderingInstance = vm;
  4738. vnode = render.call(vm._renderProxy, vm.$createElement);
  4739. } catch (e) {
  4740. handleError(e, vm, "render");
  4741. // return error render result,
  4742. // or previous vnode to prevent render error causing blank component
  4743. /* istanbul ignore else */
  4744. if ( true && vm.$options.renderError) {
  4745. try {
  4746. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4747. } catch (e) {
  4748. handleError(e, vm, "renderError");
  4749. vnode = vm._vnode;
  4750. }
  4751. } else {
  4752. vnode = vm._vnode;
  4753. }
  4754. } finally {
  4755. currentRenderingInstance = null;
  4756. }
  4757. // if the returned array contains only a single node, allow it
  4758. if (Array.isArray(vnode) && vnode.length === 1) {
  4759. vnode = vnode[0];
  4760. }
  4761. // return empty vnode in case the render function errored out
  4762. if (!(vnode instanceof VNode)) {
  4763. if ( true && Array.isArray(vnode)) {
  4764. warn(
  4765. 'Multiple root nodes returned from render function. Render function ' +
  4766. 'should return a single root node.',
  4767. vm
  4768. );
  4769. }
  4770. vnode = createEmptyVNode();
  4771. }
  4772. // set parent
  4773. vnode.parent = _parentVnode;
  4774. return vnode
  4775. };
  4776. }
  4777. /* */
  4778. function ensureCtor (comp, base) {
  4779. if (
  4780. comp.__esModule ||
  4781. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  4782. ) {
  4783. comp = comp.default;
  4784. }
  4785. return isObject(comp)
  4786. ? base.extend(comp)
  4787. : comp
  4788. }
  4789. function createAsyncPlaceholder (
  4790. factory,
  4791. data,
  4792. context,
  4793. children,
  4794. tag
  4795. ) {
  4796. var node = createEmptyVNode();
  4797. node.asyncFactory = factory;
  4798. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  4799. return node
  4800. }
  4801. function resolveAsyncComponent (
  4802. factory,
  4803. baseCtor
  4804. ) {
  4805. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4806. return factory.errorComp
  4807. }
  4808. if (isDef(factory.resolved)) {
  4809. return factory.resolved
  4810. }
  4811. var owner = currentRenderingInstance;
  4812. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  4813. // already pending
  4814. factory.owners.push(owner);
  4815. }
  4816. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4817. return factory.loadingComp
  4818. }
  4819. if (owner && !isDef(factory.owners)) {
  4820. var owners = factory.owners = [owner];
  4821. var sync = true;
  4822. var timerLoading = null;
  4823. var timerTimeout = null
  4824. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  4825. var forceRender = function (renderCompleted) {
  4826. for (var i = 0, l = owners.length; i < l; i++) {
  4827. (owners[i]).$forceUpdate();
  4828. }
  4829. if (renderCompleted) {
  4830. owners.length = 0;
  4831. if (timerLoading !== null) {
  4832. clearTimeout(timerLoading);
  4833. timerLoading = null;
  4834. }
  4835. if (timerTimeout !== null) {
  4836. clearTimeout(timerTimeout);
  4837. timerTimeout = null;
  4838. }
  4839. }
  4840. };
  4841. var resolve = once(function (res) {
  4842. // cache resolved
  4843. factory.resolved = ensureCtor(res, baseCtor);
  4844. // invoke callbacks only if this is not a synchronous resolve
  4845. // (async resolves are shimmed as synchronous during SSR)
  4846. if (!sync) {
  4847. forceRender(true);
  4848. } else {
  4849. owners.length = 0;
  4850. }
  4851. });
  4852. var reject = once(function (reason) {
  4853. true && warn(
  4854. "Failed to resolve async component: " + (String(factory)) +
  4855. (reason ? ("\nReason: " + reason) : '')
  4856. );
  4857. if (isDef(factory.errorComp)) {
  4858. factory.error = true;
  4859. forceRender(true);
  4860. }
  4861. });
  4862. var res = factory(resolve, reject);
  4863. if (isObject(res)) {
  4864. if (isPromise(res)) {
  4865. // () => Promise
  4866. if (isUndef(factory.resolved)) {
  4867. res.then(resolve, reject);
  4868. }
  4869. } else if (isPromise(res.component)) {
  4870. res.component.then(resolve, reject);
  4871. if (isDef(res.error)) {
  4872. factory.errorComp = ensureCtor(res.error, baseCtor);
  4873. }
  4874. if (isDef(res.loading)) {
  4875. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  4876. if (res.delay === 0) {
  4877. factory.loading = true;
  4878. } else {
  4879. timerLoading = setTimeout(function () {
  4880. timerLoading = null;
  4881. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  4882. factory.loading = true;
  4883. forceRender(false);
  4884. }
  4885. }, res.delay || 200);
  4886. }
  4887. }
  4888. if (isDef(res.timeout)) {
  4889. timerTimeout = setTimeout(function () {
  4890. timerTimeout = null;
  4891. if (isUndef(factory.resolved)) {
  4892. reject(
  4893. true
  4894. ? ("timeout (" + (res.timeout) + "ms)")
  4895. : undefined
  4896. );
  4897. }
  4898. }, res.timeout);
  4899. }
  4900. }
  4901. }
  4902. sync = false;
  4903. // return in case resolved synchronously
  4904. return factory.loading
  4905. ? factory.loadingComp
  4906. : factory.resolved
  4907. }
  4908. }
  4909. /* */
  4910. function isAsyncPlaceholder (node) {
  4911. return node.isComment && node.asyncFactory
  4912. }
  4913. /* */
  4914. function getFirstComponentChild (children) {
  4915. if (Array.isArray(children)) {
  4916. for (var i = 0; i < children.length; i++) {
  4917. var c = children[i];
  4918. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  4919. return c
  4920. }
  4921. }
  4922. }
  4923. }
  4924. /* */
  4925. /* */
  4926. function initEvents (vm) {
  4927. vm._events = Object.create(null);
  4928. vm._hasHookEvent = false;
  4929. // init parent attached events
  4930. var listeners = vm.$options._parentListeners;
  4931. if (listeners) {
  4932. updateComponentListeners(vm, listeners);
  4933. }
  4934. }
  4935. var target;
  4936. function add (event, fn) {
  4937. target.$on(event, fn);
  4938. }
  4939. function remove$1 (event, fn) {
  4940. target.$off(event, fn);
  4941. }
  4942. function createOnceHandler (event, fn) {
  4943. var _target = target;
  4944. return function onceHandler () {
  4945. var res = fn.apply(null, arguments);
  4946. if (res !== null) {
  4947. _target.$off(event, onceHandler);
  4948. }
  4949. }
  4950. }
  4951. function updateComponentListeners (
  4952. vm,
  4953. listeners,
  4954. oldListeners
  4955. ) {
  4956. target = vm;
  4957. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  4958. target = undefined;
  4959. }
  4960. function eventsMixin (Vue) {
  4961. var hookRE = /^hook:/;
  4962. Vue.prototype.$on = function (event, fn) {
  4963. var vm = this;
  4964. if (Array.isArray(event)) {
  4965. for (var i = 0, l = event.length; i < l; i++) {
  4966. vm.$on(event[i], fn);
  4967. }
  4968. } else {
  4969. (vm._events[event] || (vm._events[event] = [])).push(fn);
  4970. // optimize hook:event cost by using a boolean flag marked at registration
  4971. // instead of a hash lookup
  4972. if (hookRE.test(event)) {
  4973. vm._hasHookEvent = true;
  4974. }
  4975. }
  4976. return vm
  4977. };
  4978. Vue.prototype.$once = function (event, fn) {
  4979. var vm = this;
  4980. function on () {
  4981. vm.$off(event, on);
  4982. fn.apply(vm, arguments);
  4983. }
  4984. on.fn = fn;
  4985. vm.$on(event, on);
  4986. return vm
  4987. };
  4988. Vue.prototype.$off = function (event, fn) {
  4989. var vm = this;
  4990. // all
  4991. if (!arguments.length) {
  4992. vm._events = Object.create(null);
  4993. return vm
  4994. }
  4995. // array of events
  4996. if (Array.isArray(event)) {
  4997. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  4998. vm.$off(event[i$1], fn);
  4999. }
  5000. return vm
  5001. }
  5002. // specific event
  5003. var cbs = vm._events[event];
  5004. if (!cbs) {
  5005. return vm
  5006. }
  5007. if (!fn) {
  5008. vm._events[event] = null;
  5009. return vm
  5010. }
  5011. // specific handler
  5012. var cb;
  5013. var i = cbs.length;
  5014. while (i--) {
  5015. cb = cbs[i];
  5016. if (cb === fn || cb.fn === fn) {
  5017. cbs.splice(i, 1);
  5018. break
  5019. }
  5020. }
  5021. return vm
  5022. };
  5023. Vue.prototype.$emit = function (event) {
  5024. var vm = this;
  5025. if (true) {
  5026. var lowerCaseEvent = event.toLowerCase();
  5027. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  5028. tip(
  5029. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  5030. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  5031. "Note that HTML attributes are case-insensitive and you cannot use " +
  5032. "v-on to listen to camelCase events when using in-DOM templates. " +
  5033. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  5034. );
  5035. }
  5036. }
  5037. var cbs = vm._events[event];
  5038. if (cbs) {
  5039. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  5040. var args = toArray(arguments, 1);
  5041. var info = "event handler for \"" + event + "\"";
  5042. for (var i = 0, l = cbs.length; i < l; i++) {
  5043. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  5044. }
  5045. }
  5046. return vm
  5047. };
  5048. }
  5049. /* */
  5050. var activeInstance = null;
  5051. var isUpdatingChildComponent = false;
  5052. function setActiveInstance(vm) {
  5053. var prevActiveInstance = activeInstance;
  5054. activeInstance = vm;
  5055. return function () {
  5056. activeInstance = prevActiveInstance;
  5057. }
  5058. }
  5059. function initLifecycle (vm) {
  5060. var options = vm.$options;
  5061. // locate first non-abstract parent
  5062. var parent = options.parent;
  5063. if (parent && !options.abstract) {
  5064. while (parent.$options.abstract && parent.$parent) {
  5065. parent = parent.$parent;
  5066. }
  5067. parent.$children.push(vm);
  5068. }
  5069. vm.$parent = parent;
  5070. vm.$root = parent ? parent.$root : vm;
  5071. vm.$children = [];
  5072. vm.$refs = {};
  5073. vm._watcher = null;
  5074. vm._inactive = null;
  5075. vm._directInactive = false;
  5076. vm._isMounted = false;
  5077. vm._isDestroyed = false;
  5078. vm._isBeingDestroyed = false;
  5079. }
  5080. function lifecycleMixin (Vue) {
  5081. Vue.prototype._update = function (vnode, hydrating) {
  5082. var vm = this;
  5083. var prevEl = vm.$el;
  5084. var prevVnode = vm._vnode;
  5085. var restoreActiveInstance = setActiveInstance(vm);
  5086. vm._vnode = vnode;
  5087. // Vue.prototype.__patch__ is injected in entry points
  5088. // based on the rendering backend used.
  5089. if (!prevVnode) {
  5090. // initial render
  5091. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  5092. } else {
  5093. // updates
  5094. vm.$el = vm.__patch__(prevVnode, vnode);
  5095. }
  5096. restoreActiveInstance();
  5097. // update __vue__ reference
  5098. if (prevEl) {
  5099. prevEl.__vue__ = null;
  5100. }
  5101. if (vm.$el) {
  5102. vm.$el.__vue__ = vm;
  5103. }
  5104. // if parent is an HOC, update its $el as well
  5105. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  5106. vm.$parent.$el = vm.$el;
  5107. }
  5108. // updated hook is called by the scheduler to ensure that children are
  5109. // updated in a parent's updated hook.
  5110. };
  5111. Vue.prototype.$forceUpdate = function () {
  5112. var vm = this;
  5113. if (vm._watcher) {
  5114. vm._watcher.update();
  5115. }
  5116. };
  5117. Vue.prototype.$destroy = function () {
  5118. var vm = this;
  5119. if (vm._isBeingDestroyed) {
  5120. return
  5121. }
  5122. callHook(vm, 'beforeDestroy');
  5123. vm._isBeingDestroyed = true;
  5124. // remove self from parent
  5125. var parent = vm.$parent;
  5126. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  5127. remove(parent.$children, vm);
  5128. }
  5129. // teardown watchers
  5130. if (vm._watcher) {
  5131. vm._watcher.teardown();
  5132. }
  5133. var i = vm._watchers.length;
  5134. while (i--) {
  5135. vm._watchers[i].teardown();
  5136. }
  5137. // remove reference from data ob
  5138. // frozen object may not have observer.
  5139. if (vm._data.__ob__) {
  5140. vm._data.__ob__.vmCount--;
  5141. }
  5142. // call the last hook...
  5143. vm._isDestroyed = true;
  5144. // invoke destroy hooks on current rendered tree
  5145. vm.__patch__(vm._vnode, null);
  5146. // fire destroyed hook
  5147. callHook(vm, 'destroyed');
  5148. // turn off all instance listeners.
  5149. vm.$off();
  5150. // remove __vue__ reference
  5151. if (vm.$el) {
  5152. vm.$el.__vue__ = null;
  5153. }
  5154. // release circular reference (#6759)
  5155. if (vm.$vnode) {
  5156. vm.$vnode.parent = null;
  5157. }
  5158. };
  5159. }
  5160. function updateChildComponent (
  5161. vm,
  5162. propsData,
  5163. listeners,
  5164. parentVnode,
  5165. renderChildren
  5166. ) {
  5167. if (true) {
  5168. isUpdatingChildComponent = true;
  5169. }
  5170. // determine whether component has slot children
  5171. // we need to do this before overwriting $options._renderChildren.
  5172. // check if there are dynamic scopedSlots (hand-written or compiled but with
  5173. // dynamic slot names). Static scoped slots compiled from template has the
  5174. // "$stable" marker.
  5175. var newScopedSlots = parentVnode.data.scopedSlots;
  5176. var oldScopedSlots = vm.$scopedSlots;
  5177. var hasDynamicScopedSlot = !!(
  5178. (newScopedSlots && !newScopedSlots.$stable) ||
  5179. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  5180. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  5181. );
  5182. // Any static slot children from the parent may have changed during parent's
  5183. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  5184. // update is necessary to ensure correctness.
  5185. var needsForceUpdate = !!(
  5186. renderChildren || // has new static slots
  5187. vm.$options._renderChildren || // has old static slots
  5188. hasDynamicScopedSlot
  5189. );
  5190. vm.$options._parentVnode = parentVnode;
  5191. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  5192. if (vm._vnode) { // update child tree's parent
  5193. vm._vnode.parent = parentVnode;
  5194. }
  5195. vm.$options._renderChildren = renderChildren;
  5196. // update $attrs and $listeners hash
  5197. // these are also reactive so they may trigger child update if the child
  5198. // used them during render
  5199. vm.$attrs = parentVnode.data.attrs || emptyObject;
  5200. vm.$listeners = listeners || emptyObject;
  5201. // update props
  5202. if (propsData && vm.$options.props) {
  5203. toggleObserving(false);
  5204. var props = vm._props;
  5205. var propKeys = vm.$options._propKeys || [];
  5206. for (var i = 0; i < propKeys.length; i++) {
  5207. var key = propKeys[i];
  5208. var propOptions = vm.$options.props; // wtf flow?
  5209. props[key] = validateProp(key, propOptions, propsData, vm);
  5210. }
  5211. toggleObserving(true);
  5212. // keep a copy of raw propsData
  5213. vm.$options.propsData = propsData;
  5214. }
  5215. // fixed by xxxxxx update properties(mp runtime)
  5216. vm._$updateProperties && vm._$updateProperties(vm);
  5217. // update listeners
  5218. listeners = listeners || emptyObject;
  5219. var oldListeners = vm.$options._parentListeners;
  5220. vm.$options._parentListeners = listeners;
  5221. updateComponentListeners(vm, listeners, oldListeners);
  5222. // resolve slots + force update if has children
  5223. if (needsForceUpdate) {
  5224. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  5225. vm.$forceUpdate();
  5226. }
  5227. if (true) {
  5228. isUpdatingChildComponent = false;
  5229. }
  5230. }
  5231. function isInInactiveTree (vm) {
  5232. while (vm && (vm = vm.$parent)) {
  5233. if (vm._inactive) { return true }
  5234. }
  5235. return false
  5236. }
  5237. function activateChildComponent (vm, direct) {
  5238. if (direct) {
  5239. vm._directInactive = false;
  5240. if (isInInactiveTree(vm)) {
  5241. return
  5242. }
  5243. } else if (vm._directInactive) {
  5244. return
  5245. }
  5246. if (vm._inactive || vm._inactive === null) {
  5247. vm._inactive = false;
  5248. for (var i = 0; i < vm.$children.length; i++) {
  5249. activateChildComponent(vm.$children[i]);
  5250. }
  5251. callHook(vm, 'activated');
  5252. }
  5253. }
  5254. function deactivateChildComponent (vm, direct) {
  5255. if (direct) {
  5256. vm._directInactive = true;
  5257. if (isInInactiveTree(vm)) {
  5258. return
  5259. }
  5260. }
  5261. if (!vm._inactive) {
  5262. vm._inactive = true;
  5263. for (var i = 0; i < vm.$children.length; i++) {
  5264. deactivateChildComponent(vm.$children[i]);
  5265. }
  5266. callHook(vm, 'deactivated');
  5267. }
  5268. }
  5269. function callHook (vm, hook) {
  5270. // #7573 disable dep collection when invoking lifecycle hooks
  5271. pushTarget();
  5272. var handlers = vm.$options[hook];
  5273. var info = hook + " hook";
  5274. if (handlers) {
  5275. for (var i = 0, j = handlers.length; i < j; i++) {
  5276. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  5277. }
  5278. }
  5279. if (vm._hasHookEvent) {
  5280. vm.$emit('hook:' + hook);
  5281. }
  5282. popTarget();
  5283. }
  5284. /* */
  5285. var MAX_UPDATE_COUNT = 100;
  5286. var queue = [];
  5287. var activatedChildren = [];
  5288. var has = {};
  5289. var circular = {};
  5290. var waiting = false;
  5291. var flushing = false;
  5292. var index = 0;
  5293. /**
  5294. * Reset the scheduler's state.
  5295. */
  5296. function resetSchedulerState () {
  5297. index = queue.length = activatedChildren.length = 0;
  5298. has = {};
  5299. if (true) {
  5300. circular = {};
  5301. }
  5302. waiting = flushing = false;
  5303. }
  5304. // Async edge case #6566 requires saving the timestamp when event listeners are
  5305. // attached. However, calling performance.now() has a perf overhead especially
  5306. // if the page has thousands of event listeners. Instead, we take a timestamp
  5307. // every time the scheduler flushes and use that for all event listeners
  5308. // attached during that flush.
  5309. var currentFlushTimestamp = 0;
  5310. // Async edge case fix requires storing an event listener's attach timestamp.
  5311. var getNow = Date.now;
  5312. // Determine what event timestamp the browser is using. Annoyingly, the
  5313. // timestamp can either be hi-res (relative to page load) or low-res
  5314. // (relative to UNIX epoch), so in order to compare time we have to use the
  5315. // same timestamp type when saving the flush timestamp.
  5316. // All IE versions use low-res event timestamps, and have problematic clock
  5317. // implementations (#9632)
  5318. if (inBrowser && !isIE) {
  5319. var performance = window.performance;
  5320. if (
  5321. performance &&
  5322. typeof performance.now === 'function' &&
  5323. getNow() > document.createEvent('Event').timeStamp
  5324. ) {
  5325. // if the event timestamp, although evaluated AFTER the Date.now(), is
  5326. // smaller than it, it means the event is using a hi-res timestamp,
  5327. // and we need to use the hi-res version for event listener timestamps as
  5328. // well.
  5329. getNow = function () { return performance.now(); };
  5330. }
  5331. }
  5332. /**
  5333. * Flush both queues and run the watchers.
  5334. */
  5335. function flushSchedulerQueue () {
  5336. currentFlushTimestamp = getNow();
  5337. flushing = true;
  5338. var watcher, id;
  5339. // Sort queue before flush.
  5340. // This ensures that:
  5341. // 1. Components are updated from parent to child. (because parent is always
  5342. // created before the child)
  5343. // 2. A component's user watchers are run before its render watcher (because
  5344. // user watchers are created before the render watcher)
  5345. // 3. If a component is destroyed during a parent component's watcher run,
  5346. // its watchers can be skipped.
  5347. queue.sort(function (a, b) { return a.id - b.id; });
  5348. // do not cache length because more watchers might be pushed
  5349. // as we run existing watchers
  5350. for (index = 0; index < queue.length; index++) {
  5351. watcher = queue[index];
  5352. if (watcher.before) {
  5353. watcher.before();
  5354. }
  5355. id = watcher.id;
  5356. has[id] = null;
  5357. watcher.run();
  5358. // in dev build, check and stop circular updates.
  5359. if ( true && has[id] != null) {
  5360. circular[id] = (circular[id] || 0) + 1;
  5361. if (circular[id] > MAX_UPDATE_COUNT) {
  5362. warn(
  5363. 'You may have an infinite update loop ' + (
  5364. watcher.user
  5365. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  5366. : "in a component render function."
  5367. ),
  5368. watcher.vm
  5369. );
  5370. break
  5371. }
  5372. }
  5373. }
  5374. // keep copies of post queues before resetting state
  5375. var activatedQueue = activatedChildren.slice();
  5376. var updatedQueue = queue.slice();
  5377. resetSchedulerState();
  5378. // call component updated and activated hooks
  5379. callActivatedHooks(activatedQueue);
  5380. callUpdatedHooks(updatedQueue);
  5381. // devtool hook
  5382. /* istanbul ignore if */
  5383. if (devtools && config.devtools) {
  5384. devtools.emit('flush');
  5385. }
  5386. }
  5387. function callUpdatedHooks (queue) {
  5388. var i = queue.length;
  5389. while (i--) {
  5390. var watcher = queue[i];
  5391. var vm = watcher.vm;
  5392. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  5393. callHook(vm, 'updated');
  5394. }
  5395. }
  5396. }
  5397. /**
  5398. * Queue a kept-alive component that was activated during patch.
  5399. * The queue will be processed after the entire tree has been patched.
  5400. */
  5401. function queueActivatedComponent (vm) {
  5402. // setting _inactive to false here so that a render function can
  5403. // rely on checking whether it's in an inactive tree (e.g. router-view)
  5404. vm._inactive = false;
  5405. activatedChildren.push(vm);
  5406. }
  5407. function callActivatedHooks (queue) {
  5408. for (var i = 0; i < queue.length; i++) {
  5409. queue[i]._inactive = true;
  5410. activateChildComponent(queue[i], true /* true */);
  5411. }
  5412. }
  5413. /**
  5414. * Push a watcher into the watcher queue.
  5415. * Jobs with duplicate IDs will be skipped unless it's
  5416. * pushed when the queue is being flushed.
  5417. */
  5418. function queueWatcher (watcher) {
  5419. var id = watcher.id;
  5420. if (has[id] == null) {
  5421. has[id] = true;
  5422. if (!flushing) {
  5423. queue.push(watcher);
  5424. } else {
  5425. // if already flushing, splice the watcher based on its id
  5426. // if already past its id, it will be run next immediately.
  5427. var i = queue.length - 1;
  5428. while (i > index && queue[i].id > watcher.id) {
  5429. i--;
  5430. }
  5431. queue.splice(i + 1, 0, watcher);
  5432. }
  5433. // queue the flush
  5434. if (!waiting) {
  5435. waiting = true;
  5436. if ( true && !config.async) {
  5437. flushSchedulerQueue();
  5438. return
  5439. }
  5440. nextTick(flushSchedulerQueue);
  5441. }
  5442. }
  5443. }
  5444. /* */
  5445. var uid$2 = 0;
  5446. /**
  5447. * A watcher parses an expression, collects dependencies,
  5448. * and fires callback when the expression value changes.
  5449. * This is used for both the $watch() api and directives.
  5450. */
  5451. var Watcher = function Watcher (
  5452. vm,
  5453. expOrFn,
  5454. cb,
  5455. options,
  5456. isRenderWatcher
  5457. ) {
  5458. this.vm = vm;
  5459. if (isRenderWatcher) {
  5460. vm._watcher = this;
  5461. }
  5462. vm._watchers.push(this);
  5463. // options
  5464. if (options) {
  5465. this.deep = !!options.deep;
  5466. this.user = !!options.user;
  5467. this.lazy = !!options.lazy;
  5468. this.sync = !!options.sync;
  5469. this.before = options.before;
  5470. } else {
  5471. this.deep = this.user = this.lazy = this.sync = false;
  5472. }
  5473. this.cb = cb;
  5474. this.id = ++uid$2; // uid for batching
  5475. this.active = true;
  5476. this.dirty = this.lazy; // for lazy watchers
  5477. this.deps = [];
  5478. this.newDeps = [];
  5479. this.depIds = new _Set();
  5480. this.newDepIds = new _Set();
  5481. this.expression = true
  5482. ? expOrFn.toString()
  5483. : undefined;
  5484. // parse expression for getter
  5485. if (typeof expOrFn === 'function') {
  5486. this.getter = expOrFn;
  5487. } else {
  5488. this.getter = parsePath(expOrFn);
  5489. if (!this.getter) {
  5490. this.getter = noop;
  5491. true && warn(
  5492. "Failed watching path: \"" + expOrFn + "\" " +
  5493. 'Watcher only accepts simple dot-delimited paths. ' +
  5494. 'For full control, use a function instead.',
  5495. vm
  5496. );
  5497. }
  5498. }
  5499. this.value = this.lazy
  5500. ? undefined
  5501. : this.get();
  5502. };
  5503. /**
  5504. * Evaluate the getter, and re-collect dependencies.
  5505. */
  5506. Watcher.prototype.get = function get () {
  5507. pushTarget(this);
  5508. var value;
  5509. var vm = this.vm;
  5510. try {
  5511. value = this.getter.call(vm, vm);
  5512. } catch (e) {
  5513. if (this.user) {
  5514. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  5515. } else {
  5516. throw e
  5517. }
  5518. } finally {
  5519. // "touch" every property so they are all tracked as
  5520. // dependencies for deep watching
  5521. if (this.deep) {
  5522. traverse(value);
  5523. }
  5524. popTarget();
  5525. this.cleanupDeps();
  5526. }
  5527. return value
  5528. };
  5529. /**
  5530. * Add a dependency to this directive.
  5531. */
  5532. Watcher.prototype.addDep = function addDep (dep) {
  5533. var id = dep.id;
  5534. if (!this.newDepIds.has(id)) {
  5535. this.newDepIds.add(id);
  5536. this.newDeps.push(dep);
  5537. if (!this.depIds.has(id)) {
  5538. dep.addSub(this);
  5539. }
  5540. }
  5541. };
  5542. /**
  5543. * Clean up for dependency collection.
  5544. */
  5545. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  5546. var i = this.deps.length;
  5547. while (i--) {
  5548. var dep = this.deps[i];
  5549. if (!this.newDepIds.has(dep.id)) {
  5550. dep.removeSub(this);
  5551. }
  5552. }
  5553. var tmp = this.depIds;
  5554. this.depIds = this.newDepIds;
  5555. this.newDepIds = tmp;
  5556. this.newDepIds.clear();
  5557. tmp = this.deps;
  5558. this.deps = this.newDeps;
  5559. this.newDeps = tmp;
  5560. this.newDeps.length = 0;
  5561. };
  5562. /**
  5563. * Subscriber interface.
  5564. * Will be called when a dependency changes.
  5565. */
  5566. Watcher.prototype.update = function update () {
  5567. /* istanbul ignore else */
  5568. if (this.lazy) {
  5569. this.dirty = true;
  5570. } else if (this.sync) {
  5571. this.run();
  5572. } else {
  5573. queueWatcher(this);
  5574. }
  5575. };
  5576. /**
  5577. * Scheduler job interface.
  5578. * Will be called by the scheduler.
  5579. */
  5580. Watcher.prototype.run = function run () {
  5581. if (this.active) {
  5582. var value = this.get();
  5583. if (
  5584. value !== this.value ||
  5585. // Deep watchers and watchers on Object/Arrays should fire even
  5586. // when the value is the same, because the value may
  5587. // have mutated.
  5588. isObject(value) ||
  5589. this.deep
  5590. ) {
  5591. // set new value
  5592. var oldValue = this.value;
  5593. this.value = value;
  5594. if (this.user) {
  5595. try {
  5596. this.cb.call(this.vm, value, oldValue);
  5597. } catch (e) {
  5598. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  5599. }
  5600. } else {
  5601. this.cb.call(this.vm, value, oldValue);
  5602. }
  5603. }
  5604. }
  5605. };
  5606. /**
  5607. * Evaluate the value of the watcher.
  5608. * This only gets called for lazy watchers.
  5609. */
  5610. Watcher.prototype.evaluate = function evaluate () {
  5611. this.value = this.get();
  5612. this.dirty = false;
  5613. };
  5614. /**
  5615. * Depend on all deps collected by this watcher.
  5616. */
  5617. Watcher.prototype.depend = function depend () {
  5618. var i = this.deps.length;
  5619. while (i--) {
  5620. this.deps[i].depend();
  5621. }
  5622. };
  5623. /**
  5624. * Remove self from all dependencies' subscriber list.
  5625. */
  5626. Watcher.prototype.teardown = function teardown () {
  5627. if (this.active) {
  5628. // remove self from vm's watcher list
  5629. // this is a somewhat expensive operation so we skip it
  5630. // if the vm is being destroyed.
  5631. if (!this.vm._isBeingDestroyed) {
  5632. remove(this.vm._watchers, this);
  5633. }
  5634. var i = this.deps.length;
  5635. while (i--) {
  5636. this.deps[i].removeSub(this);
  5637. }
  5638. this.active = false;
  5639. }
  5640. };
  5641. /* */
  5642. var sharedPropertyDefinition = {
  5643. enumerable: true,
  5644. configurable: true,
  5645. get: noop,
  5646. set: noop
  5647. };
  5648. function proxy (target, sourceKey, key) {
  5649. sharedPropertyDefinition.get = function proxyGetter () {
  5650. return this[sourceKey][key]
  5651. };
  5652. sharedPropertyDefinition.set = function proxySetter (val) {
  5653. this[sourceKey][key] = val;
  5654. };
  5655. Object.defineProperty(target, key, sharedPropertyDefinition);
  5656. }
  5657. function initState (vm) {
  5658. vm._watchers = [];
  5659. var opts = vm.$options;
  5660. if (opts.props) { initProps(vm, opts.props); }
  5661. if (opts.methods) { initMethods(vm, opts.methods); }
  5662. if (opts.data) {
  5663. initData(vm);
  5664. } else {
  5665. observe(vm._data = {}, true /* asRootData */);
  5666. }
  5667. if (opts.computed) { initComputed(vm, opts.computed); }
  5668. if (opts.watch && opts.watch !== nativeWatch) {
  5669. initWatch(vm, opts.watch);
  5670. }
  5671. }
  5672. function initProps (vm, propsOptions) {
  5673. var propsData = vm.$options.propsData || {};
  5674. var props = vm._props = {};
  5675. // cache prop keys so that future props updates can iterate using Array
  5676. // instead of dynamic object key enumeration.
  5677. var keys = vm.$options._propKeys = [];
  5678. var isRoot = !vm.$parent;
  5679. // root instance props should be converted
  5680. if (!isRoot) {
  5681. toggleObserving(false);
  5682. }
  5683. var loop = function ( key ) {
  5684. keys.push(key);
  5685. var value = validateProp(key, propsOptions, propsData, vm);
  5686. /* istanbul ignore else */
  5687. if (true) {
  5688. var hyphenatedKey = hyphenate(key);
  5689. if (isReservedAttribute(hyphenatedKey) ||
  5690. config.isReservedAttr(hyphenatedKey)) {
  5691. warn(
  5692. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  5693. vm
  5694. );
  5695. }
  5696. defineReactive$$1(props, key, value, function () {
  5697. if (!isRoot && !isUpdatingChildComponent) {
  5698. {
  5699. if(vm.mpHost === 'mp-baidu'){//百度 observer 在 setData callback 之后触发,直接忽略该 warn
  5700. return
  5701. }
  5702. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  5703. if(
  5704. key === 'value' &&
  5705. Array.isArray(vm.$options.behaviors) &&
  5706. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  5707. ){
  5708. return
  5709. }
  5710. if(vm._getFormData){
  5711. return
  5712. }
  5713. var $parent = vm.$parent;
  5714. while($parent){
  5715. if($parent.__next_tick_pending){
  5716. return
  5717. }
  5718. $parent = $parent.$parent;
  5719. }
  5720. }
  5721. warn(
  5722. "Avoid mutating a prop directly since the value will be " +
  5723. "overwritten whenever the parent component re-renders. " +
  5724. "Instead, use a data or computed property based on the prop's " +
  5725. "value. Prop being mutated: \"" + key + "\"",
  5726. vm
  5727. );
  5728. }
  5729. });
  5730. } else {}
  5731. // static props are already proxied on the component's prototype
  5732. // during Vue.extend(). We only need to proxy props defined at
  5733. // instantiation here.
  5734. if (!(key in vm)) {
  5735. proxy(vm, "_props", key);
  5736. }
  5737. };
  5738. for (var key in propsOptions) loop( key );
  5739. toggleObserving(true);
  5740. }
  5741. function initData (vm) {
  5742. var data = vm.$options.data;
  5743. data = vm._data = typeof data === 'function'
  5744. ? getData(data, vm)
  5745. : data || {};
  5746. if (!isPlainObject(data)) {
  5747. data = {};
  5748. true && warn(
  5749. 'data functions should return an object:\n' +
  5750. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  5751. vm
  5752. );
  5753. }
  5754. // proxy data on instance
  5755. var keys = Object.keys(data);
  5756. var props = vm.$options.props;
  5757. var methods = vm.$options.methods;
  5758. var i = keys.length;
  5759. while (i--) {
  5760. var key = keys[i];
  5761. if (true) {
  5762. if (methods && hasOwn(methods, key)) {
  5763. warn(
  5764. ("Method \"" + key + "\" has already been defined as a data property."),
  5765. vm
  5766. );
  5767. }
  5768. }
  5769. if (props && hasOwn(props, key)) {
  5770. true && warn(
  5771. "The data property \"" + key + "\" is already declared as a prop. " +
  5772. "Use prop default value instead.",
  5773. vm
  5774. );
  5775. } else if (!isReserved(key)) {
  5776. proxy(vm, "_data", key);
  5777. }
  5778. }
  5779. // observe data
  5780. observe(data, true /* asRootData */);
  5781. }
  5782. function getData (data, vm) {
  5783. // #7573 disable dep collection when invoking data getters
  5784. pushTarget();
  5785. try {
  5786. return data.call(vm, vm)
  5787. } catch (e) {
  5788. handleError(e, vm, "data()");
  5789. return {}
  5790. } finally {
  5791. popTarget();
  5792. }
  5793. }
  5794. var computedWatcherOptions = { lazy: true };
  5795. function initComputed (vm, computed) {
  5796. // $flow-disable-line
  5797. var watchers = vm._computedWatchers = Object.create(null);
  5798. // computed properties are just getters during SSR
  5799. var isSSR = isServerRendering();
  5800. for (var key in computed) {
  5801. var userDef = computed[key];
  5802. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  5803. if ( true && getter == null) {
  5804. warn(
  5805. ("Getter is missing for computed property \"" + key + "\"."),
  5806. vm
  5807. );
  5808. }
  5809. if (!isSSR) {
  5810. // create internal watcher for the computed property.
  5811. watchers[key] = new Watcher(
  5812. vm,
  5813. getter || noop,
  5814. noop,
  5815. computedWatcherOptions
  5816. );
  5817. }
  5818. // component-defined computed properties are already defined on the
  5819. // component prototype. We only need to define computed properties defined
  5820. // at instantiation here.
  5821. if (!(key in vm)) {
  5822. defineComputed(vm, key, userDef);
  5823. } else if (true) {
  5824. if (key in vm.$data) {
  5825. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  5826. } else if (vm.$options.props && key in vm.$options.props) {
  5827. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  5828. }
  5829. }
  5830. }
  5831. }
  5832. function defineComputed (
  5833. target,
  5834. key,
  5835. userDef
  5836. ) {
  5837. var shouldCache = !isServerRendering();
  5838. if (typeof userDef === 'function') {
  5839. sharedPropertyDefinition.get = shouldCache
  5840. ? createComputedGetter(key)
  5841. : createGetterInvoker(userDef);
  5842. sharedPropertyDefinition.set = noop;
  5843. } else {
  5844. sharedPropertyDefinition.get = userDef.get
  5845. ? shouldCache && userDef.cache !== false
  5846. ? createComputedGetter(key)
  5847. : createGetterInvoker(userDef.get)
  5848. : noop;
  5849. sharedPropertyDefinition.set = userDef.set || noop;
  5850. }
  5851. if ( true &&
  5852. sharedPropertyDefinition.set === noop) {
  5853. sharedPropertyDefinition.set = function () {
  5854. warn(
  5855. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  5856. this
  5857. );
  5858. };
  5859. }
  5860. Object.defineProperty(target, key, sharedPropertyDefinition);
  5861. }
  5862. function createComputedGetter (key) {
  5863. return function computedGetter () {
  5864. var watcher = this._computedWatchers && this._computedWatchers[key];
  5865. if (watcher) {
  5866. if (watcher.dirty) {
  5867. watcher.evaluate();
  5868. }
  5869. if (Dep.SharedObject.target) {// fixed by xxxxxx
  5870. watcher.depend();
  5871. }
  5872. return watcher.value
  5873. }
  5874. }
  5875. }
  5876. function createGetterInvoker(fn) {
  5877. return function computedGetter () {
  5878. return fn.call(this, this)
  5879. }
  5880. }
  5881. function initMethods (vm, methods) {
  5882. var props = vm.$options.props;
  5883. for (var key in methods) {
  5884. if (true) {
  5885. if (typeof methods[key] !== 'function') {
  5886. warn(
  5887. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  5888. "Did you reference the function correctly?",
  5889. vm
  5890. );
  5891. }
  5892. if (props && hasOwn(props, key)) {
  5893. warn(
  5894. ("Method \"" + key + "\" has already been defined as a prop."),
  5895. vm
  5896. );
  5897. }
  5898. if ((key in vm) && isReserved(key)) {
  5899. warn(
  5900. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  5901. "Avoid defining component methods that start with _ or $."
  5902. );
  5903. }
  5904. }
  5905. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  5906. }
  5907. }
  5908. function initWatch (vm, watch) {
  5909. for (var key in watch) {
  5910. var handler = watch[key];
  5911. if (Array.isArray(handler)) {
  5912. for (var i = 0; i < handler.length; i++) {
  5913. createWatcher(vm, key, handler[i]);
  5914. }
  5915. } else {
  5916. createWatcher(vm, key, handler);
  5917. }
  5918. }
  5919. }
  5920. function createWatcher (
  5921. vm,
  5922. expOrFn,
  5923. handler,
  5924. options
  5925. ) {
  5926. if (isPlainObject(handler)) {
  5927. options = handler;
  5928. handler = handler.handler;
  5929. }
  5930. if (typeof handler === 'string') {
  5931. handler = vm[handler];
  5932. }
  5933. return vm.$watch(expOrFn, handler, options)
  5934. }
  5935. function stateMixin (Vue) {
  5936. // flow somehow has problems with directly declared definition object
  5937. // when using Object.defineProperty, so we have to procedurally build up
  5938. // the object here.
  5939. var dataDef = {};
  5940. dataDef.get = function () { return this._data };
  5941. var propsDef = {};
  5942. propsDef.get = function () { return this._props };
  5943. if (true) {
  5944. dataDef.set = function () {
  5945. warn(
  5946. 'Avoid replacing instance root $data. ' +
  5947. 'Use nested data properties instead.',
  5948. this
  5949. );
  5950. };
  5951. propsDef.set = function () {
  5952. warn("$props is readonly.", this);
  5953. };
  5954. }
  5955. Object.defineProperty(Vue.prototype, '$data', dataDef);
  5956. Object.defineProperty(Vue.prototype, '$props', propsDef);
  5957. Vue.prototype.$set = set;
  5958. Vue.prototype.$delete = del;
  5959. Vue.prototype.$watch = function (
  5960. expOrFn,
  5961. cb,
  5962. options
  5963. ) {
  5964. var vm = this;
  5965. if (isPlainObject(cb)) {
  5966. return createWatcher(vm, expOrFn, cb, options)
  5967. }
  5968. options = options || {};
  5969. options.user = true;
  5970. var watcher = new Watcher(vm, expOrFn, cb, options);
  5971. if (options.immediate) {
  5972. try {
  5973. cb.call(vm, watcher.value);
  5974. } catch (error) {
  5975. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  5976. }
  5977. }
  5978. return function unwatchFn () {
  5979. watcher.teardown();
  5980. }
  5981. };
  5982. }
  5983. /* */
  5984. var uid$3 = 0;
  5985. function initMixin (Vue) {
  5986. Vue.prototype._init = function (options) {
  5987. var vm = this;
  5988. // a uid
  5989. vm._uid = uid$3++;
  5990. var startTag, endTag;
  5991. /* istanbul ignore if */
  5992. if ( true && config.performance && mark) {
  5993. startTag = "vue-perf-start:" + (vm._uid);
  5994. endTag = "vue-perf-end:" + (vm._uid);
  5995. mark(startTag);
  5996. }
  5997. // a flag to avoid this being observed
  5998. vm._isVue = true;
  5999. // merge options
  6000. if (options && options._isComponent) {
  6001. // optimize internal component instantiation
  6002. // since dynamic options merging is pretty slow, and none of the
  6003. // internal component options needs special treatment.
  6004. initInternalComponent(vm, options);
  6005. } else {
  6006. vm.$options = mergeOptions(
  6007. resolveConstructorOptions(vm.constructor),
  6008. options || {},
  6009. vm
  6010. );
  6011. }
  6012. /* istanbul ignore else */
  6013. if (true) {
  6014. initProxy(vm);
  6015. } else {}
  6016. // expose real self
  6017. vm._self = vm;
  6018. initLifecycle(vm);
  6019. initEvents(vm);
  6020. initRender(vm);
  6021. callHook(vm, 'beforeCreate');
  6022. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  6023. initState(vm);
  6024. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  6025. !vm._$fallback && callHook(vm, 'created');
  6026. /* istanbul ignore if */
  6027. if ( true && config.performance && mark) {
  6028. vm._name = formatComponentName(vm, false);
  6029. mark(endTag);
  6030. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  6031. }
  6032. if (vm.$options.el) {
  6033. vm.$mount(vm.$options.el);
  6034. }
  6035. };
  6036. }
  6037. function initInternalComponent (vm, options) {
  6038. var opts = vm.$options = Object.create(vm.constructor.options);
  6039. // doing this because it's faster than dynamic enumeration.
  6040. var parentVnode = options._parentVnode;
  6041. opts.parent = options.parent;
  6042. opts._parentVnode = parentVnode;
  6043. var vnodeComponentOptions = parentVnode.componentOptions;
  6044. opts.propsData = vnodeComponentOptions.propsData;
  6045. opts._parentListeners = vnodeComponentOptions.listeners;
  6046. opts._renderChildren = vnodeComponentOptions.children;
  6047. opts._componentTag = vnodeComponentOptions.tag;
  6048. if (options.render) {
  6049. opts.render = options.render;
  6050. opts.staticRenderFns = options.staticRenderFns;
  6051. }
  6052. }
  6053. function resolveConstructorOptions (Ctor) {
  6054. var options = Ctor.options;
  6055. if (Ctor.super) {
  6056. var superOptions = resolveConstructorOptions(Ctor.super);
  6057. var cachedSuperOptions = Ctor.superOptions;
  6058. if (superOptions !== cachedSuperOptions) {
  6059. // super option changed,
  6060. // need to resolve new options.
  6061. Ctor.superOptions = superOptions;
  6062. // check if there are any late-modified/attached options (#4976)
  6063. var modifiedOptions = resolveModifiedOptions(Ctor);
  6064. // update base extend options
  6065. if (modifiedOptions) {
  6066. extend(Ctor.extendOptions, modifiedOptions);
  6067. }
  6068. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  6069. if (options.name) {
  6070. options.components[options.name] = Ctor;
  6071. }
  6072. }
  6073. }
  6074. return options
  6075. }
  6076. function resolveModifiedOptions (Ctor) {
  6077. var modified;
  6078. var latest = Ctor.options;
  6079. var sealed = Ctor.sealedOptions;
  6080. for (var key in latest) {
  6081. if (latest[key] !== sealed[key]) {
  6082. if (!modified) { modified = {}; }
  6083. modified[key] = latest[key];
  6084. }
  6085. }
  6086. return modified
  6087. }
  6088. function Vue (options) {
  6089. if ( true &&
  6090. !(this instanceof Vue)
  6091. ) {
  6092. warn('Vue is a constructor and should be called with the `new` keyword');
  6093. }
  6094. this._init(options);
  6095. }
  6096. initMixin(Vue);
  6097. stateMixin(Vue);
  6098. eventsMixin(Vue);
  6099. lifecycleMixin(Vue);
  6100. renderMixin(Vue);
  6101. /* */
  6102. function initUse (Vue) {
  6103. Vue.use = function (plugin) {
  6104. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  6105. if (installedPlugins.indexOf(plugin) > -1) {
  6106. return this
  6107. }
  6108. // additional parameters
  6109. var args = toArray(arguments, 1);
  6110. args.unshift(this);
  6111. if (typeof plugin.install === 'function') {
  6112. plugin.install.apply(plugin, args);
  6113. } else if (typeof plugin === 'function') {
  6114. plugin.apply(null, args);
  6115. }
  6116. installedPlugins.push(plugin);
  6117. return this
  6118. };
  6119. }
  6120. /* */
  6121. function initMixin$1 (Vue) {
  6122. Vue.mixin = function (mixin) {
  6123. this.options = mergeOptions(this.options, mixin);
  6124. return this
  6125. };
  6126. }
  6127. /* */
  6128. function initExtend (Vue) {
  6129. /**
  6130. * Each instance constructor, including Vue, has a unique
  6131. * cid. This enables us to create wrapped "child
  6132. * constructors" for prototypal inheritance and cache them.
  6133. */
  6134. Vue.cid = 0;
  6135. var cid = 1;
  6136. /**
  6137. * Class inheritance
  6138. */
  6139. Vue.extend = function (extendOptions) {
  6140. extendOptions = extendOptions || {};
  6141. var Super = this;
  6142. var SuperId = Super.cid;
  6143. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  6144. if (cachedCtors[SuperId]) {
  6145. return cachedCtors[SuperId]
  6146. }
  6147. var name = extendOptions.name || Super.options.name;
  6148. if ( true && name) {
  6149. validateComponentName(name);
  6150. }
  6151. var Sub = function VueComponent (options) {
  6152. this._init(options);
  6153. };
  6154. Sub.prototype = Object.create(Super.prototype);
  6155. Sub.prototype.constructor = Sub;
  6156. Sub.cid = cid++;
  6157. Sub.options = mergeOptions(
  6158. Super.options,
  6159. extendOptions
  6160. );
  6161. Sub['super'] = Super;
  6162. // For props and computed properties, we define the proxy getters on
  6163. // the Vue instances at extension time, on the extended prototype. This
  6164. // avoids Object.defineProperty calls for each instance created.
  6165. if (Sub.options.props) {
  6166. initProps$1(Sub);
  6167. }
  6168. if (Sub.options.computed) {
  6169. initComputed$1(Sub);
  6170. }
  6171. // allow further extension/mixin/plugin usage
  6172. Sub.extend = Super.extend;
  6173. Sub.mixin = Super.mixin;
  6174. Sub.use = Super.use;
  6175. // create asset registers, so extended classes
  6176. // can have their private assets too.
  6177. ASSET_TYPES.forEach(function (type) {
  6178. Sub[type] = Super[type];
  6179. });
  6180. // enable recursive self-lookup
  6181. if (name) {
  6182. Sub.options.components[name] = Sub;
  6183. }
  6184. // keep a reference to the super options at extension time.
  6185. // later at instantiation we can check if Super's options have
  6186. // been updated.
  6187. Sub.superOptions = Super.options;
  6188. Sub.extendOptions = extendOptions;
  6189. Sub.sealedOptions = extend({}, Sub.options);
  6190. // cache constructor
  6191. cachedCtors[SuperId] = Sub;
  6192. return Sub
  6193. };
  6194. }
  6195. function initProps$1 (Comp) {
  6196. var props = Comp.options.props;
  6197. for (var key in props) {
  6198. proxy(Comp.prototype, "_props", key);
  6199. }
  6200. }
  6201. function initComputed$1 (Comp) {
  6202. var computed = Comp.options.computed;
  6203. for (var key in computed) {
  6204. defineComputed(Comp.prototype, key, computed[key]);
  6205. }
  6206. }
  6207. /* */
  6208. function initAssetRegisters (Vue) {
  6209. /**
  6210. * Create asset registration methods.
  6211. */
  6212. ASSET_TYPES.forEach(function (type) {
  6213. Vue[type] = function (
  6214. id,
  6215. definition
  6216. ) {
  6217. if (!definition) {
  6218. return this.options[type + 's'][id]
  6219. } else {
  6220. /* istanbul ignore if */
  6221. if ( true && type === 'component') {
  6222. validateComponentName(id);
  6223. }
  6224. if (type === 'component' && isPlainObject(definition)) {
  6225. definition.name = definition.name || id;
  6226. definition = this.options._base.extend(definition);
  6227. }
  6228. if (type === 'directive' && typeof definition === 'function') {
  6229. definition = { bind: definition, update: definition };
  6230. }
  6231. this.options[type + 's'][id] = definition;
  6232. return definition
  6233. }
  6234. };
  6235. });
  6236. }
  6237. /* */
  6238. function getComponentName (opts) {
  6239. return opts && (opts.Ctor.options.name || opts.tag)
  6240. }
  6241. function matches (pattern, name) {
  6242. if (Array.isArray(pattern)) {
  6243. return pattern.indexOf(name) > -1
  6244. } else if (typeof pattern === 'string') {
  6245. return pattern.split(',').indexOf(name) > -1
  6246. } else if (isRegExp(pattern)) {
  6247. return pattern.test(name)
  6248. }
  6249. /* istanbul ignore next */
  6250. return false
  6251. }
  6252. function pruneCache (keepAliveInstance, filter) {
  6253. var cache = keepAliveInstance.cache;
  6254. var keys = keepAliveInstance.keys;
  6255. var _vnode = keepAliveInstance._vnode;
  6256. for (var key in cache) {
  6257. var cachedNode = cache[key];
  6258. if (cachedNode) {
  6259. var name = getComponentName(cachedNode.componentOptions);
  6260. if (name && !filter(name)) {
  6261. pruneCacheEntry(cache, key, keys, _vnode);
  6262. }
  6263. }
  6264. }
  6265. }
  6266. function pruneCacheEntry (
  6267. cache,
  6268. key,
  6269. keys,
  6270. current
  6271. ) {
  6272. var cached$$1 = cache[key];
  6273. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  6274. cached$$1.componentInstance.$destroy();
  6275. }
  6276. cache[key] = null;
  6277. remove(keys, key);
  6278. }
  6279. var patternTypes = [String, RegExp, Array];
  6280. var KeepAlive = {
  6281. name: 'keep-alive',
  6282. abstract: true,
  6283. props: {
  6284. include: patternTypes,
  6285. exclude: patternTypes,
  6286. max: [String, Number]
  6287. },
  6288. created: function created () {
  6289. this.cache = Object.create(null);
  6290. this.keys = [];
  6291. },
  6292. destroyed: function destroyed () {
  6293. for (var key in this.cache) {
  6294. pruneCacheEntry(this.cache, key, this.keys);
  6295. }
  6296. },
  6297. mounted: function mounted () {
  6298. var this$1 = this;
  6299. this.$watch('include', function (val) {
  6300. pruneCache(this$1, function (name) { return matches(val, name); });
  6301. });
  6302. this.$watch('exclude', function (val) {
  6303. pruneCache(this$1, function (name) { return !matches(val, name); });
  6304. });
  6305. },
  6306. render: function render () {
  6307. var slot = this.$slots.default;
  6308. var vnode = getFirstComponentChild(slot);
  6309. var componentOptions = vnode && vnode.componentOptions;
  6310. if (componentOptions) {
  6311. // check pattern
  6312. var name = getComponentName(componentOptions);
  6313. var ref = this;
  6314. var include = ref.include;
  6315. var exclude = ref.exclude;
  6316. if (
  6317. // not included
  6318. (include && (!name || !matches(include, name))) ||
  6319. // excluded
  6320. (exclude && name && matches(exclude, name))
  6321. ) {
  6322. return vnode
  6323. }
  6324. var ref$1 = this;
  6325. var cache = ref$1.cache;
  6326. var keys = ref$1.keys;
  6327. var key = vnode.key == null
  6328. // same constructor may get registered as different local components
  6329. // so cid alone is not enough (#3269)
  6330. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6331. : vnode.key;
  6332. if (cache[key]) {
  6333. vnode.componentInstance = cache[key].componentInstance;
  6334. // make current key freshest
  6335. remove(keys, key);
  6336. keys.push(key);
  6337. } else {
  6338. cache[key] = vnode;
  6339. keys.push(key);
  6340. // prune oldest entry
  6341. if (this.max && keys.length > parseInt(this.max)) {
  6342. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6343. }
  6344. }
  6345. vnode.data.keepAlive = true;
  6346. }
  6347. return vnode || (slot && slot[0])
  6348. }
  6349. };
  6350. var builtInComponents = {
  6351. KeepAlive: KeepAlive
  6352. };
  6353. /* */
  6354. function initGlobalAPI (Vue) {
  6355. // config
  6356. var configDef = {};
  6357. configDef.get = function () { return config; };
  6358. if (true) {
  6359. configDef.set = function () {
  6360. warn(
  6361. 'Do not replace the Vue.config object, set individual fields instead.'
  6362. );
  6363. };
  6364. }
  6365. Object.defineProperty(Vue, 'config', configDef);
  6366. // exposed util methods.
  6367. // NOTE: these are not considered part of the public API - avoid relying on
  6368. // them unless you are aware of the risk.
  6369. Vue.util = {
  6370. warn: warn,
  6371. extend: extend,
  6372. mergeOptions: mergeOptions,
  6373. defineReactive: defineReactive$$1
  6374. };
  6375. Vue.set = set;
  6376. Vue.delete = del;
  6377. Vue.nextTick = nextTick;
  6378. // 2.6 explicit observable API
  6379. Vue.observable = function (obj) {
  6380. observe(obj);
  6381. return obj
  6382. };
  6383. Vue.options = Object.create(null);
  6384. ASSET_TYPES.forEach(function (type) {
  6385. Vue.options[type + 's'] = Object.create(null);
  6386. });
  6387. // this is used to identify the "base" constructor to extend all plain-object
  6388. // components with in Weex's multi-instance scenarios.
  6389. Vue.options._base = Vue;
  6390. extend(Vue.options.components, builtInComponents);
  6391. initUse(Vue);
  6392. initMixin$1(Vue);
  6393. initExtend(Vue);
  6394. initAssetRegisters(Vue);
  6395. }
  6396. initGlobalAPI(Vue);
  6397. Object.defineProperty(Vue.prototype, '$isServer', {
  6398. get: isServerRendering
  6399. });
  6400. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6401. get: function get () {
  6402. /* istanbul ignore next */
  6403. return this.$vnode && this.$vnode.ssrContext
  6404. }
  6405. });
  6406. // expose FunctionalRenderContext for ssr runtime helper installation
  6407. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6408. value: FunctionalRenderContext
  6409. });
  6410. Vue.version = '2.6.11';
  6411. /**
  6412. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  6413. */
  6414. var ARRAYTYPE = '[object Array]';
  6415. var OBJECTTYPE = '[object Object]';
  6416. // const FUNCTIONTYPE = '[object Function]'
  6417. function diff(current, pre) {
  6418. var result = {};
  6419. syncKeys(current, pre);
  6420. _diff(current, pre, '', result);
  6421. return result
  6422. }
  6423. function syncKeys(current, pre) {
  6424. if (current === pre) { return }
  6425. var rootCurrentType = type(current);
  6426. var rootPreType = type(pre);
  6427. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6428. if(Object.keys(current).length >= Object.keys(pre).length){
  6429. for (var key in pre) {
  6430. var currentValue = current[key];
  6431. if (currentValue === undefined) {
  6432. current[key] = null;
  6433. } else {
  6434. syncKeys(currentValue, pre[key]);
  6435. }
  6436. }
  6437. }
  6438. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6439. if (current.length >= pre.length) {
  6440. pre.forEach(function (item, index) {
  6441. syncKeys(current[index], item);
  6442. });
  6443. }
  6444. }
  6445. }
  6446. function _diff(current, pre, path, result) {
  6447. if (current === pre) { return }
  6448. var rootCurrentType = type(current);
  6449. var rootPreType = type(pre);
  6450. if (rootCurrentType == OBJECTTYPE) {
  6451. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6452. setResult(result, path, current);
  6453. } else {
  6454. var loop = function ( key ) {
  6455. var currentValue = current[key];
  6456. var preValue = pre[key];
  6457. var currentType = type(currentValue);
  6458. var preType = type(preValue);
  6459. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6460. if (currentValue != pre[key]) {
  6461. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6462. }
  6463. } else if (currentType == ARRAYTYPE) {
  6464. if (preType != ARRAYTYPE) {
  6465. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6466. } else {
  6467. if (currentValue.length < preValue.length) {
  6468. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6469. } else {
  6470. currentValue.forEach(function (item, index) {
  6471. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  6472. });
  6473. }
  6474. }
  6475. } else if (currentType == OBJECTTYPE) {
  6476. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6477. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6478. } else {
  6479. for (var subKey in currentValue) {
  6480. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  6481. }
  6482. }
  6483. }
  6484. };
  6485. for (var key in current) loop( key );
  6486. }
  6487. } else if (rootCurrentType == ARRAYTYPE) {
  6488. if (rootPreType != ARRAYTYPE) {
  6489. setResult(result, path, current);
  6490. } else {
  6491. if (current.length < pre.length) {
  6492. setResult(result, path, current);
  6493. } else {
  6494. current.forEach(function (item, index) {
  6495. _diff(item, pre[index], path + '[' + index + ']', result);
  6496. });
  6497. }
  6498. }
  6499. } else {
  6500. setResult(result, path, current);
  6501. }
  6502. }
  6503. function setResult(result, k, v) {
  6504. // if (type(v) != FUNCTIONTYPE) {
  6505. result[k] = v;
  6506. // }
  6507. }
  6508. function type(obj) {
  6509. return Object.prototype.toString.call(obj)
  6510. }
  6511. /* */
  6512. function flushCallbacks$1(vm) {
  6513. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  6514. if (Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6515. var mpInstance = vm.$scope;
  6516. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6517. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  6518. }
  6519. var copies = vm.__next_tick_callbacks.slice(0);
  6520. vm.__next_tick_callbacks.length = 0;
  6521. for (var i = 0; i < copies.length; i++) {
  6522. copies[i]();
  6523. }
  6524. }
  6525. }
  6526. function hasRenderWatcher(vm) {
  6527. return queue.find(function (watcher) { return vm._watcher === watcher; })
  6528. }
  6529. function nextTick$1(vm, cb) {
  6530. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  6531. //2.nextTick 之前存在 render watcher
  6532. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  6533. if(Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6534. var mpInstance = vm.$scope;
  6535. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6536. ']:nextVueTick');
  6537. }
  6538. return nextTick(cb, vm)
  6539. }else{
  6540. if(Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  6541. var mpInstance$1 = vm.$scope;
  6542. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  6543. ']:nextMPTick');
  6544. }
  6545. }
  6546. var _resolve;
  6547. if (!vm.__next_tick_callbacks) {
  6548. vm.__next_tick_callbacks = [];
  6549. }
  6550. vm.__next_tick_callbacks.push(function () {
  6551. if (cb) {
  6552. try {
  6553. cb.call(vm);
  6554. } catch (e) {
  6555. handleError(e, vm, 'nextTick');
  6556. }
  6557. } else if (_resolve) {
  6558. _resolve(vm);
  6559. }
  6560. });
  6561. // $flow-disable-line
  6562. if (!cb && typeof Promise !== 'undefined') {
  6563. return new Promise(function (resolve) {
  6564. _resolve = resolve;
  6565. })
  6566. }
  6567. }
  6568. /* */
  6569. function cloneWithData(vm) {
  6570. // 确保当前 vm 所有数据被同步
  6571. var ret = Object.create(null);
  6572. var dataKeys = [].concat(
  6573. Object.keys(vm._data || {}),
  6574. Object.keys(vm._computedWatchers || {}));
  6575. dataKeys.reduce(function(ret, key) {
  6576. ret[key] = vm[key];
  6577. return ret
  6578. }, ret);
  6579. // vue-composition-api
  6580. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  6581. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  6582. if (rawBindings) {
  6583. Object.keys(rawBindings).forEach(function (key) {
  6584. ret[key] = vm[key];
  6585. });
  6586. }
  6587. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  6588. Object.assign(ret, vm.$mp.data || {});
  6589. if (
  6590. Array.isArray(vm.$options.behaviors) &&
  6591. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6592. ) { //form-field
  6593. ret['name'] = vm.name;
  6594. ret['value'] = vm.value;
  6595. }
  6596. return JSON.parse(JSON.stringify(ret))
  6597. }
  6598. var patch = function(oldVnode, vnode) {
  6599. var this$1 = this;
  6600. if (vnode === null) { //destroy
  6601. return
  6602. }
  6603. if (this.mpType === 'page' || this.mpType === 'component') {
  6604. var mpInstance = this.$scope;
  6605. var data = Object.create(null);
  6606. try {
  6607. data = cloneWithData(this);
  6608. } catch (err) {
  6609. console.error(err);
  6610. }
  6611. data.__webviewId__ = mpInstance.data.__webviewId__;
  6612. var mpData = Object.create(null);
  6613. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  6614. mpData[key] = mpInstance.data[key];
  6615. });
  6616. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  6617. if (Object.keys(diffData).length) {
  6618. if (Object({"VUE_APP_NAME":"sqxp-uniapp","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6619. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  6620. ']差量更新',
  6621. JSON.stringify(diffData));
  6622. }
  6623. this.__next_tick_pending = true;
  6624. mpInstance.setData(diffData, function () {
  6625. this$1.__next_tick_pending = false;
  6626. flushCallbacks$1(this$1);
  6627. });
  6628. } else {
  6629. flushCallbacks$1(this);
  6630. }
  6631. }
  6632. };
  6633. /* */
  6634. function createEmptyRender() {
  6635. }
  6636. function mountComponent$1(
  6637. vm,
  6638. el,
  6639. hydrating
  6640. ) {
  6641. if (!vm.mpType) {//main.js 中的 new Vue
  6642. return vm
  6643. }
  6644. if (vm.mpType === 'app') {
  6645. vm.$options.render = createEmptyRender;
  6646. }
  6647. if (!vm.$options.render) {
  6648. vm.$options.render = createEmptyRender;
  6649. if (true) {
  6650. /* istanbul ignore if */
  6651. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  6652. vm.$options.el || el) {
  6653. warn(
  6654. 'You are using the runtime-only build of Vue where the template ' +
  6655. 'compiler is not available. Either pre-compile the templates into ' +
  6656. 'render functions, or use the compiler-included build.',
  6657. vm
  6658. );
  6659. } else {
  6660. warn(
  6661. 'Failed to mount component: template or render function not defined.',
  6662. vm
  6663. );
  6664. }
  6665. }
  6666. }
  6667. !vm._$fallback && callHook(vm, 'beforeMount');
  6668. var updateComponent = function () {
  6669. vm._update(vm._render(), hydrating);
  6670. };
  6671. // we set this to vm._watcher inside the watcher's constructor
  6672. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  6673. // component's mounted hook), which relies on vm._watcher being already defined
  6674. new Watcher(vm, updateComponent, noop, {
  6675. before: function before() {
  6676. if (vm._isMounted && !vm._isDestroyed) {
  6677. callHook(vm, 'beforeUpdate');
  6678. }
  6679. }
  6680. }, true /* isRenderWatcher */);
  6681. hydrating = false;
  6682. return vm
  6683. }
  6684. /* */
  6685. function renderClass (
  6686. staticClass,
  6687. dynamicClass
  6688. ) {
  6689. if (isDef(staticClass) || isDef(dynamicClass)) {
  6690. return concat(staticClass, stringifyClass(dynamicClass))
  6691. }
  6692. /* istanbul ignore next */
  6693. return ''
  6694. }
  6695. function concat (a, b) {
  6696. return a ? b ? (a + ' ' + b) : a : (b || '')
  6697. }
  6698. function stringifyClass (value) {
  6699. if (Array.isArray(value)) {
  6700. return stringifyArray(value)
  6701. }
  6702. if (isObject(value)) {
  6703. return stringifyObject(value)
  6704. }
  6705. if (typeof value === 'string') {
  6706. return value
  6707. }
  6708. /* istanbul ignore next */
  6709. return ''
  6710. }
  6711. function stringifyArray (value) {
  6712. var res = '';
  6713. var stringified;
  6714. for (var i = 0, l = value.length; i < l; i++) {
  6715. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6716. if (res) { res += ' '; }
  6717. res += stringified;
  6718. }
  6719. }
  6720. return res
  6721. }
  6722. function stringifyObject (value) {
  6723. var res = '';
  6724. for (var key in value) {
  6725. if (value[key]) {
  6726. if (res) { res += ' '; }
  6727. res += key;
  6728. }
  6729. }
  6730. return res
  6731. }
  6732. /* */
  6733. var parseStyleText = cached(function (cssText) {
  6734. var res = {};
  6735. var listDelimiter = /;(?![^(]*\))/g;
  6736. var propertyDelimiter = /:(.+)/;
  6737. cssText.split(listDelimiter).forEach(function (item) {
  6738. if (item) {
  6739. var tmp = item.split(propertyDelimiter);
  6740. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6741. }
  6742. });
  6743. return res
  6744. });
  6745. // normalize possible array / string values into Object
  6746. function normalizeStyleBinding (bindingStyle) {
  6747. if (Array.isArray(bindingStyle)) {
  6748. return toObject(bindingStyle)
  6749. }
  6750. if (typeof bindingStyle === 'string') {
  6751. return parseStyleText(bindingStyle)
  6752. }
  6753. return bindingStyle
  6754. }
  6755. /* */
  6756. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  6757. function getTarget(obj, path) {
  6758. var parts = path.split('.');
  6759. var key = parts[0];
  6760. if (key.indexOf('__$n') === 0) { //number index
  6761. key = parseInt(key.replace('__$n', ''));
  6762. }
  6763. if (parts.length === 1) {
  6764. return obj[key]
  6765. }
  6766. return getTarget(obj[key], parts.slice(1).join('.'))
  6767. }
  6768. function internalMixin(Vue) {
  6769. Vue.config.errorHandler = function(err, vm, info) {
  6770. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  6771. console.error(err);
  6772. /* eslint-disable no-undef */
  6773. var app = getApp();
  6774. if (app && app.onError) {
  6775. app.onError(err);
  6776. }
  6777. };
  6778. var oldEmit = Vue.prototype.$emit;
  6779. Vue.prototype.$emit = function(event) {
  6780. if (this.$scope && event) {
  6781. this.$scope['triggerEvent'](event, {
  6782. __args__: toArray(arguments, 1)
  6783. });
  6784. }
  6785. return oldEmit.apply(this, arguments)
  6786. };
  6787. Vue.prototype.$nextTick = function(fn) {
  6788. return nextTick$1(this, fn)
  6789. };
  6790. MP_METHODS.forEach(function (method) {
  6791. Vue.prototype[method] = function(args) {
  6792. if (this.$scope && this.$scope[method]) {
  6793. return this.$scope[method](args)
  6794. }
  6795. // mp-alipay
  6796. if (typeof my === 'undefined') {
  6797. return
  6798. }
  6799. if (method === 'createSelectorQuery') {
  6800. /* eslint-disable no-undef */
  6801. return my.createSelectorQuery(args)
  6802. } else if (method === 'createIntersectionObserver') {
  6803. /* eslint-disable no-undef */
  6804. return my.createIntersectionObserver(args)
  6805. }
  6806. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  6807. };
  6808. });
  6809. Vue.prototype.__init_provide = initProvide;
  6810. Vue.prototype.__init_injections = initInjections;
  6811. Vue.prototype.__call_hook = function(hook, args) {
  6812. var vm = this;
  6813. // #7573 disable dep collection when invoking lifecycle hooks
  6814. pushTarget();
  6815. var handlers = vm.$options[hook];
  6816. var info = hook + " hook";
  6817. var ret;
  6818. if (handlers) {
  6819. for (var i = 0, j = handlers.length; i < j; i++) {
  6820. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6821. }
  6822. }
  6823. if (vm._hasHookEvent) {
  6824. vm.$emit('hook:' + hook, args);
  6825. }
  6826. popTarget();
  6827. return ret
  6828. };
  6829. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  6830. if (Array.isArray(modifiers)) {
  6831. if (modifiers.indexOf('trim') !== -1) {
  6832. value = value.trim();
  6833. }
  6834. if (modifiers.indexOf('number') !== -1) {
  6835. value = this._n(value);
  6836. }
  6837. }
  6838. if (!target) {
  6839. target = this;
  6840. }
  6841. target[key] = value;
  6842. };
  6843. Vue.prototype.__set_sync = function(target, key, value) {
  6844. if (!target) {
  6845. target = this;
  6846. }
  6847. target[key] = value;
  6848. };
  6849. Vue.prototype.__get_orig = function(item) {
  6850. if (isPlainObject(item)) {
  6851. return item['$orig'] || item
  6852. }
  6853. return item
  6854. };
  6855. Vue.prototype.__get_value = function(dataPath, target) {
  6856. return getTarget(target || this, dataPath)
  6857. };
  6858. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  6859. return renderClass(staticClass, dynamicClass)
  6860. };
  6861. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  6862. if (!dynamicStyle && !staticStyle) {
  6863. return ''
  6864. }
  6865. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  6866. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  6867. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  6868. };
  6869. Vue.prototype.__map = function(val, iteratee) {
  6870. //TODO 暂不考虑 string
  6871. var ret, i, l, keys, key;
  6872. if (Array.isArray(val)) {
  6873. ret = new Array(val.length);
  6874. for (i = 0, l = val.length; i < l; i++) {
  6875. ret[i] = iteratee(val[i], i);
  6876. }
  6877. return ret
  6878. } else if (isObject(val)) {
  6879. keys = Object.keys(val);
  6880. ret = Object.create(null);
  6881. for (i = 0, l = keys.length; i < l; i++) {
  6882. key = keys[i];
  6883. ret[key] = iteratee(val[key], key, i);
  6884. }
  6885. return ret
  6886. } else if (typeof val === 'number') {
  6887. ret = new Array(val);
  6888. for (i = 0, l = val; i < l; i++) {
  6889. // 第一个参数暂时仍和小程序一致
  6890. ret[i] = iteratee(i, i);
  6891. }
  6892. return ret
  6893. }
  6894. return []
  6895. };
  6896. }
  6897. /* */
  6898. var LIFECYCLE_HOOKS$1 = [
  6899. //App
  6900. 'onLaunch',
  6901. 'onShow',
  6902. 'onHide',
  6903. 'onUniNViewMessage',
  6904. 'onPageNotFound',
  6905. 'onThemeChange',
  6906. 'onError',
  6907. 'onUnhandledRejection',
  6908. //Page
  6909. 'onInit',
  6910. 'onLoad',
  6911. // 'onShow',
  6912. 'onReady',
  6913. // 'onHide',
  6914. 'onUnload',
  6915. 'onPullDownRefresh',
  6916. 'onReachBottom',
  6917. 'onTabItemTap',
  6918. 'onAddToFavorites',
  6919. 'onShareTimeline',
  6920. 'onShareAppMessage',
  6921. 'onResize',
  6922. 'onPageScroll',
  6923. 'onNavigationBarButtonTap',
  6924. 'onBackPress',
  6925. 'onNavigationBarSearchInputChanged',
  6926. 'onNavigationBarSearchInputConfirmed',
  6927. 'onNavigationBarSearchInputClicked',
  6928. //Component
  6929. // 'onReady', // 兼容旧版本,应该移除该事件
  6930. 'onPageShow',
  6931. 'onPageHide',
  6932. 'onPageResize'
  6933. ];
  6934. function lifecycleMixin$1(Vue) {
  6935. //fixed vue-class-component
  6936. var oldExtend = Vue.extend;
  6937. Vue.extend = function(extendOptions) {
  6938. extendOptions = extendOptions || {};
  6939. var methods = extendOptions.methods;
  6940. if (methods) {
  6941. Object.keys(methods).forEach(function (methodName) {
  6942. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  6943. extendOptions[methodName] = methods[methodName];
  6944. delete methods[methodName];
  6945. }
  6946. });
  6947. }
  6948. return oldExtend.call(this, extendOptions)
  6949. };
  6950. var strategies = Vue.config.optionMergeStrategies;
  6951. var mergeHook = strategies.created;
  6952. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  6953. strategies[hook] = mergeHook;
  6954. });
  6955. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  6956. }
  6957. /* */
  6958. // install platform patch function
  6959. Vue.prototype.__patch__ = patch;
  6960. // public mount method
  6961. Vue.prototype.$mount = function(
  6962. el ,
  6963. hydrating
  6964. ) {
  6965. return mountComponent$1(this, el, hydrating)
  6966. };
  6967. lifecycleMixin$1(Vue);
  6968. internalMixin(Vue);
  6969. /* */
  6970. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  6971. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  6972. /***/ }),
  6973. /* 3 */
  6974. /*!***********************************!*\
  6975. !*** (webpack)/buildin/global.js ***!
  6976. \***********************************/
  6977. /*! no static exports found */
  6978. /***/ (function(module, exports) {
  6979. var g;
  6980. // This works in non-strict mode
  6981. g = (function() {
  6982. return this;
  6983. })();
  6984. try {
  6985. // This works if eval is allowed (see CSP)
  6986. g = g || new Function("return this")();
  6987. } catch (e) {
  6988. // This works if the window reference is available
  6989. if (typeof window === "object") g = window;
  6990. }
  6991. // g can still be undefined, but nothing to do about it...
  6992. // We return undefined, instead of nothing here, so it's
  6993. // easier to handle this case. if(!global) { ...}
  6994. module.exports = g;
  6995. /***/ }),
  6996. /* 4 */
  6997. /*!****************************************!*\
  6998. !*** F:/uniapp/sqxp-uniapp/pages.json ***!
  6999. \****************************************/
  7000. /*! no static exports found */
  7001. /***/ (function(module, exports) {
  7002. /***/ }),
  7003. /* 5 */,
  7004. /* 6 */,
  7005. /* 7 */,
  7006. /* 8 */
  7007. /*!*******************************************!*\
  7008. !*** F:/uniapp/sqxp-uniapp/utils/auth.js ***!
  7009. \*******************************************/
  7010. /*! no static exports found */
  7011. /***/ (function(module, exports, __webpack_require__) {
  7012. "use strict";
  7013. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.getToken = getToken;exports.setToken = setToken;exports.refreshToken = refreshToken;exports.removeToken = removeToken;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 9));
  7014. var _login = __webpack_require__(/*! @/api/login.js */ 12);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
  7015. var TokenKey = 'Admin-Token';
  7016. //获取token
  7017. function getToken() {return _getToken.apply(this, arguments);}
  7018. //设置token
  7019. function _getToken() {_getToken = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var tokenObj, res;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:tokenObj = uni.getStorageSync(TokenKey);if (!(new Date().getTime() - tokenObj.date < 1000 * 60 * 28)) {_context.next = 5;break;}return _context.abrupt("return", tokenObj.token);case 5:_context.next = 7;return (0, _login.login)();case 7:res = _context.sent;setToken(res.data.token);return _context.abrupt("return", res.data.token);case 10:case "end":return _context.stop();}}}, _callee);}));return _getToken.apply(this, arguments);}function setToken(token) {
  7020. var tokenObj = {
  7021. token: token,
  7022. date: new Date().getTime() };
  7023. return uni.setStorageSync(TokenKey, tokenObj);
  7024. }
  7025. //刷新token时间
  7026. function refreshToken(token) {
  7027. var tokenObj = uni.getStorageSync(TokenKey);
  7028. if (!tokenObj) return;
  7029. tokenObj.date = new Date().getTime();
  7030. return uni.setStorageSync(TokenKey, tokenObj);
  7031. }
  7032. //移除token
  7033. function removeToken() {
  7034. return uni.removeStorageSync(TokenKey);
  7035. }
  7036. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7037. /***/ }),
  7038. /* 9 */
  7039. /*!**********************************************************!*\
  7040. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  7041. \**********************************************************/
  7042. /*! no static exports found */
  7043. /***/ (function(module, exports, __webpack_require__) {
  7044. module.exports = __webpack_require__(/*! regenerator-runtime */ 10);
  7045. /***/ }),
  7046. /* 10 */
  7047. /*!************************************************************!*\
  7048. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  7049. \************************************************************/
  7050. /*! no static exports found */
  7051. /***/ (function(module, exports, __webpack_require__) {
  7052. /**
  7053. * Copyright (c) 2014-present, Facebook, Inc.
  7054. *
  7055. * This source code is licensed under the MIT license found in the
  7056. * LICENSE file in the root directory of this source tree.
  7057. */
  7058. // This method of obtaining a reference to the global object needs to be
  7059. // kept identical to the way it is obtained in runtime.js
  7060. var g = (function() {
  7061. return this || (typeof self === "object" && self);
  7062. })() || Function("return this")();
  7063. // Use `getOwnPropertyNames` because not all browsers support calling
  7064. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  7065. var hadRuntime = g.regeneratorRuntime &&
  7066. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  7067. // Save the old regeneratorRuntime in case it needs to be restored later.
  7068. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  7069. // Force reevalutation of runtime.js.
  7070. g.regeneratorRuntime = undefined;
  7071. module.exports = __webpack_require__(/*! ./runtime */ 11);
  7072. if (hadRuntime) {
  7073. // Restore the original runtime.
  7074. g.regeneratorRuntime = oldRuntime;
  7075. } else {
  7076. // Remove the global property added by runtime.js.
  7077. try {
  7078. delete g.regeneratorRuntime;
  7079. } catch(e) {
  7080. g.regeneratorRuntime = undefined;
  7081. }
  7082. }
  7083. /***/ }),
  7084. /* 11 */
  7085. /*!*****************************************************!*\
  7086. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  7087. \*****************************************************/
  7088. /*! no static exports found */
  7089. /***/ (function(module, exports) {
  7090. /**
  7091. * Copyright (c) 2014-present, Facebook, Inc.
  7092. *
  7093. * This source code is licensed under the MIT license found in the
  7094. * LICENSE file in the root directory of this source tree.
  7095. */
  7096. !(function(global) {
  7097. "use strict";
  7098. var Op = Object.prototype;
  7099. var hasOwn = Op.hasOwnProperty;
  7100. var undefined; // More compressible than void 0.
  7101. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  7102. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  7103. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  7104. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7105. var inModule = typeof module === "object";
  7106. var runtime = global.regeneratorRuntime;
  7107. if (runtime) {
  7108. if (inModule) {
  7109. // If regeneratorRuntime is defined globally and we're in a module,
  7110. // make the exports object identical to regeneratorRuntime.
  7111. module.exports = runtime;
  7112. }
  7113. // Don't bother evaluating the rest of this file if the runtime was
  7114. // already defined globally.
  7115. return;
  7116. }
  7117. // Define the runtime globally (as expected by generated code) as either
  7118. // module.exports (if we're in a module) or a new, empty object.
  7119. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  7120. function wrap(innerFn, outerFn, self, tryLocsList) {
  7121. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  7122. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  7123. var generator = Object.create(protoGenerator.prototype);
  7124. var context = new Context(tryLocsList || []);
  7125. // The ._invoke method unifies the implementations of the .next,
  7126. // .throw, and .return methods.
  7127. generator._invoke = makeInvokeMethod(innerFn, self, context);
  7128. return generator;
  7129. }
  7130. runtime.wrap = wrap;
  7131. // Try/catch helper to minimize deoptimizations. Returns a completion
  7132. // record like context.tryEntries[i].completion. This interface could
  7133. // have been (and was previously) designed to take a closure to be
  7134. // invoked without arguments, but in all the cases we care about we
  7135. // already have an existing method we want to call, so there's no need
  7136. // to create a new function object. We can even get away with assuming
  7137. // the method takes exactly one argument, since that happens to be true
  7138. // in every case, so we don't have to touch the arguments object. The
  7139. // only additional allocation required is the completion record, which
  7140. // has a stable shape and so hopefully should be cheap to allocate.
  7141. function tryCatch(fn, obj, arg) {
  7142. try {
  7143. return { type: "normal", arg: fn.call(obj, arg) };
  7144. } catch (err) {
  7145. return { type: "throw", arg: err };
  7146. }
  7147. }
  7148. var GenStateSuspendedStart = "suspendedStart";
  7149. var GenStateSuspendedYield = "suspendedYield";
  7150. var GenStateExecuting = "executing";
  7151. var GenStateCompleted = "completed";
  7152. // Returning this object from the innerFn has the same effect as
  7153. // breaking out of the dispatch switch statement.
  7154. var ContinueSentinel = {};
  7155. // Dummy constructor functions that we use as the .constructor and
  7156. // .constructor.prototype properties for functions that return Generator
  7157. // objects. For full spec compliance, you may wish to configure your
  7158. // minifier not to mangle the names of these two functions.
  7159. function Generator() {}
  7160. function GeneratorFunction() {}
  7161. function GeneratorFunctionPrototype() {}
  7162. // This is a polyfill for %IteratorPrototype% for environments that
  7163. // don't natively support it.
  7164. var IteratorPrototype = {};
  7165. IteratorPrototype[iteratorSymbol] = function () {
  7166. return this;
  7167. };
  7168. var getProto = Object.getPrototypeOf;
  7169. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  7170. if (NativeIteratorPrototype &&
  7171. NativeIteratorPrototype !== Op &&
  7172. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  7173. // This environment has a native %IteratorPrototype%; use it instead
  7174. // of the polyfill.
  7175. IteratorPrototype = NativeIteratorPrototype;
  7176. }
  7177. var Gp = GeneratorFunctionPrototype.prototype =
  7178. Generator.prototype = Object.create(IteratorPrototype);
  7179. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  7180. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  7181. GeneratorFunctionPrototype[toStringTagSymbol] =
  7182. GeneratorFunction.displayName = "GeneratorFunction";
  7183. // Helper for defining the .next, .throw, and .return methods of the
  7184. // Iterator interface in terms of a single ._invoke method.
  7185. function defineIteratorMethods(prototype) {
  7186. ["next", "throw", "return"].forEach(function(method) {
  7187. prototype[method] = function(arg) {
  7188. return this._invoke(method, arg);
  7189. };
  7190. });
  7191. }
  7192. runtime.isGeneratorFunction = function(genFun) {
  7193. var ctor = typeof genFun === "function" && genFun.constructor;
  7194. return ctor
  7195. ? ctor === GeneratorFunction ||
  7196. // For the native GeneratorFunction constructor, the best we can
  7197. // do is to check its .name property.
  7198. (ctor.displayName || ctor.name) === "GeneratorFunction"
  7199. : false;
  7200. };
  7201. runtime.mark = function(genFun) {
  7202. if (Object.setPrototypeOf) {
  7203. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  7204. } else {
  7205. genFun.__proto__ = GeneratorFunctionPrototype;
  7206. if (!(toStringTagSymbol in genFun)) {
  7207. genFun[toStringTagSymbol] = "GeneratorFunction";
  7208. }
  7209. }
  7210. genFun.prototype = Object.create(Gp);
  7211. return genFun;
  7212. };
  7213. // Within the body of any async function, `await x` is transformed to
  7214. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  7215. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  7216. // meant to be awaited.
  7217. runtime.awrap = function(arg) {
  7218. return { __await: arg };
  7219. };
  7220. function AsyncIterator(generator) {
  7221. function invoke(method, arg, resolve, reject) {
  7222. var record = tryCatch(generator[method], generator, arg);
  7223. if (record.type === "throw") {
  7224. reject(record.arg);
  7225. } else {
  7226. var result = record.arg;
  7227. var value = result.value;
  7228. if (value &&
  7229. typeof value === "object" &&
  7230. hasOwn.call(value, "__await")) {
  7231. return Promise.resolve(value.__await).then(function(value) {
  7232. invoke("next", value, resolve, reject);
  7233. }, function(err) {
  7234. invoke("throw", err, resolve, reject);
  7235. });
  7236. }
  7237. return Promise.resolve(value).then(function(unwrapped) {
  7238. // When a yielded Promise is resolved, its final value becomes
  7239. // the .value of the Promise<{value,done}> result for the
  7240. // current iteration.
  7241. result.value = unwrapped;
  7242. resolve(result);
  7243. }, function(error) {
  7244. // If a rejected Promise was yielded, throw the rejection back
  7245. // into the async generator function so it can be handled there.
  7246. return invoke("throw", error, resolve, reject);
  7247. });
  7248. }
  7249. }
  7250. var previousPromise;
  7251. function enqueue(method, arg) {
  7252. function callInvokeWithMethodAndArg() {
  7253. return new Promise(function(resolve, reject) {
  7254. invoke(method, arg, resolve, reject);
  7255. });
  7256. }
  7257. return previousPromise =
  7258. // If enqueue has been called before, then we want to wait until
  7259. // all previous Promises have been resolved before calling invoke,
  7260. // so that results are always delivered in the correct order. If
  7261. // enqueue has not been called before, then it is important to
  7262. // call invoke immediately, without waiting on a callback to fire,
  7263. // so that the async generator function has the opportunity to do
  7264. // any necessary setup in a predictable way. This predictability
  7265. // is why the Promise constructor synchronously invokes its
  7266. // executor callback, and why async functions synchronously
  7267. // execute code before the first await. Since we implement simple
  7268. // async functions in terms of async generators, it is especially
  7269. // important to get this right, even though it requires care.
  7270. previousPromise ? previousPromise.then(
  7271. callInvokeWithMethodAndArg,
  7272. // Avoid propagating failures to Promises returned by later
  7273. // invocations of the iterator.
  7274. callInvokeWithMethodAndArg
  7275. ) : callInvokeWithMethodAndArg();
  7276. }
  7277. // Define the unified helper method that is used to implement .next,
  7278. // .throw, and .return (see defineIteratorMethods).
  7279. this._invoke = enqueue;
  7280. }
  7281. defineIteratorMethods(AsyncIterator.prototype);
  7282. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  7283. return this;
  7284. };
  7285. runtime.AsyncIterator = AsyncIterator;
  7286. // Note that simple async functions are implemented on top of
  7287. // AsyncIterator objects; they just return a Promise for the value of
  7288. // the final result produced by the iterator.
  7289. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  7290. var iter = new AsyncIterator(
  7291. wrap(innerFn, outerFn, self, tryLocsList)
  7292. );
  7293. return runtime.isGeneratorFunction(outerFn)
  7294. ? iter // If outerFn is a generator, return the full iterator.
  7295. : iter.next().then(function(result) {
  7296. return result.done ? result.value : iter.next();
  7297. });
  7298. };
  7299. function makeInvokeMethod(innerFn, self, context) {
  7300. var state = GenStateSuspendedStart;
  7301. return function invoke(method, arg) {
  7302. if (state === GenStateExecuting) {
  7303. throw new Error("Generator is already running");
  7304. }
  7305. if (state === GenStateCompleted) {
  7306. if (method === "throw") {
  7307. throw arg;
  7308. }
  7309. // Be forgiving, per 25.3.3.3.3 of the spec:
  7310. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  7311. return doneResult();
  7312. }
  7313. context.method = method;
  7314. context.arg = arg;
  7315. while (true) {
  7316. var delegate = context.delegate;
  7317. if (delegate) {
  7318. var delegateResult = maybeInvokeDelegate(delegate, context);
  7319. if (delegateResult) {
  7320. if (delegateResult === ContinueSentinel) continue;
  7321. return delegateResult;
  7322. }
  7323. }
  7324. if (context.method === "next") {
  7325. // Setting context._sent for legacy support of Babel's
  7326. // function.sent implementation.
  7327. context.sent = context._sent = context.arg;
  7328. } else if (context.method === "throw") {
  7329. if (state === GenStateSuspendedStart) {
  7330. state = GenStateCompleted;
  7331. throw context.arg;
  7332. }
  7333. context.dispatchException(context.arg);
  7334. } else if (context.method === "return") {
  7335. context.abrupt("return", context.arg);
  7336. }
  7337. state = GenStateExecuting;
  7338. var record = tryCatch(innerFn, self, context);
  7339. if (record.type === "normal") {
  7340. // If an exception is thrown from innerFn, we leave state ===
  7341. // GenStateExecuting and loop back for another invocation.
  7342. state = context.done
  7343. ? GenStateCompleted
  7344. : GenStateSuspendedYield;
  7345. if (record.arg === ContinueSentinel) {
  7346. continue;
  7347. }
  7348. return {
  7349. value: record.arg,
  7350. done: context.done
  7351. };
  7352. } else if (record.type === "throw") {
  7353. state = GenStateCompleted;
  7354. // Dispatch the exception by looping back around to the
  7355. // context.dispatchException(context.arg) call above.
  7356. context.method = "throw";
  7357. context.arg = record.arg;
  7358. }
  7359. }
  7360. };
  7361. }
  7362. // Call delegate.iterator[context.method](context.arg) and handle the
  7363. // result, either by returning a { value, done } result from the
  7364. // delegate iterator, or by modifying context.method and context.arg,
  7365. // setting context.delegate to null, and returning the ContinueSentinel.
  7366. function maybeInvokeDelegate(delegate, context) {
  7367. var method = delegate.iterator[context.method];
  7368. if (method === undefined) {
  7369. // A .throw or .return when the delegate iterator has no .throw
  7370. // method always terminates the yield* loop.
  7371. context.delegate = null;
  7372. if (context.method === "throw") {
  7373. if (delegate.iterator.return) {
  7374. // If the delegate iterator has a return method, give it a
  7375. // chance to clean up.
  7376. context.method = "return";
  7377. context.arg = undefined;
  7378. maybeInvokeDelegate(delegate, context);
  7379. if (context.method === "throw") {
  7380. // If maybeInvokeDelegate(context) changed context.method from
  7381. // "return" to "throw", let that override the TypeError below.
  7382. return ContinueSentinel;
  7383. }
  7384. }
  7385. context.method = "throw";
  7386. context.arg = new TypeError(
  7387. "The iterator does not provide a 'throw' method");
  7388. }
  7389. return ContinueSentinel;
  7390. }
  7391. var record = tryCatch(method, delegate.iterator, context.arg);
  7392. if (record.type === "throw") {
  7393. context.method = "throw";
  7394. context.arg = record.arg;
  7395. context.delegate = null;
  7396. return ContinueSentinel;
  7397. }
  7398. var info = record.arg;
  7399. if (! info) {
  7400. context.method = "throw";
  7401. context.arg = new TypeError("iterator result is not an object");
  7402. context.delegate = null;
  7403. return ContinueSentinel;
  7404. }
  7405. if (info.done) {
  7406. // Assign the result of the finished delegate to the temporary
  7407. // variable specified by delegate.resultName (see delegateYield).
  7408. context[delegate.resultName] = info.value;
  7409. // Resume execution at the desired location (see delegateYield).
  7410. context.next = delegate.nextLoc;
  7411. // If context.method was "throw" but the delegate handled the
  7412. // exception, let the outer generator proceed normally. If
  7413. // context.method was "next", forget context.arg since it has been
  7414. // "consumed" by the delegate iterator. If context.method was
  7415. // "return", allow the original .return call to continue in the
  7416. // outer generator.
  7417. if (context.method !== "return") {
  7418. context.method = "next";
  7419. context.arg = undefined;
  7420. }
  7421. } else {
  7422. // Re-yield the result returned by the delegate method.
  7423. return info;
  7424. }
  7425. // The delegate iterator is finished, so forget it and continue with
  7426. // the outer generator.
  7427. context.delegate = null;
  7428. return ContinueSentinel;
  7429. }
  7430. // Define Generator.prototype.{next,throw,return} in terms of the
  7431. // unified ._invoke helper method.
  7432. defineIteratorMethods(Gp);
  7433. Gp[toStringTagSymbol] = "Generator";
  7434. // A Generator should always return itself as the iterator object when the
  7435. // @@iterator function is called on it. Some browsers' implementations of the
  7436. // iterator prototype chain incorrectly implement this, causing the Generator
  7437. // object to not be returned from this call. This ensures that doesn't happen.
  7438. // See https://github.com/facebook/regenerator/issues/274 for more details.
  7439. Gp[iteratorSymbol] = function() {
  7440. return this;
  7441. };
  7442. Gp.toString = function() {
  7443. return "[object Generator]";
  7444. };
  7445. function pushTryEntry(locs) {
  7446. var entry = { tryLoc: locs[0] };
  7447. if (1 in locs) {
  7448. entry.catchLoc = locs[1];
  7449. }
  7450. if (2 in locs) {
  7451. entry.finallyLoc = locs[2];
  7452. entry.afterLoc = locs[3];
  7453. }
  7454. this.tryEntries.push(entry);
  7455. }
  7456. function resetTryEntry(entry) {
  7457. var record = entry.completion || {};
  7458. record.type = "normal";
  7459. delete record.arg;
  7460. entry.completion = record;
  7461. }
  7462. function Context(tryLocsList) {
  7463. // The root entry object (effectively a try statement without a catch
  7464. // or a finally block) gives us a place to store values thrown from
  7465. // locations where there is no enclosing try statement.
  7466. this.tryEntries = [{ tryLoc: "root" }];
  7467. tryLocsList.forEach(pushTryEntry, this);
  7468. this.reset(true);
  7469. }
  7470. runtime.keys = function(object) {
  7471. var keys = [];
  7472. for (var key in object) {
  7473. keys.push(key);
  7474. }
  7475. keys.reverse();
  7476. // Rather than returning an object with a next method, we keep
  7477. // things simple and return the next function itself.
  7478. return function next() {
  7479. while (keys.length) {
  7480. var key = keys.pop();
  7481. if (key in object) {
  7482. next.value = key;
  7483. next.done = false;
  7484. return next;
  7485. }
  7486. }
  7487. // To avoid creating an additional object, we just hang the .value
  7488. // and .done properties off the next function object itself. This
  7489. // also ensures that the minifier will not anonymize the function.
  7490. next.done = true;
  7491. return next;
  7492. };
  7493. };
  7494. function values(iterable) {
  7495. if (iterable) {
  7496. var iteratorMethod = iterable[iteratorSymbol];
  7497. if (iteratorMethod) {
  7498. return iteratorMethod.call(iterable);
  7499. }
  7500. if (typeof iterable.next === "function") {
  7501. return iterable;
  7502. }
  7503. if (!isNaN(iterable.length)) {
  7504. var i = -1, next = function next() {
  7505. while (++i < iterable.length) {
  7506. if (hasOwn.call(iterable, i)) {
  7507. next.value = iterable[i];
  7508. next.done = false;
  7509. return next;
  7510. }
  7511. }
  7512. next.value = undefined;
  7513. next.done = true;
  7514. return next;
  7515. };
  7516. return next.next = next;
  7517. }
  7518. }
  7519. // Return an iterator with no values.
  7520. return { next: doneResult };
  7521. }
  7522. runtime.values = values;
  7523. function doneResult() {
  7524. return { value: undefined, done: true };
  7525. }
  7526. Context.prototype = {
  7527. constructor: Context,
  7528. reset: function(skipTempReset) {
  7529. this.prev = 0;
  7530. this.next = 0;
  7531. // Resetting context._sent for legacy support of Babel's
  7532. // function.sent implementation.
  7533. this.sent = this._sent = undefined;
  7534. this.done = false;
  7535. this.delegate = null;
  7536. this.method = "next";
  7537. this.arg = undefined;
  7538. this.tryEntries.forEach(resetTryEntry);
  7539. if (!skipTempReset) {
  7540. for (var name in this) {
  7541. // Not sure about the optimal order of these conditions:
  7542. if (name.charAt(0) === "t" &&
  7543. hasOwn.call(this, name) &&
  7544. !isNaN(+name.slice(1))) {
  7545. this[name] = undefined;
  7546. }
  7547. }
  7548. }
  7549. },
  7550. stop: function() {
  7551. this.done = true;
  7552. var rootEntry = this.tryEntries[0];
  7553. var rootRecord = rootEntry.completion;
  7554. if (rootRecord.type === "throw") {
  7555. throw rootRecord.arg;
  7556. }
  7557. return this.rval;
  7558. },
  7559. dispatchException: function(exception) {
  7560. if (this.done) {
  7561. throw exception;
  7562. }
  7563. var context = this;
  7564. function handle(loc, caught) {
  7565. record.type = "throw";
  7566. record.arg = exception;
  7567. context.next = loc;
  7568. if (caught) {
  7569. // If the dispatched exception was caught by a catch block,
  7570. // then let that catch block handle the exception normally.
  7571. context.method = "next";
  7572. context.arg = undefined;
  7573. }
  7574. return !! caught;
  7575. }
  7576. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7577. var entry = this.tryEntries[i];
  7578. var record = entry.completion;
  7579. if (entry.tryLoc === "root") {
  7580. // Exception thrown outside of any try block that could handle
  7581. // it, so set the completion value of the entire function to
  7582. // throw the exception.
  7583. return handle("end");
  7584. }
  7585. if (entry.tryLoc <= this.prev) {
  7586. var hasCatch = hasOwn.call(entry, "catchLoc");
  7587. var hasFinally = hasOwn.call(entry, "finallyLoc");
  7588. if (hasCatch && hasFinally) {
  7589. if (this.prev < entry.catchLoc) {
  7590. return handle(entry.catchLoc, true);
  7591. } else if (this.prev < entry.finallyLoc) {
  7592. return handle(entry.finallyLoc);
  7593. }
  7594. } else if (hasCatch) {
  7595. if (this.prev < entry.catchLoc) {
  7596. return handle(entry.catchLoc, true);
  7597. }
  7598. } else if (hasFinally) {
  7599. if (this.prev < entry.finallyLoc) {
  7600. return handle(entry.finallyLoc);
  7601. }
  7602. } else {
  7603. throw new Error("try statement without catch or finally");
  7604. }
  7605. }
  7606. }
  7607. },
  7608. abrupt: function(type, arg) {
  7609. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7610. var entry = this.tryEntries[i];
  7611. if (entry.tryLoc <= this.prev &&
  7612. hasOwn.call(entry, "finallyLoc") &&
  7613. this.prev < entry.finallyLoc) {
  7614. var finallyEntry = entry;
  7615. break;
  7616. }
  7617. }
  7618. if (finallyEntry &&
  7619. (type === "break" ||
  7620. type === "continue") &&
  7621. finallyEntry.tryLoc <= arg &&
  7622. arg <= finallyEntry.finallyLoc) {
  7623. // Ignore the finally entry if control is not jumping to a
  7624. // location outside the try/catch block.
  7625. finallyEntry = null;
  7626. }
  7627. var record = finallyEntry ? finallyEntry.completion : {};
  7628. record.type = type;
  7629. record.arg = arg;
  7630. if (finallyEntry) {
  7631. this.method = "next";
  7632. this.next = finallyEntry.finallyLoc;
  7633. return ContinueSentinel;
  7634. }
  7635. return this.complete(record);
  7636. },
  7637. complete: function(record, afterLoc) {
  7638. if (record.type === "throw") {
  7639. throw record.arg;
  7640. }
  7641. if (record.type === "break" ||
  7642. record.type === "continue") {
  7643. this.next = record.arg;
  7644. } else if (record.type === "return") {
  7645. this.rval = this.arg = record.arg;
  7646. this.method = "return";
  7647. this.next = "end";
  7648. } else if (record.type === "normal" && afterLoc) {
  7649. this.next = afterLoc;
  7650. }
  7651. return ContinueSentinel;
  7652. },
  7653. finish: function(finallyLoc) {
  7654. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7655. var entry = this.tryEntries[i];
  7656. if (entry.finallyLoc === finallyLoc) {
  7657. this.complete(entry.completion, entry.afterLoc);
  7658. resetTryEntry(entry);
  7659. return ContinueSentinel;
  7660. }
  7661. }
  7662. },
  7663. "catch": function(tryLoc) {
  7664. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7665. var entry = this.tryEntries[i];
  7666. if (entry.tryLoc === tryLoc) {
  7667. var record = entry.completion;
  7668. if (record.type === "throw") {
  7669. var thrown = record.arg;
  7670. resetTryEntry(entry);
  7671. }
  7672. return thrown;
  7673. }
  7674. }
  7675. // The context.catch method must only be called with a location
  7676. // argument that corresponds to a known catch block.
  7677. throw new Error("illegal catch attempt");
  7678. },
  7679. delegateYield: function(iterable, resultName, nextLoc) {
  7680. this.delegate = {
  7681. iterator: values(iterable),
  7682. resultName: resultName,
  7683. nextLoc: nextLoc
  7684. };
  7685. if (this.method === "next") {
  7686. // Deliberately forget the last sent value so that we don't
  7687. // accidentally pass it on to the delegate.
  7688. this.arg = undefined;
  7689. }
  7690. return ContinueSentinel;
  7691. }
  7692. };
  7693. })(
  7694. // In sloppy mode, unbound `this` refers to the global object, fallback to
  7695. // Function constructor if we're in global strict mode. That is sadly a form
  7696. // of indirect eval which violates Content Security Policy.
  7697. (function() {
  7698. return this || (typeof self === "object" && self);
  7699. })() || Function("return this")()
  7700. );
  7701. /***/ }),
  7702. /* 12 */
  7703. /*!******************************************!*\
  7704. !*** F:/uniapp/sqxp-uniapp/api/login.js ***!
  7705. \******************************************/
  7706. /*! no static exports found */
  7707. /***/ (function(module, exports, __webpack_require__) {
  7708. "use strict";
  7709. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.login = login;exports.getInfo = getInfo;exports.logout = logout;exports.bindUserCard = bindUserCard;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 9));var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
  7710. var baseUrl = 'http://192.168.8.213:8080/zzjs-admin';
  7711. //微信小程序登录code
  7712. function unilogin() {
  7713. return new Promise(function (reslove, err) {
  7714. uni.login({
  7715. provider: 'weixin',
  7716. success: function success(res) {
  7717. reslove(res);
  7718. } });
  7719. });
  7720. }
  7721. //微信小程序获取用户信息
  7722. function unigetUserInfo() {
  7723. return new Promise(function (reslove, err) {
  7724. uni.getSetting({
  7725. success: function success(res) {
  7726. if (res.authSetting['scope.userInfo']) {
  7727. // 已经授权,可以直接调用 getUserInfo 获取头像昵称
  7728. uni.getUserInfo({
  7729. provider: 'weixin',
  7730. success: function success(res) {
  7731. reslove(res);
  7732. } });
  7733. } else {
  7734. //未授权
  7735. reslove({
  7736. code: 400,
  7737. msg: '用户未授权' });
  7738. }
  7739. } });
  7740. });
  7741. }
  7742. // 登录方法
  7743. function login() {return _login.apply(this, arguments);}
  7744. // 获取用户详细信息
  7745. function _login() {_login = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee() {var res;return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:_context.next = 2;return unilogin();case 2:res = _context.sent;return _context.abrupt("return", (0, _request.default)({ url: baseUrl + '/login/jscode', method: 'post', params: { jscode: res.code }, header: { isLogin: true } }));case 4:case "end":return _context.stop();}}}, _callee);}));return _login.apply(this, arguments);}function getInfo() {return _getInfo.apply(this, arguments);}
  7746. // 退出方法
  7747. function _getInfo() {_getInfo = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee2() {var res, userInfo;return _regenerator.default.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return unigetUserInfo();case 2:res = _context2.sent;if (!(res.code !== 400)) {_context2.next = 15;break;}_context2.next = 6;return (0, _request.default)({ url: baseUrl + '/getInfo', method: 'get' });case 6:userInfo = _context2.sent;if (!(userInfo.data.student.nickName != res.userInfo.nickName || userInfo.data.student.headImage != res.userInfo.avatarUrl)) {_context2.next = 12;break;}userInfo.data.student.nickName = res.userInfo.nickName;userInfo.data.student.headImage = res.userInfo.avatarUrl;_context2.next = 12;return (0, _request.default)({ url: baseUrl + '/student/user/info', method: 'post', data: { nickName: res.userInfo.nickName, headImage: res.userInfo.avatarUrl } });case 12:return _context2.abrupt("return", userInfo);case 15: //用户拒绝授权
  7748. console.log(wxuserinfo);case 16:return _context2.abrupt("return", (0, _request.default)({ url: baseUrl + '/getInfo', method: 'get' }));case 17:case "end":return _context2.stop();}}}, _callee2);}));return _getInfo.apply(this, arguments);}function logout() {return (0, _request.default)({
  7749. url: '/logout',
  7750. method: 'post' });
  7751. }
  7752. // 绑定用户身份证信息
  7753. function bindUserCard(data) {
  7754. return (0, _request.default)({
  7755. url: baseUrl + '/gzpt/userInfo/bind',
  7756. method: 'put',
  7757. data: data });
  7758. }
  7759. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7760. /***/ }),
  7761. /* 13 */
  7762. /*!**********************************************!*\
  7763. !*** F:/uniapp/sqxp-uniapp/utils/request.js ***!
  7764. \**********************************************/
  7765. /*! no static exports found */
  7766. /***/ (function(module, exports, __webpack_require__) {
  7767. "use strict";
  7768. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _regenerator = _interopRequireDefault(__webpack_require__(/*! ./node_modules/@babel/runtime/regenerator */ 9));var _auth = __webpack_require__(/*! @/utils/auth */ 8);
  7769. var _login = __webpack_require__(/*! @/api/login.js */ 12);
  7770. var _errorCode = _interopRequireDefault(__webpack_require__(/*! @/utils/errorCode */ 14));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}
  7771. /**
  7772. * http请求封装
  7773. */
  7774. var myAxios = function myAxios(req) {
  7775. var query = '';
  7776. req.params && Object.keys(req.params).map(function (key, index) {
  7777. if (index) {
  7778. query += '&' + key + '=' + encodeURIComponent(req.params[key]);
  7779. } else {
  7780. query += '?' + key + '=' + encodeURIComponent(req.params[key]);
  7781. }
  7782. });
  7783. var reqData = {
  7784. url: req.baseURL ? req.baseURL : '' + req.url + query,
  7785. method: req.method,
  7786. data: _objectSpread({},
  7787. req.data),
  7788. header: _objectSpread({},
  7789. req.header),
  7790. timeout: req.timeout || 10000 };
  7791. // 请求拦截器
  7792. function reqMiddleware(_x) {return _reqMiddleware.apply(this, arguments);}
  7793. // 响应拦截器
  7794. function _reqMiddleware() {_reqMiddleware = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3(config) {var token;return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:if (!config.header.isLogin) {_context3.next = 2;break;}return _context3.abrupt("return", config);case 2:_context3.next = 4;return (0, _auth.getToken)();case 4:token = _context3.sent;config.header['Authorization'] = 'Bearer ' + token; // 让每个请求携带自定义token 请根据实际情况自行修改
  7795. return _context3.abrupt("return", config);case 7:case "end":return _context3.stop();}}}, _callee3);}));return _reqMiddleware.apply(this, arguments);}function resMiddleware(_x2) {return _resMiddleware.apply(this, arguments);}
  7796. // 2. 函数内部返回Promise 对象
  7797. function _resMiddleware() {_resMiddleware = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee4(res) {var code, msg;return _regenerator.default.wrap(function _callee4$(_context4) {while (1) {switch (_context4.prev = _context4.next) {case 0:code = res.data.code || 200; // 获取错误信息
  7798. msg = _errorCode.default[code] || res.data.msg || _errorCode.default['default']; //重置Authorization时间
  7799. if (code !== 401) (0, _auth.refreshToken)();if (code === 401) {console.log('拦截器信息:' + msg);} else if (code === 500) {console.log('拦截器信息:' + msg);} else if (code === 502) {console.log('拦截器信息:' + msg);} else if (code !== 200) {console.log('拦截器信息:' + msg);}return _context4.abrupt("return", res.data);case 5:case "end":return _context4.stop();}}}, _callee4);}));return _resMiddleware.apply(this, arguments);}return new Promise( /*#__PURE__*/function () {var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {return _regenerator.default.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:_context2.next = 2;return reqMiddleware(reqData);case 2:reqData = _context2.sent; // 3.wx.request() 小程序发送请求
  7800. wx.request(_objectSpread(_objectSpread({},
  7801. reqData), {}, {
  7802. // 请求成功之后调用的函数
  7803. success: function () {var _success = _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee(result) {return _regenerator.default.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:_context.next = 2;return (
  7804. resMiddleware(result));case 2:result = _context.sent;
  7805. resolve(result);case 4:case "end":return _context.stop();}}}, _callee);}));function success(_x5) {return _success.apply(this, arguments);}return success;}(),
  7806. // 请求失败之后调用的函数
  7807. fail: function fail(error) {
  7808. reject(error);
  7809. },
  7810. complete: function complete() {
  7811. } }));case 4:case "end":return _context2.stop();}}}, _callee2);}));return function (_x3, _x4) {return _ref.apply(this, arguments);};}());
  7812. };var _default =
  7813. myAxios;exports.default = _default;
  7814. /***/ }),
  7815. /* 14 */
  7816. /*!************************************************!*\
  7817. !*** F:/uniapp/sqxp-uniapp/utils/errorCode.js ***!
  7818. \************************************************/
  7819. /*! no static exports found */
  7820. /***/ (function(module, exports, __webpack_require__) {
  7821. "use strict";
  7822. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default = {
  7823. '401': '认证失败,无法访问系统资源',
  7824. '403': '当前操作没有权限',
  7825. '404': '访问资源不存在',
  7826. '500': '系统内部错误',
  7827. 'default': '系统未知错误,请反馈给管理员' };exports.default = _default;
  7828. /***/ }),
  7829. /* 15 */,
  7830. /* 16 */,
  7831. /* 17 */
  7832. /*!**********************************************************************************************************!*\
  7833. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  7834. \**********************************************************************************************************/
  7835. /*! exports provided: default */
  7836. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7837. "use strict";
  7838. __webpack_require__.r(__webpack_exports__);
  7839. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  7840. /* globals __VUE_SSR_CONTEXT__ */
  7841. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  7842. // This module is a runtime utility for cleaner component module output and will
  7843. // be included in the final webpack user bundle.
  7844. function normalizeComponent (
  7845. scriptExports,
  7846. render,
  7847. staticRenderFns,
  7848. functionalTemplate,
  7849. injectStyles,
  7850. scopeId,
  7851. moduleIdentifier, /* server only */
  7852. shadowMode, /* vue-cli only */
  7853. components, // fixed by xxxxxx auto components
  7854. renderjs // fixed by xxxxxx renderjs
  7855. ) {
  7856. // Vue.extend constructor export interop
  7857. var options = typeof scriptExports === 'function'
  7858. ? scriptExports.options
  7859. : scriptExports
  7860. // fixed by xxxxxx auto components
  7861. if (components) {
  7862. if (!options.components) {
  7863. options.components = {}
  7864. }
  7865. var hasOwn = Object.prototype.hasOwnProperty
  7866. for (var name in components) {
  7867. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  7868. options.components[name] = components[name]
  7869. }
  7870. }
  7871. }
  7872. // fixed by xxxxxx renderjs
  7873. if (renderjs) {
  7874. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  7875. this[renderjs.__module] = this
  7876. });
  7877. (options.mixins || (options.mixins = [])).push(renderjs)
  7878. }
  7879. // render functions
  7880. if (render) {
  7881. options.render = render
  7882. options.staticRenderFns = staticRenderFns
  7883. options._compiled = true
  7884. }
  7885. // functional template
  7886. if (functionalTemplate) {
  7887. options.functional = true
  7888. }
  7889. // scopedId
  7890. if (scopeId) {
  7891. options._scopeId = 'data-v-' + scopeId
  7892. }
  7893. var hook
  7894. if (moduleIdentifier) { // server build
  7895. hook = function (context) {
  7896. // 2.3 injection
  7897. context =
  7898. context || // cached call
  7899. (this.$vnode && this.$vnode.ssrContext) || // stateful
  7900. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  7901. // 2.2 with runInNewContext: true
  7902. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  7903. context = __VUE_SSR_CONTEXT__
  7904. }
  7905. // inject component styles
  7906. if (injectStyles) {
  7907. injectStyles.call(this, context)
  7908. }
  7909. // register component module identifier for async chunk inferrence
  7910. if (context && context._registeredComponents) {
  7911. context._registeredComponents.add(moduleIdentifier)
  7912. }
  7913. }
  7914. // used by ssr in case component is cached and beforeCreate
  7915. // never gets called
  7916. options._ssrRegister = hook
  7917. } else if (injectStyles) {
  7918. hook = shadowMode
  7919. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  7920. : injectStyles
  7921. }
  7922. if (hook) {
  7923. if (options.functional) {
  7924. // for template-only hot-reload because in that case the render fn doesn't
  7925. // go through the normalizer
  7926. options._injectStyles = hook
  7927. // register for functioal component in vue file
  7928. var originalRender = options.render
  7929. options.render = function renderWithStyleInjection (h, context) {
  7930. hook.call(context)
  7931. return originalRender(h, context)
  7932. }
  7933. } else {
  7934. // inject component registration as beforeCreate hook
  7935. var existing = options.beforeCreate
  7936. options.beforeCreate = existing
  7937. ? [].concat(existing, hook)
  7938. : [hook]
  7939. }
  7940. }
  7941. return {
  7942. exports: scriptExports,
  7943. options: options
  7944. }
  7945. }
  7946. /***/ }),
  7947. /* 18 */
  7948. /*!**************************************************************!*\
  7949. !*** F:/uniapp/sqxp-uniapp/wxcomponents/vant/toast/toast.js ***!
  7950. \**************************************************************/
  7951. /*! no static exports found */
  7952. /***/ (function(module, exports, __webpack_require__) {
  7953. "use strict";
  7954. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _validator = __webpack_require__(/*! ../common/validator */ 19);
  7955. var defaultOptions = {
  7956. type: 'text',
  7957. mask: false,
  7958. message: '',
  7959. show: true,
  7960. zIndex: 1000,
  7961. duration: 2000,
  7962. position: 'middle',
  7963. forbidClick: false,
  7964. loadingType: 'circular',
  7965. selector: '#van-toast' };
  7966. var queue = [];
  7967. var currentOptions = Object.assign({}, defaultOptions);
  7968. function parseOptions(message) {
  7969. return (0, _validator.isObj)(message) ? message : { message: message };
  7970. }
  7971. function getContext() {
  7972. var pages = getCurrentPages();
  7973. return pages[pages.length - 1];
  7974. }
  7975. function Toast(toastOptions) {
  7976. var options = Object.assign(
  7977. Object.assign({}, currentOptions),
  7978. parseOptions(toastOptions));
  7979. var context = options.context || getContext();
  7980. var toast = context.selectComponent(options.selector);
  7981. if (!toast) {
  7982. console.warn('未找到 van-toast 节点,请确认 selector 及 context 是否正确');
  7983. return;
  7984. }
  7985. delete options.context;
  7986. delete options.selector;
  7987. toast.clear = function () {
  7988. toast.setData({ show: false });
  7989. if (options.onClose) {
  7990. options.onClose();
  7991. }
  7992. };
  7993. queue.push(toast);
  7994. toast.setData(options);
  7995. clearTimeout(toast.timer);
  7996. if (options.duration != null && options.duration > 0) {
  7997. toast.timer = setTimeout(function () {
  7998. toast.clear();
  7999. queue = queue.filter(function (item) {return item !== toast;});
  8000. }, options.duration);
  8001. }
  8002. return toast;
  8003. }
  8004. var createMethod = function createMethod(type) {return function (options) {return (
  8005. Toast(Object.assign({ type: type }, parseOptions(options))));};};
  8006. Toast.loading = createMethod('loading');
  8007. Toast.success = createMethod('success');
  8008. Toast.fail = createMethod('fail');
  8009. Toast.clear = function () {
  8010. queue.forEach(function (toast) {
  8011. toast.clear();
  8012. });
  8013. queue = [];
  8014. };
  8015. Toast.setDefaultOptions = function (options) {
  8016. Object.assign(currentOptions, options);
  8017. };
  8018. Toast.resetDefaultOptions = function () {
  8019. currentOptions = Object.assign({}, defaultOptions);
  8020. };var _default =
  8021. Toast;exports.default = _default;
  8022. /***/ }),
  8023. /* 19 */
  8024. /*!*******************************************************************!*\
  8025. !*** F:/uniapp/sqxp-uniapp/wxcomponents/vant/common/validator.js ***!
  8026. \*******************************************************************/
  8027. /*! no static exports found */
  8028. /***/ (function(module, exports, __webpack_require__) {
  8029. "use strict";
  8030. Object.defineProperty(exports, "__esModule", { value: true });exports.isFunction = isFunction;exports.isPlainObject = isPlainObject;exports.isPromise = isPromise;exports.isDef = isDef;exports.isObj = isObj;exports.isNumber = isNumber;exports.isBoolean = isBoolean;exports.isImageUrl = isImageUrl;exports.isVideoUrl = isVideoUrl;function isFunction(val) {
  8031. return typeof val === 'function';
  8032. }
  8033. function isPlainObject(val) {
  8034. return val !== null && typeof val === 'object' && !Array.isArray(val);
  8035. }
  8036. function isPromise(val) {
  8037. return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
  8038. }
  8039. function isDef(value) {
  8040. return value !== undefined && value !== null;
  8041. }
  8042. function isObj(x) {
  8043. var type = typeof x;
  8044. return x !== null && (type === 'object' || type === 'function');
  8045. }
  8046. function isNumber(value) {
  8047. return /^\d+(\.\d+)?$/.test(value);
  8048. }
  8049. function isBoolean(value) {
  8050. return typeof value === 'boolean';
  8051. }
  8052. var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
  8053. var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
  8054. function isImageUrl(url) {
  8055. return IMAGE_REGEXP.test(url);
  8056. }
  8057. function isVideoUrl(url) {
  8058. return VIDEO_REGEXP.test(url);
  8059. }
  8060. /***/ }),
  8061. /* 20 */,
  8062. /* 21 */,
  8063. /* 22 */,
  8064. /* 23 */,
  8065. /* 24 */,
  8066. /* 25 */,
  8067. /* 26 */,
  8068. /* 27 */,
  8069. /* 28 */,
  8070. /* 29 */,
  8071. /* 30 */,
  8072. /* 31 */,
  8073. /* 32 */,
  8074. /* 33 */,
  8075. /* 34 */
  8076. /*!*******************************************!*\
  8077. !*** F:/uniapp/sqxp-uniapp/api/answer.js ***!
  8078. \*******************************************/
  8079. /*! no static exports found */
  8080. /***/ (function(module, exports, __webpack_require__) {
  8081. "use strict";
  8082. Object.defineProperty(exports, "__esModule", { value: true });exports.questionList = questionList;exports.questionListRandom = questionListRandom;exports.questionErrorList = questionErrorList;exports.questionErrorAdd = questionErrorAdd;exports.questionErrorDel = questionErrorDel;var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  8083. var baseUrl = 'http://192.168.8.213:8080/zzjs-admin';
  8084. // 获取题库列表
  8085. function questionList(params) {
  8086. return (0, _request.default)({
  8087. url: baseUrl + '/student/question/info/getQuestionInfoList',
  8088. method: 'get',
  8089. params: params });
  8090. }
  8091. // 获取随机题库列表
  8092. function questionListRandom(params) {
  8093. return (0, _request.default)({
  8094. url: baseUrl + '/student/question/info/getRandQuestionInfoList',
  8095. method: 'get',
  8096. params: params });
  8097. }
  8098. // 获取错题收藏列表
  8099. function questionErrorList(params) {
  8100. return (0, _request.default)({
  8101. url: baseUrl + '/student/question/error/getQuestionErrorList',
  8102. method: 'get',
  8103. params: params });
  8104. }
  8105. // 新增错题
  8106. function questionErrorAdd(id) {
  8107. return (0, _request.default)({
  8108. url: baseUrl + '/student/question/error',
  8109. method: 'post',
  8110. data: {
  8111. questionId: id } });
  8112. }
  8113. // 删除错题
  8114. function questionErrorDel(ids) {
  8115. return (0, _request.default)({
  8116. url: baseUrl + "/student/question/error/".concat(ids),
  8117. method: 'delete' });
  8118. }
  8119. /***/ }),
  8120. /* 35 */,
  8121. /* 36 */,
  8122. /* 37 */,
  8123. /* 38 */,
  8124. /* 39 */,
  8125. /* 40 */,
  8126. /* 41 */,
  8127. /* 42 */,
  8128. /* 43 */,
  8129. /* 44 */,
  8130. /* 45 */,
  8131. /* 46 */,
  8132. /* 47 */,
  8133. /* 48 */,
  8134. /* 49 */,
  8135. /* 50 */,
  8136. /* 51 */,
  8137. /* 52 */,
  8138. /* 53 */,
  8139. /* 54 */,
  8140. /* 55 */,
  8141. /* 56 */,
  8142. /* 57 */,
  8143. /* 58 */,
  8144. /* 59 */
  8145. /*!****************************************************************!*\
  8146. !*** F:/uniapp/sqxp-uniapp/wxcomponents/vant/dialog/dialog.js ***!
  8147. \****************************************************************/
  8148. /*! no static exports found */
  8149. /***/ (function(module, exports, __webpack_require__) {
  8150. "use strict";
  8151. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var queue = [];
  8152. var defaultOptions = {
  8153. show: false,
  8154. title: '',
  8155. width: null,
  8156. theme: 'default',
  8157. message: '',
  8158. zIndex: 100,
  8159. overlay: true,
  8160. selector: '#van-dialog',
  8161. className: '',
  8162. asyncClose: false,
  8163. beforeClose: null,
  8164. transition: 'scale',
  8165. customStyle: '',
  8166. messageAlign: '',
  8167. overlayStyle: '',
  8168. confirmButtonText: '确认',
  8169. cancelButtonText: '取消',
  8170. showConfirmButton: true,
  8171. showCancelButton: false,
  8172. closeOnClickOverlay: false,
  8173. confirmButtonOpenType: '' };
  8174. var currentOptions = Object.assign({}, defaultOptions);
  8175. function getContext() {
  8176. var pages = getCurrentPages();
  8177. return pages[pages.length - 1];
  8178. }
  8179. var Dialog = function Dialog(options) {
  8180. options = Object.assign(Object.assign({}, currentOptions), options);
  8181. return new Promise(function (resolve, reject) {
  8182. var context = options.context || getContext();
  8183. var dialog = context.selectComponent(options.selector);
  8184. delete options.context;
  8185. delete options.selector;
  8186. if (dialog) {
  8187. dialog.setData(
  8188. Object.assign(
  8189. {
  8190. callback: function callback(action, instance) {
  8191. action === 'confirm' ? resolve(instance) : reject(instance);
  8192. } },
  8193. options));
  8194. wx.nextTick(function () {
  8195. dialog.setData({ show: true });
  8196. });
  8197. queue.push(dialog);
  8198. } else {
  8199. console.warn(
  8200. '未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
  8201. }
  8202. });
  8203. };
  8204. Dialog.alert = function (options) {return Dialog(options);};
  8205. Dialog.confirm = function (options) {return (
  8206. Dialog(Object.assign({ showCancelButton: true }, options)));};
  8207. Dialog.close = function () {
  8208. queue.forEach(function (dialog) {
  8209. dialog.close();
  8210. });
  8211. queue = [];
  8212. };
  8213. Dialog.stopLoading = function () {
  8214. queue.forEach(function (dialog) {
  8215. dialog.stopLoading();
  8216. });
  8217. };
  8218. Dialog.currentOptions = currentOptions;
  8219. Dialog.defaultOptions = defaultOptions;
  8220. Dialog.setDefaultOptions = function (options) {
  8221. currentOptions = Object.assign(Object.assign({}, currentOptions), options);
  8222. Dialog.currentOptions = currentOptions;
  8223. };
  8224. Dialog.resetDefaultOptions = function () {
  8225. currentOptions = Object.assign({}, defaultOptions);
  8226. Dialog.currentOptions = currentOptions;
  8227. };
  8228. Dialog.resetDefaultOptions();var _default =
  8229. Dialog;exports.default = _default;
  8230. /***/ }),
  8231. /* 60 */,
  8232. /* 61 */,
  8233. /* 62 */,
  8234. /* 63 */,
  8235. /* 64 */,
  8236. /* 65 */,
  8237. /* 66 */,
  8238. /* 67 */,
  8239. /* 68 */,
  8240. /* 69 */,
  8241. /* 70 */,
  8242. /* 71 */,
  8243. /* 72 */,
  8244. /* 73 */,
  8245. /* 74 */,
  8246. /* 75 */,
  8247. /* 76 */,
  8248. /* 77 */,
  8249. /* 78 */,
  8250. /* 79 */,
  8251. /* 80 */,
  8252. /* 81 */
  8253. /*!***********************************************************!*\
  8254. !*** F:/uniapp/sqxp-uniapp/node_modules/crypto-js/md5.js ***!
  8255. \***********************************************************/
  8256. /*! no static exports found */
  8257. /***/ (function(module, exports, __webpack_require__) {
  8258. ;(function (root, factory) {
  8259. if (true) {
  8260. // CommonJS
  8261. module.exports = exports = factory(__webpack_require__(/*! ./core */ 82));
  8262. } else
  8263. {}
  8264. })(this, function (CryptoJS) {
  8265. (function (Math) {
  8266. // Shortcuts
  8267. var C = CryptoJS;
  8268. var C_lib = C.lib;
  8269. var WordArray = C_lib.WordArray;
  8270. var Hasher = C_lib.Hasher;
  8271. var C_algo = C.algo;
  8272. // Constants table
  8273. var T = [];
  8274. // Compute constants
  8275. (function () {
  8276. for (var i = 0; i < 64; i++) {
  8277. T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0;
  8278. }
  8279. })();
  8280. /**
  8281. * MD5 hash algorithm.
  8282. */
  8283. var MD5 = C_algo.MD5 = Hasher.extend({
  8284. _doReset: function _doReset() {
  8285. this._hash = new WordArray.init([
  8286. 0x67452301, 0xefcdab89,
  8287. 0x98badcfe, 0x10325476]);
  8288. },
  8289. _doProcessBlock: function _doProcessBlock(M, offset) {
  8290. // Swap endian
  8291. for (var i = 0; i < 16; i++) {
  8292. // Shortcuts
  8293. var offset_i = offset + i;
  8294. var M_offset_i = M[offset_i];
  8295. M[offset_i] =
  8296. (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff |
  8297. (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
  8298. }
  8299. // Shortcuts
  8300. var H = this._hash.words;
  8301. var M_offset_0 = M[offset + 0];
  8302. var M_offset_1 = M[offset + 1];
  8303. var M_offset_2 = M[offset + 2];
  8304. var M_offset_3 = M[offset + 3];
  8305. var M_offset_4 = M[offset + 4];
  8306. var M_offset_5 = M[offset + 5];
  8307. var M_offset_6 = M[offset + 6];
  8308. var M_offset_7 = M[offset + 7];
  8309. var M_offset_8 = M[offset + 8];
  8310. var M_offset_9 = M[offset + 9];
  8311. var M_offset_10 = M[offset + 10];
  8312. var M_offset_11 = M[offset + 11];
  8313. var M_offset_12 = M[offset + 12];
  8314. var M_offset_13 = M[offset + 13];
  8315. var M_offset_14 = M[offset + 14];
  8316. var M_offset_15 = M[offset + 15];
  8317. // Working varialbes
  8318. var a = H[0];
  8319. var b = H[1];
  8320. var c = H[2];
  8321. var d = H[3];
  8322. // Computation
  8323. a = FF(a, b, c, d, M_offset_0, 7, T[0]);
  8324. d = FF(d, a, b, c, M_offset_1, 12, T[1]);
  8325. c = FF(c, d, a, b, M_offset_2, 17, T[2]);
  8326. b = FF(b, c, d, a, M_offset_3, 22, T[3]);
  8327. a = FF(a, b, c, d, M_offset_4, 7, T[4]);
  8328. d = FF(d, a, b, c, M_offset_5, 12, T[5]);
  8329. c = FF(c, d, a, b, M_offset_6, 17, T[6]);
  8330. b = FF(b, c, d, a, M_offset_7, 22, T[7]);
  8331. a = FF(a, b, c, d, M_offset_8, 7, T[8]);
  8332. d = FF(d, a, b, c, M_offset_9, 12, T[9]);
  8333. c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  8334. b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  8335. a = FF(a, b, c, d, M_offset_12, 7, T[12]);
  8336. d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  8337. c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  8338. b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  8339. a = GG(a, b, c, d, M_offset_1, 5, T[16]);
  8340. d = GG(d, a, b, c, M_offset_6, 9, T[17]);
  8341. c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  8342. b = GG(b, c, d, a, M_offset_0, 20, T[19]);
  8343. a = GG(a, b, c, d, M_offset_5, 5, T[20]);
  8344. d = GG(d, a, b, c, M_offset_10, 9, T[21]);
  8345. c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  8346. b = GG(b, c, d, a, M_offset_4, 20, T[23]);
  8347. a = GG(a, b, c, d, M_offset_9, 5, T[24]);
  8348. d = GG(d, a, b, c, M_offset_14, 9, T[25]);
  8349. c = GG(c, d, a, b, M_offset_3, 14, T[26]);
  8350. b = GG(b, c, d, a, M_offset_8, 20, T[27]);
  8351. a = GG(a, b, c, d, M_offset_13, 5, T[28]);
  8352. d = GG(d, a, b, c, M_offset_2, 9, T[29]);
  8353. c = GG(c, d, a, b, M_offset_7, 14, T[30]);
  8354. b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  8355. a = HH(a, b, c, d, M_offset_5, 4, T[32]);
  8356. d = HH(d, a, b, c, M_offset_8, 11, T[33]);
  8357. c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  8358. b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  8359. a = HH(a, b, c, d, M_offset_1, 4, T[36]);
  8360. d = HH(d, a, b, c, M_offset_4, 11, T[37]);
  8361. c = HH(c, d, a, b, M_offset_7, 16, T[38]);
  8362. b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  8363. a = HH(a, b, c, d, M_offset_13, 4, T[40]);
  8364. d = HH(d, a, b, c, M_offset_0, 11, T[41]);
  8365. c = HH(c, d, a, b, M_offset_3, 16, T[42]);
  8366. b = HH(b, c, d, a, M_offset_6, 23, T[43]);
  8367. a = HH(a, b, c, d, M_offset_9, 4, T[44]);
  8368. d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  8369. c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  8370. b = HH(b, c, d, a, M_offset_2, 23, T[47]);
  8371. a = II(a, b, c, d, M_offset_0, 6, T[48]);
  8372. d = II(d, a, b, c, M_offset_7, 10, T[49]);
  8373. c = II(c, d, a, b, M_offset_14, 15, T[50]);
  8374. b = II(b, c, d, a, M_offset_5, 21, T[51]);
  8375. a = II(a, b, c, d, M_offset_12, 6, T[52]);
  8376. d = II(d, a, b, c, M_offset_3, 10, T[53]);
  8377. c = II(c, d, a, b, M_offset_10, 15, T[54]);
  8378. b = II(b, c, d, a, M_offset_1, 21, T[55]);
  8379. a = II(a, b, c, d, M_offset_8, 6, T[56]);
  8380. d = II(d, a, b, c, M_offset_15, 10, T[57]);
  8381. c = II(c, d, a, b, M_offset_6, 15, T[58]);
  8382. b = II(b, c, d, a, M_offset_13, 21, T[59]);
  8383. a = II(a, b, c, d, M_offset_4, 6, T[60]);
  8384. d = II(d, a, b, c, M_offset_11, 10, T[61]);
  8385. c = II(c, d, a, b, M_offset_2, 15, T[62]);
  8386. b = II(b, c, d, a, M_offset_9, 21, T[63]);
  8387. // Intermediate hash value
  8388. H[0] = H[0] + a | 0;
  8389. H[1] = H[1] + b | 0;
  8390. H[2] = H[2] + c | 0;
  8391. H[3] = H[3] + d | 0;
  8392. },
  8393. _doFinalize: function _doFinalize() {
  8394. // Shortcuts
  8395. var data = this._data;
  8396. var dataWords = data.words;
  8397. var nBitsTotal = this._nDataBytes * 8;
  8398. var nBitsLeft = data.sigBytes * 8;
  8399. // Add padding
  8400. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  8401. var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  8402. var nBitsTotalL = nBitsTotal;
  8403. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] =
  8404. (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff |
  8405. (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00;
  8406. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] =
  8407. (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff |
  8408. (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00;
  8409. data.sigBytes = (dataWords.length + 1) * 4;
  8410. // Hash final blocks
  8411. this._process();
  8412. // Shortcuts
  8413. var hash = this._hash;
  8414. var H = hash.words;
  8415. // Swap endian
  8416. for (var i = 0; i < 4; i++) {
  8417. // Shortcut
  8418. var H_i = H[i];
  8419. H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff |
  8420. (H_i << 24 | H_i >>> 8) & 0xff00ff00;
  8421. }
  8422. // Return final computed hash
  8423. return hash;
  8424. },
  8425. clone: function clone() {
  8426. var clone = Hasher.clone.call(this);
  8427. clone._hash = this._hash.clone();
  8428. return clone;
  8429. } });
  8430. function FF(a, b, c, d, x, s, t) {
  8431. var n = a + (b & c | ~b & d) + x + t;
  8432. return (n << s | n >>> 32 - s) + b;
  8433. }
  8434. function GG(a, b, c, d, x, s, t) {
  8435. var n = a + (b & d | c & ~d) + x + t;
  8436. return (n << s | n >>> 32 - s) + b;
  8437. }
  8438. function HH(a, b, c, d, x, s, t) {
  8439. var n = a + (b ^ c ^ d) + x + t;
  8440. return (n << s | n >>> 32 - s) + b;
  8441. }
  8442. function II(a, b, c, d, x, s, t) {
  8443. var n = a + (c ^ (b | ~d)) + x + t;
  8444. return (n << s | n >>> 32 - s) + b;
  8445. }
  8446. /**
  8447. * Shortcut function to the hasher's object interface.
  8448. *
  8449. * @param {WordArray|string} message The message to hash.
  8450. *
  8451. * @return {WordArray} The hash.
  8452. *
  8453. * @static
  8454. *
  8455. * @example
  8456. *
  8457. * var hash = CryptoJS.MD5('message');
  8458. * var hash = CryptoJS.MD5(wordArray);
  8459. */
  8460. C.MD5 = Hasher._createHelper(MD5);
  8461. /**
  8462. * Shortcut function to the HMAC's object interface.
  8463. *
  8464. * @param {WordArray|string} message The message to hash.
  8465. * @param {WordArray|string} key The secret key.
  8466. *
  8467. * @return {WordArray} The HMAC.
  8468. *
  8469. * @static
  8470. *
  8471. * @example
  8472. *
  8473. * var hmac = CryptoJS.HmacMD5(message, key);
  8474. */
  8475. C.HmacMD5 = Hasher._createHmacHelper(MD5);
  8476. })(Math);
  8477. return CryptoJS.MD5;
  8478. });
  8479. /***/ }),
  8480. /* 82 */
  8481. /*!************************************************************!*\
  8482. !*** F:/uniapp/sqxp-uniapp/node_modules/crypto-js/core.js ***!
  8483. \************************************************************/
  8484. /*! no static exports found */
  8485. /***/ (function(module, exports, __webpack_require__) {
  8486. /* WEBPACK VAR INJECTION */(function(global) {;(function (root, factory) {
  8487. if (true) {
  8488. // CommonJS
  8489. module.exports = exports = factory();
  8490. } else
  8491. {}
  8492. })(this, function () {
  8493. /*globals window, global, require*/
  8494. /**
  8495. * CryptoJS core components.
  8496. */
  8497. var CryptoJS = CryptoJS || function (Math, undefined) {
  8498. var crypto;
  8499. // Native crypto from window (Browser)
  8500. if (typeof window !== 'undefined' && window.crypto) {
  8501. crypto = window.crypto;
  8502. }
  8503. // Native (experimental IE 11) crypto from window (Browser)
  8504. if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
  8505. crypto = window.msCrypto;
  8506. }
  8507. // Native crypto from global (NodeJS)
  8508. if (!crypto && typeof global !== 'undefined' && global.crypto) {
  8509. crypto = global.crypto;
  8510. }
  8511. // Native crypto import via require (NodeJS)
  8512. if (!crypto && "function" === 'function') {
  8513. try {
  8514. crypto = __webpack_require__(/*! crypto */ 83);
  8515. } catch (err) {}
  8516. }
  8517. /*
  8518. * Cryptographically secure pseudorandom number generator
  8519. *
  8520. * As Math.random() is cryptographically not safe to use
  8521. */
  8522. var cryptoSecureRandomInt = function cryptoSecureRandomInt() {
  8523. if (crypto) {
  8524. // Use getRandomValues method (Browser)
  8525. if (typeof crypto.getRandomValues === 'function') {
  8526. try {
  8527. return crypto.getRandomValues(new Uint32Array(1))[0];
  8528. } catch (err) {}
  8529. }
  8530. // Use randomBytes method (NodeJS)
  8531. if (typeof crypto.randomBytes === 'function') {
  8532. try {
  8533. return crypto.randomBytes(4).readInt32LE();
  8534. } catch (err) {}
  8535. }
  8536. }
  8537. throw new Error('Native crypto module could not be used to get secure random number.');
  8538. };
  8539. /*
  8540. * Local polyfill of Object.create
  8541. */
  8542. var create = Object.create || function () {
  8543. function F() {}
  8544. return function (obj) {
  8545. var subtype;
  8546. F.prototype = obj;
  8547. subtype = new F();
  8548. F.prototype = null;
  8549. return subtype;
  8550. };
  8551. }();
  8552. /**
  8553. * CryptoJS namespace.
  8554. */
  8555. var C = {};
  8556. /**
  8557. * Library namespace.
  8558. */
  8559. var C_lib = C.lib = {};
  8560. /**
  8561. * Base object for prototypal inheritance.
  8562. */
  8563. var Base = C_lib.Base = function () {
  8564. return {
  8565. /**
  8566. * Creates a new object that inherits from this object.
  8567. *
  8568. * @param {Object} overrides Properties to copy into the new object.
  8569. *
  8570. * @return {Object} The new object.
  8571. *
  8572. * @static
  8573. *
  8574. * @example
  8575. *
  8576. * var MyType = CryptoJS.lib.Base.extend({
  8577. * field: 'value',
  8578. *
  8579. * method: function () {
  8580. * }
  8581. * });
  8582. */
  8583. extend: function extend(overrides) {
  8584. // Spawn
  8585. var subtype = create(this);
  8586. // Augment
  8587. if (overrides) {
  8588. subtype.mixIn(overrides);
  8589. }
  8590. // Create default initializer
  8591. if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  8592. subtype.init = function () {
  8593. subtype.$super.init.apply(this, arguments);
  8594. };
  8595. }
  8596. // Initializer's prototype is the subtype object
  8597. subtype.init.prototype = subtype;
  8598. // Reference supertype
  8599. subtype.$super = this;
  8600. return subtype;
  8601. },
  8602. /**
  8603. * Extends this object and runs the init method.
  8604. * Arguments to create() will be passed to init().
  8605. *
  8606. * @return {Object} The new object.
  8607. *
  8608. * @static
  8609. *
  8610. * @example
  8611. *
  8612. * var instance = MyType.create();
  8613. */
  8614. create: function create() {
  8615. var instance = this.extend();
  8616. instance.init.apply(instance, arguments);
  8617. return instance;
  8618. },
  8619. /**
  8620. * Initializes a newly created object.
  8621. * Override this method to add some logic when your objects are created.
  8622. *
  8623. * @example
  8624. *
  8625. * var MyType = CryptoJS.lib.Base.extend({
  8626. * init: function () {
  8627. * // ...
  8628. * }
  8629. * });
  8630. */
  8631. init: function init() {
  8632. },
  8633. /**
  8634. * Copies properties into this object.
  8635. *
  8636. * @param {Object} properties The properties to mix in.
  8637. *
  8638. * @example
  8639. *
  8640. * MyType.mixIn({
  8641. * field: 'value'
  8642. * });
  8643. */
  8644. mixIn: function mixIn(properties) {
  8645. for (var propertyName in properties) {
  8646. if (properties.hasOwnProperty(propertyName)) {
  8647. this[propertyName] = properties[propertyName];
  8648. }
  8649. }
  8650. // IE won't copy toString using the loop above
  8651. if (properties.hasOwnProperty('toString')) {
  8652. this.toString = properties.toString;
  8653. }
  8654. },
  8655. /**
  8656. * Creates a copy of this object.
  8657. *
  8658. * @return {Object} The clone.
  8659. *
  8660. * @example
  8661. *
  8662. * var clone = instance.clone();
  8663. */
  8664. clone: function clone() {
  8665. return this.init.prototype.extend(this);
  8666. } };
  8667. }();
  8668. /**
  8669. * An array of 32-bit words.
  8670. *
  8671. * @property {Array} words The array of 32-bit words.
  8672. * @property {number} sigBytes The number of significant bytes in this word array.
  8673. */
  8674. var WordArray = C_lib.WordArray = Base.extend({
  8675. /**
  8676. * Initializes a newly created word array.
  8677. *
  8678. * @param {Array} words (Optional) An array of 32-bit words.
  8679. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  8680. *
  8681. * @example
  8682. *
  8683. * var wordArray = CryptoJS.lib.WordArray.create();
  8684. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  8685. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  8686. */
  8687. init: function init(words, sigBytes) {
  8688. words = this.words = words || [];
  8689. if (sigBytes != undefined) {
  8690. this.sigBytes = sigBytes;
  8691. } else {
  8692. this.sigBytes = words.length * 4;
  8693. }
  8694. },
  8695. /**
  8696. * Converts this word array to a string.
  8697. *
  8698. * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  8699. *
  8700. * @return {string} The stringified word array.
  8701. *
  8702. * @example
  8703. *
  8704. * var string = wordArray + '';
  8705. * var string = wordArray.toString();
  8706. * var string = wordArray.toString(CryptoJS.enc.Utf8);
  8707. */
  8708. toString: function toString(encoder) {
  8709. return (encoder || Hex).stringify(this);
  8710. },
  8711. /**
  8712. * Concatenates a word array to this word array.
  8713. *
  8714. * @param {WordArray} wordArray The word array to append.
  8715. *
  8716. * @return {WordArray} This word array.
  8717. *
  8718. * @example
  8719. *
  8720. * wordArray1.concat(wordArray2);
  8721. */
  8722. concat: function concat(wordArray) {
  8723. // Shortcuts
  8724. var thisWords = this.words;
  8725. var thatWords = wordArray.words;
  8726. var thisSigBytes = this.sigBytes;
  8727. var thatSigBytes = wordArray.sigBytes;
  8728. // Clamp excess bits
  8729. this.clamp();
  8730. // Concat
  8731. if (thisSigBytes % 4) {
  8732. // Copy one byte at a time
  8733. for (var i = 0; i < thatSigBytes; i++) {
  8734. var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  8735. thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
  8736. }
  8737. } else {
  8738. // Copy one word at a time
  8739. for (var i = 0; i < thatSigBytes; i += 4) {
  8740. thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2];
  8741. }
  8742. }
  8743. this.sigBytes += thatSigBytes;
  8744. // Chainable
  8745. return this;
  8746. },
  8747. /**
  8748. * Removes insignificant bits.
  8749. *
  8750. * @example
  8751. *
  8752. * wordArray.clamp();
  8753. */
  8754. clamp: function clamp() {
  8755. // Shortcuts
  8756. var words = this.words;
  8757. var sigBytes = this.sigBytes;
  8758. // Clamp
  8759. words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8;
  8760. words.length = Math.ceil(sigBytes / 4);
  8761. },
  8762. /**
  8763. * Creates a copy of this word array.
  8764. *
  8765. * @return {WordArray} The clone.
  8766. *
  8767. * @example
  8768. *
  8769. * var clone = wordArray.clone();
  8770. */
  8771. clone: function clone() {
  8772. var clone = Base.clone.call(this);
  8773. clone.words = this.words.slice(0);
  8774. return clone;
  8775. },
  8776. /**
  8777. * Creates a word array filled with random bytes.
  8778. *
  8779. * @param {number} nBytes The number of random bytes to generate.
  8780. *
  8781. * @return {WordArray} The random word array.
  8782. *
  8783. * @static
  8784. *
  8785. * @example
  8786. *
  8787. * var wordArray = CryptoJS.lib.WordArray.random(16);
  8788. */
  8789. random: function random(nBytes) {
  8790. var words = [];
  8791. for (var i = 0; i < nBytes; i += 4) {
  8792. words.push(cryptoSecureRandomInt());
  8793. }
  8794. return new WordArray.init(words, nBytes);
  8795. } });
  8796. /**
  8797. * Encoder namespace.
  8798. */
  8799. var C_enc = C.enc = {};
  8800. /**
  8801. * Hex encoding strategy.
  8802. */
  8803. var Hex = C_enc.Hex = {
  8804. /**
  8805. * Converts a word array to a hex string.
  8806. *
  8807. * @param {WordArray} wordArray The word array.
  8808. *
  8809. * @return {string} The hex string.
  8810. *
  8811. * @static
  8812. *
  8813. * @example
  8814. *
  8815. * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  8816. */
  8817. stringify: function stringify(wordArray) {
  8818. // Shortcuts
  8819. var words = wordArray.words;
  8820. var sigBytes = wordArray.sigBytes;
  8821. // Convert
  8822. var hexChars = [];
  8823. for (var i = 0; i < sigBytes; i++) {
  8824. var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  8825. hexChars.push((bite >>> 4).toString(16));
  8826. hexChars.push((bite & 0x0f).toString(16));
  8827. }
  8828. return hexChars.join('');
  8829. },
  8830. /**
  8831. * Converts a hex string to a word array.
  8832. *
  8833. * @param {string} hexStr The hex string.
  8834. *
  8835. * @return {WordArray} The word array.
  8836. *
  8837. * @static
  8838. *
  8839. * @example
  8840. *
  8841. * var wordArray = CryptoJS.enc.Hex.parse(hexString);
  8842. */
  8843. parse: function parse(hexStr) {
  8844. // Shortcut
  8845. var hexStrLength = hexStr.length;
  8846. // Convert
  8847. var words = [];
  8848. for (var i = 0; i < hexStrLength; i += 2) {
  8849. words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
  8850. }
  8851. return new WordArray.init(words, hexStrLength / 2);
  8852. } };
  8853. /**
  8854. * Latin1 encoding strategy.
  8855. */
  8856. var Latin1 = C_enc.Latin1 = {
  8857. /**
  8858. * Converts a word array to a Latin1 string.
  8859. *
  8860. * @param {WordArray} wordArray The word array.
  8861. *
  8862. * @return {string} The Latin1 string.
  8863. *
  8864. * @static
  8865. *
  8866. * @example
  8867. *
  8868. * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  8869. */
  8870. stringify: function stringify(wordArray) {
  8871. // Shortcuts
  8872. var words = wordArray.words;
  8873. var sigBytes = wordArray.sigBytes;
  8874. // Convert
  8875. var latin1Chars = [];
  8876. for (var i = 0; i < sigBytes; i++) {
  8877. var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  8878. latin1Chars.push(String.fromCharCode(bite));
  8879. }
  8880. return latin1Chars.join('');
  8881. },
  8882. /**
  8883. * Converts a Latin1 string to a word array.
  8884. *
  8885. * @param {string} latin1Str The Latin1 string.
  8886. *
  8887. * @return {WordArray} The word array.
  8888. *
  8889. * @static
  8890. *
  8891. * @example
  8892. *
  8893. * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  8894. */
  8895. parse: function parse(latin1Str) {
  8896. // Shortcut
  8897. var latin1StrLength = latin1Str.length;
  8898. // Convert
  8899. var words = [];
  8900. for (var i = 0; i < latin1StrLength; i++) {
  8901. words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8;
  8902. }
  8903. return new WordArray.init(words, latin1StrLength);
  8904. } };
  8905. /**
  8906. * UTF-8 encoding strategy.
  8907. */
  8908. var Utf8 = C_enc.Utf8 = {
  8909. /**
  8910. * Converts a word array to a UTF-8 string.
  8911. *
  8912. * @param {WordArray} wordArray The word array.
  8913. *
  8914. * @return {string} The UTF-8 string.
  8915. *
  8916. * @static
  8917. *
  8918. * @example
  8919. *
  8920. * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  8921. */
  8922. stringify: function stringify(wordArray) {
  8923. try {
  8924. return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  8925. } catch (e) {
  8926. throw new Error('Malformed UTF-8 data');
  8927. }
  8928. },
  8929. /**
  8930. * Converts a UTF-8 string to a word array.
  8931. *
  8932. * @param {string} utf8Str The UTF-8 string.
  8933. *
  8934. * @return {WordArray} The word array.
  8935. *
  8936. * @static
  8937. *
  8938. * @example
  8939. *
  8940. * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  8941. */
  8942. parse: function parse(utf8Str) {
  8943. return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  8944. } };
  8945. /**
  8946. * Abstract buffered block algorithm template.
  8947. *
  8948. * The property blockSize must be implemented in a concrete subtype.
  8949. *
  8950. * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  8951. */
  8952. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  8953. /**
  8954. * Resets this block algorithm's data buffer to its initial state.
  8955. *
  8956. * @example
  8957. *
  8958. * bufferedBlockAlgorithm.reset();
  8959. */
  8960. reset: function reset() {
  8961. // Initial values
  8962. this._data = new WordArray.init();
  8963. this._nDataBytes = 0;
  8964. },
  8965. /**
  8966. * Adds new data to this block algorithm's buffer.
  8967. *
  8968. * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  8969. *
  8970. * @example
  8971. *
  8972. * bufferedBlockAlgorithm._append('data');
  8973. * bufferedBlockAlgorithm._append(wordArray);
  8974. */
  8975. _append: function _append(data) {
  8976. // Convert string to WordArray, else assume WordArray already
  8977. if (typeof data == 'string') {
  8978. data = Utf8.parse(data);
  8979. }
  8980. // Append
  8981. this._data.concat(data);
  8982. this._nDataBytes += data.sigBytes;
  8983. },
  8984. /**
  8985. * Processes available data blocks.
  8986. *
  8987. * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  8988. *
  8989. * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  8990. *
  8991. * @return {WordArray} The processed data.
  8992. *
  8993. * @example
  8994. *
  8995. * var processedData = bufferedBlockAlgorithm._process();
  8996. * var processedData = bufferedBlockAlgorithm._process(!!'flush');
  8997. */
  8998. _process: function _process(doFlush) {
  8999. var processedWords;
  9000. // Shortcuts
  9001. var data = this._data;
  9002. var dataWords = data.words;
  9003. var dataSigBytes = data.sigBytes;
  9004. var blockSize = this.blockSize;
  9005. var blockSizeBytes = blockSize * 4;
  9006. // Count blocks ready
  9007. var nBlocksReady = dataSigBytes / blockSizeBytes;
  9008. if (doFlush) {
  9009. // Round up to include partial blocks
  9010. nBlocksReady = Math.ceil(nBlocksReady);
  9011. } else {
  9012. // Round down to include only full blocks,
  9013. // less the number of blocks that must remain in the buffer
  9014. nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  9015. }
  9016. // Count words ready
  9017. var nWordsReady = nBlocksReady * blockSize;
  9018. // Count bytes ready
  9019. var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  9020. // Process blocks
  9021. if (nWordsReady) {
  9022. for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  9023. // Perform concrete-algorithm logic
  9024. this._doProcessBlock(dataWords, offset);
  9025. }
  9026. // Remove processed words
  9027. processedWords = dataWords.splice(0, nWordsReady);
  9028. data.sigBytes -= nBytesReady;
  9029. }
  9030. // Return processed words
  9031. return new WordArray.init(processedWords, nBytesReady);
  9032. },
  9033. /**
  9034. * Creates a copy of this object.
  9035. *
  9036. * @return {Object} The clone.
  9037. *
  9038. * @example
  9039. *
  9040. * var clone = bufferedBlockAlgorithm.clone();
  9041. */
  9042. clone: function clone() {
  9043. var clone = Base.clone.call(this);
  9044. clone._data = this._data.clone();
  9045. return clone;
  9046. },
  9047. _minBufferSize: 0 });
  9048. /**
  9049. * Abstract hasher template.
  9050. *
  9051. * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  9052. */
  9053. var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  9054. /**
  9055. * Configuration options.
  9056. */
  9057. cfg: Base.extend(),
  9058. /**
  9059. * Initializes a newly created hasher.
  9060. *
  9061. * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  9062. *
  9063. * @example
  9064. *
  9065. * var hasher = CryptoJS.algo.SHA256.create();
  9066. */
  9067. init: function init(cfg) {
  9068. // Apply config defaults
  9069. this.cfg = this.cfg.extend(cfg);
  9070. // Set initial values
  9071. this.reset();
  9072. },
  9073. /**
  9074. * Resets this hasher to its initial state.
  9075. *
  9076. * @example
  9077. *
  9078. * hasher.reset();
  9079. */
  9080. reset: function reset() {
  9081. // Reset data buffer
  9082. BufferedBlockAlgorithm.reset.call(this);
  9083. // Perform concrete-hasher logic
  9084. this._doReset();
  9085. },
  9086. /**
  9087. * Updates this hasher with a message.
  9088. *
  9089. * @param {WordArray|string} messageUpdate The message to append.
  9090. *
  9091. * @return {Hasher} This hasher.
  9092. *
  9093. * @example
  9094. *
  9095. * hasher.update('message');
  9096. * hasher.update(wordArray);
  9097. */
  9098. update: function update(messageUpdate) {
  9099. // Append
  9100. this._append(messageUpdate);
  9101. // Update the hash
  9102. this._process();
  9103. // Chainable
  9104. return this;
  9105. },
  9106. /**
  9107. * Finalizes the hash computation.
  9108. * Note that the finalize operation is effectively a destructive, read-once operation.
  9109. *
  9110. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  9111. *
  9112. * @return {WordArray} The hash.
  9113. *
  9114. * @example
  9115. *
  9116. * var hash = hasher.finalize();
  9117. * var hash = hasher.finalize('message');
  9118. * var hash = hasher.finalize(wordArray);
  9119. */
  9120. finalize: function finalize(messageUpdate) {
  9121. // Final message update
  9122. if (messageUpdate) {
  9123. this._append(messageUpdate);
  9124. }
  9125. // Perform concrete-hasher logic
  9126. var hash = this._doFinalize();
  9127. return hash;
  9128. },
  9129. blockSize: 512 / 32,
  9130. /**
  9131. * Creates a shortcut function to a hasher's object interface.
  9132. *
  9133. * @param {Hasher} hasher The hasher to create a helper for.
  9134. *
  9135. * @return {Function} The shortcut function.
  9136. *
  9137. * @static
  9138. *
  9139. * @example
  9140. *
  9141. * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  9142. */
  9143. _createHelper: function _createHelper(hasher) {
  9144. return function (message, cfg) {
  9145. return new hasher.init(cfg).finalize(message);
  9146. };
  9147. },
  9148. /**
  9149. * Creates a shortcut function to the HMAC's object interface.
  9150. *
  9151. * @param {Hasher} hasher The hasher to use in this HMAC helper.
  9152. *
  9153. * @return {Function} The shortcut function.
  9154. *
  9155. * @static
  9156. *
  9157. * @example
  9158. *
  9159. * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  9160. */
  9161. _createHmacHelper: function _createHmacHelper(hasher) {
  9162. return function (message, key) {
  9163. return new C_algo.HMAC.init(hasher, key).finalize(message);
  9164. };
  9165. } });
  9166. /**
  9167. * Algorithm namespace.
  9168. */
  9169. var C_algo = C.algo = {};
  9170. return C;
  9171. }(Math);
  9172. return CryptoJS;
  9173. });
  9174. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../HBuilderX/plugins/uniapp-cli/node_modules/webpack/buildin/global.js */ 3)))
  9175. /***/ }),
  9176. /* 83 */
  9177. /*!*************************************************!*\
  9178. !*** ./node_modules/crypto-browserify/index.js ***!
  9179. \*************************************************/
  9180. /*! no static exports found */
  9181. /***/ (function(module, exports, __webpack_require__) {
  9182. "use strict";
  9183. exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ 84)
  9184. exports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ 92)
  9185. exports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ 127)
  9186. var algos = __webpack_require__(/*! browserify-sign/algos */ 130)
  9187. var algoKeys = Object.keys(algos)
  9188. var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
  9189. exports.getHashes = function () {
  9190. return hashes
  9191. }
  9192. var p = __webpack_require__(/*! pbkdf2 */ 132)
  9193. exports.pbkdf2 = p.pbkdf2
  9194. exports.pbkdf2Sync = p.pbkdf2Sync
  9195. var aes = __webpack_require__(/*! browserify-cipher */ 138)
  9196. exports.Cipher = aes.Cipher
  9197. exports.createCipher = aes.createCipher
  9198. exports.Cipheriv = aes.Cipheriv
  9199. exports.createCipheriv = aes.createCipheriv
  9200. exports.Decipher = aes.Decipher
  9201. exports.createDecipher = aes.createDecipher
  9202. exports.Decipheriv = aes.Decipheriv
  9203. exports.createDecipheriv = aes.createDecipheriv
  9204. exports.getCiphers = aes.getCiphers
  9205. exports.listCiphers = aes.listCiphers
  9206. var dh = __webpack_require__(/*! diffie-hellman */ 167)
  9207. exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
  9208. exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
  9209. exports.getDiffieHellman = dh.getDiffieHellman
  9210. exports.createDiffieHellman = dh.createDiffieHellman
  9211. exports.DiffieHellman = dh.DiffieHellman
  9212. var sign = __webpack_require__(/*! browserify-sign */ 177)
  9213. exports.createSign = sign.createSign
  9214. exports.Sign = sign.Sign
  9215. exports.createVerify = sign.createVerify
  9216. exports.Verify = sign.Verify
  9217. exports.createECDH = __webpack_require__(/*! create-ecdh */ 232)
  9218. var publicEncrypt = __webpack_require__(/*! public-encrypt */ 233)
  9219. exports.publicEncrypt = publicEncrypt.publicEncrypt
  9220. exports.privateEncrypt = publicEncrypt.privateEncrypt
  9221. exports.publicDecrypt = publicEncrypt.publicDecrypt
  9222. exports.privateDecrypt = publicEncrypt.privateDecrypt
  9223. // the least I can do is make error messages for the rest of the node.js/crypto api.
  9224. // ;[
  9225. // 'createCredentials'
  9226. // ].forEach(function (name) {
  9227. // exports[name] = function () {
  9228. // throw new Error([
  9229. // 'sorry, ' + name + ' is not implemented yet',
  9230. // 'we accept pull requests',
  9231. // 'https://github.com/crypto-browserify/crypto-browserify'
  9232. // ].join('\n'))
  9233. // }
  9234. // })
  9235. var rf = __webpack_require__(/*! randomfill */ 239)
  9236. exports.randomFill = rf.randomFill
  9237. exports.randomFillSync = rf.randomFillSync
  9238. exports.createCredentials = function () {
  9239. throw new Error([
  9240. 'sorry, createCredentials is not implemented yet',
  9241. 'we accept pull requests',
  9242. 'https://github.com/crypto-browserify/crypto-browserify'
  9243. ].join('\n'))
  9244. }
  9245. exports.constants = {
  9246. 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
  9247. 'DH_CHECK_P_NOT_PRIME': 1,
  9248. 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
  9249. 'DH_NOT_SUITABLE_GENERATOR': 8,
  9250. 'NPN_ENABLED': 1,
  9251. 'ALPN_ENABLED': 1,
  9252. 'RSA_PKCS1_PADDING': 1,
  9253. 'RSA_SSLV23_PADDING': 2,
  9254. 'RSA_NO_PADDING': 3,
  9255. 'RSA_PKCS1_OAEP_PADDING': 4,
  9256. 'RSA_X931_PADDING': 5,
  9257. 'RSA_PKCS1_PSS_PADDING': 6,
  9258. 'POINT_CONVERSION_COMPRESSED': 2,
  9259. 'POINT_CONVERSION_UNCOMPRESSED': 4,
  9260. 'POINT_CONVERSION_HYBRID': 6
  9261. }
  9262. /***/ }),
  9263. /* 84 */
  9264. /*!*********************************************!*\
  9265. !*** ./node_modules/randombytes/browser.js ***!
  9266. \*********************************************/
  9267. /*! no static exports found */
  9268. /***/ (function(module, exports, __webpack_require__) {
  9269. "use strict";
  9270. /* WEBPACK VAR INJECTION */(function(global, process) {
  9271. // limit of Crypto.getRandomValues()
  9272. // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
  9273. var MAX_BYTES = 65536
  9274. // Node supports requesting up to this number of bytes
  9275. // https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
  9276. var MAX_UINT32 = 4294967295
  9277. function oldBrowser () {
  9278. throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
  9279. }
  9280. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  9281. var crypto = global.crypto || global.msCrypto
  9282. if (crypto && crypto.getRandomValues) {
  9283. module.exports = randomBytes
  9284. } else {
  9285. module.exports = oldBrowser
  9286. }
  9287. function randomBytes (size, cb) {
  9288. // phantomjs needs to throw
  9289. if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
  9290. var bytes = Buffer.allocUnsafe(size)
  9291. if (size > 0) { // getRandomValues fails on IE if size == 0
  9292. if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
  9293. // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
  9294. for (var generated = 0; generated < size; generated += MAX_BYTES) {
  9295. // buffer.slice automatically checks if the end is past the end of
  9296. // the buffer so we don't have to here
  9297. crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
  9298. }
  9299. } else {
  9300. crypto.getRandomValues(bytes)
  9301. }
  9302. }
  9303. if (typeof cb === 'function') {
  9304. return process.nextTick(function () {
  9305. cb(null, bytes)
  9306. })
  9307. }
  9308. return bytes
  9309. }
  9310. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 85)))
  9311. /***/ }),
  9312. /* 85 */
  9313. /*!********************************************************!*\
  9314. !*** ./node_modules/node-libs-browser/mock/process.js ***!
  9315. \********************************************************/
  9316. /*! no static exports found */
  9317. /***/ (function(module, exports, __webpack_require__) {
  9318. exports.nextTick = function nextTick(fn) {
  9319. var args = Array.prototype.slice.call(arguments);
  9320. args.shift();
  9321. setTimeout(function () {
  9322. fn.apply(null, args);
  9323. }, 0);
  9324. };
  9325. exports.platform = exports.arch =
  9326. exports.execPath = exports.title = 'browser';
  9327. exports.pid = 1;
  9328. exports.browser = true;
  9329. exports.env = {};
  9330. exports.argv = [];
  9331. exports.binding = function (name) {
  9332. throw new Error('No such module. (Possibly not yet loaded)')
  9333. };
  9334. (function () {
  9335. var cwd = '/';
  9336. var path;
  9337. exports.cwd = function () { return cwd };
  9338. exports.chdir = function (dir) {
  9339. if (!path) path = __webpack_require__(/*! path */ 86);
  9340. cwd = path.resolve(dir, cwd);
  9341. };
  9342. })();
  9343. exports.exit = exports.kill =
  9344. exports.umask = exports.dlopen =
  9345. exports.uptime = exports.memoryUsage =
  9346. exports.uvCounters = function() {};
  9347. exports.features = {};
  9348. /***/ }),
  9349. /* 86 */
  9350. /*!***********************************************!*\
  9351. !*** ./node_modules/path-browserify/index.js ***!
  9352. \***********************************************/
  9353. /*! no static exports found */
  9354. /***/ (function(module, exports, __webpack_require__) {
  9355. /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
  9356. // backported and transplited with Babel, with backwards-compat fixes
  9357. // Copyright Joyent, Inc. and other Node contributors.
  9358. //
  9359. // Permission is hereby granted, free of charge, to any person obtaining a
  9360. // copy of this software and associated documentation files (the
  9361. // "Software"), to deal in the Software without restriction, including
  9362. // without limitation the rights to use, copy, modify, merge, publish,
  9363. // distribute, sublicense, and/or sell copies of the Software, and to permit
  9364. // persons to whom the Software is furnished to do so, subject to the
  9365. // following conditions:
  9366. //
  9367. // The above copyright notice and this permission notice shall be included
  9368. // in all copies or substantial portions of the Software.
  9369. //
  9370. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  9371. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  9372. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  9373. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  9374. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  9375. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  9376. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  9377. // resolves . and .. elements in a path array with directory names there
  9378. // must be no slashes, empty elements, or device names (c:\) in the array
  9379. // (so also no leading and trailing slashes - it does not distinguish
  9380. // relative and absolute paths)
  9381. function normalizeArray(parts, allowAboveRoot) {
  9382. // if the path tries to go above the root, `up` ends up > 0
  9383. var up = 0;
  9384. for (var i = parts.length - 1; i >= 0; i--) {
  9385. var last = parts[i];
  9386. if (last === '.') {
  9387. parts.splice(i, 1);
  9388. } else if (last === '..') {
  9389. parts.splice(i, 1);
  9390. up++;
  9391. } else if (up) {
  9392. parts.splice(i, 1);
  9393. up--;
  9394. }
  9395. }
  9396. // if the path is allowed to go above the root, restore leading ..s
  9397. if (allowAboveRoot) {
  9398. for (; up--; up) {
  9399. parts.unshift('..');
  9400. }
  9401. }
  9402. return parts;
  9403. }
  9404. // path.resolve([from ...], to)
  9405. // posix version
  9406. exports.resolve = function() {
  9407. var resolvedPath = '',
  9408. resolvedAbsolute = false;
  9409. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  9410. var path = (i >= 0) ? arguments[i] : process.cwd();
  9411. // Skip empty and invalid entries
  9412. if (typeof path !== 'string') {
  9413. throw new TypeError('Arguments to path.resolve must be strings');
  9414. } else if (!path) {
  9415. continue;
  9416. }
  9417. resolvedPath = path + '/' + resolvedPath;
  9418. resolvedAbsolute = path.charAt(0) === '/';
  9419. }
  9420. // At this point the path should be resolved to a full absolute path, but
  9421. // handle relative paths to be safe (might happen when process.cwd() fails)
  9422. // Normalize the path
  9423. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  9424. return !!p;
  9425. }), !resolvedAbsolute).join('/');
  9426. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  9427. };
  9428. // path.normalize(path)
  9429. // posix version
  9430. exports.normalize = function(path) {
  9431. var isAbsolute = exports.isAbsolute(path),
  9432. trailingSlash = substr(path, -1) === '/';
  9433. // Normalize the path
  9434. path = normalizeArray(filter(path.split('/'), function(p) {
  9435. return !!p;
  9436. }), !isAbsolute).join('/');
  9437. if (!path && !isAbsolute) {
  9438. path = '.';
  9439. }
  9440. if (path && trailingSlash) {
  9441. path += '/';
  9442. }
  9443. return (isAbsolute ? '/' : '') + path;
  9444. };
  9445. // posix version
  9446. exports.isAbsolute = function(path) {
  9447. return path.charAt(0) === '/';
  9448. };
  9449. // posix version
  9450. exports.join = function() {
  9451. var paths = Array.prototype.slice.call(arguments, 0);
  9452. return exports.normalize(filter(paths, function(p, index) {
  9453. if (typeof p !== 'string') {
  9454. throw new TypeError('Arguments to path.join must be strings');
  9455. }
  9456. return p;
  9457. }).join('/'));
  9458. };
  9459. // path.relative(from, to)
  9460. // posix version
  9461. exports.relative = function(from, to) {
  9462. from = exports.resolve(from).substr(1);
  9463. to = exports.resolve(to).substr(1);
  9464. function trim(arr) {
  9465. var start = 0;
  9466. for (; start < arr.length; start++) {
  9467. if (arr[start] !== '') break;
  9468. }
  9469. var end = arr.length - 1;
  9470. for (; end >= 0; end--) {
  9471. if (arr[end] !== '') break;
  9472. }
  9473. if (start > end) return [];
  9474. return arr.slice(start, end - start + 1);
  9475. }
  9476. var fromParts = trim(from.split('/'));
  9477. var toParts = trim(to.split('/'));
  9478. var length = Math.min(fromParts.length, toParts.length);
  9479. var samePartsLength = length;
  9480. for (var i = 0; i < length; i++) {
  9481. if (fromParts[i] !== toParts[i]) {
  9482. samePartsLength = i;
  9483. break;
  9484. }
  9485. }
  9486. var outputParts = [];
  9487. for (var i = samePartsLength; i < fromParts.length; i++) {
  9488. outputParts.push('..');
  9489. }
  9490. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  9491. return outputParts.join('/');
  9492. };
  9493. exports.sep = '/';
  9494. exports.delimiter = ':';
  9495. exports.dirname = function (path) {
  9496. if (typeof path !== 'string') path = path + '';
  9497. if (path.length === 0) return '.';
  9498. var code = path.charCodeAt(0);
  9499. var hasRoot = code === 47 /*/*/;
  9500. var end = -1;
  9501. var matchedSlash = true;
  9502. for (var i = path.length - 1; i >= 1; --i) {
  9503. code = path.charCodeAt(i);
  9504. if (code === 47 /*/*/) {
  9505. if (!matchedSlash) {
  9506. end = i;
  9507. break;
  9508. }
  9509. } else {
  9510. // We saw the first non-path separator
  9511. matchedSlash = false;
  9512. }
  9513. }
  9514. if (end === -1) return hasRoot ? '/' : '.';
  9515. if (hasRoot && end === 1) {
  9516. // return '//';
  9517. // Backwards-compat fix:
  9518. return '/';
  9519. }
  9520. return path.slice(0, end);
  9521. };
  9522. function basename(path) {
  9523. if (typeof path !== 'string') path = path + '';
  9524. var start = 0;
  9525. var end = -1;
  9526. var matchedSlash = true;
  9527. var i;
  9528. for (i = path.length - 1; i >= 0; --i) {
  9529. if (path.charCodeAt(i) === 47 /*/*/) {
  9530. // If we reached a path separator that was not part of a set of path
  9531. // separators at the end of the string, stop now
  9532. if (!matchedSlash) {
  9533. start = i + 1;
  9534. break;
  9535. }
  9536. } else if (end === -1) {
  9537. // We saw the first non-path separator, mark this as the end of our
  9538. // path component
  9539. matchedSlash = false;
  9540. end = i + 1;
  9541. }
  9542. }
  9543. if (end === -1) return '';
  9544. return path.slice(start, end);
  9545. }
  9546. // Uses a mixed approach for backwards-compatibility, as ext behavior changed
  9547. // in new Node.js versions, so only basename() above is backported here
  9548. exports.basename = function (path, ext) {
  9549. var f = basename(path);
  9550. if (ext && f.substr(-1 * ext.length) === ext) {
  9551. f = f.substr(0, f.length - ext.length);
  9552. }
  9553. return f;
  9554. };
  9555. exports.extname = function (path) {
  9556. if (typeof path !== 'string') path = path + '';
  9557. var startDot = -1;
  9558. var startPart = 0;
  9559. var end = -1;
  9560. var matchedSlash = true;
  9561. // Track the state of characters (if any) we see before our first dot and
  9562. // after any path separator we find
  9563. var preDotState = 0;
  9564. for (var i = path.length - 1; i >= 0; --i) {
  9565. var code = path.charCodeAt(i);
  9566. if (code === 47 /*/*/) {
  9567. // If we reached a path separator that was not part of a set of path
  9568. // separators at the end of the string, stop now
  9569. if (!matchedSlash) {
  9570. startPart = i + 1;
  9571. break;
  9572. }
  9573. continue;
  9574. }
  9575. if (end === -1) {
  9576. // We saw the first non-path separator, mark this as the end of our
  9577. // extension
  9578. matchedSlash = false;
  9579. end = i + 1;
  9580. }
  9581. if (code === 46 /*.*/) {
  9582. // If this is our first dot, mark it as the start of our extension
  9583. if (startDot === -1)
  9584. startDot = i;
  9585. else if (preDotState !== 1)
  9586. preDotState = 1;
  9587. } else if (startDot !== -1) {
  9588. // We saw a non-dot and non-path separator before our dot, so we should
  9589. // have a good chance at having a non-empty extension
  9590. preDotState = -1;
  9591. }
  9592. }
  9593. if (startDot === -1 || end === -1 ||
  9594. // We saw a non-dot character immediately before the dot
  9595. preDotState === 0 ||
  9596. // The (right-most) trimmed path component is exactly '..'
  9597. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  9598. return '';
  9599. }
  9600. return path.slice(startDot, end);
  9601. };
  9602. function filter (xs, f) {
  9603. if (xs.filter) return xs.filter(f);
  9604. var res = [];
  9605. for (var i = 0; i < xs.length; i++) {
  9606. if (f(xs[i], i, xs)) res.push(xs[i]);
  9607. }
  9608. return res;
  9609. }
  9610. // String.prototype.substr - negative index don't work in IE8
  9611. var substr = 'ab'.substr(-1) === 'b'
  9612. ? function (str, start, len) { return str.substr(start, len) }
  9613. : function (str, start, len) {
  9614. if (start < 0) start = str.length + start;
  9615. return str.substr(start, len);
  9616. }
  9617. ;
  9618. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 85)))
  9619. /***/ }),
  9620. /* 87 */
  9621. /*!*******************************************!*\
  9622. !*** ./node_modules/safe-buffer/index.js ***!
  9623. \*******************************************/
  9624. /*! no static exports found */
  9625. /***/ (function(module, exports, __webpack_require__) {
  9626. /* eslint-disable node/no-deprecated-api */
  9627. var buffer = __webpack_require__(/*! buffer */ 88)
  9628. var Buffer = buffer.Buffer
  9629. // alternative to using Object.keys for old browsers
  9630. function copyProps (src, dst) {
  9631. for (var key in src) {
  9632. dst[key] = src[key]
  9633. }
  9634. }
  9635. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  9636. module.exports = buffer
  9637. } else {
  9638. // Copy properties from require('buffer')
  9639. copyProps(buffer, exports)
  9640. exports.Buffer = SafeBuffer
  9641. }
  9642. function SafeBuffer (arg, encodingOrOffset, length) {
  9643. return Buffer(arg, encodingOrOffset, length)
  9644. }
  9645. // Copy static methods from Buffer
  9646. copyProps(Buffer, SafeBuffer)
  9647. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  9648. if (typeof arg === 'number') {
  9649. throw new TypeError('Argument must not be a number')
  9650. }
  9651. return Buffer(arg, encodingOrOffset, length)
  9652. }
  9653. SafeBuffer.alloc = function (size, fill, encoding) {
  9654. if (typeof size !== 'number') {
  9655. throw new TypeError('Argument must be a number')
  9656. }
  9657. var buf = Buffer(size)
  9658. if (fill !== undefined) {
  9659. if (typeof encoding === 'string') {
  9660. buf.fill(fill, encoding)
  9661. } else {
  9662. buf.fill(fill)
  9663. }
  9664. } else {
  9665. buf.fill(0)
  9666. }
  9667. return buf
  9668. }
  9669. SafeBuffer.allocUnsafe = function (size) {
  9670. if (typeof size !== 'number') {
  9671. throw new TypeError('Argument must be a number')
  9672. }
  9673. return Buffer(size)
  9674. }
  9675. SafeBuffer.allocUnsafeSlow = function (size) {
  9676. if (typeof size !== 'number') {
  9677. throw new TypeError('Argument must be a number')
  9678. }
  9679. return buffer.SlowBuffer(size)
  9680. }
  9681. /***/ }),
  9682. /* 88 */
  9683. /*!**************************************!*\
  9684. !*** ./node_modules/buffer/index.js ***!
  9685. \**************************************/
  9686. /*! no static exports found */
  9687. /***/ (function(module, exports, __webpack_require__) {
  9688. "use strict";
  9689. /* WEBPACK VAR INJECTION */(function(global) {/*!
  9690. * The buffer module from node.js, for the browser.
  9691. *
  9692. * @author Feross Aboukhadijeh <http://feross.org>
  9693. * @license MIT
  9694. */
  9695. /* eslint-disable no-proto */
  9696. var base64 = __webpack_require__(/*! base64-js */ 89)
  9697. var ieee754 = __webpack_require__(/*! ieee754 */ 90)
  9698. var isArray = __webpack_require__(/*! isarray */ 91)
  9699. exports.Buffer = Buffer
  9700. exports.SlowBuffer = SlowBuffer
  9701. exports.INSPECT_MAX_BYTES = 50
  9702. /**
  9703. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  9704. * === true Use Uint8Array implementation (fastest)
  9705. * === false Use Object implementation (most compatible, even IE6)
  9706. *
  9707. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  9708. * Opera 11.6+, iOS 4.2+.
  9709. *
  9710. * Due to various browser bugs, sometimes the Object implementation will be used even
  9711. * when the browser supports typed arrays.
  9712. *
  9713. * Note:
  9714. *
  9715. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  9716. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  9717. *
  9718. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  9719. *
  9720. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  9721. * incorrect length in some situations.
  9722. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  9723. * get the Object implementation, which is slower but behaves correctly.
  9724. */
  9725. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  9726. ? global.TYPED_ARRAY_SUPPORT
  9727. : typedArraySupport()
  9728. /*
  9729. * Export kMaxLength after typed array support is determined.
  9730. */
  9731. exports.kMaxLength = kMaxLength()
  9732. function typedArraySupport () {
  9733. try {
  9734. var arr = new Uint8Array(1)
  9735. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  9736. return arr.foo() === 42 && // typed array instances can be augmented
  9737. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  9738. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  9739. } catch (e) {
  9740. return false
  9741. }
  9742. }
  9743. function kMaxLength () {
  9744. return Buffer.TYPED_ARRAY_SUPPORT
  9745. ? 0x7fffffff
  9746. : 0x3fffffff
  9747. }
  9748. function createBuffer (that, length) {
  9749. if (kMaxLength() < length) {
  9750. throw new RangeError('Invalid typed array length')
  9751. }
  9752. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9753. // Return an augmented `Uint8Array` instance, for best performance
  9754. that = new Uint8Array(length)
  9755. that.__proto__ = Buffer.prototype
  9756. } else {
  9757. // Fallback: Return an object instance of the Buffer class
  9758. if (that === null) {
  9759. that = new Buffer(length)
  9760. }
  9761. that.length = length
  9762. }
  9763. return that
  9764. }
  9765. /**
  9766. * The Buffer constructor returns instances of `Uint8Array` that have their
  9767. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  9768. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  9769. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  9770. * returns a single octet.
  9771. *
  9772. * The `Uint8Array` prototype remains unmodified.
  9773. */
  9774. function Buffer (arg, encodingOrOffset, length) {
  9775. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  9776. return new Buffer(arg, encodingOrOffset, length)
  9777. }
  9778. // Common case.
  9779. if (typeof arg === 'number') {
  9780. if (typeof encodingOrOffset === 'string') {
  9781. throw new Error(
  9782. 'If encoding is specified then the first argument must be a string'
  9783. )
  9784. }
  9785. return allocUnsafe(this, arg)
  9786. }
  9787. return from(this, arg, encodingOrOffset, length)
  9788. }
  9789. Buffer.poolSize = 8192 // not used by this implementation
  9790. // TODO: Legacy, not needed anymore. Remove in next major version.
  9791. Buffer._augment = function (arr) {
  9792. arr.__proto__ = Buffer.prototype
  9793. return arr
  9794. }
  9795. function from (that, value, encodingOrOffset, length) {
  9796. if (typeof value === 'number') {
  9797. throw new TypeError('"value" argument must not be a number')
  9798. }
  9799. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  9800. return fromArrayBuffer(that, value, encodingOrOffset, length)
  9801. }
  9802. if (typeof value === 'string') {
  9803. return fromString(that, value, encodingOrOffset)
  9804. }
  9805. return fromObject(that, value)
  9806. }
  9807. /**
  9808. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  9809. * if value is a number.
  9810. * Buffer.from(str[, encoding])
  9811. * Buffer.from(array)
  9812. * Buffer.from(buffer)
  9813. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  9814. **/
  9815. Buffer.from = function (value, encodingOrOffset, length) {
  9816. return from(null, value, encodingOrOffset, length)
  9817. }
  9818. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9819. Buffer.prototype.__proto__ = Uint8Array.prototype
  9820. Buffer.__proto__ = Uint8Array
  9821. if (typeof Symbol !== 'undefined' && Symbol.species &&
  9822. Buffer[Symbol.species] === Buffer) {
  9823. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  9824. Object.defineProperty(Buffer, Symbol.species, {
  9825. value: null,
  9826. configurable: true
  9827. })
  9828. }
  9829. }
  9830. function assertSize (size) {
  9831. if (typeof size !== 'number') {
  9832. throw new TypeError('"size" argument must be a number')
  9833. } else if (size < 0) {
  9834. throw new RangeError('"size" argument must not be negative')
  9835. }
  9836. }
  9837. function alloc (that, size, fill, encoding) {
  9838. assertSize(size)
  9839. if (size <= 0) {
  9840. return createBuffer(that, size)
  9841. }
  9842. if (fill !== undefined) {
  9843. // Only pay attention to encoding if it's a string. This
  9844. // prevents accidentally sending in a number that would
  9845. // be interpretted as a start offset.
  9846. return typeof encoding === 'string'
  9847. ? createBuffer(that, size).fill(fill, encoding)
  9848. : createBuffer(that, size).fill(fill)
  9849. }
  9850. return createBuffer(that, size)
  9851. }
  9852. /**
  9853. * Creates a new filled Buffer instance.
  9854. * alloc(size[, fill[, encoding]])
  9855. **/
  9856. Buffer.alloc = function (size, fill, encoding) {
  9857. return alloc(null, size, fill, encoding)
  9858. }
  9859. function allocUnsafe (that, size) {
  9860. assertSize(size)
  9861. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  9862. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  9863. for (var i = 0; i < size; ++i) {
  9864. that[i] = 0
  9865. }
  9866. }
  9867. return that
  9868. }
  9869. /**
  9870. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  9871. * */
  9872. Buffer.allocUnsafe = function (size) {
  9873. return allocUnsafe(null, size)
  9874. }
  9875. /**
  9876. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  9877. */
  9878. Buffer.allocUnsafeSlow = function (size) {
  9879. return allocUnsafe(null, size)
  9880. }
  9881. function fromString (that, string, encoding) {
  9882. if (typeof encoding !== 'string' || encoding === '') {
  9883. encoding = 'utf8'
  9884. }
  9885. if (!Buffer.isEncoding(encoding)) {
  9886. throw new TypeError('"encoding" must be a valid string encoding')
  9887. }
  9888. var length = byteLength(string, encoding) | 0
  9889. that = createBuffer(that, length)
  9890. var actual = that.write(string, encoding)
  9891. if (actual !== length) {
  9892. // Writing a hex string, for example, that contains invalid characters will
  9893. // cause everything after the first invalid character to be ignored. (e.g.
  9894. // 'abxxcd' will be treated as 'ab')
  9895. that = that.slice(0, actual)
  9896. }
  9897. return that
  9898. }
  9899. function fromArrayLike (that, array) {
  9900. var length = array.length < 0 ? 0 : checked(array.length) | 0
  9901. that = createBuffer(that, length)
  9902. for (var i = 0; i < length; i += 1) {
  9903. that[i] = array[i] & 255
  9904. }
  9905. return that
  9906. }
  9907. function fromArrayBuffer (that, array, byteOffset, length) {
  9908. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  9909. if (byteOffset < 0 || array.byteLength < byteOffset) {
  9910. throw new RangeError('\'offset\' is out of bounds')
  9911. }
  9912. if (array.byteLength < byteOffset + (length || 0)) {
  9913. throw new RangeError('\'length\' is out of bounds')
  9914. }
  9915. if (byteOffset === undefined && length === undefined) {
  9916. array = new Uint8Array(array)
  9917. } else if (length === undefined) {
  9918. array = new Uint8Array(array, byteOffset)
  9919. } else {
  9920. array = new Uint8Array(array, byteOffset, length)
  9921. }
  9922. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9923. // Return an augmented `Uint8Array` instance, for best performance
  9924. that = array
  9925. that.__proto__ = Buffer.prototype
  9926. } else {
  9927. // Fallback: Return an object instance of the Buffer class
  9928. that = fromArrayLike(that, array)
  9929. }
  9930. return that
  9931. }
  9932. function fromObject (that, obj) {
  9933. if (Buffer.isBuffer(obj)) {
  9934. var len = checked(obj.length) | 0
  9935. that = createBuffer(that, len)
  9936. if (that.length === 0) {
  9937. return that
  9938. }
  9939. obj.copy(that, 0, 0, len)
  9940. return that
  9941. }
  9942. if (obj) {
  9943. if ((typeof ArrayBuffer !== 'undefined' &&
  9944. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  9945. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  9946. return createBuffer(that, 0)
  9947. }
  9948. return fromArrayLike(that, obj)
  9949. }
  9950. if (obj.type === 'Buffer' && isArray(obj.data)) {
  9951. return fromArrayLike(that, obj.data)
  9952. }
  9953. }
  9954. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  9955. }
  9956. function checked (length) {
  9957. // Note: cannot use `length < kMaxLength()` here because that fails when
  9958. // length is NaN (which is otherwise coerced to zero.)
  9959. if (length >= kMaxLength()) {
  9960. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  9961. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  9962. }
  9963. return length | 0
  9964. }
  9965. function SlowBuffer (length) {
  9966. if (+length != length) { // eslint-disable-line eqeqeq
  9967. length = 0
  9968. }
  9969. return Buffer.alloc(+length)
  9970. }
  9971. Buffer.isBuffer = function isBuffer (b) {
  9972. return !!(b != null && b._isBuffer)
  9973. }
  9974. Buffer.compare = function compare (a, b) {
  9975. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  9976. throw new TypeError('Arguments must be Buffers')
  9977. }
  9978. if (a === b) return 0
  9979. var x = a.length
  9980. var y = b.length
  9981. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  9982. if (a[i] !== b[i]) {
  9983. x = a[i]
  9984. y = b[i]
  9985. break
  9986. }
  9987. }
  9988. if (x < y) return -1
  9989. if (y < x) return 1
  9990. return 0
  9991. }
  9992. Buffer.isEncoding = function isEncoding (encoding) {
  9993. switch (String(encoding).toLowerCase()) {
  9994. case 'hex':
  9995. case 'utf8':
  9996. case 'utf-8':
  9997. case 'ascii':
  9998. case 'latin1':
  9999. case 'binary':
  10000. case 'base64':
  10001. case 'ucs2':
  10002. case 'ucs-2':
  10003. case 'utf16le':
  10004. case 'utf-16le':
  10005. return true
  10006. default:
  10007. return false
  10008. }
  10009. }
  10010. Buffer.concat = function concat (list, length) {
  10011. if (!isArray(list)) {
  10012. throw new TypeError('"list" argument must be an Array of Buffers')
  10013. }
  10014. if (list.length === 0) {
  10015. return Buffer.alloc(0)
  10016. }
  10017. var i
  10018. if (length === undefined) {
  10019. length = 0
  10020. for (i = 0; i < list.length; ++i) {
  10021. length += list[i].length
  10022. }
  10023. }
  10024. var buffer = Buffer.allocUnsafe(length)
  10025. var pos = 0
  10026. for (i = 0; i < list.length; ++i) {
  10027. var buf = list[i]
  10028. if (!Buffer.isBuffer(buf)) {
  10029. throw new TypeError('"list" argument must be an Array of Buffers')
  10030. }
  10031. buf.copy(buffer, pos)
  10032. pos += buf.length
  10033. }
  10034. return buffer
  10035. }
  10036. function byteLength (string, encoding) {
  10037. if (Buffer.isBuffer(string)) {
  10038. return string.length
  10039. }
  10040. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  10041. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  10042. return string.byteLength
  10043. }
  10044. if (typeof string !== 'string') {
  10045. string = '' + string
  10046. }
  10047. var len = string.length
  10048. if (len === 0) return 0
  10049. // Use a for loop to avoid recursion
  10050. var loweredCase = false
  10051. for (;;) {
  10052. switch (encoding) {
  10053. case 'ascii':
  10054. case 'latin1':
  10055. case 'binary':
  10056. return len
  10057. case 'utf8':
  10058. case 'utf-8':
  10059. case undefined:
  10060. return utf8ToBytes(string).length
  10061. case 'ucs2':
  10062. case 'ucs-2':
  10063. case 'utf16le':
  10064. case 'utf-16le':
  10065. return len * 2
  10066. case 'hex':
  10067. return len >>> 1
  10068. case 'base64':
  10069. return base64ToBytes(string).length
  10070. default:
  10071. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  10072. encoding = ('' + encoding).toLowerCase()
  10073. loweredCase = true
  10074. }
  10075. }
  10076. }
  10077. Buffer.byteLength = byteLength
  10078. function slowToString (encoding, start, end) {
  10079. var loweredCase = false
  10080. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  10081. // property of a typed array.
  10082. // This behaves neither like String nor Uint8Array in that we set start/end
  10083. // to their upper/lower bounds if the value passed is out of range.
  10084. // undefined is handled specially as per ECMA-262 6th Edition,
  10085. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  10086. if (start === undefined || start < 0) {
  10087. start = 0
  10088. }
  10089. // Return early if start > this.length. Done here to prevent potential uint32
  10090. // coercion fail below.
  10091. if (start > this.length) {
  10092. return ''
  10093. }
  10094. if (end === undefined || end > this.length) {
  10095. end = this.length
  10096. }
  10097. if (end <= 0) {
  10098. return ''
  10099. }
  10100. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  10101. end >>>= 0
  10102. start >>>= 0
  10103. if (end <= start) {
  10104. return ''
  10105. }
  10106. if (!encoding) encoding = 'utf8'
  10107. while (true) {
  10108. switch (encoding) {
  10109. case 'hex':
  10110. return hexSlice(this, start, end)
  10111. case 'utf8':
  10112. case 'utf-8':
  10113. return utf8Slice(this, start, end)
  10114. case 'ascii':
  10115. return asciiSlice(this, start, end)
  10116. case 'latin1':
  10117. case 'binary':
  10118. return latin1Slice(this, start, end)
  10119. case 'base64':
  10120. return base64Slice(this, start, end)
  10121. case 'ucs2':
  10122. case 'ucs-2':
  10123. case 'utf16le':
  10124. case 'utf-16le':
  10125. return utf16leSlice(this, start, end)
  10126. default:
  10127. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  10128. encoding = (encoding + '').toLowerCase()
  10129. loweredCase = true
  10130. }
  10131. }
  10132. }
  10133. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  10134. // Buffer instances.
  10135. Buffer.prototype._isBuffer = true
  10136. function swap (b, n, m) {
  10137. var i = b[n]
  10138. b[n] = b[m]
  10139. b[m] = i
  10140. }
  10141. Buffer.prototype.swap16 = function swap16 () {
  10142. var len = this.length
  10143. if (len % 2 !== 0) {
  10144. throw new RangeError('Buffer size must be a multiple of 16-bits')
  10145. }
  10146. for (var i = 0; i < len; i += 2) {
  10147. swap(this, i, i + 1)
  10148. }
  10149. return this
  10150. }
  10151. Buffer.prototype.swap32 = function swap32 () {
  10152. var len = this.length
  10153. if (len % 4 !== 0) {
  10154. throw new RangeError('Buffer size must be a multiple of 32-bits')
  10155. }
  10156. for (var i = 0; i < len; i += 4) {
  10157. swap(this, i, i + 3)
  10158. swap(this, i + 1, i + 2)
  10159. }
  10160. return this
  10161. }
  10162. Buffer.prototype.swap64 = function swap64 () {
  10163. var len = this.length
  10164. if (len % 8 !== 0) {
  10165. throw new RangeError('Buffer size must be a multiple of 64-bits')
  10166. }
  10167. for (var i = 0; i < len; i += 8) {
  10168. swap(this, i, i + 7)
  10169. swap(this, i + 1, i + 6)
  10170. swap(this, i + 2, i + 5)
  10171. swap(this, i + 3, i + 4)
  10172. }
  10173. return this
  10174. }
  10175. Buffer.prototype.toString = function toString () {
  10176. var length = this.length | 0
  10177. if (length === 0) return ''
  10178. if (arguments.length === 0) return utf8Slice(this, 0, length)
  10179. return slowToString.apply(this, arguments)
  10180. }
  10181. Buffer.prototype.equals = function equals (b) {
  10182. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  10183. if (this === b) return true
  10184. return Buffer.compare(this, b) === 0
  10185. }
  10186. Buffer.prototype.inspect = function inspect () {
  10187. var str = ''
  10188. var max = exports.INSPECT_MAX_BYTES
  10189. if (this.length > 0) {
  10190. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  10191. if (this.length > max) str += ' ... '
  10192. }
  10193. return '<Buffer ' + str + '>'
  10194. }
  10195. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  10196. if (!Buffer.isBuffer(target)) {
  10197. throw new TypeError('Argument must be a Buffer')
  10198. }
  10199. if (start === undefined) {
  10200. start = 0
  10201. }
  10202. if (end === undefined) {
  10203. end = target ? target.length : 0
  10204. }
  10205. if (thisStart === undefined) {
  10206. thisStart = 0
  10207. }
  10208. if (thisEnd === undefined) {
  10209. thisEnd = this.length
  10210. }
  10211. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  10212. throw new RangeError('out of range index')
  10213. }
  10214. if (thisStart >= thisEnd && start >= end) {
  10215. return 0
  10216. }
  10217. if (thisStart >= thisEnd) {
  10218. return -1
  10219. }
  10220. if (start >= end) {
  10221. return 1
  10222. }
  10223. start >>>= 0
  10224. end >>>= 0
  10225. thisStart >>>= 0
  10226. thisEnd >>>= 0
  10227. if (this === target) return 0
  10228. var x = thisEnd - thisStart
  10229. var y = end - start
  10230. var len = Math.min(x, y)
  10231. var thisCopy = this.slice(thisStart, thisEnd)
  10232. var targetCopy = target.slice(start, end)
  10233. for (var i = 0; i < len; ++i) {
  10234. if (thisCopy[i] !== targetCopy[i]) {
  10235. x = thisCopy[i]
  10236. y = targetCopy[i]
  10237. break
  10238. }
  10239. }
  10240. if (x < y) return -1
  10241. if (y < x) return 1
  10242. return 0
  10243. }
  10244. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  10245. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  10246. //
  10247. // Arguments:
  10248. // - buffer - a Buffer to search
  10249. // - val - a string, Buffer, or number
  10250. // - byteOffset - an index into `buffer`; will be clamped to an int32
  10251. // - encoding - an optional encoding, relevant is val is a string
  10252. // - dir - true for indexOf, false for lastIndexOf
  10253. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  10254. // Empty buffer means no match
  10255. if (buffer.length === 0) return -1
  10256. // Normalize byteOffset
  10257. if (typeof byteOffset === 'string') {
  10258. encoding = byteOffset
  10259. byteOffset = 0
  10260. } else if (byteOffset > 0x7fffffff) {
  10261. byteOffset = 0x7fffffff
  10262. } else if (byteOffset < -0x80000000) {
  10263. byteOffset = -0x80000000
  10264. }
  10265. byteOffset = +byteOffset // Coerce to Number.
  10266. if (isNaN(byteOffset)) {
  10267. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  10268. byteOffset = dir ? 0 : (buffer.length - 1)
  10269. }
  10270. // Normalize byteOffset: negative offsets start from the end of the buffer
  10271. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  10272. if (byteOffset >= buffer.length) {
  10273. if (dir) return -1
  10274. else byteOffset = buffer.length - 1
  10275. } else if (byteOffset < 0) {
  10276. if (dir) byteOffset = 0
  10277. else return -1
  10278. }
  10279. // Normalize val
  10280. if (typeof val === 'string') {
  10281. val = Buffer.from(val, encoding)
  10282. }
  10283. // Finally, search either indexOf (if dir is true) or lastIndexOf
  10284. if (Buffer.isBuffer(val)) {
  10285. // Special case: looking for empty string/buffer always fails
  10286. if (val.length === 0) {
  10287. return -1
  10288. }
  10289. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  10290. } else if (typeof val === 'number') {
  10291. val = val & 0xFF // Search for a byte value [0-255]
  10292. if (Buffer.TYPED_ARRAY_SUPPORT &&
  10293. typeof Uint8Array.prototype.indexOf === 'function') {
  10294. if (dir) {
  10295. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  10296. } else {
  10297. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  10298. }
  10299. }
  10300. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  10301. }
  10302. throw new TypeError('val must be string, number or Buffer')
  10303. }
  10304. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  10305. var indexSize = 1
  10306. var arrLength = arr.length
  10307. var valLength = val.length
  10308. if (encoding !== undefined) {
  10309. encoding = String(encoding).toLowerCase()
  10310. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  10311. encoding === 'utf16le' || encoding === 'utf-16le') {
  10312. if (arr.length < 2 || val.length < 2) {
  10313. return -1
  10314. }
  10315. indexSize = 2
  10316. arrLength /= 2
  10317. valLength /= 2
  10318. byteOffset /= 2
  10319. }
  10320. }
  10321. function read (buf, i) {
  10322. if (indexSize === 1) {
  10323. return buf[i]
  10324. } else {
  10325. return buf.readUInt16BE(i * indexSize)
  10326. }
  10327. }
  10328. var i
  10329. if (dir) {
  10330. var foundIndex = -1
  10331. for (i = byteOffset; i < arrLength; i++) {
  10332. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  10333. if (foundIndex === -1) foundIndex = i
  10334. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  10335. } else {
  10336. if (foundIndex !== -1) i -= i - foundIndex
  10337. foundIndex = -1
  10338. }
  10339. }
  10340. } else {
  10341. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  10342. for (i = byteOffset; i >= 0; i--) {
  10343. var found = true
  10344. for (var j = 0; j < valLength; j++) {
  10345. if (read(arr, i + j) !== read(val, j)) {
  10346. found = false
  10347. break
  10348. }
  10349. }
  10350. if (found) return i
  10351. }
  10352. }
  10353. return -1
  10354. }
  10355. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  10356. return this.indexOf(val, byteOffset, encoding) !== -1
  10357. }
  10358. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  10359. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  10360. }
  10361. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  10362. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  10363. }
  10364. function hexWrite (buf, string, offset, length) {
  10365. offset = Number(offset) || 0
  10366. var remaining = buf.length - offset
  10367. if (!length) {
  10368. length = remaining
  10369. } else {
  10370. length = Number(length)
  10371. if (length > remaining) {
  10372. length = remaining
  10373. }
  10374. }
  10375. // must be an even number of digits
  10376. var strLen = string.length
  10377. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  10378. if (length > strLen / 2) {
  10379. length = strLen / 2
  10380. }
  10381. for (var i = 0; i < length; ++i) {
  10382. var parsed = parseInt(string.substr(i * 2, 2), 16)
  10383. if (isNaN(parsed)) return i
  10384. buf[offset + i] = parsed
  10385. }
  10386. return i
  10387. }
  10388. function utf8Write (buf, string, offset, length) {
  10389. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  10390. }
  10391. function asciiWrite (buf, string, offset, length) {
  10392. return blitBuffer(asciiToBytes(string), buf, offset, length)
  10393. }
  10394. function latin1Write (buf, string, offset, length) {
  10395. return asciiWrite(buf, string, offset, length)
  10396. }
  10397. function base64Write (buf, string, offset, length) {
  10398. return blitBuffer(base64ToBytes(string), buf, offset, length)
  10399. }
  10400. function ucs2Write (buf, string, offset, length) {
  10401. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  10402. }
  10403. Buffer.prototype.write = function write (string, offset, length, encoding) {
  10404. // Buffer#write(string)
  10405. if (offset === undefined) {
  10406. encoding = 'utf8'
  10407. length = this.length
  10408. offset = 0
  10409. // Buffer#write(string, encoding)
  10410. } else if (length === undefined && typeof offset === 'string') {
  10411. encoding = offset
  10412. length = this.length
  10413. offset = 0
  10414. // Buffer#write(string, offset[, length][, encoding])
  10415. } else if (isFinite(offset)) {
  10416. offset = offset | 0
  10417. if (isFinite(length)) {
  10418. length = length | 0
  10419. if (encoding === undefined) encoding = 'utf8'
  10420. } else {
  10421. encoding = length
  10422. length = undefined
  10423. }
  10424. // legacy write(string, encoding, offset, length) - remove in v0.13
  10425. } else {
  10426. throw new Error(
  10427. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  10428. )
  10429. }
  10430. var remaining = this.length - offset
  10431. if (length === undefined || length > remaining) length = remaining
  10432. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  10433. throw new RangeError('Attempt to write outside buffer bounds')
  10434. }
  10435. if (!encoding) encoding = 'utf8'
  10436. var loweredCase = false
  10437. for (;;) {
  10438. switch (encoding) {
  10439. case 'hex':
  10440. return hexWrite(this, string, offset, length)
  10441. case 'utf8':
  10442. case 'utf-8':
  10443. return utf8Write(this, string, offset, length)
  10444. case 'ascii':
  10445. return asciiWrite(this, string, offset, length)
  10446. case 'latin1':
  10447. case 'binary':
  10448. return latin1Write(this, string, offset, length)
  10449. case 'base64':
  10450. // Warning: maxLength not taken into account in base64Write
  10451. return base64Write(this, string, offset, length)
  10452. case 'ucs2':
  10453. case 'ucs-2':
  10454. case 'utf16le':
  10455. case 'utf-16le':
  10456. return ucs2Write(this, string, offset, length)
  10457. default:
  10458. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  10459. encoding = ('' + encoding).toLowerCase()
  10460. loweredCase = true
  10461. }
  10462. }
  10463. }
  10464. Buffer.prototype.toJSON = function toJSON () {
  10465. return {
  10466. type: 'Buffer',
  10467. data: Array.prototype.slice.call(this._arr || this, 0)
  10468. }
  10469. }
  10470. function base64Slice (buf, start, end) {
  10471. if (start === 0 && end === buf.length) {
  10472. return base64.fromByteArray(buf)
  10473. } else {
  10474. return base64.fromByteArray(buf.slice(start, end))
  10475. }
  10476. }
  10477. function utf8Slice (buf, start, end) {
  10478. end = Math.min(buf.length, end)
  10479. var res = []
  10480. var i = start
  10481. while (i < end) {
  10482. var firstByte = buf[i]
  10483. var codePoint = null
  10484. var bytesPerSequence = (firstByte > 0xEF) ? 4
  10485. : (firstByte > 0xDF) ? 3
  10486. : (firstByte > 0xBF) ? 2
  10487. : 1
  10488. if (i + bytesPerSequence <= end) {
  10489. var secondByte, thirdByte, fourthByte, tempCodePoint
  10490. switch (bytesPerSequence) {
  10491. case 1:
  10492. if (firstByte < 0x80) {
  10493. codePoint = firstByte
  10494. }
  10495. break
  10496. case 2:
  10497. secondByte = buf[i + 1]
  10498. if ((secondByte & 0xC0) === 0x80) {
  10499. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  10500. if (tempCodePoint > 0x7F) {
  10501. codePoint = tempCodePoint
  10502. }
  10503. }
  10504. break
  10505. case 3:
  10506. secondByte = buf[i + 1]
  10507. thirdByte = buf[i + 2]
  10508. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  10509. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  10510. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  10511. codePoint = tempCodePoint
  10512. }
  10513. }
  10514. break
  10515. case 4:
  10516. secondByte = buf[i + 1]
  10517. thirdByte = buf[i + 2]
  10518. fourthByte = buf[i + 3]
  10519. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  10520. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  10521. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  10522. codePoint = tempCodePoint
  10523. }
  10524. }
  10525. }
  10526. }
  10527. if (codePoint === null) {
  10528. // we did not generate a valid codePoint so insert a
  10529. // replacement char (U+FFFD) and advance only 1 byte
  10530. codePoint = 0xFFFD
  10531. bytesPerSequence = 1
  10532. } else if (codePoint > 0xFFFF) {
  10533. // encode to utf16 (surrogate pair dance)
  10534. codePoint -= 0x10000
  10535. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  10536. codePoint = 0xDC00 | codePoint & 0x3FF
  10537. }
  10538. res.push(codePoint)
  10539. i += bytesPerSequence
  10540. }
  10541. return decodeCodePointsArray(res)
  10542. }
  10543. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  10544. // the lowest limit is Chrome, with 0x10000 args.
  10545. // We go 1 magnitude less, for safety
  10546. var MAX_ARGUMENTS_LENGTH = 0x1000
  10547. function decodeCodePointsArray (codePoints) {
  10548. var len = codePoints.length
  10549. if (len <= MAX_ARGUMENTS_LENGTH) {
  10550. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  10551. }
  10552. // Decode in chunks to avoid "call stack size exceeded".
  10553. var res = ''
  10554. var i = 0
  10555. while (i < len) {
  10556. res += String.fromCharCode.apply(
  10557. String,
  10558. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  10559. )
  10560. }
  10561. return res
  10562. }
  10563. function asciiSlice (buf, start, end) {
  10564. var ret = ''
  10565. end = Math.min(buf.length, end)
  10566. for (var i = start; i < end; ++i) {
  10567. ret += String.fromCharCode(buf[i] & 0x7F)
  10568. }
  10569. return ret
  10570. }
  10571. function latin1Slice (buf, start, end) {
  10572. var ret = ''
  10573. end = Math.min(buf.length, end)
  10574. for (var i = start; i < end; ++i) {
  10575. ret += String.fromCharCode(buf[i])
  10576. }
  10577. return ret
  10578. }
  10579. function hexSlice (buf, start, end) {
  10580. var len = buf.length
  10581. if (!start || start < 0) start = 0
  10582. if (!end || end < 0 || end > len) end = len
  10583. var out = ''
  10584. for (var i = start; i < end; ++i) {
  10585. out += toHex(buf[i])
  10586. }
  10587. return out
  10588. }
  10589. function utf16leSlice (buf, start, end) {
  10590. var bytes = buf.slice(start, end)
  10591. var res = ''
  10592. for (var i = 0; i < bytes.length; i += 2) {
  10593. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  10594. }
  10595. return res
  10596. }
  10597. Buffer.prototype.slice = function slice (start, end) {
  10598. var len = this.length
  10599. start = ~~start
  10600. end = end === undefined ? len : ~~end
  10601. if (start < 0) {
  10602. start += len
  10603. if (start < 0) start = 0
  10604. } else if (start > len) {
  10605. start = len
  10606. }
  10607. if (end < 0) {
  10608. end += len
  10609. if (end < 0) end = 0
  10610. } else if (end > len) {
  10611. end = len
  10612. }
  10613. if (end < start) end = start
  10614. var newBuf
  10615. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10616. newBuf = this.subarray(start, end)
  10617. newBuf.__proto__ = Buffer.prototype
  10618. } else {
  10619. var sliceLen = end - start
  10620. newBuf = new Buffer(sliceLen, undefined)
  10621. for (var i = 0; i < sliceLen; ++i) {
  10622. newBuf[i] = this[i + start]
  10623. }
  10624. }
  10625. return newBuf
  10626. }
  10627. /*
  10628. * Need to make sure that buffer isn't trying to write out of bounds.
  10629. */
  10630. function checkOffset (offset, ext, length) {
  10631. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  10632. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  10633. }
  10634. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  10635. offset = offset | 0
  10636. byteLength = byteLength | 0
  10637. if (!noAssert) checkOffset(offset, byteLength, this.length)
  10638. var val = this[offset]
  10639. var mul = 1
  10640. var i = 0
  10641. while (++i < byteLength && (mul *= 0x100)) {
  10642. val += this[offset + i] * mul
  10643. }
  10644. return val
  10645. }
  10646. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  10647. offset = offset | 0
  10648. byteLength = byteLength | 0
  10649. if (!noAssert) {
  10650. checkOffset(offset, byteLength, this.length)
  10651. }
  10652. var val = this[offset + --byteLength]
  10653. var mul = 1
  10654. while (byteLength > 0 && (mul *= 0x100)) {
  10655. val += this[offset + --byteLength] * mul
  10656. }
  10657. return val
  10658. }
  10659. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  10660. if (!noAssert) checkOffset(offset, 1, this.length)
  10661. return this[offset]
  10662. }
  10663. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  10664. if (!noAssert) checkOffset(offset, 2, this.length)
  10665. return this[offset] | (this[offset + 1] << 8)
  10666. }
  10667. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  10668. if (!noAssert) checkOffset(offset, 2, this.length)
  10669. return (this[offset] << 8) | this[offset + 1]
  10670. }
  10671. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  10672. if (!noAssert) checkOffset(offset, 4, this.length)
  10673. return ((this[offset]) |
  10674. (this[offset + 1] << 8) |
  10675. (this[offset + 2] << 16)) +
  10676. (this[offset + 3] * 0x1000000)
  10677. }
  10678. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  10679. if (!noAssert) checkOffset(offset, 4, this.length)
  10680. return (this[offset] * 0x1000000) +
  10681. ((this[offset + 1] << 16) |
  10682. (this[offset + 2] << 8) |
  10683. this[offset + 3])
  10684. }
  10685. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  10686. offset = offset | 0
  10687. byteLength = byteLength | 0
  10688. if (!noAssert) checkOffset(offset, byteLength, this.length)
  10689. var val = this[offset]
  10690. var mul = 1
  10691. var i = 0
  10692. while (++i < byteLength && (mul *= 0x100)) {
  10693. val += this[offset + i] * mul
  10694. }
  10695. mul *= 0x80
  10696. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  10697. return val
  10698. }
  10699. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  10700. offset = offset | 0
  10701. byteLength = byteLength | 0
  10702. if (!noAssert) checkOffset(offset, byteLength, this.length)
  10703. var i = byteLength
  10704. var mul = 1
  10705. var val = this[offset + --i]
  10706. while (i > 0 && (mul *= 0x100)) {
  10707. val += this[offset + --i] * mul
  10708. }
  10709. mul *= 0x80
  10710. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  10711. return val
  10712. }
  10713. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  10714. if (!noAssert) checkOffset(offset, 1, this.length)
  10715. if (!(this[offset] & 0x80)) return (this[offset])
  10716. return ((0xff - this[offset] + 1) * -1)
  10717. }
  10718. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  10719. if (!noAssert) checkOffset(offset, 2, this.length)
  10720. var val = this[offset] | (this[offset + 1] << 8)
  10721. return (val & 0x8000) ? val | 0xFFFF0000 : val
  10722. }
  10723. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  10724. if (!noAssert) checkOffset(offset, 2, this.length)
  10725. var val = this[offset + 1] | (this[offset] << 8)
  10726. return (val & 0x8000) ? val | 0xFFFF0000 : val
  10727. }
  10728. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  10729. if (!noAssert) checkOffset(offset, 4, this.length)
  10730. return (this[offset]) |
  10731. (this[offset + 1] << 8) |
  10732. (this[offset + 2] << 16) |
  10733. (this[offset + 3] << 24)
  10734. }
  10735. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  10736. if (!noAssert) checkOffset(offset, 4, this.length)
  10737. return (this[offset] << 24) |
  10738. (this[offset + 1] << 16) |
  10739. (this[offset + 2] << 8) |
  10740. (this[offset + 3])
  10741. }
  10742. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  10743. if (!noAssert) checkOffset(offset, 4, this.length)
  10744. return ieee754.read(this, offset, true, 23, 4)
  10745. }
  10746. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  10747. if (!noAssert) checkOffset(offset, 4, this.length)
  10748. return ieee754.read(this, offset, false, 23, 4)
  10749. }
  10750. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  10751. if (!noAssert) checkOffset(offset, 8, this.length)
  10752. return ieee754.read(this, offset, true, 52, 8)
  10753. }
  10754. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  10755. if (!noAssert) checkOffset(offset, 8, this.length)
  10756. return ieee754.read(this, offset, false, 52, 8)
  10757. }
  10758. function checkInt (buf, value, offset, ext, max, min) {
  10759. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  10760. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  10761. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  10762. }
  10763. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  10764. value = +value
  10765. offset = offset | 0
  10766. byteLength = byteLength | 0
  10767. if (!noAssert) {
  10768. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  10769. checkInt(this, value, offset, byteLength, maxBytes, 0)
  10770. }
  10771. var mul = 1
  10772. var i = 0
  10773. this[offset] = value & 0xFF
  10774. while (++i < byteLength && (mul *= 0x100)) {
  10775. this[offset + i] = (value / mul) & 0xFF
  10776. }
  10777. return offset + byteLength
  10778. }
  10779. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  10780. value = +value
  10781. offset = offset | 0
  10782. byteLength = byteLength | 0
  10783. if (!noAssert) {
  10784. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  10785. checkInt(this, value, offset, byteLength, maxBytes, 0)
  10786. }
  10787. var i = byteLength - 1
  10788. var mul = 1
  10789. this[offset + i] = value & 0xFF
  10790. while (--i >= 0 && (mul *= 0x100)) {
  10791. this[offset + i] = (value / mul) & 0xFF
  10792. }
  10793. return offset + byteLength
  10794. }
  10795. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  10796. value = +value
  10797. offset = offset | 0
  10798. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  10799. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  10800. this[offset] = (value & 0xff)
  10801. return offset + 1
  10802. }
  10803. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  10804. if (value < 0) value = 0xffff + value + 1
  10805. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  10806. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  10807. (littleEndian ? i : 1 - i) * 8
  10808. }
  10809. }
  10810. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  10811. value = +value
  10812. offset = offset | 0
  10813. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  10814. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10815. this[offset] = (value & 0xff)
  10816. this[offset + 1] = (value >>> 8)
  10817. } else {
  10818. objectWriteUInt16(this, value, offset, true)
  10819. }
  10820. return offset + 2
  10821. }
  10822. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  10823. value = +value
  10824. offset = offset | 0
  10825. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  10826. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10827. this[offset] = (value >>> 8)
  10828. this[offset + 1] = (value & 0xff)
  10829. } else {
  10830. objectWriteUInt16(this, value, offset, false)
  10831. }
  10832. return offset + 2
  10833. }
  10834. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  10835. if (value < 0) value = 0xffffffff + value + 1
  10836. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  10837. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  10838. }
  10839. }
  10840. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  10841. value = +value
  10842. offset = offset | 0
  10843. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  10844. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10845. this[offset + 3] = (value >>> 24)
  10846. this[offset + 2] = (value >>> 16)
  10847. this[offset + 1] = (value >>> 8)
  10848. this[offset] = (value & 0xff)
  10849. } else {
  10850. objectWriteUInt32(this, value, offset, true)
  10851. }
  10852. return offset + 4
  10853. }
  10854. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  10855. value = +value
  10856. offset = offset | 0
  10857. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  10858. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10859. this[offset] = (value >>> 24)
  10860. this[offset + 1] = (value >>> 16)
  10861. this[offset + 2] = (value >>> 8)
  10862. this[offset + 3] = (value & 0xff)
  10863. } else {
  10864. objectWriteUInt32(this, value, offset, false)
  10865. }
  10866. return offset + 4
  10867. }
  10868. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  10869. value = +value
  10870. offset = offset | 0
  10871. if (!noAssert) {
  10872. var limit = Math.pow(2, 8 * byteLength - 1)
  10873. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  10874. }
  10875. var i = 0
  10876. var mul = 1
  10877. var sub = 0
  10878. this[offset] = value & 0xFF
  10879. while (++i < byteLength && (mul *= 0x100)) {
  10880. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  10881. sub = 1
  10882. }
  10883. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  10884. }
  10885. return offset + byteLength
  10886. }
  10887. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  10888. value = +value
  10889. offset = offset | 0
  10890. if (!noAssert) {
  10891. var limit = Math.pow(2, 8 * byteLength - 1)
  10892. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  10893. }
  10894. var i = byteLength - 1
  10895. var mul = 1
  10896. var sub = 0
  10897. this[offset + i] = value & 0xFF
  10898. while (--i >= 0 && (mul *= 0x100)) {
  10899. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  10900. sub = 1
  10901. }
  10902. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  10903. }
  10904. return offset + byteLength
  10905. }
  10906. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  10907. value = +value
  10908. offset = offset | 0
  10909. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  10910. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  10911. if (value < 0) value = 0xff + value + 1
  10912. this[offset] = (value & 0xff)
  10913. return offset + 1
  10914. }
  10915. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  10916. value = +value
  10917. offset = offset | 0
  10918. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  10919. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10920. this[offset] = (value & 0xff)
  10921. this[offset + 1] = (value >>> 8)
  10922. } else {
  10923. objectWriteUInt16(this, value, offset, true)
  10924. }
  10925. return offset + 2
  10926. }
  10927. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  10928. value = +value
  10929. offset = offset | 0
  10930. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  10931. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10932. this[offset] = (value >>> 8)
  10933. this[offset + 1] = (value & 0xff)
  10934. } else {
  10935. objectWriteUInt16(this, value, offset, false)
  10936. }
  10937. return offset + 2
  10938. }
  10939. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  10940. value = +value
  10941. offset = offset | 0
  10942. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  10943. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10944. this[offset] = (value & 0xff)
  10945. this[offset + 1] = (value >>> 8)
  10946. this[offset + 2] = (value >>> 16)
  10947. this[offset + 3] = (value >>> 24)
  10948. } else {
  10949. objectWriteUInt32(this, value, offset, true)
  10950. }
  10951. return offset + 4
  10952. }
  10953. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  10954. value = +value
  10955. offset = offset | 0
  10956. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  10957. if (value < 0) value = 0xffffffff + value + 1
  10958. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10959. this[offset] = (value >>> 24)
  10960. this[offset + 1] = (value >>> 16)
  10961. this[offset + 2] = (value >>> 8)
  10962. this[offset + 3] = (value & 0xff)
  10963. } else {
  10964. objectWriteUInt32(this, value, offset, false)
  10965. }
  10966. return offset + 4
  10967. }
  10968. function checkIEEE754 (buf, value, offset, ext, max, min) {
  10969. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  10970. if (offset < 0) throw new RangeError('Index out of range')
  10971. }
  10972. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  10973. if (!noAssert) {
  10974. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  10975. }
  10976. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  10977. return offset + 4
  10978. }
  10979. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  10980. return writeFloat(this, value, offset, true, noAssert)
  10981. }
  10982. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  10983. return writeFloat(this, value, offset, false, noAssert)
  10984. }
  10985. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  10986. if (!noAssert) {
  10987. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  10988. }
  10989. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  10990. return offset + 8
  10991. }
  10992. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  10993. return writeDouble(this, value, offset, true, noAssert)
  10994. }
  10995. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  10996. return writeDouble(this, value, offset, false, noAssert)
  10997. }
  10998. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  10999. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  11000. if (!start) start = 0
  11001. if (!end && end !== 0) end = this.length
  11002. if (targetStart >= target.length) targetStart = target.length
  11003. if (!targetStart) targetStart = 0
  11004. if (end > 0 && end < start) end = start
  11005. // Copy 0 bytes; we're done
  11006. if (end === start) return 0
  11007. if (target.length === 0 || this.length === 0) return 0
  11008. // Fatal error conditions
  11009. if (targetStart < 0) {
  11010. throw new RangeError('targetStart out of bounds')
  11011. }
  11012. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  11013. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  11014. // Are we oob?
  11015. if (end > this.length) end = this.length
  11016. if (target.length - targetStart < end - start) {
  11017. end = target.length - targetStart + start
  11018. }
  11019. var len = end - start
  11020. var i
  11021. if (this === target && start < targetStart && targetStart < end) {
  11022. // descending copy from end
  11023. for (i = len - 1; i >= 0; --i) {
  11024. target[i + targetStart] = this[i + start]
  11025. }
  11026. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  11027. // ascending copy from start
  11028. for (i = 0; i < len; ++i) {
  11029. target[i + targetStart] = this[i + start]
  11030. }
  11031. } else {
  11032. Uint8Array.prototype.set.call(
  11033. target,
  11034. this.subarray(start, start + len),
  11035. targetStart
  11036. )
  11037. }
  11038. return len
  11039. }
  11040. // Usage:
  11041. // buffer.fill(number[, offset[, end]])
  11042. // buffer.fill(buffer[, offset[, end]])
  11043. // buffer.fill(string[, offset[, end]][, encoding])
  11044. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  11045. // Handle string cases:
  11046. if (typeof val === 'string') {
  11047. if (typeof start === 'string') {
  11048. encoding = start
  11049. start = 0
  11050. end = this.length
  11051. } else if (typeof end === 'string') {
  11052. encoding = end
  11053. end = this.length
  11054. }
  11055. if (val.length === 1) {
  11056. var code = val.charCodeAt(0)
  11057. if (code < 256) {
  11058. val = code
  11059. }
  11060. }
  11061. if (encoding !== undefined && typeof encoding !== 'string') {
  11062. throw new TypeError('encoding must be a string')
  11063. }
  11064. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  11065. throw new TypeError('Unknown encoding: ' + encoding)
  11066. }
  11067. } else if (typeof val === 'number') {
  11068. val = val & 255
  11069. }
  11070. // Invalid ranges are not set to a default, so can range check early.
  11071. if (start < 0 || this.length < start || this.length < end) {
  11072. throw new RangeError('Out of range index')
  11073. }
  11074. if (end <= start) {
  11075. return this
  11076. }
  11077. start = start >>> 0
  11078. end = end === undefined ? this.length : end >>> 0
  11079. if (!val) val = 0
  11080. var i
  11081. if (typeof val === 'number') {
  11082. for (i = start; i < end; ++i) {
  11083. this[i] = val
  11084. }
  11085. } else {
  11086. var bytes = Buffer.isBuffer(val)
  11087. ? val
  11088. : utf8ToBytes(new Buffer(val, encoding).toString())
  11089. var len = bytes.length
  11090. for (i = 0; i < end - start; ++i) {
  11091. this[i + start] = bytes[i % len]
  11092. }
  11093. }
  11094. return this
  11095. }
  11096. // HELPER FUNCTIONS
  11097. // ================
  11098. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  11099. function base64clean (str) {
  11100. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  11101. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  11102. // Node converts strings with length < 2 to ''
  11103. if (str.length < 2) return ''
  11104. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  11105. while (str.length % 4 !== 0) {
  11106. str = str + '='
  11107. }
  11108. return str
  11109. }
  11110. function stringtrim (str) {
  11111. if (str.trim) return str.trim()
  11112. return str.replace(/^\s+|\s+$/g, '')
  11113. }
  11114. function toHex (n) {
  11115. if (n < 16) return '0' + n.toString(16)
  11116. return n.toString(16)
  11117. }
  11118. function utf8ToBytes (string, units) {
  11119. units = units || Infinity
  11120. var codePoint
  11121. var length = string.length
  11122. var leadSurrogate = null
  11123. var bytes = []
  11124. for (var i = 0; i < length; ++i) {
  11125. codePoint = string.charCodeAt(i)
  11126. // is surrogate component
  11127. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  11128. // last char was a lead
  11129. if (!leadSurrogate) {
  11130. // no lead yet
  11131. if (codePoint > 0xDBFF) {
  11132. // unexpected trail
  11133. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11134. continue
  11135. } else if (i + 1 === length) {
  11136. // unpaired lead
  11137. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11138. continue
  11139. }
  11140. // valid lead
  11141. leadSurrogate = codePoint
  11142. continue
  11143. }
  11144. // 2 leads in a row
  11145. if (codePoint < 0xDC00) {
  11146. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11147. leadSurrogate = codePoint
  11148. continue
  11149. }
  11150. // valid surrogate pair
  11151. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  11152. } else if (leadSurrogate) {
  11153. // valid bmp char, but last char was a lead
  11154. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11155. }
  11156. leadSurrogate = null
  11157. // encode utf8
  11158. if (codePoint < 0x80) {
  11159. if ((units -= 1) < 0) break
  11160. bytes.push(codePoint)
  11161. } else if (codePoint < 0x800) {
  11162. if ((units -= 2) < 0) break
  11163. bytes.push(
  11164. codePoint >> 0x6 | 0xC0,
  11165. codePoint & 0x3F | 0x80
  11166. )
  11167. } else if (codePoint < 0x10000) {
  11168. if ((units -= 3) < 0) break
  11169. bytes.push(
  11170. codePoint >> 0xC | 0xE0,
  11171. codePoint >> 0x6 & 0x3F | 0x80,
  11172. codePoint & 0x3F | 0x80
  11173. )
  11174. } else if (codePoint < 0x110000) {
  11175. if ((units -= 4) < 0) break
  11176. bytes.push(
  11177. codePoint >> 0x12 | 0xF0,
  11178. codePoint >> 0xC & 0x3F | 0x80,
  11179. codePoint >> 0x6 & 0x3F | 0x80,
  11180. codePoint & 0x3F | 0x80
  11181. )
  11182. } else {
  11183. throw new Error('Invalid code point')
  11184. }
  11185. }
  11186. return bytes
  11187. }
  11188. function asciiToBytes (str) {
  11189. var byteArray = []
  11190. for (var i = 0; i < str.length; ++i) {
  11191. // Node's code seems to be doing this and not & 0x7F..
  11192. byteArray.push(str.charCodeAt(i) & 0xFF)
  11193. }
  11194. return byteArray
  11195. }
  11196. function utf16leToBytes (str, units) {
  11197. var c, hi, lo
  11198. var byteArray = []
  11199. for (var i = 0; i < str.length; ++i) {
  11200. if ((units -= 2) < 0) break
  11201. c = str.charCodeAt(i)
  11202. hi = c >> 8
  11203. lo = c % 256
  11204. byteArray.push(lo)
  11205. byteArray.push(hi)
  11206. }
  11207. return byteArray
  11208. }
  11209. function base64ToBytes (str) {
  11210. return base64.toByteArray(base64clean(str))
  11211. }
  11212. function blitBuffer (src, dst, offset, length) {
  11213. for (var i = 0; i < length; ++i) {
  11214. if ((i + offset >= dst.length) || (i >= src.length)) break
  11215. dst[i + offset] = src[i]
  11216. }
  11217. return i
  11218. }
  11219. function isnan (val) {
  11220. return val !== val // eslint-disable-line no-self-compare
  11221. }
  11222. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
  11223. /***/ }),
  11224. /* 89 */
  11225. /*!*****************************************!*\
  11226. !*** ./node_modules/base64-js/index.js ***!
  11227. \*****************************************/
  11228. /*! no static exports found */
  11229. /***/ (function(module, exports, __webpack_require__) {
  11230. "use strict";
  11231. exports.byteLength = byteLength
  11232. exports.toByteArray = toByteArray
  11233. exports.fromByteArray = fromByteArray
  11234. var lookup = []
  11235. var revLookup = []
  11236. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  11237. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  11238. for (var i = 0, len = code.length; i < len; ++i) {
  11239. lookup[i] = code[i]
  11240. revLookup[code.charCodeAt(i)] = i
  11241. }
  11242. // Support decoding URL-safe base64 strings, as Node.js does.
  11243. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  11244. revLookup['-'.charCodeAt(0)] = 62
  11245. revLookup['_'.charCodeAt(0)] = 63
  11246. function getLens (b64) {
  11247. var len = b64.length
  11248. if (len % 4 > 0) {
  11249. throw new Error('Invalid string. Length must be a multiple of 4')
  11250. }
  11251. // Trim off extra bytes after placeholder bytes are found
  11252. // See: https://github.com/beatgammit/base64-js/issues/42
  11253. var validLen = b64.indexOf('=')
  11254. if (validLen === -1) validLen = len
  11255. var placeHoldersLen = validLen === len
  11256. ? 0
  11257. : 4 - (validLen % 4)
  11258. return [validLen, placeHoldersLen]
  11259. }
  11260. // base64 is 4/3 + up to two characters of the original data
  11261. function byteLength (b64) {
  11262. var lens = getLens(b64)
  11263. var validLen = lens[0]
  11264. var placeHoldersLen = lens[1]
  11265. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  11266. }
  11267. function _byteLength (b64, validLen, placeHoldersLen) {
  11268. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  11269. }
  11270. function toByteArray (b64) {
  11271. var tmp
  11272. var lens = getLens(b64)
  11273. var validLen = lens[0]
  11274. var placeHoldersLen = lens[1]
  11275. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  11276. var curByte = 0
  11277. // if there are placeholders, only get up to the last complete 4 chars
  11278. var len = placeHoldersLen > 0
  11279. ? validLen - 4
  11280. : validLen
  11281. var i
  11282. for (i = 0; i < len; i += 4) {
  11283. tmp =
  11284. (revLookup[b64.charCodeAt(i)] << 18) |
  11285. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  11286. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  11287. revLookup[b64.charCodeAt(i + 3)]
  11288. arr[curByte++] = (tmp >> 16) & 0xFF
  11289. arr[curByte++] = (tmp >> 8) & 0xFF
  11290. arr[curByte++] = tmp & 0xFF
  11291. }
  11292. if (placeHoldersLen === 2) {
  11293. tmp =
  11294. (revLookup[b64.charCodeAt(i)] << 2) |
  11295. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  11296. arr[curByte++] = tmp & 0xFF
  11297. }
  11298. if (placeHoldersLen === 1) {
  11299. tmp =
  11300. (revLookup[b64.charCodeAt(i)] << 10) |
  11301. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  11302. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  11303. arr[curByte++] = (tmp >> 8) & 0xFF
  11304. arr[curByte++] = tmp & 0xFF
  11305. }
  11306. return arr
  11307. }
  11308. function tripletToBase64 (num) {
  11309. return lookup[num >> 18 & 0x3F] +
  11310. lookup[num >> 12 & 0x3F] +
  11311. lookup[num >> 6 & 0x3F] +
  11312. lookup[num & 0x3F]
  11313. }
  11314. function encodeChunk (uint8, start, end) {
  11315. var tmp
  11316. var output = []
  11317. for (var i = start; i < end; i += 3) {
  11318. tmp =
  11319. ((uint8[i] << 16) & 0xFF0000) +
  11320. ((uint8[i + 1] << 8) & 0xFF00) +
  11321. (uint8[i + 2] & 0xFF)
  11322. output.push(tripletToBase64(tmp))
  11323. }
  11324. return output.join('')
  11325. }
  11326. function fromByteArray (uint8) {
  11327. var tmp
  11328. var len = uint8.length
  11329. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  11330. var parts = []
  11331. var maxChunkLength = 16383 // must be multiple of 3
  11332. // go through the array every three bytes, we'll deal with trailing stuff later
  11333. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  11334. parts.push(encodeChunk(
  11335. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  11336. ))
  11337. }
  11338. // pad the end with zeros, but make sure to not forget the extra bytes
  11339. if (extraBytes === 1) {
  11340. tmp = uint8[len - 1]
  11341. parts.push(
  11342. lookup[tmp >> 2] +
  11343. lookup[(tmp << 4) & 0x3F] +
  11344. '=='
  11345. )
  11346. } else if (extraBytes === 2) {
  11347. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  11348. parts.push(
  11349. lookup[tmp >> 10] +
  11350. lookup[(tmp >> 4) & 0x3F] +
  11351. lookup[(tmp << 2) & 0x3F] +
  11352. '='
  11353. )
  11354. }
  11355. return parts.join('')
  11356. }
  11357. /***/ }),
  11358. /* 90 */
  11359. /*!***************************************!*\
  11360. !*** ./node_modules/ieee754/index.js ***!
  11361. \***************************************/
  11362. /*! no static exports found */
  11363. /***/ (function(module, exports) {
  11364. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11365. var e, m
  11366. var eLen = (nBytes * 8) - mLen - 1
  11367. var eMax = (1 << eLen) - 1
  11368. var eBias = eMax >> 1
  11369. var nBits = -7
  11370. var i = isLE ? (nBytes - 1) : 0
  11371. var d = isLE ? -1 : 1
  11372. var s = buffer[offset + i]
  11373. i += d
  11374. e = s & ((1 << (-nBits)) - 1)
  11375. s >>= (-nBits)
  11376. nBits += eLen
  11377. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11378. m = e & ((1 << (-nBits)) - 1)
  11379. e >>= (-nBits)
  11380. nBits += mLen
  11381. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11382. if (e === 0) {
  11383. e = 1 - eBias
  11384. } else if (e === eMax) {
  11385. return m ? NaN : ((s ? -1 : 1) * Infinity)
  11386. } else {
  11387. m = m + Math.pow(2, mLen)
  11388. e = e - eBias
  11389. }
  11390. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  11391. }
  11392. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  11393. var e, m, c
  11394. var eLen = (nBytes * 8) - mLen - 1
  11395. var eMax = (1 << eLen) - 1
  11396. var eBias = eMax >> 1
  11397. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  11398. var i = isLE ? 0 : (nBytes - 1)
  11399. var d = isLE ? 1 : -1
  11400. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  11401. value = Math.abs(value)
  11402. if (isNaN(value) || value === Infinity) {
  11403. m = isNaN(value) ? 1 : 0
  11404. e = eMax
  11405. } else {
  11406. e = Math.floor(Math.log(value) / Math.LN2)
  11407. if (value * (c = Math.pow(2, -e)) < 1) {
  11408. e--
  11409. c *= 2
  11410. }
  11411. if (e + eBias >= 1) {
  11412. value += rt / c
  11413. } else {
  11414. value += rt * Math.pow(2, 1 - eBias)
  11415. }
  11416. if (value * c >= 2) {
  11417. e++
  11418. c /= 2
  11419. }
  11420. if (e + eBias >= eMax) {
  11421. m = 0
  11422. e = eMax
  11423. } else if (e + eBias >= 1) {
  11424. m = ((value * c) - 1) * Math.pow(2, mLen)
  11425. e = e + eBias
  11426. } else {
  11427. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  11428. e = 0
  11429. }
  11430. }
  11431. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  11432. e = (e << mLen) | m
  11433. eLen += mLen
  11434. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  11435. buffer[offset + i - d] |= s * 128
  11436. }
  11437. /***/ }),
  11438. /* 91 */
  11439. /*!***************************************!*\
  11440. !*** ./node_modules/isarray/index.js ***!
  11441. \***************************************/
  11442. /*! no static exports found */
  11443. /***/ (function(module, exports) {
  11444. var toString = {}.toString;
  11445. module.exports = Array.isArray || function (arr) {
  11446. return toString.call(arr) == '[object Array]';
  11447. };
  11448. /***/ }),
  11449. /* 92 */
  11450. /*!*********************************************!*\
  11451. !*** ./node_modules/create-hash/browser.js ***!
  11452. \*********************************************/
  11453. /*! no static exports found */
  11454. /***/ (function(module, exports, __webpack_require__) {
  11455. "use strict";
  11456. var inherits = __webpack_require__(/*! inherits */ 93)
  11457. var MD5 = __webpack_require__(/*! md5.js */ 94)
  11458. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 112)
  11459. var sha = __webpack_require__(/*! sha.js */ 113)
  11460. var Base = __webpack_require__(/*! cipher-base */ 121)
  11461. function Hash (hash) {
  11462. Base.call(this, 'digest')
  11463. this._hash = hash
  11464. }
  11465. inherits(Hash, Base)
  11466. Hash.prototype._update = function (data) {
  11467. this._hash.update(data)
  11468. }
  11469. Hash.prototype._final = function () {
  11470. return this._hash.digest()
  11471. }
  11472. module.exports = function createHash (alg) {
  11473. alg = alg.toLowerCase()
  11474. if (alg === 'md5') return new MD5()
  11475. if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
  11476. return new Hash(sha(alg))
  11477. }
  11478. /***/ }),
  11479. /* 93 */
  11480. /*!***************************************************!*\
  11481. !*** ./node_modules/inherits/inherits_browser.js ***!
  11482. \***************************************************/
  11483. /*! no static exports found */
  11484. /***/ (function(module, exports) {
  11485. if (typeof Object.create === 'function') {
  11486. // implementation from standard node.js 'util' module
  11487. module.exports = function inherits(ctor, superCtor) {
  11488. if (superCtor) {
  11489. ctor.super_ = superCtor
  11490. ctor.prototype = Object.create(superCtor.prototype, {
  11491. constructor: {
  11492. value: ctor,
  11493. enumerable: false,
  11494. writable: true,
  11495. configurable: true
  11496. }
  11497. })
  11498. }
  11499. };
  11500. } else {
  11501. // old school shim for old browsers
  11502. module.exports = function inherits(ctor, superCtor) {
  11503. if (superCtor) {
  11504. ctor.super_ = superCtor
  11505. var TempCtor = function () {}
  11506. TempCtor.prototype = superCtor.prototype
  11507. ctor.prototype = new TempCtor()
  11508. ctor.prototype.constructor = ctor
  11509. }
  11510. }
  11511. }
  11512. /***/ }),
  11513. /* 94 */
  11514. /*!**************************************!*\
  11515. !*** ./node_modules/md5.js/index.js ***!
  11516. \**************************************/
  11517. /*! no static exports found */
  11518. /***/ (function(module, exports, __webpack_require__) {
  11519. "use strict";
  11520. var inherits = __webpack_require__(/*! inherits */ 93)
  11521. var HashBase = __webpack_require__(/*! hash-base */ 95)
  11522. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  11523. var ARRAY16 = new Array(16)
  11524. function MD5 () {
  11525. HashBase.call(this, 64)
  11526. // state
  11527. this._a = 0x67452301
  11528. this._b = 0xefcdab89
  11529. this._c = 0x98badcfe
  11530. this._d = 0x10325476
  11531. }
  11532. inherits(MD5, HashBase)
  11533. MD5.prototype._update = function () {
  11534. var M = ARRAY16
  11535. for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
  11536. var a = this._a
  11537. var b = this._b
  11538. var c = this._c
  11539. var d = this._d
  11540. a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
  11541. d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
  11542. c = fnF(c, d, a, b, M[2], 0x242070db, 17)
  11543. b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
  11544. a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
  11545. d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
  11546. c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
  11547. b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
  11548. a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
  11549. d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
  11550. c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
  11551. b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
  11552. a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
  11553. d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
  11554. c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
  11555. b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
  11556. a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
  11557. d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
  11558. c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
  11559. b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
  11560. a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
  11561. d = fnG(d, a, b, c, M[10], 0x02441453, 9)
  11562. c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
  11563. b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
  11564. a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
  11565. d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
  11566. c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
  11567. b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
  11568. a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
  11569. d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
  11570. c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
  11571. b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
  11572. a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
  11573. d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
  11574. c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
  11575. b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
  11576. a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
  11577. d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
  11578. c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
  11579. b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
  11580. a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
  11581. d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
  11582. c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
  11583. b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
  11584. a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
  11585. d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
  11586. c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
  11587. b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
  11588. a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
  11589. d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
  11590. c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
  11591. b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
  11592. a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
  11593. d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
  11594. c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
  11595. b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
  11596. a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
  11597. d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
  11598. c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
  11599. b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
  11600. a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
  11601. d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
  11602. c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
  11603. b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
  11604. this._a = (this._a + a) | 0
  11605. this._b = (this._b + b) | 0
  11606. this._c = (this._c + c) | 0
  11607. this._d = (this._d + d) | 0
  11608. }
  11609. MD5.prototype._digest = function () {
  11610. // create padding and handle blocks
  11611. this._block[this._blockOffset++] = 0x80
  11612. if (this._blockOffset > 56) {
  11613. this._block.fill(0, this._blockOffset, 64)
  11614. this._update()
  11615. this._blockOffset = 0
  11616. }
  11617. this._block.fill(0, this._blockOffset, 56)
  11618. this._block.writeUInt32LE(this._length[0], 56)
  11619. this._block.writeUInt32LE(this._length[1], 60)
  11620. this._update()
  11621. // produce result
  11622. var buffer = Buffer.allocUnsafe(16)
  11623. buffer.writeInt32LE(this._a, 0)
  11624. buffer.writeInt32LE(this._b, 4)
  11625. buffer.writeInt32LE(this._c, 8)
  11626. buffer.writeInt32LE(this._d, 12)
  11627. return buffer
  11628. }
  11629. function rotl (x, n) {
  11630. return (x << n) | (x >>> (32 - n))
  11631. }
  11632. function fnF (a, b, c, d, m, k, s) {
  11633. return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0
  11634. }
  11635. function fnG (a, b, c, d, m, k, s) {
  11636. return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0
  11637. }
  11638. function fnH (a, b, c, d, m, k, s) {
  11639. return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0
  11640. }
  11641. function fnI (a, b, c, d, m, k, s) {
  11642. return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0
  11643. }
  11644. module.exports = MD5
  11645. /***/ }),
  11646. /* 95 */
  11647. /*!*****************************************!*\
  11648. !*** ./node_modules/hash-base/index.js ***!
  11649. \*****************************************/
  11650. /*! no static exports found */
  11651. /***/ (function(module, exports, __webpack_require__) {
  11652. "use strict";
  11653. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  11654. var Transform = __webpack_require__(/*! readable-stream */ 96).Transform
  11655. var inherits = __webpack_require__(/*! inherits */ 93)
  11656. function throwIfNotStringOrBuffer (val, prefix) {
  11657. if (!Buffer.isBuffer(val) && typeof val !== 'string') {
  11658. throw new TypeError(prefix + ' must be a string or a buffer')
  11659. }
  11660. }
  11661. function HashBase (blockSize) {
  11662. Transform.call(this)
  11663. this._block = Buffer.allocUnsafe(blockSize)
  11664. this._blockSize = blockSize
  11665. this._blockOffset = 0
  11666. this._length = [0, 0, 0, 0]
  11667. this._finalized = false
  11668. }
  11669. inherits(HashBase, Transform)
  11670. HashBase.prototype._transform = function (chunk, encoding, callback) {
  11671. var error = null
  11672. try {
  11673. this.update(chunk, encoding)
  11674. } catch (err) {
  11675. error = err
  11676. }
  11677. callback(error)
  11678. }
  11679. HashBase.prototype._flush = function (callback) {
  11680. var error = null
  11681. try {
  11682. this.push(this.digest())
  11683. } catch (err) {
  11684. error = err
  11685. }
  11686. callback(error)
  11687. }
  11688. HashBase.prototype.update = function (data, encoding) {
  11689. throwIfNotStringOrBuffer(data, 'Data')
  11690. if (this._finalized) throw new Error('Digest already called')
  11691. if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
  11692. // consume data
  11693. var block = this._block
  11694. var offset = 0
  11695. while (this._blockOffset + data.length - offset >= this._blockSize) {
  11696. for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
  11697. this._update()
  11698. this._blockOffset = 0
  11699. }
  11700. while (offset < data.length) block[this._blockOffset++] = data[offset++]
  11701. // update length
  11702. for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
  11703. this._length[j] += carry
  11704. carry = (this._length[j] / 0x0100000000) | 0
  11705. if (carry > 0) this._length[j] -= 0x0100000000 * carry
  11706. }
  11707. return this
  11708. }
  11709. HashBase.prototype._update = function () {
  11710. throw new Error('_update is not implemented')
  11711. }
  11712. HashBase.prototype.digest = function (encoding) {
  11713. if (this._finalized) throw new Error('Digest already called')
  11714. this._finalized = true
  11715. var digest = this._digest()
  11716. if (encoding !== undefined) digest = digest.toString(encoding)
  11717. // reset state
  11718. this._block.fill(0)
  11719. this._blockOffset = 0
  11720. for (var i = 0; i < 4; ++i) this._length[i] = 0
  11721. return digest
  11722. }
  11723. HashBase.prototype._digest = function () {
  11724. throw new Error('_digest is not implemented')
  11725. }
  11726. module.exports = HashBase
  11727. /***/ }),
  11728. /* 96 */
  11729. /*!**********************************************************!*\
  11730. !*** ./node_modules/readable-stream/readable-browser.js ***!
  11731. \**********************************************************/
  11732. /*! no static exports found */
  11733. /***/ (function(module, exports, __webpack_require__) {
  11734. exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ 97);
  11735. exports.Stream = exports;
  11736. exports.Readable = exports;
  11737. exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 107);
  11738. exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ 106);
  11739. exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ 110);
  11740. exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ 111);
  11741. /***/ }),
  11742. /* 97 */
  11743. /*!**************************************************************!*\
  11744. !*** ./node_modules/readable-stream/lib/_stream_readable.js ***!
  11745. \**************************************************************/
  11746. /*! no static exports found */
  11747. /***/ (function(module, exports, __webpack_require__) {
  11748. "use strict";
  11749. /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
  11750. //
  11751. // Permission is hereby granted, free of charge, to any person obtaining a
  11752. // copy of this software and associated documentation files (the
  11753. // "Software"), to deal in the Software without restriction, including
  11754. // without limitation the rights to use, copy, modify, merge, publish,
  11755. // distribute, sublicense, and/or sell copies of the Software, and to permit
  11756. // persons to whom the Software is furnished to do so, subject to the
  11757. // following conditions:
  11758. //
  11759. // The above copyright notice and this permission notice shall be included
  11760. // in all copies or substantial portions of the Software.
  11761. //
  11762. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  11763. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11764. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11765. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11766. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11767. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11768. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  11769. /*<replacement>*/
  11770. var pna = __webpack_require__(/*! process-nextick-args */ 98);
  11771. /*</replacement>*/
  11772. module.exports = Readable;
  11773. /*<replacement>*/
  11774. var isArray = __webpack_require__(/*! isarray */ 91);
  11775. /*</replacement>*/
  11776. /*<replacement>*/
  11777. var Duplex;
  11778. /*</replacement>*/
  11779. Readable.ReadableState = ReadableState;
  11780. /*<replacement>*/
  11781. var EE = __webpack_require__(/*! events */ 99).EventEmitter;
  11782. var EElistenerCount = function (emitter, type) {
  11783. return emitter.listeners(type).length;
  11784. };
  11785. /*</replacement>*/
  11786. /*<replacement>*/
  11787. var Stream = __webpack_require__(/*! ./internal/streams/stream */ 100);
  11788. /*</replacement>*/
  11789. /*<replacement>*/
  11790. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer;
  11791. var OurUint8Array = global.Uint8Array || function () {};
  11792. function _uint8ArrayToBuffer(chunk) {
  11793. return Buffer.from(chunk);
  11794. }
  11795. function _isUint8Array(obj) {
  11796. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  11797. }
  11798. /*</replacement>*/
  11799. /*<replacement>*/
  11800. var util = Object.create(__webpack_require__(/*! core-util-is */ 101));
  11801. util.inherits = __webpack_require__(/*! inherits */ 93);
  11802. /*</replacement>*/
  11803. /*<replacement>*/
  11804. var debugUtil = __webpack_require__(/*! util */ 102);
  11805. var debug = void 0;
  11806. if (debugUtil && debugUtil.debuglog) {
  11807. debug = debugUtil.debuglog('stream');
  11808. } else {
  11809. debug = function () {};
  11810. }
  11811. /*</replacement>*/
  11812. var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ 103);
  11813. var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 105);
  11814. var StringDecoder;
  11815. util.inherits(Readable, Stream);
  11816. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  11817. function prependListener(emitter, event, fn) {
  11818. // Sadly this is not cacheable as some libraries bundle their own
  11819. // event emitter implementation with them.
  11820. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  11821. // This is a hack to make sure that our error handler is attached before any
  11822. // userland ones. NEVER DO THIS. This is here only because this code needs
  11823. // to continue to work with older versions of Node.js that do not include
  11824. // the prependListener() method. The goal is to eventually remove this hack.
  11825. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  11826. }
  11827. function ReadableState(options, stream) {
  11828. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 106);
  11829. options = options || {};
  11830. // Duplex streams are both readable and writable, but share
  11831. // the same options object.
  11832. // However, some cases require setting options to different
  11833. // values for the readable and the writable sides of the duplex stream.
  11834. // These options can be provided separately as readableXXX and writableXXX.
  11835. var isDuplex = stream instanceof Duplex;
  11836. // object stream flag. Used to make read(n) ignore n and to
  11837. // make all the buffer merging and length checks go away
  11838. this.objectMode = !!options.objectMode;
  11839. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  11840. // the point at which it stops calling _read() to fill the buffer
  11841. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  11842. var hwm = options.highWaterMark;
  11843. var readableHwm = options.readableHighWaterMark;
  11844. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  11845. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  11846. // cast to ints.
  11847. this.highWaterMark = Math.floor(this.highWaterMark);
  11848. // A linked list is used to store data chunks instead of an array because the
  11849. // linked list can remove elements from the beginning faster than
  11850. // array.shift()
  11851. this.buffer = new BufferList();
  11852. this.length = 0;
  11853. this.pipes = null;
  11854. this.pipesCount = 0;
  11855. this.flowing = null;
  11856. this.ended = false;
  11857. this.endEmitted = false;
  11858. this.reading = false;
  11859. // a flag to be able to tell if the event 'readable'/'data' is emitted
  11860. // immediately, or on a later tick. We set this to true at first, because
  11861. // any actions that shouldn't happen until "later" should generally also
  11862. // not happen before the first read call.
  11863. this.sync = true;
  11864. // whenever we return null, then we set a flag to say
  11865. // that we're awaiting a 'readable' event emission.
  11866. this.needReadable = false;
  11867. this.emittedReadable = false;
  11868. this.readableListening = false;
  11869. this.resumeScheduled = false;
  11870. // has it been destroyed
  11871. this.destroyed = false;
  11872. // Crypto is kind of old and crusty. Historically, its default string
  11873. // encoding is 'binary' so we have to make this configurable.
  11874. // Everything else in the universe uses 'utf8', though.
  11875. this.defaultEncoding = options.defaultEncoding || 'utf8';
  11876. // the number of writers that are awaiting a drain event in .pipe()s
  11877. this.awaitDrain = 0;
  11878. // if true, a maybeReadMore has been scheduled
  11879. this.readingMore = false;
  11880. this.decoder = null;
  11881. this.encoding = null;
  11882. if (options.encoding) {
  11883. if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 109).StringDecoder;
  11884. this.decoder = new StringDecoder(options.encoding);
  11885. this.encoding = options.encoding;
  11886. }
  11887. }
  11888. function Readable(options) {
  11889. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 106);
  11890. if (!(this instanceof Readable)) return new Readable(options);
  11891. this._readableState = new ReadableState(options, this);
  11892. // legacy
  11893. this.readable = true;
  11894. if (options) {
  11895. if (typeof options.read === 'function') this._read = options.read;
  11896. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  11897. }
  11898. Stream.call(this);
  11899. }
  11900. Object.defineProperty(Readable.prototype, 'destroyed', {
  11901. get: function () {
  11902. if (this._readableState === undefined) {
  11903. return false;
  11904. }
  11905. return this._readableState.destroyed;
  11906. },
  11907. set: function (value) {
  11908. // we ignore the value if the stream
  11909. // has not been initialized yet
  11910. if (!this._readableState) {
  11911. return;
  11912. }
  11913. // backward compatibility, the user is explicitly
  11914. // managing destroyed
  11915. this._readableState.destroyed = value;
  11916. }
  11917. });
  11918. Readable.prototype.destroy = destroyImpl.destroy;
  11919. Readable.prototype._undestroy = destroyImpl.undestroy;
  11920. Readable.prototype._destroy = function (err, cb) {
  11921. this.push(null);
  11922. cb(err);
  11923. };
  11924. // Manually shove something into the read() buffer.
  11925. // This returns true if the highWaterMark has not been hit yet,
  11926. // similar to how Writable.write() returns true if you should
  11927. // write() some more.
  11928. Readable.prototype.push = function (chunk, encoding) {
  11929. var state = this._readableState;
  11930. var skipChunkCheck;
  11931. if (!state.objectMode) {
  11932. if (typeof chunk === 'string') {
  11933. encoding = encoding || state.defaultEncoding;
  11934. if (encoding !== state.encoding) {
  11935. chunk = Buffer.from(chunk, encoding);
  11936. encoding = '';
  11937. }
  11938. skipChunkCheck = true;
  11939. }
  11940. } else {
  11941. skipChunkCheck = true;
  11942. }
  11943. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  11944. };
  11945. // Unshift should *always* be something directly out of read()
  11946. Readable.prototype.unshift = function (chunk) {
  11947. return readableAddChunk(this, chunk, null, true, false);
  11948. };
  11949. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  11950. var state = stream._readableState;
  11951. if (chunk === null) {
  11952. state.reading = false;
  11953. onEofChunk(stream, state);
  11954. } else {
  11955. var er;
  11956. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  11957. if (er) {
  11958. stream.emit('error', er);
  11959. } else if (state.objectMode || chunk && chunk.length > 0) {
  11960. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  11961. chunk = _uint8ArrayToBuffer(chunk);
  11962. }
  11963. if (addToFront) {
  11964. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  11965. } else if (state.ended) {
  11966. stream.emit('error', new Error('stream.push() after EOF'));
  11967. } else {
  11968. state.reading = false;
  11969. if (state.decoder && !encoding) {
  11970. chunk = state.decoder.write(chunk);
  11971. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  11972. } else {
  11973. addChunk(stream, state, chunk, false);
  11974. }
  11975. }
  11976. } else if (!addToFront) {
  11977. state.reading = false;
  11978. }
  11979. }
  11980. return needMoreData(state);
  11981. }
  11982. function addChunk(stream, state, chunk, addToFront) {
  11983. if (state.flowing && state.length === 0 && !state.sync) {
  11984. stream.emit('data', chunk);
  11985. stream.read(0);
  11986. } else {
  11987. // update the buffer info.
  11988. state.length += state.objectMode ? 1 : chunk.length;
  11989. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  11990. if (state.needReadable) emitReadable(stream);
  11991. }
  11992. maybeReadMore(stream, state);
  11993. }
  11994. function chunkInvalid(state, chunk) {
  11995. var er;
  11996. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  11997. er = new TypeError('Invalid non-string/buffer chunk');
  11998. }
  11999. return er;
  12000. }
  12001. // if it's past the high water mark, we can push in some more.
  12002. // Also, if we have no data yet, we can stand some
  12003. // more bytes. This is to work around cases where hwm=0,
  12004. // such as the repl. Also, if the push() triggered a
  12005. // readable event, and the user called read(largeNumber) such that
  12006. // needReadable was set, then we ought to push more, so that another
  12007. // 'readable' event will be triggered.
  12008. function needMoreData(state) {
  12009. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  12010. }
  12011. Readable.prototype.isPaused = function () {
  12012. return this._readableState.flowing === false;
  12013. };
  12014. // backwards compatibility.
  12015. Readable.prototype.setEncoding = function (enc) {
  12016. if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 109).StringDecoder;
  12017. this._readableState.decoder = new StringDecoder(enc);
  12018. this._readableState.encoding = enc;
  12019. return this;
  12020. };
  12021. // Don't raise the hwm > 8MB
  12022. var MAX_HWM = 0x800000;
  12023. function computeNewHighWaterMark(n) {
  12024. if (n >= MAX_HWM) {
  12025. n = MAX_HWM;
  12026. } else {
  12027. // Get the next highest power of 2 to prevent increasing hwm excessively in
  12028. // tiny amounts
  12029. n--;
  12030. n |= n >>> 1;
  12031. n |= n >>> 2;
  12032. n |= n >>> 4;
  12033. n |= n >>> 8;
  12034. n |= n >>> 16;
  12035. n++;
  12036. }
  12037. return n;
  12038. }
  12039. // This function is designed to be inlinable, so please take care when making
  12040. // changes to the function body.
  12041. function howMuchToRead(n, state) {
  12042. if (n <= 0 || state.length === 0 && state.ended) return 0;
  12043. if (state.objectMode) return 1;
  12044. if (n !== n) {
  12045. // Only flow one buffer at a time
  12046. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  12047. }
  12048. // If we're asking for more than the current hwm, then raise the hwm.
  12049. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  12050. if (n <= state.length) return n;
  12051. // Don't have enough
  12052. if (!state.ended) {
  12053. state.needReadable = true;
  12054. return 0;
  12055. }
  12056. return state.length;
  12057. }
  12058. // you can override either this method, or the async _read(n) below.
  12059. Readable.prototype.read = function (n) {
  12060. debug('read', n);
  12061. n = parseInt(n, 10);
  12062. var state = this._readableState;
  12063. var nOrig = n;
  12064. if (n !== 0) state.emittedReadable = false;
  12065. // if we're doing read(0) to trigger a readable event, but we
  12066. // already have a bunch of data in the buffer, then just trigger
  12067. // the 'readable' event and move on.
  12068. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  12069. debug('read: emitReadable', state.length, state.ended);
  12070. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  12071. return null;
  12072. }
  12073. n = howMuchToRead(n, state);
  12074. // if we've ended, and we're now clear, then finish it up.
  12075. if (n === 0 && state.ended) {
  12076. if (state.length === 0) endReadable(this);
  12077. return null;
  12078. }
  12079. // All the actual chunk generation logic needs to be
  12080. // *below* the call to _read. The reason is that in certain
  12081. // synthetic stream cases, such as passthrough streams, _read
  12082. // may be a completely synchronous operation which may change
  12083. // the state of the read buffer, providing enough data when
  12084. // before there was *not* enough.
  12085. //
  12086. // So, the steps are:
  12087. // 1. Figure out what the state of things will be after we do
  12088. // a read from the buffer.
  12089. //
  12090. // 2. If that resulting state will trigger a _read, then call _read.
  12091. // Note that this may be asynchronous, or synchronous. Yes, it is
  12092. // deeply ugly to write APIs this way, but that still doesn't mean
  12093. // that the Readable class should behave improperly, as streams are
  12094. // designed to be sync/async agnostic.
  12095. // Take note if the _read call is sync or async (ie, if the read call
  12096. // has returned yet), so that we know whether or not it's safe to emit
  12097. // 'readable' etc.
  12098. //
  12099. // 3. Actually pull the requested chunks out of the buffer and return.
  12100. // if we need a readable event, then we need to do some reading.
  12101. var doRead = state.needReadable;
  12102. debug('need readable', doRead);
  12103. // if we currently have less than the highWaterMark, then also read some
  12104. if (state.length === 0 || state.length - n < state.highWaterMark) {
  12105. doRead = true;
  12106. debug('length less than watermark', doRead);
  12107. }
  12108. // however, if we've ended, then there's no point, and if we're already
  12109. // reading, then it's unnecessary.
  12110. if (state.ended || state.reading) {
  12111. doRead = false;
  12112. debug('reading or ended', doRead);
  12113. } else if (doRead) {
  12114. debug('do read');
  12115. state.reading = true;
  12116. state.sync = true;
  12117. // if the length is currently zero, then we *need* a readable event.
  12118. if (state.length === 0) state.needReadable = true;
  12119. // call internal read method
  12120. this._read(state.highWaterMark);
  12121. state.sync = false;
  12122. // If _read pushed data synchronously, then `reading` will be false,
  12123. // and we need to re-evaluate how much data we can return to the user.
  12124. if (!state.reading) n = howMuchToRead(nOrig, state);
  12125. }
  12126. var ret;
  12127. if (n > 0) ret = fromList(n, state);else ret = null;
  12128. if (ret === null) {
  12129. state.needReadable = true;
  12130. n = 0;
  12131. } else {
  12132. state.length -= n;
  12133. }
  12134. if (state.length === 0) {
  12135. // If we have nothing in the buffer, then we want to know
  12136. // as soon as we *do* get something into the buffer.
  12137. if (!state.ended) state.needReadable = true;
  12138. // If we tried to read() past the EOF, then emit end on the next tick.
  12139. if (nOrig !== n && state.ended) endReadable(this);
  12140. }
  12141. if (ret !== null) this.emit('data', ret);
  12142. return ret;
  12143. };
  12144. function onEofChunk(stream, state) {
  12145. if (state.ended) return;
  12146. if (state.decoder) {
  12147. var chunk = state.decoder.end();
  12148. if (chunk && chunk.length) {
  12149. state.buffer.push(chunk);
  12150. state.length += state.objectMode ? 1 : chunk.length;
  12151. }
  12152. }
  12153. state.ended = true;
  12154. // emit 'readable' now to make sure it gets picked up.
  12155. emitReadable(stream);
  12156. }
  12157. // Don't emit readable right away in sync mode, because this can trigger
  12158. // another read() call => stack overflow. This way, it might trigger
  12159. // a nextTick recursion warning, but that's not so bad.
  12160. function emitReadable(stream) {
  12161. var state = stream._readableState;
  12162. state.needReadable = false;
  12163. if (!state.emittedReadable) {
  12164. debug('emitReadable', state.flowing);
  12165. state.emittedReadable = true;
  12166. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  12167. }
  12168. }
  12169. function emitReadable_(stream) {
  12170. debug('emit readable');
  12171. stream.emit('readable');
  12172. flow(stream);
  12173. }
  12174. // at this point, the user has presumably seen the 'readable' event,
  12175. // and called read() to consume some data. that may have triggered
  12176. // in turn another _read(n) call, in which case reading = true if
  12177. // it's in progress.
  12178. // However, if we're not ended, or reading, and the length < hwm,
  12179. // then go ahead and try to read some more preemptively.
  12180. function maybeReadMore(stream, state) {
  12181. if (!state.readingMore) {
  12182. state.readingMore = true;
  12183. pna.nextTick(maybeReadMore_, stream, state);
  12184. }
  12185. }
  12186. function maybeReadMore_(stream, state) {
  12187. var len = state.length;
  12188. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  12189. debug('maybeReadMore read 0');
  12190. stream.read(0);
  12191. if (len === state.length)
  12192. // didn't get any data, stop spinning.
  12193. break;else len = state.length;
  12194. }
  12195. state.readingMore = false;
  12196. }
  12197. // abstract method. to be overridden in specific implementation classes.
  12198. // call cb(er, data) where data is <= n in length.
  12199. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  12200. // arbitrary, and perhaps not very meaningful.
  12201. Readable.prototype._read = function (n) {
  12202. this.emit('error', new Error('_read() is not implemented'));
  12203. };
  12204. Readable.prototype.pipe = function (dest, pipeOpts) {
  12205. var src = this;
  12206. var state = this._readableState;
  12207. switch (state.pipesCount) {
  12208. case 0:
  12209. state.pipes = dest;
  12210. break;
  12211. case 1:
  12212. state.pipes = [state.pipes, dest];
  12213. break;
  12214. default:
  12215. state.pipes.push(dest);
  12216. break;
  12217. }
  12218. state.pipesCount += 1;
  12219. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  12220. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  12221. var endFn = doEnd ? onend : unpipe;
  12222. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  12223. dest.on('unpipe', onunpipe);
  12224. function onunpipe(readable, unpipeInfo) {
  12225. debug('onunpipe');
  12226. if (readable === src) {
  12227. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  12228. unpipeInfo.hasUnpiped = true;
  12229. cleanup();
  12230. }
  12231. }
  12232. }
  12233. function onend() {
  12234. debug('onend');
  12235. dest.end();
  12236. }
  12237. // when the dest drains, it reduces the awaitDrain counter
  12238. // on the source. This would be more elegant with a .once()
  12239. // handler in flow(), but adding and removing repeatedly is
  12240. // too slow.
  12241. var ondrain = pipeOnDrain(src);
  12242. dest.on('drain', ondrain);
  12243. var cleanedUp = false;
  12244. function cleanup() {
  12245. debug('cleanup');
  12246. // cleanup event handlers once the pipe is broken
  12247. dest.removeListener('close', onclose);
  12248. dest.removeListener('finish', onfinish);
  12249. dest.removeListener('drain', ondrain);
  12250. dest.removeListener('error', onerror);
  12251. dest.removeListener('unpipe', onunpipe);
  12252. src.removeListener('end', onend);
  12253. src.removeListener('end', unpipe);
  12254. src.removeListener('data', ondata);
  12255. cleanedUp = true;
  12256. // if the reader is waiting for a drain event from this
  12257. // specific writer, then it would cause it to never start
  12258. // flowing again.
  12259. // So, if this is awaiting a drain, then we just call it now.
  12260. // If we don't know, then assume that we are waiting for one.
  12261. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  12262. }
  12263. // If the user pushes more data while we're writing to dest then we'll end up
  12264. // in ondata again. However, we only want to increase awaitDrain once because
  12265. // dest will only emit one 'drain' event for the multiple writes.
  12266. // => Introduce a guard on increasing awaitDrain.
  12267. var increasedAwaitDrain = false;
  12268. src.on('data', ondata);
  12269. function ondata(chunk) {
  12270. debug('ondata');
  12271. increasedAwaitDrain = false;
  12272. var ret = dest.write(chunk);
  12273. if (false === ret && !increasedAwaitDrain) {
  12274. // If the user unpiped during `dest.write()`, it is possible
  12275. // to get stuck in a permanently paused state if that write
  12276. // also returned false.
  12277. // => Check whether `dest` is still a piping destination.
  12278. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  12279. debug('false write response, pause', src._readableState.awaitDrain);
  12280. src._readableState.awaitDrain++;
  12281. increasedAwaitDrain = true;
  12282. }
  12283. src.pause();
  12284. }
  12285. }
  12286. // if the dest has an error, then stop piping into it.
  12287. // however, don't suppress the throwing behavior for this.
  12288. function onerror(er) {
  12289. debug('onerror', er);
  12290. unpipe();
  12291. dest.removeListener('error', onerror);
  12292. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  12293. }
  12294. // Make sure our error handler is attached before userland ones.
  12295. prependListener(dest, 'error', onerror);
  12296. // Both close and finish should trigger unpipe, but only once.
  12297. function onclose() {
  12298. dest.removeListener('finish', onfinish);
  12299. unpipe();
  12300. }
  12301. dest.once('close', onclose);
  12302. function onfinish() {
  12303. debug('onfinish');
  12304. dest.removeListener('close', onclose);
  12305. unpipe();
  12306. }
  12307. dest.once('finish', onfinish);
  12308. function unpipe() {
  12309. debug('unpipe');
  12310. src.unpipe(dest);
  12311. }
  12312. // tell the dest that it's being piped to
  12313. dest.emit('pipe', src);
  12314. // start the flow if it hasn't been started already.
  12315. if (!state.flowing) {
  12316. debug('pipe resume');
  12317. src.resume();
  12318. }
  12319. return dest;
  12320. };
  12321. function pipeOnDrain(src) {
  12322. return function () {
  12323. var state = src._readableState;
  12324. debug('pipeOnDrain', state.awaitDrain);
  12325. if (state.awaitDrain) state.awaitDrain--;
  12326. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  12327. state.flowing = true;
  12328. flow(src);
  12329. }
  12330. };
  12331. }
  12332. Readable.prototype.unpipe = function (dest) {
  12333. var state = this._readableState;
  12334. var unpipeInfo = { hasUnpiped: false };
  12335. // if we're not piping anywhere, then do nothing.
  12336. if (state.pipesCount === 0) return this;
  12337. // just one destination. most common case.
  12338. if (state.pipesCount === 1) {
  12339. // passed in one, but it's not the right one.
  12340. if (dest && dest !== state.pipes) return this;
  12341. if (!dest) dest = state.pipes;
  12342. // got a match.
  12343. state.pipes = null;
  12344. state.pipesCount = 0;
  12345. state.flowing = false;
  12346. if (dest) dest.emit('unpipe', this, unpipeInfo);
  12347. return this;
  12348. }
  12349. // slow case. multiple pipe destinations.
  12350. if (!dest) {
  12351. // remove all.
  12352. var dests = state.pipes;
  12353. var len = state.pipesCount;
  12354. state.pipes = null;
  12355. state.pipesCount = 0;
  12356. state.flowing = false;
  12357. for (var i = 0; i < len; i++) {
  12358. dests[i].emit('unpipe', this, unpipeInfo);
  12359. }return this;
  12360. }
  12361. // try to find the right one.
  12362. var index = indexOf(state.pipes, dest);
  12363. if (index === -1) return this;
  12364. state.pipes.splice(index, 1);
  12365. state.pipesCount -= 1;
  12366. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  12367. dest.emit('unpipe', this, unpipeInfo);
  12368. return this;
  12369. };
  12370. // set up data events if they are asked for
  12371. // Ensure readable listeners eventually get something
  12372. Readable.prototype.on = function (ev, fn) {
  12373. var res = Stream.prototype.on.call(this, ev, fn);
  12374. if (ev === 'data') {
  12375. // Start flowing on next tick if stream isn't explicitly paused
  12376. if (this._readableState.flowing !== false) this.resume();
  12377. } else if (ev === 'readable') {
  12378. var state = this._readableState;
  12379. if (!state.endEmitted && !state.readableListening) {
  12380. state.readableListening = state.needReadable = true;
  12381. state.emittedReadable = false;
  12382. if (!state.reading) {
  12383. pna.nextTick(nReadingNextTick, this);
  12384. } else if (state.length) {
  12385. emitReadable(this);
  12386. }
  12387. }
  12388. }
  12389. return res;
  12390. };
  12391. Readable.prototype.addListener = Readable.prototype.on;
  12392. function nReadingNextTick(self) {
  12393. debug('readable nexttick read 0');
  12394. self.read(0);
  12395. }
  12396. // pause() and resume() are remnants of the legacy readable stream API
  12397. // If the user uses them, then switch into old mode.
  12398. Readable.prototype.resume = function () {
  12399. var state = this._readableState;
  12400. if (!state.flowing) {
  12401. debug('resume');
  12402. state.flowing = true;
  12403. resume(this, state);
  12404. }
  12405. return this;
  12406. };
  12407. function resume(stream, state) {
  12408. if (!state.resumeScheduled) {
  12409. state.resumeScheduled = true;
  12410. pna.nextTick(resume_, stream, state);
  12411. }
  12412. }
  12413. function resume_(stream, state) {
  12414. if (!state.reading) {
  12415. debug('resume read 0');
  12416. stream.read(0);
  12417. }
  12418. state.resumeScheduled = false;
  12419. state.awaitDrain = 0;
  12420. stream.emit('resume');
  12421. flow(stream);
  12422. if (state.flowing && !state.reading) stream.read(0);
  12423. }
  12424. Readable.prototype.pause = function () {
  12425. debug('call pause flowing=%j', this._readableState.flowing);
  12426. if (false !== this._readableState.flowing) {
  12427. debug('pause');
  12428. this._readableState.flowing = false;
  12429. this.emit('pause');
  12430. }
  12431. return this;
  12432. };
  12433. function flow(stream) {
  12434. var state = stream._readableState;
  12435. debug('flow', state.flowing);
  12436. while (state.flowing && stream.read() !== null) {}
  12437. }
  12438. // wrap an old-style stream as the async data source.
  12439. // This is *not* part of the readable stream interface.
  12440. // It is an ugly unfortunate mess of history.
  12441. Readable.prototype.wrap = function (stream) {
  12442. var _this = this;
  12443. var state = this._readableState;
  12444. var paused = false;
  12445. stream.on('end', function () {
  12446. debug('wrapped end');
  12447. if (state.decoder && !state.ended) {
  12448. var chunk = state.decoder.end();
  12449. if (chunk && chunk.length) _this.push(chunk);
  12450. }
  12451. _this.push(null);
  12452. });
  12453. stream.on('data', function (chunk) {
  12454. debug('wrapped data');
  12455. if (state.decoder) chunk = state.decoder.write(chunk);
  12456. // don't skip over falsy values in objectMode
  12457. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  12458. var ret = _this.push(chunk);
  12459. if (!ret) {
  12460. paused = true;
  12461. stream.pause();
  12462. }
  12463. });
  12464. // proxy all the other methods.
  12465. // important when wrapping filters and duplexes.
  12466. for (var i in stream) {
  12467. if (this[i] === undefined && typeof stream[i] === 'function') {
  12468. this[i] = function (method) {
  12469. return function () {
  12470. return stream[method].apply(stream, arguments);
  12471. };
  12472. }(i);
  12473. }
  12474. }
  12475. // proxy certain important events.
  12476. for (var n = 0; n < kProxyEvents.length; n++) {
  12477. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  12478. }
  12479. // when we try to consume some more bytes, simply unpause the
  12480. // underlying stream.
  12481. this._read = function (n) {
  12482. debug('wrapped _read', n);
  12483. if (paused) {
  12484. paused = false;
  12485. stream.resume();
  12486. }
  12487. };
  12488. return this;
  12489. };
  12490. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  12491. // making it explicit this property is not enumerable
  12492. // because otherwise some prototype manipulation in
  12493. // userland will fail
  12494. enumerable: false,
  12495. get: function () {
  12496. return this._readableState.highWaterMark;
  12497. }
  12498. });
  12499. // exposed for testing purposes only.
  12500. Readable._fromList = fromList;
  12501. // Pluck off n bytes from an array of buffers.
  12502. // Length is the combined lengths of all the buffers in the list.
  12503. // This function is designed to be inlinable, so please take care when making
  12504. // changes to the function body.
  12505. function fromList(n, state) {
  12506. // nothing buffered
  12507. if (state.length === 0) return null;
  12508. var ret;
  12509. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  12510. // read it all, truncate the list
  12511. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
  12512. state.buffer.clear();
  12513. } else {
  12514. // read part of list
  12515. ret = fromListPartial(n, state.buffer, state.decoder);
  12516. }
  12517. return ret;
  12518. }
  12519. // Extracts only enough buffered data to satisfy the amount requested.
  12520. // This function is designed to be inlinable, so please take care when making
  12521. // changes to the function body.
  12522. function fromListPartial(n, list, hasStrings) {
  12523. var ret;
  12524. if (n < list.head.data.length) {
  12525. // slice is the same for buffers and strings
  12526. ret = list.head.data.slice(0, n);
  12527. list.head.data = list.head.data.slice(n);
  12528. } else if (n === list.head.data.length) {
  12529. // first chunk is a perfect match
  12530. ret = list.shift();
  12531. } else {
  12532. // result spans more than one buffer
  12533. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  12534. }
  12535. return ret;
  12536. }
  12537. // Copies a specified amount of characters from the list of buffered data
  12538. // chunks.
  12539. // This function is designed to be inlinable, so please take care when making
  12540. // changes to the function body.
  12541. function copyFromBufferString(n, list) {
  12542. var p = list.head;
  12543. var c = 1;
  12544. var ret = p.data;
  12545. n -= ret.length;
  12546. while (p = p.next) {
  12547. var str = p.data;
  12548. var nb = n > str.length ? str.length : n;
  12549. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  12550. n -= nb;
  12551. if (n === 0) {
  12552. if (nb === str.length) {
  12553. ++c;
  12554. if (p.next) list.head = p.next;else list.head = list.tail = null;
  12555. } else {
  12556. list.head = p;
  12557. p.data = str.slice(nb);
  12558. }
  12559. break;
  12560. }
  12561. ++c;
  12562. }
  12563. list.length -= c;
  12564. return ret;
  12565. }
  12566. // Copies a specified amount of bytes from the list of buffered data chunks.
  12567. // This function is designed to be inlinable, so please take care when making
  12568. // changes to the function body.
  12569. function copyFromBuffer(n, list) {
  12570. var ret = Buffer.allocUnsafe(n);
  12571. var p = list.head;
  12572. var c = 1;
  12573. p.data.copy(ret);
  12574. n -= p.data.length;
  12575. while (p = p.next) {
  12576. var buf = p.data;
  12577. var nb = n > buf.length ? buf.length : n;
  12578. buf.copy(ret, ret.length - n, 0, nb);
  12579. n -= nb;
  12580. if (n === 0) {
  12581. if (nb === buf.length) {
  12582. ++c;
  12583. if (p.next) list.head = p.next;else list.head = list.tail = null;
  12584. } else {
  12585. list.head = p;
  12586. p.data = buf.slice(nb);
  12587. }
  12588. break;
  12589. }
  12590. ++c;
  12591. }
  12592. list.length -= c;
  12593. return ret;
  12594. }
  12595. function endReadable(stream) {
  12596. var state = stream._readableState;
  12597. // If we get here before consuming all the bytes, then that is a
  12598. // bug in node. Should never happen.
  12599. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  12600. if (!state.endEmitted) {
  12601. state.ended = true;
  12602. pna.nextTick(endReadableNT, state, stream);
  12603. }
  12604. }
  12605. function endReadableNT(state, stream) {
  12606. // Check that we didn't get one last unshift.
  12607. if (!state.endEmitted && state.length === 0) {
  12608. state.endEmitted = true;
  12609. stream.readable = false;
  12610. stream.emit('end');
  12611. }
  12612. }
  12613. function indexOf(xs, x) {
  12614. for (var i = 0, l = xs.length; i < l; i++) {
  12615. if (xs[i] === x) return i;
  12616. }
  12617. return -1;
  12618. }
  12619. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 85)))
  12620. /***/ }),
  12621. /* 98 */
  12622. /*!****************************************************!*\
  12623. !*** ./node_modules/process-nextick-args/index.js ***!
  12624. \****************************************************/
  12625. /*! no static exports found */
  12626. /***/ (function(module, exports, __webpack_require__) {
  12627. "use strict";
  12628. /* WEBPACK VAR INJECTION */(function(process) {
  12629. if (typeof process === 'undefined' ||
  12630. !process.version ||
  12631. process.version.indexOf('v0.') === 0 ||
  12632. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  12633. module.exports = { nextTick: nextTick };
  12634. } else {
  12635. module.exports = process
  12636. }
  12637. function nextTick(fn, arg1, arg2, arg3) {
  12638. if (typeof fn !== 'function') {
  12639. throw new TypeError('"callback" argument must be a function');
  12640. }
  12641. var len = arguments.length;
  12642. var args, i;
  12643. switch (len) {
  12644. case 0:
  12645. case 1:
  12646. return process.nextTick(fn);
  12647. case 2:
  12648. return process.nextTick(function afterTickOne() {
  12649. fn.call(null, arg1);
  12650. });
  12651. case 3:
  12652. return process.nextTick(function afterTickTwo() {
  12653. fn.call(null, arg1, arg2);
  12654. });
  12655. case 4:
  12656. return process.nextTick(function afterTickThree() {
  12657. fn.call(null, arg1, arg2, arg3);
  12658. });
  12659. default:
  12660. args = new Array(len - 1);
  12661. i = 0;
  12662. while (i < args.length) {
  12663. args[i++] = arguments[i];
  12664. }
  12665. return process.nextTick(function afterTick() {
  12666. fn.apply(null, args);
  12667. });
  12668. }
  12669. }
  12670. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 85)))
  12671. /***/ }),
  12672. /* 99 */
  12673. /*!***************************************!*\
  12674. !*** ./node_modules/events/events.js ***!
  12675. \***************************************/
  12676. /*! no static exports found */
  12677. /***/ (function(module, exports, __webpack_require__) {
  12678. "use strict";
  12679. // Copyright Joyent, Inc. and other Node contributors.
  12680. //
  12681. // Permission is hereby granted, free of charge, to any person obtaining a
  12682. // copy of this software and associated documentation files (the
  12683. // "Software"), to deal in the Software without restriction, including
  12684. // without limitation the rights to use, copy, modify, merge, publish,
  12685. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12686. // persons to whom the Software is furnished to do so, subject to the
  12687. // following conditions:
  12688. //
  12689. // The above copyright notice and this permission notice shall be included
  12690. // in all copies or substantial portions of the Software.
  12691. //
  12692. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12693. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12694. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12695. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12696. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12697. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12698. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12699. var R = typeof Reflect === 'object' ? Reflect : null
  12700. var ReflectApply = R && typeof R.apply === 'function'
  12701. ? R.apply
  12702. : function ReflectApply(target, receiver, args) {
  12703. return Function.prototype.apply.call(target, receiver, args);
  12704. }
  12705. var ReflectOwnKeys
  12706. if (R && typeof R.ownKeys === 'function') {
  12707. ReflectOwnKeys = R.ownKeys
  12708. } else if (Object.getOwnPropertySymbols) {
  12709. ReflectOwnKeys = function ReflectOwnKeys(target) {
  12710. return Object.getOwnPropertyNames(target)
  12711. .concat(Object.getOwnPropertySymbols(target));
  12712. };
  12713. } else {
  12714. ReflectOwnKeys = function ReflectOwnKeys(target) {
  12715. return Object.getOwnPropertyNames(target);
  12716. };
  12717. }
  12718. function ProcessEmitWarning(warning) {
  12719. if (console && console.warn) console.warn(warning);
  12720. }
  12721. var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
  12722. return value !== value;
  12723. }
  12724. function EventEmitter() {
  12725. EventEmitter.init.call(this);
  12726. }
  12727. module.exports = EventEmitter;
  12728. // Backwards-compat with node 0.10.x
  12729. EventEmitter.EventEmitter = EventEmitter;
  12730. EventEmitter.prototype._events = undefined;
  12731. EventEmitter.prototype._eventsCount = 0;
  12732. EventEmitter.prototype._maxListeners = undefined;
  12733. // By default EventEmitters will print a warning if more than 10 listeners are
  12734. // added to it. This is a useful default which helps finding memory leaks.
  12735. var defaultMaxListeners = 10;
  12736. function checkListener(listener) {
  12737. if (typeof listener !== 'function') {
  12738. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  12739. }
  12740. }
  12741. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  12742. enumerable: true,
  12743. get: function() {
  12744. return defaultMaxListeners;
  12745. },
  12746. set: function(arg) {
  12747. if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
  12748. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
  12749. }
  12750. defaultMaxListeners = arg;
  12751. }
  12752. });
  12753. EventEmitter.init = function() {
  12754. if (this._events === undefined ||
  12755. this._events === Object.getPrototypeOf(this)._events) {
  12756. this._events = Object.create(null);
  12757. this._eventsCount = 0;
  12758. }
  12759. this._maxListeners = this._maxListeners || undefined;
  12760. };
  12761. // Obviously not all Emitters should be limited to 10. This function allows
  12762. // that to be increased. Set to zero for unlimited.
  12763. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  12764. if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
  12765. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
  12766. }
  12767. this._maxListeners = n;
  12768. return this;
  12769. };
  12770. function _getMaxListeners(that) {
  12771. if (that._maxListeners === undefined)
  12772. return EventEmitter.defaultMaxListeners;
  12773. return that._maxListeners;
  12774. }
  12775. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  12776. return _getMaxListeners(this);
  12777. };
  12778. EventEmitter.prototype.emit = function emit(type) {
  12779. var args = [];
  12780. for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
  12781. var doError = (type === 'error');
  12782. var events = this._events;
  12783. if (events !== undefined)
  12784. doError = (doError && events.error === undefined);
  12785. else if (!doError)
  12786. return false;
  12787. // If there is no 'error' event listener then throw.
  12788. if (doError) {
  12789. var er;
  12790. if (args.length > 0)
  12791. er = args[0];
  12792. if (er instanceof Error) {
  12793. // Note: The comments on the `throw` lines are intentional, they show
  12794. // up in Node's output if this results in an unhandled exception.
  12795. throw er; // Unhandled 'error' event
  12796. }
  12797. // At least give some kind of context to the user
  12798. var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
  12799. err.context = er;
  12800. throw err; // Unhandled 'error' event
  12801. }
  12802. var handler = events[type];
  12803. if (handler === undefined)
  12804. return false;
  12805. if (typeof handler === 'function') {
  12806. ReflectApply(handler, this, args);
  12807. } else {
  12808. var len = handler.length;
  12809. var listeners = arrayClone(handler, len);
  12810. for (var i = 0; i < len; ++i)
  12811. ReflectApply(listeners[i], this, args);
  12812. }
  12813. return true;
  12814. };
  12815. function _addListener(target, type, listener, prepend) {
  12816. var m;
  12817. var events;
  12818. var existing;
  12819. checkListener(listener);
  12820. events = target._events;
  12821. if (events === undefined) {
  12822. events = target._events = Object.create(null);
  12823. target._eventsCount = 0;
  12824. } else {
  12825. // To avoid recursion in the case that type === "newListener"! Before
  12826. // adding it to the listeners, first emit "newListener".
  12827. if (events.newListener !== undefined) {
  12828. target.emit('newListener', type,
  12829. listener.listener ? listener.listener : listener);
  12830. // Re-assign `events` because a newListener handler could have caused the
  12831. // this._events to be assigned to a new object
  12832. events = target._events;
  12833. }
  12834. existing = events[type];
  12835. }
  12836. if (existing === undefined) {
  12837. // Optimize the case of one listener. Don't need the extra array object.
  12838. existing = events[type] = listener;
  12839. ++target._eventsCount;
  12840. } else {
  12841. if (typeof existing === 'function') {
  12842. // Adding the second element, need to change to array.
  12843. existing = events[type] =
  12844. prepend ? [listener, existing] : [existing, listener];
  12845. // If we've already got an array, just append.
  12846. } else if (prepend) {
  12847. existing.unshift(listener);
  12848. } else {
  12849. existing.push(listener);
  12850. }
  12851. // Check for listener leak
  12852. m = _getMaxListeners(target);
  12853. if (m > 0 && existing.length > m && !existing.warned) {
  12854. existing.warned = true;
  12855. // No error code for this since it is a Warning
  12856. // eslint-disable-next-line no-restricted-syntax
  12857. var w = new Error('Possible EventEmitter memory leak detected. ' +
  12858. existing.length + ' ' + String(type) + ' listeners ' +
  12859. 'added. Use emitter.setMaxListeners() to ' +
  12860. 'increase limit');
  12861. w.name = 'MaxListenersExceededWarning';
  12862. w.emitter = target;
  12863. w.type = type;
  12864. w.count = existing.length;
  12865. ProcessEmitWarning(w);
  12866. }
  12867. }
  12868. return target;
  12869. }
  12870. EventEmitter.prototype.addListener = function addListener(type, listener) {
  12871. return _addListener(this, type, listener, false);
  12872. };
  12873. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  12874. EventEmitter.prototype.prependListener =
  12875. function prependListener(type, listener) {
  12876. return _addListener(this, type, listener, true);
  12877. };
  12878. function onceWrapper() {
  12879. if (!this.fired) {
  12880. this.target.removeListener(this.type, this.wrapFn);
  12881. this.fired = true;
  12882. if (arguments.length === 0)
  12883. return this.listener.call(this.target);
  12884. return this.listener.apply(this.target, arguments);
  12885. }
  12886. }
  12887. function _onceWrap(target, type, listener) {
  12888. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  12889. var wrapped = onceWrapper.bind(state);
  12890. wrapped.listener = listener;
  12891. state.wrapFn = wrapped;
  12892. return wrapped;
  12893. }
  12894. EventEmitter.prototype.once = function once(type, listener) {
  12895. checkListener(listener);
  12896. this.on(type, _onceWrap(this, type, listener));
  12897. return this;
  12898. };
  12899. EventEmitter.prototype.prependOnceListener =
  12900. function prependOnceListener(type, listener) {
  12901. checkListener(listener);
  12902. this.prependListener(type, _onceWrap(this, type, listener));
  12903. return this;
  12904. };
  12905. // Emits a 'removeListener' event if and only if the listener was removed.
  12906. EventEmitter.prototype.removeListener =
  12907. function removeListener(type, listener) {
  12908. var list, events, position, i, originalListener;
  12909. checkListener(listener);
  12910. events = this._events;
  12911. if (events === undefined)
  12912. return this;
  12913. list = events[type];
  12914. if (list === undefined)
  12915. return this;
  12916. if (list === listener || list.listener === listener) {
  12917. if (--this._eventsCount === 0)
  12918. this._events = Object.create(null);
  12919. else {
  12920. delete events[type];
  12921. if (events.removeListener)
  12922. this.emit('removeListener', type, list.listener || listener);
  12923. }
  12924. } else if (typeof list !== 'function') {
  12925. position = -1;
  12926. for (i = list.length - 1; i >= 0; i--) {
  12927. if (list[i] === listener || list[i].listener === listener) {
  12928. originalListener = list[i].listener;
  12929. position = i;
  12930. break;
  12931. }
  12932. }
  12933. if (position < 0)
  12934. return this;
  12935. if (position === 0)
  12936. list.shift();
  12937. else {
  12938. spliceOne(list, position);
  12939. }
  12940. if (list.length === 1)
  12941. events[type] = list[0];
  12942. if (events.removeListener !== undefined)
  12943. this.emit('removeListener', type, originalListener || listener);
  12944. }
  12945. return this;
  12946. };
  12947. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  12948. EventEmitter.prototype.removeAllListeners =
  12949. function removeAllListeners(type) {
  12950. var listeners, events, i;
  12951. events = this._events;
  12952. if (events === undefined)
  12953. return this;
  12954. // not listening for removeListener, no need to emit
  12955. if (events.removeListener === undefined) {
  12956. if (arguments.length === 0) {
  12957. this._events = Object.create(null);
  12958. this._eventsCount = 0;
  12959. } else if (events[type] !== undefined) {
  12960. if (--this._eventsCount === 0)
  12961. this._events = Object.create(null);
  12962. else
  12963. delete events[type];
  12964. }
  12965. return this;
  12966. }
  12967. // emit removeListener for all listeners on all events
  12968. if (arguments.length === 0) {
  12969. var keys = Object.keys(events);
  12970. var key;
  12971. for (i = 0; i < keys.length; ++i) {
  12972. key = keys[i];
  12973. if (key === 'removeListener') continue;
  12974. this.removeAllListeners(key);
  12975. }
  12976. this.removeAllListeners('removeListener');
  12977. this._events = Object.create(null);
  12978. this._eventsCount = 0;
  12979. return this;
  12980. }
  12981. listeners = events[type];
  12982. if (typeof listeners === 'function') {
  12983. this.removeListener(type, listeners);
  12984. } else if (listeners !== undefined) {
  12985. // LIFO order
  12986. for (i = listeners.length - 1; i >= 0; i--) {
  12987. this.removeListener(type, listeners[i]);
  12988. }
  12989. }
  12990. return this;
  12991. };
  12992. function _listeners(target, type, unwrap) {
  12993. var events = target._events;
  12994. if (events === undefined)
  12995. return [];
  12996. var evlistener = events[type];
  12997. if (evlistener === undefined)
  12998. return [];
  12999. if (typeof evlistener === 'function')
  13000. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  13001. return unwrap ?
  13002. unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  13003. }
  13004. EventEmitter.prototype.listeners = function listeners(type) {
  13005. return _listeners(this, type, true);
  13006. };
  13007. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  13008. return _listeners(this, type, false);
  13009. };
  13010. EventEmitter.listenerCount = function(emitter, type) {
  13011. if (typeof emitter.listenerCount === 'function') {
  13012. return emitter.listenerCount(type);
  13013. } else {
  13014. return listenerCount.call(emitter, type);
  13015. }
  13016. };
  13017. EventEmitter.prototype.listenerCount = listenerCount;
  13018. function listenerCount(type) {
  13019. var events = this._events;
  13020. if (events !== undefined) {
  13021. var evlistener = events[type];
  13022. if (typeof evlistener === 'function') {
  13023. return 1;
  13024. } else if (evlistener !== undefined) {
  13025. return evlistener.length;
  13026. }
  13027. }
  13028. return 0;
  13029. }
  13030. EventEmitter.prototype.eventNames = function eventNames() {
  13031. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  13032. };
  13033. function arrayClone(arr, n) {
  13034. var copy = new Array(n);
  13035. for (var i = 0; i < n; ++i)
  13036. copy[i] = arr[i];
  13037. return copy;
  13038. }
  13039. function spliceOne(list, index) {
  13040. for (; index + 1 < list.length; index++)
  13041. list[index] = list[index + 1];
  13042. list.pop();
  13043. }
  13044. function unwrapListeners(arr) {
  13045. var ret = new Array(arr.length);
  13046. for (var i = 0; i < ret.length; ++i) {
  13047. ret[i] = arr[i].listener || arr[i];
  13048. }
  13049. return ret;
  13050. }
  13051. /***/ }),
  13052. /* 100 */
  13053. /*!*****************************************************************************!*\
  13054. !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
  13055. \*****************************************************************************/
  13056. /*! no static exports found */
  13057. /***/ (function(module, exports, __webpack_require__) {
  13058. module.exports = __webpack_require__(/*! events */ 99).EventEmitter;
  13059. /***/ }),
  13060. /* 101 */
  13061. /*!***********************************************!*\
  13062. !*** ./node_modules/core-util-is/lib/util.js ***!
  13063. \***********************************************/
  13064. /*! no static exports found */
  13065. /***/ (function(module, exports, __webpack_require__) {
  13066. /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
  13067. //
  13068. // Permission is hereby granted, free of charge, to any person obtaining a
  13069. // copy of this software and associated documentation files (the
  13070. // "Software"), to deal in the Software without restriction, including
  13071. // without limitation the rights to use, copy, modify, merge, publish,
  13072. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13073. // persons to whom the Software is furnished to do so, subject to the
  13074. // following conditions:
  13075. //
  13076. // The above copyright notice and this permission notice shall be included
  13077. // in all copies or substantial portions of the Software.
  13078. //
  13079. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13080. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13081. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13082. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13083. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13084. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13085. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13086. // NOTE: These type checking functions intentionally don't use `instanceof`
  13087. // because it is fragile and can be easily faked with `Object.create()`.
  13088. function isArray(arg) {
  13089. if (Array.isArray) {
  13090. return Array.isArray(arg);
  13091. }
  13092. return objectToString(arg) === '[object Array]';
  13093. }
  13094. exports.isArray = isArray;
  13095. function isBoolean(arg) {
  13096. return typeof arg === 'boolean';
  13097. }
  13098. exports.isBoolean = isBoolean;
  13099. function isNull(arg) {
  13100. return arg === null;
  13101. }
  13102. exports.isNull = isNull;
  13103. function isNullOrUndefined(arg) {
  13104. return arg == null;
  13105. }
  13106. exports.isNullOrUndefined = isNullOrUndefined;
  13107. function isNumber(arg) {
  13108. return typeof arg === 'number';
  13109. }
  13110. exports.isNumber = isNumber;
  13111. function isString(arg) {
  13112. return typeof arg === 'string';
  13113. }
  13114. exports.isString = isString;
  13115. function isSymbol(arg) {
  13116. return typeof arg === 'symbol';
  13117. }
  13118. exports.isSymbol = isSymbol;
  13119. function isUndefined(arg) {
  13120. return arg === void 0;
  13121. }
  13122. exports.isUndefined = isUndefined;
  13123. function isRegExp(re) {
  13124. return objectToString(re) === '[object RegExp]';
  13125. }
  13126. exports.isRegExp = isRegExp;
  13127. function isObject(arg) {
  13128. return typeof arg === 'object' && arg !== null;
  13129. }
  13130. exports.isObject = isObject;
  13131. function isDate(d) {
  13132. return objectToString(d) === '[object Date]';
  13133. }
  13134. exports.isDate = isDate;
  13135. function isError(e) {
  13136. return (objectToString(e) === '[object Error]' || e instanceof Error);
  13137. }
  13138. exports.isError = isError;
  13139. function isFunction(arg) {
  13140. return typeof arg === 'function';
  13141. }
  13142. exports.isFunction = isFunction;
  13143. function isPrimitive(arg) {
  13144. return arg === null ||
  13145. typeof arg === 'boolean' ||
  13146. typeof arg === 'number' ||
  13147. typeof arg === 'string' ||
  13148. typeof arg === 'symbol' || // ES6 symbol
  13149. typeof arg === 'undefined';
  13150. }
  13151. exports.isPrimitive = isPrimitive;
  13152. exports.isBuffer = Buffer.isBuffer;
  13153. function objectToString(o) {
  13154. return Object.prototype.toString.call(o);
  13155. }
  13156. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 88).Buffer))
  13157. /***/ }),
  13158. /* 102 */
  13159. /*!**********************!*\
  13160. !*** util (ignored) ***!
  13161. \**********************/
  13162. /*! no static exports found */
  13163. /***/ (function(module, exports) {
  13164. /* (ignored) */
  13165. /***/ }),
  13166. /* 103 */
  13167. /*!*************************************************************************!*\
  13168. !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***!
  13169. \*************************************************************************/
  13170. /*! no static exports found */
  13171. /***/ (function(module, exports, __webpack_require__) {
  13172. "use strict";
  13173. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13174. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer;
  13175. var util = __webpack_require__(/*! util */ 104);
  13176. function copyBuffer(src, target, offset) {
  13177. src.copy(target, offset);
  13178. }
  13179. module.exports = function () {
  13180. function BufferList() {
  13181. _classCallCheck(this, BufferList);
  13182. this.head = null;
  13183. this.tail = null;
  13184. this.length = 0;
  13185. }
  13186. BufferList.prototype.push = function push(v) {
  13187. var entry = { data: v, next: null };
  13188. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  13189. this.tail = entry;
  13190. ++this.length;
  13191. };
  13192. BufferList.prototype.unshift = function unshift(v) {
  13193. var entry = { data: v, next: this.head };
  13194. if (this.length === 0) this.tail = entry;
  13195. this.head = entry;
  13196. ++this.length;
  13197. };
  13198. BufferList.prototype.shift = function shift() {
  13199. if (this.length === 0) return;
  13200. var ret = this.head.data;
  13201. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  13202. --this.length;
  13203. return ret;
  13204. };
  13205. BufferList.prototype.clear = function clear() {
  13206. this.head = this.tail = null;
  13207. this.length = 0;
  13208. };
  13209. BufferList.prototype.join = function join(s) {
  13210. if (this.length === 0) return '';
  13211. var p = this.head;
  13212. var ret = '' + p.data;
  13213. while (p = p.next) {
  13214. ret += s + p.data;
  13215. }return ret;
  13216. };
  13217. BufferList.prototype.concat = function concat(n) {
  13218. if (this.length === 0) return Buffer.alloc(0);
  13219. if (this.length === 1) return this.head.data;
  13220. var ret = Buffer.allocUnsafe(n >>> 0);
  13221. var p = this.head;
  13222. var i = 0;
  13223. while (p) {
  13224. copyBuffer(p.data, ret, i);
  13225. i += p.data.length;
  13226. p = p.next;
  13227. }
  13228. return ret;
  13229. };
  13230. return BufferList;
  13231. }();
  13232. if (util && util.inspect && util.inspect.custom) {
  13233. module.exports.prototype[util.inspect.custom] = function () {
  13234. var obj = util.inspect({ length: this.length });
  13235. return this.constructor.name + ' ' + obj;
  13236. };
  13237. }
  13238. /***/ }),
  13239. /* 104 */
  13240. /*!**********************!*\
  13241. !*** util (ignored) ***!
  13242. \**********************/
  13243. /*! no static exports found */
  13244. /***/ (function(module, exports) {
  13245. /* (ignored) */
  13246. /***/ }),
  13247. /* 105 */
  13248. /*!**********************************************************************!*\
  13249. !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!
  13250. \**********************************************************************/
  13251. /*! no static exports found */
  13252. /***/ (function(module, exports, __webpack_require__) {
  13253. "use strict";
  13254. /*<replacement>*/
  13255. var pna = __webpack_require__(/*! process-nextick-args */ 98);
  13256. /*</replacement>*/
  13257. // undocumented cb() API, needed for core, not for public API
  13258. function destroy(err, cb) {
  13259. var _this = this;
  13260. var readableDestroyed = this._readableState && this._readableState.destroyed;
  13261. var writableDestroyed = this._writableState && this._writableState.destroyed;
  13262. if (readableDestroyed || writableDestroyed) {
  13263. if (cb) {
  13264. cb(err);
  13265. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  13266. pna.nextTick(emitErrorNT, this, err);
  13267. }
  13268. return this;
  13269. }
  13270. // we set destroyed to true before firing error callbacks in order
  13271. // to make it re-entrance safe in case destroy() is called within callbacks
  13272. if (this._readableState) {
  13273. this._readableState.destroyed = true;
  13274. }
  13275. // if this is a duplex stream mark the writable part as destroyed as well
  13276. if (this._writableState) {
  13277. this._writableState.destroyed = true;
  13278. }
  13279. this._destroy(err || null, function (err) {
  13280. if (!cb && err) {
  13281. pna.nextTick(emitErrorNT, _this, err);
  13282. if (_this._writableState) {
  13283. _this._writableState.errorEmitted = true;
  13284. }
  13285. } else if (cb) {
  13286. cb(err);
  13287. }
  13288. });
  13289. return this;
  13290. }
  13291. function undestroy() {
  13292. if (this._readableState) {
  13293. this._readableState.destroyed = false;
  13294. this._readableState.reading = false;
  13295. this._readableState.ended = false;
  13296. this._readableState.endEmitted = false;
  13297. }
  13298. if (this._writableState) {
  13299. this._writableState.destroyed = false;
  13300. this._writableState.ended = false;
  13301. this._writableState.ending = false;
  13302. this._writableState.finished = false;
  13303. this._writableState.errorEmitted = false;
  13304. }
  13305. }
  13306. function emitErrorNT(self, err) {
  13307. self.emit('error', err);
  13308. }
  13309. module.exports = {
  13310. destroy: destroy,
  13311. undestroy: undestroy
  13312. };
  13313. /***/ }),
  13314. /* 106 */
  13315. /*!************************************************************!*\
  13316. !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!
  13317. \************************************************************/
  13318. /*! no static exports found */
  13319. /***/ (function(module, exports, __webpack_require__) {
  13320. "use strict";
  13321. // Copyright Joyent, Inc. and other Node contributors.
  13322. //
  13323. // Permission is hereby granted, free of charge, to any person obtaining a
  13324. // copy of this software and associated documentation files (the
  13325. // "Software"), to deal in the Software without restriction, including
  13326. // without limitation the rights to use, copy, modify, merge, publish,
  13327. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13328. // persons to whom the Software is furnished to do so, subject to the
  13329. // following conditions:
  13330. //
  13331. // The above copyright notice and this permission notice shall be included
  13332. // in all copies or substantial portions of the Software.
  13333. //
  13334. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13335. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13336. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13337. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13338. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13339. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13340. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13341. // a duplex stream is just a stream that is both readable and writable.
  13342. // Since JS doesn't have multiple prototypal inheritance, this class
  13343. // prototypally inherits from Readable, and then parasitically from
  13344. // Writable.
  13345. /*<replacement>*/
  13346. var pna = __webpack_require__(/*! process-nextick-args */ 98);
  13347. /*</replacement>*/
  13348. /*<replacement>*/
  13349. var objectKeys = Object.keys || function (obj) {
  13350. var keys = [];
  13351. for (var key in obj) {
  13352. keys.push(key);
  13353. }return keys;
  13354. };
  13355. /*</replacement>*/
  13356. module.exports = Duplex;
  13357. /*<replacement>*/
  13358. var util = Object.create(__webpack_require__(/*! core-util-is */ 101));
  13359. util.inherits = __webpack_require__(/*! inherits */ 93);
  13360. /*</replacement>*/
  13361. var Readable = __webpack_require__(/*! ./_stream_readable */ 97);
  13362. var Writable = __webpack_require__(/*! ./_stream_writable */ 107);
  13363. util.inherits(Duplex, Readable);
  13364. {
  13365. // avoid scope creep, the keys array can then be collected
  13366. var keys = objectKeys(Writable.prototype);
  13367. for (var v = 0; v < keys.length; v++) {
  13368. var method = keys[v];
  13369. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  13370. }
  13371. }
  13372. function Duplex(options) {
  13373. if (!(this instanceof Duplex)) return new Duplex(options);
  13374. Readable.call(this, options);
  13375. Writable.call(this, options);
  13376. if (options && options.readable === false) this.readable = false;
  13377. if (options && options.writable === false) this.writable = false;
  13378. this.allowHalfOpen = true;
  13379. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  13380. this.once('end', onend);
  13381. }
  13382. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  13383. // making it explicit this property is not enumerable
  13384. // because otherwise some prototype manipulation in
  13385. // userland will fail
  13386. enumerable: false,
  13387. get: function () {
  13388. return this._writableState.highWaterMark;
  13389. }
  13390. });
  13391. // the no-half-open enforcer
  13392. function onend() {
  13393. // if we allow half-open state, or if the writable side ended,
  13394. // then we're ok.
  13395. if (this.allowHalfOpen || this._writableState.ended) return;
  13396. // no more data can be written.
  13397. // But allow more writes to happen in this tick.
  13398. pna.nextTick(onEndNT, this);
  13399. }
  13400. function onEndNT(self) {
  13401. self.end();
  13402. }
  13403. Object.defineProperty(Duplex.prototype, 'destroyed', {
  13404. get: function () {
  13405. if (this._readableState === undefined || this._writableState === undefined) {
  13406. return false;
  13407. }
  13408. return this._readableState.destroyed && this._writableState.destroyed;
  13409. },
  13410. set: function (value) {
  13411. // we ignore the value if the stream
  13412. // has not been initialized yet
  13413. if (this._readableState === undefined || this._writableState === undefined) {
  13414. return;
  13415. }
  13416. // backward compatibility, the user is explicitly
  13417. // managing destroyed
  13418. this._readableState.destroyed = value;
  13419. this._writableState.destroyed = value;
  13420. }
  13421. });
  13422. Duplex.prototype._destroy = function (err, cb) {
  13423. this.push(null);
  13424. this.end();
  13425. pna.nextTick(cb, err);
  13426. };
  13427. /***/ }),
  13428. /* 107 */
  13429. /*!**************************************************************!*\
  13430. !*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
  13431. \**************************************************************/
  13432. /*! no static exports found */
  13433. /***/ (function(module, exports, __webpack_require__) {
  13434. "use strict";
  13435. /* WEBPACK VAR INJECTION */(function(process, global) {// Copyright Joyent, Inc. and other Node contributors.
  13436. //
  13437. // Permission is hereby granted, free of charge, to any person obtaining a
  13438. // copy of this software and associated documentation files (the
  13439. // "Software"), to deal in the Software without restriction, including
  13440. // without limitation the rights to use, copy, modify, merge, publish,
  13441. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13442. // persons to whom the Software is furnished to do so, subject to the
  13443. // following conditions:
  13444. //
  13445. // The above copyright notice and this permission notice shall be included
  13446. // in all copies or substantial portions of the Software.
  13447. //
  13448. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13449. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13450. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13451. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13452. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13453. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13454. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13455. // A bit simpler than readable streams.
  13456. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  13457. // the drain event emission and buffering.
  13458. /*<replacement>*/
  13459. var pna = __webpack_require__(/*! process-nextick-args */ 98);
  13460. /*</replacement>*/
  13461. module.exports = Writable;
  13462. /* <replacement> */
  13463. function WriteReq(chunk, encoding, cb) {
  13464. this.chunk = chunk;
  13465. this.encoding = encoding;
  13466. this.callback = cb;
  13467. this.next = null;
  13468. }
  13469. // It seems a linked list but it is not
  13470. // there will be only 2 of these for each stream
  13471. function CorkedRequest(state) {
  13472. var _this = this;
  13473. this.next = null;
  13474. this.entry = null;
  13475. this.finish = function () {
  13476. onCorkedFinish(_this, state);
  13477. };
  13478. }
  13479. /* </replacement> */
  13480. /*<replacement>*/
  13481. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  13482. /*</replacement>*/
  13483. /*<replacement>*/
  13484. var Duplex;
  13485. /*</replacement>*/
  13486. Writable.WritableState = WritableState;
  13487. /*<replacement>*/
  13488. var util = Object.create(__webpack_require__(/*! core-util-is */ 101));
  13489. util.inherits = __webpack_require__(/*! inherits */ 93);
  13490. /*</replacement>*/
  13491. /*<replacement>*/
  13492. var internalUtil = {
  13493. deprecate: __webpack_require__(/*! util-deprecate */ 108)
  13494. };
  13495. /*</replacement>*/
  13496. /*<replacement>*/
  13497. var Stream = __webpack_require__(/*! ./internal/streams/stream */ 100);
  13498. /*</replacement>*/
  13499. /*<replacement>*/
  13500. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer;
  13501. var OurUint8Array = global.Uint8Array || function () {};
  13502. function _uint8ArrayToBuffer(chunk) {
  13503. return Buffer.from(chunk);
  13504. }
  13505. function _isUint8Array(obj) {
  13506. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  13507. }
  13508. /*</replacement>*/
  13509. var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 105);
  13510. util.inherits(Writable, Stream);
  13511. function nop() {}
  13512. function WritableState(options, stream) {
  13513. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 106);
  13514. options = options || {};
  13515. // Duplex streams are both readable and writable, but share
  13516. // the same options object.
  13517. // However, some cases require setting options to different
  13518. // values for the readable and the writable sides of the duplex stream.
  13519. // These options can be provided separately as readableXXX and writableXXX.
  13520. var isDuplex = stream instanceof Duplex;
  13521. // object stream flag to indicate whether or not this stream
  13522. // contains buffers or objects.
  13523. this.objectMode = !!options.objectMode;
  13524. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  13525. // the point at which write() starts returning false
  13526. // Note: 0 is a valid value, means that we always return false if
  13527. // the entire buffer is not flushed immediately on write()
  13528. var hwm = options.highWaterMark;
  13529. var writableHwm = options.writableHighWaterMark;
  13530. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  13531. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  13532. // cast to ints.
  13533. this.highWaterMark = Math.floor(this.highWaterMark);
  13534. // if _final has been called
  13535. this.finalCalled = false;
  13536. // drain event flag.
  13537. this.needDrain = false;
  13538. // at the start of calling end()
  13539. this.ending = false;
  13540. // when end() has been called, and returned
  13541. this.ended = false;
  13542. // when 'finish' is emitted
  13543. this.finished = false;
  13544. // has it been destroyed
  13545. this.destroyed = false;
  13546. // should we decode strings into buffers before passing to _write?
  13547. // this is here so that some node-core streams can optimize string
  13548. // handling at a lower level.
  13549. var noDecode = options.decodeStrings === false;
  13550. this.decodeStrings = !noDecode;
  13551. // Crypto is kind of old and crusty. Historically, its default string
  13552. // encoding is 'binary' so we have to make this configurable.
  13553. // Everything else in the universe uses 'utf8', though.
  13554. this.defaultEncoding = options.defaultEncoding || 'utf8';
  13555. // not an actual buffer we keep track of, but a measurement
  13556. // of how much we're waiting to get pushed to some underlying
  13557. // socket or file.
  13558. this.length = 0;
  13559. // a flag to see when we're in the middle of a write.
  13560. this.writing = false;
  13561. // when true all writes will be buffered until .uncork() call
  13562. this.corked = 0;
  13563. // a flag to be able to tell if the onwrite cb is called immediately,
  13564. // or on a later tick. We set this to true at first, because any
  13565. // actions that shouldn't happen until "later" should generally also
  13566. // not happen before the first write call.
  13567. this.sync = true;
  13568. // a flag to know if we're processing previously buffered items, which
  13569. // may call the _write() callback in the same tick, so that we don't
  13570. // end up in an overlapped onwrite situation.
  13571. this.bufferProcessing = false;
  13572. // the callback that's passed to _write(chunk,cb)
  13573. this.onwrite = function (er) {
  13574. onwrite(stream, er);
  13575. };
  13576. // the callback that the user supplies to write(chunk,encoding,cb)
  13577. this.writecb = null;
  13578. // the amount that is being written when _write is called.
  13579. this.writelen = 0;
  13580. this.bufferedRequest = null;
  13581. this.lastBufferedRequest = null;
  13582. // number of pending user-supplied write callbacks
  13583. // this must be 0 before 'finish' can be emitted
  13584. this.pendingcb = 0;
  13585. // emit prefinish if the only thing we're waiting for is _write cbs
  13586. // This is relevant for synchronous Transform streams
  13587. this.prefinished = false;
  13588. // True if the error was already emitted and should not be thrown again
  13589. this.errorEmitted = false;
  13590. // count buffered requests
  13591. this.bufferedRequestCount = 0;
  13592. // allocate the first CorkedRequest, there is always
  13593. // one allocated and free to use, and we maintain at most two
  13594. this.corkedRequestsFree = new CorkedRequest(this);
  13595. }
  13596. WritableState.prototype.getBuffer = function getBuffer() {
  13597. var current = this.bufferedRequest;
  13598. var out = [];
  13599. while (current) {
  13600. out.push(current);
  13601. current = current.next;
  13602. }
  13603. return out;
  13604. };
  13605. (function () {
  13606. try {
  13607. Object.defineProperty(WritableState.prototype, 'buffer', {
  13608. get: internalUtil.deprecate(function () {
  13609. return this.getBuffer();
  13610. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  13611. });
  13612. } catch (_) {}
  13613. })();
  13614. // Test _writableState for inheritance to account for Duplex streams,
  13615. // whose prototype chain only points to Readable.
  13616. var realHasInstance;
  13617. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  13618. realHasInstance = Function.prototype[Symbol.hasInstance];
  13619. Object.defineProperty(Writable, Symbol.hasInstance, {
  13620. value: function (object) {
  13621. if (realHasInstance.call(this, object)) return true;
  13622. if (this !== Writable) return false;
  13623. return object && object._writableState instanceof WritableState;
  13624. }
  13625. });
  13626. } else {
  13627. realHasInstance = function (object) {
  13628. return object instanceof this;
  13629. };
  13630. }
  13631. function Writable(options) {
  13632. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 106);
  13633. // Writable ctor is applied to Duplexes, too.
  13634. // `realHasInstance` is necessary because using plain `instanceof`
  13635. // would return false, as no `_writableState` property is attached.
  13636. // Trying to use the custom `instanceof` for Writable here will also break the
  13637. // Node.js LazyTransform implementation, which has a non-trivial getter for
  13638. // `_writableState` that would lead to infinite recursion.
  13639. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  13640. return new Writable(options);
  13641. }
  13642. this._writableState = new WritableState(options, this);
  13643. // legacy.
  13644. this.writable = true;
  13645. if (options) {
  13646. if (typeof options.write === 'function') this._write = options.write;
  13647. if (typeof options.writev === 'function') this._writev = options.writev;
  13648. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  13649. if (typeof options.final === 'function') this._final = options.final;
  13650. }
  13651. Stream.call(this);
  13652. }
  13653. // Otherwise people can pipe Writable streams, which is just wrong.
  13654. Writable.prototype.pipe = function () {
  13655. this.emit('error', new Error('Cannot pipe, not readable'));
  13656. };
  13657. function writeAfterEnd(stream, cb) {
  13658. var er = new Error('write after end');
  13659. // TODO: defer error events consistently everywhere, not just the cb
  13660. stream.emit('error', er);
  13661. pna.nextTick(cb, er);
  13662. }
  13663. // Checks that a user-supplied chunk is valid, especially for the particular
  13664. // mode the stream is in. Currently this means that `null` is never accepted
  13665. // and undefined/non-string values are only allowed in object mode.
  13666. function validChunk(stream, state, chunk, cb) {
  13667. var valid = true;
  13668. var er = false;
  13669. if (chunk === null) {
  13670. er = new TypeError('May not write null values to stream');
  13671. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  13672. er = new TypeError('Invalid non-string/buffer chunk');
  13673. }
  13674. if (er) {
  13675. stream.emit('error', er);
  13676. pna.nextTick(cb, er);
  13677. valid = false;
  13678. }
  13679. return valid;
  13680. }
  13681. Writable.prototype.write = function (chunk, encoding, cb) {
  13682. var state = this._writableState;
  13683. var ret = false;
  13684. var isBuf = !state.objectMode && _isUint8Array(chunk);
  13685. if (isBuf && !Buffer.isBuffer(chunk)) {
  13686. chunk = _uint8ArrayToBuffer(chunk);
  13687. }
  13688. if (typeof encoding === 'function') {
  13689. cb = encoding;
  13690. encoding = null;
  13691. }
  13692. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  13693. if (typeof cb !== 'function') cb = nop;
  13694. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  13695. state.pendingcb++;
  13696. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  13697. }
  13698. return ret;
  13699. };
  13700. Writable.prototype.cork = function () {
  13701. var state = this._writableState;
  13702. state.corked++;
  13703. };
  13704. Writable.prototype.uncork = function () {
  13705. var state = this._writableState;
  13706. if (state.corked) {
  13707. state.corked--;
  13708. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  13709. }
  13710. };
  13711. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  13712. // node::ParseEncoding() requires lower case.
  13713. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  13714. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  13715. this._writableState.defaultEncoding = encoding;
  13716. return this;
  13717. };
  13718. function decodeChunk(state, chunk, encoding) {
  13719. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  13720. chunk = Buffer.from(chunk, encoding);
  13721. }
  13722. return chunk;
  13723. }
  13724. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  13725. // making it explicit this property is not enumerable
  13726. // because otherwise some prototype manipulation in
  13727. // userland will fail
  13728. enumerable: false,
  13729. get: function () {
  13730. return this._writableState.highWaterMark;
  13731. }
  13732. });
  13733. // if we're already writing something, then just put this
  13734. // in the queue, and wait our turn. Otherwise, call _write
  13735. // If we return false, then we need a drain event, so set that flag.
  13736. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  13737. if (!isBuf) {
  13738. var newChunk = decodeChunk(state, chunk, encoding);
  13739. if (chunk !== newChunk) {
  13740. isBuf = true;
  13741. encoding = 'buffer';
  13742. chunk = newChunk;
  13743. }
  13744. }
  13745. var len = state.objectMode ? 1 : chunk.length;
  13746. state.length += len;
  13747. var ret = state.length < state.highWaterMark;
  13748. // we must ensure that previous needDrain will not be reset to false.
  13749. if (!ret) state.needDrain = true;
  13750. if (state.writing || state.corked) {
  13751. var last = state.lastBufferedRequest;
  13752. state.lastBufferedRequest = {
  13753. chunk: chunk,
  13754. encoding: encoding,
  13755. isBuf: isBuf,
  13756. callback: cb,
  13757. next: null
  13758. };
  13759. if (last) {
  13760. last.next = state.lastBufferedRequest;
  13761. } else {
  13762. state.bufferedRequest = state.lastBufferedRequest;
  13763. }
  13764. state.bufferedRequestCount += 1;
  13765. } else {
  13766. doWrite(stream, state, false, len, chunk, encoding, cb);
  13767. }
  13768. return ret;
  13769. }
  13770. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  13771. state.writelen = len;
  13772. state.writecb = cb;
  13773. state.writing = true;
  13774. state.sync = true;
  13775. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  13776. state.sync = false;
  13777. }
  13778. function onwriteError(stream, state, sync, er, cb) {
  13779. --state.pendingcb;
  13780. if (sync) {
  13781. // defer the callback if we are being called synchronously
  13782. // to avoid piling up things on the stack
  13783. pna.nextTick(cb, er);
  13784. // this can emit finish, and it will always happen
  13785. // after error
  13786. pna.nextTick(finishMaybe, stream, state);
  13787. stream._writableState.errorEmitted = true;
  13788. stream.emit('error', er);
  13789. } else {
  13790. // the caller expect this to happen before if
  13791. // it is async
  13792. cb(er);
  13793. stream._writableState.errorEmitted = true;
  13794. stream.emit('error', er);
  13795. // this can emit finish, but finish must
  13796. // always follow error
  13797. finishMaybe(stream, state);
  13798. }
  13799. }
  13800. function onwriteStateUpdate(state) {
  13801. state.writing = false;
  13802. state.writecb = null;
  13803. state.length -= state.writelen;
  13804. state.writelen = 0;
  13805. }
  13806. function onwrite(stream, er) {
  13807. var state = stream._writableState;
  13808. var sync = state.sync;
  13809. var cb = state.writecb;
  13810. onwriteStateUpdate(state);
  13811. if (er) onwriteError(stream, state, sync, er, cb);else {
  13812. // Check if we're actually ready to finish, but don't emit yet
  13813. var finished = needFinish(state);
  13814. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  13815. clearBuffer(stream, state);
  13816. }
  13817. if (sync) {
  13818. /*<replacement>*/
  13819. asyncWrite(afterWrite, stream, state, finished, cb);
  13820. /*</replacement>*/
  13821. } else {
  13822. afterWrite(stream, state, finished, cb);
  13823. }
  13824. }
  13825. }
  13826. function afterWrite(stream, state, finished, cb) {
  13827. if (!finished) onwriteDrain(stream, state);
  13828. state.pendingcb--;
  13829. cb();
  13830. finishMaybe(stream, state);
  13831. }
  13832. // Must force callback to be called on nextTick, so that we don't
  13833. // emit 'drain' before the write() consumer gets the 'false' return
  13834. // value, and has a chance to attach a 'drain' listener.
  13835. function onwriteDrain(stream, state) {
  13836. if (state.length === 0 && state.needDrain) {
  13837. state.needDrain = false;
  13838. stream.emit('drain');
  13839. }
  13840. }
  13841. // if there's something in the buffer waiting, then process it
  13842. function clearBuffer(stream, state) {
  13843. state.bufferProcessing = true;
  13844. var entry = state.bufferedRequest;
  13845. if (stream._writev && entry && entry.next) {
  13846. // Fast case, write everything using _writev()
  13847. var l = state.bufferedRequestCount;
  13848. var buffer = new Array(l);
  13849. var holder = state.corkedRequestsFree;
  13850. holder.entry = entry;
  13851. var count = 0;
  13852. var allBuffers = true;
  13853. while (entry) {
  13854. buffer[count] = entry;
  13855. if (!entry.isBuf) allBuffers = false;
  13856. entry = entry.next;
  13857. count += 1;
  13858. }
  13859. buffer.allBuffers = allBuffers;
  13860. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  13861. // doWrite is almost always async, defer these to save a bit of time
  13862. // as the hot path ends with doWrite
  13863. state.pendingcb++;
  13864. state.lastBufferedRequest = null;
  13865. if (holder.next) {
  13866. state.corkedRequestsFree = holder.next;
  13867. holder.next = null;
  13868. } else {
  13869. state.corkedRequestsFree = new CorkedRequest(state);
  13870. }
  13871. state.bufferedRequestCount = 0;
  13872. } else {
  13873. // Slow case, write chunks one-by-one
  13874. while (entry) {
  13875. var chunk = entry.chunk;
  13876. var encoding = entry.encoding;
  13877. var cb = entry.callback;
  13878. var len = state.objectMode ? 1 : chunk.length;
  13879. doWrite(stream, state, false, len, chunk, encoding, cb);
  13880. entry = entry.next;
  13881. state.bufferedRequestCount--;
  13882. // if we didn't call the onwrite immediately, then
  13883. // it means that we need to wait until it does.
  13884. // also, that means that the chunk and cb are currently
  13885. // being processed, so move the buffer counter past them.
  13886. if (state.writing) {
  13887. break;
  13888. }
  13889. }
  13890. if (entry === null) state.lastBufferedRequest = null;
  13891. }
  13892. state.bufferedRequest = entry;
  13893. state.bufferProcessing = false;
  13894. }
  13895. Writable.prototype._write = function (chunk, encoding, cb) {
  13896. cb(new Error('_write() is not implemented'));
  13897. };
  13898. Writable.prototype._writev = null;
  13899. Writable.prototype.end = function (chunk, encoding, cb) {
  13900. var state = this._writableState;
  13901. if (typeof chunk === 'function') {
  13902. cb = chunk;
  13903. chunk = null;
  13904. encoding = null;
  13905. } else if (typeof encoding === 'function') {
  13906. cb = encoding;
  13907. encoding = null;
  13908. }
  13909. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  13910. // .end() fully uncorks
  13911. if (state.corked) {
  13912. state.corked = 1;
  13913. this.uncork();
  13914. }
  13915. // ignore unnecessary end() calls.
  13916. if (!state.ending && !state.finished) endWritable(this, state, cb);
  13917. };
  13918. function needFinish(state) {
  13919. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  13920. }
  13921. function callFinal(stream, state) {
  13922. stream._final(function (err) {
  13923. state.pendingcb--;
  13924. if (err) {
  13925. stream.emit('error', err);
  13926. }
  13927. state.prefinished = true;
  13928. stream.emit('prefinish');
  13929. finishMaybe(stream, state);
  13930. });
  13931. }
  13932. function prefinish(stream, state) {
  13933. if (!state.prefinished && !state.finalCalled) {
  13934. if (typeof stream._final === 'function') {
  13935. state.pendingcb++;
  13936. state.finalCalled = true;
  13937. pna.nextTick(callFinal, stream, state);
  13938. } else {
  13939. state.prefinished = true;
  13940. stream.emit('prefinish');
  13941. }
  13942. }
  13943. }
  13944. function finishMaybe(stream, state) {
  13945. var need = needFinish(state);
  13946. if (need) {
  13947. prefinish(stream, state);
  13948. if (state.pendingcb === 0) {
  13949. state.finished = true;
  13950. stream.emit('finish');
  13951. }
  13952. }
  13953. return need;
  13954. }
  13955. function endWritable(stream, state, cb) {
  13956. state.ending = true;
  13957. finishMaybe(stream, state);
  13958. if (cb) {
  13959. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  13960. }
  13961. state.ended = true;
  13962. stream.writable = false;
  13963. }
  13964. function onCorkedFinish(corkReq, state, err) {
  13965. var entry = corkReq.entry;
  13966. corkReq.entry = null;
  13967. while (entry) {
  13968. var cb = entry.callback;
  13969. state.pendingcb--;
  13970. cb(err);
  13971. entry = entry.next;
  13972. }
  13973. if (state.corkedRequestsFree) {
  13974. state.corkedRequestsFree.next = corkReq;
  13975. } else {
  13976. state.corkedRequestsFree = corkReq;
  13977. }
  13978. }
  13979. Object.defineProperty(Writable.prototype, 'destroyed', {
  13980. get: function () {
  13981. if (this._writableState === undefined) {
  13982. return false;
  13983. }
  13984. return this._writableState.destroyed;
  13985. },
  13986. set: function (value) {
  13987. // we ignore the value if the stream
  13988. // has not been initialized yet
  13989. if (!this._writableState) {
  13990. return;
  13991. }
  13992. // backward compatibility, the user is explicitly
  13993. // managing destroyed
  13994. this._writableState.destroyed = value;
  13995. }
  13996. });
  13997. Writable.prototype.destroy = destroyImpl.destroy;
  13998. Writable.prototype._undestroy = destroyImpl.undestroy;
  13999. Writable.prototype._destroy = function (err, cb) {
  14000. this.end();
  14001. cb(err);
  14002. };
  14003. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 85), __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3)))
  14004. /***/ }),
  14005. /* 108 */
  14006. /*!************************************************!*\
  14007. !*** ./node_modules/util-deprecate/browser.js ***!
  14008. \************************************************/
  14009. /*! no static exports found */
  14010. /***/ (function(module, exports, __webpack_require__) {
  14011. /* WEBPACK VAR INJECTION */(function(global) {
  14012. /**
  14013. * Module exports.
  14014. */
  14015. module.exports = deprecate;
  14016. /**
  14017. * Mark that a method should not be used.
  14018. * Returns a modified function which warns once by default.
  14019. *
  14020. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  14021. *
  14022. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  14023. * will throw an Error when invoked.
  14024. *
  14025. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  14026. * will invoke `console.trace()` instead of `console.error()`.
  14027. *
  14028. * @param {Function} fn - the function to deprecate
  14029. * @param {String} msg - the string to print to the console when `fn` is invoked
  14030. * @returns {Function} a new "deprecated" version of `fn`
  14031. * @api public
  14032. */
  14033. function deprecate (fn, msg) {
  14034. if (config('noDeprecation')) {
  14035. return fn;
  14036. }
  14037. var warned = false;
  14038. function deprecated() {
  14039. if (!warned) {
  14040. if (config('throwDeprecation')) {
  14041. throw new Error(msg);
  14042. } else if (config('traceDeprecation')) {
  14043. console.trace(msg);
  14044. } else {
  14045. console.warn(msg);
  14046. }
  14047. warned = true;
  14048. }
  14049. return fn.apply(this, arguments);
  14050. }
  14051. return deprecated;
  14052. }
  14053. /**
  14054. * Checks `localStorage` for boolean values for the given `name`.
  14055. *
  14056. * @param {String} name
  14057. * @returns {Boolean}
  14058. * @api private
  14059. */
  14060. function config (name) {
  14061. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  14062. try {
  14063. if (!global.localStorage) return false;
  14064. } catch (_) {
  14065. return false;
  14066. }
  14067. var val = global.localStorage[name];
  14068. if (null == val) return false;
  14069. return String(val).toLowerCase() === 'true';
  14070. }
  14071. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
  14072. /***/ }),
  14073. /* 109 */
  14074. /*!***********************************************************!*\
  14075. !*** ./node_modules/string_decoder/lib/string_decoder.js ***!
  14076. \***********************************************************/
  14077. /*! no static exports found */
  14078. /***/ (function(module, exports, __webpack_require__) {
  14079. "use strict";
  14080. // Copyright Joyent, Inc. and other Node contributors.
  14081. //
  14082. // Permission is hereby granted, free of charge, to any person obtaining a
  14083. // copy of this software and associated documentation files (the
  14084. // "Software"), to deal in the Software without restriction, including
  14085. // without limitation the rights to use, copy, modify, merge, publish,
  14086. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14087. // persons to whom the Software is furnished to do so, subject to the
  14088. // following conditions:
  14089. //
  14090. // The above copyright notice and this permission notice shall be included
  14091. // in all copies or substantial portions of the Software.
  14092. //
  14093. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14094. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14095. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14096. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14097. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14098. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14099. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14100. /*<replacement>*/
  14101. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer;
  14102. /*</replacement>*/
  14103. var isEncoding = Buffer.isEncoding || function (encoding) {
  14104. encoding = '' + encoding;
  14105. switch (encoding && encoding.toLowerCase()) {
  14106. case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
  14107. return true;
  14108. default:
  14109. return false;
  14110. }
  14111. };
  14112. function _normalizeEncoding(enc) {
  14113. if (!enc) return 'utf8';
  14114. var retried;
  14115. while (true) {
  14116. switch (enc) {
  14117. case 'utf8':
  14118. case 'utf-8':
  14119. return 'utf8';
  14120. case 'ucs2':
  14121. case 'ucs-2':
  14122. case 'utf16le':
  14123. case 'utf-16le':
  14124. return 'utf16le';
  14125. case 'latin1':
  14126. case 'binary':
  14127. return 'latin1';
  14128. case 'base64':
  14129. case 'ascii':
  14130. case 'hex':
  14131. return enc;
  14132. default:
  14133. if (retried) return; // undefined
  14134. enc = ('' + enc).toLowerCase();
  14135. retried = true;
  14136. }
  14137. }
  14138. };
  14139. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  14140. // modules monkey-patch it to support additional encodings
  14141. function normalizeEncoding(enc) {
  14142. var nenc = _normalizeEncoding(enc);
  14143. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  14144. return nenc || enc;
  14145. }
  14146. // StringDecoder provides an interface for efficiently splitting a series of
  14147. // buffers into a series of JS strings without breaking apart multi-byte
  14148. // characters.
  14149. exports.StringDecoder = StringDecoder;
  14150. function StringDecoder(encoding) {
  14151. this.encoding = normalizeEncoding(encoding);
  14152. var nb;
  14153. switch (this.encoding) {
  14154. case 'utf16le':
  14155. this.text = utf16Text;
  14156. this.end = utf16End;
  14157. nb = 4;
  14158. break;
  14159. case 'utf8':
  14160. this.fillLast = utf8FillLast;
  14161. nb = 4;
  14162. break;
  14163. case 'base64':
  14164. this.text = base64Text;
  14165. this.end = base64End;
  14166. nb = 3;
  14167. break;
  14168. default:
  14169. this.write = simpleWrite;
  14170. this.end = simpleEnd;
  14171. return;
  14172. }
  14173. this.lastNeed = 0;
  14174. this.lastTotal = 0;
  14175. this.lastChar = Buffer.allocUnsafe(nb);
  14176. }
  14177. StringDecoder.prototype.write = function (buf) {
  14178. if (buf.length === 0) return '';
  14179. var r;
  14180. var i;
  14181. if (this.lastNeed) {
  14182. r = this.fillLast(buf);
  14183. if (r === undefined) return '';
  14184. i = this.lastNeed;
  14185. this.lastNeed = 0;
  14186. } else {
  14187. i = 0;
  14188. }
  14189. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  14190. return r || '';
  14191. };
  14192. StringDecoder.prototype.end = utf8End;
  14193. // Returns only complete characters in a Buffer
  14194. StringDecoder.prototype.text = utf8Text;
  14195. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  14196. StringDecoder.prototype.fillLast = function (buf) {
  14197. if (this.lastNeed <= buf.length) {
  14198. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  14199. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14200. }
  14201. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  14202. this.lastNeed -= buf.length;
  14203. };
  14204. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  14205. // continuation byte. If an invalid byte is detected, -2 is returned.
  14206. function utf8CheckByte(byte) {
  14207. if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  14208. return byte >> 6 === 0x02 ? -1 : -2;
  14209. }
  14210. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  14211. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  14212. // needed to complete the UTF-8 character (if applicable) are returned.
  14213. function utf8CheckIncomplete(self, buf, i) {
  14214. var j = buf.length - 1;
  14215. if (j < i) return 0;
  14216. var nb = utf8CheckByte(buf[j]);
  14217. if (nb >= 0) {
  14218. if (nb > 0) self.lastNeed = nb - 1;
  14219. return nb;
  14220. }
  14221. if (--j < i || nb === -2) return 0;
  14222. nb = utf8CheckByte(buf[j]);
  14223. if (nb >= 0) {
  14224. if (nb > 0) self.lastNeed = nb - 2;
  14225. return nb;
  14226. }
  14227. if (--j < i || nb === -2) return 0;
  14228. nb = utf8CheckByte(buf[j]);
  14229. if (nb >= 0) {
  14230. if (nb > 0) {
  14231. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  14232. }
  14233. return nb;
  14234. }
  14235. return 0;
  14236. }
  14237. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  14238. // needed or are available. If we see a non-continuation byte where we expect
  14239. // one, we "replace" the validated continuation bytes we've seen so far with
  14240. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  14241. // behavior. The continuation byte check is included three times in the case
  14242. // where all of the continuation bytes for a character exist in the same buffer.
  14243. // It is also done this way as a slight performance increase instead of using a
  14244. // loop.
  14245. function utf8CheckExtraBytes(self, buf, p) {
  14246. if ((buf[0] & 0xC0) !== 0x80) {
  14247. self.lastNeed = 0;
  14248. return '\ufffd';
  14249. }
  14250. if (self.lastNeed > 1 && buf.length > 1) {
  14251. if ((buf[1] & 0xC0) !== 0x80) {
  14252. self.lastNeed = 1;
  14253. return '\ufffd';
  14254. }
  14255. if (self.lastNeed > 2 && buf.length > 2) {
  14256. if ((buf[2] & 0xC0) !== 0x80) {
  14257. self.lastNeed = 2;
  14258. return '\ufffd';
  14259. }
  14260. }
  14261. }
  14262. }
  14263. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  14264. function utf8FillLast(buf) {
  14265. var p = this.lastTotal - this.lastNeed;
  14266. var r = utf8CheckExtraBytes(this, buf, p);
  14267. if (r !== undefined) return r;
  14268. if (this.lastNeed <= buf.length) {
  14269. buf.copy(this.lastChar, p, 0, this.lastNeed);
  14270. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14271. }
  14272. buf.copy(this.lastChar, p, 0, buf.length);
  14273. this.lastNeed -= buf.length;
  14274. }
  14275. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  14276. // partial character, the character's bytes are buffered until the required
  14277. // number of bytes are available.
  14278. function utf8Text(buf, i) {
  14279. var total = utf8CheckIncomplete(this, buf, i);
  14280. if (!this.lastNeed) return buf.toString('utf8', i);
  14281. this.lastTotal = total;
  14282. var end = buf.length - (total - this.lastNeed);
  14283. buf.copy(this.lastChar, 0, end);
  14284. return buf.toString('utf8', i, end);
  14285. }
  14286. // For UTF-8, a replacement character is added when ending on a partial
  14287. // character.
  14288. function utf8End(buf) {
  14289. var r = buf && buf.length ? this.write(buf) : '';
  14290. if (this.lastNeed) return r + '\ufffd';
  14291. return r;
  14292. }
  14293. // UTF-16LE typically needs two bytes per character, but even if we have an even
  14294. // number of bytes available, we need to check if we end on a leading/high
  14295. // surrogate. In that case, we need to wait for the next two bytes in order to
  14296. // decode the last character properly.
  14297. function utf16Text(buf, i) {
  14298. if ((buf.length - i) % 2 === 0) {
  14299. var r = buf.toString('utf16le', i);
  14300. if (r) {
  14301. var c = r.charCodeAt(r.length - 1);
  14302. if (c >= 0xD800 && c <= 0xDBFF) {
  14303. this.lastNeed = 2;
  14304. this.lastTotal = 4;
  14305. this.lastChar[0] = buf[buf.length - 2];
  14306. this.lastChar[1] = buf[buf.length - 1];
  14307. return r.slice(0, -1);
  14308. }
  14309. }
  14310. return r;
  14311. }
  14312. this.lastNeed = 1;
  14313. this.lastTotal = 2;
  14314. this.lastChar[0] = buf[buf.length - 1];
  14315. return buf.toString('utf16le', i, buf.length - 1);
  14316. }
  14317. // For UTF-16LE we do not explicitly append special replacement characters if we
  14318. // end on a partial character, we simply let v8 handle that.
  14319. function utf16End(buf) {
  14320. var r = buf && buf.length ? this.write(buf) : '';
  14321. if (this.lastNeed) {
  14322. var end = this.lastTotal - this.lastNeed;
  14323. return r + this.lastChar.toString('utf16le', 0, end);
  14324. }
  14325. return r;
  14326. }
  14327. function base64Text(buf, i) {
  14328. var n = (buf.length - i) % 3;
  14329. if (n === 0) return buf.toString('base64', i);
  14330. this.lastNeed = 3 - n;
  14331. this.lastTotal = 3;
  14332. if (n === 1) {
  14333. this.lastChar[0] = buf[buf.length - 1];
  14334. } else {
  14335. this.lastChar[0] = buf[buf.length - 2];
  14336. this.lastChar[1] = buf[buf.length - 1];
  14337. }
  14338. return buf.toString('base64', i, buf.length - n);
  14339. }
  14340. function base64End(buf) {
  14341. var r = buf && buf.length ? this.write(buf) : '';
  14342. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  14343. return r;
  14344. }
  14345. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  14346. function simpleWrite(buf) {
  14347. return buf.toString(this.encoding);
  14348. }
  14349. function simpleEnd(buf) {
  14350. return buf && buf.length ? this.write(buf) : '';
  14351. }
  14352. /***/ }),
  14353. /* 110 */
  14354. /*!***************************************************************!*\
  14355. !*** ./node_modules/readable-stream/lib/_stream_transform.js ***!
  14356. \***************************************************************/
  14357. /*! no static exports found */
  14358. /***/ (function(module, exports, __webpack_require__) {
  14359. "use strict";
  14360. // Copyright Joyent, Inc. and other Node contributors.
  14361. //
  14362. // Permission is hereby granted, free of charge, to any person obtaining a
  14363. // copy of this software and associated documentation files (the
  14364. // "Software"), to deal in the Software without restriction, including
  14365. // without limitation the rights to use, copy, modify, merge, publish,
  14366. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14367. // persons to whom the Software is furnished to do so, subject to the
  14368. // following conditions:
  14369. //
  14370. // The above copyright notice and this permission notice shall be included
  14371. // in all copies or substantial portions of the Software.
  14372. //
  14373. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14374. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14375. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14376. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14377. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14378. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14379. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14380. // a transform stream is a readable/writable stream where you do
  14381. // something with the data. Sometimes it's called a "filter",
  14382. // but that's not a great name for it, since that implies a thing where
  14383. // some bits pass through, and others are simply ignored. (That would
  14384. // be a valid example of a transform, of course.)
  14385. //
  14386. // While the output is causally related to the input, it's not a
  14387. // necessarily symmetric or synchronous transformation. For example,
  14388. // a zlib stream might take multiple plain-text writes(), and then
  14389. // emit a single compressed chunk some time in the future.
  14390. //
  14391. // Here's how this works:
  14392. //
  14393. // The Transform stream has all the aspects of the readable and writable
  14394. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  14395. // internally, and returns false if there's a lot of pending writes
  14396. // buffered up. When you call read(), that calls _read(n) until
  14397. // there's enough pending readable data buffered up.
  14398. //
  14399. // In a transform stream, the written data is placed in a buffer. When
  14400. // _read(n) is called, it transforms the queued up data, calling the
  14401. // buffered _write cb's as it consumes chunks. If consuming a single
  14402. // written chunk would result in multiple output chunks, then the first
  14403. // outputted bit calls the readcb, and subsequent chunks just go into
  14404. // the read buffer, and will cause it to emit 'readable' if necessary.
  14405. //
  14406. // This way, back-pressure is actually determined by the reading side,
  14407. // since _read has to be called to start processing a new chunk. However,
  14408. // a pathological inflate type of transform can cause excessive buffering
  14409. // here. For example, imagine a stream where every byte of input is
  14410. // interpreted as an integer from 0-255, and then results in that many
  14411. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  14412. // 1kb of data being output. In this case, you could write a very small
  14413. // amount of input, and end up with a very large amount of output. In
  14414. // such a pathological inflating mechanism, there'd be no way to tell
  14415. // the system to stop doing the transform. A single 4MB write could
  14416. // cause the system to run out of memory.
  14417. //
  14418. // However, even in such a pathological case, only a single written chunk
  14419. // would be consumed, and then the rest would wait (un-transformed) until
  14420. // the results of the previous transformed chunk were consumed.
  14421. module.exports = Transform;
  14422. var Duplex = __webpack_require__(/*! ./_stream_duplex */ 106);
  14423. /*<replacement>*/
  14424. var util = Object.create(__webpack_require__(/*! core-util-is */ 101));
  14425. util.inherits = __webpack_require__(/*! inherits */ 93);
  14426. /*</replacement>*/
  14427. util.inherits(Transform, Duplex);
  14428. function afterTransform(er, data) {
  14429. var ts = this._transformState;
  14430. ts.transforming = false;
  14431. var cb = ts.writecb;
  14432. if (!cb) {
  14433. return this.emit('error', new Error('write callback called multiple times'));
  14434. }
  14435. ts.writechunk = null;
  14436. ts.writecb = null;
  14437. if (data != null) // single equals check for both `null` and `undefined`
  14438. this.push(data);
  14439. cb(er);
  14440. var rs = this._readableState;
  14441. rs.reading = false;
  14442. if (rs.needReadable || rs.length < rs.highWaterMark) {
  14443. this._read(rs.highWaterMark);
  14444. }
  14445. }
  14446. function Transform(options) {
  14447. if (!(this instanceof Transform)) return new Transform(options);
  14448. Duplex.call(this, options);
  14449. this._transformState = {
  14450. afterTransform: afterTransform.bind(this),
  14451. needTransform: false,
  14452. transforming: false,
  14453. writecb: null,
  14454. writechunk: null,
  14455. writeencoding: null
  14456. };
  14457. // start out asking for a readable event once data is transformed.
  14458. this._readableState.needReadable = true;
  14459. // we have implemented the _read method, and done the other things
  14460. // that Readable wants before the first _read call, so unset the
  14461. // sync guard flag.
  14462. this._readableState.sync = false;
  14463. if (options) {
  14464. if (typeof options.transform === 'function') this._transform = options.transform;
  14465. if (typeof options.flush === 'function') this._flush = options.flush;
  14466. }
  14467. // When the writable side finishes, then flush out anything remaining.
  14468. this.on('prefinish', prefinish);
  14469. }
  14470. function prefinish() {
  14471. var _this = this;
  14472. if (typeof this._flush === 'function') {
  14473. this._flush(function (er, data) {
  14474. done(_this, er, data);
  14475. });
  14476. } else {
  14477. done(this, null, null);
  14478. }
  14479. }
  14480. Transform.prototype.push = function (chunk, encoding) {
  14481. this._transformState.needTransform = false;
  14482. return Duplex.prototype.push.call(this, chunk, encoding);
  14483. };
  14484. // This is the part where you do stuff!
  14485. // override this function in implementation classes.
  14486. // 'chunk' is an input chunk.
  14487. //
  14488. // Call `push(newChunk)` to pass along transformed output
  14489. // to the readable side. You may call 'push' zero or more times.
  14490. //
  14491. // Call `cb(err)` when you are done with this chunk. If you pass
  14492. // an error, then that'll put the hurt on the whole operation. If you
  14493. // never call cb(), then you'll never get another chunk.
  14494. Transform.prototype._transform = function (chunk, encoding, cb) {
  14495. throw new Error('_transform() is not implemented');
  14496. };
  14497. Transform.prototype._write = function (chunk, encoding, cb) {
  14498. var ts = this._transformState;
  14499. ts.writecb = cb;
  14500. ts.writechunk = chunk;
  14501. ts.writeencoding = encoding;
  14502. if (!ts.transforming) {
  14503. var rs = this._readableState;
  14504. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  14505. }
  14506. };
  14507. // Doesn't matter what the args are here.
  14508. // _transform does all the work.
  14509. // That we got here means that the readable side wants more data.
  14510. Transform.prototype._read = function (n) {
  14511. var ts = this._transformState;
  14512. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  14513. ts.transforming = true;
  14514. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  14515. } else {
  14516. // mark that we need a transform, so that any data that comes in
  14517. // will get processed, now that we've asked for it.
  14518. ts.needTransform = true;
  14519. }
  14520. };
  14521. Transform.prototype._destroy = function (err, cb) {
  14522. var _this2 = this;
  14523. Duplex.prototype._destroy.call(this, err, function (err2) {
  14524. cb(err2);
  14525. _this2.emit('close');
  14526. });
  14527. };
  14528. function done(stream, er, data) {
  14529. if (er) return stream.emit('error', er);
  14530. if (data != null) // single equals check for both `null` and `undefined`
  14531. stream.push(data);
  14532. // if there's nothing in the write buffer, then that means
  14533. // that nothing more will ever be provided
  14534. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  14535. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  14536. return stream.push(null);
  14537. }
  14538. /***/ }),
  14539. /* 111 */
  14540. /*!*****************************************************************!*\
  14541. !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!
  14542. \*****************************************************************/
  14543. /*! no static exports found */
  14544. /***/ (function(module, exports, __webpack_require__) {
  14545. "use strict";
  14546. // Copyright Joyent, Inc. and other Node contributors.
  14547. //
  14548. // Permission is hereby granted, free of charge, to any person obtaining a
  14549. // copy of this software and associated documentation files (the
  14550. // "Software"), to deal in the Software without restriction, including
  14551. // without limitation the rights to use, copy, modify, merge, publish,
  14552. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14553. // persons to whom the Software is furnished to do so, subject to the
  14554. // following conditions:
  14555. //
  14556. // The above copyright notice and this permission notice shall be included
  14557. // in all copies or substantial portions of the Software.
  14558. //
  14559. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14560. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14561. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14562. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14563. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14564. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14565. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14566. // a passthrough stream.
  14567. // basically just the most minimal sort of Transform stream.
  14568. // Every written chunk gets output as-is.
  14569. module.exports = PassThrough;
  14570. var Transform = __webpack_require__(/*! ./_stream_transform */ 110);
  14571. /*<replacement>*/
  14572. var util = Object.create(__webpack_require__(/*! core-util-is */ 101));
  14573. util.inherits = __webpack_require__(/*! inherits */ 93);
  14574. /*</replacement>*/
  14575. util.inherits(PassThrough, Transform);
  14576. function PassThrough(options) {
  14577. if (!(this instanceof PassThrough)) return new PassThrough(options);
  14578. Transform.call(this, options);
  14579. }
  14580. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  14581. cb(null, chunk);
  14582. };
  14583. /***/ }),
  14584. /* 112 */
  14585. /*!*****************************************!*\
  14586. !*** ./node_modules/ripemd160/index.js ***!
  14587. \*****************************************/
  14588. /*! no static exports found */
  14589. /***/ (function(module, exports, __webpack_require__) {
  14590. "use strict";
  14591. var Buffer = __webpack_require__(/*! buffer */ 88).Buffer
  14592. var inherits = __webpack_require__(/*! inherits */ 93)
  14593. var HashBase = __webpack_require__(/*! hash-base */ 95)
  14594. var ARRAY16 = new Array(16)
  14595. var zl = [
  14596. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  14597. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  14598. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  14599. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  14600. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  14601. ]
  14602. var zr = [
  14603. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  14604. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  14605. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  14606. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  14607. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  14608. ]
  14609. var sl = [
  14610. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  14611. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  14612. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  14613. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  14614. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  14615. ]
  14616. var sr = [
  14617. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  14618. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  14619. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  14620. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  14621. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  14622. ]
  14623. var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
  14624. var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
  14625. function RIPEMD160 () {
  14626. HashBase.call(this, 64)
  14627. // state
  14628. this._a = 0x67452301
  14629. this._b = 0xefcdab89
  14630. this._c = 0x98badcfe
  14631. this._d = 0x10325476
  14632. this._e = 0xc3d2e1f0
  14633. }
  14634. inherits(RIPEMD160, HashBase)
  14635. RIPEMD160.prototype._update = function () {
  14636. var words = ARRAY16
  14637. for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)
  14638. var al = this._a | 0
  14639. var bl = this._b | 0
  14640. var cl = this._c | 0
  14641. var dl = this._d | 0
  14642. var el = this._e | 0
  14643. var ar = this._a | 0
  14644. var br = this._b | 0
  14645. var cr = this._c | 0
  14646. var dr = this._d | 0
  14647. var er = this._e | 0
  14648. // computation
  14649. for (var i = 0; i < 80; i += 1) {
  14650. var tl
  14651. var tr
  14652. if (i < 16) {
  14653. tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])
  14654. tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])
  14655. } else if (i < 32) {
  14656. tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])
  14657. tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])
  14658. } else if (i < 48) {
  14659. tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])
  14660. tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])
  14661. } else if (i < 64) {
  14662. tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])
  14663. tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])
  14664. } else { // if (i<80) {
  14665. tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])
  14666. tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])
  14667. }
  14668. al = el
  14669. el = dl
  14670. dl = rotl(cl, 10)
  14671. cl = bl
  14672. bl = tl
  14673. ar = er
  14674. er = dr
  14675. dr = rotl(cr, 10)
  14676. cr = br
  14677. br = tr
  14678. }
  14679. // update state
  14680. var t = (this._b + cl + dr) | 0
  14681. this._b = (this._c + dl + er) | 0
  14682. this._c = (this._d + el + ar) | 0
  14683. this._d = (this._e + al + br) | 0
  14684. this._e = (this._a + bl + cr) | 0
  14685. this._a = t
  14686. }
  14687. RIPEMD160.prototype._digest = function () {
  14688. // create padding and handle blocks
  14689. this._block[this._blockOffset++] = 0x80
  14690. if (this._blockOffset > 56) {
  14691. this._block.fill(0, this._blockOffset, 64)
  14692. this._update()
  14693. this._blockOffset = 0
  14694. }
  14695. this._block.fill(0, this._blockOffset, 56)
  14696. this._block.writeUInt32LE(this._length[0], 56)
  14697. this._block.writeUInt32LE(this._length[1], 60)
  14698. this._update()
  14699. // produce result
  14700. var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)
  14701. buffer.writeInt32LE(this._a, 0)
  14702. buffer.writeInt32LE(this._b, 4)
  14703. buffer.writeInt32LE(this._c, 8)
  14704. buffer.writeInt32LE(this._d, 12)
  14705. buffer.writeInt32LE(this._e, 16)
  14706. return buffer
  14707. }
  14708. function rotl (x, n) {
  14709. return (x << n) | (x >>> (32 - n))
  14710. }
  14711. function fn1 (a, b, c, d, e, m, k, s) {
  14712. return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0
  14713. }
  14714. function fn2 (a, b, c, d, e, m, k, s) {
  14715. return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0
  14716. }
  14717. function fn3 (a, b, c, d, e, m, k, s) {
  14718. return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0
  14719. }
  14720. function fn4 (a, b, c, d, e, m, k, s) {
  14721. return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0
  14722. }
  14723. function fn5 (a, b, c, d, e, m, k, s) {
  14724. return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0
  14725. }
  14726. module.exports = RIPEMD160
  14727. /***/ }),
  14728. /* 113 */
  14729. /*!**************************************!*\
  14730. !*** ./node_modules/sha.js/index.js ***!
  14731. \**************************************/
  14732. /*! no static exports found */
  14733. /***/ (function(module, exports, __webpack_require__) {
  14734. var exports = module.exports = function SHA (algorithm) {
  14735. algorithm = algorithm.toLowerCase()
  14736. var Algorithm = exports[algorithm]
  14737. if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
  14738. return new Algorithm()
  14739. }
  14740. exports.sha = __webpack_require__(/*! ./sha */ 114)
  14741. exports.sha1 = __webpack_require__(/*! ./sha1 */ 116)
  14742. exports.sha224 = __webpack_require__(/*! ./sha224 */ 117)
  14743. exports.sha256 = __webpack_require__(/*! ./sha256 */ 118)
  14744. exports.sha384 = __webpack_require__(/*! ./sha384 */ 119)
  14745. exports.sha512 = __webpack_require__(/*! ./sha512 */ 120)
  14746. /***/ }),
  14747. /* 114 */
  14748. /*!************************************!*\
  14749. !*** ./node_modules/sha.js/sha.js ***!
  14750. \************************************/
  14751. /*! no static exports found */
  14752. /***/ (function(module, exports, __webpack_require__) {
  14753. /*
  14754. * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
  14755. * in FIPS PUB 180-1
  14756. * This source code is derived from sha1.js of the same repository.
  14757. * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
  14758. * operation was added.
  14759. */
  14760. var inherits = __webpack_require__(/*! inherits */ 93)
  14761. var Hash = __webpack_require__(/*! ./hash */ 115)
  14762. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  14763. var K = [
  14764. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  14765. ]
  14766. var W = new Array(80)
  14767. function Sha () {
  14768. this.init()
  14769. this._w = W
  14770. Hash.call(this, 64, 56)
  14771. }
  14772. inherits(Sha, Hash)
  14773. Sha.prototype.init = function () {
  14774. this._a = 0x67452301
  14775. this._b = 0xefcdab89
  14776. this._c = 0x98badcfe
  14777. this._d = 0x10325476
  14778. this._e = 0xc3d2e1f0
  14779. return this
  14780. }
  14781. function rotl5 (num) {
  14782. return (num << 5) | (num >>> 27)
  14783. }
  14784. function rotl30 (num) {
  14785. return (num << 30) | (num >>> 2)
  14786. }
  14787. function ft (s, b, c, d) {
  14788. if (s === 0) return (b & c) | ((~b) & d)
  14789. if (s === 2) return (b & c) | (b & d) | (c & d)
  14790. return b ^ c ^ d
  14791. }
  14792. Sha.prototype._update = function (M) {
  14793. var W = this._w
  14794. var a = this._a | 0
  14795. var b = this._b | 0
  14796. var c = this._c | 0
  14797. var d = this._d | 0
  14798. var e = this._e | 0
  14799. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  14800. for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
  14801. for (var j = 0; j < 80; ++j) {
  14802. var s = ~~(j / 20)
  14803. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  14804. e = d
  14805. d = c
  14806. c = rotl30(b)
  14807. b = a
  14808. a = t
  14809. }
  14810. this._a = (a + this._a) | 0
  14811. this._b = (b + this._b) | 0
  14812. this._c = (c + this._c) | 0
  14813. this._d = (d + this._d) | 0
  14814. this._e = (e + this._e) | 0
  14815. }
  14816. Sha.prototype._hash = function () {
  14817. var H = Buffer.allocUnsafe(20)
  14818. H.writeInt32BE(this._a | 0, 0)
  14819. H.writeInt32BE(this._b | 0, 4)
  14820. H.writeInt32BE(this._c | 0, 8)
  14821. H.writeInt32BE(this._d | 0, 12)
  14822. H.writeInt32BE(this._e | 0, 16)
  14823. return H
  14824. }
  14825. module.exports = Sha
  14826. /***/ }),
  14827. /* 115 */
  14828. /*!*************************************!*\
  14829. !*** ./node_modules/sha.js/hash.js ***!
  14830. \*************************************/
  14831. /*! no static exports found */
  14832. /***/ (function(module, exports, __webpack_require__) {
  14833. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  14834. // prototype class for hash functions
  14835. function Hash (blockSize, finalSize) {
  14836. this._block = Buffer.alloc(blockSize)
  14837. this._finalSize = finalSize
  14838. this._blockSize = blockSize
  14839. this._len = 0
  14840. }
  14841. Hash.prototype.update = function (data, enc) {
  14842. if (typeof data === 'string') {
  14843. enc = enc || 'utf8'
  14844. data = Buffer.from(data, enc)
  14845. }
  14846. var block = this._block
  14847. var blockSize = this._blockSize
  14848. var length = data.length
  14849. var accum = this._len
  14850. for (var offset = 0; offset < length;) {
  14851. var assigned = accum % blockSize
  14852. var remainder = Math.min(length - offset, blockSize - assigned)
  14853. for (var i = 0; i < remainder; i++) {
  14854. block[assigned + i] = data[offset + i]
  14855. }
  14856. accum += remainder
  14857. offset += remainder
  14858. if ((accum % blockSize) === 0) {
  14859. this._update(block)
  14860. }
  14861. }
  14862. this._len += length
  14863. return this
  14864. }
  14865. Hash.prototype.digest = function (enc) {
  14866. var rem = this._len % this._blockSize
  14867. this._block[rem] = 0x80
  14868. // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
  14869. // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
  14870. this._block.fill(0, rem + 1)
  14871. if (rem >= this._finalSize) {
  14872. this._update(this._block)
  14873. this._block.fill(0)
  14874. }
  14875. var bits = this._len * 8
  14876. // uint32
  14877. if (bits <= 0xffffffff) {
  14878. this._block.writeUInt32BE(bits, this._blockSize - 4)
  14879. // uint64
  14880. } else {
  14881. var lowBits = (bits & 0xffffffff) >>> 0
  14882. var highBits = (bits - lowBits) / 0x100000000
  14883. this._block.writeUInt32BE(highBits, this._blockSize - 8)
  14884. this._block.writeUInt32BE(lowBits, this._blockSize - 4)
  14885. }
  14886. this._update(this._block)
  14887. var hash = this._hash()
  14888. return enc ? hash.toString(enc) : hash
  14889. }
  14890. Hash.prototype._update = function () {
  14891. throw new Error('_update must be implemented by subclass')
  14892. }
  14893. module.exports = Hash
  14894. /***/ }),
  14895. /* 116 */
  14896. /*!*************************************!*\
  14897. !*** ./node_modules/sha.js/sha1.js ***!
  14898. \*************************************/
  14899. /*! no static exports found */
  14900. /***/ (function(module, exports, __webpack_require__) {
  14901. /*
  14902. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  14903. * in FIPS PUB 180-1
  14904. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  14905. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  14906. * Distributed under the BSD License
  14907. * See http://pajhome.org.uk/crypt/md5 for details.
  14908. */
  14909. var inherits = __webpack_require__(/*! inherits */ 93)
  14910. var Hash = __webpack_require__(/*! ./hash */ 115)
  14911. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  14912. var K = [
  14913. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  14914. ]
  14915. var W = new Array(80)
  14916. function Sha1 () {
  14917. this.init()
  14918. this._w = W
  14919. Hash.call(this, 64, 56)
  14920. }
  14921. inherits(Sha1, Hash)
  14922. Sha1.prototype.init = function () {
  14923. this._a = 0x67452301
  14924. this._b = 0xefcdab89
  14925. this._c = 0x98badcfe
  14926. this._d = 0x10325476
  14927. this._e = 0xc3d2e1f0
  14928. return this
  14929. }
  14930. function rotl1 (num) {
  14931. return (num << 1) | (num >>> 31)
  14932. }
  14933. function rotl5 (num) {
  14934. return (num << 5) | (num >>> 27)
  14935. }
  14936. function rotl30 (num) {
  14937. return (num << 30) | (num >>> 2)
  14938. }
  14939. function ft (s, b, c, d) {
  14940. if (s === 0) return (b & c) | ((~b) & d)
  14941. if (s === 2) return (b & c) | (b & d) | (c & d)
  14942. return b ^ c ^ d
  14943. }
  14944. Sha1.prototype._update = function (M) {
  14945. var W = this._w
  14946. var a = this._a | 0
  14947. var b = this._b | 0
  14948. var c = this._c | 0
  14949. var d = this._d | 0
  14950. var e = this._e | 0
  14951. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  14952. for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
  14953. for (var j = 0; j < 80; ++j) {
  14954. var s = ~~(j / 20)
  14955. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  14956. e = d
  14957. d = c
  14958. c = rotl30(b)
  14959. b = a
  14960. a = t
  14961. }
  14962. this._a = (a + this._a) | 0
  14963. this._b = (b + this._b) | 0
  14964. this._c = (c + this._c) | 0
  14965. this._d = (d + this._d) | 0
  14966. this._e = (e + this._e) | 0
  14967. }
  14968. Sha1.prototype._hash = function () {
  14969. var H = Buffer.allocUnsafe(20)
  14970. H.writeInt32BE(this._a | 0, 0)
  14971. H.writeInt32BE(this._b | 0, 4)
  14972. H.writeInt32BE(this._c | 0, 8)
  14973. H.writeInt32BE(this._d | 0, 12)
  14974. H.writeInt32BE(this._e | 0, 16)
  14975. return H
  14976. }
  14977. module.exports = Sha1
  14978. /***/ }),
  14979. /* 117 */
  14980. /*!***************************************!*\
  14981. !*** ./node_modules/sha.js/sha224.js ***!
  14982. \***************************************/
  14983. /*! no static exports found */
  14984. /***/ (function(module, exports, __webpack_require__) {
  14985. /**
  14986. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  14987. * in FIPS 180-2
  14988. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  14989. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  14990. *
  14991. */
  14992. var inherits = __webpack_require__(/*! inherits */ 93)
  14993. var Sha256 = __webpack_require__(/*! ./sha256 */ 118)
  14994. var Hash = __webpack_require__(/*! ./hash */ 115)
  14995. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  14996. var W = new Array(64)
  14997. function Sha224 () {
  14998. this.init()
  14999. this._w = W // new Array(64)
  15000. Hash.call(this, 64, 56)
  15001. }
  15002. inherits(Sha224, Sha256)
  15003. Sha224.prototype.init = function () {
  15004. this._a = 0xc1059ed8
  15005. this._b = 0x367cd507
  15006. this._c = 0x3070dd17
  15007. this._d = 0xf70e5939
  15008. this._e = 0xffc00b31
  15009. this._f = 0x68581511
  15010. this._g = 0x64f98fa7
  15011. this._h = 0xbefa4fa4
  15012. return this
  15013. }
  15014. Sha224.prototype._hash = function () {
  15015. var H = Buffer.allocUnsafe(28)
  15016. H.writeInt32BE(this._a, 0)
  15017. H.writeInt32BE(this._b, 4)
  15018. H.writeInt32BE(this._c, 8)
  15019. H.writeInt32BE(this._d, 12)
  15020. H.writeInt32BE(this._e, 16)
  15021. H.writeInt32BE(this._f, 20)
  15022. H.writeInt32BE(this._g, 24)
  15023. return H
  15024. }
  15025. module.exports = Sha224
  15026. /***/ }),
  15027. /* 118 */
  15028. /*!***************************************!*\
  15029. !*** ./node_modules/sha.js/sha256.js ***!
  15030. \***************************************/
  15031. /*! no static exports found */
  15032. /***/ (function(module, exports, __webpack_require__) {
  15033. /**
  15034. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  15035. * in FIPS 180-2
  15036. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  15037. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  15038. *
  15039. */
  15040. var inherits = __webpack_require__(/*! inherits */ 93)
  15041. var Hash = __webpack_require__(/*! ./hash */ 115)
  15042. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15043. var K = [
  15044. 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
  15045. 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
  15046. 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
  15047. 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
  15048. 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
  15049. 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
  15050. 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
  15051. 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
  15052. 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
  15053. 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
  15054. 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
  15055. 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
  15056. 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
  15057. 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
  15058. 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
  15059. 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
  15060. ]
  15061. var W = new Array(64)
  15062. function Sha256 () {
  15063. this.init()
  15064. this._w = W // new Array(64)
  15065. Hash.call(this, 64, 56)
  15066. }
  15067. inherits(Sha256, Hash)
  15068. Sha256.prototype.init = function () {
  15069. this._a = 0x6a09e667
  15070. this._b = 0xbb67ae85
  15071. this._c = 0x3c6ef372
  15072. this._d = 0xa54ff53a
  15073. this._e = 0x510e527f
  15074. this._f = 0x9b05688c
  15075. this._g = 0x1f83d9ab
  15076. this._h = 0x5be0cd19
  15077. return this
  15078. }
  15079. function ch (x, y, z) {
  15080. return z ^ (x & (y ^ z))
  15081. }
  15082. function maj (x, y, z) {
  15083. return (x & y) | (z & (x | y))
  15084. }
  15085. function sigma0 (x) {
  15086. return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
  15087. }
  15088. function sigma1 (x) {
  15089. return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
  15090. }
  15091. function gamma0 (x) {
  15092. return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
  15093. }
  15094. function gamma1 (x) {
  15095. return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
  15096. }
  15097. Sha256.prototype._update = function (M) {
  15098. var W = this._w
  15099. var a = this._a | 0
  15100. var b = this._b | 0
  15101. var c = this._c | 0
  15102. var d = this._d | 0
  15103. var e = this._e | 0
  15104. var f = this._f | 0
  15105. var g = this._g | 0
  15106. var h = this._h | 0
  15107. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  15108. for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
  15109. for (var j = 0; j < 64; ++j) {
  15110. var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
  15111. var T2 = (sigma0(a) + maj(a, b, c)) | 0
  15112. h = g
  15113. g = f
  15114. f = e
  15115. e = (d + T1) | 0
  15116. d = c
  15117. c = b
  15118. b = a
  15119. a = (T1 + T2) | 0
  15120. }
  15121. this._a = (a + this._a) | 0
  15122. this._b = (b + this._b) | 0
  15123. this._c = (c + this._c) | 0
  15124. this._d = (d + this._d) | 0
  15125. this._e = (e + this._e) | 0
  15126. this._f = (f + this._f) | 0
  15127. this._g = (g + this._g) | 0
  15128. this._h = (h + this._h) | 0
  15129. }
  15130. Sha256.prototype._hash = function () {
  15131. var H = Buffer.allocUnsafe(32)
  15132. H.writeInt32BE(this._a, 0)
  15133. H.writeInt32BE(this._b, 4)
  15134. H.writeInt32BE(this._c, 8)
  15135. H.writeInt32BE(this._d, 12)
  15136. H.writeInt32BE(this._e, 16)
  15137. H.writeInt32BE(this._f, 20)
  15138. H.writeInt32BE(this._g, 24)
  15139. H.writeInt32BE(this._h, 28)
  15140. return H
  15141. }
  15142. module.exports = Sha256
  15143. /***/ }),
  15144. /* 119 */
  15145. /*!***************************************!*\
  15146. !*** ./node_modules/sha.js/sha384.js ***!
  15147. \***************************************/
  15148. /*! no static exports found */
  15149. /***/ (function(module, exports, __webpack_require__) {
  15150. var inherits = __webpack_require__(/*! inherits */ 93)
  15151. var SHA512 = __webpack_require__(/*! ./sha512 */ 120)
  15152. var Hash = __webpack_require__(/*! ./hash */ 115)
  15153. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15154. var W = new Array(160)
  15155. function Sha384 () {
  15156. this.init()
  15157. this._w = W
  15158. Hash.call(this, 128, 112)
  15159. }
  15160. inherits(Sha384, SHA512)
  15161. Sha384.prototype.init = function () {
  15162. this._ah = 0xcbbb9d5d
  15163. this._bh = 0x629a292a
  15164. this._ch = 0x9159015a
  15165. this._dh = 0x152fecd8
  15166. this._eh = 0x67332667
  15167. this._fh = 0x8eb44a87
  15168. this._gh = 0xdb0c2e0d
  15169. this._hh = 0x47b5481d
  15170. this._al = 0xc1059ed8
  15171. this._bl = 0x367cd507
  15172. this._cl = 0x3070dd17
  15173. this._dl = 0xf70e5939
  15174. this._el = 0xffc00b31
  15175. this._fl = 0x68581511
  15176. this._gl = 0x64f98fa7
  15177. this._hl = 0xbefa4fa4
  15178. return this
  15179. }
  15180. Sha384.prototype._hash = function () {
  15181. var H = Buffer.allocUnsafe(48)
  15182. function writeInt64BE (h, l, offset) {
  15183. H.writeInt32BE(h, offset)
  15184. H.writeInt32BE(l, offset + 4)
  15185. }
  15186. writeInt64BE(this._ah, this._al, 0)
  15187. writeInt64BE(this._bh, this._bl, 8)
  15188. writeInt64BE(this._ch, this._cl, 16)
  15189. writeInt64BE(this._dh, this._dl, 24)
  15190. writeInt64BE(this._eh, this._el, 32)
  15191. writeInt64BE(this._fh, this._fl, 40)
  15192. return H
  15193. }
  15194. module.exports = Sha384
  15195. /***/ }),
  15196. /* 120 */
  15197. /*!***************************************!*\
  15198. !*** ./node_modules/sha.js/sha512.js ***!
  15199. \***************************************/
  15200. /*! no static exports found */
  15201. /***/ (function(module, exports, __webpack_require__) {
  15202. var inherits = __webpack_require__(/*! inherits */ 93)
  15203. var Hash = __webpack_require__(/*! ./hash */ 115)
  15204. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15205. var K = [
  15206. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  15207. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  15208. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  15209. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  15210. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  15211. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  15212. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  15213. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  15214. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  15215. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  15216. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  15217. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  15218. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  15219. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  15220. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  15221. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  15222. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  15223. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  15224. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  15225. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  15226. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  15227. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  15228. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  15229. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  15230. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  15231. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  15232. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  15233. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  15234. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  15235. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  15236. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  15237. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  15238. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  15239. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  15240. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  15241. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  15242. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  15243. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  15244. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  15245. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  15246. ]
  15247. var W = new Array(160)
  15248. function Sha512 () {
  15249. this.init()
  15250. this._w = W
  15251. Hash.call(this, 128, 112)
  15252. }
  15253. inherits(Sha512, Hash)
  15254. Sha512.prototype.init = function () {
  15255. this._ah = 0x6a09e667
  15256. this._bh = 0xbb67ae85
  15257. this._ch = 0x3c6ef372
  15258. this._dh = 0xa54ff53a
  15259. this._eh = 0x510e527f
  15260. this._fh = 0x9b05688c
  15261. this._gh = 0x1f83d9ab
  15262. this._hh = 0x5be0cd19
  15263. this._al = 0xf3bcc908
  15264. this._bl = 0x84caa73b
  15265. this._cl = 0xfe94f82b
  15266. this._dl = 0x5f1d36f1
  15267. this._el = 0xade682d1
  15268. this._fl = 0x2b3e6c1f
  15269. this._gl = 0xfb41bd6b
  15270. this._hl = 0x137e2179
  15271. return this
  15272. }
  15273. function Ch (x, y, z) {
  15274. return z ^ (x & (y ^ z))
  15275. }
  15276. function maj (x, y, z) {
  15277. return (x & y) | (z & (x | y))
  15278. }
  15279. function sigma0 (x, xl) {
  15280. return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
  15281. }
  15282. function sigma1 (x, xl) {
  15283. return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
  15284. }
  15285. function Gamma0 (x, xl) {
  15286. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
  15287. }
  15288. function Gamma0l (x, xl) {
  15289. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
  15290. }
  15291. function Gamma1 (x, xl) {
  15292. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
  15293. }
  15294. function Gamma1l (x, xl) {
  15295. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
  15296. }
  15297. function getCarry (a, b) {
  15298. return (a >>> 0) < (b >>> 0) ? 1 : 0
  15299. }
  15300. Sha512.prototype._update = function (M) {
  15301. var W = this._w
  15302. var ah = this._ah | 0
  15303. var bh = this._bh | 0
  15304. var ch = this._ch | 0
  15305. var dh = this._dh | 0
  15306. var eh = this._eh | 0
  15307. var fh = this._fh | 0
  15308. var gh = this._gh | 0
  15309. var hh = this._hh | 0
  15310. var al = this._al | 0
  15311. var bl = this._bl | 0
  15312. var cl = this._cl | 0
  15313. var dl = this._dl | 0
  15314. var el = this._el | 0
  15315. var fl = this._fl | 0
  15316. var gl = this._gl | 0
  15317. var hl = this._hl | 0
  15318. for (var i = 0; i < 32; i += 2) {
  15319. W[i] = M.readInt32BE(i * 4)
  15320. W[i + 1] = M.readInt32BE(i * 4 + 4)
  15321. }
  15322. for (; i < 160; i += 2) {
  15323. var xh = W[i - 15 * 2]
  15324. var xl = W[i - 15 * 2 + 1]
  15325. var gamma0 = Gamma0(xh, xl)
  15326. var gamma0l = Gamma0l(xl, xh)
  15327. xh = W[i - 2 * 2]
  15328. xl = W[i - 2 * 2 + 1]
  15329. var gamma1 = Gamma1(xh, xl)
  15330. var gamma1l = Gamma1l(xl, xh)
  15331. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  15332. var Wi7h = W[i - 7 * 2]
  15333. var Wi7l = W[i - 7 * 2 + 1]
  15334. var Wi16h = W[i - 16 * 2]
  15335. var Wi16l = W[i - 16 * 2 + 1]
  15336. var Wil = (gamma0l + Wi7l) | 0
  15337. var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
  15338. Wil = (Wil + gamma1l) | 0
  15339. Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
  15340. Wil = (Wil + Wi16l) | 0
  15341. Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
  15342. W[i] = Wih
  15343. W[i + 1] = Wil
  15344. }
  15345. for (var j = 0; j < 160; j += 2) {
  15346. Wih = W[j]
  15347. Wil = W[j + 1]
  15348. var majh = maj(ah, bh, ch)
  15349. var majl = maj(al, bl, cl)
  15350. var sigma0h = sigma0(ah, al)
  15351. var sigma0l = sigma0(al, ah)
  15352. var sigma1h = sigma1(eh, el)
  15353. var sigma1l = sigma1(el, eh)
  15354. // t1 = h + sigma1 + ch + K[j] + W[j]
  15355. var Kih = K[j]
  15356. var Kil = K[j + 1]
  15357. var chh = Ch(eh, fh, gh)
  15358. var chl = Ch(el, fl, gl)
  15359. var t1l = (hl + sigma1l) | 0
  15360. var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
  15361. t1l = (t1l + chl) | 0
  15362. t1h = (t1h + chh + getCarry(t1l, chl)) | 0
  15363. t1l = (t1l + Kil) | 0
  15364. t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
  15365. t1l = (t1l + Wil) | 0
  15366. t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
  15367. // t2 = sigma0 + maj
  15368. var t2l = (sigma0l + majl) | 0
  15369. var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
  15370. hh = gh
  15371. hl = gl
  15372. gh = fh
  15373. gl = fl
  15374. fh = eh
  15375. fl = el
  15376. el = (dl + t1l) | 0
  15377. eh = (dh + t1h + getCarry(el, dl)) | 0
  15378. dh = ch
  15379. dl = cl
  15380. ch = bh
  15381. cl = bl
  15382. bh = ah
  15383. bl = al
  15384. al = (t1l + t2l) | 0
  15385. ah = (t1h + t2h + getCarry(al, t1l)) | 0
  15386. }
  15387. this._al = (this._al + al) | 0
  15388. this._bl = (this._bl + bl) | 0
  15389. this._cl = (this._cl + cl) | 0
  15390. this._dl = (this._dl + dl) | 0
  15391. this._el = (this._el + el) | 0
  15392. this._fl = (this._fl + fl) | 0
  15393. this._gl = (this._gl + gl) | 0
  15394. this._hl = (this._hl + hl) | 0
  15395. this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
  15396. this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
  15397. this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
  15398. this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
  15399. this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
  15400. this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
  15401. this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
  15402. this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
  15403. }
  15404. Sha512.prototype._hash = function () {
  15405. var H = Buffer.allocUnsafe(64)
  15406. function writeInt64BE (h, l, offset) {
  15407. H.writeInt32BE(h, offset)
  15408. H.writeInt32BE(l, offset + 4)
  15409. }
  15410. writeInt64BE(this._ah, this._al, 0)
  15411. writeInt64BE(this._bh, this._bl, 8)
  15412. writeInt64BE(this._ch, this._cl, 16)
  15413. writeInt64BE(this._dh, this._dl, 24)
  15414. writeInt64BE(this._eh, this._el, 32)
  15415. writeInt64BE(this._fh, this._fl, 40)
  15416. writeInt64BE(this._gh, this._gl, 48)
  15417. writeInt64BE(this._hh, this._hl, 56)
  15418. return H
  15419. }
  15420. module.exports = Sha512
  15421. /***/ }),
  15422. /* 121 */
  15423. /*!*******************************************!*\
  15424. !*** ./node_modules/cipher-base/index.js ***!
  15425. \*******************************************/
  15426. /*! no static exports found */
  15427. /***/ (function(module, exports, __webpack_require__) {
  15428. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15429. var Transform = __webpack_require__(/*! stream */ 122).Transform
  15430. var StringDecoder = __webpack_require__(/*! string_decoder */ 109).StringDecoder
  15431. var inherits = __webpack_require__(/*! inherits */ 93)
  15432. function CipherBase (hashMode) {
  15433. Transform.call(this)
  15434. this.hashMode = typeof hashMode === 'string'
  15435. if (this.hashMode) {
  15436. this[hashMode] = this._finalOrDigest
  15437. } else {
  15438. this.final = this._finalOrDigest
  15439. }
  15440. if (this._final) {
  15441. this.__final = this._final
  15442. this._final = null
  15443. }
  15444. this._decoder = null
  15445. this._encoding = null
  15446. }
  15447. inherits(CipherBase, Transform)
  15448. CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
  15449. if (typeof data === 'string') {
  15450. data = Buffer.from(data, inputEnc)
  15451. }
  15452. var outData = this._update(data)
  15453. if (this.hashMode) return this
  15454. if (outputEnc) {
  15455. outData = this._toString(outData, outputEnc)
  15456. }
  15457. return outData
  15458. }
  15459. CipherBase.prototype.setAutoPadding = function () {}
  15460. CipherBase.prototype.getAuthTag = function () {
  15461. throw new Error('trying to get auth tag in unsupported state')
  15462. }
  15463. CipherBase.prototype.setAuthTag = function () {
  15464. throw new Error('trying to set auth tag in unsupported state')
  15465. }
  15466. CipherBase.prototype.setAAD = function () {
  15467. throw new Error('trying to set aad in unsupported state')
  15468. }
  15469. CipherBase.prototype._transform = function (data, _, next) {
  15470. var err
  15471. try {
  15472. if (this.hashMode) {
  15473. this._update(data)
  15474. } else {
  15475. this.push(this._update(data))
  15476. }
  15477. } catch (e) {
  15478. err = e
  15479. } finally {
  15480. next(err)
  15481. }
  15482. }
  15483. CipherBase.prototype._flush = function (done) {
  15484. var err
  15485. try {
  15486. this.push(this.__final())
  15487. } catch (e) {
  15488. err = e
  15489. }
  15490. done(err)
  15491. }
  15492. CipherBase.prototype._finalOrDigest = function (outputEnc) {
  15493. var outData = this.__final() || Buffer.alloc(0)
  15494. if (outputEnc) {
  15495. outData = this._toString(outData, outputEnc, true)
  15496. }
  15497. return outData
  15498. }
  15499. CipherBase.prototype._toString = function (value, enc, fin) {
  15500. if (!this._decoder) {
  15501. this._decoder = new StringDecoder(enc)
  15502. this._encoding = enc
  15503. }
  15504. if (this._encoding !== enc) throw new Error('can\'t switch encodings')
  15505. var out = this._decoder.write(value)
  15506. if (fin) {
  15507. out += this._decoder.end()
  15508. }
  15509. return out
  15510. }
  15511. module.exports = CipherBase
  15512. /***/ }),
  15513. /* 122 */
  15514. /*!*************************************************!*\
  15515. !*** ./node_modules/stream-browserify/index.js ***!
  15516. \*************************************************/
  15517. /*! no static exports found */
  15518. /***/ (function(module, exports, __webpack_require__) {
  15519. // Copyright Joyent, Inc. and other Node contributors.
  15520. //
  15521. // Permission is hereby granted, free of charge, to any person obtaining a
  15522. // copy of this software and associated documentation files (the
  15523. // "Software"), to deal in the Software without restriction, including
  15524. // without limitation the rights to use, copy, modify, merge, publish,
  15525. // distribute, sublicense, and/or sell copies of the Software, and to permit
  15526. // persons to whom the Software is furnished to do so, subject to the
  15527. // following conditions:
  15528. //
  15529. // The above copyright notice and this permission notice shall be included
  15530. // in all copies or substantial portions of the Software.
  15531. //
  15532. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15533. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15534. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15535. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15536. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15537. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15538. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  15539. module.exports = Stream;
  15540. var EE = __webpack_require__(/*! events */ 99).EventEmitter;
  15541. var inherits = __webpack_require__(/*! inherits */ 93);
  15542. inherits(Stream, EE);
  15543. Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ 96);
  15544. Stream.Writable = __webpack_require__(/*! readable-stream/writable.js */ 123);
  15545. Stream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ 124);
  15546. Stream.Transform = __webpack_require__(/*! readable-stream/transform.js */ 125);
  15547. Stream.PassThrough = __webpack_require__(/*! readable-stream/passthrough.js */ 126);
  15548. // Backwards-compat with node 0.4.x
  15549. Stream.Stream = Stream;
  15550. // old-style streams. Note that the pipe method (the only relevant
  15551. // part of this class) is overridden in the Readable class.
  15552. function Stream() {
  15553. EE.call(this);
  15554. }
  15555. Stream.prototype.pipe = function(dest, options) {
  15556. var source = this;
  15557. function ondata(chunk) {
  15558. if (dest.writable) {
  15559. if (false === dest.write(chunk) && source.pause) {
  15560. source.pause();
  15561. }
  15562. }
  15563. }
  15564. source.on('data', ondata);
  15565. function ondrain() {
  15566. if (source.readable && source.resume) {
  15567. source.resume();
  15568. }
  15569. }
  15570. dest.on('drain', ondrain);
  15571. // If the 'end' option is not supplied, dest.end() will be called when
  15572. // source gets the 'end' or 'close' events. Only dest.end() once.
  15573. if (!dest._isStdio && (!options || options.end !== false)) {
  15574. source.on('end', onend);
  15575. source.on('close', onclose);
  15576. }
  15577. var didOnEnd = false;
  15578. function onend() {
  15579. if (didOnEnd) return;
  15580. didOnEnd = true;
  15581. dest.end();
  15582. }
  15583. function onclose() {
  15584. if (didOnEnd) return;
  15585. didOnEnd = true;
  15586. if (typeof dest.destroy === 'function') dest.destroy();
  15587. }
  15588. // don't leave dangling pipes when there are errors.
  15589. function onerror(er) {
  15590. cleanup();
  15591. if (EE.listenerCount(this, 'error') === 0) {
  15592. throw er; // Unhandled stream error in pipe.
  15593. }
  15594. }
  15595. source.on('error', onerror);
  15596. dest.on('error', onerror);
  15597. // remove all the event listeners that were added.
  15598. function cleanup() {
  15599. source.removeListener('data', ondata);
  15600. dest.removeListener('drain', ondrain);
  15601. source.removeListener('end', onend);
  15602. source.removeListener('close', onclose);
  15603. source.removeListener('error', onerror);
  15604. dest.removeListener('error', onerror);
  15605. source.removeListener('end', cleanup);
  15606. source.removeListener('close', cleanup);
  15607. dest.removeListener('close', cleanup);
  15608. }
  15609. source.on('end', cleanup);
  15610. source.on('close', cleanup);
  15611. dest.on('close', cleanup);
  15612. dest.emit('pipe', source);
  15613. // Allow for unix-like usage: A.pipe(B).pipe(C)
  15614. return dest;
  15615. };
  15616. /***/ }),
  15617. /* 123 */
  15618. /*!**********************************************************!*\
  15619. !*** ./node_modules/readable-stream/writable-browser.js ***!
  15620. \**********************************************************/
  15621. /*! no static exports found */
  15622. /***/ (function(module, exports, __webpack_require__) {
  15623. module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ 107);
  15624. /***/ }),
  15625. /* 124 */
  15626. /*!********************************************************!*\
  15627. !*** ./node_modules/readable-stream/duplex-browser.js ***!
  15628. \********************************************************/
  15629. /*! no static exports found */
  15630. /***/ (function(module, exports, __webpack_require__) {
  15631. module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ 106);
  15632. /***/ }),
  15633. /* 125 */
  15634. /*!***************************************************!*\
  15635. !*** ./node_modules/readable-stream/transform.js ***!
  15636. \***************************************************/
  15637. /*! no static exports found */
  15638. /***/ (function(module, exports, __webpack_require__) {
  15639. module.exports = __webpack_require__(/*! ./readable */ 96).Transform
  15640. /***/ }),
  15641. /* 126 */
  15642. /*!*****************************************************!*\
  15643. !*** ./node_modules/readable-stream/passthrough.js ***!
  15644. \*****************************************************/
  15645. /*! no static exports found */
  15646. /***/ (function(module, exports, __webpack_require__) {
  15647. module.exports = __webpack_require__(/*! ./readable */ 96).PassThrough
  15648. /***/ }),
  15649. /* 127 */
  15650. /*!*********************************************!*\
  15651. !*** ./node_modules/create-hmac/browser.js ***!
  15652. \*********************************************/
  15653. /*! no static exports found */
  15654. /***/ (function(module, exports, __webpack_require__) {
  15655. "use strict";
  15656. var inherits = __webpack_require__(/*! inherits */ 93)
  15657. var Legacy = __webpack_require__(/*! ./legacy */ 128)
  15658. var Base = __webpack_require__(/*! cipher-base */ 121)
  15659. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15660. var md5 = __webpack_require__(/*! create-hash/md5 */ 129)
  15661. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 112)
  15662. var sha = __webpack_require__(/*! sha.js */ 113)
  15663. var ZEROS = Buffer.alloc(128)
  15664. function Hmac (alg, key) {
  15665. Base.call(this, 'digest')
  15666. if (typeof key === 'string') {
  15667. key = Buffer.from(key)
  15668. }
  15669. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  15670. this._alg = alg
  15671. this._key = key
  15672. if (key.length > blocksize) {
  15673. var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
  15674. key = hash.update(key).digest()
  15675. } else if (key.length < blocksize) {
  15676. key = Buffer.concat([key, ZEROS], blocksize)
  15677. }
  15678. var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
  15679. var opad = this._opad = Buffer.allocUnsafe(blocksize)
  15680. for (var i = 0; i < blocksize; i++) {
  15681. ipad[i] = key[i] ^ 0x36
  15682. opad[i] = key[i] ^ 0x5C
  15683. }
  15684. this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
  15685. this._hash.update(ipad)
  15686. }
  15687. inherits(Hmac, Base)
  15688. Hmac.prototype._update = function (data) {
  15689. this._hash.update(data)
  15690. }
  15691. Hmac.prototype._final = function () {
  15692. var h = this._hash.digest()
  15693. var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
  15694. return hash.update(this._opad).update(h).digest()
  15695. }
  15696. module.exports = function createHmac (alg, key) {
  15697. alg = alg.toLowerCase()
  15698. if (alg === 'rmd160' || alg === 'ripemd160') {
  15699. return new Hmac('rmd160', key)
  15700. }
  15701. if (alg === 'md5') {
  15702. return new Legacy(md5, key)
  15703. }
  15704. return new Hmac(alg, key)
  15705. }
  15706. /***/ }),
  15707. /* 128 */
  15708. /*!********************************************!*\
  15709. !*** ./node_modules/create-hmac/legacy.js ***!
  15710. \********************************************/
  15711. /*! no static exports found */
  15712. /***/ (function(module, exports, __webpack_require__) {
  15713. "use strict";
  15714. var inherits = __webpack_require__(/*! inherits */ 93)
  15715. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15716. var Base = __webpack_require__(/*! cipher-base */ 121)
  15717. var ZEROS = Buffer.alloc(128)
  15718. var blocksize = 64
  15719. function Hmac (alg, key) {
  15720. Base.call(this, 'digest')
  15721. if (typeof key === 'string') {
  15722. key = Buffer.from(key)
  15723. }
  15724. this._alg = alg
  15725. this._key = key
  15726. if (key.length > blocksize) {
  15727. key = alg(key)
  15728. } else if (key.length < blocksize) {
  15729. key = Buffer.concat([key, ZEROS], blocksize)
  15730. }
  15731. var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
  15732. var opad = this._opad = Buffer.allocUnsafe(blocksize)
  15733. for (var i = 0; i < blocksize; i++) {
  15734. ipad[i] = key[i] ^ 0x36
  15735. opad[i] = key[i] ^ 0x5C
  15736. }
  15737. this._hash = [ipad]
  15738. }
  15739. inherits(Hmac, Base)
  15740. Hmac.prototype._update = function (data) {
  15741. this._hash.push(data)
  15742. }
  15743. Hmac.prototype._final = function () {
  15744. var h = this._alg(Buffer.concat(this._hash))
  15745. return this._alg(Buffer.concat([this._opad, h]))
  15746. }
  15747. module.exports = Hmac
  15748. /***/ }),
  15749. /* 129 */
  15750. /*!*****************************************!*\
  15751. !*** ./node_modules/create-hash/md5.js ***!
  15752. \*****************************************/
  15753. /*! no static exports found */
  15754. /***/ (function(module, exports, __webpack_require__) {
  15755. var MD5 = __webpack_require__(/*! md5.js */ 94)
  15756. module.exports = function (buffer) {
  15757. return new MD5().update(buffer).digest()
  15758. }
  15759. /***/ }),
  15760. /* 130 */
  15761. /*!***********************************************!*\
  15762. !*** ./node_modules/browserify-sign/algos.js ***!
  15763. \***********************************************/
  15764. /*! no static exports found */
  15765. /***/ (function(module, exports, __webpack_require__) {
  15766. module.exports = __webpack_require__(/*! ./browser/algorithms.json */ 131)
  15767. /***/ }),
  15768. /* 131 */
  15769. /*!**************************************************************!*\
  15770. !*** ./node_modules/browserify-sign/browser/algorithms.json ***!
  15771. \**************************************************************/
  15772. /*! exports provided: sha224WithRSAEncryption, RSA-SHA224, sha256WithRSAEncryption, RSA-SHA256, sha384WithRSAEncryption, RSA-SHA384, sha512WithRSAEncryption, RSA-SHA512, RSA-SHA1, ecdsa-with-SHA1, sha256, sha224, sha384, sha512, DSA-SHA, DSA-SHA1, DSA, DSA-WITH-SHA224, DSA-SHA224, DSA-WITH-SHA256, DSA-SHA256, DSA-WITH-SHA384, DSA-SHA384, DSA-WITH-SHA512, DSA-SHA512, DSA-RIPEMD160, ripemd160WithRSA, RSA-RIPEMD160, md5WithRSAEncryption, RSA-MD5, default */
  15773. /***/ (function(module) {
  15774. module.exports = JSON.parse("{\"sha224WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"RSA-SHA224\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha224\",\"id\":\"302d300d06096086480165030402040500041c\"},\"sha256WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"RSA-SHA256\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha256\",\"id\":\"3031300d060960864801650304020105000420\"},\"sha384WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"RSA-SHA384\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha384\",\"id\":\"3041300d060960864801650304020205000430\"},\"sha512WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA512\":{\"sign\":\"ecdsa/rsa\",\"hash\":\"sha512\",\"id\":\"3051300d060960864801650304020305000440\"},\"RSA-SHA1\":{\"sign\":\"rsa\",\"hash\":\"sha1\",\"id\":\"3021300906052b0e03021a05000414\"},\"ecdsa-with-SHA1\":{\"sign\":\"ecdsa\",\"hash\":\"sha1\",\"id\":\"\"},\"sha256\":{\"sign\":\"ecdsa\",\"hash\":\"sha256\",\"id\":\"\"},\"sha224\":{\"sign\":\"ecdsa\",\"hash\":\"sha224\",\"id\":\"\"},\"sha384\":{\"sign\":\"ecdsa\",\"hash\":\"sha384\",\"id\":\"\"},\"sha512\":{\"sign\":\"ecdsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-SHA1\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA\":{\"sign\":\"dsa\",\"hash\":\"sha1\",\"id\":\"\"},\"DSA-WITH-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-SHA224\":{\"sign\":\"dsa\",\"hash\":\"sha224\",\"id\":\"\"},\"DSA-WITH-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-SHA256\":{\"sign\":\"dsa\",\"hash\":\"sha256\",\"id\":\"\"},\"DSA-WITH-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-SHA384\":{\"sign\":\"dsa\",\"hash\":\"sha384\",\"id\":\"\"},\"DSA-WITH-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-SHA512\":{\"sign\":\"dsa\",\"hash\":\"sha512\",\"id\":\"\"},\"DSA-RIPEMD160\":{\"sign\":\"dsa\",\"hash\":\"rmd160\",\"id\":\"\"},\"ripemd160WithRSA\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"RSA-RIPEMD160\":{\"sign\":\"rsa\",\"hash\":\"rmd160\",\"id\":\"3021300906052b2403020105000414\"},\"md5WithRSAEncryption\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"},\"RSA-MD5\":{\"sign\":\"rsa\",\"hash\":\"md5\",\"id\":\"3020300c06082a864886f70d020505000410\"}}");
  15775. /***/ }),
  15776. /* 132 */
  15777. /*!****************************************!*\
  15778. !*** ./node_modules/pbkdf2/browser.js ***!
  15779. \****************************************/
  15780. /*! no static exports found */
  15781. /***/ (function(module, exports, __webpack_require__) {
  15782. exports.pbkdf2 = __webpack_require__(/*! ./lib/async */ 133)
  15783. exports.pbkdf2Sync = __webpack_require__(/*! ./lib/sync */ 136)
  15784. /***/ }),
  15785. /* 133 */
  15786. /*!******************************************!*\
  15787. !*** ./node_modules/pbkdf2/lib/async.js ***!
  15788. \******************************************/
  15789. /*! no static exports found */
  15790. /***/ (function(module, exports, __webpack_require__) {
  15791. /* WEBPACK VAR INJECTION */(function(global, process) {var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15792. var checkParameters = __webpack_require__(/*! ./precondition */ 134)
  15793. var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 135)
  15794. var sync = __webpack_require__(/*! ./sync */ 136)
  15795. var toBuffer = __webpack_require__(/*! ./to-buffer */ 137)
  15796. var ZERO_BUF
  15797. var subtle = global.crypto && global.crypto.subtle
  15798. var toBrowser = {
  15799. sha: 'SHA-1',
  15800. 'sha-1': 'SHA-1',
  15801. sha1: 'SHA-1',
  15802. sha256: 'SHA-256',
  15803. 'sha-256': 'SHA-256',
  15804. sha384: 'SHA-384',
  15805. 'sha-384': 'SHA-384',
  15806. 'sha-512': 'SHA-512',
  15807. sha512: 'SHA-512'
  15808. }
  15809. var checks = []
  15810. function checkNative (algo) {
  15811. if (global.process && !global.process.browser) {
  15812. return Promise.resolve(false)
  15813. }
  15814. if (!subtle || !subtle.importKey || !subtle.deriveBits) {
  15815. return Promise.resolve(false)
  15816. }
  15817. if (checks[algo] !== undefined) {
  15818. return checks[algo]
  15819. }
  15820. ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
  15821. var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
  15822. .then(function () {
  15823. return true
  15824. }).catch(function () {
  15825. return false
  15826. })
  15827. checks[algo] = prom
  15828. return prom
  15829. }
  15830. function browserPbkdf2 (password, salt, iterations, length, algo) {
  15831. return subtle.importKey(
  15832. 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']
  15833. ).then(function (key) {
  15834. return subtle.deriveBits({
  15835. name: 'PBKDF2',
  15836. salt: salt,
  15837. iterations: iterations,
  15838. hash: {
  15839. name: algo
  15840. }
  15841. }, key, length << 3)
  15842. }).then(function (res) {
  15843. return Buffer.from(res)
  15844. })
  15845. }
  15846. function resolvePromise (promise, callback) {
  15847. promise.then(function (out) {
  15848. process.nextTick(function () {
  15849. callback(null, out)
  15850. })
  15851. }, function (e) {
  15852. process.nextTick(function () {
  15853. callback(e)
  15854. })
  15855. })
  15856. }
  15857. module.exports = function (password, salt, iterations, keylen, digest, callback) {
  15858. if (typeof digest === 'function') {
  15859. callback = digest
  15860. digest = undefined
  15861. }
  15862. digest = digest || 'sha1'
  15863. var algo = toBrowser[digest.toLowerCase()]
  15864. if (!algo || typeof global.Promise !== 'function') {
  15865. return process.nextTick(function () {
  15866. var out
  15867. try {
  15868. out = sync(password, salt, iterations, keylen, digest)
  15869. } catch (e) {
  15870. return callback(e)
  15871. }
  15872. callback(null, out)
  15873. })
  15874. }
  15875. checkParameters(iterations, keylen)
  15876. password = toBuffer(password, defaultEncoding, 'Password')
  15877. salt = toBuffer(salt, defaultEncoding, 'Salt')
  15878. if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
  15879. resolvePromise(checkNative(algo).then(function (resp) {
  15880. if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
  15881. return sync(password, salt, iterations, keylen, digest)
  15882. }), callback)
  15883. }
  15884. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 85)))
  15885. /***/ }),
  15886. /* 134 */
  15887. /*!*************************************************!*\
  15888. !*** ./node_modules/pbkdf2/lib/precondition.js ***!
  15889. \*************************************************/
  15890. /*! no static exports found */
  15891. /***/ (function(module, exports) {
  15892. var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
  15893. module.exports = function (iterations, keylen) {
  15894. if (typeof iterations !== 'number') {
  15895. throw new TypeError('Iterations not a number')
  15896. }
  15897. if (iterations < 0) {
  15898. throw new TypeError('Bad iterations')
  15899. }
  15900. if (typeof keylen !== 'number') {
  15901. throw new TypeError('Key length not a number')
  15902. }
  15903. if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
  15904. throw new TypeError('Bad key length')
  15905. }
  15906. }
  15907. /***/ }),
  15908. /* 135 */
  15909. /*!*****************************************************!*\
  15910. !*** ./node_modules/pbkdf2/lib/default-encoding.js ***!
  15911. \*****************************************************/
  15912. /*! no static exports found */
  15913. /***/ (function(module, exports, __webpack_require__) {
  15914. /* WEBPACK VAR INJECTION */(function(process) {var defaultEncoding
  15915. /* istanbul ignore next */
  15916. if (process.browser) {
  15917. defaultEncoding = 'utf-8'
  15918. } else if (process.version) {
  15919. var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
  15920. defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
  15921. } else {
  15922. defaultEncoding = 'utf-8'
  15923. }
  15924. module.exports = defaultEncoding
  15925. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 85)))
  15926. /***/ }),
  15927. /* 136 */
  15928. /*!*************************************************!*\
  15929. !*** ./node_modules/pbkdf2/lib/sync-browser.js ***!
  15930. \*************************************************/
  15931. /*! no static exports found */
  15932. /***/ (function(module, exports, __webpack_require__) {
  15933. var md5 = __webpack_require__(/*! create-hash/md5 */ 129)
  15934. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 112)
  15935. var sha = __webpack_require__(/*! sha.js */ 113)
  15936. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  15937. var checkParameters = __webpack_require__(/*! ./precondition */ 134)
  15938. var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 135)
  15939. var toBuffer = __webpack_require__(/*! ./to-buffer */ 137)
  15940. var ZEROS = Buffer.alloc(128)
  15941. var sizes = {
  15942. md5: 16,
  15943. sha1: 20,
  15944. sha224: 28,
  15945. sha256: 32,
  15946. sha384: 48,
  15947. sha512: 64,
  15948. rmd160: 20,
  15949. ripemd160: 20
  15950. }
  15951. function Hmac (alg, key, saltLen) {
  15952. var hash = getDigest(alg)
  15953. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  15954. if (key.length > blocksize) {
  15955. key = hash(key)
  15956. } else if (key.length < blocksize) {
  15957. key = Buffer.concat([key, ZEROS], blocksize)
  15958. }
  15959. var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
  15960. var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
  15961. for (var i = 0; i < blocksize; i++) {
  15962. ipad[i] = key[i] ^ 0x36
  15963. opad[i] = key[i] ^ 0x5C
  15964. }
  15965. var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
  15966. ipad.copy(ipad1, 0, 0, blocksize)
  15967. this.ipad1 = ipad1
  15968. this.ipad2 = ipad
  15969. this.opad = opad
  15970. this.alg = alg
  15971. this.blocksize = blocksize
  15972. this.hash = hash
  15973. this.size = sizes[alg]
  15974. }
  15975. Hmac.prototype.run = function (data, ipad) {
  15976. data.copy(ipad, this.blocksize)
  15977. var h = this.hash(ipad)
  15978. h.copy(this.opad, this.blocksize)
  15979. return this.hash(this.opad)
  15980. }
  15981. function getDigest (alg) {
  15982. function shaFunc (data) {
  15983. return sha(alg).update(data).digest()
  15984. }
  15985. function rmd160Func (data) {
  15986. return new RIPEMD160().update(data).digest()
  15987. }
  15988. if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func
  15989. if (alg === 'md5') return md5
  15990. return shaFunc
  15991. }
  15992. function pbkdf2 (password, salt, iterations, keylen, digest) {
  15993. checkParameters(iterations, keylen)
  15994. password = toBuffer(password, defaultEncoding, 'Password')
  15995. salt = toBuffer(salt, defaultEncoding, 'Salt')
  15996. digest = digest || 'sha1'
  15997. var hmac = new Hmac(digest, password, salt.length)
  15998. var DK = Buffer.allocUnsafe(keylen)
  15999. var block1 = Buffer.allocUnsafe(salt.length + 4)
  16000. salt.copy(block1, 0, 0, salt.length)
  16001. var destPos = 0
  16002. var hLen = sizes[digest]
  16003. var l = Math.ceil(keylen / hLen)
  16004. for (var i = 1; i <= l; i++) {
  16005. block1.writeUInt32BE(i, salt.length)
  16006. var T = hmac.run(block1, hmac.ipad1)
  16007. var U = T
  16008. for (var j = 1; j < iterations; j++) {
  16009. U = hmac.run(U, hmac.ipad2)
  16010. for (var k = 0; k < hLen; k++) T[k] ^= U[k]
  16011. }
  16012. T.copy(DK, destPos)
  16013. destPos += hLen
  16014. }
  16015. return DK
  16016. }
  16017. module.exports = pbkdf2
  16018. /***/ }),
  16019. /* 137 */
  16020. /*!**********************************************!*\
  16021. !*** ./node_modules/pbkdf2/lib/to-buffer.js ***!
  16022. \**********************************************/
  16023. /*! no static exports found */
  16024. /***/ (function(module, exports, __webpack_require__) {
  16025. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  16026. module.exports = function (thing, encoding, name) {
  16027. if (Buffer.isBuffer(thing)) {
  16028. return thing
  16029. } else if (typeof thing === 'string') {
  16030. return Buffer.from(thing, encoding)
  16031. } else if (ArrayBuffer.isView(thing)) {
  16032. return Buffer.from(thing.buffer)
  16033. } else {
  16034. throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')
  16035. }
  16036. }
  16037. /***/ }),
  16038. /* 138 */
  16039. /*!***************************************************!*\
  16040. !*** ./node_modules/browserify-cipher/browser.js ***!
  16041. \***************************************************/
  16042. /*! no static exports found */
  16043. /***/ (function(module, exports, __webpack_require__) {
  16044. var DES = __webpack_require__(/*! browserify-des */ 139)
  16045. var aes = __webpack_require__(/*! browserify-aes/browser */ 147)
  16046. var aesModes = __webpack_require__(/*! browserify-aes/modes */ 149)
  16047. var desModes = __webpack_require__(/*! browserify-des/modes */ 166)
  16048. var ebtk = __webpack_require__(/*! evp_bytestokey */ 164)
  16049. function createCipher (suite, password) {
  16050. suite = suite.toLowerCase()
  16051. var keyLen, ivLen
  16052. if (aesModes[suite]) {
  16053. keyLen = aesModes[suite].key
  16054. ivLen = aesModes[suite].iv
  16055. } else if (desModes[suite]) {
  16056. keyLen = desModes[suite].key * 8
  16057. ivLen = desModes[suite].iv
  16058. } else {
  16059. throw new TypeError('invalid suite type')
  16060. }
  16061. var keys = ebtk(password, false, keyLen, ivLen)
  16062. return createCipheriv(suite, keys.key, keys.iv)
  16063. }
  16064. function createDecipher (suite, password) {
  16065. suite = suite.toLowerCase()
  16066. var keyLen, ivLen
  16067. if (aesModes[suite]) {
  16068. keyLen = aesModes[suite].key
  16069. ivLen = aesModes[suite].iv
  16070. } else if (desModes[suite]) {
  16071. keyLen = desModes[suite].key * 8
  16072. ivLen = desModes[suite].iv
  16073. } else {
  16074. throw new TypeError('invalid suite type')
  16075. }
  16076. var keys = ebtk(password, false, keyLen, ivLen)
  16077. return createDecipheriv(suite, keys.key, keys.iv)
  16078. }
  16079. function createCipheriv (suite, key, iv) {
  16080. suite = suite.toLowerCase()
  16081. if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
  16082. if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
  16083. throw new TypeError('invalid suite type')
  16084. }
  16085. function createDecipheriv (suite, key, iv) {
  16086. suite = suite.toLowerCase()
  16087. if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
  16088. if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
  16089. throw new TypeError('invalid suite type')
  16090. }
  16091. function getCiphers () {
  16092. return Object.keys(desModes).concat(aes.getCiphers())
  16093. }
  16094. exports.createCipher = exports.Cipher = createCipher
  16095. exports.createCipheriv = exports.Cipheriv = createCipheriv
  16096. exports.createDecipher = exports.Decipher = createDecipher
  16097. exports.createDecipheriv = exports.Decipheriv = createDecipheriv
  16098. exports.listCiphers = exports.getCiphers = getCiphers
  16099. /***/ }),
  16100. /* 139 */
  16101. /*!**********************************************!*\
  16102. !*** ./node_modules/browserify-des/index.js ***!
  16103. \**********************************************/
  16104. /*! no static exports found */
  16105. /***/ (function(module, exports, __webpack_require__) {
  16106. var CipherBase = __webpack_require__(/*! cipher-base */ 121)
  16107. var des = __webpack_require__(/*! des.js */ 140)
  16108. var inherits = __webpack_require__(/*! inherits */ 93)
  16109. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  16110. var modes = {
  16111. 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
  16112. 'des-ede3': des.EDE,
  16113. 'des-ede-cbc': des.CBC.instantiate(des.EDE),
  16114. 'des-ede': des.EDE,
  16115. 'des-cbc': des.CBC.instantiate(des.DES),
  16116. 'des-ecb': des.DES
  16117. }
  16118. modes.des = modes['des-cbc']
  16119. modes.des3 = modes['des-ede3-cbc']
  16120. module.exports = DES
  16121. inherits(DES, CipherBase)
  16122. function DES (opts) {
  16123. CipherBase.call(this)
  16124. var modeName = opts.mode.toLowerCase()
  16125. var mode = modes[modeName]
  16126. var type
  16127. if (opts.decrypt) {
  16128. type = 'decrypt'
  16129. } else {
  16130. type = 'encrypt'
  16131. }
  16132. var key = opts.key
  16133. if (!Buffer.isBuffer(key)) {
  16134. key = Buffer.from(key)
  16135. }
  16136. if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
  16137. key = Buffer.concat([key, key.slice(0, 8)])
  16138. }
  16139. var iv = opts.iv
  16140. if (!Buffer.isBuffer(iv)) {
  16141. iv = Buffer.from(iv)
  16142. }
  16143. this._des = mode.create({
  16144. key: key,
  16145. iv: iv,
  16146. type: type
  16147. })
  16148. }
  16149. DES.prototype._update = function (data) {
  16150. return Buffer.from(this._des.update(data))
  16151. }
  16152. DES.prototype._final = function () {
  16153. return Buffer.from(this._des.final())
  16154. }
  16155. /***/ }),
  16156. /* 140 */
  16157. /*!****************************************!*\
  16158. !*** ./node_modules/des.js/lib/des.js ***!
  16159. \****************************************/
  16160. /*! no static exports found */
  16161. /***/ (function(module, exports, __webpack_require__) {
  16162. "use strict";
  16163. exports.utils = __webpack_require__(/*! ./des/utils */ 141);
  16164. exports.Cipher = __webpack_require__(/*! ./des/cipher */ 142);
  16165. exports.DES = __webpack_require__(/*! ./des/des */ 144);
  16166. exports.CBC = __webpack_require__(/*! ./des/cbc */ 145);
  16167. exports.EDE = __webpack_require__(/*! ./des/ede */ 146);
  16168. /***/ }),
  16169. /* 141 */
  16170. /*!**********************************************!*\
  16171. !*** ./node_modules/des.js/lib/des/utils.js ***!
  16172. \**********************************************/
  16173. /*! no static exports found */
  16174. /***/ (function(module, exports, __webpack_require__) {
  16175. "use strict";
  16176. exports.readUInt32BE = function readUInt32BE(bytes, off) {
  16177. var res = (bytes[0 + off] << 24) |
  16178. (bytes[1 + off] << 16) |
  16179. (bytes[2 + off] << 8) |
  16180. bytes[3 + off];
  16181. return res >>> 0;
  16182. };
  16183. exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
  16184. bytes[0 + off] = value >>> 24;
  16185. bytes[1 + off] = (value >>> 16) & 0xff;
  16186. bytes[2 + off] = (value >>> 8) & 0xff;
  16187. bytes[3 + off] = value & 0xff;
  16188. };
  16189. exports.ip = function ip(inL, inR, out, off) {
  16190. var outL = 0;
  16191. var outR = 0;
  16192. for (var i = 6; i >= 0; i -= 2) {
  16193. for (var j = 0; j <= 24; j += 8) {
  16194. outL <<= 1;
  16195. outL |= (inR >>> (j + i)) & 1;
  16196. }
  16197. for (var j = 0; j <= 24; j += 8) {
  16198. outL <<= 1;
  16199. outL |= (inL >>> (j + i)) & 1;
  16200. }
  16201. }
  16202. for (var i = 6; i >= 0; i -= 2) {
  16203. for (var j = 1; j <= 25; j += 8) {
  16204. outR <<= 1;
  16205. outR |= (inR >>> (j + i)) & 1;
  16206. }
  16207. for (var j = 1; j <= 25; j += 8) {
  16208. outR <<= 1;
  16209. outR |= (inL >>> (j + i)) & 1;
  16210. }
  16211. }
  16212. out[off + 0] = outL >>> 0;
  16213. out[off + 1] = outR >>> 0;
  16214. };
  16215. exports.rip = function rip(inL, inR, out, off) {
  16216. var outL = 0;
  16217. var outR = 0;
  16218. for (var i = 0; i < 4; i++) {
  16219. for (var j = 24; j >= 0; j -= 8) {
  16220. outL <<= 1;
  16221. outL |= (inR >>> (j + i)) & 1;
  16222. outL <<= 1;
  16223. outL |= (inL >>> (j + i)) & 1;
  16224. }
  16225. }
  16226. for (var i = 4; i < 8; i++) {
  16227. for (var j = 24; j >= 0; j -= 8) {
  16228. outR <<= 1;
  16229. outR |= (inR >>> (j + i)) & 1;
  16230. outR <<= 1;
  16231. outR |= (inL >>> (j + i)) & 1;
  16232. }
  16233. }
  16234. out[off + 0] = outL >>> 0;
  16235. out[off + 1] = outR >>> 0;
  16236. };
  16237. exports.pc1 = function pc1(inL, inR, out, off) {
  16238. var outL = 0;
  16239. var outR = 0;
  16240. // 7, 15, 23, 31, 39, 47, 55, 63
  16241. // 6, 14, 22, 30, 39, 47, 55, 63
  16242. // 5, 13, 21, 29, 39, 47, 55, 63
  16243. // 4, 12, 20, 28
  16244. for (var i = 7; i >= 5; i--) {
  16245. for (var j = 0; j <= 24; j += 8) {
  16246. outL <<= 1;
  16247. outL |= (inR >> (j + i)) & 1;
  16248. }
  16249. for (var j = 0; j <= 24; j += 8) {
  16250. outL <<= 1;
  16251. outL |= (inL >> (j + i)) & 1;
  16252. }
  16253. }
  16254. for (var j = 0; j <= 24; j += 8) {
  16255. outL <<= 1;
  16256. outL |= (inR >> (j + i)) & 1;
  16257. }
  16258. // 1, 9, 17, 25, 33, 41, 49, 57
  16259. // 2, 10, 18, 26, 34, 42, 50, 58
  16260. // 3, 11, 19, 27, 35, 43, 51, 59
  16261. // 36, 44, 52, 60
  16262. for (var i = 1; i <= 3; i++) {
  16263. for (var j = 0; j <= 24; j += 8) {
  16264. outR <<= 1;
  16265. outR |= (inR >> (j + i)) & 1;
  16266. }
  16267. for (var j = 0; j <= 24; j += 8) {
  16268. outR <<= 1;
  16269. outR |= (inL >> (j + i)) & 1;
  16270. }
  16271. }
  16272. for (var j = 0; j <= 24; j += 8) {
  16273. outR <<= 1;
  16274. outR |= (inL >> (j + i)) & 1;
  16275. }
  16276. out[off + 0] = outL >>> 0;
  16277. out[off + 1] = outR >>> 0;
  16278. };
  16279. exports.r28shl = function r28shl(num, shift) {
  16280. return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
  16281. };
  16282. var pc2table = [
  16283. // inL => outL
  16284. 14, 11, 17, 4, 27, 23, 25, 0,
  16285. 13, 22, 7, 18, 5, 9, 16, 24,
  16286. 2, 20, 12, 21, 1, 8, 15, 26,
  16287. // inR => outR
  16288. 15, 4, 25, 19, 9, 1, 26, 16,
  16289. 5, 11, 23, 8, 12, 7, 17, 0,
  16290. 22, 3, 10, 14, 6, 20, 27, 24
  16291. ];
  16292. exports.pc2 = function pc2(inL, inR, out, off) {
  16293. var outL = 0;
  16294. var outR = 0;
  16295. var len = pc2table.length >>> 1;
  16296. for (var i = 0; i < len; i++) {
  16297. outL <<= 1;
  16298. outL |= (inL >>> pc2table[i]) & 0x1;
  16299. }
  16300. for (var i = len; i < pc2table.length; i++) {
  16301. outR <<= 1;
  16302. outR |= (inR >>> pc2table[i]) & 0x1;
  16303. }
  16304. out[off + 0] = outL >>> 0;
  16305. out[off + 1] = outR >>> 0;
  16306. };
  16307. exports.expand = function expand(r, out, off) {
  16308. var outL = 0;
  16309. var outR = 0;
  16310. outL = ((r & 1) << 5) | (r >>> 27);
  16311. for (var i = 23; i >= 15; i -= 4) {
  16312. outL <<= 6;
  16313. outL |= (r >>> i) & 0x3f;
  16314. }
  16315. for (var i = 11; i >= 3; i -= 4) {
  16316. outR |= (r >>> i) & 0x3f;
  16317. outR <<= 6;
  16318. }
  16319. outR |= ((r & 0x1f) << 1) | (r >>> 31);
  16320. out[off + 0] = outL >>> 0;
  16321. out[off + 1] = outR >>> 0;
  16322. };
  16323. var sTable = [
  16324. 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
  16325. 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
  16326. 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
  16327. 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
  16328. 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
  16329. 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
  16330. 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
  16331. 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
  16332. 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
  16333. 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
  16334. 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
  16335. 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
  16336. 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
  16337. 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
  16338. 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
  16339. 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
  16340. 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
  16341. 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
  16342. 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
  16343. 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
  16344. 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
  16345. 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
  16346. 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
  16347. 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
  16348. 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
  16349. 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
  16350. 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
  16351. 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
  16352. 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
  16353. 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
  16354. 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
  16355. 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
  16356. ];
  16357. exports.substitute = function substitute(inL, inR) {
  16358. var out = 0;
  16359. for (var i = 0; i < 4; i++) {
  16360. var b = (inL >>> (18 - i * 6)) & 0x3f;
  16361. var sb = sTable[i * 0x40 + b];
  16362. out <<= 4;
  16363. out |= sb;
  16364. }
  16365. for (var i = 0; i < 4; i++) {
  16366. var b = (inR >>> (18 - i * 6)) & 0x3f;
  16367. var sb = sTable[4 * 0x40 + i * 0x40 + b];
  16368. out <<= 4;
  16369. out |= sb;
  16370. }
  16371. return out >>> 0;
  16372. };
  16373. var permuteTable = [
  16374. 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
  16375. 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
  16376. ];
  16377. exports.permute = function permute(num) {
  16378. var out = 0;
  16379. for (var i = 0; i < permuteTable.length; i++) {
  16380. out <<= 1;
  16381. out |= (num >>> permuteTable[i]) & 0x1;
  16382. }
  16383. return out >>> 0;
  16384. };
  16385. exports.padSplit = function padSplit(num, size, group) {
  16386. var str = num.toString(2);
  16387. while (str.length < size)
  16388. str = '0' + str;
  16389. var out = [];
  16390. for (var i = 0; i < size; i += group)
  16391. out.push(str.slice(i, i + group));
  16392. return out.join(' ');
  16393. };
  16394. /***/ }),
  16395. /* 142 */
  16396. /*!***********************************************!*\
  16397. !*** ./node_modules/des.js/lib/des/cipher.js ***!
  16398. \***********************************************/
  16399. /*! no static exports found */
  16400. /***/ (function(module, exports, __webpack_require__) {
  16401. "use strict";
  16402. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  16403. function Cipher(options) {
  16404. this.options = options;
  16405. this.type = this.options.type;
  16406. this.blockSize = 8;
  16407. this._init();
  16408. this.buffer = new Array(this.blockSize);
  16409. this.bufferOff = 0;
  16410. }
  16411. module.exports = Cipher;
  16412. Cipher.prototype._init = function _init() {
  16413. // Might be overrided
  16414. };
  16415. Cipher.prototype.update = function update(data) {
  16416. if (data.length === 0)
  16417. return [];
  16418. if (this.type === 'decrypt')
  16419. return this._updateDecrypt(data);
  16420. else
  16421. return this._updateEncrypt(data);
  16422. };
  16423. Cipher.prototype._buffer = function _buffer(data, off) {
  16424. // Append data to buffer
  16425. var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
  16426. for (var i = 0; i < min; i++)
  16427. this.buffer[this.bufferOff + i] = data[off + i];
  16428. this.bufferOff += min;
  16429. // Shift next
  16430. return min;
  16431. };
  16432. Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
  16433. this._update(this.buffer, 0, out, off);
  16434. this.bufferOff = 0;
  16435. return this.blockSize;
  16436. };
  16437. Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
  16438. var inputOff = 0;
  16439. var outputOff = 0;
  16440. var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
  16441. var out = new Array(count * this.blockSize);
  16442. if (this.bufferOff !== 0) {
  16443. inputOff += this._buffer(data, inputOff);
  16444. if (this.bufferOff === this.buffer.length)
  16445. outputOff += this._flushBuffer(out, outputOff);
  16446. }
  16447. // Write blocks
  16448. var max = data.length - ((data.length - inputOff) % this.blockSize);
  16449. for (; inputOff < max; inputOff += this.blockSize) {
  16450. this._update(data, inputOff, out, outputOff);
  16451. outputOff += this.blockSize;
  16452. }
  16453. // Queue rest
  16454. for (; inputOff < data.length; inputOff++, this.bufferOff++)
  16455. this.buffer[this.bufferOff] = data[inputOff];
  16456. return out;
  16457. };
  16458. Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
  16459. var inputOff = 0;
  16460. var outputOff = 0;
  16461. var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
  16462. var out = new Array(count * this.blockSize);
  16463. // TODO(indutny): optimize it, this is far from optimal
  16464. for (; count > 0; count--) {
  16465. inputOff += this._buffer(data, inputOff);
  16466. outputOff += this._flushBuffer(out, outputOff);
  16467. }
  16468. // Buffer rest of the input
  16469. inputOff += this._buffer(data, inputOff);
  16470. return out;
  16471. };
  16472. Cipher.prototype.final = function final(buffer) {
  16473. var first;
  16474. if (buffer)
  16475. first = this.update(buffer);
  16476. var last;
  16477. if (this.type === 'encrypt')
  16478. last = this._finalEncrypt();
  16479. else
  16480. last = this._finalDecrypt();
  16481. if (first)
  16482. return first.concat(last);
  16483. else
  16484. return last;
  16485. };
  16486. Cipher.prototype._pad = function _pad(buffer, off) {
  16487. if (off === 0)
  16488. return false;
  16489. while (off < buffer.length)
  16490. buffer[off++] = 0;
  16491. return true;
  16492. };
  16493. Cipher.prototype._finalEncrypt = function _finalEncrypt() {
  16494. if (!this._pad(this.buffer, this.bufferOff))
  16495. return [];
  16496. var out = new Array(this.blockSize);
  16497. this._update(this.buffer, 0, out, 0);
  16498. return out;
  16499. };
  16500. Cipher.prototype._unpad = function _unpad(buffer) {
  16501. return buffer;
  16502. };
  16503. Cipher.prototype._finalDecrypt = function _finalDecrypt() {
  16504. assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
  16505. var out = new Array(this.blockSize);
  16506. this._flushBuffer(out, 0);
  16507. return this._unpad(out);
  16508. };
  16509. /***/ }),
  16510. /* 143 */
  16511. /*!***************************************************!*\
  16512. !*** ./node_modules/minimalistic-assert/index.js ***!
  16513. \***************************************************/
  16514. /*! no static exports found */
  16515. /***/ (function(module, exports) {
  16516. module.exports = assert;
  16517. function assert(val, msg) {
  16518. if (!val)
  16519. throw new Error(msg || 'Assertion failed');
  16520. }
  16521. assert.equal = function assertEqual(l, r, msg) {
  16522. if (l != r)
  16523. throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
  16524. };
  16525. /***/ }),
  16526. /* 144 */
  16527. /*!********************************************!*\
  16528. !*** ./node_modules/des.js/lib/des/des.js ***!
  16529. \********************************************/
  16530. /*! no static exports found */
  16531. /***/ (function(module, exports, __webpack_require__) {
  16532. "use strict";
  16533. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  16534. var inherits = __webpack_require__(/*! inherits */ 93);
  16535. var utils = __webpack_require__(/*! ./utils */ 141);
  16536. var Cipher = __webpack_require__(/*! ./cipher */ 142);
  16537. function DESState() {
  16538. this.tmp = new Array(2);
  16539. this.keys = null;
  16540. }
  16541. function DES(options) {
  16542. Cipher.call(this, options);
  16543. var state = new DESState();
  16544. this._desState = state;
  16545. this.deriveKeys(state, options.key);
  16546. }
  16547. inherits(DES, Cipher);
  16548. module.exports = DES;
  16549. DES.create = function create(options) {
  16550. return new DES(options);
  16551. };
  16552. var shiftTable = [
  16553. 1, 1, 2, 2, 2, 2, 2, 2,
  16554. 1, 2, 2, 2, 2, 2, 2, 1
  16555. ];
  16556. DES.prototype.deriveKeys = function deriveKeys(state, key) {
  16557. state.keys = new Array(16 * 2);
  16558. assert.equal(key.length, this.blockSize, 'Invalid key length');
  16559. var kL = utils.readUInt32BE(key, 0);
  16560. var kR = utils.readUInt32BE(key, 4);
  16561. utils.pc1(kL, kR, state.tmp, 0);
  16562. kL = state.tmp[0];
  16563. kR = state.tmp[1];
  16564. for (var i = 0; i < state.keys.length; i += 2) {
  16565. var shift = shiftTable[i >>> 1];
  16566. kL = utils.r28shl(kL, shift);
  16567. kR = utils.r28shl(kR, shift);
  16568. utils.pc2(kL, kR, state.keys, i);
  16569. }
  16570. };
  16571. DES.prototype._update = function _update(inp, inOff, out, outOff) {
  16572. var state = this._desState;
  16573. var l = utils.readUInt32BE(inp, inOff);
  16574. var r = utils.readUInt32BE(inp, inOff + 4);
  16575. // Initial Permutation
  16576. utils.ip(l, r, state.tmp, 0);
  16577. l = state.tmp[0];
  16578. r = state.tmp[1];
  16579. if (this.type === 'encrypt')
  16580. this._encrypt(state, l, r, state.tmp, 0);
  16581. else
  16582. this._decrypt(state, l, r, state.tmp, 0);
  16583. l = state.tmp[0];
  16584. r = state.tmp[1];
  16585. utils.writeUInt32BE(out, l, outOff);
  16586. utils.writeUInt32BE(out, r, outOff + 4);
  16587. };
  16588. DES.prototype._pad = function _pad(buffer, off) {
  16589. var value = buffer.length - off;
  16590. for (var i = off; i < buffer.length; i++)
  16591. buffer[i] = value;
  16592. return true;
  16593. };
  16594. DES.prototype._unpad = function _unpad(buffer) {
  16595. var pad = buffer[buffer.length - 1];
  16596. for (var i = buffer.length - pad; i < buffer.length; i++)
  16597. assert.equal(buffer[i], pad);
  16598. return buffer.slice(0, buffer.length - pad);
  16599. };
  16600. DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
  16601. var l = lStart;
  16602. var r = rStart;
  16603. // Apply f() x16 times
  16604. for (var i = 0; i < state.keys.length; i += 2) {
  16605. var keyL = state.keys[i];
  16606. var keyR = state.keys[i + 1];
  16607. // f(r, k)
  16608. utils.expand(r, state.tmp, 0);
  16609. keyL ^= state.tmp[0];
  16610. keyR ^= state.tmp[1];
  16611. var s = utils.substitute(keyL, keyR);
  16612. var f = utils.permute(s);
  16613. var t = r;
  16614. r = (l ^ f) >>> 0;
  16615. l = t;
  16616. }
  16617. // Reverse Initial Permutation
  16618. utils.rip(r, l, out, off);
  16619. };
  16620. DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
  16621. var l = rStart;
  16622. var r = lStart;
  16623. // Apply f() x16 times
  16624. for (var i = state.keys.length - 2; i >= 0; i -= 2) {
  16625. var keyL = state.keys[i];
  16626. var keyR = state.keys[i + 1];
  16627. // f(r, k)
  16628. utils.expand(l, state.tmp, 0);
  16629. keyL ^= state.tmp[0];
  16630. keyR ^= state.tmp[1];
  16631. var s = utils.substitute(keyL, keyR);
  16632. var f = utils.permute(s);
  16633. var t = l;
  16634. l = (r ^ f) >>> 0;
  16635. r = t;
  16636. }
  16637. // Reverse Initial Permutation
  16638. utils.rip(l, r, out, off);
  16639. };
  16640. /***/ }),
  16641. /* 145 */
  16642. /*!********************************************!*\
  16643. !*** ./node_modules/des.js/lib/des/cbc.js ***!
  16644. \********************************************/
  16645. /*! no static exports found */
  16646. /***/ (function(module, exports, __webpack_require__) {
  16647. "use strict";
  16648. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  16649. var inherits = __webpack_require__(/*! inherits */ 93);
  16650. var proto = {};
  16651. function CBCState(iv) {
  16652. assert.equal(iv.length, 8, 'Invalid IV length');
  16653. this.iv = new Array(8);
  16654. for (var i = 0; i < this.iv.length; i++)
  16655. this.iv[i] = iv[i];
  16656. }
  16657. function instantiate(Base) {
  16658. function CBC(options) {
  16659. Base.call(this, options);
  16660. this._cbcInit();
  16661. }
  16662. inherits(CBC, Base);
  16663. var keys = Object.keys(proto);
  16664. for (var i = 0; i < keys.length; i++) {
  16665. var key = keys[i];
  16666. CBC.prototype[key] = proto[key];
  16667. }
  16668. CBC.create = function create(options) {
  16669. return new CBC(options);
  16670. };
  16671. return CBC;
  16672. }
  16673. exports.instantiate = instantiate;
  16674. proto._cbcInit = function _cbcInit() {
  16675. var state = new CBCState(this.options.iv);
  16676. this._cbcState = state;
  16677. };
  16678. proto._update = function _update(inp, inOff, out, outOff) {
  16679. var state = this._cbcState;
  16680. var superProto = this.constructor.super_.prototype;
  16681. var iv = state.iv;
  16682. if (this.type === 'encrypt') {
  16683. for (var i = 0; i < this.blockSize; i++)
  16684. iv[i] ^= inp[inOff + i];
  16685. superProto._update.call(this, iv, 0, out, outOff);
  16686. for (var i = 0; i < this.blockSize; i++)
  16687. iv[i] = out[outOff + i];
  16688. } else {
  16689. superProto._update.call(this, inp, inOff, out, outOff);
  16690. for (var i = 0; i < this.blockSize; i++)
  16691. out[outOff + i] ^= iv[i];
  16692. for (var i = 0; i < this.blockSize; i++)
  16693. iv[i] = inp[inOff + i];
  16694. }
  16695. };
  16696. /***/ }),
  16697. /* 146 */
  16698. /*!********************************************!*\
  16699. !*** ./node_modules/des.js/lib/des/ede.js ***!
  16700. \********************************************/
  16701. /*! no static exports found */
  16702. /***/ (function(module, exports, __webpack_require__) {
  16703. "use strict";
  16704. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  16705. var inherits = __webpack_require__(/*! inherits */ 93);
  16706. var Cipher = __webpack_require__(/*! ./cipher */ 142);
  16707. var DES = __webpack_require__(/*! ./des */ 144);
  16708. function EDEState(type, key) {
  16709. assert.equal(key.length, 24, 'Invalid key length');
  16710. var k1 = key.slice(0, 8);
  16711. var k2 = key.slice(8, 16);
  16712. var k3 = key.slice(16, 24);
  16713. if (type === 'encrypt') {
  16714. this.ciphers = [
  16715. DES.create({ type: 'encrypt', key: k1 }),
  16716. DES.create({ type: 'decrypt', key: k2 }),
  16717. DES.create({ type: 'encrypt', key: k3 })
  16718. ];
  16719. } else {
  16720. this.ciphers = [
  16721. DES.create({ type: 'decrypt', key: k3 }),
  16722. DES.create({ type: 'encrypt', key: k2 }),
  16723. DES.create({ type: 'decrypt', key: k1 })
  16724. ];
  16725. }
  16726. }
  16727. function EDE(options) {
  16728. Cipher.call(this, options);
  16729. var state = new EDEState(this.type, this.options.key);
  16730. this._edeState = state;
  16731. }
  16732. inherits(EDE, Cipher);
  16733. module.exports = EDE;
  16734. EDE.create = function create(options) {
  16735. return new EDE(options);
  16736. };
  16737. EDE.prototype._update = function _update(inp, inOff, out, outOff) {
  16738. var state = this._edeState;
  16739. state.ciphers[0]._update(inp, inOff, out, outOff);
  16740. state.ciphers[1]._update(out, outOff, out, outOff);
  16741. state.ciphers[2]._update(out, outOff, out, outOff);
  16742. };
  16743. EDE.prototype._pad = DES.prototype._pad;
  16744. EDE.prototype._unpad = DES.prototype._unpad;
  16745. /***/ }),
  16746. /* 147 */
  16747. /*!************************************************!*\
  16748. !*** ./node_modules/browserify-aes/browser.js ***!
  16749. \************************************************/
  16750. /*! no static exports found */
  16751. /***/ (function(module, exports, __webpack_require__) {
  16752. var ciphers = __webpack_require__(/*! ./encrypter */ 148)
  16753. var deciphers = __webpack_require__(/*! ./decrypter */ 165)
  16754. var modes = __webpack_require__(/*! ./modes/list.json */ 159)
  16755. function getCiphers () {
  16756. return Object.keys(modes)
  16757. }
  16758. exports.createCipher = exports.Cipher = ciphers.createCipher
  16759. exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
  16760. exports.createDecipher = exports.Decipher = deciphers.createDecipher
  16761. exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
  16762. exports.listCiphers = exports.getCiphers = getCiphers
  16763. /***/ }),
  16764. /* 148 */
  16765. /*!**************************************************!*\
  16766. !*** ./node_modules/browserify-aes/encrypter.js ***!
  16767. \**************************************************/
  16768. /*! no static exports found */
  16769. /***/ (function(module, exports, __webpack_require__) {
  16770. var MODES = __webpack_require__(/*! ./modes */ 149)
  16771. var AuthCipher = __webpack_require__(/*! ./authCipher */ 160)
  16772. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  16773. var StreamCipher = __webpack_require__(/*! ./streamCipher */ 163)
  16774. var Transform = __webpack_require__(/*! cipher-base */ 121)
  16775. var aes = __webpack_require__(/*! ./aes */ 161)
  16776. var ebtk = __webpack_require__(/*! evp_bytestokey */ 164)
  16777. var inherits = __webpack_require__(/*! inherits */ 93)
  16778. function Cipher (mode, key, iv) {
  16779. Transform.call(this)
  16780. this._cache = new Splitter()
  16781. this._cipher = new aes.AES(key)
  16782. this._prev = Buffer.from(iv)
  16783. this._mode = mode
  16784. this._autopadding = true
  16785. }
  16786. inherits(Cipher, Transform)
  16787. Cipher.prototype._update = function (data) {
  16788. this._cache.add(data)
  16789. var chunk
  16790. var thing
  16791. var out = []
  16792. while ((chunk = this._cache.get())) {
  16793. thing = this._mode.encrypt(this, chunk)
  16794. out.push(thing)
  16795. }
  16796. return Buffer.concat(out)
  16797. }
  16798. var PADDING = Buffer.alloc(16, 0x10)
  16799. Cipher.prototype._final = function () {
  16800. var chunk = this._cache.flush()
  16801. if (this._autopadding) {
  16802. chunk = this._mode.encrypt(this, chunk)
  16803. this._cipher.scrub()
  16804. return chunk
  16805. }
  16806. if (!chunk.equals(PADDING)) {
  16807. this._cipher.scrub()
  16808. throw new Error('data not multiple of block length')
  16809. }
  16810. }
  16811. Cipher.prototype.setAutoPadding = function (setTo) {
  16812. this._autopadding = !!setTo
  16813. return this
  16814. }
  16815. function Splitter () {
  16816. this.cache = Buffer.allocUnsafe(0)
  16817. }
  16818. Splitter.prototype.add = function (data) {
  16819. this.cache = Buffer.concat([this.cache, data])
  16820. }
  16821. Splitter.prototype.get = function () {
  16822. if (this.cache.length > 15) {
  16823. var out = this.cache.slice(0, 16)
  16824. this.cache = this.cache.slice(16)
  16825. return out
  16826. }
  16827. return null
  16828. }
  16829. Splitter.prototype.flush = function () {
  16830. var len = 16 - this.cache.length
  16831. var padBuff = Buffer.allocUnsafe(len)
  16832. var i = -1
  16833. while (++i < len) {
  16834. padBuff.writeUInt8(len, i)
  16835. }
  16836. return Buffer.concat([this.cache, padBuff])
  16837. }
  16838. function createCipheriv (suite, password, iv) {
  16839. var config = MODES[suite.toLowerCase()]
  16840. if (!config) throw new TypeError('invalid suite type')
  16841. if (typeof password === 'string') password = Buffer.from(password)
  16842. if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
  16843. if (typeof iv === 'string') iv = Buffer.from(iv)
  16844. if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
  16845. if (config.type === 'stream') {
  16846. return new StreamCipher(config.module, password, iv)
  16847. } else if (config.type === 'auth') {
  16848. return new AuthCipher(config.module, password, iv)
  16849. }
  16850. return new Cipher(config.module, password, iv)
  16851. }
  16852. function createCipher (suite, password) {
  16853. var config = MODES[suite.toLowerCase()]
  16854. if (!config) throw new TypeError('invalid suite type')
  16855. var keys = ebtk(password, false, config.key, config.iv)
  16856. return createCipheriv(suite, keys.key, keys.iv)
  16857. }
  16858. exports.createCipheriv = createCipheriv
  16859. exports.createCipher = createCipher
  16860. /***/ }),
  16861. /* 149 */
  16862. /*!****************************************************!*\
  16863. !*** ./node_modules/browserify-aes/modes/index.js ***!
  16864. \****************************************************/
  16865. /*! no static exports found */
  16866. /***/ (function(module, exports, __webpack_require__) {
  16867. var modeModules = {
  16868. ECB: __webpack_require__(/*! ./ecb */ 150),
  16869. CBC: __webpack_require__(/*! ./cbc */ 151),
  16870. CFB: __webpack_require__(/*! ./cfb */ 153),
  16871. CFB8: __webpack_require__(/*! ./cfb8 */ 154),
  16872. CFB1: __webpack_require__(/*! ./cfb1 */ 155),
  16873. OFB: __webpack_require__(/*! ./ofb */ 156),
  16874. CTR: __webpack_require__(/*! ./ctr */ 157),
  16875. GCM: __webpack_require__(/*! ./ctr */ 157)
  16876. }
  16877. var modes = __webpack_require__(/*! ./list.json */ 159)
  16878. for (var key in modes) {
  16879. modes[key].module = modeModules[modes[key].mode]
  16880. }
  16881. module.exports = modes
  16882. /***/ }),
  16883. /* 150 */
  16884. /*!**************************************************!*\
  16885. !*** ./node_modules/browserify-aes/modes/ecb.js ***!
  16886. \**************************************************/
  16887. /*! no static exports found */
  16888. /***/ (function(module, exports) {
  16889. exports.encrypt = function (self, block) {
  16890. return self._cipher.encryptBlock(block)
  16891. }
  16892. exports.decrypt = function (self, block) {
  16893. return self._cipher.decryptBlock(block)
  16894. }
  16895. /***/ }),
  16896. /* 151 */
  16897. /*!**************************************************!*\
  16898. !*** ./node_modules/browserify-aes/modes/cbc.js ***!
  16899. \**************************************************/
  16900. /*! no static exports found */
  16901. /***/ (function(module, exports, __webpack_require__) {
  16902. var xor = __webpack_require__(/*! buffer-xor */ 152)
  16903. exports.encrypt = function (self, block) {
  16904. var data = xor(block, self._prev)
  16905. self._prev = self._cipher.encryptBlock(data)
  16906. return self._prev
  16907. }
  16908. exports.decrypt = function (self, block) {
  16909. var pad = self._prev
  16910. self._prev = block
  16911. var out = self._cipher.decryptBlock(block)
  16912. return xor(out, pad)
  16913. }
  16914. /***/ }),
  16915. /* 152 */
  16916. /*!******************************************!*\
  16917. !*** ./node_modules/buffer-xor/index.js ***!
  16918. \******************************************/
  16919. /*! no static exports found */
  16920. /***/ (function(module, exports, __webpack_require__) {
  16921. /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
  16922. var length = Math.min(a.length, b.length)
  16923. var buffer = new Buffer(length)
  16924. for (var i = 0; i < length; ++i) {
  16925. buffer[i] = a[i] ^ b[i]
  16926. }
  16927. return buffer
  16928. }
  16929. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 88).Buffer))
  16930. /***/ }),
  16931. /* 153 */
  16932. /*!**************************************************!*\
  16933. !*** ./node_modules/browserify-aes/modes/cfb.js ***!
  16934. \**************************************************/
  16935. /*! no static exports found */
  16936. /***/ (function(module, exports, __webpack_require__) {
  16937. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  16938. var xor = __webpack_require__(/*! buffer-xor */ 152)
  16939. function encryptStart (self, data, decrypt) {
  16940. var len = data.length
  16941. var out = xor(data, self._cache)
  16942. self._cache = self._cache.slice(len)
  16943. self._prev = Buffer.concat([self._prev, decrypt ? data : out])
  16944. return out
  16945. }
  16946. exports.encrypt = function (self, data, decrypt) {
  16947. var out = Buffer.allocUnsafe(0)
  16948. var len
  16949. while (data.length) {
  16950. if (self._cache.length === 0) {
  16951. self._cache = self._cipher.encryptBlock(self._prev)
  16952. self._prev = Buffer.allocUnsafe(0)
  16953. }
  16954. if (self._cache.length <= data.length) {
  16955. len = self._cache.length
  16956. out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
  16957. data = data.slice(len)
  16958. } else {
  16959. out = Buffer.concat([out, encryptStart(self, data, decrypt)])
  16960. break
  16961. }
  16962. }
  16963. return out
  16964. }
  16965. /***/ }),
  16966. /* 154 */
  16967. /*!***************************************************!*\
  16968. !*** ./node_modules/browserify-aes/modes/cfb8.js ***!
  16969. \***************************************************/
  16970. /*! no static exports found */
  16971. /***/ (function(module, exports, __webpack_require__) {
  16972. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  16973. function encryptByte (self, byteParam, decrypt) {
  16974. var pad = self._cipher.encryptBlock(self._prev)
  16975. var out = pad[0] ^ byteParam
  16976. self._prev = Buffer.concat([
  16977. self._prev.slice(1),
  16978. Buffer.from([decrypt ? byteParam : out])
  16979. ])
  16980. return out
  16981. }
  16982. exports.encrypt = function (self, chunk, decrypt) {
  16983. var len = chunk.length
  16984. var out = Buffer.allocUnsafe(len)
  16985. var i = -1
  16986. while (++i < len) {
  16987. out[i] = encryptByte(self, chunk[i], decrypt)
  16988. }
  16989. return out
  16990. }
  16991. /***/ }),
  16992. /* 155 */
  16993. /*!***************************************************!*\
  16994. !*** ./node_modules/browserify-aes/modes/cfb1.js ***!
  16995. \***************************************************/
  16996. /*! no static exports found */
  16997. /***/ (function(module, exports, __webpack_require__) {
  16998. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  16999. function encryptByte (self, byteParam, decrypt) {
  17000. var pad
  17001. var i = -1
  17002. var len = 8
  17003. var out = 0
  17004. var bit, value
  17005. while (++i < len) {
  17006. pad = self._cipher.encryptBlock(self._prev)
  17007. bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
  17008. value = pad[0] ^ bit
  17009. out += ((value & 0x80) >> (i % 8))
  17010. self._prev = shiftIn(self._prev, decrypt ? bit : value)
  17011. }
  17012. return out
  17013. }
  17014. function shiftIn (buffer, value) {
  17015. var len = buffer.length
  17016. var i = -1
  17017. var out = Buffer.allocUnsafe(buffer.length)
  17018. buffer = Buffer.concat([buffer, Buffer.from([value])])
  17019. while (++i < len) {
  17020. out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
  17021. }
  17022. return out
  17023. }
  17024. exports.encrypt = function (self, chunk, decrypt) {
  17025. var len = chunk.length
  17026. var out = Buffer.allocUnsafe(len)
  17027. var i = -1
  17028. while (++i < len) {
  17029. out[i] = encryptByte(self, chunk[i], decrypt)
  17030. }
  17031. return out
  17032. }
  17033. /***/ }),
  17034. /* 156 */
  17035. /*!**************************************************!*\
  17036. !*** ./node_modules/browserify-aes/modes/ofb.js ***!
  17037. \**************************************************/
  17038. /*! no static exports found */
  17039. /***/ (function(module, exports, __webpack_require__) {
  17040. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(/*! buffer-xor */ 152)
  17041. function getBlock (self) {
  17042. self._prev = self._cipher.encryptBlock(self._prev)
  17043. return self._prev
  17044. }
  17045. exports.encrypt = function (self, chunk) {
  17046. while (self._cache.length < chunk.length) {
  17047. self._cache = Buffer.concat([self._cache, getBlock(self)])
  17048. }
  17049. var pad = self._cache.slice(0, chunk.length)
  17050. self._cache = self._cache.slice(chunk.length)
  17051. return xor(chunk, pad)
  17052. }
  17053. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 88).Buffer))
  17054. /***/ }),
  17055. /* 157 */
  17056. /*!**************************************************!*\
  17057. !*** ./node_modules/browserify-aes/modes/ctr.js ***!
  17058. \**************************************************/
  17059. /*! no static exports found */
  17060. /***/ (function(module, exports, __webpack_require__) {
  17061. var xor = __webpack_require__(/*! buffer-xor */ 152)
  17062. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17063. var incr32 = __webpack_require__(/*! ../incr32 */ 158)
  17064. function getBlock (self) {
  17065. var out = self._cipher.encryptBlockRaw(self._prev)
  17066. incr32(self._prev)
  17067. return out
  17068. }
  17069. var blockSize = 16
  17070. exports.encrypt = function (self, chunk) {
  17071. var chunkNum = Math.ceil(chunk.length / blockSize)
  17072. var start = self._cache.length
  17073. self._cache = Buffer.concat([
  17074. self._cache,
  17075. Buffer.allocUnsafe(chunkNum * blockSize)
  17076. ])
  17077. for (var i = 0; i < chunkNum; i++) {
  17078. var out = getBlock(self)
  17079. var offset = start + i * blockSize
  17080. self._cache.writeUInt32BE(out[0], offset + 0)
  17081. self._cache.writeUInt32BE(out[1], offset + 4)
  17082. self._cache.writeUInt32BE(out[2], offset + 8)
  17083. self._cache.writeUInt32BE(out[3], offset + 12)
  17084. }
  17085. var pad = self._cache.slice(0, chunk.length)
  17086. self._cache = self._cache.slice(chunk.length)
  17087. return xor(chunk, pad)
  17088. }
  17089. /***/ }),
  17090. /* 158 */
  17091. /*!***********************************************!*\
  17092. !*** ./node_modules/browserify-aes/incr32.js ***!
  17093. \***********************************************/
  17094. /*! no static exports found */
  17095. /***/ (function(module, exports) {
  17096. function incr32 (iv) {
  17097. var len = iv.length
  17098. var item
  17099. while (len--) {
  17100. item = iv.readUInt8(len)
  17101. if (item === 255) {
  17102. iv.writeUInt8(0, len)
  17103. } else {
  17104. item++
  17105. iv.writeUInt8(item, len)
  17106. break
  17107. }
  17108. }
  17109. }
  17110. module.exports = incr32
  17111. /***/ }),
  17112. /* 159 */
  17113. /*!*****************************************************!*\
  17114. !*** ./node_modules/browserify-aes/modes/list.json ***!
  17115. \*****************************************************/
  17116. /*! exports provided: aes-128-ecb, aes-192-ecb, aes-256-ecb, aes-128-cbc, aes-192-cbc, aes-256-cbc, aes128, aes192, aes256, aes-128-cfb, aes-192-cfb, aes-256-cfb, aes-128-cfb8, aes-192-cfb8, aes-256-cfb8, aes-128-cfb1, aes-192-cfb1, aes-256-cfb1, aes-128-ofb, aes-192-ofb, aes-256-ofb, aes-128-ctr, aes-192-ctr, aes-256-ctr, aes-128-gcm, aes-192-gcm, aes-256-gcm, default */
  17117. /***/ (function(module) {
  17118. module.exports = JSON.parse("{\"aes-128-ecb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-192-ecb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-256-ecb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":0,\"mode\":\"ECB\",\"type\":\"block\"},\"aes-128-cbc\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-192-cbc\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-256-cbc\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes128\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes192\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes256\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CBC\",\"type\":\"block\"},\"aes-128-cfb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-192-cfb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-256-cfb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB\",\"type\":\"stream\"},\"aes-128-cfb8\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-192-cfb8\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-256-cfb8\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB8\",\"type\":\"stream\"},\"aes-128-cfb1\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-192-cfb1\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-256-cfb1\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CFB1\",\"type\":\"stream\"},\"aes-128-ofb\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-192-ofb\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-256-ofb\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"OFB\",\"type\":\"stream\"},\"aes-128-ctr\":{\"cipher\":\"AES\",\"key\":128,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-192-ctr\":{\"cipher\":\"AES\",\"key\":192,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-256-ctr\":{\"cipher\":\"AES\",\"key\":256,\"iv\":16,\"mode\":\"CTR\",\"type\":\"stream\"},\"aes-128-gcm\":{\"cipher\":\"AES\",\"key\":128,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-192-gcm\":{\"cipher\":\"AES\",\"key\":192,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"},\"aes-256-gcm\":{\"cipher\":\"AES\",\"key\":256,\"iv\":12,\"mode\":\"GCM\",\"type\":\"auth\"}}");
  17119. /***/ }),
  17120. /* 160 */
  17121. /*!***************************************************!*\
  17122. !*** ./node_modules/browserify-aes/authCipher.js ***!
  17123. \***************************************************/
  17124. /*! no static exports found */
  17125. /***/ (function(module, exports, __webpack_require__) {
  17126. var aes = __webpack_require__(/*! ./aes */ 161)
  17127. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17128. var Transform = __webpack_require__(/*! cipher-base */ 121)
  17129. var inherits = __webpack_require__(/*! inherits */ 93)
  17130. var GHASH = __webpack_require__(/*! ./ghash */ 162)
  17131. var xor = __webpack_require__(/*! buffer-xor */ 152)
  17132. var incr32 = __webpack_require__(/*! ./incr32 */ 158)
  17133. function xorTest (a, b) {
  17134. var out = 0
  17135. if (a.length !== b.length) out++
  17136. var len = Math.min(a.length, b.length)
  17137. for (var i = 0; i < len; ++i) {
  17138. out += (a[i] ^ b[i])
  17139. }
  17140. return out
  17141. }
  17142. function calcIv (self, iv, ck) {
  17143. if (iv.length === 12) {
  17144. self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
  17145. return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
  17146. }
  17147. var ghash = new GHASH(ck)
  17148. var len = iv.length
  17149. var toPad = len % 16
  17150. ghash.update(iv)
  17151. if (toPad) {
  17152. toPad = 16 - toPad
  17153. ghash.update(Buffer.alloc(toPad, 0))
  17154. }
  17155. ghash.update(Buffer.alloc(8, 0))
  17156. var ivBits = len * 8
  17157. var tail = Buffer.alloc(8)
  17158. tail.writeUIntBE(ivBits, 0, 8)
  17159. ghash.update(tail)
  17160. self._finID = ghash.state
  17161. var out = Buffer.from(self._finID)
  17162. incr32(out)
  17163. return out
  17164. }
  17165. function StreamCipher (mode, key, iv, decrypt) {
  17166. Transform.call(this)
  17167. var h = Buffer.alloc(4, 0)
  17168. this._cipher = new aes.AES(key)
  17169. var ck = this._cipher.encryptBlock(h)
  17170. this._ghash = new GHASH(ck)
  17171. iv = calcIv(this, iv, ck)
  17172. this._prev = Buffer.from(iv)
  17173. this._cache = Buffer.allocUnsafe(0)
  17174. this._secCache = Buffer.allocUnsafe(0)
  17175. this._decrypt = decrypt
  17176. this._alen = 0
  17177. this._len = 0
  17178. this._mode = mode
  17179. this._authTag = null
  17180. this._called = false
  17181. }
  17182. inherits(StreamCipher, Transform)
  17183. StreamCipher.prototype._update = function (chunk) {
  17184. if (!this._called && this._alen) {
  17185. var rump = 16 - (this._alen % 16)
  17186. if (rump < 16) {
  17187. rump = Buffer.alloc(rump, 0)
  17188. this._ghash.update(rump)
  17189. }
  17190. }
  17191. this._called = true
  17192. var out = this._mode.encrypt(this, chunk)
  17193. if (this._decrypt) {
  17194. this._ghash.update(chunk)
  17195. } else {
  17196. this._ghash.update(out)
  17197. }
  17198. this._len += chunk.length
  17199. return out
  17200. }
  17201. StreamCipher.prototype._final = function () {
  17202. if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
  17203. var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
  17204. if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
  17205. this._authTag = tag
  17206. this._cipher.scrub()
  17207. }
  17208. StreamCipher.prototype.getAuthTag = function getAuthTag () {
  17209. if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
  17210. return this._authTag
  17211. }
  17212. StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
  17213. if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
  17214. this._authTag = tag
  17215. }
  17216. StreamCipher.prototype.setAAD = function setAAD (buf) {
  17217. if (this._called) throw new Error('Attempting to set AAD in unsupported state')
  17218. this._ghash.update(buf)
  17219. this._alen += buf.length
  17220. }
  17221. module.exports = StreamCipher
  17222. /***/ }),
  17223. /* 161 */
  17224. /*!********************************************!*\
  17225. !*** ./node_modules/browserify-aes/aes.js ***!
  17226. \********************************************/
  17227. /*! no static exports found */
  17228. /***/ (function(module, exports, __webpack_require__) {
  17229. // based on the aes implimentation in triple sec
  17230. // https://github.com/keybase/triplesec
  17231. // which is in turn based on the one from crypto-js
  17232. // https://code.google.com/p/crypto-js/
  17233. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17234. function asUInt32Array (buf) {
  17235. if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
  17236. var len = (buf.length / 4) | 0
  17237. var out = new Array(len)
  17238. for (var i = 0; i < len; i++) {
  17239. out[i] = buf.readUInt32BE(i * 4)
  17240. }
  17241. return out
  17242. }
  17243. function scrubVec (v) {
  17244. for (var i = 0; i < v.length; v++) {
  17245. v[i] = 0
  17246. }
  17247. }
  17248. function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
  17249. var SUB_MIX0 = SUB_MIX[0]
  17250. var SUB_MIX1 = SUB_MIX[1]
  17251. var SUB_MIX2 = SUB_MIX[2]
  17252. var SUB_MIX3 = SUB_MIX[3]
  17253. var s0 = M[0] ^ keySchedule[0]
  17254. var s1 = M[1] ^ keySchedule[1]
  17255. var s2 = M[2] ^ keySchedule[2]
  17256. var s3 = M[3] ^ keySchedule[3]
  17257. var t0, t1, t2, t3
  17258. var ksRow = 4
  17259. for (var round = 1; round < nRounds; round++) {
  17260. t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
  17261. t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
  17262. t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
  17263. t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
  17264. s0 = t0
  17265. s1 = t1
  17266. s2 = t2
  17267. s3 = t3
  17268. }
  17269. t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
  17270. t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
  17271. t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
  17272. t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
  17273. t0 = t0 >>> 0
  17274. t1 = t1 >>> 0
  17275. t2 = t2 >>> 0
  17276. t3 = t3 >>> 0
  17277. return [t0, t1, t2, t3]
  17278. }
  17279. // AES constants
  17280. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
  17281. var G = (function () {
  17282. // Compute double table
  17283. var d = new Array(256)
  17284. for (var j = 0; j < 256; j++) {
  17285. if (j < 128) {
  17286. d[j] = j << 1
  17287. } else {
  17288. d[j] = (j << 1) ^ 0x11b
  17289. }
  17290. }
  17291. var SBOX = []
  17292. var INV_SBOX = []
  17293. var SUB_MIX = [[], [], [], []]
  17294. var INV_SUB_MIX = [[], [], [], []]
  17295. // Walk GF(2^8)
  17296. var x = 0
  17297. var xi = 0
  17298. for (var i = 0; i < 256; ++i) {
  17299. // Compute sbox
  17300. var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
  17301. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
  17302. SBOX[x] = sx
  17303. INV_SBOX[sx] = x
  17304. // Compute multiplication
  17305. var x2 = d[x]
  17306. var x4 = d[x2]
  17307. var x8 = d[x4]
  17308. // Compute sub bytes, mix columns tables
  17309. var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
  17310. SUB_MIX[0][x] = (t << 24) | (t >>> 8)
  17311. SUB_MIX[1][x] = (t << 16) | (t >>> 16)
  17312. SUB_MIX[2][x] = (t << 8) | (t >>> 24)
  17313. SUB_MIX[3][x] = t
  17314. // Compute inv sub bytes, inv mix columns tables
  17315. t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
  17316. INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
  17317. INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
  17318. INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
  17319. INV_SUB_MIX[3][sx] = t
  17320. if (x === 0) {
  17321. x = xi = 1
  17322. } else {
  17323. x = x2 ^ d[d[d[x8 ^ x2]]]
  17324. xi ^= d[d[xi]]
  17325. }
  17326. }
  17327. return {
  17328. SBOX: SBOX,
  17329. INV_SBOX: INV_SBOX,
  17330. SUB_MIX: SUB_MIX,
  17331. INV_SUB_MIX: INV_SUB_MIX
  17332. }
  17333. })()
  17334. function AES (key) {
  17335. this._key = asUInt32Array(key)
  17336. this._reset()
  17337. }
  17338. AES.blockSize = 4 * 4
  17339. AES.keySize = 256 / 8
  17340. AES.prototype.blockSize = AES.blockSize
  17341. AES.prototype.keySize = AES.keySize
  17342. AES.prototype._reset = function () {
  17343. var keyWords = this._key
  17344. var keySize = keyWords.length
  17345. var nRounds = keySize + 6
  17346. var ksRows = (nRounds + 1) * 4
  17347. var keySchedule = []
  17348. for (var k = 0; k < keySize; k++) {
  17349. keySchedule[k] = keyWords[k]
  17350. }
  17351. for (k = keySize; k < ksRows; k++) {
  17352. var t = keySchedule[k - 1]
  17353. if (k % keySize === 0) {
  17354. t = (t << 8) | (t >>> 24)
  17355. t =
  17356. (G.SBOX[t >>> 24] << 24) |
  17357. (G.SBOX[(t >>> 16) & 0xff] << 16) |
  17358. (G.SBOX[(t >>> 8) & 0xff] << 8) |
  17359. (G.SBOX[t & 0xff])
  17360. t ^= RCON[(k / keySize) | 0] << 24
  17361. } else if (keySize > 6 && k % keySize === 4) {
  17362. t =
  17363. (G.SBOX[t >>> 24] << 24) |
  17364. (G.SBOX[(t >>> 16) & 0xff] << 16) |
  17365. (G.SBOX[(t >>> 8) & 0xff] << 8) |
  17366. (G.SBOX[t & 0xff])
  17367. }
  17368. keySchedule[k] = keySchedule[k - keySize] ^ t
  17369. }
  17370. var invKeySchedule = []
  17371. for (var ik = 0; ik < ksRows; ik++) {
  17372. var ksR = ksRows - ik
  17373. var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
  17374. if (ik < 4 || ksR <= 4) {
  17375. invKeySchedule[ik] = tt
  17376. } else {
  17377. invKeySchedule[ik] =
  17378. G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
  17379. G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
  17380. G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
  17381. G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
  17382. }
  17383. }
  17384. this._nRounds = nRounds
  17385. this._keySchedule = keySchedule
  17386. this._invKeySchedule = invKeySchedule
  17387. }
  17388. AES.prototype.encryptBlockRaw = function (M) {
  17389. M = asUInt32Array(M)
  17390. return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
  17391. }
  17392. AES.prototype.encryptBlock = function (M) {
  17393. var out = this.encryptBlockRaw(M)
  17394. var buf = Buffer.allocUnsafe(16)
  17395. buf.writeUInt32BE(out[0], 0)
  17396. buf.writeUInt32BE(out[1], 4)
  17397. buf.writeUInt32BE(out[2], 8)
  17398. buf.writeUInt32BE(out[3], 12)
  17399. return buf
  17400. }
  17401. AES.prototype.decryptBlock = function (M) {
  17402. M = asUInt32Array(M)
  17403. // swap
  17404. var m1 = M[1]
  17405. M[1] = M[3]
  17406. M[3] = m1
  17407. var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
  17408. var buf = Buffer.allocUnsafe(16)
  17409. buf.writeUInt32BE(out[0], 0)
  17410. buf.writeUInt32BE(out[3], 4)
  17411. buf.writeUInt32BE(out[2], 8)
  17412. buf.writeUInt32BE(out[1], 12)
  17413. return buf
  17414. }
  17415. AES.prototype.scrub = function () {
  17416. scrubVec(this._keySchedule)
  17417. scrubVec(this._invKeySchedule)
  17418. scrubVec(this._key)
  17419. }
  17420. module.exports.AES = AES
  17421. /***/ }),
  17422. /* 162 */
  17423. /*!**********************************************!*\
  17424. !*** ./node_modules/browserify-aes/ghash.js ***!
  17425. \**********************************************/
  17426. /*! no static exports found */
  17427. /***/ (function(module, exports, __webpack_require__) {
  17428. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17429. var ZEROES = Buffer.alloc(16, 0)
  17430. function toArray (buf) {
  17431. return [
  17432. buf.readUInt32BE(0),
  17433. buf.readUInt32BE(4),
  17434. buf.readUInt32BE(8),
  17435. buf.readUInt32BE(12)
  17436. ]
  17437. }
  17438. function fromArray (out) {
  17439. var buf = Buffer.allocUnsafe(16)
  17440. buf.writeUInt32BE(out[0] >>> 0, 0)
  17441. buf.writeUInt32BE(out[1] >>> 0, 4)
  17442. buf.writeUInt32BE(out[2] >>> 0, 8)
  17443. buf.writeUInt32BE(out[3] >>> 0, 12)
  17444. return buf
  17445. }
  17446. function GHASH (key) {
  17447. this.h = key
  17448. this.state = Buffer.alloc(16, 0)
  17449. this.cache = Buffer.allocUnsafe(0)
  17450. }
  17451. // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
  17452. // by Juho Vähä-Herttua
  17453. GHASH.prototype.ghash = function (block) {
  17454. var i = -1
  17455. while (++i < block.length) {
  17456. this.state[i] ^= block[i]
  17457. }
  17458. this._multiply()
  17459. }
  17460. GHASH.prototype._multiply = function () {
  17461. var Vi = toArray(this.h)
  17462. var Zi = [0, 0, 0, 0]
  17463. var j, xi, lsbVi
  17464. var i = -1
  17465. while (++i < 128) {
  17466. xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
  17467. if (xi) {
  17468. // Z_i+1 = Z_i ^ V_i
  17469. Zi[0] ^= Vi[0]
  17470. Zi[1] ^= Vi[1]
  17471. Zi[2] ^= Vi[2]
  17472. Zi[3] ^= Vi[3]
  17473. }
  17474. // Store the value of LSB(V_i)
  17475. lsbVi = (Vi[3] & 1) !== 0
  17476. // V_i+1 = V_i >> 1
  17477. for (j = 3; j > 0; j--) {
  17478. Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
  17479. }
  17480. Vi[0] = Vi[0] >>> 1
  17481. // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
  17482. if (lsbVi) {
  17483. Vi[0] = Vi[0] ^ (0xe1 << 24)
  17484. }
  17485. }
  17486. this.state = fromArray(Zi)
  17487. }
  17488. GHASH.prototype.update = function (buf) {
  17489. this.cache = Buffer.concat([this.cache, buf])
  17490. var chunk
  17491. while (this.cache.length >= 16) {
  17492. chunk = this.cache.slice(0, 16)
  17493. this.cache = this.cache.slice(16)
  17494. this.ghash(chunk)
  17495. }
  17496. }
  17497. GHASH.prototype.final = function (abl, bl) {
  17498. if (this.cache.length) {
  17499. this.ghash(Buffer.concat([this.cache, ZEROES], 16))
  17500. }
  17501. this.ghash(fromArray([0, abl, 0, bl]))
  17502. return this.state
  17503. }
  17504. module.exports = GHASH
  17505. /***/ }),
  17506. /* 163 */
  17507. /*!*****************************************************!*\
  17508. !*** ./node_modules/browserify-aes/streamCipher.js ***!
  17509. \*****************************************************/
  17510. /*! no static exports found */
  17511. /***/ (function(module, exports, __webpack_require__) {
  17512. var aes = __webpack_require__(/*! ./aes */ 161)
  17513. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17514. var Transform = __webpack_require__(/*! cipher-base */ 121)
  17515. var inherits = __webpack_require__(/*! inherits */ 93)
  17516. function StreamCipher (mode, key, iv, decrypt) {
  17517. Transform.call(this)
  17518. this._cipher = new aes.AES(key)
  17519. this._prev = Buffer.from(iv)
  17520. this._cache = Buffer.allocUnsafe(0)
  17521. this._secCache = Buffer.allocUnsafe(0)
  17522. this._decrypt = decrypt
  17523. this._mode = mode
  17524. }
  17525. inherits(StreamCipher, Transform)
  17526. StreamCipher.prototype._update = function (chunk) {
  17527. return this._mode.encrypt(this, chunk, this._decrypt)
  17528. }
  17529. StreamCipher.prototype._final = function () {
  17530. this._cipher.scrub()
  17531. }
  17532. module.exports = StreamCipher
  17533. /***/ }),
  17534. /* 164 */
  17535. /*!**********************************************!*\
  17536. !*** ./node_modules/evp_bytestokey/index.js ***!
  17537. \**********************************************/
  17538. /*! no static exports found */
  17539. /***/ (function(module, exports, __webpack_require__) {
  17540. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17541. var MD5 = __webpack_require__(/*! md5.js */ 94)
  17542. /* eslint-disable camelcase */
  17543. function EVP_BytesToKey (password, salt, keyBits, ivLen) {
  17544. if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
  17545. if (salt) {
  17546. if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
  17547. if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
  17548. }
  17549. var keyLen = keyBits / 8
  17550. var key = Buffer.alloc(keyLen)
  17551. var iv = Buffer.alloc(ivLen || 0)
  17552. var tmp = Buffer.alloc(0)
  17553. while (keyLen > 0 || ivLen > 0) {
  17554. var hash = new MD5()
  17555. hash.update(tmp)
  17556. hash.update(password)
  17557. if (salt) hash.update(salt)
  17558. tmp = hash.digest()
  17559. var used = 0
  17560. if (keyLen > 0) {
  17561. var keyStart = key.length - keyLen
  17562. used = Math.min(keyLen, tmp.length)
  17563. tmp.copy(key, keyStart, 0, used)
  17564. keyLen -= used
  17565. }
  17566. if (used < tmp.length && ivLen > 0) {
  17567. var ivStart = iv.length - ivLen
  17568. var length = Math.min(ivLen, tmp.length - used)
  17569. tmp.copy(iv, ivStart, used, used + length)
  17570. ivLen -= length
  17571. }
  17572. }
  17573. tmp.fill(0)
  17574. return { key: key, iv: iv }
  17575. }
  17576. module.exports = EVP_BytesToKey
  17577. /***/ }),
  17578. /* 165 */
  17579. /*!**************************************************!*\
  17580. !*** ./node_modules/browserify-aes/decrypter.js ***!
  17581. \**************************************************/
  17582. /*! no static exports found */
  17583. /***/ (function(module, exports, __webpack_require__) {
  17584. var AuthCipher = __webpack_require__(/*! ./authCipher */ 160)
  17585. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  17586. var MODES = __webpack_require__(/*! ./modes */ 149)
  17587. var StreamCipher = __webpack_require__(/*! ./streamCipher */ 163)
  17588. var Transform = __webpack_require__(/*! cipher-base */ 121)
  17589. var aes = __webpack_require__(/*! ./aes */ 161)
  17590. var ebtk = __webpack_require__(/*! evp_bytestokey */ 164)
  17591. var inherits = __webpack_require__(/*! inherits */ 93)
  17592. function Decipher (mode, key, iv) {
  17593. Transform.call(this)
  17594. this._cache = new Splitter()
  17595. this._last = void 0
  17596. this._cipher = new aes.AES(key)
  17597. this._prev = Buffer.from(iv)
  17598. this._mode = mode
  17599. this._autopadding = true
  17600. }
  17601. inherits(Decipher, Transform)
  17602. Decipher.prototype._update = function (data) {
  17603. this._cache.add(data)
  17604. var chunk
  17605. var thing
  17606. var out = []
  17607. while ((chunk = this._cache.get(this._autopadding))) {
  17608. thing = this._mode.decrypt(this, chunk)
  17609. out.push(thing)
  17610. }
  17611. return Buffer.concat(out)
  17612. }
  17613. Decipher.prototype._final = function () {
  17614. var chunk = this._cache.flush()
  17615. if (this._autopadding) {
  17616. return unpad(this._mode.decrypt(this, chunk))
  17617. } else if (chunk) {
  17618. throw new Error('data not multiple of block length')
  17619. }
  17620. }
  17621. Decipher.prototype.setAutoPadding = function (setTo) {
  17622. this._autopadding = !!setTo
  17623. return this
  17624. }
  17625. function Splitter () {
  17626. this.cache = Buffer.allocUnsafe(0)
  17627. }
  17628. Splitter.prototype.add = function (data) {
  17629. this.cache = Buffer.concat([this.cache, data])
  17630. }
  17631. Splitter.prototype.get = function (autoPadding) {
  17632. var out
  17633. if (autoPadding) {
  17634. if (this.cache.length > 16) {
  17635. out = this.cache.slice(0, 16)
  17636. this.cache = this.cache.slice(16)
  17637. return out
  17638. }
  17639. } else {
  17640. if (this.cache.length >= 16) {
  17641. out = this.cache.slice(0, 16)
  17642. this.cache = this.cache.slice(16)
  17643. return out
  17644. }
  17645. }
  17646. return null
  17647. }
  17648. Splitter.prototype.flush = function () {
  17649. if (this.cache.length) return this.cache
  17650. }
  17651. function unpad (last) {
  17652. var padded = last[15]
  17653. if (padded < 1 || padded > 16) {
  17654. throw new Error('unable to decrypt data')
  17655. }
  17656. var i = -1
  17657. while (++i < padded) {
  17658. if (last[(i + (16 - padded))] !== padded) {
  17659. throw new Error('unable to decrypt data')
  17660. }
  17661. }
  17662. if (padded === 16) return
  17663. return last.slice(0, 16 - padded)
  17664. }
  17665. function createDecipheriv (suite, password, iv) {
  17666. var config = MODES[suite.toLowerCase()]
  17667. if (!config) throw new TypeError('invalid suite type')
  17668. if (typeof iv === 'string') iv = Buffer.from(iv)
  17669. if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
  17670. if (typeof password === 'string') password = Buffer.from(password)
  17671. if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
  17672. if (config.type === 'stream') {
  17673. return new StreamCipher(config.module, password, iv, true)
  17674. } else if (config.type === 'auth') {
  17675. return new AuthCipher(config.module, password, iv, true)
  17676. }
  17677. return new Decipher(config.module, password, iv)
  17678. }
  17679. function createDecipher (suite, password) {
  17680. var config = MODES[suite.toLowerCase()]
  17681. if (!config) throw new TypeError('invalid suite type')
  17682. var keys = ebtk(password, false, config.key, config.iv)
  17683. return createDecipheriv(suite, keys.key, keys.iv)
  17684. }
  17685. exports.createDecipher = createDecipher
  17686. exports.createDecipheriv = createDecipheriv
  17687. /***/ }),
  17688. /* 166 */
  17689. /*!**********************************************!*\
  17690. !*** ./node_modules/browserify-des/modes.js ***!
  17691. \**********************************************/
  17692. /*! no static exports found */
  17693. /***/ (function(module, exports) {
  17694. exports['des-ecb'] = {
  17695. key: 8,
  17696. iv: 0
  17697. }
  17698. exports['des-cbc'] = exports.des = {
  17699. key: 8,
  17700. iv: 8
  17701. }
  17702. exports['des-ede3-cbc'] = exports.des3 = {
  17703. key: 24,
  17704. iv: 8
  17705. }
  17706. exports['des-ede3'] = {
  17707. key: 24,
  17708. iv: 0
  17709. }
  17710. exports['des-ede-cbc'] = {
  17711. key: 16,
  17712. iv: 8
  17713. }
  17714. exports['des-ede'] = {
  17715. key: 16,
  17716. iv: 0
  17717. }
  17718. /***/ }),
  17719. /* 167 */
  17720. /*!************************************************!*\
  17721. !*** ./node_modules/diffie-hellman/browser.js ***!
  17722. \************************************************/
  17723. /*! no static exports found */
  17724. /***/ (function(module, exports, __webpack_require__) {
  17725. /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(/*! ./lib/generatePrime */ 168)
  17726. var primes = __webpack_require__(/*! ./lib/primes.json */ 175)
  17727. var DH = __webpack_require__(/*! ./lib/dh */ 176)
  17728. function getDiffieHellman (mod) {
  17729. var prime = new Buffer(primes[mod].prime, 'hex')
  17730. var gen = new Buffer(primes[mod].gen, 'hex')
  17731. return new DH(prime, gen)
  17732. }
  17733. var ENCODINGS = {
  17734. 'binary': true, 'hex': true, 'base64': true
  17735. }
  17736. function createDiffieHellman (prime, enc, generator, genc) {
  17737. if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
  17738. return createDiffieHellman(prime, 'binary', enc, generator)
  17739. }
  17740. enc = enc || 'binary'
  17741. genc = genc || 'binary'
  17742. generator = generator || new Buffer([2])
  17743. if (!Buffer.isBuffer(generator)) {
  17744. generator = new Buffer(generator, genc)
  17745. }
  17746. if (typeof prime === 'number') {
  17747. return new DH(generatePrime(prime, generator), generator, true)
  17748. }
  17749. if (!Buffer.isBuffer(prime)) {
  17750. prime = new Buffer(prime, enc)
  17751. }
  17752. return new DH(prime, generator, true)
  17753. }
  17754. exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
  17755. exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
  17756. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 88).Buffer))
  17757. /***/ }),
  17758. /* 168 */
  17759. /*!**********************************************************!*\
  17760. !*** ./node_modules/diffie-hellman/lib/generatePrime.js ***!
  17761. \**********************************************************/
  17762. /*! no static exports found */
  17763. /***/ (function(module, exports, __webpack_require__) {
  17764. var randomBytes = __webpack_require__(/*! randombytes */ 84);
  17765. module.exports = findPrime;
  17766. findPrime.simpleSieve = simpleSieve;
  17767. findPrime.fermatTest = fermatTest;
  17768. var BN = __webpack_require__(/*! bn.js */ 169);
  17769. var TWENTYFOUR = new BN(24);
  17770. var MillerRabin = __webpack_require__(/*! miller-rabin */ 172);
  17771. var millerRabin = new MillerRabin();
  17772. var ONE = new BN(1);
  17773. var TWO = new BN(2);
  17774. var FIVE = new BN(5);
  17775. var SIXTEEN = new BN(16);
  17776. var EIGHT = new BN(8);
  17777. var TEN = new BN(10);
  17778. var THREE = new BN(3);
  17779. var SEVEN = new BN(7);
  17780. var ELEVEN = new BN(11);
  17781. var FOUR = new BN(4);
  17782. var TWELVE = new BN(12);
  17783. var primes = null;
  17784. function _getPrimes() {
  17785. if (primes !== null)
  17786. return primes;
  17787. var limit = 0x100000;
  17788. var res = [];
  17789. res[0] = 2;
  17790. for (var i = 1, k = 3; k < limit; k += 2) {
  17791. var sqrt = Math.ceil(Math.sqrt(k));
  17792. for (var j = 0; j < i && res[j] <= sqrt; j++)
  17793. if (k % res[j] === 0)
  17794. break;
  17795. if (i !== j && res[j] <= sqrt)
  17796. continue;
  17797. res[i++] = k;
  17798. }
  17799. primes = res;
  17800. return res;
  17801. }
  17802. function simpleSieve(p) {
  17803. var primes = _getPrimes();
  17804. for (var i = 0; i < primes.length; i++)
  17805. if (p.modn(primes[i]) === 0) {
  17806. if (p.cmpn(primes[i]) === 0) {
  17807. return true;
  17808. } else {
  17809. return false;
  17810. }
  17811. }
  17812. return true;
  17813. }
  17814. function fermatTest(p) {
  17815. var red = BN.mont(p);
  17816. return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
  17817. }
  17818. function findPrime(bits, gen) {
  17819. if (bits < 16) {
  17820. // this is what openssl does
  17821. if (gen === 2 || gen === 5) {
  17822. return new BN([0x8c, 0x7b]);
  17823. } else {
  17824. return new BN([0x8c, 0x27]);
  17825. }
  17826. }
  17827. gen = new BN(gen);
  17828. var num, n2;
  17829. while (true) {
  17830. num = new BN(randomBytes(Math.ceil(bits / 8)));
  17831. while (num.bitLength() > bits) {
  17832. num.ishrn(1);
  17833. }
  17834. if (num.isEven()) {
  17835. num.iadd(ONE);
  17836. }
  17837. if (!num.testn(1)) {
  17838. num.iadd(TWO);
  17839. }
  17840. if (!gen.cmp(TWO)) {
  17841. while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
  17842. num.iadd(FOUR);
  17843. }
  17844. } else if (!gen.cmp(FIVE)) {
  17845. while (num.mod(TEN).cmp(THREE)) {
  17846. num.iadd(FOUR);
  17847. }
  17848. }
  17849. n2 = num.shrn(1);
  17850. if (simpleSieve(n2) && simpleSieve(num) &&
  17851. fermatTest(n2) && fermatTest(num) &&
  17852. millerRabin.test(n2) && millerRabin.test(num)) {
  17853. return num;
  17854. }
  17855. }
  17856. }
  17857. /***/ }),
  17858. /* 169 */
  17859. /*!**************************************!*\
  17860. !*** ./node_modules/bn.js/lib/bn.js ***!
  17861. \**************************************/
  17862. /*! no static exports found */
  17863. /***/ (function(module, exports, __webpack_require__) {
  17864. /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
  17865. 'use strict';
  17866. // Utils
  17867. function assert (val, msg) {
  17868. if (!val) throw new Error(msg || 'Assertion failed');
  17869. }
  17870. // Could use `inherits` module, but don't want to move from single file
  17871. // architecture yet.
  17872. function inherits (ctor, superCtor) {
  17873. ctor.super_ = superCtor;
  17874. var TempCtor = function () {};
  17875. TempCtor.prototype = superCtor.prototype;
  17876. ctor.prototype = new TempCtor();
  17877. ctor.prototype.constructor = ctor;
  17878. }
  17879. // BN
  17880. function BN (number, base, endian) {
  17881. if (BN.isBN(number)) {
  17882. return number;
  17883. }
  17884. this.negative = 0;
  17885. this.words = null;
  17886. this.length = 0;
  17887. // Reduction context
  17888. this.red = null;
  17889. if (number !== null) {
  17890. if (base === 'le' || base === 'be') {
  17891. endian = base;
  17892. base = 10;
  17893. }
  17894. this._init(number || 0, base || 10, endian || 'be');
  17895. }
  17896. }
  17897. if (typeof module === 'object') {
  17898. module.exports = BN;
  17899. } else {
  17900. exports.BN = BN;
  17901. }
  17902. BN.BN = BN;
  17903. BN.wordSize = 26;
  17904. var Buffer;
  17905. try {
  17906. Buffer = __webpack_require__(/*! buffer */ 171).Buffer;
  17907. } catch (e) {
  17908. }
  17909. BN.isBN = function isBN (num) {
  17910. if (num instanceof BN) {
  17911. return true;
  17912. }
  17913. return num !== null && typeof num === 'object' &&
  17914. num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
  17915. };
  17916. BN.max = function max (left, right) {
  17917. if (left.cmp(right) > 0) return left;
  17918. return right;
  17919. };
  17920. BN.min = function min (left, right) {
  17921. if (left.cmp(right) < 0) return left;
  17922. return right;
  17923. };
  17924. BN.prototype._init = function init (number, base, endian) {
  17925. if (typeof number === 'number') {
  17926. return this._initNumber(number, base, endian);
  17927. }
  17928. if (typeof number === 'object') {
  17929. return this._initArray(number, base, endian);
  17930. }
  17931. if (base === 'hex') {
  17932. base = 16;
  17933. }
  17934. assert(base === (base | 0) && base >= 2 && base <= 36);
  17935. number = number.toString().replace(/\s+/g, '');
  17936. var start = 0;
  17937. if (number[0] === '-') {
  17938. start++;
  17939. }
  17940. if (base === 16) {
  17941. this._parseHex(number, start);
  17942. } else {
  17943. this._parseBase(number, base, start);
  17944. }
  17945. if (number[0] === '-') {
  17946. this.negative = 1;
  17947. }
  17948. this._strip();
  17949. if (endian !== 'le') return;
  17950. this._initArray(this.toArray(), base, endian);
  17951. };
  17952. BN.prototype._initNumber = function _initNumber (number, base, endian) {
  17953. if (number < 0) {
  17954. this.negative = 1;
  17955. number = -number;
  17956. }
  17957. if (number < 0x4000000) {
  17958. this.words = [number & 0x3ffffff];
  17959. this.length = 1;
  17960. } else if (number < 0x10000000000000) {
  17961. this.words = [
  17962. number & 0x3ffffff,
  17963. (number / 0x4000000) & 0x3ffffff
  17964. ];
  17965. this.length = 2;
  17966. } else {
  17967. assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
  17968. this.words = [
  17969. number & 0x3ffffff,
  17970. (number / 0x4000000) & 0x3ffffff,
  17971. 1
  17972. ];
  17973. this.length = 3;
  17974. }
  17975. if (endian !== 'le') return;
  17976. // Reverse the bytes
  17977. this._initArray(this.toArray(), base, endian);
  17978. };
  17979. BN.prototype._initArray = function _initArray (number, base, endian) {
  17980. // Perhaps a Uint8Array
  17981. assert(typeof number.length === 'number');
  17982. if (number.length <= 0) {
  17983. this.words = [0];
  17984. this.length = 1;
  17985. return this;
  17986. }
  17987. this.length = Math.ceil(number.length / 3);
  17988. this.words = new Array(this.length);
  17989. for (var i = 0; i < this.length; i++) {
  17990. this.words[i] = 0;
  17991. }
  17992. var j, w;
  17993. var off = 0;
  17994. if (endian === 'be') {
  17995. for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
  17996. w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
  17997. this.words[j] |= (w << off) & 0x3ffffff;
  17998. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  17999. off += 24;
  18000. if (off >= 26) {
  18001. off -= 26;
  18002. j++;
  18003. }
  18004. }
  18005. } else if (endian === 'le') {
  18006. for (i = 0, j = 0; i < number.length; i += 3) {
  18007. w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
  18008. this.words[j] |= (w << off) & 0x3ffffff;
  18009. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  18010. off += 24;
  18011. if (off >= 26) {
  18012. off -= 26;
  18013. j++;
  18014. }
  18015. }
  18016. }
  18017. return this._strip();
  18018. };
  18019. function parseHex (str, start, end) {
  18020. var r = 0;
  18021. var len = Math.min(str.length, end);
  18022. var z = 0;
  18023. for (var i = start; i < len; i++) {
  18024. var c = str.charCodeAt(i) - 48;
  18025. r <<= 4;
  18026. var b;
  18027. // 'a' - 'f'
  18028. if (c >= 49 && c <= 54) {
  18029. b = c - 49 + 0xa;
  18030. // 'A' - 'F'
  18031. } else if (c >= 17 && c <= 22) {
  18032. b = c - 17 + 0xa;
  18033. // '0' - '9'
  18034. } else {
  18035. b = c;
  18036. }
  18037. r |= b;
  18038. z |= b;
  18039. }
  18040. assert(!(z & 0xf0), 'Invalid character in ' + str);
  18041. return r;
  18042. }
  18043. BN.prototype._parseHex = function _parseHex (number, start) {
  18044. // Create possibly bigger array to ensure that it fits the number
  18045. this.length = Math.ceil((number.length - start) / 6);
  18046. this.words = new Array(this.length);
  18047. for (var i = 0; i < this.length; i++) {
  18048. this.words[i] = 0;
  18049. }
  18050. var j, w;
  18051. // Scan 24-bit chunks and add them to the number
  18052. var off = 0;
  18053. for (i = number.length - 6, j = 0; i >= start; i -= 6) {
  18054. w = parseHex(number, i, i + 6);
  18055. this.words[j] |= (w << off) & 0x3ffffff;
  18056. // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
  18057. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  18058. off += 24;
  18059. if (off >= 26) {
  18060. off -= 26;
  18061. j++;
  18062. }
  18063. }
  18064. if (i + 6 !== start) {
  18065. w = parseHex(number, start, i + 6);
  18066. this.words[j] |= (w << off) & 0x3ffffff;
  18067. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  18068. }
  18069. this._strip();
  18070. };
  18071. function parseBase (str, start, end, mul) {
  18072. var r = 0;
  18073. var b = 0;
  18074. var len = Math.min(str.length, end);
  18075. for (var i = start; i < len; i++) {
  18076. var c = str.charCodeAt(i) - 48;
  18077. r *= mul;
  18078. // 'a'
  18079. if (c >= 49) {
  18080. b = c - 49 + 0xa;
  18081. // 'A'
  18082. } else if (c >= 17) {
  18083. b = c - 17 + 0xa;
  18084. // '0' - '9'
  18085. } else {
  18086. b = c;
  18087. }
  18088. assert(c >= 0 && b < mul, 'Invalid character');
  18089. r += b;
  18090. }
  18091. return r;
  18092. }
  18093. BN.prototype._parseBase = function _parseBase (number, base, start) {
  18094. // Initialize as zero
  18095. this.words = [0];
  18096. this.length = 1;
  18097. // Find length of limb in base
  18098. for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
  18099. limbLen++;
  18100. }
  18101. limbLen--;
  18102. limbPow = (limbPow / base) | 0;
  18103. var total = number.length - start;
  18104. var mod = total % limbLen;
  18105. var end = Math.min(total, total - mod) + start;
  18106. var word = 0;
  18107. for (var i = start; i < end; i += limbLen) {
  18108. word = parseBase(number, i, i + limbLen, base);
  18109. this.imuln(limbPow);
  18110. if (this.words[0] + word < 0x4000000) {
  18111. this.words[0] += word;
  18112. } else {
  18113. this._iaddn(word);
  18114. }
  18115. }
  18116. if (mod !== 0) {
  18117. var pow = 1;
  18118. word = parseBase(number, i, number.length, base);
  18119. for (i = 0; i < mod; i++) {
  18120. pow *= base;
  18121. }
  18122. this.imuln(pow);
  18123. if (this.words[0] + word < 0x4000000) {
  18124. this.words[0] += word;
  18125. } else {
  18126. this._iaddn(word);
  18127. }
  18128. }
  18129. };
  18130. BN.prototype.copy = function copy (dest) {
  18131. dest.words = new Array(this.length);
  18132. for (var i = 0; i < this.length; i++) {
  18133. dest.words[i] = this.words[i];
  18134. }
  18135. dest.length = this.length;
  18136. dest.negative = this.negative;
  18137. dest.red = this.red;
  18138. };
  18139. function move (dest, src) {
  18140. dest.words = src.words;
  18141. dest.length = src.length;
  18142. dest.negative = src.negative;
  18143. dest.red = src.red;
  18144. }
  18145. BN.prototype._move = function _move (dest) {
  18146. move(dest, this);
  18147. };
  18148. BN.prototype.clone = function clone () {
  18149. var r = new BN(null);
  18150. this.copy(r);
  18151. return r;
  18152. };
  18153. BN.prototype._expand = function _expand (size) {
  18154. while (this.length < size) {
  18155. this.words[this.length++] = 0;
  18156. }
  18157. return this;
  18158. };
  18159. // Remove leading `0` from `this`
  18160. BN.prototype._strip = function strip () {
  18161. while (this.length > 1 && this.words[this.length - 1] === 0) {
  18162. this.length--;
  18163. }
  18164. return this._normSign();
  18165. };
  18166. BN.prototype._normSign = function _normSign () {
  18167. // -0 = 0
  18168. if (this.length === 1 && this.words[0] === 0) {
  18169. this.negative = 0;
  18170. }
  18171. return this;
  18172. };
  18173. // Check Symbol.for because not everywhere where Symbol defined
  18174. // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility
  18175. if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
  18176. BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;
  18177. } else {
  18178. BN.prototype.inspect = inspect;
  18179. }
  18180. function inspect () {
  18181. return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
  18182. }
  18183. /*
  18184. var zeros = [];
  18185. var groupSizes = [];
  18186. var groupBases = [];
  18187. var s = '';
  18188. var i = -1;
  18189. while (++i < BN.wordSize) {
  18190. zeros[i] = s;
  18191. s += '0';
  18192. }
  18193. groupSizes[0] = 0;
  18194. groupSizes[1] = 0;
  18195. groupBases[0] = 0;
  18196. groupBases[1] = 0;
  18197. var base = 2 - 1;
  18198. while (++base < 36 + 1) {
  18199. var groupSize = 0;
  18200. var groupBase = 1;
  18201. while (groupBase < (1 << BN.wordSize) / base) {
  18202. groupBase *= base;
  18203. groupSize += 1;
  18204. }
  18205. groupSizes[base] = groupSize;
  18206. groupBases[base] = groupBase;
  18207. }
  18208. */
  18209. var zeros = [
  18210. '',
  18211. '0',
  18212. '00',
  18213. '000',
  18214. '0000',
  18215. '00000',
  18216. '000000',
  18217. '0000000',
  18218. '00000000',
  18219. '000000000',
  18220. '0000000000',
  18221. '00000000000',
  18222. '000000000000',
  18223. '0000000000000',
  18224. '00000000000000',
  18225. '000000000000000',
  18226. '0000000000000000',
  18227. '00000000000000000',
  18228. '000000000000000000',
  18229. '0000000000000000000',
  18230. '00000000000000000000',
  18231. '000000000000000000000',
  18232. '0000000000000000000000',
  18233. '00000000000000000000000',
  18234. '000000000000000000000000',
  18235. '0000000000000000000000000'
  18236. ];
  18237. var groupSizes = [
  18238. 0, 0,
  18239. 25, 16, 12, 11, 10, 9, 8,
  18240. 8, 7, 7, 7, 7, 6, 6,
  18241. 6, 6, 6, 6, 6, 5, 5,
  18242. 5, 5, 5, 5, 5, 5, 5,
  18243. 5, 5, 5, 5, 5, 5, 5
  18244. ];
  18245. var groupBases = [
  18246. 0, 0,
  18247. 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
  18248. 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
  18249. 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
  18250. 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
  18251. 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  18252. ];
  18253. BN.prototype.toString = function toString (base, padding) {
  18254. base = base || 10;
  18255. padding = padding | 0 || 1;
  18256. var out;
  18257. if (base === 16 || base === 'hex') {
  18258. out = '';
  18259. var off = 0;
  18260. var carry = 0;
  18261. for (var i = 0; i < this.length; i++) {
  18262. var w = this.words[i];
  18263. var word = (((w << off) | carry) & 0xffffff).toString(16);
  18264. carry = (w >>> (24 - off)) & 0xffffff;
  18265. if (carry !== 0 || i !== this.length - 1) {
  18266. out = zeros[6 - word.length] + word + out;
  18267. } else {
  18268. out = word + out;
  18269. }
  18270. off += 2;
  18271. if (off >= 26) {
  18272. off -= 26;
  18273. i--;
  18274. }
  18275. }
  18276. if (carry !== 0) {
  18277. out = carry.toString(16) + out;
  18278. }
  18279. while (out.length % padding !== 0) {
  18280. out = '0' + out;
  18281. }
  18282. if (this.negative !== 0) {
  18283. out = '-' + out;
  18284. }
  18285. return out;
  18286. }
  18287. if (base === (base | 0) && base >= 2 && base <= 36) {
  18288. // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
  18289. var groupSize = groupSizes[base];
  18290. // var groupBase = Math.pow(base, groupSize);
  18291. var groupBase = groupBases[base];
  18292. out = '';
  18293. var c = this.clone();
  18294. c.negative = 0;
  18295. while (!c.isZero()) {
  18296. var r = c.modrn(groupBase).toString(base);
  18297. c = c.idivn(groupBase);
  18298. if (!c.isZero()) {
  18299. out = zeros[groupSize - r.length] + r + out;
  18300. } else {
  18301. out = r + out;
  18302. }
  18303. }
  18304. if (this.isZero()) {
  18305. out = '0' + out;
  18306. }
  18307. while (out.length % padding !== 0) {
  18308. out = '0' + out;
  18309. }
  18310. if (this.negative !== 0) {
  18311. out = '-' + out;
  18312. }
  18313. return out;
  18314. }
  18315. assert(false, 'Base should be between 2 and 36');
  18316. };
  18317. BN.prototype.toNumber = function toNumber () {
  18318. var ret = this.words[0];
  18319. if (this.length === 2) {
  18320. ret += this.words[1] * 0x4000000;
  18321. } else if (this.length === 3 && this.words[2] === 0x01) {
  18322. // NOTE: at this stage it is known that the top bit is set
  18323. ret += 0x10000000000000 + (this.words[1] * 0x4000000);
  18324. } else if (this.length > 2) {
  18325. assert(false, 'Number can only safely store up to 53 bits');
  18326. }
  18327. return (this.negative !== 0) ? -ret : ret;
  18328. };
  18329. BN.prototype.toJSON = function toJSON () {
  18330. return this.toString(16, 2);
  18331. };
  18332. if (Buffer) {
  18333. BN.prototype.toBuffer = function toBuffer (endian, length) {
  18334. return this.toArrayLike(Buffer, endian, length);
  18335. };
  18336. }
  18337. BN.prototype.toArray = function toArray (endian, length) {
  18338. return this.toArrayLike(Array, endian, length);
  18339. };
  18340. var allocate = function allocate (ArrayType, size) {
  18341. if (ArrayType.allocUnsafe) {
  18342. return ArrayType.allocUnsafe(size);
  18343. }
  18344. return new ArrayType(size);
  18345. };
  18346. BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
  18347. this._strip();
  18348. var byteLength = this.byteLength();
  18349. var reqLength = length || Math.max(1, byteLength);
  18350. assert(byteLength <= reqLength, 'byte array longer than desired length');
  18351. assert(reqLength > 0, 'Requested array length <= 0');
  18352. var res = allocate(ArrayType, reqLength);
  18353. var postfix = endian === 'le' ? 'LE' : 'BE';
  18354. this['_toArrayLike' + postfix](res, byteLength);
  18355. return res;
  18356. };
  18357. BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {
  18358. var position = 0;
  18359. var carry = 0;
  18360. for (var i = 0, shift = 0; i < this.length; i++) {
  18361. var word = (this.words[i] << shift) | carry;
  18362. res[position++] = word & 0xff;
  18363. if (position < res.length) {
  18364. res[position++] = (word >> 8) & 0xff;
  18365. }
  18366. if (position < res.length) {
  18367. res[position++] = (word >> 16) & 0xff;
  18368. }
  18369. if (shift === 6) {
  18370. if (position < res.length) {
  18371. res[position++] = (word >> 24) & 0xff;
  18372. }
  18373. carry = 0;
  18374. shift = 0;
  18375. } else {
  18376. carry = word >>> 24;
  18377. shift += 2;
  18378. }
  18379. }
  18380. if (position < res.length) {
  18381. res[position++] = carry;
  18382. while (position < res.length) {
  18383. res[position++] = 0;
  18384. }
  18385. }
  18386. };
  18387. BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {
  18388. var position = res.length - 1;
  18389. var carry = 0;
  18390. for (var i = 0, shift = 0; i < this.length; i++) {
  18391. var word = (this.words[i] << shift) | carry;
  18392. res[position--] = word & 0xff;
  18393. if (position >= 0) {
  18394. res[position--] = (word >> 8) & 0xff;
  18395. }
  18396. if (position >= 0) {
  18397. res[position--] = (word >> 16) & 0xff;
  18398. }
  18399. if (shift === 6) {
  18400. if (position >= 0) {
  18401. res[position--] = (word >> 24) & 0xff;
  18402. }
  18403. carry = 0;
  18404. shift = 0;
  18405. } else {
  18406. carry = word >>> 24;
  18407. shift += 2;
  18408. }
  18409. }
  18410. if (position >= 0) {
  18411. res[position--] = carry;
  18412. while (position >= 0) {
  18413. res[position--] = 0;
  18414. }
  18415. }
  18416. };
  18417. if (Math.clz32) {
  18418. BN.prototype._countBits = function _countBits (w) {
  18419. return 32 - Math.clz32(w);
  18420. };
  18421. } else {
  18422. BN.prototype._countBits = function _countBits (w) {
  18423. var t = w;
  18424. var r = 0;
  18425. if (t >= 0x1000) {
  18426. r += 13;
  18427. t >>>= 13;
  18428. }
  18429. if (t >= 0x40) {
  18430. r += 7;
  18431. t >>>= 7;
  18432. }
  18433. if (t >= 0x8) {
  18434. r += 4;
  18435. t >>>= 4;
  18436. }
  18437. if (t >= 0x02) {
  18438. r += 2;
  18439. t >>>= 2;
  18440. }
  18441. return r + t;
  18442. };
  18443. }
  18444. BN.prototype._zeroBits = function _zeroBits (w) {
  18445. // Short-cut
  18446. if (w === 0) return 26;
  18447. var t = w;
  18448. var r = 0;
  18449. if ((t & 0x1fff) === 0) {
  18450. r += 13;
  18451. t >>>= 13;
  18452. }
  18453. if ((t & 0x7f) === 0) {
  18454. r += 7;
  18455. t >>>= 7;
  18456. }
  18457. if ((t & 0xf) === 0) {
  18458. r += 4;
  18459. t >>>= 4;
  18460. }
  18461. if ((t & 0x3) === 0) {
  18462. r += 2;
  18463. t >>>= 2;
  18464. }
  18465. if ((t & 0x1) === 0) {
  18466. r++;
  18467. }
  18468. return r;
  18469. };
  18470. // Return number of used bits in a BN
  18471. BN.prototype.bitLength = function bitLength () {
  18472. var w = this.words[this.length - 1];
  18473. var hi = this._countBits(w);
  18474. return (this.length - 1) * 26 + hi;
  18475. };
  18476. function toBitArray (num) {
  18477. var w = new Array(num.bitLength());
  18478. for (var bit = 0; bit < w.length; bit++) {
  18479. var off = (bit / 26) | 0;
  18480. var wbit = bit % 26;
  18481. w[bit] = (num.words[off] >>> wbit) & 0x01;
  18482. }
  18483. return w;
  18484. }
  18485. // Number of trailing zero bits
  18486. BN.prototype.zeroBits = function zeroBits () {
  18487. if (this.isZero()) return 0;
  18488. var r = 0;
  18489. for (var i = 0; i < this.length; i++) {
  18490. var b = this._zeroBits(this.words[i]);
  18491. r += b;
  18492. if (b !== 26) break;
  18493. }
  18494. return r;
  18495. };
  18496. BN.prototype.byteLength = function byteLength () {
  18497. return Math.ceil(this.bitLength() / 8);
  18498. };
  18499. BN.prototype.toTwos = function toTwos (width) {
  18500. if (this.negative !== 0) {
  18501. return this.abs().inotn(width).iaddn(1);
  18502. }
  18503. return this.clone();
  18504. };
  18505. BN.prototype.fromTwos = function fromTwos (width) {
  18506. if (this.testn(width - 1)) {
  18507. return this.notn(width).iaddn(1).ineg();
  18508. }
  18509. return this.clone();
  18510. };
  18511. BN.prototype.isNeg = function isNeg () {
  18512. return this.negative !== 0;
  18513. };
  18514. // Return negative clone of `this`
  18515. BN.prototype.neg = function neg () {
  18516. return this.clone().ineg();
  18517. };
  18518. BN.prototype.ineg = function ineg () {
  18519. if (!this.isZero()) {
  18520. this.negative ^= 1;
  18521. }
  18522. return this;
  18523. };
  18524. // Or `num` with `this` in-place
  18525. BN.prototype.iuor = function iuor (num) {
  18526. while (this.length < num.length) {
  18527. this.words[this.length++] = 0;
  18528. }
  18529. for (var i = 0; i < num.length; i++) {
  18530. this.words[i] = this.words[i] | num.words[i];
  18531. }
  18532. return this._strip();
  18533. };
  18534. BN.prototype.ior = function ior (num) {
  18535. assert((this.negative | num.negative) === 0);
  18536. return this.iuor(num);
  18537. };
  18538. // Or `num` with `this`
  18539. BN.prototype.or = function or (num) {
  18540. if (this.length > num.length) return this.clone().ior(num);
  18541. return num.clone().ior(this);
  18542. };
  18543. BN.prototype.uor = function uor (num) {
  18544. if (this.length > num.length) return this.clone().iuor(num);
  18545. return num.clone().iuor(this);
  18546. };
  18547. // And `num` with `this` in-place
  18548. BN.prototype.iuand = function iuand (num) {
  18549. // b = min-length(num, this)
  18550. var b;
  18551. if (this.length > num.length) {
  18552. b = num;
  18553. } else {
  18554. b = this;
  18555. }
  18556. for (var i = 0; i < b.length; i++) {
  18557. this.words[i] = this.words[i] & num.words[i];
  18558. }
  18559. this.length = b.length;
  18560. return this._strip();
  18561. };
  18562. BN.prototype.iand = function iand (num) {
  18563. assert((this.negative | num.negative) === 0);
  18564. return this.iuand(num);
  18565. };
  18566. // And `num` with `this`
  18567. BN.prototype.and = function and (num) {
  18568. if (this.length > num.length) return this.clone().iand(num);
  18569. return num.clone().iand(this);
  18570. };
  18571. BN.prototype.uand = function uand (num) {
  18572. if (this.length > num.length) return this.clone().iuand(num);
  18573. return num.clone().iuand(this);
  18574. };
  18575. // Xor `num` with `this` in-place
  18576. BN.prototype.iuxor = function iuxor (num) {
  18577. // a.length > b.length
  18578. var a;
  18579. var b;
  18580. if (this.length > num.length) {
  18581. a = this;
  18582. b = num;
  18583. } else {
  18584. a = num;
  18585. b = this;
  18586. }
  18587. for (var i = 0; i < b.length; i++) {
  18588. this.words[i] = a.words[i] ^ b.words[i];
  18589. }
  18590. if (this !== a) {
  18591. for (; i < a.length; i++) {
  18592. this.words[i] = a.words[i];
  18593. }
  18594. }
  18595. this.length = a.length;
  18596. return this._strip();
  18597. };
  18598. BN.prototype.ixor = function ixor (num) {
  18599. assert((this.negative | num.negative) === 0);
  18600. return this.iuxor(num);
  18601. };
  18602. // Xor `num` with `this`
  18603. BN.prototype.xor = function xor (num) {
  18604. if (this.length > num.length) return this.clone().ixor(num);
  18605. return num.clone().ixor(this);
  18606. };
  18607. BN.prototype.uxor = function uxor (num) {
  18608. if (this.length > num.length) return this.clone().iuxor(num);
  18609. return num.clone().iuxor(this);
  18610. };
  18611. // Not ``this`` with ``width`` bitwidth
  18612. BN.prototype.inotn = function inotn (width) {
  18613. assert(typeof width === 'number' && width >= 0);
  18614. var bytesNeeded = Math.ceil(width / 26) | 0;
  18615. var bitsLeft = width % 26;
  18616. // Extend the buffer with leading zeroes
  18617. this._expand(bytesNeeded);
  18618. if (bitsLeft > 0) {
  18619. bytesNeeded--;
  18620. }
  18621. // Handle complete words
  18622. for (var i = 0; i < bytesNeeded; i++) {
  18623. this.words[i] = ~this.words[i] & 0x3ffffff;
  18624. }
  18625. // Handle the residue
  18626. if (bitsLeft > 0) {
  18627. this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
  18628. }
  18629. // And remove leading zeroes
  18630. return this._strip();
  18631. };
  18632. BN.prototype.notn = function notn (width) {
  18633. return this.clone().inotn(width);
  18634. };
  18635. // Set `bit` of `this`
  18636. BN.prototype.setn = function setn (bit, val) {
  18637. assert(typeof bit === 'number' && bit >= 0);
  18638. var off = (bit / 26) | 0;
  18639. var wbit = bit % 26;
  18640. this._expand(off + 1);
  18641. if (val) {
  18642. this.words[off] = this.words[off] | (1 << wbit);
  18643. } else {
  18644. this.words[off] = this.words[off] & ~(1 << wbit);
  18645. }
  18646. return this._strip();
  18647. };
  18648. // Add `num` to `this` in-place
  18649. BN.prototype.iadd = function iadd (num) {
  18650. var r;
  18651. // negative + positive
  18652. if (this.negative !== 0 && num.negative === 0) {
  18653. this.negative = 0;
  18654. r = this.isub(num);
  18655. this.negative ^= 1;
  18656. return this._normSign();
  18657. // positive + negative
  18658. } else if (this.negative === 0 && num.negative !== 0) {
  18659. num.negative = 0;
  18660. r = this.isub(num);
  18661. num.negative = 1;
  18662. return r._normSign();
  18663. }
  18664. // a.length > b.length
  18665. var a, b;
  18666. if (this.length > num.length) {
  18667. a = this;
  18668. b = num;
  18669. } else {
  18670. a = num;
  18671. b = this;
  18672. }
  18673. var carry = 0;
  18674. for (var i = 0; i < b.length; i++) {
  18675. r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
  18676. this.words[i] = r & 0x3ffffff;
  18677. carry = r >>> 26;
  18678. }
  18679. for (; carry !== 0 && i < a.length; i++) {
  18680. r = (a.words[i] | 0) + carry;
  18681. this.words[i] = r & 0x3ffffff;
  18682. carry = r >>> 26;
  18683. }
  18684. this.length = a.length;
  18685. if (carry !== 0) {
  18686. this.words[this.length] = carry;
  18687. this.length++;
  18688. // Copy the rest of the words
  18689. } else if (a !== this) {
  18690. for (; i < a.length; i++) {
  18691. this.words[i] = a.words[i];
  18692. }
  18693. }
  18694. return this;
  18695. };
  18696. // Add `num` to `this`
  18697. BN.prototype.add = function add (num) {
  18698. var res;
  18699. if (num.negative !== 0 && this.negative === 0) {
  18700. num.negative = 0;
  18701. res = this.sub(num);
  18702. num.negative ^= 1;
  18703. return res;
  18704. } else if (num.negative === 0 && this.negative !== 0) {
  18705. this.negative = 0;
  18706. res = num.sub(this);
  18707. this.negative = 1;
  18708. return res;
  18709. }
  18710. if (this.length > num.length) return this.clone().iadd(num);
  18711. return num.clone().iadd(this);
  18712. };
  18713. // Subtract `num` from `this` in-place
  18714. BN.prototype.isub = function isub (num) {
  18715. // this - (-num) = this + num
  18716. if (num.negative !== 0) {
  18717. num.negative = 0;
  18718. var r = this.iadd(num);
  18719. num.negative = 1;
  18720. return r._normSign();
  18721. // -this - num = -(this + num)
  18722. } else if (this.negative !== 0) {
  18723. this.negative = 0;
  18724. this.iadd(num);
  18725. this.negative = 1;
  18726. return this._normSign();
  18727. }
  18728. // At this point both numbers are positive
  18729. var cmp = this.cmp(num);
  18730. // Optimization - zeroify
  18731. if (cmp === 0) {
  18732. this.negative = 0;
  18733. this.length = 1;
  18734. this.words[0] = 0;
  18735. return this;
  18736. }
  18737. // a > b
  18738. var a, b;
  18739. if (cmp > 0) {
  18740. a = this;
  18741. b = num;
  18742. } else {
  18743. a = num;
  18744. b = this;
  18745. }
  18746. var carry = 0;
  18747. for (var i = 0; i < b.length; i++) {
  18748. r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
  18749. carry = r >> 26;
  18750. this.words[i] = r & 0x3ffffff;
  18751. }
  18752. for (; carry !== 0 && i < a.length; i++) {
  18753. r = (a.words[i] | 0) + carry;
  18754. carry = r >> 26;
  18755. this.words[i] = r & 0x3ffffff;
  18756. }
  18757. // Copy rest of the words
  18758. if (carry === 0 && i < a.length && a !== this) {
  18759. for (; i < a.length; i++) {
  18760. this.words[i] = a.words[i];
  18761. }
  18762. }
  18763. this.length = Math.max(this.length, i);
  18764. if (a !== this) {
  18765. this.negative = 1;
  18766. }
  18767. return this._strip();
  18768. };
  18769. // Subtract `num` from `this`
  18770. BN.prototype.sub = function sub (num) {
  18771. return this.clone().isub(num);
  18772. };
  18773. function smallMulTo (self, num, out) {
  18774. out.negative = num.negative ^ self.negative;
  18775. var len = (self.length + num.length) | 0;
  18776. out.length = len;
  18777. len = (len - 1) | 0;
  18778. // Peel one iteration (compiler can't do it, because of code complexity)
  18779. var a = self.words[0] | 0;
  18780. var b = num.words[0] | 0;
  18781. var r = a * b;
  18782. var lo = r & 0x3ffffff;
  18783. var carry = (r / 0x4000000) | 0;
  18784. out.words[0] = lo;
  18785. for (var k = 1; k < len; k++) {
  18786. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  18787. // note that ncarry could be >= 0x3ffffff
  18788. var ncarry = carry >>> 26;
  18789. var rword = carry & 0x3ffffff;
  18790. var maxJ = Math.min(k, num.length - 1);
  18791. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  18792. var i = (k - j) | 0;
  18793. a = self.words[i] | 0;
  18794. b = num.words[j] | 0;
  18795. r = a * b + rword;
  18796. ncarry += (r / 0x4000000) | 0;
  18797. rword = r & 0x3ffffff;
  18798. }
  18799. out.words[k] = rword | 0;
  18800. carry = ncarry | 0;
  18801. }
  18802. if (carry !== 0) {
  18803. out.words[k] = carry | 0;
  18804. } else {
  18805. out.length--;
  18806. }
  18807. return out._strip();
  18808. }
  18809. // TODO(indutny): it may be reasonable to omit it for users who don't need
  18810. // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
  18811. // multiplication (like elliptic secp256k1).
  18812. var comb10MulTo = function comb10MulTo (self, num, out) {
  18813. var a = self.words;
  18814. var b = num.words;
  18815. var o = out.words;
  18816. var c = 0;
  18817. var lo;
  18818. var mid;
  18819. var hi;
  18820. var a0 = a[0] | 0;
  18821. var al0 = a0 & 0x1fff;
  18822. var ah0 = a0 >>> 13;
  18823. var a1 = a[1] | 0;
  18824. var al1 = a1 & 0x1fff;
  18825. var ah1 = a1 >>> 13;
  18826. var a2 = a[2] | 0;
  18827. var al2 = a2 & 0x1fff;
  18828. var ah2 = a2 >>> 13;
  18829. var a3 = a[3] | 0;
  18830. var al3 = a3 & 0x1fff;
  18831. var ah3 = a3 >>> 13;
  18832. var a4 = a[4] | 0;
  18833. var al4 = a4 & 0x1fff;
  18834. var ah4 = a4 >>> 13;
  18835. var a5 = a[5] | 0;
  18836. var al5 = a5 & 0x1fff;
  18837. var ah5 = a5 >>> 13;
  18838. var a6 = a[6] | 0;
  18839. var al6 = a6 & 0x1fff;
  18840. var ah6 = a6 >>> 13;
  18841. var a7 = a[7] | 0;
  18842. var al7 = a7 & 0x1fff;
  18843. var ah7 = a7 >>> 13;
  18844. var a8 = a[8] | 0;
  18845. var al8 = a8 & 0x1fff;
  18846. var ah8 = a8 >>> 13;
  18847. var a9 = a[9] | 0;
  18848. var al9 = a9 & 0x1fff;
  18849. var ah9 = a9 >>> 13;
  18850. var b0 = b[0] | 0;
  18851. var bl0 = b0 & 0x1fff;
  18852. var bh0 = b0 >>> 13;
  18853. var b1 = b[1] | 0;
  18854. var bl1 = b1 & 0x1fff;
  18855. var bh1 = b1 >>> 13;
  18856. var b2 = b[2] | 0;
  18857. var bl2 = b2 & 0x1fff;
  18858. var bh2 = b2 >>> 13;
  18859. var b3 = b[3] | 0;
  18860. var bl3 = b3 & 0x1fff;
  18861. var bh3 = b3 >>> 13;
  18862. var b4 = b[4] | 0;
  18863. var bl4 = b4 & 0x1fff;
  18864. var bh4 = b4 >>> 13;
  18865. var b5 = b[5] | 0;
  18866. var bl5 = b5 & 0x1fff;
  18867. var bh5 = b5 >>> 13;
  18868. var b6 = b[6] | 0;
  18869. var bl6 = b6 & 0x1fff;
  18870. var bh6 = b6 >>> 13;
  18871. var b7 = b[7] | 0;
  18872. var bl7 = b7 & 0x1fff;
  18873. var bh7 = b7 >>> 13;
  18874. var b8 = b[8] | 0;
  18875. var bl8 = b8 & 0x1fff;
  18876. var bh8 = b8 >>> 13;
  18877. var b9 = b[9] | 0;
  18878. var bl9 = b9 & 0x1fff;
  18879. var bh9 = b9 >>> 13;
  18880. out.negative = self.negative ^ num.negative;
  18881. out.length = 19;
  18882. /* k = 0 */
  18883. lo = Math.imul(al0, bl0);
  18884. mid = Math.imul(al0, bh0);
  18885. mid = (mid + Math.imul(ah0, bl0)) | 0;
  18886. hi = Math.imul(ah0, bh0);
  18887. var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  18888. c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
  18889. w0 &= 0x3ffffff;
  18890. /* k = 1 */
  18891. lo = Math.imul(al1, bl0);
  18892. mid = Math.imul(al1, bh0);
  18893. mid = (mid + Math.imul(ah1, bl0)) | 0;
  18894. hi = Math.imul(ah1, bh0);
  18895. lo = (lo + Math.imul(al0, bl1)) | 0;
  18896. mid = (mid + Math.imul(al0, bh1)) | 0;
  18897. mid = (mid + Math.imul(ah0, bl1)) | 0;
  18898. hi = (hi + Math.imul(ah0, bh1)) | 0;
  18899. var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  18900. c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
  18901. w1 &= 0x3ffffff;
  18902. /* k = 2 */
  18903. lo = Math.imul(al2, bl0);
  18904. mid = Math.imul(al2, bh0);
  18905. mid = (mid + Math.imul(ah2, bl0)) | 0;
  18906. hi = Math.imul(ah2, bh0);
  18907. lo = (lo + Math.imul(al1, bl1)) | 0;
  18908. mid = (mid + Math.imul(al1, bh1)) | 0;
  18909. mid = (mid + Math.imul(ah1, bl1)) | 0;
  18910. hi = (hi + Math.imul(ah1, bh1)) | 0;
  18911. lo = (lo + Math.imul(al0, bl2)) | 0;
  18912. mid = (mid + Math.imul(al0, bh2)) | 0;
  18913. mid = (mid + Math.imul(ah0, bl2)) | 0;
  18914. hi = (hi + Math.imul(ah0, bh2)) | 0;
  18915. var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  18916. c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
  18917. w2 &= 0x3ffffff;
  18918. /* k = 3 */
  18919. lo = Math.imul(al3, bl0);
  18920. mid = Math.imul(al3, bh0);
  18921. mid = (mid + Math.imul(ah3, bl0)) | 0;
  18922. hi = Math.imul(ah3, bh0);
  18923. lo = (lo + Math.imul(al2, bl1)) | 0;
  18924. mid = (mid + Math.imul(al2, bh1)) | 0;
  18925. mid = (mid + Math.imul(ah2, bl1)) | 0;
  18926. hi = (hi + Math.imul(ah2, bh1)) | 0;
  18927. lo = (lo + Math.imul(al1, bl2)) | 0;
  18928. mid = (mid + Math.imul(al1, bh2)) | 0;
  18929. mid = (mid + Math.imul(ah1, bl2)) | 0;
  18930. hi = (hi + Math.imul(ah1, bh2)) | 0;
  18931. lo = (lo + Math.imul(al0, bl3)) | 0;
  18932. mid = (mid + Math.imul(al0, bh3)) | 0;
  18933. mid = (mid + Math.imul(ah0, bl3)) | 0;
  18934. hi = (hi + Math.imul(ah0, bh3)) | 0;
  18935. var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  18936. c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
  18937. w3 &= 0x3ffffff;
  18938. /* k = 4 */
  18939. lo = Math.imul(al4, bl0);
  18940. mid = Math.imul(al4, bh0);
  18941. mid = (mid + Math.imul(ah4, bl0)) | 0;
  18942. hi = Math.imul(ah4, bh0);
  18943. lo = (lo + Math.imul(al3, bl1)) | 0;
  18944. mid = (mid + Math.imul(al3, bh1)) | 0;
  18945. mid = (mid + Math.imul(ah3, bl1)) | 0;
  18946. hi = (hi + Math.imul(ah3, bh1)) | 0;
  18947. lo = (lo + Math.imul(al2, bl2)) | 0;
  18948. mid = (mid + Math.imul(al2, bh2)) | 0;
  18949. mid = (mid + Math.imul(ah2, bl2)) | 0;
  18950. hi = (hi + Math.imul(ah2, bh2)) | 0;
  18951. lo = (lo + Math.imul(al1, bl3)) | 0;
  18952. mid = (mid + Math.imul(al1, bh3)) | 0;
  18953. mid = (mid + Math.imul(ah1, bl3)) | 0;
  18954. hi = (hi + Math.imul(ah1, bh3)) | 0;
  18955. lo = (lo + Math.imul(al0, bl4)) | 0;
  18956. mid = (mid + Math.imul(al0, bh4)) | 0;
  18957. mid = (mid + Math.imul(ah0, bl4)) | 0;
  18958. hi = (hi + Math.imul(ah0, bh4)) | 0;
  18959. var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  18960. c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
  18961. w4 &= 0x3ffffff;
  18962. /* k = 5 */
  18963. lo = Math.imul(al5, bl0);
  18964. mid = Math.imul(al5, bh0);
  18965. mid = (mid + Math.imul(ah5, bl0)) | 0;
  18966. hi = Math.imul(ah5, bh0);
  18967. lo = (lo + Math.imul(al4, bl1)) | 0;
  18968. mid = (mid + Math.imul(al4, bh1)) | 0;
  18969. mid = (mid + Math.imul(ah4, bl1)) | 0;
  18970. hi = (hi + Math.imul(ah4, bh1)) | 0;
  18971. lo = (lo + Math.imul(al3, bl2)) | 0;
  18972. mid = (mid + Math.imul(al3, bh2)) | 0;
  18973. mid = (mid + Math.imul(ah3, bl2)) | 0;
  18974. hi = (hi + Math.imul(ah3, bh2)) | 0;
  18975. lo = (lo + Math.imul(al2, bl3)) | 0;
  18976. mid = (mid + Math.imul(al2, bh3)) | 0;
  18977. mid = (mid + Math.imul(ah2, bl3)) | 0;
  18978. hi = (hi + Math.imul(ah2, bh3)) | 0;
  18979. lo = (lo + Math.imul(al1, bl4)) | 0;
  18980. mid = (mid + Math.imul(al1, bh4)) | 0;
  18981. mid = (mid + Math.imul(ah1, bl4)) | 0;
  18982. hi = (hi + Math.imul(ah1, bh4)) | 0;
  18983. lo = (lo + Math.imul(al0, bl5)) | 0;
  18984. mid = (mid + Math.imul(al0, bh5)) | 0;
  18985. mid = (mid + Math.imul(ah0, bl5)) | 0;
  18986. hi = (hi + Math.imul(ah0, bh5)) | 0;
  18987. var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  18988. c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
  18989. w5 &= 0x3ffffff;
  18990. /* k = 6 */
  18991. lo = Math.imul(al6, bl0);
  18992. mid = Math.imul(al6, bh0);
  18993. mid = (mid + Math.imul(ah6, bl0)) | 0;
  18994. hi = Math.imul(ah6, bh0);
  18995. lo = (lo + Math.imul(al5, bl1)) | 0;
  18996. mid = (mid + Math.imul(al5, bh1)) | 0;
  18997. mid = (mid + Math.imul(ah5, bl1)) | 0;
  18998. hi = (hi + Math.imul(ah5, bh1)) | 0;
  18999. lo = (lo + Math.imul(al4, bl2)) | 0;
  19000. mid = (mid + Math.imul(al4, bh2)) | 0;
  19001. mid = (mid + Math.imul(ah4, bl2)) | 0;
  19002. hi = (hi + Math.imul(ah4, bh2)) | 0;
  19003. lo = (lo + Math.imul(al3, bl3)) | 0;
  19004. mid = (mid + Math.imul(al3, bh3)) | 0;
  19005. mid = (mid + Math.imul(ah3, bl3)) | 0;
  19006. hi = (hi + Math.imul(ah3, bh3)) | 0;
  19007. lo = (lo + Math.imul(al2, bl4)) | 0;
  19008. mid = (mid + Math.imul(al2, bh4)) | 0;
  19009. mid = (mid + Math.imul(ah2, bl4)) | 0;
  19010. hi = (hi + Math.imul(ah2, bh4)) | 0;
  19011. lo = (lo + Math.imul(al1, bl5)) | 0;
  19012. mid = (mid + Math.imul(al1, bh5)) | 0;
  19013. mid = (mid + Math.imul(ah1, bl5)) | 0;
  19014. hi = (hi + Math.imul(ah1, bh5)) | 0;
  19015. lo = (lo + Math.imul(al0, bl6)) | 0;
  19016. mid = (mid + Math.imul(al0, bh6)) | 0;
  19017. mid = (mid + Math.imul(ah0, bl6)) | 0;
  19018. hi = (hi + Math.imul(ah0, bh6)) | 0;
  19019. var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19020. c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
  19021. w6 &= 0x3ffffff;
  19022. /* k = 7 */
  19023. lo = Math.imul(al7, bl0);
  19024. mid = Math.imul(al7, bh0);
  19025. mid = (mid + Math.imul(ah7, bl0)) | 0;
  19026. hi = Math.imul(ah7, bh0);
  19027. lo = (lo + Math.imul(al6, bl1)) | 0;
  19028. mid = (mid + Math.imul(al6, bh1)) | 0;
  19029. mid = (mid + Math.imul(ah6, bl1)) | 0;
  19030. hi = (hi + Math.imul(ah6, bh1)) | 0;
  19031. lo = (lo + Math.imul(al5, bl2)) | 0;
  19032. mid = (mid + Math.imul(al5, bh2)) | 0;
  19033. mid = (mid + Math.imul(ah5, bl2)) | 0;
  19034. hi = (hi + Math.imul(ah5, bh2)) | 0;
  19035. lo = (lo + Math.imul(al4, bl3)) | 0;
  19036. mid = (mid + Math.imul(al4, bh3)) | 0;
  19037. mid = (mid + Math.imul(ah4, bl3)) | 0;
  19038. hi = (hi + Math.imul(ah4, bh3)) | 0;
  19039. lo = (lo + Math.imul(al3, bl4)) | 0;
  19040. mid = (mid + Math.imul(al3, bh4)) | 0;
  19041. mid = (mid + Math.imul(ah3, bl4)) | 0;
  19042. hi = (hi + Math.imul(ah3, bh4)) | 0;
  19043. lo = (lo + Math.imul(al2, bl5)) | 0;
  19044. mid = (mid + Math.imul(al2, bh5)) | 0;
  19045. mid = (mid + Math.imul(ah2, bl5)) | 0;
  19046. hi = (hi + Math.imul(ah2, bh5)) | 0;
  19047. lo = (lo + Math.imul(al1, bl6)) | 0;
  19048. mid = (mid + Math.imul(al1, bh6)) | 0;
  19049. mid = (mid + Math.imul(ah1, bl6)) | 0;
  19050. hi = (hi + Math.imul(ah1, bh6)) | 0;
  19051. lo = (lo + Math.imul(al0, bl7)) | 0;
  19052. mid = (mid + Math.imul(al0, bh7)) | 0;
  19053. mid = (mid + Math.imul(ah0, bl7)) | 0;
  19054. hi = (hi + Math.imul(ah0, bh7)) | 0;
  19055. var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19056. c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
  19057. w7 &= 0x3ffffff;
  19058. /* k = 8 */
  19059. lo = Math.imul(al8, bl0);
  19060. mid = Math.imul(al8, bh0);
  19061. mid = (mid + Math.imul(ah8, bl0)) | 0;
  19062. hi = Math.imul(ah8, bh0);
  19063. lo = (lo + Math.imul(al7, bl1)) | 0;
  19064. mid = (mid + Math.imul(al7, bh1)) | 0;
  19065. mid = (mid + Math.imul(ah7, bl1)) | 0;
  19066. hi = (hi + Math.imul(ah7, bh1)) | 0;
  19067. lo = (lo + Math.imul(al6, bl2)) | 0;
  19068. mid = (mid + Math.imul(al6, bh2)) | 0;
  19069. mid = (mid + Math.imul(ah6, bl2)) | 0;
  19070. hi = (hi + Math.imul(ah6, bh2)) | 0;
  19071. lo = (lo + Math.imul(al5, bl3)) | 0;
  19072. mid = (mid + Math.imul(al5, bh3)) | 0;
  19073. mid = (mid + Math.imul(ah5, bl3)) | 0;
  19074. hi = (hi + Math.imul(ah5, bh3)) | 0;
  19075. lo = (lo + Math.imul(al4, bl4)) | 0;
  19076. mid = (mid + Math.imul(al4, bh4)) | 0;
  19077. mid = (mid + Math.imul(ah4, bl4)) | 0;
  19078. hi = (hi + Math.imul(ah4, bh4)) | 0;
  19079. lo = (lo + Math.imul(al3, bl5)) | 0;
  19080. mid = (mid + Math.imul(al3, bh5)) | 0;
  19081. mid = (mid + Math.imul(ah3, bl5)) | 0;
  19082. hi = (hi + Math.imul(ah3, bh5)) | 0;
  19083. lo = (lo + Math.imul(al2, bl6)) | 0;
  19084. mid = (mid + Math.imul(al2, bh6)) | 0;
  19085. mid = (mid + Math.imul(ah2, bl6)) | 0;
  19086. hi = (hi + Math.imul(ah2, bh6)) | 0;
  19087. lo = (lo + Math.imul(al1, bl7)) | 0;
  19088. mid = (mid + Math.imul(al1, bh7)) | 0;
  19089. mid = (mid + Math.imul(ah1, bl7)) | 0;
  19090. hi = (hi + Math.imul(ah1, bh7)) | 0;
  19091. lo = (lo + Math.imul(al0, bl8)) | 0;
  19092. mid = (mid + Math.imul(al0, bh8)) | 0;
  19093. mid = (mid + Math.imul(ah0, bl8)) | 0;
  19094. hi = (hi + Math.imul(ah0, bh8)) | 0;
  19095. var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19096. c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
  19097. w8 &= 0x3ffffff;
  19098. /* k = 9 */
  19099. lo = Math.imul(al9, bl0);
  19100. mid = Math.imul(al9, bh0);
  19101. mid = (mid + Math.imul(ah9, bl0)) | 0;
  19102. hi = Math.imul(ah9, bh0);
  19103. lo = (lo + Math.imul(al8, bl1)) | 0;
  19104. mid = (mid + Math.imul(al8, bh1)) | 0;
  19105. mid = (mid + Math.imul(ah8, bl1)) | 0;
  19106. hi = (hi + Math.imul(ah8, bh1)) | 0;
  19107. lo = (lo + Math.imul(al7, bl2)) | 0;
  19108. mid = (mid + Math.imul(al7, bh2)) | 0;
  19109. mid = (mid + Math.imul(ah7, bl2)) | 0;
  19110. hi = (hi + Math.imul(ah7, bh2)) | 0;
  19111. lo = (lo + Math.imul(al6, bl3)) | 0;
  19112. mid = (mid + Math.imul(al6, bh3)) | 0;
  19113. mid = (mid + Math.imul(ah6, bl3)) | 0;
  19114. hi = (hi + Math.imul(ah6, bh3)) | 0;
  19115. lo = (lo + Math.imul(al5, bl4)) | 0;
  19116. mid = (mid + Math.imul(al5, bh4)) | 0;
  19117. mid = (mid + Math.imul(ah5, bl4)) | 0;
  19118. hi = (hi + Math.imul(ah5, bh4)) | 0;
  19119. lo = (lo + Math.imul(al4, bl5)) | 0;
  19120. mid = (mid + Math.imul(al4, bh5)) | 0;
  19121. mid = (mid + Math.imul(ah4, bl5)) | 0;
  19122. hi = (hi + Math.imul(ah4, bh5)) | 0;
  19123. lo = (lo + Math.imul(al3, bl6)) | 0;
  19124. mid = (mid + Math.imul(al3, bh6)) | 0;
  19125. mid = (mid + Math.imul(ah3, bl6)) | 0;
  19126. hi = (hi + Math.imul(ah3, bh6)) | 0;
  19127. lo = (lo + Math.imul(al2, bl7)) | 0;
  19128. mid = (mid + Math.imul(al2, bh7)) | 0;
  19129. mid = (mid + Math.imul(ah2, bl7)) | 0;
  19130. hi = (hi + Math.imul(ah2, bh7)) | 0;
  19131. lo = (lo + Math.imul(al1, bl8)) | 0;
  19132. mid = (mid + Math.imul(al1, bh8)) | 0;
  19133. mid = (mid + Math.imul(ah1, bl8)) | 0;
  19134. hi = (hi + Math.imul(ah1, bh8)) | 0;
  19135. lo = (lo + Math.imul(al0, bl9)) | 0;
  19136. mid = (mid + Math.imul(al0, bh9)) | 0;
  19137. mid = (mid + Math.imul(ah0, bl9)) | 0;
  19138. hi = (hi + Math.imul(ah0, bh9)) | 0;
  19139. var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19140. c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
  19141. w9 &= 0x3ffffff;
  19142. /* k = 10 */
  19143. lo = Math.imul(al9, bl1);
  19144. mid = Math.imul(al9, bh1);
  19145. mid = (mid + Math.imul(ah9, bl1)) | 0;
  19146. hi = Math.imul(ah9, bh1);
  19147. lo = (lo + Math.imul(al8, bl2)) | 0;
  19148. mid = (mid + Math.imul(al8, bh2)) | 0;
  19149. mid = (mid + Math.imul(ah8, bl2)) | 0;
  19150. hi = (hi + Math.imul(ah8, bh2)) | 0;
  19151. lo = (lo + Math.imul(al7, bl3)) | 0;
  19152. mid = (mid + Math.imul(al7, bh3)) | 0;
  19153. mid = (mid + Math.imul(ah7, bl3)) | 0;
  19154. hi = (hi + Math.imul(ah7, bh3)) | 0;
  19155. lo = (lo + Math.imul(al6, bl4)) | 0;
  19156. mid = (mid + Math.imul(al6, bh4)) | 0;
  19157. mid = (mid + Math.imul(ah6, bl4)) | 0;
  19158. hi = (hi + Math.imul(ah6, bh4)) | 0;
  19159. lo = (lo + Math.imul(al5, bl5)) | 0;
  19160. mid = (mid + Math.imul(al5, bh5)) | 0;
  19161. mid = (mid + Math.imul(ah5, bl5)) | 0;
  19162. hi = (hi + Math.imul(ah5, bh5)) | 0;
  19163. lo = (lo + Math.imul(al4, bl6)) | 0;
  19164. mid = (mid + Math.imul(al4, bh6)) | 0;
  19165. mid = (mid + Math.imul(ah4, bl6)) | 0;
  19166. hi = (hi + Math.imul(ah4, bh6)) | 0;
  19167. lo = (lo + Math.imul(al3, bl7)) | 0;
  19168. mid = (mid + Math.imul(al3, bh7)) | 0;
  19169. mid = (mid + Math.imul(ah3, bl7)) | 0;
  19170. hi = (hi + Math.imul(ah3, bh7)) | 0;
  19171. lo = (lo + Math.imul(al2, bl8)) | 0;
  19172. mid = (mid + Math.imul(al2, bh8)) | 0;
  19173. mid = (mid + Math.imul(ah2, bl8)) | 0;
  19174. hi = (hi + Math.imul(ah2, bh8)) | 0;
  19175. lo = (lo + Math.imul(al1, bl9)) | 0;
  19176. mid = (mid + Math.imul(al1, bh9)) | 0;
  19177. mid = (mid + Math.imul(ah1, bl9)) | 0;
  19178. hi = (hi + Math.imul(ah1, bh9)) | 0;
  19179. var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19180. c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
  19181. w10 &= 0x3ffffff;
  19182. /* k = 11 */
  19183. lo = Math.imul(al9, bl2);
  19184. mid = Math.imul(al9, bh2);
  19185. mid = (mid + Math.imul(ah9, bl2)) | 0;
  19186. hi = Math.imul(ah9, bh2);
  19187. lo = (lo + Math.imul(al8, bl3)) | 0;
  19188. mid = (mid + Math.imul(al8, bh3)) | 0;
  19189. mid = (mid + Math.imul(ah8, bl3)) | 0;
  19190. hi = (hi + Math.imul(ah8, bh3)) | 0;
  19191. lo = (lo + Math.imul(al7, bl4)) | 0;
  19192. mid = (mid + Math.imul(al7, bh4)) | 0;
  19193. mid = (mid + Math.imul(ah7, bl4)) | 0;
  19194. hi = (hi + Math.imul(ah7, bh4)) | 0;
  19195. lo = (lo + Math.imul(al6, bl5)) | 0;
  19196. mid = (mid + Math.imul(al6, bh5)) | 0;
  19197. mid = (mid + Math.imul(ah6, bl5)) | 0;
  19198. hi = (hi + Math.imul(ah6, bh5)) | 0;
  19199. lo = (lo + Math.imul(al5, bl6)) | 0;
  19200. mid = (mid + Math.imul(al5, bh6)) | 0;
  19201. mid = (mid + Math.imul(ah5, bl6)) | 0;
  19202. hi = (hi + Math.imul(ah5, bh6)) | 0;
  19203. lo = (lo + Math.imul(al4, bl7)) | 0;
  19204. mid = (mid + Math.imul(al4, bh7)) | 0;
  19205. mid = (mid + Math.imul(ah4, bl7)) | 0;
  19206. hi = (hi + Math.imul(ah4, bh7)) | 0;
  19207. lo = (lo + Math.imul(al3, bl8)) | 0;
  19208. mid = (mid + Math.imul(al3, bh8)) | 0;
  19209. mid = (mid + Math.imul(ah3, bl8)) | 0;
  19210. hi = (hi + Math.imul(ah3, bh8)) | 0;
  19211. lo = (lo + Math.imul(al2, bl9)) | 0;
  19212. mid = (mid + Math.imul(al2, bh9)) | 0;
  19213. mid = (mid + Math.imul(ah2, bl9)) | 0;
  19214. hi = (hi + Math.imul(ah2, bh9)) | 0;
  19215. var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19216. c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
  19217. w11 &= 0x3ffffff;
  19218. /* k = 12 */
  19219. lo = Math.imul(al9, bl3);
  19220. mid = Math.imul(al9, bh3);
  19221. mid = (mid + Math.imul(ah9, bl3)) | 0;
  19222. hi = Math.imul(ah9, bh3);
  19223. lo = (lo + Math.imul(al8, bl4)) | 0;
  19224. mid = (mid + Math.imul(al8, bh4)) | 0;
  19225. mid = (mid + Math.imul(ah8, bl4)) | 0;
  19226. hi = (hi + Math.imul(ah8, bh4)) | 0;
  19227. lo = (lo + Math.imul(al7, bl5)) | 0;
  19228. mid = (mid + Math.imul(al7, bh5)) | 0;
  19229. mid = (mid + Math.imul(ah7, bl5)) | 0;
  19230. hi = (hi + Math.imul(ah7, bh5)) | 0;
  19231. lo = (lo + Math.imul(al6, bl6)) | 0;
  19232. mid = (mid + Math.imul(al6, bh6)) | 0;
  19233. mid = (mid + Math.imul(ah6, bl6)) | 0;
  19234. hi = (hi + Math.imul(ah6, bh6)) | 0;
  19235. lo = (lo + Math.imul(al5, bl7)) | 0;
  19236. mid = (mid + Math.imul(al5, bh7)) | 0;
  19237. mid = (mid + Math.imul(ah5, bl7)) | 0;
  19238. hi = (hi + Math.imul(ah5, bh7)) | 0;
  19239. lo = (lo + Math.imul(al4, bl8)) | 0;
  19240. mid = (mid + Math.imul(al4, bh8)) | 0;
  19241. mid = (mid + Math.imul(ah4, bl8)) | 0;
  19242. hi = (hi + Math.imul(ah4, bh8)) | 0;
  19243. lo = (lo + Math.imul(al3, bl9)) | 0;
  19244. mid = (mid + Math.imul(al3, bh9)) | 0;
  19245. mid = (mid + Math.imul(ah3, bl9)) | 0;
  19246. hi = (hi + Math.imul(ah3, bh9)) | 0;
  19247. var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19248. c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
  19249. w12 &= 0x3ffffff;
  19250. /* k = 13 */
  19251. lo = Math.imul(al9, bl4);
  19252. mid = Math.imul(al9, bh4);
  19253. mid = (mid + Math.imul(ah9, bl4)) | 0;
  19254. hi = Math.imul(ah9, bh4);
  19255. lo = (lo + Math.imul(al8, bl5)) | 0;
  19256. mid = (mid + Math.imul(al8, bh5)) | 0;
  19257. mid = (mid + Math.imul(ah8, bl5)) | 0;
  19258. hi = (hi + Math.imul(ah8, bh5)) | 0;
  19259. lo = (lo + Math.imul(al7, bl6)) | 0;
  19260. mid = (mid + Math.imul(al7, bh6)) | 0;
  19261. mid = (mid + Math.imul(ah7, bl6)) | 0;
  19262. hi = (hi + Math.imul(ah7, bh6)) | 0;
  19263. lo = (lo + Math.imul(al6, bl7)) | 0;
  19264. mid = (mid + Math.imul(al6, bh7)) | 0;
  19265. mid = (mid + Math.imul(ah6, bl7)) | 0;
  19266. hi = (hi + Math.imul(ah6, bh7)) | 0;
  19267. lo = (lo + Math.imul(al5, bl8)) | 0;
  19268. mid = (mid + Math.imul(al5, bh8)) | 0;
  19269. mid = (mid + Math.imul(ah5, bl8)) | 0;
  19270. hi = (hi + Math.imul(ah5, bh8)) | 0;
  19271. lo = (lo + Math.imul(al4, bl9)) | 0;
  19272. mid = (mid + Math.imul(al4, bh9)) | 0;
  19273. mid = (mid + Math.imul(ah4, bl9)) | 0;
  19274. hi = (hi + Math.imul(ah4, bh9)) | 0;
  19275. var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19276. c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
  19277. w13 &= 0x3ffffff;
  19278. /* k = 14 */
  19279. lo = Math.imul(al9, bl5);
  19280. mid = Math.imul(al9, bh5);
  19281. mid = (mid + Math.imul(ah9, bl5)) | 0;
  19282. hi = Math.imul(ah9, bh5);
  19283. lo = (lo + Math.imul(al8, bl6)) | 0;
  19284. mid = (mid + Math.imul(al8, bh6)) | 0;
  19285. mid = (mid + Math.imul(ah8, bl6)) | 0;
  19286. hi = (hi + Math.imul(ah8, bh6)) | 0;
  19287. lo = (lo + Math.imul(al7, bl7)) | 0;
  19288. mid = (mid + Math.imul(al7, bh7)) | 0;
  19289. mid = (mid + Math.imul(ah7, bl7)) | 0;
  19290. hi = (hi + Math.imul(ah7, bh7)) | 0;
  19291. lo = (lo + Math.imul(al6, bl8)) | 0;
  19292. mid = (mid + Math.imul(al6, bh8)) | 0;
  19293. mid = (mid + Math.imul(ah6, bl8)) | 0;
  19294. hi = (hi + Math.imul(ah6, bh8)) | 0;
  19295. lo = (lo + Math.imul(al5, bl9)) | 0;
  19296. mid = (mid + Math.imul(al5, bh9)) | 0;
  19297. mid = (mid + Math.imul(ah5, bl9)) | 0;
  19298. hi = (hi + Math.imul(ah5, bh9)) | 0;
  19299. var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19300. c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
  19301. w14 &= 0x3ffffff;
  19302. /* k = 15 */
  19303. lo = Math.imul(al9, bl6);
  19304. mid = Math.imul(al9, bh6);
  19305. mid = (mid + Math.imul(ah9, bl6)) | 0;
  19306. hi = Math.imul(ah9, bh6);
  19307. lo = (lo + Math.imul(al8, bl7)) | 0;
  19308. mid = (mid + Math.imul(al8, bh7)) | 0;
  19309. mid = (mid + Math.imul(ah8, bl7)) | 0;
  19310. hi = (hi + Math.imul(ah8, bh7)) | 0;
  19311. lo = (lo + Math.imul(al7, bl8)) | 0;
  19312. mid = (mid + Math.imul(al7, bh8)) | 0;
  19313. mid = (mid + Math.imul(ah7, bl8)) | 0;
  19314. hi = (hi + Math.imul(ah7, bh8)) | 0;
  19315. lo = (lo + Math.imul(al6, bl9)) | 0;
  19316. mid = (mid + Math.imul(al6, bh9)) | 0;
  19317. mid = (mid + Math.imul(ah6, bl9)) | 0;
  19318. hi = (hi + Math.imul(ah6, bh9)) | 0;
  19319. var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19320. c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
  19321. w15 &= 0x3ffffff;
  19322. /* k = 16 */
  19323. lo = Math.imul(al9, bl7);
  19324. mid = Math.imul(al9, bh7);
  19325. mid = (mid + Math.imul(ah9, bl7)) | 0;
  19326. hi = Math.imul(ah9, bh7);
  19327. lo = (lo + Math.imul(al8, bl8)) | 0;
  19328. mid = (mid + Math.imul(al8, bh8)) | 0;
  19329. mid = (mid + Math.imul(ah8, bl8)) | 0;
  19330. hi = (hi + Math.imul(ah8, bh8)) | 0;
  19331. lo = (lo + Math.imul(al7, bl9)) | 0;
  19332. mid = (mid + Math.imul(al7, bh9)) | 0;
  19333. mid = (mid + Math.imul(ah7, bl9)) | 0;
  19334. hi = (hi + Math.imul(ah7, bh9)) | 0;
  19335. var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19336. c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
  19337. w16 &= 0x3ffffff;
  19338. /* k = 17 */
  19339. lo = Math.imul(al9, bl8);
  19340. mid = Math.imul(al9, bh8);
  19341. mid = (mid + Math.imul(ah9, bl8)) | 0;
  19342. hi = Math.imul(ah9, bh8);
  19343. lo = (lo + Math.imul(al8, bl9)) | 0;
  19344. mid = (mid + Math.imul(al8, bh9)) | 0;
  19345. mid = (mid + Math.imul(ah8, bl9)) | 0;
  19346. hi = (hi + Math.imul(ah8, bh9)) | 0;
  19347. var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19348. c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
  19349. w17 &= 0x3ffffff;
  19350. /* k = 18 */
  19351. lo = Math.imul(al9, bl9);
  19352. mid = Math.imul(al9, bh9);
  19353. mid = (mid + Math.imul(ah9, bl9)) | 0;
  19354. hi = Math.imul(ah9, bh9);
  19355. var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  19356. c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
  19357. w18 &= 0x3ffffff;
  19358. o[0] = w0;
  19359. o[1] = w1;
  19360. o[2] = w2;
  19361. o[3] = w3;
  19362. o[4] = w4;
  19363. o[5] = w5;
  19364. o[6] = w6;
  19365. o[7] = w7;
  19366. o[8] = w8;
  19367. o[9] = w9;
  19368. o[10] = w10;
  19369. o[11] = w11;
  19370. o[12] = w12;
  19371. o[13] = w13;
  19372. o[14] = w14;
  19373. o[15] = w15;
  19374. o[16] = w16;
  19375. o[17] = w17;
  19376. o[18] = w18;
  19377. if (c !== 0) {
  19378. o[19] = c;
  19379. out.length++;
  19380. }
  19381. return out;
  19382. };
  19383. // Polyfill comb
  19384. if (!Math.imul) {
  19385. comb10MulTo = smallMulTo;
  19386. }
  19387. function bigMulTo (self, num, out) {
  19388. out.negative = num.negative ^ self.negative;
  19389. out.length = self.length + num.length;
  19390. var carry = 0;
  19391. var hncarry = 0;
  19392. for (var k = 0; k < out.length - 1; k++) {
  19393. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  19394. // note that ncarry could be >= 0x3ffffff
  19395. var ncarry = hncarry;
  19396. hncarry = 0;
  19397. var rword = carry & 0x3ffffff;
  19398. var maxJ = Math.min(k, num.length - 1);
  19399. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  19400. var i = k - j;
  19401. var a = self.words[i] | 0;
  19402. var b = num.words[j] | 0;
  19403. var r = a * b;
  19404. var lo = r & 0x3ffffff;
  19405. ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
  19406. lo = (lo + rword) | 0;
  19407. rword = lo & 0x3ffffff;
  19408. ncarry = (ncarry + (lo >>> 26)) | 0;
  19409. hncarry += ncarry >>> 26;
  19410. ncarry &= 0x3ffffff;
  19411. }
  19412. out.words[k] = rword;
  19413. carry = ncarry;
  19414. ncarry = hncarry;
  19415. }
  19416. if (carry !== 0) {
  19417. out.words[k] = carry;
  19418. } else {
  19419. out.length--;
  19420. }
  19421. return out._strip();
  19422. }
  19423. function jumboMulTo (self, num, out) {
  19424. // Temporary disable, see https://github.com/indutny/bn.js/issues/211
  19425. // var fftm = new FFTM();
  19426. // return fftm.mulp(self, num, out);
  19427. return bigMulTo(self, num, out);
  19428. }
  19429. BN.prototype.mulTo = function mulTo (num, out) {
  19430. var res;
  19431. var len = this.length + num.length;
  19432. if (this.length === 10 && num.length === 10) {
  19433. res = comb10MulTo(this, num, out);
  19434. } else if (len < 63) {
  19435. res = smallMulTo(this, num, out);
  19436. } else if (len < 1024) {
  19437. res = bigMulTo(this, num, out);
  19438. } else {
  19439. res = jumboMulTo(this, num, out);
  19440. }
  19441. return res;
  19442. };
  19443. // Cooley-Tukey algorithm for FFT
  19444. // slightly revisited to rely on looping instead of recursion
  19445. function FFTM (x, y) {
  19446. this.x = x;
  19447. this.y = y;
  19448. }
  19449. FFTM.prototype.makeRBT = function makeRBT (N) {
  19450. var t = new Array(N);
  19451. var l = BN.prototype._countBits(N) - 1;
  19452. for (var i = 0; i < N; i++) {
  19453. t[i] = this.revBin(i, l, N);
  19454. }
  19455. return t;
  19456. };
  19457. // Returns binary-reversed representation of `x`
  19458. FFTM.prototype.revBin = function revBin (x, l, N) {
  19459. if (x === 0 || x === N - 1) return x;
  19460. var rb = 0;
  19461. for (var i = 0; i < l; i++) {
  19462. rb |= (x & 1) << (l - i - 1);
  19463. x >>= 1;
  19464. }
  19465. return rb;
  19466. };
  19467. // Performs "tweedling" phase, therefore 'emulating'
  19468. // behaviour of the recursive algorithm
  19469. FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
  19470. for (var i = 0; i < N; i++) {
  19471. rtws[i] = rws[rbt[i]];
  19472. itws[i] = iws[rbt[i]];
  19473. }
  19474. };
  19475. FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
  19476. this.permute(rbt, rws, iws, rtws, itws, N);
  19477. for (var s = 1; s < N; s <<= 1) {
  19478. var l = s << 1;
  19479. var rtwdf = Math.cos(2 * Math.PI / l);
  19480. var itwdf = Math.sin(2 * Math.PI / l);
  19481. for (var p = 0; p < N; p += l) {
  19482. var rtwdf_ = rtwdf;
  19483. var itwdf_ = itwdf;
  19484. for (var j = 0; j < s; j++) {
  19485. var re = rtws[p + j];
  19486. var ie = itws[p + j];
  19487. var ro = rtws[p + j + s];
  19488. var io = itws[p + j + s];
  19489. var rx = rtwdf_ * ro - itwdf_ * io;
  19490. io = rtwdf_ * io + itwdf_ * ro;
  19491. ro = rx;
  19492. rtws[p + j] = re + ro;
  19493. itws[p + j] = ie + io;
  19494. rtws[p + j + s] = re - ro;
  19495. itws[p + j + s] = ie - io;
  19496. /* jshint maxdepth : false */
  19497. if (j !== l) {
  19498. rx = rtwdf * rtwdf_ - itwdf * itwdf_;
  19499. itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
  19500. rtwdf_ = rx;
  19501. }
  19502. }
  19503. }
  19504. }
  19505. };
  19506. FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
  19507. var N = Math.max(m, n) | 1;
  19508. var odd = N & 1;
  19509. var i = 0;
  19510. for (N = N / 2 | 0; N; N = N >>> 1) {
  19511. i++;
  19512. }
  19513. return 1 << i + 1 + odd;
  19514. };
  19515. FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
  19516. if (N <= 1) return;
  19517. for (var i = 0; i < N / 2; i++) {
  19518. var t = rws[i];
  19519. rws[i] = rws[N - i - 1];
  19520. rws[N - i - 1] = t;
  19521. t = iws[i];
  19522. iws[i] = -iws[N - i - 1];
  19523. iws[N - i - 1] = -t;
  19524. }
  19525. };
  19526. FFTM.prototype.normalize13b = function normalize13b (ws, N) {
  19527. var carry = 0;
  19528. for (var i = 0; i < N / 2; i++) {
  19529. var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
  19530. Math.round(ws[2 * i] / N) +
  19531. carry;
  19532. ws[i] = w & 0x3ffffff;
  19533. if (w < 0x4000000) {
  19534. carry = 0;
  19535. } else {
  19536. carry = w / 0x4000000 | 0;
  19537. }
  19538. }
  19539. return ws;
  19540. };
  19541. FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
  19542. var carry = 0;
  19543. for (var i = 0; i < len; i++) {
  19544. carry = carry + (ws[i] | 0);
  19545. rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
  19546. rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
  19547. }
  19548. // Pad with zeroes
  19549. for (i = 2 * len; i < N; ++i) {
  19550. rws[i] = 0;
  19551. }
  19552. assert(carry === 0);
  19553. assert((carry & ~0x1fff) === 0);
  19554. };
  19555. FFTM.prototype.stub = function stub (N) {
  19556. var ph = new Array(N);
  19557. for (var i = 0; i < N; i++) {
  19558. ph[i] = 0;
  19559. }
  19560. return ph;
  19561. };
  19562. FFTM.prototype.mulp = function mulp (x, y, out) {
  19563. var N = 2 * this.guessLen13b(x.length, y.length);
  19564. var rbt = this.makeRBT(N);
  19565. var _ = this.stub(N);
  19566. var rws = new Array(N);
  19567. var rwst = new Array(N);
  19568. var iwst = new Array(N);
  19569. var nrws = new Array(N);
  19570. var nrwst = new Array(N);
  19571. var niwst = new Array(N);
  19572. var rmws = out.words;
  19573. rmws.length = N;
  19574. this.convert13b(x.words, x.length, rws, N);
  19575. this.convert13b(y.words, y.length, nrws, N);
  19576. this.transform(rws, _, rwst, iwst, N, rbt);
  19577. this.transform(nrws, _, nrwst, niwst, N, rbt);
  19578. for (var i = 0; i < N; i++) {
  19579. var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
  19580. iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
  19581. rwst[i] = rx;
  19582. }
  19583. this.conjugate(rwst, iwst, N);
  19584. this.transform(rwst, iwst, rmws, _, N, rbt);
  19585. this.conjugate(rmws, _, N);
  19586. this.normalize13b(rmws, N);
  19587. out.negative = x.negative ^ y.negative;
  19588. out.length = x.length + y.length;
  19589. return out._strip();
  19590. };
  19591. // Multiply `this` by `num`
  19592. BN.prototype.mul = function mul (num) {
  19593. var out = new BN(null);
  19594. out.words = new Array(this.length + num.length);
  19595. return this.mulTo(num, out);
  19596. };
  19597. // Multiply employing FFT
  19598. BN.prototype.mulf = function mulf (num) {
  19599. var out = new BN(null);
  19600. out.words = new Array(this.length + num.length);
  19601. return jumboMulTo(this, num, out);
  19602. };
  19603. // In-place Multiplication
  19604. BN.prototype.imul = function imul (num) {
  19605. return this.clone().mulTo(num, this);
  19606. };
  19607. BN.prototype.imuln = function imuln (num) {
  19608. var isNegNum = num < 0;
  19609. if (isNegNum) num = -num;
  19610. assert(typeof num === 'number');
  19611. assert(num < 0x4000000);
  19612. // Carry
  19613. var carry = 0;
  19614. for (var i = 0; i < this.length; i++) {
  19615. var w = (this.words[i] | 0) * num;
  19616. var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
  19617. carry >>= 26;
  19618. carry += (w / 0x4000000) | 0;
  19619. // NOTE: lo is 27bit maximum
  19620. carry += lo >>> 26;
  19621. this.words[i] = lo & 0x3ffffff;
  19622. }
  19623. if (carry !== 0) {
  19624. this.words[i] = carry;
  19625. this.length++;
  19626. }
  19627. return isNegNum ? this.ineg() : this;
  19628. };
  19629. BN.prototype.muln = function muln (num) {
  19630. return this.clone().imuln(num);
  19631. };
  19632. // `this` * `this`
  19633. BN.prototype.sqr = function sqr () {
  19634. return this.mul(this);
  19635. };
  19636. // `this` * `this` in-place
  19637. BN.prototype.isqr = function isqr () {
  19638. return this.imul(this.clone());
  19639. };
  19640. // Math.pow(`this`, `num`)
  19641. BN.prototype.pow = function pow (num) {
  19642. var w = toBitArray(num);
  19643. if (w.length === 0) return new BN(1);
  19644. // Skip leading zeroes
  19645. var res = this;
  19646. for (var i = 0; i < w.length; i++, res = res.sqr()) {
  19647. if (w[i] !== 0) break;
  19648. }
  19649. if (++i < w.length) {
  19650. for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
  19651. if (w[i] === 0) continue;
  19652. res = res.mul(q);
  19653. }
  19654. }
  19655. return res;
  19656. };
  19657. // Shift-left in-place
  19658. BN.prototype.iushln = function iushln (bits) {
  19659. assert(typeof bits === 'number' && bits >= 0);
  19660. var r = bits % 26;
  19661. var s = (bits - r) / 26;
  19662. var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
  19663. var i;
  19664. if (r !== 0) {
  19665. var carry = 0;
  19666. for (i = 0; i < this.length; i++) {
  19667. var newCarry = this.words[i] & carryMask;
  19668. var c = ((this.words[i] | 0) - newCarry) << r;
  19669. this.words[i] = c | carry;
  19670. carry = newCarry >>> (26 - r);
  19671. }
  19672. if (carry) {
  19673. this.words[i] = carry;
  19674. this.length++;
  19675. }
  19676. }
  19677. if (s !== 0) {
  19678. for (i = this.length - 1; i >= 0; i--) {
  19679. this.words[i + s] = this.words[i];
  19680. }
  19681. for (i = 0; i < s; i++) {
  19682. this.words[i] = 0;
  19683. }
  19684. this.length += s;
  19685. }
  19686. return this._strip();
  19687. };
  19688. BN.prototype.ishln = function ishln (bits) {
  19689. // TODO(indutny): implement me
  19690. assert(this.negative === 0);
  19691. return this.iushln(bits);
  19692. };
  19693. // Shift-right in-place
  19694. // NOTE: `hint` is a lowest bit before trailing zeroes
  19695. // NOTE: if `extended` is present - it will be filled with destroyed bits
  19696. BN.prototype.iushrn = function iushrn (bits, hint, extended) {
  19697. assert(typeof bits === 'number' && bits >= 0);
  19698. var h;
  19699. if (hint) {
  19700. h = (hint - (hint % 26)) / 26;
  19701. } else {
  19702. h = 0;
  19703. }
  19704. var r = bits % 26;
  19705. var s = Math.min((bits - r) / 26, this.length);
  19706. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  19707. var maskedWords = extended;
  19708. h -= s;
  19709. h = Math.max(0, h);
  19710. // Extended mode, copy masked part
  19711. if (maskedWords) {
  19712. for (var i = 0; i < s; i++) {
  19713. maskedWords.words[i] = this.words[i];
  19714. }
  19715. maskedWords.length = s;
  19716. }
  19717. if (s === 0) {
  19718. // No-op, we should not move anything at all
  19719. } else if (this.length > s) {
  19720. this.length -= s;
  19721. for (i = 0; i < this.length; i++) {
  19722. this.words[i] = this.words[i + s];
  19723. }
  19724. } else {
  19725. this.words[0] = 0;
  19726. this.length = 1;
  19727. }
  19728. var carry = 0;
  19729. for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
  19730. var word = this.words[i] | 0;
  19731. this.words[i] = (carry << (26 - r)) | (word >>> r);
  19732. carry = word & mask;
  19733. }
  19734. // Push carried bits as a mask
  19735. if (maskedWords && carry !== 0) {
  19736. maskedWords.words[maskedWords.length++] = carry;
  19737. }
  19738. if (this.length === 0) {
  19739. this.words[0] = 0;
  19740. this.length = 1;
  19741. }
  19742. return this._strip();
  19743. };
  19744. BN.prototype.ishrn = function ishrn (bits, hint, extended) {
  19745. // TODO(indutny): implement me
  19746. assert(this.negative === 0);
  19747. return this.iushrn(bits, hint, extended);
  19748. };
  19749. // Shift-left
  19750. BN.prototype.shln = function shln (bits) {
  19751. return this.clone().ishln(bits);
  19752. };
  19753. BN.prototype.ushln = function ushln (bits) {
  19754. return this.clone().iushln(bits);
  19755. };
  19756. // Shift-right
  19757. BN.prototype.shrn = function shrn (bits) {
  19758. return this.clone().ishrn(bits);
  19759. };
  19760. BN.prototype.ushrn = function ushrn (bits) {
  19761. return this.clone().iushrn(bits);
  19762. };
  19763. // Test if n bit is set
  19764. BN.prototype.testn = function testn (bit) {
  19765. assert(typeof bit === 'number' && bit >= 0);
  19766. var r = bit % 26;
  19767. var s = (bit - r) / 26;
  19768. var q = 1 << r;
  19769. // Fast case: bit is much higher than all existing words
  19770. if (this.length <= s) return false;
  19771. // Check bit and return
  19772. var w = this.words[s];
  19773. return !!(w & q);
  19774. };
  19775. // Return only lowers bits of number (in-place)
  19776. BN.prototype.imaskn = function imaskn (bits) {
  19777. assert(typeof bits === 'number' && bits >= 0);
  19778. var r = bits % 26;
  19779. var s = (bits - r) / 26;
  19780. assert(this.negative === 0, 'imaskn works only with positive numbers');
  19781. if (this.length <= s) {
  19782. return this;
  19783. }
  19784. if (r !== 0) {
  19785. s++;
  19786. }
  19787. this.length = Math.min(s, this.length);
  19788. if (r !== 0) {
  19789. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  19790. this.words[this.length - 1] &= mask;
  19791. }
  19792. return this._strip();
  19793. };
  19794. // Return only lowers bits of number
  19795. BN.prototype.maskn = function maskn (bits) {
  19796. return this.clone().imaskn(bits);
  19797. };
  19798. // Add plain number `num` to `this`
  19799. BN.prototype.iaddn = function iaddn (num) {
  19800. assert(typeof num === 'number');
  19801. assert(num < 0x4000000);
  19802. if (num < 0) return this.isubn(-num);
  19803. // Possible sign change
  19804. if (this.negative !== 0) {
  19805. if (this.length === 1 && (this.words[0] | 0) <= num) {
  19806. this.words[0] = num - (this.words[0] | 0);
  19807. this.negative = 0;
  19808. return this;
  19809. }
  19810. this.negative = 0;
  19811. this.isubn(num);
  19812. this.negative = 1;
  19813. return this;
  19814. }
  19815. // Add without checks
  19816. return this._iaddn(num);
  19817. };
  19818. BN.prototype._iaddn = function _iaddn (num) {
  19819. this.words[0] += num;
  19820. // Carry
  19821. for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
  19822. this.words[i] -= 0x4000000;
  19823. if (i === this.length - 1) {
  19824. this.words[i + 1] = 1;
  19825. } else {
  19826. this.words[i + 1]++;
  19827. }
  19828. }
  19829. this.length = Math.max(this.length, i + 1);
  19830. return this;
  19831. };
  19832. // Subtract plain number `num` from `this`
  19833. BN.prototype.isubn = function isubn (num) {
  19834. assert(typeof num === 'number');
  19835. assert(num < 0x4000000);
  19836. if (num < 0) return this.iaddn(-num);
  19837. if (this.negative !== 0) {
  19838. this.negative = 0;
  19839. this.iaddn(num);
  19840. this.negative = 1;
  19841. return this;
  19842. }
  19843. this.words[0] -= num;
  19844. if (this.length === 1 && this.words[0] < 0) {
  19845. this.words[0] = -this.words[0];
  19846. this.negative = 1;
  19847. } else {
  19848. // Carry
  19849. for (var i = 0; i < this.length && this.words[i] < 0; i++) {
  19850. this.words[i] += 0x4000000;
  19851. this.words[i + 1] -= 1;
  19852. }
  19853. }
  19854. return this._strip();
  19855. };
  19856. BN.prototype.addn = function addn (num) {
  19857. return this.clone().iaddn(num);
  19858. };
  19859. BN.prototype.subn = function subn (num) {
  19860. return this.clone().isubn(num);
  19861. };
  19862. BN.prototype.iabs = function iabs () {
  19863. this.negative = 0;
  19864. return this;
  19865. };
  19866. BN.prototype.abs = function abs () {
  19867. return this.clone().iabs();
  19868. };
  19869. BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
  19870. var len = num.length + shift;
  19871. var i;
  19872. this._expand(len);
  19873. var w;
  19874. var carry = 0;
  19875. for (i = 0; i < num.length; i++) {
  19876. w = (this.words[i + shift] | 0) + carry;
  19877. var right = (num.words[i] | 0) * mul;
  19878. w -= right & 0x3ffffff;
  19879. carry = (w >> 26) - ((right / 0x4000000) | 0);
  19880. this.words[i + shift] = w & 0x3ffffff;
  19881. }
  19882. for (; i < this.length - shift; i++) {
  19883. w = (this.words[i + shift] | 0) + carry;
  19884. carry = w >> 26;
  19885. this.words[i + shift] = w & 0x3ffffff;
  19886. }
  19887. if (carry === 0) return this._strip();
  19888. // Subtraction overflow
  19889. assert(carry === -1);
  19890. carry = 0;
  19891. for (i = 0; i < this.length; i++) {
  19892. w = -(this.words[i] | 0) + carry;
  19893. carry = w >> 26;
  19894. this.words[i] = w & 0x3ffffff;
  19895. }
  19896. this.negative = 1;
  19897. return this._strip();
  19898. };
  19899. BN.prototype._wordDiv = function _wordDiv (num, mode) {
  19900. var shift = this.length - num.length;
  19901. var a = this.clone();
  19902. var b = num;
  19903. // Normalize
  19904. var bhi = b.words[b.length - 1] | 0;
  19905. var bhiBits = this._countBits(bhi);
  19906. shift = 26 - bhiBits;
  19907. if (shift !== 0) {
  19908. b = b.ushln(shift);
  19909. a.iushln(shift);
  19910. bhi = b.words[b.length - 1] | 0;
  19911. }
  19912. // Initialize quotient
  19913. var m = a.length - b.length;
  19914. var q;
  19915. if (mode !== 'mod') {
  19916. q = new BN(null);
  19917. q.length = m + 1;
  19918. q.words = new Array(q.length);
  19919. for (var i = 0; i < q.length; i++) {
  19920. q.words[i] = 0;
  19921. }
  19922. }
  19923. var diff = a.clone()._ishlnsubmul(b, 1, m);
  19924. if (diff.negative === 0) {
  19925. a = diff;
  19926. if (q) {
  19927. q.words[m] = 1;
  19928. }
  19929. }
  19930. for (var j = m - 1; j >= 0; j--) {
  19931. var qj = (a.words[b.length + j] | 0) * 0x4000000 +
  19932. (a.words[b.length + j - 1] | 0);
  19933. // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
  19934. // (0x7ffffff)
  19935. qj = Math.min((qj / bhi) | 0, 0x3ffffff);
  19936. a._ishlnsubmul(b, qj, j);
  19937. while (a.negative !== 0) {
  19938. qj--;
  19939. a.negative = 0;
  19940. a._ishlnsubmul(b, 1, j);
  19941. if (!a.isZero()) {
  19942. a.negative ^= 1;
  19943. }
  19944. }
  19945. if (q) {
  19946. q.words[j] = qj;
  19947. }
  19948. }
  19949. if (q) {
  19950. q._strip();
  19951. }
  19952. a._strip();
  19953. // Denormalize
  19954. if (mode !== 'div' && shift !== 0) {
  19955. a.iushrn(shift);
  19956. }
  19957. return {
  19958. div: q || null,
  19959. mod: a
  19960. };
  19961. };
  19962. // NOTE: 1) `mode` can be set to `mod` to request mod only,
  19963. // to `div` to request div only, or be absent to
  19964. // request both div & mod
  19965. // 2) `positive` is true if unsigned mod is requested
  19966. BN.prototype.divmod = function divmod (num, mode, positive) {
  19967. assert(!num.isZero());
  19968. if (this.isZero()) {
  19969. return {
  19970. div: new BN(0),
  19971. mod: new BN(0)
  19972. };
  19973. }
  19974. var div, mod, res;
  19975. if (this.negative !== 0 && num.negative === 0) {
  19976. res = this.neg().divmod(num, mode);
  19977. if (mode !== 'mod') {
  19978. div = res.div.neg();
  19979. }
  19980. if (mode !== 'div') {
  19981. mod = res.mod.neg();
  19982. if (positive && mod.negative !== 0) {
  19983. mod.iadd(num);
  19984. }
  19985. }
  19986. return {
  19987. div: div,
  19988. mod: mod
  19989. };
  19990. }
  19991. if (this.negative === 0 && num.negative !== 0) {
  19992. res = this.divmod(num.neg(), mode);
  19993. if (mode !== 'mod') {
  19994. div = res.div.neg();
  19995. }
  19996. return {
  19997. div: div,
  19998. mod: res.mod
  19999. };
  20000. }
  20001. if ((this.negative & num.negative) !== 0) {
  20002. res = this.neg().divmod(num.neg(), mode);
  20003. if (mode !== 'div') {
  20004. mod = res.mod.neg();
  20005. if (positive && mod.negative !== 0) {
  20006. mod.isub(num);
  20007. }
  20008. }
  20009. return {
  20010. div: res.div,
  20011. mod: mod
  20012. };
  20013. }
  20014. // Both numbers are positive at this point
  20015. // Strip both numbers to approximate shift value
  20016. if (num.length > this.length || this.cmp(num) < 0) {
  20017. return {
  20018. div: new BN(0),
  20019. mod: this
  20020. };
  20021. }
  20022. // Very short reduction
  20023. if (num.length === 1) {
  20024. if (mode === 'div') {
  20025. return {
  20026. div: this.divn(num.words[0]),
  20027. mod: null
  20028. };
  20029. }
  20030. if (mode === 'mod') {
  20031. return {
  20032. div: null,
  20033. mod: new BN(this.modrn(num.words[0]))
  20034. };
  20035. }
  20036. return {
  20037. div: this.divn(num.words[0]),
  20038. mod: new BN(this.modrn(num.words[0]))
  20039. };
  20040. }
  20041. return this._wordDiv(num, mode);
  20042. };
  20043. // Find `this` / `num`
  20044. BN.prototype.div = function div (num) {
  20045. return this.divmod(num, 'div', false).div;
  20046. };
  20047. // Find `this` % `num`
  20048. BN.prototype.mod = function mod (num) {
  20049. return this.divmod(num, 'mod', false).mod;
  20050. };
  20051. BN.prototype.umod = function umod (num) {
  20052. return this.divmod(num, 'mod', true).mod;
  20053. };
  20054. // Find Round(`this` / `num`)
  20055. BN.prototype.divRound = function divRound (num) {
  20056. var dm = this.divmod(num);
  20057. // Fast case - exact division
  20058. if (dm.mod.isZero()) return dm.div;
  20059. var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
  20060. var half = num.ushrn(1);
  20061. var r2 = num.andln(1);
  20062. var cmp = mod.cmp(half);
  20063. // Round down
  20064. if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;
  20065. // Round up
  20066. return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
  20067. };
  20068. BN.prototype.modrn = function modrn (num) {
  20069. var isNegNum = num < 0;
  20070. if (isNegNum) num = -num;
  20071. assert(num <= 0x3ffffff);
  20072. var p = (1 << 26) % num;
  20073. var acc = 0;
  20074. for (var i = this.length - 1; i >= 0; i--) {
  20075. acc = (p * acc + (this.words[i] | 0)) % num;
  20076. }
  20077. return isNegNum ? -acc : acc;
  20078. };
  20079. // WARNING: DEPRECATED
  20080. BN.prototype.modn = function modn (num) {
  20081. return this.modrn(num);
  20082. };
  20083. // In-place division by number
  20084. BN.prototype.idivn = function idivn (num) {
  20085. var isNegNum = num < 0;
  20086. if (isNegNum) num = -num;
  20087. assert(num <= 0x3ffffff);
  20088. var carry = 0;
  20089. for (var i = this.length - 1; i >= 0; i--) {
  20090. var w = (this.words[i] | 0) + carry * 0x4000000;
  20091. this.words[i] = (w / num) | 0;
  20092. carry = w % num;
  20093. }
  20094. this._strip();
  20095. return isNegNum ? this.ineg() : this;
  20096. };
  20097. BN.prototype.divn = function divn (num) {
  20098. return this.clone().idivn(num);
  20099. };
  20100. BN.prototype.egcd = function egcd (p) {
  20101. assert(p.negative === 0);
  20102. assert(!p.isZero());
  20103. var x = this;
  20104. var y = p.clone();
  20105. if (x.negative !== 0) {
  20106. x = x.umod(p);
  20107. } else {
  20108. x = x.clone();
  20109. }
  20110. // A * x + B * y = x
  20111. var A = new BN(1);
  20112. var B = new BN(0);
  20113. // C * x + D * y = y
  20114. var C = new BN(0);
  20115. var D = new BN(1);
  20116. var g = 0;
  20117. while (x.isEven() && y.isEven()) {
  20118. x.iushrn(1);
  20119. y.iushrn(1);
  20120. ++g;
  20121. }
  20122. var yp = y.clone();
  20123. var xp = x.clone();
  20124. while (!x.isZero()) {
  20125. for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  20126. if (i > 0) {
  20127. x.iushrn(i);
  20128. while (i-- > 0) {
  20129. if (A.isOdd() || B.isOdd()) {
  20130. A.iadd(yp);
  20131. B.isub(xp);
  20132. }
  20133. A.iushrn(1);
  20134. B.iushrn(1);
  20135. }
  20136. }
  20137. for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  20138. if (j > 0) {
  20139. y.iushrn(j);
  20140. while (j-- > 0) {
  20141. if (C.isOdd() || D.isOdd()) {
  20142. C.iadd(yp);
  20143. D.isub(xp);
  20144. }
  20145. C.iushrn(1);
  20146. D.iushrn(1);
  20147. }
  20148. }
  20149. if (x.cmp(y) >= 0) {
  20150. x.isub(y);
  20151. A.isub(C);
  20152. B.isub(D);
  20153. } else {
  20154. y.isub(x);
  20155. C.isub(A);
  20156. D.isub(B);
  20157. }
  20158. }
  20159. return {
  20160. a: C,
  20161. b: D,
  20162. gcd: y.iushln(g)
  20163. };
  20164. };
  20165. // This is reduced incarnation of the binary EEA
  20166. // above, designated to invert members of the
  20167. // _prime_ fields F(p) at a maximal speed
  20168. BN.prototype._invmp = function _invmp (p) {
  20169. assert(p.negative === 0);
  20170. assert(!p.isZero());
  20171. var a = this;
  20172. var b = p.clone();
  20173. if (a.negative !== 0) {
  20174. a = a.umod(p);
  20175. } else {
  20176. a = a.clone();
  20177. }
  20178. var x1 = new BN(1);
  20179. var x2 = new BN(0);
  20180. var delta = b.clone();
  20181. while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
  20182. for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  20183. if (i > 0) {
  20184. a.iushrn(i);
  20185. while (i-- > 0) {
  20186. if (x1.isOdd()) {
  20187. x1.iadd(delta);
  20188. }
  20189. x1.iushrn(1);
  20190. }
  20191. }
  20192. for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  20193. if (j > 0) {
  20194. b.iushrn(j);
  20195. while (j-- > 0) {
  20196. if (x2.isOdd()) {
  20197. x2.iadd(delta);
  20198. }
  20199. x2.iushrn(1);
  20200. }
  20201. }
  20202. if (a.cmp(b) >= 0) {
  20203. a.isub(b);
  20204. x1.isub(x2);
  20205. } else {
  20206. b.isub(a);
  20207. x2.isub(x1);
  20208. }
  20209. }
  20210. var res;
  20211. if (a.cmpn(1) === 0) {
  20212. res = x1;
  20213. } else {
  20214. res = x2;
  20215. }
  20216. if (res.cmpn(0) < 0) {
  20217. res.iadd(p);
  20218. }
  20219. return res;
  20220. };
  20221. BN.prototype.gcd = function gcd (num) {
  20222. if (this.isZero()) return num.abs();
  20223. if (num.isZero()) return this.abs();
  20224. var a = this.clone();
  20225. var b = num.clone();
  20226. a.negative = 0;
  20227. b.negative = 0;
  20228. // Remove common factor of two
  20229. for (var shift = 0; a.isEven() && b.isEven(); shift++) {
  20230. a.iushrn(1);
  20231. b.iushrn(1);
  20232. }
  20233. do {
  20234. while (a.isEven()) {
  20235. a.iushrn(1);
  20236. }
  20237. while (b.isEven()) {
  20238. b.iushrn(1);
  20239. }
  20240. var r = a.cmp(b);
  20241. if (r < 0) {
  20242. // Swap `a` and `b` to make `a` always bigger than `b`
  20243. var t = a;
  20244. a = b;
  20245. b = t;
  20246. } else if (r === 0 || b.cmpn(1) === 0) {
  20247. break;
  20248. }
  20249. a.isub(b);
  20250. } while (true);
  20251. return b.iushln(shift);
  20252. };
  20253. // Invert number in the field F(num)
  20254. BN.prototype.invm = function invm (num) {
  20255. return this.egcd(num).a.umod(num);
  20256. };
  20257. BN.prototype.isEven = function isEven () {
  20258. return (this.words[0] & 1) === 0;
  20259. };
  20260. BN.prototype.isOdd = function isOdd () {
  20261. return (this.words[0] & 1) === 1;
  20262. };
  20263. // And first word and num
  20264. BN.prototype.andln = function andln (num) {
  20265. return this.words[0] & num;
  20266. };
  20267. // Increment at the bit position in-line
  20268. BN.prototype.bincn = function bincn (bit) {
  20269. assert(typeof bit === 'number');
  20270. var r = bit % 26;
  20271. var s = (bit - r) / 26;
  20272. var q = 1 << r;
  20273. // Fast case: bit is much higher than all existing words
  20274. if (this.length <= s) {
  20275. this._expand(s + 1);
  20276. this.words[s] |= q;
  20277. return this;
  20278. }
  20279. // Add bit and propagate, if needed
  20280. var carry = q;
  20281. for (var i = s; carry !== 0 && i < this.length; i++) {
  20282. var w = this.words[i] | 0;
  20283. w += carry;
  20284. carry = w >>> 26;
  20285. w &= 0x3ffffff;
  20286. this.words[i] = w;
  20287. }
  20288. if (carry !== 0) {
  20289. this.words[i] = carry;
  20290. this.length++;
  20291. }
  20292. return this;
  20293. };
  20294. BN.prototype.isZero = function isZero () {
  20295. return this.length === 1 && this.words[0] === 0;
  20296. };
  20297. BN.prototype.cmpn = function cmpn (num) {
  20298. var negative = num < 0;
  20299. if (this.negative !== 0 && !negative) return -1;
  20300. if (this.negative === 0 && negative) return 1;
  20301. this._strip();
  20302. var res;
  20303. if (this.length > 1) {
  20304. res = 1;
  20305. } else {
  20306. if (negative) {
  20307. num = -num;
  20308. }
  20309. assert(num <= 0x3ffffff, 'Number is too big');
  20310. var w = this.words[0] | 0;
  20311. res = w === num ? 0 : w < num ? -1 : 1;
  20312. }
  20313. if (this.negative !== 0) return -res | 0;
  20314. return res;
  20315. };
  20316. // Compare two numbers and return:
  20317. // 1 - if `this` > `num`
  20318. // 0 - if `this` == `num`
  20319. // -1 - if `this` < `num`
  20320. BN.prototype.cmp = function cmp (num) {
  20321. if (this.negative !== 0 && num.negative === 0) return -1;
  20322. if (this.negative === 0 && num.negative !== 0) return 1;
  20323. var res = this.ucmp(num);
  20324. if (this.negative !== 0) return -res | 0;
  20325. return res;
  20326. };
  20327. // Unsigned comparison
  20328. BN.prototype.ucmp = function ucmp (num) {
  20329. // At this point both numbers have the same sign
  20330. if (this.length > num.length) return 1;
  20331. if (this.length < num.length) return -1;
  20332. var res = 0;
  20333. for (var i = this.length - 1; i >= 0; i--) {
  20334. var a = this.words[i] | 0;
  20335. var b = num.words[i] | 0;
  20336. if (a === b) continue;
  20337. if (a < b) {
  20338. res = -1;
  20339. } else if (a > b) {
  20340. res = 1;
  20341. }
  20342. break;
  20343. }
  20344. return res;
  20345. };
  20346. BN.prototype.gtn = function gtn (num) {
  20347. return this.cmpn(num) === 1;
  20348. };
  20349. BN.prototype.gt = function gt (num) {
  20350. return this.cmp(num) === 1;
  20351. };
  20352. BN.prototype.gten = function gten (num) {
  20353. return this.cmpn(num) >= 0;
  20354. };
  20355. BN.prototype.gte = function gte (num) {
  20356. return this.cmp(num) >= 0;
  20357. };
  20358. BN.prototype.ltn = function ltn (num) {
  20359. return this.cmpn(num) === -1;
  20360. };
  20361. BN.prototype.lt = function lt (num) {
  20362. return this.cmp(num) === -1;
  20363. };
  20364. BN.prototype.lten = function lten (num) {
  20365. return this.cmpn(num) <= 0;
  20366. };
  20367. BN.prototype.lte = function lte (num) {
  20368. return this.cmp(num) <= 0;
  20369. };
  20370. BN.prototype.eqn = function eqn (num) {
  20371. return this.cmpn(num) === 0;
  20372. };
  20373. BN.prototype.eq = function eq (num) {
  20374. return this.cmp(num) === 0;
  20375. };
  20376. //
  20377. // A reduce context, could be using montgomery or something better, depending
  20378. // on the `m` itself.
  20379. //
  20380. BN.red = function red (num) {
  20381. return new Red(num);
  20382. };
  20383. BN.prototype.toRed = function toRed (ctx) {
  20384. assert(!this.red, 'Already a number in reduction context');
  20385. assert(this.negative === 0, 'red works only with positives');
  20386. return ctx.convertTo(this)._forceRed(ctx);
  20387. };
  20388. BN.prototype.fromRed = function fromRed () {
  20389. assert(this.red, 'fromRed works only with numbers in reduction context');
  20390. return this.red.convertFrom(this);
  20391. };
  20392. BN.prototype._forceRed = function _forceRed (ctx) {
  20393. this.red = ctx;
  20394. return this;
  20395. };
  20396. BN.prototype.forceRed = function forceRed (ctx) {
  20397. assert(!this.red, 'Already a number in reduction context');
  20398. return this._forceRed(ctx);
  20399. };
  20400. BN.prototype.redAdd = function redAdd (num) {
  20401. assert(this.red, 'redAdd works only with red numbers');
  20402. return this.red.add(this, num);
  20403. };
  20404. BN.prototype.redIAdd = function redIAdd (num) {
  20405. assert(this.red, 'redIAdd works only with red numbers');
  20406. return this.red.iadd(this, num);
  20407. };
  20408. BN.prototype.redSub = function redSub (num) {
  20409. assert(this.red, 'redSub works only with red numbers');
  20410. return this.red.sub(this, num);
  20411. };
  20412. BN.prototype.redISub = function redISub (num) {
  20413. assert(this.red, 'redISub works only with red numbers');
  20414. return this.red.isub(this, num);
  20415. };
  20416. BN.prototype.redShl = function redShl (num) {
  20417. assert(this.red, 'redShl works only with red numbers');
  20418. return this.red.shl(this, num);
  20419. };
  20420. BN.prototype.redMul = function redMul (num) {
  20421. assert(this.red, 'redMul works only with red numbers');
  20422. this.red._verify2(this, num);
  20423. return this.red.mul(this, num);
  20424. };
  20425. BN.prototype.redIMul = function redIMul (num) {
  20426. assert(this.red, 'redMul works only with red numbers');
  20427. this.red._verify2(this, num);
  20428. return this.red.imul(this, num);
  20429. };
  20430. BN.prototype.redSqr = function redSqr () {
  20431. assert(this.red, 'redSqr works only with red numbers');
  20432. this.red._verify1(this);
  20433. return this.red.sqr(this);
  20434. };
  20435. BN.prototype.redISqr = function redISqr () {
  20436. assert(this.red, 'redISqr works only with red numbers');
  20437. this.red._verify1(this);
  20438. return this.red.isqr(this);
  20439. };
  20440. // Square root over p
  20441. BN.prototype.redSqrt = function redSqrt () {
  20442. assert(this.red, 'redSqrt works only with red numbers');
  20443. this.red._verify1(this);
  20444. return this.red.sqrt(this);
  20445. };
  20446. BN.prototype.redInvm = function redInvm () {
  20447. assert(this.red, 'redInvm works only with red numbers');
  20448. this.red._verify1(this);
  20449. return this.red.invm(this);
  20450. };
  20451. // Return negative clone of `this` % `red modulo`
  20452. BN.prototype.redNeg = function redNeg () {
  20453. assert(this.red, 'redNeg works only with red numbers');
  20454. this.red._verify1(this);
  20455. return this.red.neg(this);
  20456. };
  20457. BN.prototype.redPow = function redPow (num) {
  20458. assert(this.red && !num.red, 'redPow(normalNum)');
  20459. this.red._verify1(this);
  20460. return this.red.pow(this, num);
  20461. };
  20462. // Prime numbers with efficient reduction
  20463. var primes = {
  20464. k256: null,
  20465. p224: null,
  20466. p192: null,
  20467. p25519: null
  20468. };
  20469. // Pseudo-Mersenne prime
  20470. function MPrime (name, p) {
  20471. // P = 2 ^ N - K
  20472. this.name = name;
  20473. this.p = new BN(p, 16);
  20474. this.n = this.p.bitLength();
  20475. this.k = new BN(1).iushln(this.n).isub(this.p);
  20476. this.tmp = this._tmp();
  20477. }
  20478. MPrime.prototype._tmp = function _tmp () {
  20479. var tmp = new BN(null);
  20480. tmp.words = new Array(Math.ceil(this.n / 13));
  20481. return tmp;
  20482. };
  20483. MPrime.prototype.ireduce = function ireduce (num) {
  20484. // Assumes that `num` is less than `P^2`
  20485. // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
  20486. var r = num;
  20487. var rlen;
  20488. do {
  20489. this.split(r, this.tmp);
  20490. r = this.imulK(r);
  20491. r = r.iadd(this.tmp);
  20492. rlen = r.bitLength();
  20493. } while (rlen > this.n);
  20494. var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
  20495. if (cmp === 0) {
  20496. r.words[0] = 0;
  20497. r.length = 1;
  20498. } else if (cmp > 0) {
  20499. r.isub(this.p);
  20500. } else {
  20501. if (r.strip !== undefined) {
  20502. // r is a BN v4 instance
  20503. r.strip();
  20504. } else {
  20505. // r is a BN v5 instance
  20506. r._strip();
  20507. }
  20508. }
  20509. return r;
  20510. };
  20511. MPrime.prototype.split = function split (input, out) {
  20512. input.iushrn(this.n, 0, out);
  20513. };
  20514. MPrime.prototype.imulK = function imulK (num) {
  20515. return num.imul(this.k);
  20516. };
  20517. function K256 () {
  20518. MPrime.call(
  20519. this,
  20520. 'k256',
  20521. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
  20522. }
  20523. inherits(K256, MPrime);
  20524. K256.prototype.split = function split (input, output) {
  20525. // 256 = 9 * 26 + 22
  20526. var mask = 0x3fffff;
  20527. var outLen = Math.min(input.length, 9);
  20528. for (var i = 0; i < outLen; i++) {
  20529. output.words[i] = input.words[i];
  20530. }
  20531. output.length = outLen;
  20532. if (input.length <= 9) {
  20533. input.words[0] = 0;
  20534. input.length = 1;
  20535. return;
  20536. }
  20537. // Shift by 9 limbs
  20538. var prev = input.words[9];
  20539. output.words[output.length++] = prev & mask;
  20540. for (i = 10; i < input.length; i++) {
  20541. var next = input.words[i] | 0;
  20542. input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
  20543. prev = next;
  20544. }
  20545. prev >>>= 22;
  20546. input.words[i - 10] = prev;
  20547. if (prev === 0 && input.length > 10) {
  20548. input.length -= 10;
  20549. } else {
  20550. input.length -= 9;
  20551. }
  20552. };
  20553. K256.prototype.imulK = function imulK (num) {
  20554. // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
  20555. num.words[num.length] = 0;
  20556. num.words[num.length + 1] = 0;
  20557. num.length += 2;
  20558. // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
  20559. var lo = 0;
  20560. for (var i = 0; i < num.length; i++) {
  20561. var w = num.words[i] | 0;
  20562. lo += w * 0x3d1;
  20563. num.words[i] = lo & 0x3ffffff;
  20564. lo = w * 0x40 + ((lo / 0x4000000) | 0);
  20565. }
  20566. // Fast length reduction
  20567. if (num.words[num.length - 1] === 0) {
  20568. num.length--;
  20569. if (num.words[num.length - 1] === 0) {
  20570. num.length--;
  20571. }
  20572. }
  20573. return num;
  20574. };
  20575. function P224 () {
  20576. MPrime.call(
  20577. this,
  20578. 'p224',
  20579. 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
  20580. }
  20581. inherits(P224, MPrime);
  20582. function P192 () {
  20583. MPrime.call(
  20584. this,
  20585. 'p192',
  20586. 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
  20587. }
  20588. inherits(P192, MPrime);
  20589. function P25519 () {
  20590. // 2 ^ 255 - 19
  20591. MPrime.call(
  20592. this,
  20593. '25519',
  20594. '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
  20595. }
  20596. inherits(P25519, MPrime);
  20597. P25519.prototype.imulK = function imulK (num) {
  20598. // K = 0x13
  20599. var carry = 0;
  20600. for (var i = 0; i < num.length; i++) {
  20601. var hi = (num.words[i] | 0) * 0x13 + carry;
  20602. var lo = hi & 0x3ffffff;
  20603. hi >>>= 26;
  20604. num.words[i] = lo;
  20605. carry = hi;
  20606. }
  20607. if (carry !== 0) {
  20608. num.words[num.length++] = carry;
  20609. }
  20610. return num;
  20611. };
  20612. // Exported mostly for testing purposes, use plain name instead
  20613. BN._prime = function prime (name) {
  20614. // Cached version of prime
  20615. if (primes[name]) return primes[name];
  20616. var prime;
  20617. if (name === 'k256') {
  20618. prime = new K256();
  20619. } else if (name === 'p224') {
  20620. prime = new P224();
  20621. } else if (name === 'p192') {
  20622. prime = new P192();
  20623. } else if (name === 'p25519') {
  20624. prime = new P25519();
  20625. } else {
  20626. throw new Error('Unknown prime ' + name);
  20627. }
  20628. primes[name] = prime;
  20629. return prime;
  20630. };
  20631. //
  20632. // Base reduction engine
  20633. //
  20634. function Red (m) {
  20635. if (typeof m === 'string') {
  20636. var prime = BN._prime(m);
  20637. this.m = prime.p;
  20638. this.prime = prime;
  20639. } else {
  20640. assert(m.gtn(1), 'modulus must be greater than 1');
  20641. this.m = m;
  20642. this.prime = null;
  20643. }
  20644. }
  20645. Red.prototype._verify1 = function _verify1 (a) {
  20646. assert(a.negative === 0, 'red works only with positives');
  20647. assert(a.red, 'red works only with red numbers');
  20648. };
  20649. Red.prototype._verify2 = function _verify2 (a, b) {
  20650. assert((a.negative | b.negative) === 0, 'red works only with positives');
  20651. assert(a.red && a.red === b.red,
  20652. 'red works only with red numbers');
  20653. };
  20654. Red.prototype.imod = function imod (a) {
  20655. if (this.prime) return this.prime.ireduce(a)._forceRed(this);
  20656. move(a, a.umod(this.m)._forceRed(this));
  20657. return a;
  20658. };
  20659. Red.prototype.neg = function neg (a) {
  20660. if (a.isZero()) {
  20661. return a.clone();
  20662. }
  20663. return this.m.sub(a)._forceRed(this);
  20664. };
  20665. Red.prototype.add = function add (a, b) {
  20666. this._verify2(a, b);
  20667. var res = a.add(b);
  20668. if (res.cmp(this.m) >= 0) {
  20669. res.isub(this.m);
  20670. }
  20671. return res._forceRed(this);
  20672. };
  20673. Red.prototype.iadd = function iadd (a, b) {
  20674. this._verify2(a, b);
  20675. var res = a.iadd(b);
  20676. if (res.cmp(this.m) >= 0) {
  20677. res.isub(this.m);
  20678. }
  20679. return res;
  20680. };
  20681. Red.prototype.sub = function sub (a, b) {
  20682. this._verify2(a, b);
  20683. var res = a.sub(b);
  20684. if (res.cmpn(0) < 0) {
  20685. res.iadd(this.m);
  20686. }
  20687. return res._forceRed(this);
  20688. };
  20689. Red.prototype.isub = function isub (a, b) {
  20690. this._verify2(a, b);
  20691. var res = a.isub(b);
  20692. if (res.cmpn(0) < 0) {
  20693. res.iadd(this.m);
  20694. }
  20695. return res;
  20696. };
  20697. Red.prototype.shl = function shl (a, num) {
  20698. this._verify1(a);
  20699. return this.imod(a.ushln(num));
  20700. };
  20701. Red.prototype.imul = function imul (a, b) {
  20702. this._verify2(a, b);
  20703. return this.imod(a.imul(b));
  20704. };
  20705. Red.prototype.mul = function mul (a, b) {
  20706. this._verify2(a, b);
  20707. return this.imod(a.mul(b));
  20708. };
  20709. Red.prototype.isqr = function isqr (a) {
  20710. return this.imul(a, a.clone());
  20711. };
  20712. Red.prototype.sqr = function sqr (a) {
  20713. return this.mul(a, a);
  20714. };
  20715. Red.prototype.sqrt = function sqrt (a) {
  20716. if (a.isZero()) return a.clone();
  20717. var mod3 = this.m.andln(3);
  20718. assert(mod3 % 2 === 1);
  20719. // Fast case
  20720. if (mod3 === 3) {
  20721. var pow = this.m.add(new BN(1)).iushrn(2);
  20722. return this.pow(a, pow);
  20723. }
  20724. // Tonelli-Shanks algorithm (Totally unoptimized and slow)
  20725. //
  20726. // Find Q and S, that Q * 2 ^ S = (P - 1)
  20727. var q = this.m.subn(1);
  20728. var s = 0;
  20729. while (!q.isZero() && q.andln(1) === 0) {
  20730. s++;
  20731. q.iushrn(1);
  20732. }
  20733. assert(!q.isZero());
  20734. var one = new BN(1).toRed(this);
  20735. var nOne = one.redNeg();
  20736. // Find quadratic non-residue
  20737. // NOTE: Max is such because of generalized Riemann hypothesis.
  20738. var lpow = this.m.subn(1).iushrn(1);
  20739. var z = this.m.bitLength();
  20740. z = new BN(2 * z * z).toRed(this);
  20741. while (this.pow(z, lpow).cmp(nOne) !== 0) {
  20742. z.redIAdd(nOne);
  20743. }
  20744. var c = this.pow(z, q);
  20745. var r = this.pow(a, q.addn(1).iushrn(1));
  20746. var t = this.pow(a, q);
  20747. var m = s;
  20748. while (t.cmp(one) !== 0) {
  20749. var tmp = t;
  20750. for (var i = 0; tmp.cmp(one) !== 0; i++) {
  20751. tmp = tmp.redSqr();
  20752. }
  20753. assert(i < m);
  20754. var b = this.pow(c, new BN(1).iushln(m - i - 1));
  20755. r = r.redMul(b);
  20756. c = b.redSqr();
  20757. t = t.redMul(c);
  20758. m = i;
  20759. }
  20760. return r;
  20761. };
  20762. Red.prototype.invm = function invm (a) {
  20763. var inv = a._invmp(this.m);
  20764. if (inv.negative !== 0) {
  20765. inv.negative = 0;
  20766. return this.imod(inv).redNeg();
  20767. } else {
  20768. return this.imod(inv);
  20769. }
  20770. };
  20771. Red.prototype.pow = function pow (a, num) {
  20772. if (num.isZero()) return new BN(1).toRed(this);
  20773. if (num.cmpn(1) === 0) return a.clone();
  20774. var windowSize = 4;
  20775. var wnd = new Array(1 << windowSize);
  20776. wnd[0] = new BN(1).toRed(this);
  20777. wnd[1] = a;
  20778. for (var i = 2; i < wnd.length; i++) {
  20779. wnd[i] = this.mul(wnd[i - 1], a);
  20780. }
  20781. var res = wnd[0];
  20782. var current = 0;
  20783. var currentLen = 0;
  20784. var start = num.bitLength() % 26;
  20785. if (start === 0) {
  20786. start = 26;
  20787. }
  20788. for (i = num.length - 1; i >= 0; i--) {
  20789. var word = num.words[i];
  20790. for (var j = start - 1; j >= 0; j--) {
  20791. var bit = (word >> j) & 1;
  20792. if (res !== wnd[0]) {
  20793. res = this.sqr(res);
  20794. }
  20795. if (bit === 0 && current === 0) {
  20796. currentLen = 0;
  20797. continue;
  20798. }
  20799. current <<= 1;
  20800. current |= bit;
  20801. currentLen++;
  20802. if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
  20803. res = this.mul(res, wnd[current]);
  20804. currentLen = 0;
  20805. current = 0;
  20806. }
  20807. start = 26;
  20808. }
  20809. return res;
  20810. };
  20811. Red.prototype.convertTo = function convertTo (num) {
  20812. var r = num.umod(this.m);
  20813. return r === num ? r.clone() : r;
  20814. };
  20815. Red.prototype.convertFrom = function convertFrom (num) {
  20816. var res = num.clone();
  20817. res.red = null;
  20818. return res;
  20819. };
  20820. //
  20821. // Montgomery method engine
  20822. //
  20823. BN.mont = function mont (num) {
  20824. return new Mont(num);
  20825. };
  20826. function Mont (m) {
  20827. Red.call(this, m);
  20828. this.shift = this.m.bitLength();
  20829. if (this.shift % 26 !== 0) {
  20830. this.shift += 26 - (this.shift % 26);
  20831. }
  20832. this.r = new BN(1).iushln(this.shift);
  20833. this.r2 = this.imod(this.r.sqr());
  20834. this.rinv = this.r._invmp(this.m);
  20835. this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
  20836. this.minv = this.minv.umod(this.r);
  20837. this.minv = this.r.sub(this.minv);
  20838. }
  20839. inherits(Mont, Red);
  20840. Mont.prototype.convertTo = function convertTo (num) {
  20841. return this.imod(num.ushln(this.shift));
  20842. };
  20843. Mont.prototype.convertFrom = function convertFrom (num) {
  20844. var r = this.imod(num.mul(this.rinv));
  20845. r.red = null;
  20846. return r;
  20847. };
  20848. Mont.prototype.imul = function imul (a, b) {
  20849. if (a.isZero() || b.isZero()) {
  20850. a.words[0] = 0;
  20851. a.length = 1;
  20852. return a;
  20853. }
  20854. var t = a.imul(b);
  20855. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  20856. var u = t.isub(c).iushrn(this.shift);
  20857. var res = u;
  20858. if (u.cmp(this.m) >= 0) {
  20859. res = u.isub(this.m);
  20860. } else if (u.cmpn(0) < 0) {
  20861. res = u.iadd(this.m);
  20862. }
  20863. return res._forceRed(this);
  20864. };
  20865. Mont.prototype.mul = function mul (a, b) {
  20866. if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
  20867. var t = a.mul(b);
  20868. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  20869. var u = t.isub(c).iushrn(this.shift);
  20870. var res = u;
  20871. if (u.cmp(this.m) >= 0) {
  20872. res = u.isub(this.m);
  20873. } else if (u.cmpn(0) < 0) {
  20874. res = u.iadd(this.m);
  20875. }
  20876. return res._forceRed(this);
  20877. };
  20878. Mont.prototype.invm = function invm (a) {
  20879. // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
  20880. var res = this.imod(a._invmp(this.m).mul(this.r2));
  20881. return res._forceRed(this);
  20882. };
  20883. })( false || module, this);
  20884. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ 170)(module)))
  20885. /***/ }),
  20886. /* 170 */
  20887. /*!***********************************!*\
  20888. !*** (webpack)/buildin/module.js ***!
  20889. \***********************************/
  20890. /*! no static exports found */
  20891. /***/ (function(module, exports) {
  20892. module.exports = function(module) {
  20893. if (!module.webpackPolyfill) {
  20894. module.deprecate = function() {};
  20895. module.paths = [];
  20896. // module.parent = undefined by default
  20897. if (!module.children) module.children = [];
  20898. Object.defineProperty(module, "loaded", {
  20899. enumerable: true,
  20900. get: function() {
  20901. return module.l;
  20902. }
  20903. });
  20904. Object.defineProperty(module, "id", {
  20905. enumerable: true,
  20906. get: function() {
  20907. return module.i;
  20908. }
  20909. });
  20910. module.webpackPolyfill = 1;
  20911. }
  20912. return module;
  20913. };
  20914. /***/ }),
  20915. /* 171 */
  20916. /*!************************!*\
  20917. !*** buffer (ignored) ***!
  20918. \************************/
  20919. /*! no static exports found */
  20920. /***/ (function(module, exports) {
  20921. /* (ignored) */
  20922. /***/ }),
  20923. /* 172 */
  20924. /*!*********************************************!*\
  20925. !*** ./node_modules/miller-rabin/lib/mr.js ***!
  20926. \*********************************************/
  20927. /*! no static exports found */
  20928. /***/ (function(module, exports, __webpack_require__) {
  20929. var bn = __webpack_require__(/*! bn.js */ 169);
  20930. var brorand = __webpack_require__(/*! brorand */ 173);
  20931. function MillerRabin(rand) {
  20932. this.rand = rand || new brorand.Rand();
  20933. }
  20934. module.exports = MillerRabin;
  20935. MillerRabin.create = function create(rand) {
  20936. return new MillerRabin(rand);
  20937. };
  20938. MillerRabin.prototype._randbelow = function _randbelow(n) {
  20939. var len = n.bitLength();
  20940. var min_bytes = Math.ceil(len / 8);
  20941. // Generage random bytes until a number less than n is found.
  20942. // This ensures that 0..n-1 have an equal probability of being selected.
  20943. do
  20944. var a = new bn(this.rand.generate(min_bytes));
  20945. while (a.cmp(n) >= 0);
  20946. return a;
  20947. };
  20948. MillerRabin.prototype._randrange = function _randrange(start, stop) {
  20949. // Generate a random number greater than or equal to start and less than stop.
  20950. var size = stop.sub(start);
  20951. return start.add(this._randbelow(size));
  20952. };
  20953. MillerRabin.prototype.test = function test(n, k, cb) {
  20954. var len = n.bitLength();
  20955. var red = bn.mont(n);
  20956. var rone = new bn(1).toRed(red);
  20957. if (!k)
  20958. k = Math.max(1, (len / 48) | 0);
  20959. // Find d and s, (n - 1) = (2 ^ s) * d;
  20960. var n1 = n.subn(1);
  20961. for (var s = 0; !n1.testn(s); s++) {}
  20962. var d = n.shrn(s);
  20963. var rn1 = n1.toRed(red);
  20964. var prime = true;
  20965. for (; k > 0; k--) {
  20966. var a = this._randrange(new bn(2), n1);
  20967. if (cb)
  20968. cb(a);
  20969. var x = a.toRed(red).redPow(d);
  20970. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  20971. continue;
  20972. for (var i = 1; i < s; i++) {
  20973. x = x.redSqr();
  20974. if (x.cmp(rone) === 0)
  20975. return false;
  20976. if (x.cmp(rn1) === 0)
  20977. break;
  20978. }
  20979. if (i === s)
  20980. return false;
  20981. }
  20982. return prime;
  20983. };
  20984. MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
  20985. var len = n.bitLength();
  20986. var red = bn.mont(n);
  20987. var rone = new bn(1).toRed(red);
  20988. if (!k)
  20989. k = Math.max(1, (len / 48) | 0);
  20990. // Find d and s, (n - 1) = (2 ^ s) * d;
  20991. var n1 = n.subn(1);
  20992. for (var s = 0; !n1.testn(s); s++) {}
  20993. var d = n.shrn(s);
  20994. var rn1 = n1.toRed(red);
  20995. for (; k > 0; k--) {
  20996. var a = this._randrange(new bn(2), n1);
  20997. var g = n.gcd(a);
  20998. if (g.cmpn(1) !== 0)
  20999. return g;
  21000. var x = a.toRed(red).redPow(d);
  21001. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  21002. continue;
  21003. for (var i = 1; i < s; i++) {
  21004. x = x.redSqr();
  21005. if (x.cmp(rone) === 0)
  21006. return x.fromRed().subn(1).gcd(n);
  21007. if (x.cmp(rn1) === 0)
  21008. break;
  21009. }
  21010. if (i === s) {
  21011. x = x.redSqr();
  21012. return x.fromRed().subn(1).gcd(n);
  21013. }
  21014. }
  21015. return false;
  21016. };
  21017. /***/ }),
  21018. /* 173 */
  21019. /*!***************************************!*\
  21020. !*** ./node_modules/brorand/index.js ***!
  21021. \***************************************/
  21022. /*! no static exports found */
  21023. /***/ (function(module, exports, __webpack_require__) {
  21024. var r;
  21025. module.exports = function rand(len) {
  21026. if (!r)
  21027. r = new Rand(null);
  21028. return r.generate(len);
  21029. };
  21030. function Rand(rand) {
  21031. this.rand = rand;
  21032. }
  21033. module.exports.Rand = Rand;
  21034. Rand.prototype.generate = function generate(len) {
  21035. return this._rand(len);
  21036. };
  21037. // Emulate crypto API using randy
  21038. Rand.prototype._rand = function _rand(n) {
  21039. if (this.rand.getBytes)
  21040. return this.rand.getBytes(n);
  21041. var res = new Uint8Array(n);
  21042. for (var i = 0; i < res.length; i++)
  21043. res[i] = this.rand.getByte();
  21044. return res;
  21045. };
  21046. if (typeof self === 'object') {
  21047. if (self.crypto && self.crypto.getRandomValues) {
  21048. // Modern browsers
  21049. Rand.prototype._rand = function _rand(n) {
  21050. var arr = new Uint8Array(n);
  21051. self.crypto.getRandomValues(arr);
  21052. return arr;
  21053. };
  21054. } else if (self.msCrypto && self.msCrypto.getRandomValues) {
  21055. // IE
  21056. Rand.prototype._rand = function _rand(n) {
  21057. var arr = new Uint8Array(n);
  21058. self.msCrypto.getRandomValues(arr);
  21059. return arr;
  21060. };
  21061. // Safari's WebWorkers do not have `crypto`
  21062. } else if (typeof window === 'object') {
  21063. // Old junk
  21064. Rand.prototype._rand = function() {
  21065. throw new Error('Not implemented yet');
  21066. };
  21067. }
  21068. } else {
  21069. // Node.js or Web worker with no crypto support
  21070. try {
  21071. var crypto = __webpack_require__(/*! crypto */ 174);
  21072. if (typeof crypto.randomBytes !== 'function')
  21073. throw new Error('Not supported');
  21074. Rand.prototype._rand = function _rand(n) {
  21075. return crypto.randomBytes(n);
  21076. };
  21077. } catch (e) {
  21078. }
  21079. }
  21080. /***/ }),
  21081. /* 174 */
  21082. /*!************************!*\
  21083. !*** crypto (ignored) ***!
  21084. \************************/
  21085. /*! no static exports found */
  21086. /***/ (function(module, exports) {
  21087. /* (ignored) */
  21088. /***/ }),
  21089. /* 175 */
  21090. /*!*****************************************************!*\
  21091. !*** ./node_modules/diffie-hellman/lib/primes.json ***!
  21092. \*****************************************************/
  21093. /*! exports provided: modp1, modp2, modp5, modp14, modp15, modp16, modp17, modp18, default */
  21094. /***/ (function(module) {
  21095. module.exports = JSON.parse("{\"modp1\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff\"},\"modp2\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff\"},\"modp5\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff\"},\"modp14\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff\"},\"modp15\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff\"},\"modp16\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff\"},\"modp17\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff\"},\"modp18\":{\"gen\":\"02\",\"prime\":\"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff\"}}");
  21096. /***/ }),
  21097. /* 176 */
  21098. /*!***********************************************!*\
  21099. !*** ./node_modules/diffie-hellman/lib/dh.js ***!
  21100. \***********************************************/
  21101. /*! no static exports found */
  21102. /***/ (function(module, exports, __webpack_require__) {
  21103. /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(/*! bn.js */ 169);
  21104. var MillerRabin = __webpack_require__(/*! miller-rabin */ 172);
  21105. var millerRabin = new MillerRabin();
  21106. var TWENTYFOUR = new BN(24);
  21107. var ELEVEN = new BN(11);
  21108. var TEN = new BN(10);
  21109. var THREE = new BN(3);
  21110. var SEVEN = new BN(7);
  21111. var primes = __webpack_require__(/*! ./generatePrime */ 168);
  21112. var randomBytes = __webpack_require__(/*! randombytes */ 84);
  21113. module.exports = DH;
  21114. function setPublicKey(pub, enc) {
  21115. enc = enc || 'utf8';
  21116. if (!Buffer.isBuffer(pub)) {
  21117. pub = new Buffer(pub, enc);
  21118. }
  21119. this._pub = new BN(pub);
  21120. return this;
  21121. }
  21122. function setPrivateKey(priv, enc) {
  21123. enc = enc || 'utf8';
  21124. if (!Buffer.isBuffer(priv)) {
  21125. priv = new Buffer(priv, enc);
  21126. }
  21127. this._priv = new BN(priv);
  21128. return this;
  21129. }
  21130. var primeCache = {};
  21131. function checkPrime(prime, generator) {
  21132. var gen = generator.toString('hex');
  21133. var hex = [gen, prime.toString(16)].join('_');
  21134. if (hex in primeCache) {
  21135. return primeCache[hex];
  21136. }
  21137. var error = 0;
  21138. if (prime.isEven() ||
  21139. !primes.simpleSieve ||
  21140. !primes.fermatTest(prime) ||
  21141. !millerRabin.test(prime)) {
  21142. //not a prime so +1
  21143. error += 1;
  21144. if (gen === '02' || gen === '05') {
  21145. // we'd be able to check the generator
  21146. // it would fail so +8
  21147. error += 8;
  21148. } else {
  21149. //we wouldn't be able to test the generator
  21150. // so +4
  21151. error += 4;
  21152. }
  21153. primeCache[hex] = error;
  21154. return error;
  21155. }
  21156. if (!millerRabin.test(prime.shrn(1))) {
  21157. //not a safe prime
  21158. error += 2;
  21159. }
  21160. var rem;
  21161. switch (gen) {
  21162. case '02':
  21163. if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
  21164. // unsuidable generator
  21165. error += 8;
  21166. }
  21167. break;
  21168. case '05':
  21169. rem = prime.mod(TEN);
  21170. if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
  21171. // prime mod 10 needs to equal 3 or 7
  21172. error += 8;
  21173. }
  21174. break;
  21175. default:
  21176. error += 4;
  21177. }
  21178. primeCache[hex] = error;
  21179. return error;
  21180. }
  21181. function DH(prime, generator, malleable) {
  21182. this.setGenerator(generator);
  21183. this.__prime = new BN(prime);
  21184. this._prime = BN.mont(this.__prime);
  21185. this._primeLen = prime.length;
  21186. this._pub = undefined;
  21187. this._priv = undefined;
  21188. this._primeCode = undefined;
  21189. if (malleable) {
  21190. this.setPublicKey = setPublicKey;
  21191. this.setPrivateKey = setPrivateKey;
  21192. } else {
  21193. this._primeCode = 8;
  21194. }
  21195. }
  21196. Object.defineProperty(DH.prototype, 'verifyError', {
  21197. enumerable: true,
  21198. get: function () {
  21199. if (typeof this._primeCode !== 'number') {
  21200. this._primeCode = checkPrime(this.__prime, this.__gen);
  21201. }
  21202. return this._primeCode;
  21203. }
  21204. });
  21205. DH.prototype.generateKeys = function () {
  21206. if (!this._priv) {
  21207. this._priv = new BN(randomBytes(this._primeLen));
  21208. }
  21209. this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
  21210. return this.getPublicKey();
  21211. };
  21212. DH.prototype.computeSecret = function (other) {
  21213. other = new BN(other);
  21214. other = other.toRed(this._prime);
  21215. var secret = other.redPow(this._priv).fromRed();
  21216. var out = new Buffer(secret.toArray());
  21217. var prime = this.getPrime();
  21218. if (out.length < prime.length) {
  21219. var front = new Buffer(prime.length - out.length);
  21220. front.fill(0);
  21221. out = Buffer.concat([front, out]);
  21222. }
  21223. return out;
  21224. };
  21225. DH.prototype.getPublicKey = function getPublicKey(enc) {
  21226. return formatReturnValue(this._pub, enc);
  21227. };
  21228. DH.prototype.getPrivateKey = function getPrivateKey(enc) {
  21229. return formatReturnValue(this._priv, enc);
  21230. };
  21231. DH.prototype.getPrime = function (enc) {
  21232. return formatReturnValue(this.__prime, enc);
  21233. };
  21234. DH.prototype.getGenerator = function (enc) {
  21235. return formatReturnValue(this._gen, enc);
  21236. };
  21237. DH.prototype.setGenerator = function (gen, enc) {
  21238. enc = enc || 'utf8';
  21239. if (!Buffer.isBuffer(gen)) {
  21240. gen = new Buffer(gen, enc);
  21241. }
  21242. this.__gen = gen;
  21243. this._gen = new BN(gen);
  21244. return this;
  21245. };
  21246. function formatReturnValue(bn, enc) {
  21247. var buf = new Buffer(bn.toArray());
  21248. if (!enc) {
  21249. return buf;
  21250. } else {
  21251. return buf.toString(enc);
  21252. }
  21253. }
  21254. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 88).Buffer))
  21255. /***/ }),
  21256. /* 177 */
  21257. /*!*******************************************************!*\
  21258. !*** ./node_modules/browserify-sign/browser/index.js ***!
  21259. \*******************************************************/
  21260. /*! no static exports found */
  21261. /***/ (function(module, exports, __webpack_require__) {
  21262. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  21263. var createHash = __webpack_require__(/*! create-hash */ 92)
  21264. var stream = __webpack_require__(/*! readable-stream */ 96)
  21265. var inherits = __webpack_require__(/*! inherits */ 93)
  21266. var sign = __webpack_require__(/*! ./sign */ 178)
  21267. var verify = __webpack_require__(/*! ./verify */ 231)
  21268. var algorithms = __webpack_require__(/*! ./algorithms.json */ 131)
  21269. Object.keys(algorithms).forEach(function (key) {
  21270. algorithms[key].id = Buffer.from(algorithms[key].id, 'hex')
  21271. algorithms[key.toLowerCase()] = algorithms[key]
  21272. })
  21273. function Sign (algorithm) {
  21274. stream.Writable.call(this)
  21275. var data = algorithms[algorithm]
  21276. if (!data) throw new Error('Unknown message digest')
  21277. this._hashType = data.hash
  21278. this._hash = createHash(data.hash)
  21279. this._tag = data.id
  21280. this._signType = data.sign
  21281. }
  21282. inherits(Sign, stream.Writable)
  21283. Sign.prototype._write = function _write (data, _, done) {
  21284. this._hash.update(data)
  21285. done()
  21286. }
  21287. Sign.prototype.update = function update (data, enc) {
  21288. if (typeof data === 'string') data = Buffer.from(data, enc)
  21289. this._hash.update(data)
  21290. return this
  21291. }
  21292. Sign.prototype.sign = function signMethod (key, enc) {
  21293. this.end()
  21294. var hash = this._hash.digest()
  21295. var sig = sign(hash, key, this._hashType, this._signType, this._tag)
  21296. return enc ? sig.toString(enc) : sig
  21297. }
  21298. function Verify (algorithm) {
  21299. stream.Writable.call(this)
  21300. var data = algorithms[algorithm]
  21301. if (!data) throw new Error('Unknown message digest')
  21302. this._hash = createHash(data.hash)
  21303. this._tag = data.id
  21304. this._signType = data.sign
  21305. }
  21306. inherits(Verify, stream.Writable)
  21307. Verify.prototype._write = function _write (data, _, done) {
  21308. this._hash.update(data)
  21309. done()
  21310. }
  21311. Verify.prototype.update = function update (data, enc) {
  21312. if (typeof data === 'string') data = Buffer.from(data, enc)
  21313. this._hash.update(data)
  21314. return this
  21315. }
  21316. Verify.prototype.verify = function verifyMethod (key, sig, enc) {
  21317. if (typeof sig === 'string') sig = Buffer.from(sig, enc)
  21318. this.end()
  21319. var hash = this._hash.digest()
  21320. return verify(sig, hash, key, this._signType, this._tag)
  21321. }
  21322. function createSign (algorithm) {
  21323. return new Sign(algorithm)
  21324. }
  21325. function createVerify (algorithm) {
  21326. return new Verify(algorithm)
  21327. }
  21328. module.exports = {
  21329. Sign: createSign,
  21330. Verify: createVerify,
  21331. createSign: createSign,
  21332. createVerify: createVerify
  21333. }
  21334. /***/ }),
  21335. /* 178 */
  21336. /*!******************************************************!*\
  21337. !*** ./node_modules/browserify-sign/browser/sign.js ***!
  21338. \******************************************************/
  21339. /*! no static exports found */
  21340. /***/ (function(module, exports, __webpack_require__) {
  21341. // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  21342. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  21343. var createHmac = __webpack_require__(/*! create-hmac */ 127)
  21344. var crt = __webpack_require__(/*! browserify-rsa */ 179)
  21345. var EC = __webpack_require__(/*! elliptic */ 180).ec
  21346. var BN = __webpack_require__(/*! bn.js */ 169)
  21347. var parseKeys = __webpack_require__(/*! parse-asn1 */ 210)
  21348. var curves = __webpack_require__(/*! ./curves.json */ 230)
  21349. function sign (hash, key, hashType, signType, tag) {
  21350. var priv = parseKeys(key)
  21351. if (priv.curve) {
  21352. // rsa keys can be interpreted as ecdsa ones in openssl
  21353. if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
  21354. return ecSign(hash, priv)
  21355. } else if (priv.type === 'dsa') {
  21356. if (signType !== 'dsa') throw new Error('wrong private key type')
  21357. return dsaSign(hash, priv, hashType)
  21358. } else {
  21359. if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
  21360. }
  21361. hash = Buffer.concat([tag, hash])
  21362. var len = priv.modulus.byteLength()
  21363. var pad = [0, 1]
  21364. while (hash.length + pad.length + 1 < len) pad.push(0xff)
  21365. pad.push(0x00)
  21366. var i = -1
  21367. while (++i < hash.length) pad.push(hash[i])
  21368. var out = crt(pad, priv)
  21369. return out
  21370. }
  21371. function ecSign (hash, priv) {
  21372. var curveId = curves[priv.curve.join('.')]
  21373. if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
  21374. var curve = new EC(curveId)
  21375. var key = curve.keyFromPrivate(priv.privateKey)
  21376. var out = key.sign(hash)
  21377. return Buffer.from(out.toDER())
  21378. }
  21379. function dsaSign (hash, priv, algo) {
  21380. var x = priv.params.priv_key
  21381. var p = priv.params.p
  21382. var q = priv.params.q
  21383. var g = priv.params.g
  21384. var r = new BN(0)
  21385. var k
  21386. var H = bits2int(hash, q).mod(q)
  21387. var s = false
  21388. var kv = getKey(x, q, hash, algo)
  21389. while (s === false) {
  21390. k = makeKey(q, kv, algo)
  21391. r = makeR(g, k, p, q)
  21392. s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
  21393. if (s.cmpn(0) === 0) {
  21394. s = false
  21395. r = new BN(0)
  21396. }
  21397. }
  21398. return toDER(r, s)
  21399. }
  21400. function toDER (r, s) {
  21401. r = r.toArray()
  21402. s = s.toArray()
  21403. // Pad values
  21404. if (r[0] & 0x80) r = [0].concat(r)
  21405. if (s[0] & 0x80) s = [0].concat(s)
  21406. var total = r.length + s.length + 4
  21407. var res = [0x30, total, 0x02, r.length]
  21408. res = res.concat(r, [0x02, s.length], s)
  21409. return Buffer.from(res)
  21410. }
  21411. function getKey (x, q, hash, algo) {
  21412. x = Buffer.from(x.toArray())
  21413. if (x.length < q.byteLength()) {
  21414. var zeros = Buffer.alloc(q.byteLength() - x.length)
  21415. x = Buffer.concat([zeros, x])
  21416. }
  21417. var hlen = hash.length
  21418. var hbits = bits2octets(hash, q)
  21419. var v = Buffer.alloc(hlen)
  21420. v.fill(1)
  21421. var k = Buffer.alloc(hlen)
  21422. k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest()
  21423. v = createHmac(algo, k).update(v).digest()
  21424. k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest()
  21425. v = createHmac(algo, k).update(v).digest()
  21426. return { k: k, v: v }
  21427. }
  21428. function bits2int (obits, q) {
  21429. var bits = new BN(obits)
  21430. var shift = (obits.length << 3) - q.bitLength()
  21431. if (shift > 0) bits.ishrn(shift)
  21432. return bits
  21433. }
  21434. function bits2octets (bits, q) {
  21435. bits = bits2int(bits, q)
  21436. bits = bits.mod(q)
  21437. var out = Buffer.from(bits.toArray())
  21438. if (out.length < q.byteLength()) {
  21439. var zeros = Buffer.alloc(q.byteLength() - out.length)
  21440. out = Buffer.concat([zeros, out])
  21441. }
  21442. return out
  21443. }
  21444. function makeKey (q, kv, algo) {
  21445. var t
  21446. var k
  21447. do {
  21448. t = Buffer.alloc(0)
  21449. while (t.length * 8 < q.bitLength()) {
  21450. kv.v = createHmac(algo, kv.k).update(kv.v).digest()
  21451. t = Buffer.concat([t, kv.v])
  21452. }
  21453. k = bits2int(t, q)
  21454. kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest()
  21455. kv.v = createHmac(algo, kv.k).update(kv.v).digest()
  21456. } while (k.cmp(q) !== -1)
  21457. return k
  21458. }
  21459. function makeR (g, k, p, q) {
  21460. return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
  21461. }
  21462. module.exports = sign
  21463. module.exports.getKey = getKey
  21464. module.exports.makeKey = makeKey
  21465. /***/ }),
  21466. /* 179 */
  21467. /*!**********************************************!*\
  21468. !*** ./node_modules/browserify-rsa/index.js ***!
  21469. \**********************************************/
  21470. /*! no static exports found */
  21471. /***/ (function(module, exports, __webpack_require__) {
  21472. /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(/*! bn.js */ 169);
  21473. var randomBytes = __webpack_require__(/*! randombytes */ 84);
  21474. module.exports = crt;
  21475. function blind(priv) {
  21476. var r = getr(priv);
  21477. var blinder = r.toRed(bn.mont(priv.modulus))
  21478. .redPow(new bn(priv.publicExponent)).fromRed();
  21479. return {
  21480. blinder: blinder,
  21481. unblinder:r.invm(priv.modulus)
  21482. };
  21483. }
  21484. function crt(msg, priv) {
  21485. var blinds = blind(priv);
  21486. var len = priv.modulus.byteLength();
  21487. var mod = bn.mont(priv.modulus);
  21488. var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
  21489. var c1 = blinded.toRed(bn.mont(priv.prime1));
  21490. var c2 = blinded.toRed(bn.mont(priv.prime2));
  21491. var qinv = priv.coefficient;
  21492. var p = priv.prime1;
  21493. var q = priv.prime2;
  21494. var m1 = c1.redPow(priv.exponent1);
  21495. var m2 = c2.redPow(priv.exponent2);
  21496. m1 = m1.fromRed();
  21497. m2 = m2.fromRed();
  21498. var h = m1.isub(m2).imul(qinv).umod(p);
  21499. h.imul(q);
  21500. m2.iadd(h);
  21501. return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
  21502. }
  21503. crt.getr = getr;
  21504. function getr(priv) {
  21505. var len = priv.modulus.byteLength();
  21506. var r = new bn(randomBytes(len));
  21507. while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
  21508. r = new bn(randomBytes(len));
  21509. }
  21510. return r;
  21511. }
  21512. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 88).Buffer))
  21513. /***/ }),
  21514. /* 180 */
  21515. /*!***********************************************!*\
  21516. !*** ./node_modules/elliptic/lib/elliptic.js ***!
  21517. \***********************************************/
  21518. /*! no static exports found */
  21519. /***/ (function(module, exports, __webpack_require__) {
  21520. "use strict";
  21521. var elliptic = exports;
  21522. elliptic.version = __webpack_require__(/*! ../package.json */ 181).version;
  21523. elliptic.utils = __webpack_require__(/*! ./elliptic/utils */ 182);
  21524. elliptic.rand = __webpack_require__(/*! brorand */ 173);
  21525. elliptic.curve = __webpack_require__(/*! ./elliptic/curve */ 184);
  21526. elliptic.curves = __webpack_require__(/*! ./elliptic/curves */ 189);
  21527. // Protocols
  21528. elliptic.ec = __webpack_require__(/*! ./elliptic/ec */ 203);
  21529. elliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ 207);
  21530. /***/ }),
  21531. /* 181 */
  21532. /*!********************************************!*\
  21533. !*** ./node_modules/elliptic/package.json ***!
  21534. \********************************************/
  21535. /*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, bugs, bundleDependencies, dependencies, deprecated, description, devDependencies, files, homepage, keywords, license, main, name, repository, scripts, version, default */
  21536. /***/ (function(module) {
  21537. module.exports = JSON.parse("{\"_from\":\"elliptic@^6.5.2\",\"_id\":\"elliptic@6.5.2\",\"_inBundle\":false,\"_integrity\":\"sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==\",\"_location\":\"/elliptic\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"elliptic@^6.5.2\",\"name\":\"elliptic\",\"escapedName\":\"elliptic\",\"rawSpec\":\"^6.5.2\",\"saveSpec\":null,\"fetchSpec\":\"^6.5.2\"},\"_requiredBy\":[\"/browserify-sign\",\"/create-ecdh\"],\"_resolved\":\"https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz\",\"_shasum\":\"05c5678d7173c049d8ca433552224a495d0e3762\",\"_spec\":\"elliptic@^6.5.2\",\"_where\":\"/Users/fxy/Documents/DCloud/HbuilderX-plugins/alpha/uniapp-cli/node_modules/browserify-sign\",\"author\":{\"name\":\"Fedor Indutny\",\"email\":\"fedor@indutny.com\"},\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"bn.js\":\"^4.4.0\",\"brorand\":\"^1.0.1\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.0\",\"inherits\":\"^2.0.1\",\"minimalistic-assert\":\"^1.0.0\",\"minimalistic-crypto-utils\":\"^1.0.0\"},\"deprecated\":false,\"description\":\"EC cryptography\",\"devDependencies\":{\"brfs\":\"^1.4.3\",\"coveralls\":\"^3.0.8\",\"grunt\":\"^1.0.4\",\"grunt-browserify\":\"^5.0.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-connect\":\"^1.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^1.0.1\",\"grunt-mocha-istanbul\":\"^3.0.1\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.2\",\"jscs\":\"^3.0.7\",\"jshint\":\"^2.10.3\",\"mocha\":\"^6.2.2\"},\"files\":[\"lib\"],\"homepage\":\"https://github.com/indutny/elliptic\",\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"license\":\"MIT\",\"main\":\"lib/elliptic.js\",\"name\":\"elliptic\",\"repository\":{\"type\":\"git\",\"url\":\"git+ssh://git@github.com/indutny/elliptic.git\"},\"scripts\":{\"jscs\":\"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js\",\"jshint\":\"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js\",\"lint\":\"npm run jscs && npm run jshint\",\"test\":\"npm run lint && npm run unit\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"version\":\"grunt dist && git add dist/\"},\"version\":\"6.5.2\"}");
  21538. /***/ }),
  21539. /* 182 */
  21540. /*!*****************************************************!*\
  21541. !*** ./node_modules/elliptic/lib/elliptic/utils.js ***!
  21542. \*****************************************************/
  21543. /*! no static exports found */
  21544. /***/ (function(module, exports, __webpack_require__) {
  21545. "use strict";
  21546. var utils = exports;
  21547. var BN = __webpack_require__(/*! bn.js */ 169);
  21548. var minAssert = __webpack_require__(/*! minimalistic-assert */ 143);
  21549. var minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ 183);
  21550. utils.assert = minAssert;
  21551. utils.toArray = minUtils.toArray;
  21552. utils.zero2 = minUtils.zero2;
  21553. utils.toHex = minUtils.toHex;
  21554. utils.encode = minUtils.encode;
  21555. // Represent num in a w-NAF form
  21556. function getNAF(num, w, bits) {
  21557. var naf = new Array(Math.max(num.bitLength(), bits) + 1);
  21558. naf.fill(0);
  21559. var ws = 1 << (w + 1);
  21560. var k = num.clone();
  21561. for (var i = 0; i < naf.length; i++) {
  21562. var z;
  21563. var mod = k.andln(ws - 1);
  21564. if (k.isOdd()) {
  21565. if (mod > (ws >> 1) - 1)
  21566. z = (ws >> 1) - mod;
  21567. else
  21568. z = mod;
  21569. k.isubn(z);
  21570. } else {
  21571. z = 0;
  21572. }
  21573. naf[i] = z;
  21574. k.iushrn(1);
  21575. }
  21576. return naf;
  21577. }
  21578. utils.getNAF = getNAF;
  21579. // Represent k1, k2 in a Joint Sparse Form
  21580. function getJSF(k1, k2) {
  21581. var jsf = [
  21582. [],
  21583. []
  21584. ];
  21585. k1 = k1.clone();
  21586. k2 = k2.clone();
  21587. var d1 = 0;
  21588. var d2 = 0;
  21589. while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
  21590. // First phase
  21591. var m14 = (k1.andln(3) + d1) & 3;
  21592. var m24 = (k2.andln(3) + d2) & 3;
  21593. if (m14 === 3)
  21594. m14 = -1;
  21595. if (m24 === 3)
  21596. m24 = -1;
  21597. var u1;
  21598. if ((m14 & 1) === 0) {
  21599. u1 = 0;
  21600. } else {
  21601. var m8 = (k1.andln(7) + d1) & 7;
  21602. if ((m8 === 3 || m8 === 5) && m24 === 2)
  21603. u1 = -m14;
  21604. else
  21605. u1 = m14;
  21606. }
  21607. jsf[0].push(u1);
  21608. var u2;
  21609. if ((m24 & 1) === 0) {
  21610. u2 = 0;
  21611. } else {
  21612. var m8 = (k2.andln(7) + d2) & 7;
  21613. if ((m8 === 3 || m8 === 5) && m14 === 2)
  21614. u2 = -m24;
  21615. else
  21616. u2 = m24;
  21617. }
  21618. jsf[1].push(u2);
  21619. // Second phase
  21620. if (2 * d1 === u1 + 1)
  21621. d1 = 1 - d1;
  21622. if (2 * d2 === u2 + 1)
  21623. d2 = 1 - d2;
  21624. k1.iushrn(1);
  21625. k2.iushrn(1);
  21626. }
  21627. return jsf;
  21628. }
  21629. utils.getJSF = getJSF;
  21630. function cachedProperty(obj, name, computer) {
  21631. var key = '_' + name;
  21632. obj.prototype[name] = function cachedProperty() {
  21633. return this[key] !== undefined ? this[key] :
  21634. this[key] = computer.call(this);
  21635. };
  21636. }
  21637. utils.cachedProperty = cachedProperty;
  21638. function parseBytes(bytes) {
  21639. return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
  21640. bytes;
  21641. }
  21642. utils.parseBytes = parseBytes;
  21643. function intFromLE(bytes) {
  21644. return new BN(bytes, 'hex', 'le');
  21645. }
  21646. utils.intFromLE = intFromLE;
  21647. /***/ }),
  21648. /* 183 */
  21649. /*!*************************************************************!*\
  21650. !*** ./node_modules/minimalistic-crypto-utils/lib/utils.js ***!
  21651. \*************************************************************/
  21652. /*! no static exports found */
  21653. /***/ (function(module, exports, __webpack_require__) {
  21654. "use strict";
  21655. var utils = exports;
  21656. function toArray(msg, enc) {
  21657. if (Array.isArray(msg))
  21658. return msg.slice();
  21659. if (!msg)
  21660. return [];
  21661. var res = [];
  21662. if (typeof msg !== 'string') {
  21663. for (var i = 0; i < msg.length; i++)
  21664. res[i] = msg[i] | 0;
  21665. return res;
  21666. }
  21667. if (enc === 'hex') {
  21668. msg = msg.replace(/[^a-z0-9]+/ig, '');
  21669. if (msg.length % 2 !== 0)
  21670. msg = '0' + msg;
  21671. for (var i = 0; i < msg.length; i += 2)
  21672. res.push(parseInt(msg[i] + msg[i + 1], 16));
  21673. } else {
  21674. for (var i = 0; i < msg.length; i++) {
  21675. var c = msg.charCodeAt(i);
  21676. var hi = c >> 8;
  21677. var lo = c & 0xff;
  21678. if (hi)
  21679. res.push(hi, lo);
  21680. else
  21681. res.push(lo);
  21682. }
  21683. }
  21684. return res;
  21685. }
  21686. utils.toArray = toArray;
  21687. function zero2(word) {
  21688. if (word.length === 1)
  21689. return '0' + word;
  21690. else
  21691. return word;
  21692. }
  21693. utils.zero2 = zero2;
  21694. function toHex(msg) {
  21695. var res = '';
  21696. for (var i = 0; i < msg.length; i++)
  21697. res += zero2(msg[i].toString(16));
  21698. return res;
  21699. }
  21700. utils.toHex = toHex;
  21701. utils.encode = function encode(arr, enc) {
  21702. if (enc === 'hex')
  21703. return toHex(arr);
  21704. else
  21705. return arr;
  21706. };
  21707. /***/ }),
  21708. /* 184 */
  21709. /*!***********************************************************!*\
  21710. !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***!
  21711. \***********************************************************/
  21712. /*! no static exports found */
  21713. /***/ (function(module, exports, __webpack_require__) {
  21714. "use strict";
  21715. var curve = exports;
  21716. curve.base = __webpack_require__(/*! ./base */ 185);
  21717. curve.short = __webpack_require__(/*! ./short */ 186);
  21718. curve.mont = __webpack_require__(/*! ./mont */ 187);
  21719. curve.edwards = __webpack_require__(/*! ./edwards */ 188);
  21720. /***/ }),
  21721. /* 185 */
  21722. /*!**********************************************************!*\
  21723. !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***!
  21724. \**********************************************************/
  21725. /*! no static exports found */
  21726. /***/ (function(module, exports, __webpack_require__) {
  21727. "use strict";
  21728. var BN = __webpack_require__(/*! bn.js */ 169);
  21729. var utils = __webpack_require__(/*! ../utils */ 182);
  21730. var getNAF = utils.getNAF;
  21731. var getJSF = utils.getJSF;
  21732. var assert = utils.assert;
  21733. function BaseCurve(type, conf) {
  21734. this.type = type;
  21735. this.p = new BN(conf.p, 16);
  21736. // Use Montgomery, when there is no fast reduction for the prime
  21737. this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
  21738. // Useful for many curves
  21739. this.zero = new BN(0).toRed(this.red);
  21740. this.one = new BN(1).toRed(this.red);
  21741. this.two = new BN(2).toRed(this.red);
  21742. // Curve configuration, optional
  21743. this.n = conf.n && new BN(conf.n, 16);
  21744. this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
  21745. // Temporary arrays
  21746. this._wnafT1 = new Array(4);
  21747. this._wnafT2 = new Array(4);
  21748. this._wnafT3 = new Array(4);
  21749. this._wnafT4 = new Array(4);
  21750. this._bitLength = this.n ? this.n.bitLength() : 0;
  21751. // Generalized Greg Maxwell's trick
  21752. var adjustCount = this.n && this.p.div(this.n);
  21753. if (!adjustCount || adjustCount.cmpn(100) > 0) {
  21754. this.redN = null;
  21755. } else {
  21756. this._maxwellTrick = true;
  21757. this.redN = this.n.toRed(this.red);
  21758. }
  21759. }
  21760. module.exports = BaseCurve;
  21761. BaseCurve.prototype.point = function point() {
  21762. throw new Error('Not implemented');
  21763. };
  21764. BaseCurve.prototype.validate = function validate() {
  21765. throw new Error('Not implemented');
  21766. };
  21767. BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
  21768. assert(p.precomputed);
  21769. var doubles = p._getDoubles();
  21770. var naf = getNAF(k, 1, this._bitLength);
  21771. var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
  21772. I /= 3;
  21773. // Translate into more windowed form
  21774. var repr = [];
  21775. for (var j = 0; j < naf.length; j += doubles.step) {
  21776. var nafW = 0;
  21777. for (var k = j + doubles.step - 1; k >= j; k--)
  21778. nafW = (nafW << 1) + naf[k];
  21779. repr.push(nafW);
  21780. }
  21781. var a = this.jpoint(null, null, null);
  21782. var b = this.jpoint(null, null, null);
  21783. for (var i = I; i > 0; i--) {
  21784. for (var j = 0; j < repr.length; j++) {
  21785. var nafW = repr[j];
  21786. if (nafW === i)
  21787. b = b.mixedAdd(doubles.points[j]);
  21788. else if (nafW === -i)
  21789. b = b.mixedAdd(doubles.points[j].neg());
  21790. }
  21791. a = a.add(b);
  21792. }
  21793. return a.toP();
  21794. };
  21795. BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
  21796. var w = 4;
  21797. // Precompute window
  21798. var nafPoints = p._getNAFPoints(w);
  21799. w = nafPoints.wnd;
  21800. var wnd = nafPoints.points;
  21801. // Get NAF form
  21802. var naf = getNAF(k, w, this._bitLength);
  21803. // Add `this`*(N+1) for every w-NAF index
  21804. var acc = this.jpoint(null, null, null);
  21805. for (var i = naf.length - 1; i >= 0; i--) {
  21806. // Count zeroes
  21807. for (var k = 0; i >= 0 && naf[i] === 0; i--)
  21808. k++;
  21809. if (i >= 0)
  21810. k++;
  21811. acc = acc.dblp(k);
  21812. if (i < 0)
  21813. break;
  21814. var z = naf[i];
  21815. assert(z !== 0);
  21816. if (p.type === 'affine') {
  21817. // J +- P
  21818. if (z > 0)
  21819. acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
  21820. else
  21821. acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
  21822. } else {
  21823. // J +- J
  21824. if (z > 0)
  21825. acc = acc.add(wnd[(z - 1) >> 1]);
  21826. else
  21827. acc = acc.add(wnd[(-z - 1) >> 1].neg());
  21828. }
  21829. }
  21830. return p.type === 'affine' ? acc.toP() : acc;
  21831. };
  21832. BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
  21833. points,
  21834. coeffs,
  21835. len,
  21836. jacobianResult) {
  21837. var wndWidth = this._wnafT1;
  21838. var wnd = this._wnafT2;
  21839. var naf = this._wnafT3;
  21840. // Fill all arrays
  21841. var max = 0;
  21842. for (var i = 0; i < len; i++) {
  21843. var p = points[i];
  21844. var nafPoints = p._getNAFPoints(defW);
  21845. wndWidth[i] = nafPoints.wnd;
  21846. wnd[i] = nafPoints.points;
  21847. }
  21848. // Comb small window NAFs
  21849. for (var i = len - 1; i >= 1; i -= 2) {
  21850. var a = i - 1;
  21851. var b = i;
  21852. if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
  21853. naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
  21854. naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
  21855. max = Math.max(naf[a].length, max);
  21856. max = Math.max(naf[b].length, max);
  21857. continue;
  21858. }
  21859. var comb = [
  21860. points[a], /* 1 */
  21861. null, /* 3 */
  21862. null, /* 5 */
  21863. points[b] /* 7 */
  21864. ];
  21865. // Try to avoid Projective points, if possible
  21866. if (points[a].y.cmp(points[b].y) === 0) {
  21867. comb[1] = points[a].add(points[b]);
  21868. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  21869. } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
  21870. comb[1] = points[a].toJ().mixedAdd(points[b]);
  21871. comb[2] = points[a].add(points[b].neg());
  21872. } else {
  21873. comb[1] = points[a].toJ().mixedAdd(points[b]);
  21874. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  21875. }
  21876. var index = [
  21877. -3, /* -1 -1 */
  21878. -1, /* -1 0 */
  21879. -5, /* -1 1 */
  21880. -7, /* 0 -1 */
  21881. 0, /* 0 0 */
  21882. 7, /* 0 1 */
  21883. 5, /* 1 -1 */
  21884. 1, /* 1 0 */
  21885. 3 /* 1 1 */
  21886. ];
  21887. var jsf = getJSF(coeffs[a], coeffs[b]);
  21888. max = Math.max(jsf[0].length, max);
  21889. naf[a] = new Array(max);
  21890. naf[b] = new Array(max);
  21891. for (var j = 0; j < max; j++) {
  21892. var ja = jsf[0][j] | 0;
  21893. var jb = jsf[1][j] | 0;
  21894. naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
  21895. naf[b][j] = 0;
  21896. wnd[a] = comb;
  21897. }
  21898. }
  21899. var acc = this.jpoint(null, null, null);
  21900. var tmp = this._wnafT4;
  21901. for (var i = max; i >= 0; i--) {
  21902. var k = 0;
  21903. while (i >= 0) {
  21904. var zero = true;
  21905. for (var j = 0; j < len; j++) {
  21906. tmp[j] = naf[j][i] | 0;
  21907. if (tmp[j] !== 0)
  21908. zero = false;
  21909. }
  21910. if (!zero)
  21911. break;
  21912. k++;
  21913. i--;
  21914. }
  21915. if (i >= 0)
  21916. k++;
  21917. acc = acc.dblp(k);
  21918. if (i < 0)
  21919. break;
  21920. for (var j = 0; j < len; j++) {
  21921. var z = tmp[j];
  21922. var p;
  21923. if (z === 0)
  21924. continue;
  21925. else if (z > 0)
  21926. p = wnd[j][(z - 1) >> 1];
  21927. else if (z < 0)
  21928. p = wnd[j][(-z - 1) >> 1].neg();
  21929. if (p.type === 'affine')
  21930. acc = acc.mixedAdd(p);
  21931. else
  21932. acc = acc.add(p);
  21933. }
  21934. }
  21935. // Zeroify references
  21936. for (var i = 0; i < len; i++)
  21937. wnd[i] = null;
  21938. if (jacobianResult)
  21939. return acc;
  21940. else
  21941. return acc.toP();
  21942. };
  21943. function BasePoint(curve, type) {
  21944. this.curve = curve;
  21945. this.type = type;
  21946. this.precomputed = null;
  21947. }
  21948. BaseCurve.BasePoint = BasePoint;
  21949. BasePoint.prototype.eq = function eq(/*other*/) {
  21950. throw new Error('Not implemented');
  21951. };
  21952. BasePoint.prototype.validate = function validate() {
  21953. return this.curve.validate(this);
  21954. };
  21955. BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  21956. bytes = utils.toArray(bytes, enc);
  21957. var len = this.p.byteLength();
  21958. // uncompressed, hybrid-odd, hybrid-even
  21959. if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
  21960. bytes.length - 1 === 2 * len) {
  21961. if (bytes[0] === 0x06)
  21962. assert(bytes[bytes.length - 1] % 2 === 0);
  21963. else if (bytes[0] === 0x07)
  21964. assert(bytes[bytes.length - 1] % 2 === 1);
  21965. var res = this.point(bytes.slice(1, 1 + len),
  21966. bytes.slice(1 + len, 1 + 2 * len));
  21967. return res;
  21968. } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
  21969. bytes.length - 1 === len) {
  21970. return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
  21971. }
  21972. throw new Error('Unknown point format');
  21973. };
  21974. BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
  21975. return this.encode(enc, true);
  21976. };
  21977. BasePoint.prototype._encode = function _encode(compact) {
  21978. var len = this.curve.p.byteLength();
  21979. var x = this.getX().toArray('be', len);
  21980. if (compact)
  21981. return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
  21982. return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
  21983. };
  21984. BasePoint.prototype.encode = function encode(enc, compact) {
  21985. return utils.encode(this._encode(compact), enc);
  21986. };
  21987. BasePoint.prototype.precompute = function precompute(power) {
  21988. if (this.precomputed)
  21989. return this;
  21990. var precomputed = {
  21991. doubles: null,
  21992. naf: null,
  21993. beta: null
  21994. };
  21995. precomputed.naf = this._getNAFPoints(8);
  21996. precomputed.doubles = this._getDoubles(4, power);
  21997. precomputed.beta = this._getBeta();
  21998. this.precomputed = precomputed;
  21999. return this;
  22000. };
  22001. BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
  22002. if (!this.precomputed)
  22003. return false;
  22004. var doubles = this.precomputed.doubles;
  22005. if (!doubles)
  22006. return false;
  22007. return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
  22008. };
  22009. BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
  22010. if (this.precomputed && this.precomputed.doubles)
  22011. return this.precomputed.doubles;
  22012. var doubles = [ this ];
  22013. var acc = this;
  22014. for (var i = 0; i < power; i += step) {
  22015. for (var j = 0; j < step; j++)
  22016. acc = acc.dbl();
  22017. doubles.push(acc);
  22018. }
  22019. return {
  22020. step: step,
  22021. points: doubles
  22022. };
  22023. };
  22024. BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
  22025. if (this.precomputed && this.precomputed.naf)
  22026. return this.precomputed.naf;
  22027. var res = [ this ];
  22028. var max = (1 << wnd) - 1;
  22029. var dbl = max === 1 ? null : this.dbl();
  22030. for (var i = 1; i < max; i++)
  22031. res[i] = res[i - 1].add(dbl);
  22032. return {
  22033. wnd: wnd,
  22034. points: res
  22035. };
  22036. };
  22037. BasePoint.prototype._getBeta = function _getBeta() {
  22038. return null;
  22039. };
  22040. BasePoint.prototype.dblp = function dblp(k) {
  22041. var r = this;
  22042. for (var i = 0; i < k; i++)
  22043. r = r.dbl();
  22044. return r;
  22045. };
  22046. /***/ }),
  22047. /* 186 */
  22048. /*!***********************************************************!*\
  22049. !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***!
  22050. \***********************************************************/
  22051. /*! no static exports found */
  22052. /***/ (function(module, exports, __webpack_require__) {
  22053. "use strict";
  22054. var utils = __webpack_require__(/*! ../utils */ 182);
  22055. var BN = __webpack_require__(/*! bn.js */ 169);
  22056. var inherits = __webpack_require__(/*! inherits */ 93);
  22057. var Base = __webpack_require__(/*! ./base */ 185);
  22058. var assert = utils.assert;
  22059. function ShortCurve(conf) {
  22060. Base.call(this, 'short', conf);
  22061. this.a = new BN(conf.a, 16).toRed(this.red);
  22062. this.b = new BN(conf.b, 16).toRed(this.red);
  22063. this.tinv = this.two.redInvm();
  22064. this.zeroA = this.a.fromRed().cmpn(0) === 0;
  22065. this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
  22066. // If the curve is endomorphic, precalculate beta and lambda
  22067. this.endo = this._getEndomorphism(conf);
  22068. this._endoWnafT1 = new Array(4);
  22069. this._endoWnafT2 = new Array(4);
  22070. }
  22071. inherits(ShortCurve, Base);
  22072. module.exports = ShortCurve;
  22073. ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
  22074. // No efficient endomorphism
  22075. if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
  22076. return;
  22077. // Compute beta and lambda, that lambda * P = (beta * Px; Py)
  22078. var beta;
  22079. var lambda;
  22080. if (conf.beta) {
  22081. beta = new BN(conf.beta, 16).toRed(this.red);
  22082. } else {
  22083. var betas = this._getEndoRoots(this.p);
  22084. // Choose the smallest beta
  22085. beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
  22086. beta = beta.toRed(this.red);
  22087. }
  22088. if (conf.lambda) {
  22089. lambda = new BN(conf.lambda, 16);
  22090. } else {
  22091. // Choose the lambda that is matching selected beta
  22092. var lambdas = this._getEndoRoots(this.n);
  22093. if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
  22094. lambda = lambdas[0];
  22095. } else {
  22096. lambda = lambdas[1];
  22097. assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
  22098. }
  22099. }
  22100. // Get basis vectors, used for balanced length-two representation
  22101. var basis;
  22102. if (conf.basis) {
  22103. basis = conf.basis.map(function(vec) {
  22104. return {
  22105. a: new BN(vec.a, 16),
  22106. b: new BN(vec.b, 16)
  22107. };
  22108. });
  22109. } else {
  22110. basis = this._getEndoBasis(lambda);
  22111. }
  22112. return {
  22113. beta: beta,
  22114. lambda: lambda,
  22115. basis: basis
  22116. };
  22117. };
  22118. ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
  22119. // Find roots of for x^2 + x + 1 in F
  22120. // Root = (-1 +- Sqrt(-3)) / 2
  22121. //
  22122. var red = num === this.p ? this.red : BN.mont(num);
  22123. var tinv = new BN(2).toRed(red).redInvm();
  22124. var ntinv = tinv.redNeg();
  22125. var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
  22126. var l1 = ntinv.redAdd(s).fromRed();
  22127. var l2 = ntinv.redSub(s).fromRed();
  22128. return [ l1, l2 ];
  22129. };
  22130. ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
  22131. // aprxSqrt >= sqrt(this.n)
  22132. var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
  22133. // 3.74
  22134. // Run EGCD, until r(L + 1) < aprxSqrt
  22135. var u = lambda;
  22136. var v = this.n.clone();
  22137. var x1 = new BN(1);
  22138. var y1 = new BN(0);
  22139. var x2 = new BN(0);
  22140. var y2 = new BN(1);
  22141. // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
  22142. var a0;
  22143. var b0;
  22144. // First vector
  22145. var a1;
  22146. var b1;
  22147. // Second vector
  22148. var a2;
  22149. var b2;
  22150. var prevR;
  22151. var i = 0;
  22152. var r;
  22153. var x;
  22154. while (u.cmpn(0) !== 0) {
  22155. var q = v.div(u);
  22156. r = v.sub(q.mul(u));
  22157. x = x2.sub(q.mul(x1));
  22158. var y = y2.sub(q.mul(y1));
  22159. if (!a1 && r.cmp(aprxSqrt) < 0) {
  22160. a0 = prevR.neg();
  22161. b0 = x1;
  22162. a1 = r.neg();
  22163. b1 = x;
  22164. } else if (a1 && ++i === 2) {
  22165. break;
  22166. }
  22167. prevR = r;
  22168. v = u;
  22169. u = r;
  22170. x2 = x1;
  22171. x1 = x;
  22172. y2 = y1;
  22173. y1 = y;
  22174. }
  22175. a2 = r.neg();
  22176. b2 = x;
  22177. var len1 = a1.sqr().add(b1.sqr());
  22178. var len2 = a2.sqr().add(b2.sqr());
  22179. if (len2.cmp(len1) >= 0) {
  22180. a2 = a0;
  22181. b2 = b0;
  22182. }
  22183. // Normalize signs
  22184. if (a1.negative) {
  22185. a1 = a1.neg();
  22186. b1 = b1.neg();
  22187. }
  22188. if (a2.negative) {
  22189. a2 = a2.neg();
  22190. b2 = b2.neg();
  22191. }
  22192. return [
  22193. { a: a1, b: b1 },
  22194. { a: a2, b: b2 }
  22195. ];
  22196. };
  22197. ShortCurve.prototype._endoSplit = function _endoSplit(k) {
  22198. var basis = this.endo.basis;
  22199. var v1 = basis[0];
  22200. var v2 = basis[1];
  22201. var c1 = v2.b.mul(k).divRound(this.n);
  22202. var c2 = v1.b.neg().mul(k).divRound(this.n);
  22203. var p1 = c1.mul(v1.a);
  22204. var p2 = c2.mul(v2.a);
  22205. var q1 = c1.mul(v1.b);
  22206. var q2 = c2.mul(v2.b);
  22207. // Calculate answer
  22208. var k1 = k.sub(p1).sub(p2);
  22209. var k2 = q1.add(q2).neg();
  22210. return { k1: k1, k2: k2 };
  22211. };
  22212. ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
  22213. x = new BN(x, 16);
  22214. if (!x.red)
  22215. x = x.toRed(this.red);
  22216. var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
  22217. var y = y2.redSqrt();
  22218. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  22219. throw new Error('invalid point');
  22220. // XXX Is there any way to tell if the number is odd without converting it
  22221. // to non-red form?
  22222. var isOdd = y.fromRed().isOdd();
  22223. if (odd && !isOdd || !odd && isOdd)
  22224. y = y.redNeg();
  22225. return this.point(x, y);
  22226. };
  22227. ShortCurve.prototype.validate = function validate(point) {
  22228. if (point.inf)
  22229. return true;
  22230. var x = point.x;
  22231. var y = point.y;
  22232. var ax = this.a.redMul(x);
  22233. var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
  22234. return y.redSqr().redISub(rhs).cmpn(0) === 0;
  22235. };
  22236. ShortCurve.prototype._endoWnafMulAdd =
  22237. function _endoWnafMulAdd(points, coeffs, jacobianResult) {
  22238. var npoints = this._endoWnafT1;
  22239. var ncoeffs = this._endoWnafT2;
  22240. for (var i = 0; i < points.length; i++) {
  22241. var split = this._endoSplit(coeffs[i]);
  22242. var p = points[i];
  22243. var beta = p._getBeta();
  22244. if (split.k1.negative) {
  22245. split.k1.ineg();
  22246. p = p.neg(true);
  22247. }
  22248. if (split.k2.negative) {
  22249. split.k2.ineg();
  22250. beta = beta.neg(true);
  22251. }
  22252. npoints[i * 2] = p;
  22253. npoints[i * 2 + 1] = beta;
  22254. ncoeffs[i * 2] = split.k1;
  22255. ncoeffs[i * 2 + 1] = split.k2;
  22256. }
  22257. var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
  22258. // Clean-up references to points and coefficients
  22259. for (var j = 0; j < i * 2; j++) {
  22260. npoints[j] = null;
  22261. ncoeffs[j] = null;
  22262. }
  22263. return res;
  22264. };
  22265. function Point(curve, x, y, isRed) {
  22266. Base.BasePoint.call(this, curve, 'affine');
  22267. if (x === null && y === null) {
  22268. this.x = null;
  22269. this.y = null;
  22270. this.inf = true;
  22271. } else {
  22272. this.x = new BN(x, 16);
  22273. this.y = new BN(y, 16);
  22274. // Force redgomery representation when loading from JSON
  22275. if (isRed) {
  22276. this.x.forceRed(this.curve.red);
  22277. this.y.forceRed(this.curve.red);
  22278. }
  22279. if (!this.x.red)
  22280. this.x = this.x.toRed(this.curve.red);
  22281. if (!this.y.red)
  22282. this.y = this.y.toRed(this.curve.red);
  22283. this.inf = false;
  22284. }
  22285. }
  22286. inherits(Point, Base.BasePoint);
  22287. ShortCurve.prototype.point = function point(x, y, isRed) {
  22288. return new Point(this, x, y, isRed);
  22289. };
  22290. ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
  22291. return Point.fromJSON(this, obj, red);
  22292. };
  22293. Point.prototype._getBeta = function _getBeta() {
  22294. if (!this.curve.endo)
  22295. return;
  22296. var pre = this.precomputed;
  22297. if (pre && pre.beta)
  22298. return pre.beta;
  22299. var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
  22300. if (pre) {
  22301. var curve = this.curve;
  22302. var endoMul = function(p) {
  22303. return curve.point(p.x.redMul(curve.endo.beta), p.y);
  22304. };
  22305. pre.beta = beta;
  22306. beta.precomputed = {
  22307. beta: null,
  22308. naf: pre.naf && {
  22309. wnd: pre.naf.wnd,
  22310. points: pre.naf.points.map(endoMul)
  22311. },
  22312. doubles: pre.doubles && {
  22313. step: pre.doubles.step,
  22314. points: pre.doubles.points.map(endoMul)
  22315. }
  22316. };
  22317. }
  22318. return beta;
  22319. };
  22320. Point.prototype.toJSON = function toJSON() {
  22321. if (!this.precomputed)
  22322. return [ this.x, this.y ];
  22323. return [ this.x, this.y, this.precomputed && {
  22324. doubles: this.precomputed.doubles && {
  22325. step: this.precomputed.doubles.step,
  22326. points: this.precomputed.doubles.points.slice(1)
  22327. },
  22328. naf: this.precomputed.naf && {
  22329. wnd: this.precomputed.naf.wnd,
  22330. points: this.precomputed.naf.points.slice(1)
  22331. }
  22332. } ];
  22333. };
  22334. Point.fromJSON = function fromJSON(curve, obj, red) {
  22335. if (typeof obj === 'string')
  22336. obj = JSON.parse(obj);
  22337. var res = curve.point(obj[0], obj[1], red);
  22338. if (!obj[2])
  22339. return res;
  22340. function obj2point(obj) {
  22341. return curve.point(obj[0], obj[1], red);
  22342. }
  22343. var pre = obj[2];
  22344. res.precomputed = {
  22345. beta: null,
  22346. doubles: pre.doubles && {
  22347. step: pre.doubles.step,
  22348. points: [ res ].concat(pre.doubles.points.map(obj2point))
  22349. },
  22350. naf: pre.naf && {
  22351. wnd: pre.naf.wnd,
  22352. points: [ res ].concat(pre.naf.points.map(obj2point))
  22353. }
  22354. };
  22355. return res;
  22356. };
  22357. Point.prototype.inspect = function inspect() {
  22358. if (this.isInfinity())
  22359. return '<EC Point Infinity>';
  22360. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  22361. ' y: ' + this.y.fromRed().toString(16, 2) + '>';
  22362. };
  22363. Point.prototype.isInfinity = function isInfinity() {
  22364. return this.inf;
  22365. };
  22366. Point.prototype.add = function add(p) {
  22367. // O + P = P
  22368. if (this.inf)
  22369. return p;
  22370. // P + O = P
  22371. if (p.inf)
  22372. return this;
  22373. // P + P = 2P
  22374. if (this.eq(p))
  22375. return this.dbl();
  22376. // P + (-P) = O
  22377. if (this.neg().eq(p))
  22378. return this.curve.point(null, null);
  22379. // P + Q = O
  22380. if (this.x.cmp(p.x) === 0)
  22381. return this.curve.point(null, null);
  22382. var c = this.y.redSub(p.y);
  22383. if (c.cmpn(0) !== 0)
  22384. c = c.redMul(this.x.redSub(p.x).redInvm());
  22385. var nx = c.redSqr().redISub(this.x).redISub(p.x);
  22386. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  22387. return this.curve.point(nx, ny);
  22388. };
  22389. Point.prototype.dbl = function dbl() {
  22390. if (this.inf)
  22391. return this;
  22392. // 2P = O
  22393. var ys1 = this.y.redAdd(this.y);
  22394. if (ys1.cmpn(0) === 0)
  22395. return this.curve.point(null, null);
  22396. var a = this.curve.a;
  22397. var x2 = this.x.redSqr();
  22398. var dyinv = ys1.redInvm();
  22399. var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
  22400. var nx = c.redSqr().redISub(this.x.redAdd(this.x));
  22401. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  22402. return this.curve.point(nx, ny);
  22403. };
  22404. Point.prototype.getX = function getX() {
  22405. return this.x.fromRed();
  22406. };
  22407. Point.prototype.getY = function getY() {
  22408. return this.y.fromRed();
  22409. };
  22410. Point.prototype.mul = function mul(k) {
  22411. k = new BN(k, 16);
  22412. if (this.isInfinity())
  22413. return this;
  22414. else if (this._hasDoubles(k))
  22415. return this.curve._fixedNafMul(this, k);
  22416. else if (this.curve.endo)
  22417. return this.curve._endoWnafMulAdd([ this ], [ k ]);
  22418. else
  22419. return this.curve._wnafMul(this, k);
  22420. };
  22421. Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
  22422. var points = [ this, p2 ];
  22423. var coeffs = [ k1, k2 ];
  22424. if (this.curve.endo)
  22425. return this.curve._endoWnafMulAdd(points, coeffs);
  22426. else
  22427. return this.curve._wnafMulAdd(1, points, coeffs, 2);
  22428. };
  22429. Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
  22430. var points = [ this, p2 ];
  22431. var coeffs = [ k1, k2 ];
  22432. if (this.curve.endo)
  22433. return this.curve._endoWnafMulAdd(points, coeffs, true);
  22434. else
  22435. return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
  22436. };
  22437. Point.prototype.eq = function eq(p) {
  22438. return this === p ||
  22439. this.inf === p.inf &&
  22440. (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
  22441. };
  22442. Point.prototype.neg = function neg(_precompute) {
  22443. if (this.inf)
  22444. return this;
  22445. var res = this.curve.point(this.x, this.y.redNeg());
  22446. if (_precompute && this.precomputed) {
  22447. var pre = this.precomputed;
  22448. var negate = function(p) {
  22449. return p.neg();
  22450. };
  22451. res.precomputed = {
  22452. naf: pre.naf && {
  22453. wnd: pre.naf.wnd,
  22454. points: pre.naf.points.map(negate)
  22455. },
  22456. doubles: pre.doubles && {
  22457. step: pre.doubles.step,
  22458. points: pre.doubles.points.map(negate)
  22459. }
  22460. };
  22461. }
  22462. return res;
  22463. };
  22464. Point.prototype.toJ = function toJ() {
  22465. if (this.inf)
  22466. return this.curve.jpoint(null, null, null);
  22467. var res = this.curve.jpoint(this.x, this.y, this.curve.one);
  22468. return res;
  22469. };
  22470. function JPoint(curve, x, y, z) {
  22471. Base.BasePoint.call(this, curve, 'jacobian');
  22472. if (x === null && y === null && z === null) {
  22473. this.x = this.curve.one;
  22474. this.y = this.curve.one;
  22475. this.z = new BN(0);
  22476. } else {
  22477. this.x = new BN(x, 16);
  22478. this.y = new BN(y, 16);
  22479. this.z = new BN(z, 16);
  22480. }
  22481. if (!this.x.red)
  22482. this.x = this.x.toRed(this.curve.red);
  22483. if (!this.y.red)
  22484. this.y = this.y.toRed(this.curve.red);
  22485. if (!this.z.red)
  22486. this.z = this.z.toRed(this.curve.red);
  22487. this.zOne = this.z === this.curve.one;
  22488. }
  22489. inherits(JPoint, Base.BasePoint);
  22490. ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
  22491. return new JPoint(this, x, y, z);
  22492. };
  22493. JPoint.prototype.toP = function toP() {
  22494. if (this.isInfinity())
  22495. return this.curve.point(null, null);
  22496. var zinv = this.z.redInvm();
  22497. var zinv2 = zinv.redSqr();
  22498. var ax = this.x.redMul(zinv2);
  22499. var ay = this.y.redMul(zinv2).redMul(zinv);
  22500. return this.curve.point(ax, ay);
  22501. };
  22502. JPoint.prototype.neg = function neg() {
  22503. return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
  22504. };
  22505. JPoint.prototype.add = function add(p) {
  22506. // O + P = P
  22507. if (this.isInfinity())
  22508. return p;
  22509. // P + O = P
  22510. if (p.isInfinity())
  22511. return this;
  22512. // 12M + 4S + 7A
  22513. var pz2 = p.z.redSqr();
  22514. var z2 = this.z.redSqr();
  22515. var u1 = this.x.redMul(pz2);
  22516. var u2 = p.x.redMul(z2);
  22517. var s1 = this.y.redMul(pz2.redMul(p.z));
  22518. var s2 = p.y.redMul(z2.redMul(this.z));
  22519. var h = u1.redSub(u2);
  22520. var r = s1.redSub(s2);
  22521. if (h.cmpn(0) === 0) {
  22522. if (r.cmpn(0) !== 0)
  22523. return this.curve.jpoint(null, null, null);
  22524. else
  22525. return this.dbl();
  22526. }
  22527. var h2 = h.redSqr();
  22528. var h3 = h2.redMul(h);
  22529. var v = u1.redMul(h2);
  22530. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  22531. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  22532. var nz = this.z.redMul(p.z).redMul(h);
  22533. return this.curve.jpoint(nx, ny, nz);
  22534. };
  22535. JPoint.prototype.mixedAdd = function mixedAdd(p) {
  22536. // O + P = P
  22537. if (this.isInfinity())
  22538. return p.toJ();
  22539. // P + O = P
  22540. if (p.isInfinity())
  22541. return this;
  22542. // 8M + 3S + 7A
  22543. var z2 = this.z.redSqr();
  22544. var u1 = this.x;
  22545. var u2 = p.x.redMul(z2);
  22546. var s1 = this.y;
  22547. var s2 = p.y.redMul(z2).redMul(this.z);
  22548. var h = u1.redSub(u2);
  22549. var r = s1.redSub(s2);
  22550. if (h.cmpn(0) === 0) {
  22551. if (r.cmpn(0) !== 0)
  22552. return this.curve.jpoint(null, null, null);
  22553. else
  22554. return this.dbl();
  22555. }
  22556. var h2 = h.redSqr();
  22557. var h3 = h2.redMul(h);
  22558. var v = u1.redMul(h2);
  22559. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  22560. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  22561. var nz = this.z.redMul(h);
  22562. return this.curve.jpoint(nx, ny, nz);
  22563. };
  22564. JPoint.prototype.dblp = function dblp(pow) {
  22565. if (pow === 0)
  22566. return this;
  22567. if (this.isInfinity())
  22568. return this;
  22569. if (!pow)
  22570. return this.dbl();
  22571. if (this.curve.zeroA || this.curve.threeA) {
  22572. var r = this;
  22573. for (var i = 0; i < pow; i++)
  22574. r = r.dbl();
  22575. return r;
  22576. }
  22577. // 1M + 2S + 1A + N * (4S + 5M + 8A)
  22578. // N = 1 => 6M + 6S + 9A
  22579. var a = this.curve.a;
  22580. var tinv = this.curve.tinv;
  22581. var jx = this.x;
  22582. var jy = this.y;
  22583. var jz = this.z;
  22584. var jz4 = jz.redSqr().redSqr();
  22585. // Reuse results
  22586. var jyd = jy.redAdd(jy);
  22587. for (var i = 0; i < pow; i++) {
  22588. var jx2 = jx.redSqr();
  22589. var jyd2 = jyd.redSqr();
  22590. var jyd4 = jyd2.redSqr();
  22591. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  22592. var t1 = jx.redMul(jyd2);
  22593. var nx = c.redSqr().redISub(t1.redAdd(t1));
  22594. var t2 = t1.redISub(nx);
  22595. var dny = c.redMul(t2);
  22596. dny = dny.redIAdd(dny).redISub(jyd4);
  22597. var nz = jyd.redMul(jz);
  22598. if (i + 1 < pow)
  22599. jz4 = jz4.redMul(jyd4);
  22600. jx = nx;
  22601. jz = nz;
  22602. jyd = dny;
  22603. }
  22604. return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
  22605. };
  22606. JPoint.prototype.dbl = function dbl() {
  22607. if (this.isInfinity())
  22608. return this;
  22609. if (this.curve.zeroA)
  22610. return this._zeroDbl();
  22611. else if (this.curve.threeA)
  22612. return this._threeDbl();
  22613. else
  22614. return this._dbl();
  22615. };
  22616. JPoint.prototype._zeroDbl = function _zeroDbl() {
  22617. var nx;
  22618. var ny;
  22619. var nz;
  22620. // Z = 1
  22621. if (this.zOne) {
  22622. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  22623. // #doubling-mdbl-2007-bl
  22624. // 1M + 5S + 14A
  22625. // XX = X1^2
  22626. var xx = this.x.redSqr();
  22627. // YY = Y1^2
  22628. var yy = this.y.redSqr();
  22629. // YYYY = YY^2
  22630. var yyyy = yy.redSqr();
  22631. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  22632. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  22633. s = s.redIAdd(s);
  22634. // M = 3 * XX + a; a = 0
  22635. var m = xx.redAdd(xx).redIAdd(xx);
  22636. // T = M ^ 2 - 2*S
  22637. var t = m.redSqr().redISub(s).redISub(s);
  22638. // 8 * YYYY
  22639. var yyyy8 = yyyy.redIAdd(yyyy);
  22640. yyyy8 = yyyy8.redIAdd(yyyy8);
  22641. yyyy8 = yyyy8.redIAdd(yyyy8);
  22642. // X3 = T
  22643. nx = t;
  22644. // Y3 = M * (S - T) - 8 * YYYY
  22645. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  22646. // Z3 = 2*Y1
  22647. nz = this.y.redAdd(this.y);
  22648. } else {
  22649. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  22650. // #doubling-dbl-2009-l
  22651. // 2M + 5S + 13A
  22652. // A = X1^2
  22653. var a = this.x.redSqr();
  22654. // B = Y1^2
  22655. var b = this.y.redSqr();
  22656. // C = B^2
  22657. var c = b.redSqr();
  22658. // D = 2 * ((X1 + B)^2 - A - C)
  22659. var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
  22660. d = d.redIAdd(d);
  22661. // E = 3 * A
  22662. var e = a.redAdd(a).redIAdd(a);
  22663. // F = E^2
  22664. var f = e.redSqr();
  22665. // 8 * C
  22666. var c8 = c.redIAdd(c);
  22667. c8 = c8.redIAdd(c8);
  22668. c8 = c8.redIAdd(c8);
  22669. // X3 = F - 2 * D
  22670. nx = f.redISub(d).redISub(d);
  22671. // Y3 = E * (D - X3) - 8 * C
  22672. ny = e.redMul(d.redISub(nx)).redISub(c8);
  22673. // Z3 = 2 * Y1 * Z1
  22674. nz = this.y.redMul(this.z);
  22675. nz = nz.redIAdd(nz);
  22676. }
  22677. return this.curve.jpoint(nx, ny, nz);
  22678. };
  22679. JPoint.prototype._threeDbl = function _threeDbl() {
  22680. var nx;
  22681. var ny;
  22682. var nz;
  22683. // Z = 1
  22684. if (this.zOne) {
  22685. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
  22686. // #doubling-mdbl-2007-bl
  22687. // 1M + 5S + 15A
  22688. // XX = X1^2
  22689. var xx = this.x.redSqr();
  22690. // YY = Y1^2
  22691. var yy = this.y.redSqr();
  22692. // YYYY = YY^2
  22693. var yyyy = yy.redSqr();
  22694. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  22695. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  22696. s = s.redIAdd(s);
  22697. // M = 3 * XX + a
  22698. var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
  22699. // T = M^2 - 2 * S
  22700. var t = m.redSqr().redISub(s).redISub(s);
  22701. // X3 = T
  22702. nx = t;
  22703. // Y3 = M * (S - T) - 8 * YYYY
  22704. var yyyy8 = yyyy.redIAdd(yyyy);
  22705. yyyy8 = yyyy8.redIAdd(yyyy8);
  22706. yyyy8 = yyyy8.redIAdd(yyyy8);
  22707. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  22708. // Z3 = 2 * Y1
  22709. nz = this.y.redAdd(this.y);
  22710. } else {
  22711. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
  22712. // 3M + 5S
  22713. // delta = Z1^2
  22714. var delta = this.z.redSqr();
  22715. // gamma = Y1^2
  22716. var gamma = this.y.redSqr();
  22717. // beta = X1 * gamma
  22718. var beta = this.x.redMul(gamma);
  22719. // alpha = 3 * (X1 - delta) * (X1 + delta)
  22720. var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
  22721. alpha = alpha.redAdd(alpha).redIAdd(alpha);
  22722. // X3 = alpha^2 - 8 * beta
  22723. var beta4 = beta.redIAdd(beta);
  22724. beta4 = beta4.redIAdd(beta4);
  22725. var beta8 = beta4.redAdd(beta4);
  22726. nx = alpha.redSqr().redISub(beta8);
  22727. // Z3 = (Y1 + Z1)^2 - gamma - delta
  22728. nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
  22729. // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
  22730. var ggamma8 = gamma.redSqr();
  22731. ggamma8 = ggamma8.redIAdd(ggamma8);
  22732. ggamma8 = ggamma8.redIAdd(ggamma8);
  22733. ggamma8 = ggamma8.redIAdd(ggamma8);
  22734. ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
  22735. }
  22736. return this.curve.jpoint(nx, ny, nz);
  22737. };
  22738. JPoint.prototype._dbl = function _dbl() {
  22739. var a = this.curve.a;
  22740. // 4M + 6S + 10A
  22741. var jx = this.x;
  22742. var jy = this.y;
  22743. var jz = this.z;
  22744. var jz4 = jz.redSqr().redSqr();
  22745. var jx2 = jx.redSqr();
  22746. var jy2 = jy.redSqr();
  22747. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  22748. var jxd4 = jx.redAdd(jx);
  22749. jxd4 = jxd4.redIAdd(jxd4);
  22750. var t1 = jxd4.redMul(jy2);
  22751. var nx = c.redSqr().redISub(t1.redAdd(t1));
  22752. var t2 = t1.redISub(nx);
  22753. var jyd8 = jy2.redSqr();
  22754. jyd8 = jyd8.redIAdd(jyd8);
  22755. jyd8 = jyd8.redIAdd(jyd8);
  22756. jyd8 = jyd8.redIAdd(jyd8);
  22757. var ny = c.redMul(t2).redISub(jyd8);
  22758. var nz = jy.redAdd(jy).redMul(jz);
  22759. return this.curve.jpoint(nx, ny, nz);
  22760. };
  22761. JPoint.prototype.trpl = function trpl() {
  22762. if (!this.curve.zeroA)
  22763. return this.dbl().add(this);
  22764. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
  22765. // 5M + 10S + ...
  22766. // XX = X1^2
  22767. var xx = this.x.redSqr();
  22768. // YY = Y1^2
  22769. var yy = this.y.redSqr();
  22770. // ZZ = Z1^2
  22771. var zz = this.z.redSqr();
  22772. // YYYY = YY^2
  22773. var yyyy = yy.redSqr();
  22774. // M = 3 * XX + a * ZZ2; a = 0
  22775. var m = xx.redAdd(xx).redIAdd(xx);
  22776. // MM = M^2
  22777. var mm = m.redSqr();
  22778. // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
  22779. var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  22780. e = e.redIAdd(e);
  22781. e = e.redAdd(e).redIAdd(e);
  22782. e = e.redISub(mm);
  22783. // EE = E^2
  22784. var ee = e.redSqr();
  22785. // T = 16*YYYY
  22786. var t = yyyy.redIAdd(yyyy);
  22787. t = t.redIAdd(t);
  22788. t = t.redIAdd(t);
  22789. t = t.redIAdd(t);
  22790. // U = (M + E)^2 - MM - EE - T
  22791. var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
  22792. // X3 = 4 * (X1 * EE - 4 * YY * U)
  22793. var yyu4 = yy.redMul(u);
  22794. yyu4 = yyu4.redIAdd(yyu4);
  22795. yyu4 = yyu4.redIAdd(yyu4);
  22796. var nx = this.x.redMul(ee).redISub(yyu4);
  22797. nx = nx.redIAdd(nx);
  22798. nx = nx.redIAdd(nx);
  22799. // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
  22800. var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
  22801. ny = ny.redIAdd(ny);
  22802. ny = ny.redIAdd(ny);
  22803. ny = ny.redIAdd(ny);
  22804. // Z3 = (Z1 + E)^2 - ZZ - EE
  22805. var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
  22806. return this.curve.jpoint(nx, ny, nz);
  22807. };
  22808. JPoint.prototype.mul = function mul(k, kbase) {
  22809. k = new BN(k, kbase);
  22810. return this.curve._wnafMul(this, k);
  22811. };
  22812. JPoint.prototype.eq = function eq(p) {
  22813. if (p.type === 'affine')
  22814. return this.eq(p.toJ());
  22815. if (this === p)
  22816. return true;
  22817. // x1 * z2^2 == x2 * z1^2
  22818. var z2 = this.z.redSqr();
  22819. var pz2 = p.z.redSqr();
  22820. if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
  22821. return false;
  22822. // y1 * z2^3 == y2 * z1^3
  22823. var z3 = z2.redMul(this.z);
  22824. var pz3 = pz2.redMul(p.z);
  22825. return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
  22826. };
  22827. JPoint.prototype.eqXToP = function eqXToP(x) {
  22828. var zs = this.z.redSqr();
  22829. var rx = x.toRed(this.curve.red).redMul(zs);
  22830. if (this.x.cmp(rx) === 0)
  22831. return true;
  22832. var xc = x.clone();
  22833. var t = this.curve.redN.redMul(zs);
  22834. for (;;) {
  22835. xc.iadd(this.curve.n);
  22836. if (xc.cmp(this.curve.p) >= 0)
  22837. return false;
  22838. rx.redIAdd(t);
  22839. if (this.x.cmp(rx) === 0)
  22840. return true;
  22841. }
  22842. };
  22843. JPoint.prototype.inspect = function inspect() {
  22844. if (this.isInfinity())
  22845. return '<EC JPoint Infinity>';
  22846. return '<EC JPoint x: ' + this.x.toString(16, 2) +
  22847. ' y: ' + this.y.toString(16, 2) +
  22848. ' z: ' + this.z.toString(16, 2) + '>';
  22849. };
  22850. JPoint.prototype.isInfinity = function isInfinity() {
  22851. // XXX This code assumes that zero is always zero in red
  22852. return this.z.cmpn(0) === 0;
  22853. };
  22854. /***/ }),
  22855. /* 187 */
  22856. /*!**********************************************************!*\
  22857. !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***!
  22858. \**********************************************************/
  22859. /*! no static exports found */
  22860. /***/ (function(module, exports, __webpack_require__) {
  22861. "use strict";
  22862. var BN = __webpack_require__(/*! bn.js */ 169);
  22863. var inherits = __webpack_require__(/*! inherits */ 93);
  22864. var Base = __webpack_require__(/*! ./base */ 185);
  22865. var utils = __webpack_require__(/*! ../utils */ 182);
  22866. function MontCurve(conf) {
  22867. Base.call(this, 'mont', conf);
  22868. this.a = new BN(conf.a, 16).toRed(this.red);
  22869. this.b = new BN(conf.b, 16).toRed(this.red);
  22870. this.i4 = new BN(4).toRed(this.red).redInvm();
  22871. this.two = new BN(2).toRed(this.red);
  22872. this.a24 = this.i4.redMul(this.a.redAdd(this.two));
  22873. }
  22874. inherits(MontCurve, Base);
  22875. module.exports = MontCurve;
  22876. MontCurve.prototype.validate = function validate(point) {
  22877. var x = point.normalize().x;
  22878. var x2 = x.redSqr();
  22879. var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
  22880. var y = rhs.redSqrt();
  22881. return y.redSqr().cmp(rhs) === 0;
  22882. };
  22883. function Point(curve, x, z) {
  22884. Base.BasePoint.call(this, curve, 'projective');
  22885. if (x === null && z === null) {
  22886. this.x = this.curve.one;
  22887. this.z = this.curve.zero;
  22888. } else {
  22889. this.x = new BN(x, 16);
  22890. this.z = new BN(z, 16);
  22891. if (!this.x.red)
  22892. this.x = this.x.toRed(this.curve.red);
  22893. if (!this.z.red)
  22894. this.z = this.z.toRed(this.curve.red);
  22895. }
  22896. }
  22897. inherits(Point, Base.BasePoint);
  22898. MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  22899. return this.point(utils.toArray(bytes, enc), 1);
  22900. };
  22901. MontCurve.prototype.point = function point(x, z) {
  22902. return new Point(this, x, z);
  22903. };
  22904. MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  22905. return Point.fromJSON(this, obj);
  22906. };
  22907. Point.prototype.precompute = function precompute() {
  22908. // No-op
  22909. };
  22910. Point.prototype._encode = function _encode() {
  22911. return this.getX().toArray('be', this.curve.p.byteLength());
  22912. };
  22913. Point.fromJSON = function fromJSON(curve, obj) {
  22914. return new Point(curve, obj[0], obj[1] || curve.one);
  22915. };
  22916. Point.prototype.inspect = function inspect() {
  22917. if (this.isInfinity())
  22918. return '<EC Point Infinity>';
  22919. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  22920. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  22921. };
  22922. Point.prototype.isInfinity = function isInfinity() {
  22923. // XXX This code assumes that zero is always zero in red
  22924. return this.z.cmpn(0) === 0;
  22925. };
  22926. Point.prototype.dbl = function dbl() {
  22927. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
  22928. // 2M + 2S + 4A
  22929. // A = X1 + Z1
  22930. var a = this.x.redAdd(this.z);
  22931. // AA = A^2
  22932. var aa = a.redSqr();
  22933. // B = X1 - Z1
  22934. var b = this.x.redSub(this.z);
  22935. // BB = B^2
  22936. var bb = b.redSqr();
  22937. // C = AA - BB
  22938. var c = aa.redSub(bb);
  22939. // X3 = AA * BB
  22940. var nx = aa.redMul(bb);
  22941. // Z3 = C * (BB + A24 * C)
  22942. var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
  22943. return this.curve.point(nx, nz);
  22944. };
  22945. Point.prototype.add = function add() {
  22946. throw new Error('Not supported on Montgomery curve');
  22947. };
  22948. Point.prototype.diffAdd = function diffAdd(p, diff) {
  22949. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
  22950. // 4M + 2S + 6A
  22951. // A = X2 + Z2
  22952. var a = this.x.redAdd(this.z);
  22953. // B = X2 - Z2
  22954. var b = this.x.redSub(this.z);
  22955. // C = X3 + Z3
  22956. var c = p.x.redAdd(p.z);
  22957. // D = X3 - Z3
  22958. var d = p.x.redSub(p.z);
  22959. // DA = D * A
  22960. var da = d.redMul(a);
  22961. // CB = C * B
  22962. var cb = c.redMul(b);
  22963. // X5 = Z1 * (DA + CB)^2
  22964. var nx = diff.z.redMul(da.redAdd(cb).redSqr());
  22965. // Z5 = X1 * (DA - CB)^2
  22966. var nz = diff.x.redMul(da.redISub(cb).redSqr());
  22967. return this.curve.point(nx, nz);
  22968. };
  22969. Point.prototype.mul = function mul(k) {
  22970. var t = k.clone();
  22971. var a = this; // (N / 2) * Q + Q
  22972. var b = this.curve.point(null, null); // (N / 2) * Q
  22973. var c = this; // Q
  22974. for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
  22975. bits.push(t.andln(1));
  22976. for (var i = bits.length - 1; i >= 0; i--) {
  22977. if (bits[i] === 0) {
  22978. // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
  22979. a = a.diffAdd(b, c);
  22980. // N * Q = 2 * ((N / 2) * Q + Q))
  22981. b = b.dbl();
  22982. } else {
  22983. // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
  22984. b = a.diffAdd(b, c);
  22985. // N * Q + Q = 2 * ((N / 2) * Q + Q)
  22986. a = a.dbl();
  22987. }
  22988. }
  22989. return b;
  22990. };
  22991. Point.prototype.mulAdd = function mulAdd() {
  22992. throw new Error('Not supported on Montgomery curve');
  22993. };
  22994. Point.prototype.jumlAdd = function jumlAdd() {
  22995. throw new Error('Not supported on Montgomery curve');
  22996. };
  22997. Point.prototype.eq = function eq(other) {
  22998. return this.getX().cmp(other.getX()) === 0;
  22999. };
  23000. Point.prototype.normalize = function normalize() {
  23001. this.x = this.x.redMul(this.z.redInvm());
  23002. this.z = this.curve.one;
  23003. return this;
  23004. };
  23005. Point.prototype.getX = function getX() {
  23006. // Normalize coordinates
  23007. this.normalize();
  23008. return this.x.fromRed();
  23009. };
  23010. /***/ }),
  23011. /* 188 */
  23012. /*!*************************************************************!*\
  23013. !*** ./node_modules/elliptic/lib/elliptic/curve/edwards.js ***!
  23014. \*************************************************************/
  23015. /*! no static exports found */
  23016. /***/ (function(module, exports, __webpack_require__) {
  23017. "use strict";
  23018. var utils = __webpack_require__(/*! ../utils */ 182);
  23019. var BN = __webpack_require__(/*! bn.js */ 169);
  23020. var inherits = __webpack_require__(/*! inherits */ 93);
  23021. var Base = __webpack_require__(/*! ./base */ 185);
  23022. var assert = utils.assert;
  23023. function EdwardsCurve(conf) {
  23024. // NOTE: Important as we are creating point in Base.call()
  23025. this.twisted = (conf.a | 0) !== 1;
  23026. this.mOneA = this.twisted && (conf.a | 0) === -1;
  23027. this.extended = this.mOneA;
  23028. Base.call(this, 'edwards', conf);
  23029. this.a = new BN(conf.a, 16).umod(this.red.m);
  23030. this.a = this.a.toRed(this.red);
  23031. this.c = new BN(conf.c, 16).toRed(this.red);
  23032. this.c2 = this.c.redSqr();
  23033. this.d = new BN(conf.d, 16).toRed(this.red);
  23034. this.dd = this.d.redAdd(this.d);
  23035. assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
  23036. this.oneC = (conf.c | 0) === 1;
  23037. }
  23038. inherits(EdwardsCurve, Base);
  23039. module.exports = EdwardsCurve;
  23040. EdwardsCurve.prototype._mulA = function _mulA(num) {
  23041. if (this.mOneA)
  23042. return num.redNeg();
  23043. else
  23044. return this.a.redMul(num);
  23045. };
  23046. EdwardsCurve.prototype._mulC = function _mulC(num) {
  23047. if (this.oneC)
  23048. return num;
  23049. else
  23050. return this.c.redMul(num);
  23051. };
  23052. // Just for compatibility with Short curve
  23053. EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
  23054. return this.point(x, y, z, t);
  23055. };
  23056. EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
  23057. x = new BN(x, 16);
  23058. if (!x.red)
  23059. x = x.toRed(this.red);
  23060. var x2 = x.redSqr();
  23061. var rhs = this.c2.redSub(this.a.redMul(x2));
  23062. var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
  23063. var y2 = rhs.redMul(lhs.redInvm());
  23064. var y = y2.redSqrt();
  23065. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  23066. throw new Error('invalid point');
  23067. var isOdd = y.fromRed().isOdd();
  23068. if (odd && !isOdd || !odd && isOdd)
  23069. y = y.redNeg();
  23070. return this.point(x, y);
  23071. };
  23072. EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
  23073. y = new BN(y, 16);
  23074. if (!y.red)
  23075. y = y.toRed(this.red);
  23076. // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
  23077. var y2 = y.redSqr();
  23078. var lhs = y2.redSub(this.c2);
  23079. var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
  23080. var x2 = lhs.redMul(rhs.redInvm());
  23081. if (x2.cmp(this.zero) === 0) {
  23082. if (odd)
  23083. throw new Error('invalid point');
  23084. else
  23085. return this.point(this.zero, y);
  23086. }
  23087. var x = x2.redSqrt();
  23088. if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
  23089. throw new Error('invalid point');
  23090. if (x.fromRed().isOdd() !== odd)
  23091. x = x.redNeg();
  23092. return this.point(x, y);
  23093. };
  23094. EdwardsCurve.prototype.validate = function validate(point) {
  23095. if (point.isInfinity())
  23096. return true;
  23097. // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
  23098. point.normalize();
  23099. var x2 = point.x.redSqr();
  23100. var y2 = point.y.redSqr();
  23101. var lhs = x2.redMul(this.a).redAdd(y2);
  23102. var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
  23103. return lhs.cmp(rhs) === 0;
  23104. };
  23105. function Point(curve, x, y, z, t) {
  23106. Base.BasePoint.call(this, curve, 'projective');
  23107. if (x === null && y === null && z === null) {
  23108. this.x = this.curve.zero;
  23109. this.y = this.curve.one;
  23110. this.z = this.curve.one;
  23111. this.t = this.curve.zero;
  23112. this.zOne = true;
  23113. } else {
  23114. this.x = new BN(x, 16);
  23115. this.y = new BN(y, 16);
  23116. this.z = z ? new BN(z, 16) : this.curve.one;
  23117. this.t = t && new BN(t, 16);
  23118. if (!this.x.red)
  23119. this.x = this.x.toRed(this.curve.red);
  23120. if (!this.y.red)
  23121. this.y = this.y.toRed(this.curve.red);
  23122. if (!this.z.red)
  23123. this.z = this.z.toRed(this.curve.red);
  23124. if (this.t && !this.t.red)
  23125. this.t = this.t.toRed(this.curve.red);
  23126. this.zOne = this.z === this.curve.one;
  23127. // Use extended coordinates
  23128. if (this.curve.extended && !this.t) {
  23129. this.t = this.x.redMul(this.y);
  23130. if (!this.zOne)
  23131. this.t = this.t.redMul(this.z.redInvm());
  23132. }
  23133. }
  23134. }
  23135. inherits(Point, Base.BasePoint);
  23136. EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23137. return Point.fromJSON(this, obj);
  23138. };
  23139. EdwardsCurve.prototype.point = function point(x, y, z, t) {
  23140. return new Point(this, x, y, z, t);
  23141. };
  23142. Point.fromJSON = function fromJSON(curve, obj) {
  23143. return new Point(curve, obj[0], obj[1], obj[2]);
  23144. };
  23145. Point.prototype.inspect = function inspect() {
  23146. if (this.isInfinity())
  23147. return '<EC Point Infinity>';
  23148. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23149. ' y: ' + this.y.fromRed().toString(16, 2) +
  23150. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23151. };
  23152. Point.prototype.isInfinity = function isInfinity() {
  23153. // XXX This code assumes that zero is always zero in red
  23154. return this.x.cmpn(0) === 0 &&
  23155. (this.y.cmp(this.z) === 0 ||
  23156. (this.zOne && this.y.cmp(this.curve.c) === 0));
  23157. };
  23158. Point.prototype._extDbl = function _extDbl() {
  23159. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23160. // #doubling-dbl-2008-hwcd
  23161. // 4M + 4S
  23162. // A = X1^2
  23163. var a = this.x.redSqr();
  23164. // B = Y1^2
  23165. var b = this.y.redSqr();
  23166. // C = 2 * Z1^2
  23167. var c = this.z.redSqr();
  23168. c = c.redIAdd(c);
  23169. // D = a * A
  23170. var d = this.curve._mulA(a);
  23171. // E = (X1 + Y1)^2 - A - B
  23172. var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
  23173. // G = D + B
  23174. var g = d.redAdd(b);
  23175. // F = G - C
  23176. var f = g.redSub(c);
  23177. // H = D - B
  23178. var h = d.redSub(b);
  23179. // X3 = E * F
  23180. var nx = e.redMul(f);
  23181. // Y3 = G * H
  23182. var ny = g.redMul(h);
  23183. // T3 = E * H
  23184. var nt = e.redMul(h);
  23185. // Z3 = F * G
  23186. var nz = f.redMul(g);
  23187. return this.curve.point(nx, ny, nz, nt);
  23188. };
  23189. Point.prototype._projDbl = function _projDbl() {
  23190. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23191. // #doubling-dbl-2008-bbjlp
  23192. // #doubling-dbl-2007-bl
  23193. // and others
  23194. // Generally 3M + 4S or 2M + 4S
  23195. // B = (X1 + Y1)^2
  23196. var b = this.x.redAdd(this.y).redSqr();
  23197. // C = X1^2
  23198. var c = this.x.redSqr();
  23199. // D = Y1^2
  23200. var d = this.y.redSqr();
  23201. var nx;
  23202. var ny;
  23203. var nz;
  23204. if (this.curve.twisted) {
  23205. // E = a * C
  23206. var e = this.curve._mulA(c);
  23207. // F = E + D
  23208. var f = e.redAdd(d);
  23209. if (this.zOne) {
  23210. // X3 = (B - C - D) * (F - 2)
  23211. nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
  23212. // Y3 = F * (E - D)
  23213. ny = f.redMul(e.redSub(d));
  23214. // Z3 = F^2 - 2 * F
  23215. nz = f.redSqr().redSub(f).redSub(f);
  23216. } else {
  23217. // H = Z1^2
  23218. var h = this.z.redSqr();
  23219. // J = F - 2 * H
  23220. var j = f.redSub(h).redISub(h);
  23221. // X3 = (B-C-D)*J
  23222. nx = b.redSub(c).redISub(d).redMul(j);
  23223. // Y3 = F * (E - D)
  23224. ny = f.redMul(e.redSub(d));
  23225. // Z3 = F * J
  23226. nz = f.redMul(j);
  23227. }
  23228. } else {
  23229. // E = C + D
  23230. var e = c.redAdd(d);
  23231. // H = (c * Z1)^2
  23232. var h = this.curve._mulC(this.z).redSqr();
  23233. // J = E - 2 * H
  23234. var j = e.redSub(h).redSub(h);
  23235. // X3 = c * (B - E) * J
  23236. nx = this.curve._mulC(b.redISub(e)).redMul(j);
  23237. // Y3 = c * E * (C - D)
  23238. ny = this.curve._mulC(e).redMul(c.redISub(d));
  23239. // Z3 = E * J
  23240. nz = e.redMul(j);
  23241. }
  23242. return this.curve.point(nx, ny, nz);
  23243. };
  23244. Point.prototype.dbl = function dbl() {
  23245. if (this.isInfinity())
  23246. return this;
  23247. // Double in extended coordinates
  23248. if (this.curve.extended)
  23249. return this._extDbl();
  23250. else
  23251. return this._projDbl();
  23252. };
  23253. Point.prototype._extAdd = function _extAdd(p) {
  23254. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23255. // #addition-add-2008-hwcd-3
  23256. // 8M
  23257. // A = (Y1 - X1) * (Y2 - X2)
  23258. var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
  23259. // B = (Y1 + X1) * (Y2 + X2)
  23260. var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
  23261. // C = T1 * k * T2
  23262. var c = this.t.redMul(this.curve.dd).redMul(p.t);
  23263. // D = Z1 * 2 * Z2
  23264. var d = this.z.redMul(p.z.redAdd(p.z));
  23265. // E = B - A
  23266. var e = b.redSub(a);
  23267. // F = D - C
  23268. var f = d.redSub(c);
  23269. // G = D + C
  23270. var g = d.redAdd(c);
  23271. // H = B + A
  23272. var h = b.redAdd(a);
  23273. // X3 = E * F
  23274. var nx = e.redMul(f);
  23275. // Y3 = G * H
  23276. var ny = g.redMul(h);
  23277. // T3 = E * H
  23278. var nt = e.redMul(h);
  23279. // Z3 = F * G
  23280. var nz = f.redMul(g);
  23281. return this.curve.point(nx, ny, nz, nt);
  23282. };
  23283. Point.prototype._projAdd = function _projAdd(p) {
  23284. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23285. // #addition-add-2008-bbjlp
  23286. // #addition-add-2007-bl
  23287. // 10M + 1S
  23288. // A = Z1 * Z2
  23289. var a = this.z.redMul(p.z);
  23290. // B = A^2
  23291. var b = a.redSqr();
  23292. // C = X1 * X2
  23293. var c = this.x.redMul(p.x);
  23294. // D = Y1 * Y2
  23295. var d = this.y.redMul(p.y);
  23296. // E = d * C * D
  23297. var e = this.curve.d.redMul(c).redMul(d);
  23298. // F = B - E
  23299. var f = b.redSub(e);
  23300. // G = B + E
  23301. var g = b.redAdd(e);
  23302. // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
  23303. var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
  23304. var nx = a.redMul(f).redMul(tmp);
  23305. var ny;
  23306. var nz;
  23307. if (this.curve.twisted) {
  23308. // Y3 = A * G * (D - a * C)
  23309. ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
  23310. // Z3 = F * G
  23311. nz = f.redMul(g);
  23312. } else {
  23313. // Y3 = A * G * (D - C)
  23314. ny = a.redMul(g).redMul(d.redSub(c));
  23315. // Z3 = c * F * G
  23316. nz = this.curve._mulC(f).redMul(g);
  23317. }
  23318. return this.curve.point(nx, ny, nz);
  23319. };
  23320. Point.prototype.add = function add(p) {
  23321. if (this.isInfinity())
  23322. return p;
  23323. if (p.isInfinity())
  23324. return this;
  23325. if (this.curve.extended)
  23326. return this._extAdd(p);
  23327. else
  23328. return this._projAdd(p);
  23329. };
  23330. Point.prototype.mul = function mul(k) {
  23331. if (this._hasDoubles(k))
  23332. return this.curve._fixedNafMul(this, k);
  23333. else
  23334. return this.curve._wnafMul(this, k);
  23335. };
  23336. Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
  23337. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
  23338. };
  23339. Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
  23340. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
  23341. };
  23342. Point.prototype.normalize = function normalize() {
  23343. if (this.zOne)
  23344. return this;
  23345. // Normalize coordinates
  23346. var zi = this.z.redInvm();
  23347. this.x = this.x.redMul(zi);
  23348. this.y = this.y.redMul(zi);
  23349. if (this.t)
  23350. this.t = this.t.redMul(zi);
  23351. this.z = this.curve.one;
  23352. this.zOne = true;
  23353. return this;
  23354. };
  23355. Point.prototype.neg = function neg() {
  23356. return this.curve.point(this.x.redNeg(),
  23357. this.y,
  23358. this.z,
  23359. this.t && this.t.redNeg());
  23360. };
  23361. Point.prototype.getX = function getX() {
  23362. this.normalize();
  23363. return this.x.fromRed();
  23364. };
  23365. Point.prototype.getY = function getY() {
  23366. this.normalize();
  23367. return this.y.fromRed();
  23368. };
  23369. Point.prototype.eq = function eq(other) {
  23370. return this === other ||
  23371. this.getX().cmp(other.getX()) === 0 &&
  23372. this.getY().cmp(other.getY()) === 0;
  23373. };
  23374. Point.prototype.eqXToP = function eqXToP(x) {
  23375. var rx = x.toRed(this.curve.red).redMul(this.z);
  23376. if (this.x.cmp(rx) === 0)
  23377. return true;
  23378. var xc = x.clone();
  23379. var t = this.curve.redN.redMul(this.z);
  23380. for (;;) {
  23381. xc.iadd(this.curve.n);
  23382. if (xc.cmp(this.curve.p) >= 0)
  23383. return false;
  23384. rx.redIAdd(t);
  23385. if (this.x.cmp(rx) === 0)
  23386. return true;
  23387. }
  23388. };
  23389. // Compatibility with BaseCurve
  23390. Point.prototype.toP = Point.prototype.normalize;
  23391. Point.prototype.mixedAdd = Point.prototype.add;
  23392. /***/ }),
  23393. /* 189 */
  23394. /*!******************************************************!*\
  23395. !*** ./node_modules/elliptic/lib/elliptic/curves.js ***!
  23396. \******************************************************/
  23397. /*! no static exports found */
  23398. /***/ (function(module, exports, __webpack_require__) {
  23399. "use strict";
  23400. var curves = exports;
  23401. var hash = __webpack_require__(/*! hash.js */ 190);
  23402. var curve = __webpack_require__(/*! ./curve */ 184);
  23403. var utils = __webpack_require__(/*! ./utils */ 182);
  23404. var assert = utils.assert;
  23405. function PresetCurve(options) {
  23406. if (options.type === 'short')
  23407. this.curve = new curve.short(options);
  23408. else if (options.type === 'edwards')
  23409. this.curve = new curve.edwards(options);
  23410. else
  23411. this.curve = new curve.mont(options);
  23412. this.g = this.curve.g;
  23413. this.n = this.curve.n;
  23414. this.hash = options.hash;
  23415. assert(this.g.validate(), 'Invalid curve');
  23416. assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
  23417. }
  23418. curves.PresetCurve = PresetCurve;
  23419. function defineCurve(name, options) {
  23420. Object.defineProperty(curves, name, {
  23421. configurable: true,
  23422. enumerable: true,
  23423. get: function() {
  23424. var curve = new PresetCurve(options);
  23425. Object.defineProperty(curves, name, {
  23426. configurable: true,
  23427. enumerable: true,
  23428. value: curve
  23429. });
  23430. return curve;
  23431. }
  23432. });
  23433. }
  23434. defineCurve('p192', {
  23435. type: 'short',
  23436. prime: 'p192',
  23437. p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
  23438. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
  23439. b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
  23440. n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
  23441. hash: hash.sha256,
  23442. gRed: false,
  23443. g: [
  23444. '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
  23445. '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
  23446. ]
  23447. });
  23448. defineCurve('p224', {
  23449. type: 'short',
  23450. prime: 'p224',
  23451. p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
  23452. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
  23453. b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
  23454. n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
  23455. hash: hash.sha256,
  23456. gRed: false,
  23457. g: [
  23458. 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
  23459. 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
  23460. ]
  23461. });
  23462. defineCurve('p256', {
  23463. type: 'short',
  23464. prime: null,
  23465. p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
  23466. a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
  23467. b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
  23468. n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
  23469. hash: hash.sha256,
  23470. gRed: false,
  23471. g: [
  23472. '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
  23473. '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
  23474. ]
  23475. });
  23476. defineCurve('p384', {
  23477. type: 'short',
  23478. prime: null,
  23479. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23480. 'fffffffe ffffffff 00000000 00000000 ffffffff',
  23481. a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23482. 'fffffffe ffffffff 00000000 00000000 fffffffc',
  23483. b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
  23484. '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
  23485. n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
  23486. 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
  23487. hash: hash.sha384,
  23488. gRed: false,
  23489. g: [
  23490. 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
  23491. '5502f25d bf55296c 3a545e38 72760ab7',
  23492. '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
  23493. '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
  23494. ]
  23495. });
  23496. defineCurve('p521', {
  23497. type: 'short',
  23498. prime: null,
  23499. p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23500. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23501. 'ffffffff ffffffff ffffffff ffffffff ffffffff',
  23502. a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23503. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23504. 'ffffffff ffffffff ffffffff ffffffff fffffffc',
  23505. b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
  23506. '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
  23507. '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
  23508. n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  23509. 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
  23510. 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
  23511. hash: hash.sha512,
  23512. gRed: false,
  23513. g: [
  23514. '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
  23515. '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
  23516. 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
  23517. '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
  23518. '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
  23519. '3fad0761 353c7086 a272c240 88be9476 9fd16650'
  23520. ]
  23521. });
  23522. defineCurve('curve25519', {
  23523. type: 'mont',
  23524. prime: 'p25519',
  23525. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  23526. a: '76d06',
  23527. b: '1',
  23528. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  23529. hash: hash.sha256,
  23530. gRed: false,
  23531. g: [
  23532. '9'
  23533. ]
  23534. });
  23535. defineCurve('ed25519', {
  23536. type: 'edwards',
  23537. prime: 'p25519',
  23538. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  23539. a: '-1',
  23540. c: '1',
  23541. // -121665 * (121666^(-1)) (mod P)
  23542. d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
  23543. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  23544. hash: hash.sha256,
  23545. gRed: false,
  23546. g: [
  23547. '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
  23548. // 4/5
  23549. '6666666666666666666666666666666666666666666666666666666666666658'
  23550. ]
  23551. });
  23552. var pre;
  23553. try {
  23554. pre = __webpack_require__(/*! ./precomputed/secp256k1 */ 202);
  23555. } catch (e) {
  23556. pre = undefined;
  23557. }
  23558. defineCurve('secp256k1', {
  23559. type: 'short',
  23560. prime: 'k256',
  23561. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
  23562. a: '0',
  23563. b: '7',
  23564. n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
  23565. h: '1',
  23566. hash: hash.sha256,
  23567. // Precomputed endomorphism
  23568. beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
  23569. lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
  23570. basis: [
  23571. {
  23572. a: '3086d221a7d46bcde86c90e49284eb15',
  23573. b: '-e4437ed6010e88286f547fa90abfe4c3'
  23574. },
  23575. {
  23576. a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
  23577. b: '3086d221a7d46bcde86c90e49284eb15'
  23578. }
  23579. ],
  23580. gRed: false,
  23581. g: [
  23582. '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
  23583. '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
  23584. pre
  23585. ]
  23586. });
  23587. /***/ }),
  23588. /* 190 */
  23589. /*!******************************************!*\
  23590. !*** ./node_modules/hash.js/lib/hash.js ***!
  23591. \******************************************/
  23592. /*! no static exports found */
  23593. /***/ (function(module, exports, __webpack_require__) {
  23594. var hash = exports;
  23595. hash.utils = __webpack_require__(/*! ./hash/utils */ 191);
  23596. hash.common = __webpack_require__(/*! ./hash/common */ 192);
  23597. hash.sha = __webpack_require__(/*! ./hash/sha */ 193);
  23598. hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ 200);
  23599. hash.hmac = __webpack_require__(/*! ./hash/hmac */ 201);
  23600. // Proxy hash functions to the main object
  23601. hash.sha1 = hash.sha.sha1;
  23602. hash.sha256 = hash.sha.sha256;
  23603. hash.sha224 = hash.sha.sha224;
  23604. hash.sha384 = hash.sha.sha384;
  23605. hash.sha512 = hash.sha.sha512;
  23606. hash.ripemd160 = hash.ripemd.ripemd160;
  23607. /***/ }),
  23608. /* 191 */
  23609. /*!************************************************!*\
  23610. !*** ./node_modules/hash.js/lib/hash/utils.js ***!
  23611. \************************************************/
  23612. /*! no static exports found */
  23613. /***/ (function(module, exports, __webpack_require__) {
  23614. "use strict";
  23615. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  23616. var inherits = __webpack_require__(/*! inherits */ 93);
  23617. exports.inherits = inherits;
  23618. function isSurrogatePair(msg, i) {
  23619. if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
  23620. return false;
  23621. }
  23622. if (i < 0 || i + 1 >= msg.length) {
  23623. return false;
  23624. }
  23625. return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
  23626. }
  23627. function toArray(msg, enc) {
  23628. if (Array.isArray(msg))
  23629. return msg.slice();
  23630. if (!msg)
  23631. return [];
  23632. var res = [];
  23633. if (typeof msg === 'string') {
  23634. if (!enc) {
  23635. // Inspired by stringToUtf8ByteArray() in closure-library by Google
  23636. // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
  23637. // Apache License 2.0
  23638. // https://github.com/google/closure-library/blob/master/LICENSE
  23639. var p = 0;
  23640. for (var i = 0; i < msg.length; i++) {
  23641. var c = msg.charCodeAt(i);
  23642. if (c < 128) {
  23643. res[p++] = c;
  23644. } else if (c < 2048) {
  23645. res[p++] = (c >> 6) | 192;
  23646. res[p++] = (c & 63) | 128;
  23647. } else if (isSurrogatePair(msg, i)) {
  23648. c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
  23649. res[p++] = (c >> 18) | 240;
  23650. res[p++] = ((c >> 12) & 63) | 128;
  23651. res[p++] = ((c >> 6) & 63) | 128;
  23652. res[p++] = (c & 63) | 128;
  23653. } else {
  23654. res[p++] = (c >> 12) | 224;
  23655. res[p++] = ((c >> 6) & 63) | 128;
  23656. res[p++] = (c & 63) | 128;
  23657. }
  23658. }
  23659. } else if (enc === 'hex') {
  23660. msg = msg.replace(/[^a-z0-9]+/ig, '');
  23661. if (msg.length % 2 !== 0)
  23662. msg = '0' + msg;
  23663. for (i = 0; i < msg.length; i += 2)
  23664. res.push(parseInt(msg[i] + msg[i + 1], 16));
  23665. }
  23666. } else {
  23667. for (i = 0; i < msg.length; i++)
  23668. res[i] = msg[i] | 0;
  23669. }
  23670. return res;
  23671. }
  23672. exports.toArray = toArray;
  23673. function toHex(msg) {
  23674. var res = '';
  23675. for (var i = 0; i < msg.length; i++)
  23676. res += zero2(msg[i].toString(16));
  23677. return res;
  23678. }
  23679. exports.toHex = toHex;
  23680. function htonl(w) {
  23681. var res = (w >>> 24) |
  23682. ((w >>> 8) & 0xff00) |
  23683. ((w << 8) & 0xff0000) |
  23684. ((w & 0xff) << 24);
  23685. return res >>> 0;
  23686. }
  23687. exports.htonl = htonl;
  23688. function toHex32(msg, endian) {
  23689. var res = '';
  23690. for (var i = 0; i < msg.length; i++) {
  23691. var w = msg[i];
  23692. if (endian === 'little')
  23693. w = htonl(w);
  23694. res += zero8(w.toString(16));
  23695. }
  23696. return res;
  23697. }
  23698. exports.toHex32 = toHex32;
  23699. function zero2(word) {
  23700. if (word.length === 1)
  23701. return '0' + word;
  23702. else
  23703. return word;
  23704. }
  23705. exports.zero2 = zero2;
  23706. function zero8(word) {
  23707. if (word.length === 7)
  23708. return '0' + word;
  23709. else if (word.length === 6)
  23710. return '00' + word;
  23711. else if (word.length === 5)
  23712. return '000' + word;
  23713. else if (word.length === 4)
  23714. return '0000' + word;
  23715. else if (word.length === 3)
  23716. return '00000' + word;
  23717. else if (word.length === 2)
  23718. return '000000' + word;
  23719. else if (word.length === 1)
  23720. return '0000000' + word;
  23721. else
  23722. return word;
  23723. }
  23724. exports.zero8 = zero8;
  23725. function join32(msg, start, end, endian) {
  23726. var len = end - start;
  23727. assert(len % 4 === 0);
  23728. var res = new Array(len / 4);
  23729. for (var i = 0, k = start; i < res.length; i++, k += 4) {
  23730. var w;
  23731. if (endian === 'big')
  23732. w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
  23733. else
  23734. w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
  23735. res[i] = w >>> 0;
  23736. }
  23737. return res;
  23738. }
  23739. exports.join32 = join32;
  23740. function split32(msg, endian) {
  23741. var res = new Array(msg.length * 4);
  23742. for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
  23743. var m = msg[i];
  23744. if (endian === 'big') {
  23745. res[k] = m >>> 24;
  23746. res[k + 1] = (m >>> 16) & 0xff;
  23747. res[k + 2] = (m >>> 8) & 0xff;
  23748. res[k + 3] = m & 0xff;
  23749. } else {
  23750. res[k + 3] = m >>> 24;
  23751. res[k + 2] = (m >>> 16) & 0xff;
  23752. res[k + 1] = (m >>> 8) & 0xff;
  23753. res[k] = m & 0xff;
  23754. }
  23755. }
  23756. return res;
  23757. }
  23758. exports.split32 = split32;
  23759. function rotr32(w, b) {
  23760. return (w >>> b) | (w << (32 - b));
  23761. }
  23762. exports.rotr32 = rotr32;
  23763. function rotl32(w, b) {
  23764. return (w << b) | (w >>> (32 - b));
  23765. }
  23766. exports.rotl32 = rotl32;
  23767. function sum32(a, b) {
  23768. return (a + b) >>> 0;
  23769. }
  23770. exports.sum32 = sum32;
  23771. function sum32_3(a, b, c) {
  23772. return (a + b + c) >>> 0;
  23773. }
  23774. exports.sum32_3 = sum32_3;
  23775. function sum32_4(a, b, c, d) {
  23776. return (a + b + c + d) >>> 0;
  23777. }
  23778. exports.sum32_4 = sum32_4;
  23779. function sum32_5(a, b, c, d, e) {
  23780. return (a + b + c + d + e) >>> 0;
  23781. }
  23782. exports.sum32_5 = sum32_5;
  23783. function sum64(buf, pos, ah, al) {
  23784. var bh = buf[pos];
  23785. var bl = buf[pos + 1];
  23786. var lo = (al + bl) >>> 0;
  23787. var hi = (lo < al ? 1 : 0) + ah + bh;
  23788. buf[pos] = hi >>> 0;
  23789. buf[pos + 1] = lo;
  23790. }
  23791. exports.sum64 = sum64;
  23792. function sum64_hi(ah, al, bh, bl) {
  23793. var lo = (al + bl) >>> 0;
  23794. var hi = (lo < al ? 1 : 0) + ah + bh;
  23795. return hi >>> 0;
  23796. }
  23797. exports.sum64_hi = sum64_hi;
  23798. function sum64_lo(ah, al, bh, bl) {
  23799. var lo = al + bl;
  23800. return lo >>> 0;
  23801. }
  23802. exports.sum64_lo = sum64_lo;
  23803. function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
  23804. var carry = 0;
  23805. var lo = al;
  23806. lo = (lo + bl) >>> 0;
  23807. carry += lo < al ? 1 : 0;
  23808. lo = (lo + cl) >>> 0;
  23809. carry += lo < cl ? 1 : 0;
  23810. lo = (lo + dl) >>> 0;
  23811. carry += lo < dl ? 1 : 0;
  23812. var hi = ah + bh + ch + dh + carry;
  23813. return hi >>> 0;
  23814. }
  23815. exports.sum64_4_hi = sum64_4_hi;
  23816. function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
  23817. var lo = al + bl + cl + dl;
  23818. return lo >>> 0;
  23819. }
  23820. exports.sum64_4_lo = sum64_4_lo;
  23821. function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  23822. var carry = 0;
  23823. var lo = al;
  23824. lo = (lo + bl) >>> 0;
  23825. carry += lo < al ? 1 : 0;
  23826. lo = (lo + cl) >>> 0;
  23827. carry += lo < cl ? 1 : 0;
  23828. lo = (lo + dl) >>> 0;
  23829. carry += lo < dl ? 1 : 0;
  23830. lo = (lo + el) >>> 0;
  23831. carry += lo < el ? 1 : 0;
  23832. var hi = ah + bh + ch + dh + eh + carry;
  23833. return hi >>> 0;
  23834. }
  23835. exports.sum64_5_hi = sum64_5_hi;
  23836. function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  23837. var lo = al + bl + cl + dl + el;
  23838. return lo >>> 0;
  23839. }
  23840. exports.sum64_5_lo = sum64_5_lo;
  23841. function rotr64_hi(ah, al, num) {
  23842. var r = (al << (32 - num)) | (ah >>> num);
  23843. return r >>> 0;
  23844. }
  23845. exports.rotr64_hi = rotr64_hi;
  23846. function rotr64_lo(ah, al, num) {
  23847. var r = (ah << (32 - num)) | (al >>> num);
  23848. return r >>> 0;
  23849. }
  23850. exports.rotr64_lo = rotr64_lo;
  23851. function shr64_hi(ah, al, num) {
  23852. return ah >>> num;
  23853. }
  23854. exports.shr64_hi = shr64_hi;
  23855. function shr64_lo(ah, al, num) {
  23856. var r = (ah << (32 - num)) | (al >>> num);
  23857. return r >>> 0;
  23858. }
  23859. exports.shr64_lo = shr64_lo;
  23860. /***/ }),
  23861. /* 192 */
  23862. /*!*************************************************!*\
  23863. !*** ./node_modules/hash.js/lib/hash/common.js ***!
  23864. \*************************************************/
  23865. /*! no static exports found */
  23866. /***/ (function(module, exports, __webpack_require__) {
  23867. "use strict";
  23868. var utils = __webpack_require__(/*! ./utils */ 191);
  23869. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  23870. function BlockHash() {
  23871. this.pending = null;
  23872. this.pendingTotal = 0;
  23873. this.blockSize = this.constructor.blockSize;
  23874. this.outSize = this.constructor.outSize;
  23875. this.hmacStrength = this.constructor.hmacStrength;
  23876. this.padLength = this.constructor.padLength / 8;
  23877. this.endian = 'big';
  23878. this._delta8 = this.blockSize / 8;
  23879. this._delta32 = this.blockSize / 32;
  23880. }
  23881. exports.BlockHash = BlockHash;
  23882. BlockHash.prototype.update = function update(msg, enc) {
  23883. // Convert message to array, pad it, and join into 32bit blocks
  23884. msg = utils.toArray(msg, enc);
  23885. if (!this.pending)
  23886. this.pending = msg;
  23887. else
  23888. this.pending = this.pending.concat(msg);
  23889. this.pendingTotal += msg.length;
  23890. // Enough data, try updating
  23891. if (this.pending.length >= this._delta8) {
  23892. msg = this.pending;
  23893. // Process pending data in blocks
  23894. var r = msg.length % this._delta8;
  23895. this.pending = msg.slice(msg.length - r, msg.length);
  23896. if (this.pending.length === 0)
  23897. this.pending = null;
  23898. msg = utils.join32(msg, 0, msg.length - r, this.endian);
  23899. for (var i = 0; i < msg.length; i += this._delta32)
  23900. this._update(msg, i, i + this._delta32);
  23901. }
  23902. return this;
  23903. };
  23904. BlockHash.prototype.digest = function digest(enc) {
  23905. this.update(this._pad());
  23906. assert(this.pending === null);
  23907. return this._digest(enc);
  23908. };
  23909. BlockHash.prototype._pad = function pad() {
  23910. var len = this.pendingTotal;
  23911. var bytes = this._delta8;
  23912. var k = bytes - ((len + this.padLength) % bytes);
  23913. var res = new Array(k + this.padLength);
  23914. res[0] = 0x80;
  23915. for (var i = 1; i < k; i++)
  23916. res[i] = 0;
  23917. // Append length
  23918. len <<= 3;
  23919. if (this.endian === 'big') {
  23920. for (var t = 8; t < this.padLength; t++)
  23921. res[i++] = 0;
  23922. res[i++] = 0;
  23923. res[i++] = 0;
  23924. res[i++] = 0;
  23925. res[i++] = 0;
  23926. res[i++] = (len >>> 24) & 0xff;
  23927. res[i++] = (len >>> 16) & 0xff;
  23928. res[i++] = (len >>> 8) & 0xff;
  23929. res[i++] = len & 0xff;
  23930. } else {
  23931. res[i++] = len & 0xff;
  23932. res[i++] = (len >>> 8) & 0xff;
  23933. res[i++] = (len >>> 16) & 0xff;
  23934. res[i++] = (len >>> 24) & 0xff;
  23935. res[i++] = 0;
  23936. res[i++] = 0;
  23937. res[i++] = 0;
  23938. res[i++] = 0;
  23939. for (t = 8; t < this.padLength; t++)
  23940. res[i++] = 0;
  23941. }
  23942. return res;
  23943. };
  23944. /***/ }),
  23945. /* 193 */
  23946. /*!**********************************************!*\
  23947. !*** ./node_modules/hash.js/lib/hash/sha.js ***!
  23948. \**********************************************/
  23949. /*! no static exports found */
  23950. /***/ (function(module, exports, __webpack_require__) {
  23951. "use strict";
  23952. exports.sha1 = __webpack_require__(/*! ./sha/1 */ 194);
  23953. exports.sha224 = __webpack_require__(/*! ./sha/224 */ 196);
  23954. exports.sha256 = __webpack_require__(/*! ./sha/256 */ 197);
  23955. exports.sha384 = __webpack_require__(/*! ./sha/384 */ 198);
  23956. exports.sha512 = __webpack_require__(/*! ./sha/512 */ 199);
  23957. /***/ }),
  23958. /* 194 */
  23959. /*!************************************************!*\
  23960. !*** ./node_modules/hash.js/lib/hash/sha/1.js ***!
  23961. \************************************************/
  23962. /*! no static exports found */
  23963. /***/ (function(module, exports, __webpack_require__) {
  23964. "use strict";
  23965. var utils = __webpack_require__(/*! ../utils */ 191);
  23966. var common = __webpack_require__(/*! ../common */ 192);
  23967. var shaCommon = __webpack_require__(/*! ./common */ 195);
  23968. var rotl32 = utils.rotl32;
  23969. var sum32 = utils.sum32;
  23970. var sum32_5 = utils.sum32_5;
  23971. var ft_1 = shaCommon.ft_1;
  23972. var BlockHash = common.BlockHash;
  23973. var sha1_K = [
  23974. 0x5A827999, 0x6ED9EBA1,
  23975. 0x8F1BBCDC, 0xCA62C1D6
  23976. ];
  23977. function SHA1() {
  23978. if (!(this instanceof SHA1))
  23979. return new SHA1();
  23980. BlockHash.call(this);
  23981. this.h = [
  23982. 0x67452301, 0xefcdab89, 0x98badcfe,
  23983. 0x10325476, 0xc3d2e1f0 ];
  23984. this.W = new Array(80);
  23985. }
  23986. utils.inherits(SHA1, BlockHash);
  23987. module.exports = SHA1;
  23988. SHA1.blockSize = 512;
  23989. SHA1.outSize = 160;
  23990. SHA1.hmacStrength = 80;
  23991. SHA1.padLength = 64;
  23992. SHA1.prototype._update = function _update(msg, start) {
  23993. var W = this.W;
  23994. for (var i = 0; i < 16; i++)
  23995. W[i] = msg[start + i];
  23996. for(; i < W.length; i++)
  23997. W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
  23998. var a = this.h[0];
  23999. var b = this.h[1];
  24000. var c = this.h[2];
  24001. var d = this.h[3];
  24002. var e = this.h[4];
  24003. for (i = 0; i < W.length; i++) {
  24004. var s = ~~(i / 20);
  24005. var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
  24006. e = d;
  24007. d = c;
  24008. c = rotl32(b, 30);
  24009. b = a;
  24010. a = t;
  24011. }
  24012. this.h[0] = sum32(this.h[0], a);
  24013. this.h[1] = sum32(this.h[1], b);
  24014. this.h[2] = sum32(this.h[2], c);
  24015. this.h[3] = sum32(this.h[3], d);
  24016. this.h[4] = sum32(this.h[4], e);
  24017. };
  24018. SHA1.prototype._digest = function digest(enc) {
  24019. if (enc === 'hex')
  24020. return utils.toHex32(this.h, 'big');
  24021. else
  24022. return utils.split32(this.h, 'big');
  24023. };
  24024. /***/ }),
  24025. /* 195 */
  24026. /*!*****************************************************!*\
  24027. !*** ./node_modules/hash.js/lib/hash/sha/common.js ***!
  24028. \*****************************************************/
  24029. /*! no static exports found */
  24030. /***/ (function(module, exports, __webpack_require__) {
  24031. "use strict";
  24032. var utils = __webpack_require__(/*! ../utils */ 191);
  24033. var rotr32 = utils.rotr32;
  24034. function ft_1(s, x, y, z) {
  24035. if (s === 0)
  24036. return ch32(x, y, z);
  24037. if (s === 1 || s === 3)
  24038. return p32(x, y, z);
  24039. if (s === 2)
  24040. return maj32(x, y, z);
  24041. }
  24042. exports.ft_1 = ft_1;
  24043. function ch32(x, y, z) {
  24044. return (x & y) ^ ((~x) & z);
  24045. }
  24046. exports.ch32 = ch32;
  24047. function maj32(x, y, z) {
  24048. return (x & y) ^ (x & z) ^ (y & z);
  24049. }
  24050. exports.maj32 = maj32;
  24051. function p32(x, y, z) {
  24052. return x ^ y ^ z;
  24053. }
  24054. exports.p32 = p32;
  24055. function s0_256(x) {
  24056. return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
  24057. }
  24058. exports.s0_256 = s0_256;
  24059. function s1_256(x) {
  24060. return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
  24061. }
  24062. exports.s1_256 = s1_256;
  24063. function g0_256(x) {
  24064. return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
  24065. }
  24066. exports.g0_256 = g0_256;
  24067. function g1_256(x) {
  24068. return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
  24069. }
  24070. exports.g1_256 = g1_256;
  24071. /***/ }),
  24072. /* 196 */
  24073. /*!**************************************************!*\
  24074. !*** ./node_modules/hash.js/lib/hash/sha/224.js ***!
  24075. \**************************************************/
  24076. /*! no static exports found */
  24077. /***/ (function(module, exports, __webpack_require__) {
  24078. "use strict";
  24079. var utils = __webpack_require__(/*! ../utils */ 191);
  24080. var SHA256 = __webpack_require__(/*! ./256 */ 197);
  24081. function SHA224() {
  24082. if (!(this instanceof SHA224))
  24083. return new SHA224();
  24084. SHA256.call(this);
  24085. this.h = [
  24086. 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  24087. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
  24088. }
  24089. utils.inherits(SHA224, SHA256);
  24090. module.exports = SHA224;
  24091. SHA224.blockSize = 512;
  24092. SHA224.outSize = 224;
  24093. SHA224.hmacStrength = 192;
  24094. SHA224.padLength = 64;
  24095. SHA224.prototype._digest = function digest(enc) {
  24096. // Just truncate output
  24097. if (enc === 'hex')
  24098. return utils.toHex32(this.h.slice(0, 7), 'big');
  24099. else
  24100. return utils.split32(this.h.slice(0, 7), 'big');
  24101. };
  24102. /***/ }),
  24103. /* 197 */
  24104. /*!**************************************************!*\
  24105. !*** ./node_modules/hash.js/lib/hash/sha/256.js ***!
  24106. \**************************************************/
  24107. /*! no static exports found */
  24108. /***/ (function(module, exports, __webpack_require__) {
  24109. "use strict";
  24110. var utils = __webpack_require__(/*! ../utils */ 191);
  24111. var common = __webpack_require__(/*! ../common */ 192);
  24112. var shaCommon = __webpack_require__(/*! ./common */ 195);
  24113. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  24114. var sum32 = utils.sum32;
  24115. var sum32_4 = utils.sum32_4;
  24116. var sum32_5 = utils.sum32_5;
  24117. var ch32 = shaCommon.ch32;
  24118. var maj32 = shaCommon.maj32;
  24119. var s0_256 = shaCommon.s0_256;
  24120. var s1_256 = shaCommon.s1_256;
  24121. var g0_256 = shaCommon.g0_256;
  24122. var g1_256 = shaCommon.g1_256;
  24123. var BlockHash = common.BlockHash;
  24124. var sha256_K = [
  24125. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
  24126. 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
  24127. 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
  24128. 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
  24129. 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  24130. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
  24131. 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
  24132. 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
  24133. 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
  24134. 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  24135. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
  24136. 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
  24137. 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
  24138. 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
  24139. 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  24140. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
  24141. ];
  24142. function SHA256() {
  24143. if (!(this instanceof SHA256))
  24144. return new SHA256();
  24145. BlockHash.call(this);
  24146. this.h = [
  24147. 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
  24148. 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
  24149. ];
  24150. this.k = sha256_K;
  24151. this.W = new Array(64);
  24152. }
  24153. utils.inherits(SHA256, BlockHash);
  24154. module.exports = SHA256;
  24155. SHA256.blockSize = 512;
  24156. SHA256.outSize = 256;
  24157. SHA256.hmacStrength = 192;
  24158. SHA256.padLength = 64;
  24159. SHA256.prototype._update = function _update(msg, start) {
  24160. var W = this.W;
  24161. for (var i = 0; i < 16; i++)
  24162. W[i] = msg[start + i];
  24163. for (; i < W.length; i++)
  24164. W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
  24165. var a = this.h[0];
  24166. var b = this.h[1];
  24167. var c = this.h[2];
  24168. var d = this.h[3];
  24169. var e = this.h[4];
  24170. var f = this.h[5];
  24171. var g = this.h[6];
  24172. var h = this.h[7];
  24173. assert(this.k.length === W.length);
  24174. for (i = 0; i < W.length; i++) {
  24175. var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
  24176. var T2 = sum32(s0_256(a), maj32(a, b, c));
  24177. h = g;
  24178. g = f;
  24179. f = e;
  24180. e = sum32(d, T1);
  24181. d = c;
  24182. c = b;
  24183. b = a;
  24184. a = sum32(T1, T2);
  24185. }
  24186. this.h[0] = sum32(this.h[0], a);
  24187. this.h[1] = sum32(this.h[1], b);
  24188. this.h[2] = sum32(this.h[2], c);
  24189. this.h[3] = sum32(this.h[3], d);
  24190. this.h[4] = sum32(this.h[4], e);
  24191. this.h[5] = sum32(this.h[5], f);
  24192. this.h[6] = sum32(this.h[6], g);
  24193. this.h[7] = sum32(this.h[7], h);
  24194. };
  24195. SHA256.prototype._digest = function digest(enc) {
  24196. if (enc === 'hex')
  24197. return utils.toHex32(this.h, 'big');
  24198. else
  24199. return utils.split32(this.h, 'big');
  24200. };
  24201. /***/ }),
  24202. /* 198 */
  24203. /*!**************************************************!*\
  24204. !*** ./node_modules/hash.js/lib/hash/sha/384.js ***!
  24205. \**************************************************/
  24206. /*! no static exports found */
  24207. /***/ (function(module, exports, __webpack_require__) {
  24208. "use strict";
  24209. var utils = __webpack_require__(/*! ../utils */ 191);
  24210. var SHA512 = __webpack_require__(/*! ./512 */ 199);
  24211. function SHA384() {
  24212. if (!(this instanceof SHA384))
  24213. return new SHA384();
  24214. SHA512.call(this);
  24215. this.h = [
  24216. 0xcbbb9d5d, 0xc1059ed8,
  24217. 0x629a292a, 0x367cd507,
  24218. 0x9159015a, 0x3070dd17,
  24219. 0x152fecd8, 0xf70e5939,
  24220. 0x67332667, 0xffc00b31,
  24221. 0x8eb44a87, 0x68581511,
  24222. 0xdb0c2e0d, 0x64f98fa7,
  24223. 0x47b5481d, 0xbefa4fa4 ];
  24224. }
  24225. utils.inherits(SHA384, SHA512);
  24226. module.exports = SHA384;
  24227. SHA384.blockSize = 1024;
  24228. SHA384.outSize = 384;
  24229. SHA384.hmacStrength = 192;
  24230. SHA384.padLength = 128;
  24231. SHA384.prototype._digest = function digest(enc) {
  24232. if (enc === 'hex')
  24233. return utils.toHex32(this.h.slice(0, 12), 'big');
  24234. else
  24235. return utils.split32(this.h.slice(0, 12), 'big');
  24236. };
  24237. /***/ }),
  24238. /* 199 */
  24239. /*!**************************************************!*\
  24240. !*** ./node_modules/hash.js/lib/hash/sha/512.js ***!
  24241. \**************************************************/
  24242. /*! no static exports found */
  24243. /***/ (function(module, exports, __webpack_require__) {
  24244. "use strict";
  24245. var utils = __webpack_require__(/*! ../utils */ 191);
  24246. var common = __webpack_require__(/*! ../common */ 192);
  24247. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  24248. var rotr64_hi = utils.rotr64_hi;
  24249. var rotr64_lo = utils.rotr64_lo;
  24250. var shr64_hi = utils.shr64_hi;
  24251. var shr64_lo = utils.shr64_lo;
  24252. var sum64 = utils.sum64;
  24253. var sum64_hi = utils.sum64_hi;
  24254. var sum64_lo = utils.sum64_lo;
  24255. var sum64_4_hi = utils.sum64_4_hi;
  24256. var sum64_4_lo = utils.sum64_4_lo;
  24257. var sum64_5_hi = utils.sum64_5_hi;
  24258. var sum64_5_lo = utils.sum64_5_lo;
  24259. var BlockHash = common.BlockHash;
  24260. var sha512_K = [
  24261. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  24262. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  24263. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  24264. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  24265. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  24266. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  24267. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  24268. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  24269. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  24270. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  24271. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  24272. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  24273. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  24274. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  24275. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  24276. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  24277. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  24278. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  24279. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  24280. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  24281. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  24282. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  24283. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  24284. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  24285. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  24286. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  24287. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  24288. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  24289. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  24290. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  24291. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  24292. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  24293. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  24294. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  24295. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  24296. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  24297. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  24298. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  24299. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  24300. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  24301. ];
  24302. function SHA512() {
  24303. if (!(this instanceof SHA512))
  24304. return new SHA512();
  24305. BlockHash.call(this);
  24306. this.h = [
  24307. 0x6a09e667, 0xf3bcc908,
  24308. 0xbb67ae85, 0x84caa73b,
  24309. 0x3c6ef372, 0xfe94f82b,
  24310. 0xa54ff53a, 0x5f1d36f1,
  24311. 0x510e527f, 0xade682d1,
  24312. 0x9b05688c, 0x2b3e6c1f,
  24313. 0x1f83d9ab, 0xfb41bd6b,
  24314. 0x5be0cd19, 0x137e2179 ];
  24315. this.k = sha512_K;
  24316. this.W = new Array(160);
  24317. }
  24318. utils.inherits(SHA512, BlockHash);
  24319. module.exports = SHA512;
  24320. SHA512.blockSize = 1024;
  24321. SHA512.outSize = 512;
  24322. SHA512.hmacStrength = 192;
  24323. SHA512.padLength = 128;
  24324. SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
  24325. var W = this.W;
  24326. // 32 x 32bit words
  24327. for (var i = 0; i < 32; i++)
  24328. W[i] = msg[start + i];
  24329. for (; i < W.length; i += 2) {
  24330. var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
  24331. var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
  24332. var c1_hi = W[i - 14]; // i - 7
  24333. var c1_lo = W[i - 13];
  24334. var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
  24335. var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
  24336. var c3_hi = W[i - 32]; // i - 16
  24337. var c3_lo = W[i - 31];
  24338. W[i] = sum64_4_hi(
  24339. c0_hi, c0_lo,
  24340. c1_hi, c1_lo,
  24341. c2_hi, c2_lo,
  24342. c3_hi, c3_lo);
  24343. W[i + 1] = sum64_4_lo(
  24344. c0_hi, c0_lo,
  24345. c1_hi, c1_lo,
  24346. c2_hi, c2_lo,
  24347. c3_hi, c3_lo);
  24348. }
  24349. };
  24350. SHA512.prototype._update = function _update(msg, start) {
  24351. this._prepareBlock(msg, start);
  24352. var W = this.W;
  24353. var ah = this.h[0];
  24354. var al = this.h[1];
  24355. var bh = this.h[2];
  24356. var bl = this.h[3];
  24357. var ch = this.h[4];
  24358. var cl = this.h[5];
  24359. var dh = this.h[6];
  24360. var dl = this.h[7];
  24361. var eh = this.h[8];
  24362. var el = this.h[9];
  24363. var fh = this.h[10];
  24364. var fl = this.h[11];
  24365. var gh = this.h[12];
  24366. var gl = this.h[13];
  24367. var hh = this.h[14];
  24368. var hl = this.h[15];
  24369. assert(this.k.length === W.length);
  24370. for (var i = 0; i < W.length; i += 2) {
  24371. var c0_hi = hh;
  24372. var c0_lo = hl;
  24373. var c1_hi = s1_512_hi(eh, el);
  24374. var c1_lo = s1_512_lo(eh, el);
  24375. var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
  24376. var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
  24377. var c3_hi = this.k[i];
  24378. var c3_lo = this.k[i + 1];
  24379. var c4_hi = W[i];
  24380. var c4_lo = W[i + 1];
  24381. var T1_hi = sum64_5_hi(
  24382. c0_hi, c0_lo,
  24383. c1_hi, c1_lo,
  24384. c2_hi, c2_lo,
  24385. c3_hi, c3_lo,
  24386. c4_hi, c4_lo);
  24387. var T1_lo = sum64_5_lo(
  24388. c0_hi, c0_lo,
  24389. c1_hi, c1_lo,
  24390. c2_hi, c2_lo,
  24391. c3_hi, c3_lo,
  24392. c4_hi, c4_lo);
  24393. c0_hi = s0_512_hi(ah, al);
  24394. c0_lo = s0_512_lo(ah, al);
  24395. c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
  24396. c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
  24397. var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
  24398. var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
  24399. hh = gh;
  24400. hl = gl;
  24401. gh = fh;
  24402. gl = fl;
  24403. fh = eh;
  24404. fl = el;
  24405. eh = sum64_hi(dh, dl, T1_hi, T1_lo);
  24406. el = sum64_lo(dl, dl, T1_hi, T1_lo);
  24407. dh = ch;
  24408. dl = cl;
  24409. ch = bh;
  24410. cl = bl;
  24411. bh = ah;
  24412. bl = al;
  24413. ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
  24414. al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
  24415. }
  24416. sum64(this.h, 0, ah, al);
  24417. sum64(this.h, 2, bh, bl);
  24418. sum64(this.h, 4, ch, cl);
  24419. sum64(this.h, 6, dh, dl);
  24420. sum64(this.h, 8, eh, el);
  24421. sum64(this.h, 10, fh, fl);
  24422. sum64(this.h, 12, gh, gl);
  24423. sum64(this.h, 14, hh, hl);
  24424. };
  24425. SHA512.prototype._digest = function digest(enc) {
  24426. if (enc === 'hex')
  24427. return utils.toHex32(this.h, 'big');
  24428. else
  24429. return utils.split32(this.h, 'big');
  24430. };
  24431. function ch64_hi(xh, xl, yh, yl, zh) {
  24432. var r = (xh & yh) ^ ((~xh) & zh);
  24433. if (r < 0)
  24434. r += 0x100000000;
  24435. return r;
  24436. }
  24437. function ch64_lo(xh, xl, yh, yl, zh, zl) {
  24438. var r = (xl & yl) ^ ((~xl) & zl);
  24439. if (r < 0)
  24440. r += 0x100000000;
  24441. return r;
  24442. }
  24443. function maj64_hi(xh, xl, yh, yl, zh) {
  24444. var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
  24445. if (r < 0)
  24446. r += 0x100000000;
  24447. return r;
  24448. }
  24449. function maj64_lo(xh, xl, yh, yl, zh, zl) {
  24450. var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
  24451. if (r < 0)
  24452. r += 0x100000000;
  24453. return r;
  24454. }
  24455. function s0_512_hi(xh, xl) {
  24456. var c0_hi = rotr64_hi(xh, xl, 28);
  24457. var c1_hi = rotr64_hi(xl, xh, 2); // 34
  24458. var c2_hi = rotr64_hi(xl, xh, 7); // 39
  24459. var r = c0_hi ^ c1_hi ^ c2_hi;
  24460. if (r < 0)
  24461. r += 0x100000000;
  24462. return r;
  24463. }
  24464. function s0_512_lo(xh, xl) {
  24465. var c0_lo = rotr64_lo(xh, xl, 28);
  24466. var c1_lo = rotr64_lo(xl, xh, 2); // 34
  24467. var c2_lo = rotr64_lo(xl, xh, 7); // 39
  24468. var r = c0_lo ^ c1_lo ^ c2_lo;
  24469. if (r < 0)
  24470. r += 0x100000000;
  24471. return r;
  24472. }
  24473. function s1_512_hi(xh, xl) {
  24474. var c0_hi = rotr64_hi(xh, xl, 14);
  24475. var c1_hi = rotr64_hi(xh, xl, 18);
  24476. var c2_hi = rotr64_hi(xl, xh, 9); // 41
  24477. var r = c0_hi ^ c1_hi ^ c2_hi;
  24478. if (r < 0)
  24479. r += 0x100000000;
  24480. return r;
  24481. }
  24482. function s1_512_lo(xh, xl) {
  24483. var c0_lo = rotr64_lo(xh, xl, 14);
  24484. var c1_lo = rotr64_lo(xh, xl, 18);
  24485. var c2_lo = rotr64_lo(xl, xh, 9); // 41
  24486. var r = c0_lo ^ c1_lo ^ c2_lo;
  24487. if (r < 0)
  24488. r += 0x100000000;
  24489. return r;
  24490. }
  24491. function g0_512_hi(xh, xl) {
  24492. var c0_hi = rotr64_hi(xh, xl, 1);
  24493. var c1_hi = rotr64_hi(xh, xl, 8);
  24494. var c2_hi = shr64_hi(xh, xl, 7);
  24495. var r = c0_hi ^ c1_hi ^ c2_hi;
  24496. if (r < 0)
  24497. r += 0x100000000;
  24498. return r;
  24499. }
  24500. function g0_512_lo(xh, xl) {
  24501. var c0_lo = rotr64_lo(xh, xl, 1);
  24502. var c1_lo = rotr64_lo(xh, xl, 8);
  24503. var c2_lo = shr64_lo(xh, xl, 7);
  24504. var r = c0_lo ^ c1_lo ^ c2_lo;
  24505. if (r < 0)
  24506. r += 0x100000000;
  24507. return r;
  24508. }
  24509. function g1_512_hi(xh, xl) {
  24510. var c0_hi = rotr64_hi(xh, xl, 19);
  24511. var c1_hi = rotr64_hi(xl, xh, 29); // 61
  24512. var c2_hi = shr64_hi(xh, xl, 6);
  24513. var r = c0_hi ^ c1_hi ^ c2_hi;
  24514. if (r < 0)
  24515. r += 0x100000000;
  24516. return r;
  24517. }
  24518. function g1_512_lo(xh, xl) {
  24519. var c0_lo = rotr64_lo(xh, xl, 19);
  24520. var c1_lo = rotr64_lo(xl, xh, 29); // 61
  24521. var c2_lo = shr64_lo(xh, xl, 6);
  24522. var r = c0_lo ^ c1_lo ^ c2_lo;
  24523. if (r < 0)
  24524. r += 0x100000000;
  24525. return r;
  24526. }
  24527. /***/ }),
  24528. /* 200 */
  24529. /*!*************************************************!*\
  24530. !*** ./node_modules/hash.js/lib/hash/ripemd.js ***!
  24531. \*************************************************/
  24532. /*! no static exports found */
  24533. /***/ (function(module, exports, __webpack_require__) {
  24534. "use strict";
  24535. var utils = __webpack_require__(/*! ./utils */ 191);
  24536. var common = __webpack_require__(/*! ./common */ 192);
  24537. var rotl32 = utils.rotl32;
  24538. var sum32 = utils.sum32;
  24539. var sum32_3 = utils.sum32_3;
  24540. var sum32_4 = utils.sum32_4;
  24541. var BlockHash = common.BlockHash;
  24542. function RIPEMD160() {
  24543. if (!(this instanceof RIPEMD160))
  24544. return new RIPEMD160();
  24545. BlockHash.call(this);
  24546. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
  24547. this.endian = 'little';
  24548. }
  24549. utils.inherits(RIPEMD160, BlockHash);
  24550. exports.ripemd160 = RIPEMD160;
  24551. RIPEMD160.blockSize = 512;
  24552. RIPEMD160.outSize = 160;
  24553. RIPEMD160.hmacStrength = 192;
  24554. RIPEMD160.padLength = 64;
  24555. RIPEMD160.prototype._update = function update(msg, start) {
  24556. var A = this.h[0];
  24557. var B = this.h[1];
  24558. var C = this.h[2];
  24559. var D = this.h[3];
  24560. var E = this.h[4];
  24561. var Ah = A;
  24562. var Bh = B;
  24563. var Ch = C;
  24564. var Dh = D;
  24565. var Eh = E;
  24566. for (var j = 0; j < 80; j++) {
  24567. var T = sum32(
  24568. rotl32(
  24569. sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
  24570. s[j]),
  24571. E);
  24572. A = E;
  24573. E = D;
  24574. D = rotl32(C, 10);
  24575. C = B;
  24576. B = T;
  24577. T = sum32(
  24578. rotl32(
  24579. sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
  24580. sh[j]),
  24581. Eh);
  24582. Ah = Eh;
  24583. Eh = Dh;
  24584. Dh = rotl32(Ch, 10);
  24585. Ch = Bh;
  24586. Bh = T;
  24587. }
  24588. T = sum32_3(this.h[1], C, Dh);
  24589. this.h[1] = sum32_3(this.h[2], D, Eh);
  24590. this.h[2] = sum32_3(this.h[3], E, Ah);
  24591. this.h[3] = sum32_3(this.h[4], A, Bh);
  24592. this.h[4] = sum32_3(this.h[0], B, Ch);
  24593. this.h[0] = T;
  24594. };
  24595. RIPEMD160.prototype._digest = function digest(enc) {
  24596. if (enc === 'hex')
  24597. return utils.toHex32(this.h, 'little');
  24598. else
  24599. return utils.split32(this.h, 'little');
  24600. };
  24601. function f(j, x, y, z) {
  24602. if (j <= 15)
  24603. return x ^ y ^ z;
  24604. else if (j <= 31)
  24605. return (x & y) | ((~x) & z);
  24606. else if (j <= 47)
  24607. return (x | (~y)) ^ z;
  24608. else if (j <= 63)
  24609. return (x & z) | (y & (~z));
  24610. else
  24611. return x ^ (y | (~z));
  24612. }
  24613. function K(j) {
  24614. if (j <= 15)
  24615. return 0x00000000;
  24616. else if (j <= 31)
  24617. return 0x5a827999;
  24618. else if (j <= 47)
  24619. return 0x6ed9eba1;
  24620. else if (j <= 63)
  24621. return 0x8f1bbcdc;
  24622. else
  24623. return 0xa953fd4e;
  24624. }
  24625. function Kh(j) {
  24626. if (j <= 15)
  24627. return 0x50a28be6;
  24628. else if (j <= 31)
  24629. return 0x5c4dd124;
  24630. else if (j <= 47)
  24631. return 0x6d703ef3;
  24632. else if (j <= 63)
  24633. return 0x7a6d76e9;
  24634. else
  24635. return 0x00000000;
  24636. }
  24637. var r = [
  24638. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  24639. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  24640. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  24641. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  24642. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  24643. ];
  24644. var rh = [
  24645. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  24646. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  24647. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  24648. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  24649. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  24650. ];
  24651. var s = [
  24652. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  24653. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  24654. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  24655. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  24656. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  24657. ];
  24658. var sh = [
  24659. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  24660. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  24661. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  24662. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  24663. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  24664. ];
  24665. /***/ }),
  24666. /* 201 */
  24667. /*!***********************************************!*\
  24668. !*** ./node_modules/hash.js/lib/hash/hmac.js ***!
  24669. \***********************************************/
  24670. /*! no static exports found */
  24671. /***/ (function(module, exports, __webpack_require__) {
  24672. "use strict";
  24673. var utils = __webpack_require__(/*! ./utils */ 191);
  24674. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  24675. function Hmac(hash, key, enc) {
  24676. if (!(this instanceof Hmac))
  24677. return new Hmac(hash, key, enc);
  24678. this.Hash = hash;
  24679. this.blockSize = hash.blockSize / 8;
  24680. this.outSize = hash.outSize / 8;
  24681. this.inner = null;
  24682. this.outer = null;
  24683. this._init(utils.toArray(key, enc));
  24684. }
  24685. module.exports = Hmac;
  24686. Hmac.prototype._init = function init(key) {
  24687. // Shorten key, if needed
  24688. if (key.length > this.blockSize)
  24689. key = new this.Hash().update(key).digest();
  24690. assert(key.length <= this.blockSize);
  24691. // Add padding to key
  24692. for (var i = key.length; i < this.blockSize; i++)
  24693. key.push(0);
  24694. for (i = 0; i < key.length; i++)
  24695. key[i] ^= 0x36;
  24696. this.inner = new this.Hash().update(key);
  24697. // 0x36 ^ 0x5c = 0x6a
  24698. for (i = 0; i < key.length; i++)
  24699. key[i] ^= 0x6a;
  24700. this.outer = new this.Hash().update(key);
  24701. };
  24702. Hmac.prototype.update = function update(msg, enc) {
  24703. this.inner.update(msg, enc);
  24704. return this;
  24705. };
  24706. Hmac.prototype.digest = function digest(enc) {
  24707. this.outer.update(this.inner.digest());
  24708. return this.outer.digest(enc);
  24709. };
  24710. /***/ }),
  24711. /* 202 */
  24712. /*!*********************************************************************!*\
  24713. !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***!
  24714. \*********************************************************************/
  24715. /*! no static exports found */
  24716. /***/ (function(module, exports) {
  24717. module.exports = {
  24718. doubles: {
  24719. step: 4,
  24720. points: [
  24721. [
  24722. 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
  24723. 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
  24724. ],
  24725. [
  24726. '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
  24727. '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
  24728. ],
  24729. [
  24730. '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
  24731. 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
  24732. ],
  24733. [
  24734. '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
  24735. '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
  24736. ],
  24737. [
  24738. '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
  24739. '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
  24740. ],
  24741. [
  24742. '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
  24743. '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
  24744. ],
  24745. [
  24746. 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
  24747. '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
  24748. ],
  24749. [
  24750. '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
  24751. 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
  24752. ],
  24753. [
  24754. 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
  24755. '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
  24756. ],
  24757. [
  24758. 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
  24759. 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
  24760. ],
  24761. [
  24762. 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
  24763. '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
  24764. ],
  24765. [
  24766. '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
  24767. '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
  24768. ],
  24769. [
  24770. '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
  24771. '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
  24772. ],
  24773. [
  24774. '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
  24775. '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
  24776. ],
  24777. [
  24778. '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
  24779. '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
  24780. ],
  24781. [
  24782. '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
  24783. '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
  24784. ],
  24785. [
  24786. '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
  24787. '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
  24788. ],
  24789. [
  24790. '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
  24791. '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
  24792. ],
  24793. [
  24794. '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
  24795. 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
  24796. ],
  24797. [
  24798. 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
  24799. '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
  24800. ],
  24801. [
  24802. 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
  24803. '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
  24804. ],
  24805. [
  24806. '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
  24807. '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
  24808. ],
  24809. [
  24810. '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
  24811. '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
  24812. ],
  24813. [
  24814. 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
  24815. '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
  24816. ],
  24817. [
  24818. '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
  24819. 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
  24820. ],
  24821. [
  24822. 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
  24823. '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
  24824. ],
  24825. [
  24826. 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
  24827. 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
  24828. ],
  24829. [
  24830. 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
  24831. '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
  24832. ],
  24833. [
  24834. 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
  24835. 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
  24836. ],
  24837. [
  24838. 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
  24839. '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
  24840. ],
  24841. [
  24842. '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
  24843. 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
  24844. ],
  24845. [
  24846. '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
  24847. '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
  24848. ],
  24849. [
  24850. 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
  24851. '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
  24852. ],
  24853. [
  24854. '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
  24855. 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
  24856. ],
  24857. [
  24858. 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
  24859. '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
  24860. ],
  24861. [
  24862. 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
  24863. '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
  24864. ],
  24865. [
  24866. 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
  24867. 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
  24868. ],
  24869. [
  24870. '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
  24871. '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
  24872. ],
  24873. [
  24874. '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
  24875. '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
  24876. ],
  24877. [
  24878. '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
  24879. 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
  24880. ],
  24881. [
  24882. '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
  24883. '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
  24884. ],
  24885. [
  24886. 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
  24887. '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
  24888. ],
  24889. [
  24890. '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
  24891. '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
  24892. ],
  24893. [
  24894. '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
  24895. 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
  24896. ],
  24897. [
  24898. '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
  24899. '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
  24900. ],
  24901. [
  24902. 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
  24903. '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
  24904. ],
  24905. [
  24906. '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
  24907. 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
  24908. ],
  24909. [
  24910. 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
  24911. 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
  24912. ],
  24913. [
  24914. 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
  24915. '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
  24916. ],
  24917. [
  24918. '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
  24919. 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
  24920. ],
  24921. [
  24922. '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
  24923. 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
  24924. ],
  24925. [
  24926. 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
  24927. '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
  24928. ],
  24929. [
  24930. 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
  24931. '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
  24932. ],
  24933. [
  24934. 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
  24935. '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
  24936. ],
  24937. [
  24938. '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
  24939. 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
  24940. ],
  24941. [
  24942. '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
  24943. '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
  24944. ],
  24945. [
  24946. 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
  24947. 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
  24948. ],
  24949. [
  24950. '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
  24951. 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
  24952. ],
  24953. [
  24954. '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
  24955. '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
  24956. ],
  24957. [
  24958. '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
  24959. '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
  24960. ],
  24961. [
  24962. 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
  24963. 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
  24964. ],
  24965. [
  24966. '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
  24967. '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
  24968. ],
  24969. [
  24970. '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
  24971. '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
  24972. ],
  24973. [
  24974. 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
  24975. '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
  24976. ],
  24977. [
  24978. 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
  24979. 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
  24980. ]
  24981. ]
  24982. },
  24983. naf: {
  24984. wnd: 7,
  24985. points: [
  24986. [
  24987. 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
  24988. '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
  24989. ],
  24990. [
  24991. '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
  24992. 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
  24993. ],
  24994. [
  24995. '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
  24996. '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
  24997. ],
  24998. [
  24999. 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
  25000. 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
  25001. ],
  25002. [
  25003. '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
  25004. 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
  25005. ],
  25006. [
  25007. 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
  25008. 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
  25009. ],
  25010. [
  25011. 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
  25012. '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
  25013. ],
  25014. [
  25015. 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
  25016. '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
  25017. ],
  25018. [
  25019. '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
  25020. '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
  25021. ],
  25022. [
  25023. '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
  25024. '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
  25025. ],
  25026. [
  25027. '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
  25028. '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
  25029. ],
  25030. [
  25031. '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
  25032. '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
  25033. ],
  25034. [
  25035. 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
  25036. 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
  25037. ],
  25038. [
  25039. 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
  25040. '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
  25041. ],
  25042. [
  25043. '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
  25044. 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
  25045. ],
  25046. [
  25047. '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
  25048. 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
  25049. ],
  25050. [
  25051. '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
  25052. '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
  25053. ],
  25054. [
  25055. '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
  25056. '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
  25057. ],
  25058. [
  25059. '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
  25060. '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
  25061. ],
  25062. [
  25063. '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
  25064. 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
  25065. ],
  25066. [
  25067. 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
  25068. 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
  25069. ],
  25070. [
  25071. '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
  25072. '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
  25073. ],
  25074. [
  25075. '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
  25076. '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
  25077. ],
  25078. [
  25079. 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
  25080. 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
  25081. ],
  25082. [
  25083. '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
  25084. '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
  25085. ],
  25086. [
  25087. 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
  25088. 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
  25089. ],
  25090. [
  25091. 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
  25092. 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
  25093. ],
  25094. [
  25095. '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
  25096. '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
  25097. ],
  25098. [
  25099. '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
  25100. '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
  25101. ],
  25102. [
  25103. '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
  25104. '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
  25105. ],
  25106. [
  25107. 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
  25108. '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
  25109. ],
  25110. [
  25111. '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
  25112. '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
  25113. ],
  25114. [
  25115. 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
  25116. '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
  25117. ],
  25118. [
  25119. '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
  25120. 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
  25121. ],
  25122. [
  25123. '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
  25124. 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
  25125. ],
  25126. [
  25127. 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
  25128. 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
  25129. ],
  25130. [
  25131. '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
  25132. '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
  25133. ],
  25134. [
  25135. '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
  25136. 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
  25137. ],
  25138. [
  25139. 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
  25140. 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
  25141. ],
  25142. [
  25143. '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
  25144. '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
  25145. ],
  25146. [
  25147. '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
  25148. 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
  25149. ],
  25150. [
  25151. '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
  25152. '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
  25153. ],
  25154. [
  25155. '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
  25156. 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
  25157. ],
  25158. [
  25159. 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
  25160. '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
  25161. ],
  25162. [
  25163. '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
  25164. '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
  25165. ],
  25166. [
  25167. '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
  25168. 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
  25169. ],
  25170. [
  25171. '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
  25172. 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
  25173. ],
  25174. [
  25175. 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
  25176. 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
  25177. ],
  25178. [
  25179. 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
  25180. 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
  25181. ],
  25182. [
  25183. '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
  25184. '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
  25185. ],
  25186. [
  25187. '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
  25188. '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
  25189. ],
  25190. [
  25191. 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
  25192. '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
  25193. ],
  25194. [
  25195. 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
  25196. 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
  25197. ],
  25198. [
  25199. '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
  25200. '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
  25201. ],
  25202. [
  25203. '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
  25204. '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
  25205. ],
  25206. [
  25207. 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
  25208. '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
  25209. ],
  25210. [
  25211. '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
  25212. '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
  25213. ],
  25214. [
  25215. 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
  25216. 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
  25217. ],
  25218. [
  25219. '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
  25220. 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
  25221. ],
  25222. [
  25223. '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
  25224. '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
  25225. ],
  25226. [
  25227. 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
  25228. '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
  25229. ],
  25230. [
  25231. 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
  25232. '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
  25233. ],
  25234. [
  25235. '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
  25236. '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
  25237. ],
  25238. [
  25239. '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
  25240. '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
  25241. ],
  25242. [
  25243. '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
  25244. 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
  25245. ],
  25246. [
  25247. '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
  25248. 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
  25249. ],
  25250. [
  25251. '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
  25252. '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
  25253. ],
  25254. [
  25255. '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
  25256. '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
  25257. ],
  25258. [
  25259. '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
  25260. '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
  25261. ],
  25262. [
  25263. '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
  25264. 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
  25265. ],
  25266. [
  25267. 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
  25268. 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
  25269. ],
  25270. [
  25271. '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
  25272. 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
  25273. ],
  25274. [
  25275. 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
  25276. '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
  25277. ],
  25278. [
  25279. 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
  25280. '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
  25281. ],
  25282. [
  25283. 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
  25284. '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
  25285. ],
  25286. [
  25287. 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
  25288. '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
  25289. ],
  25290. [
  25291. '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
  25292. 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
  25293. ],
  25294. [
  25295. '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
  25296. '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
  25297. ],
  25298. [
  25299. '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
  25300. 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
  25301. ],
  25302. [
  25303. 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
  25304. 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
  25305. ],
  25306. [
  25307. 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
  25308. '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
  25309. ],
  25310. [
  25311. 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
  25312. 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
  25313. ],
  25314. [
  25315. 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
  25316. '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
  25317. ],
  25318. [
  25319. '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
  25320. '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
  25321. ],
  25322. [
  25323. 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
  25324. '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
  25325. ],
  25326. [
  25327. 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
  25328. '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
  25329. ],
  25330. [
  25331. '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
  25332. '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
  25333. ],
  25334. [
  25335. '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
  25336. 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
  25337. ],
  25338. [
  25339. 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
  25340. '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
  25341. ],
  25342. [
  25343. 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
  25344. '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
  25345. ],
  25346. [
  25347. 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
  25348. '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
  25349. ],
  25350. [
  25351. '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
  25352. '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
  25353. ],
  25354. [
  25355. 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
  25356. 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
  25357. ],
  25358. [
  25359. '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
  25360. 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
  25361. ],
  25362. [
  25363. 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
  25364. 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
  25365. ],
  25366. [
  25367. 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
  25368. '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
  25369. ],
  25370. [
  25371. '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
  25372. 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
  25373. ],
  25374. [
  25375. 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
  25376. '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
  25377. ],
  25378. [
  25379. 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
  25380. '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
  25381. ],
  25382. [
  25383. 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
  25384. '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
  25385. ],
  25386. [
  25387. '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
  25388. 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
  25389. ],
  25390. [
  25391. '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
  25392. 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
  25393. ],
  25394. [
  25395. 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
  25396. '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
  25397. ],
  25398. [
  25399. '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
  25400. 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
  25401. ],
  25402. [
  25403. '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
  25404. '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
  25405. ],
  25406. [
  25407. '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
  25408. 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
  25409. ],
  25410. [
  25411. 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
  25412. 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
  25413. ],
  25414. [
  25415. '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
  25416. 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
  25417. ],
  25418. [
  25419. '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
  25420. '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
  25421. ],
  25422. [
  25423. '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
  25424. 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
  25425. ],
  25426. [
  25427. '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
  25428. '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
  25429. ],
  25430. [
  25431. 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
  25432. 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
  25433. ],
  25434. [
  25435. '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
  25436. '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
  25437. ],
  25438. [
  25439. 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
  25440. '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
  25441. ],
  25442. [
  25443. '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
  25444. '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
  25445. ],
  25446. [
  25447. 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
  25448. 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
  25449. ],
  25450. [
  25451. 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
  25452. '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
  25453. ],
  25454. [
  25455. 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
  25456. 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
  25457. ],
  25458. [
  25459. '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
  25460. 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
  25461. ],
  25462. [
  25463. '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
  25464. '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
  25465. ],
  25466. [
  25467. '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
  25468. 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
  25469. ],
  25470. [
  25471. '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
  25472. '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
  25473. ],
  25474. [
  25475. '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
  25476. '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
  25477. ],
  25478. [
  25479. '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
  25480. 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
  25481. ],
  25482. [
  25483. '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
  25484. '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
  25485. ],
  25486. [
  25487. '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
  25488. '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
  25489. ],
  25490. [
  25491. '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
  25492. '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
  25493. ]
  25494. ]
  25495. }
  25496. };
  25497. /***/ }),
  25498. /* 203 */
  25499. /*!********************************************************!*\
  25500. !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***!
  25501. \********************************************************/
  25502. /*! no static exports found */
  25503. /***/ (function(module, exports, __webpack_require__) {
  25504. "use strict";
  25505. var BN = __webpack_require__(/*! bn.js */ 169);
  25506. var HmacDRBG = __webpack_require__(/*! hmac-drbg */ 204);
  25507. var utils = __webpack_require__(/*! ../utils */ 182);
  25508. var curves = __webpack_require__(/*! ../curves */ 189);
  25509. var rand = __webpack_require__(/*! brorand */ 173);
  25510. var assert = utils.assert;
  25511. var KeyPair = __webpack_require__(/*! ./key */ 205);
  25512. var Signature = __webpack_require__(/*! ./signature */ 206);
  25513. function EC(options) {
  25514. if (!(this instanceof EC))
  25515. return new EC(options);
  25516. // Shortcut `elliptic.ec(curve-name)`
  25517. if (typeof options === 'string') {
  25518. assert(curves.hasOwnProperty(options), 'Unknown curve ' + options);
  25519. options = curves[options];
  25520. }
  25521. // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
  25522. if (options instanceof curves.PresetCurve)
  25523. options = { curve: options };
  25524. this.curve = options.curve.curve;
  25525. this.n = this.curve.n;
  25526. this.nh = this.n.ushrn(1);
  25527. this.g = this.curve.g;
  25528. // Point on curve
  25529. this.g = options.curve.g;
  25530. this.g.precompute(options.curve.n.bitLength() + 1);
  25531. // Hash for function for DRBG
  25532. this.hash = options.hash || options.curve.hash;
  25533. }
  25534. module.exports = EC;
  25535. EC.prototype.keyPair = function keyPair(options) {
  25536. return new KeyPair(this, options);
  25537. };
  25538. EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
  25539. return KeyPair.fromPrivate(this, priv, enc);
  25540. };
  25541. EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
  25542. return KeyPair.fromPublic(this, pub, enc);
  25543. };
  25544. EC.prototype.genKeyPair = function genKeyPair(options) {
  25545. if (!options)
  25546. options = {};
  25547. // Instantiate Hmac_DRBG
  25548. var drbg = new HmacDRBG({
  25549. hash: this.hash,
  25550. pers: options.pers,
  25551. persEnc: options.persEnc || 'utf8',
  25552. entropy: options.entropy || rand(this.hash.hmacStrength),
  25553. entropyEnc: options.entropy && options.entropyEnc || 'utf8',
  25554. nonce: this.n.toArray()
  25555. });
  25556. var bytes = this.n.byteLength();
  25557. var ns2 = this.n.sub(new BN(2));
  25558. do {
  25559. var priv = new BN(drbg.generate(bytes));
  25560. if (priv.cmp(ns2) > 0)
  25561. continue;
  25562. priv.iaddn(1);
  25563. return this.keyFromPrivate(priv);
  25564. } while (true);
  25565. };
  25566. EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
  25567. var delta = msg.byteLength() * 8 - this.n.bitLength();
  25568. if (delta > 0)
  25569. msg = msg.ushrn(delta);
  25570. if (!truncOnly && msg.cmp(this.n) >= 0)
  25571. return msg.sub(this.n);
  25572. else
  25573. return msg;
  25574. };
  25575. EC.prototype.sign = function sign(msg, key, enc, options) {
  25576. if (typeof enc === 'object') {
  25577. options = enc;
  25578. enc = null;
  25579. }
  25580. if (!options)
  25581. options = {};
  25582. key = this.keyFromPrivate(key, enc);
  25583. msg = this._truncateToN(new BN(msg, 16));
  25584. // Zero-extend key to provide enough entropy
  25585. var bytes = this.n.byteLength();
  25586. var bkey = key.getPrivate().toArray('be', bytes);
  25587. // Zero-extend nonce to have the same byte size as N
  25588. var nonce = msg.toArray('be', bytes);
  25589. // Instantiate Hmac_DRBG
  25590. var drbg = new HmacDRBG({
  25591. hash: this.hash,
  25592. entropy: bkey,
  25593. nonce: nonce,
  25594. pers: options.pers,
  25595. persEnc: options.persEnc || 'utf8'
  25596. });
  25597. // Number of bytes to generate
  25598. var ns1 = this.n.sub(new BN(1));
  25599. for (var iter = 0; true; iter++) {
  25600. var k = options.k ?
  25601. options.k(iter) :
  25602. new BN(drbg.generate(this.n.byteLength()));
  25603. k = this._truncateToN(k, true);
  25604. if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
  25605. continue;
  25606. var kp = this.g.mul(k);
  25607. if (kp.isInfinity())
  25608. continue;
  25609. var kpX = kp.getX();
  25610. var r = kpX.umod(this.n);
  25611. if (r.cmpn(0) === 0)
  25612. continue;
  25613. var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
  25614. s = s.umod(this.n);
  25615. if (s.cmpn(0) === 0)
  25616. continue;
  25617. var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
  25618. (kpX.cmp(r) !== 0 ? 2 : 0);
  25619. // Use complement of `s`, if it is > `n / 2`
  25620. if (options.canonical && s.cmp(this.nh) > 0) {
  25621. s = this.n.sub(s);
  25622. recoveryParam ^= 1;
  25623. }
  25624. return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
  25625. }
  25626. };
  25627. EC.prototype.verify = function verify(msg, signature, key, enc) {
  25628. msg = this._truncateToN(new BN(msg, 16));
  25629. key = this.keyFromPublic(key, enc);
  25630. signature = new Signature(signature, 'hex');
  25631. // Perform primitive values validation
  25632. var r = signature.r;
  25633. var s = signature.s;
  25634. if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
  25635. return false;
  25636. if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
  25637. return false;
  25638. // Validate signature
  25639. var sinv = s.invm(this.n);
  25640. var u1 = sinv.mul(msg).umod(this.n);
  25641. var u2 = sinv.mul(r).umod(this.n);
  25642. if (!this.curve._maxwellTrick) {
  25643. var p = this.g.mulAdd(u1, key.getPublic(), u2);
  25644. if (p.isInfinity())
  25645. return false;
  25646. return p.getX().umod(this.n).cmp(r) === 0;
  25647. }
  25648. // NOTE: Greg Maxwell's trick, inspired by:
  25649. // https://git.io/vad3K
  25650. var p = this.g.jmulAdd(u1, key.getPublic(), u2);
  25651. if (p.isInfinity())
  25652. return false;
  25653. // Compare `p.x` of Jacobian point with `r`,
  25654. // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
  25655. // inverse of `p.z^2`
  25656. return p.eqXToP(r);
  25657. };
  25658. EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
  25659. assert((3 & j) === j, 'The recovery param is more than two bits');
  25660. signature = new Signature(signature, enc);
  25661. var n = this.n;
  25662. var e = new BN(msg);
  25663. var r = signature.r;
  25664. var s = signature.s;
  25665. // A set LSB signifies that the y-coordinate is odd
  25666. var isYOdd = j & 1;
  25667. var isSecondKey = j >> 1;
  25668. if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
  25669. throw new Error('Unable to find sencond key candinate');
  25670. // 1.1. Let x = r + jn.
  25671. if (isSecondKey)
  25672. r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
  25673. else
  25674. r = this.curve.pointFromX(r, isYOdd);
  25675. var rInv = signature.r.invm(n);
  25676. var s1 = n.sub(e).mul(rInv).umod(n);
  25677. var s2 = s.mul(rInv).umod(n);
  25678. // 1.6.1 Compute Q = r^-1 (sR - eG)
  25679. // Q = r^-1 (sR + -eG)
  25680. return this.g.mulAdd(s1, r, s2);
  25681. };
  25682. EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
  25683. signature = new Signature(signature, enc);
  25684. if (signature.recoveryParam !== null)
  25685. return signature.recoveryParam;
  25686. for (var i = 0; i < 4; i++) {
  25687. var Qprime;
  25688. try {
  25689. Qprime = this.recoverPubKey(e, signature, i);
  25690. } catch (e) {
  25691. continue;
  25692. }
  25693. if (Qprime.eq(Q))
  25694. return i;
  25695. }
  25696. throw new Error('Unable to find valid recovery factor');
  25697. };
  25698. /***/ }),
  25699. /* 204 */
  25700. /*!*************************************************!*\
  25701. !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***!
  25702. \*************************************************/
  25703. /*! no static exports found */
  25704. /***/ (function(module, exports, __webpack_require__) {
  25705. "use strict";
  25706. var hash = __webpack_require__(/*! hash.js */ 190);
  25707. var utils = __webpack_require__(/*! minimalistic-crypto-utils */ 183);
  25708. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  25709. function HmacDRBG(options) {
  25710. if (!(this instanceof HmacDRBG))
  25711. return new HmacDRBG(options);
  25712. this.hash = options.hash;
  25713. this.predResist = !!options.predResist;
  25714. this.outLen = this.hash.outSize;
  25715. this.minEntropy = options.minEntropy || this.hash.hmacStrength;
  25716. this._reseed = null;
  25717. this.reseedInterval = null;
  25718. this.K = null;
  25719. this.V = null;
  25720. var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
  25721. var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
  25722. var pers = utils.toArray(options.pers, options.persEnc || 'hex');
  25723. assert(entropy.length >= (this.minEntropy / 8),
  25724. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25725. this._init(entropy, nonce, pers);
  25726. }
  25727. module.exports = HmacDRBG;
  25728. HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
  25729. var seed = entropy.concat(nonce).concat(pers);
  25730. this.K = new Array(this.outLen / 8);
  25731. this.V = new Array(this.outLen / 8);
  25732. for (var i = 0; i < this.V.length; i++) {
  25733. this.K[i] = 0x00;
  25734. this.V[i] = 0x01;
  25735. }
  25736. this._update(seed);
  25737. this._reseed = 1;
  25738. this.reseedInterval = 0x1000000000000; // 2^48
  25739. };
  25740. HmacDRBG.prototype._hmac = function hmac() {
  25741. return new hash.hmac(this.hash, this.K);
  25742. };
  25743. HmacDRBG.prototype._update = function update(seed) {
  25744. var kmac = this._hmac()
  25745. .update(this.V)
  25746. .update([ 0x00 ]);
  25747. if (seed)
  25748. kmac = kmac.update(seed);
  25749. this.K = kmac.digest();
  25750. this.V = this._hmac().update(this.V).digest();
  25751. if (!seed)
  25752. return;
  25753. this.K = this._hmac()
  25754. .update(this.V)
  25755. .update([ 0x01 ])
  25756. .update(seed)
  25757. .digest();
  25758. this.V = this._hmac().update(this.V).digest();
  25759. };
  25760. HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
  25761. // Optional entropy enc
  25762. if (typeof entropyEnc !== 'string') {
  25763. addEnc = add;
  25764. add = entropyEnc;
  25765. entropyEnc = null;
  25766. }
  25767. entropy = utils.toArray(entropy, entropyEnc);
  25768. add = utils.toArray(add, addEnc);
  25769. assert(entropy.length >= (this.minEntropy / 8),
  25770. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25771. this._update(entropy.concat(add || []));
  25772. this._reseed = 1;
  25773. };
  25774. HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
  25775. if (this._reseed > this.reseedInterval)
  25776. throw new Error('Reseed is required');
  25777. // Optional encoding
  25778. if (typeof enc !== 'string') {
  25779. addEnc = add;
  25780. add = enc;
  25781. enc = null;
  25782. }
  25783. // Optional additional data
  25784. if (add) {
  25785. add = utils.toArray(add, addEnc || 'hex');
  25786. this._update(add);
  25787. }
  25788. var temp = [];
  25789. while (temp.length < len) {
  25790. this.V = this._hmac().update(this.V).digest();
  25791. temp = temp.concat(this.V);
  25792. }
  25793. var res = temp.slice(0, len);
  25794. this._update(add);
  25795. this._reseed++;
  25796. return utils.encode(res, enc);
  25797. };
  25798. /***/ }),
  25799. /* 205 */
  25800. /*!******************************************************!*\
  25801. !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***!
  25802. \******************************************************/
  25803. /*! no static exports found */
  25804. /***/ (function(module, exports, __webpack_require__) {
  25805. "use strict";
  25806. var BN = __webpack_require__(/*! bn.js */ 169);
  25807. var utils = __webpack_require__(/*! ../utils */ 182);
  25808. var assert = utils.assert;
  25809. function KeyPair(ec, options) {
  25810. this.ec = ec;
  25811. this.priv = null;
  25812. this.pub = null;
  25813. // KeyPair(ec, { priv: ..., pub: ... })
  25814. if (options.priv)
  25815. this._importPrivate(options.priv, options.privEnc);
  25816. if (options.pub)
  25817. this._importPublic(options.pub, options.pubEnc);
  25818. }
  25819. module.exports = KeyPair;
  25820. KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
  25821. if (pub instanceof KeyPair)
  25822. return pub;
  25823. return new KeyPair(ec, {
  25824. pub: pub,
  25825. pubEnc: enc
  25826. });
  25827. };
  25828. KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
  25829. if (priv instanceof KeyPair)
  25830. return priv;
  25831. return new KeyPair(ec, {
  25832. priv: priv,
  25833. privEnc: enc
  25834. });
  25835. };
  25836. KeyPair.prototype.validate = function validate() {
  25837. var pub = this.getPublic();
  25838. if (pub.isInfinity())
  25839. return { result: false, reason: 'Invalid public key' };
  25840. if (!pub.validate())
  25841. return { result: false, reason: 'Public key is not a point' };
  25842. if (!pub.mul(this.ec.curve.n).isInfinity())
  25843. return { result: false, reason: 'Public key * N != O' };
  25844. return { result: true, reason: null };
  25845. };
  25846. KeyPair.prototype.getPublic = function getPublic(compact, enc) {
  25847. // compact is optional argument
  25848. if (typeof compact === 'string') {
  25849. enc = compact;
  25850. compact = null;
  25851. }
  25852. if (!this.pub)
  25853. this.pub = this.ec.g.mul(this.priv);
  25854. if (!enc)
  25855. return this.pub;
  25856. return this.pub.encode(enc, compact);
  25857. };
  25858. KeyPair.prototype.getPrivate = function getPrivate(enc) {
  25859. if (enc === 'hex')
  25860. return this.priv.toString(16, 2);
  25861. else
  25862. return this.priv;
  25863. };
  25864. KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
  25865. this.priv = new BN(key, enc || 16);
  25866. // Ensure that the priv won't be bigger than n, otherwise we may fail
  25867. // in fixed multiplication method
  25868. this.priv = this.priv.umod(this.ec.curve.n);
  25869. };
  25870. KeyPair.prototype._importPublic = function _importPublic(key, enc) {
  25871. if (key.x || key.y) {
  25872. // Montgomery points only have an `x` coordinate.
  25873. // Weierstrass/Edwards points on the other hand have both `x` and
  25874. // `y` coordinates.
  25875. if (this.ec.curve.type === 'mont') {
  25876. assert(key.x, 'Need x coordinate');
  25877. } else if (this.ec.curve.type === 'short' ||
  25878. this.ec.curve.type === 'edwards') {
  25879. assert(key.x && key.y, 'Need both x and y coordinate');
  25880. }
  25881. this.pub = this.ec.curve.point(key.x, key.y);
  25882. return;
  25883. }
  25884. this.pub = this.ec.curve.decodePoint(key, enc);
  25885. };
  25886. // ECDH
  25887. KeyPair.prototype.derive = function derive(pub) {
  25888. return pub.mul(this.priv).getX();
  25889. };
  25890. // ECDSA
  25891. KeyPair.prototype.sign = function sign(msg, enc, options) {
  25892. return this.ec.sign(msg, this, enc, options);
  25893. };
  25894. KeyPair.prototype.verify = function verify(msg, signature) {
  25895. return this.ec.verify(msg, signature, this);
  25896. };
  25897. KeyPair.prototype.inspect = function inspect() {
  25898. return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
  25899. ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
  25900. };
  25901. /***/ }),
  25902. /* 206 */
  25903. /*!************************************************************!*\
  25904. !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***!
  25905. \************************************************************/
  25906. /*! no static exports found */
  25907. /***/ (function(module, exports, __webpack_require__) {
  25908. "use strict";
  25909. var BN = __webpack_require__(/*! bn.js */ 169);
  25910. var utils = __webpack_require__(/*! ../utils */ 182);
  25911. var assert = utils.assert;
  25912. function Signature(options, enc) {
  25913. if (options instanceof Signature)
  25914. return options;
  25915. if (this._importDER(options, enc))
  25916. return;
  25917. assert(options.r && options.s, 'Signature without r or s');
  25918. this.r = new BN(options.r, 16);
  25919. this.s = new BN(options.s, 16);
  25920. if (options.recoveryParam === undefined)
  25921. this.recoveryParam = null;
  25922. else
  25923. this.recoveryParam = options.recoveryParam;
  25924. }
  25925. module.exports = Signature;
  25926. function Position() {
  25927. this.place = 0;
  25928. }
  25929. function getLength(buf, p) {
  25930. var initial = buf[p.place++];
  25931. if (!(initial & 0x80)) {
  25932. return initial;
  25933. }
  25934. var octetLen = initial & 0xf;
  25935. var val = 0;
  25936. for (var i = 0, off = p.place; i < octetLen; i++, off++) {
  25937. val <<= 8;
  25938. val |= buf[off];
  25939. }
  25940. p.place = off;
  25941. return val;
  25942. }
  25943. function rmPadding(buf) {
  25944. var i = 0;
  25945. var len = buf.length - 1;
  25946. while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
  25947. i++;
  25948. }
  25949. if (i === 0) {
  25950. return buf;
  25951. }
  25952. return buf.slice(i);
  25953. }
  25954. Signature.prototype._importDER = function _importDER(data, enc) {
  25955. data = utils.toArray(data, enc);
  25956. var p = new Position();
  25957. if (data[p.place++] !== 0x30) {
  25958. return false;
  25959. }
  25960. var len = getLength(data, p);
  25961. if ((len + p.place) !== data.length) {
  25962. return false;
  25963. }
  25964. if (data[p.place++] !== 0x02) {
  25965. return false;
  25966. }
  25967. var rlen = getLength(data, p);
  25968. var r = data.slice(p.place, rlen + p.place);
  25969. p.place += rlen;
  25970. if (data[p.place++] !== 0x02) {
  25971. return false;
  25972. }
  25973. var slen = getLength(data, p);
  25974. if (data.length !== slen + p.place) {
  25975. return false;
  25976. }
  25977. var s = data.slice(p.place, slen + p.place);
  25978. if (r[0] === 0 && (r[1] & 0x80)) {
  25979. r = r.slice(1);
  25980. }
  25981. if (s[0] === 0 && (s[1] & 0x80)) {
  25982. s = s.slice(1);
  25983. }
  25984. this.r = new BN(r);
  25985. this.s = new BN(s);
  25986. this.recoveryParam = null;
  25987. return true;
  25988. };
  25989. function constructLength(arr, len) {
  25990. if (len < 0x80) {
  25991. arr.push(len);
  25992. return;
  25993. }
  25994. var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
  25995. arr.push(octets | 0x80);
  25996. while (--octets) {
  25997. arr.push((len >>> (octets << 3)) & 0xff);
  25998. }
  25999. arr.push(len);
  26000. }
  26001. Signature.prototype.toDER = function toDER(enc) {
  26002. var r = this.r.toArray();
  26003. var s = this.s.toArray();
  26004. // Pad values
  26005. if (r[0] & 0x80)
  26006. r = [ 0 ].concat(r);
  26007. // Pad values
  26008. if (s[0] & 0x80)
  26009. s = [ 0 ].concat(s);
  26010. r = rmPadding(r);
  26011. s = rmPadding(s);
  26012. while (!s[0] && !(s[1] & 0x80)) {
  26013. s = s.slice(1);
  26014. }
  26015. var arr = [ 0x02 ];
  26016. constructLength(arr, r.length);
  26017. arr = arr.concat(r);
  26018. arr.push(0x02);
  26019. constructLength(arr, s.length);
  26020. var backHalf = arr.concat(s);
  26021. var res = [ 0x30 ];
  26022. constructLength(res, backHalf.length);
  26023. res = res.concat(backHalf);
  26024. return utils.encode(res, enc);
  26025. };
  26026. /***/ }),
  26027. /* 207 */
  26028. /*!***********************************************************!*\
  26029. !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***!
  26030. \***********************************************************/
  26031. /*! no static exports found */
  26032. /***/ (function(module, exports, __webpack_require__) {
  26033. "use strict";
  26034. var hash = __webpack_require__(/*! hash.js */ 190);
  26035. var curves = __webpack_require__(/*! ../curves */ 189);
  26036. var utils = __webpack_require__(/*! ../utils */ 182);
  26037. var assert = utils.assert;
  26038. var parseBytes = utils.parseBytes;
  26039. var KeyPair = __webpack_require__(/*! ./key */ 208);
  26040. var Signature = __webpack_require__(/*! ./signature */ 209);
  26041. function EDDSA(curve) {
  26042. assert(curve === 'ed25519', 'only tested with ed25519 so far');
  26043. if (!(this instanceof EDDSA))
  26044. return new EDDSA(curve);
  26045. var curve = curves[curve].curve;
  26046. this.curve = curve;
  26047. this.g = curve.g;
  26048. this.g.precompute(curve.n.bitLength() + 1);
  26049. this.pointClass = curve.point().constructor;
  26050. this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
  26051. this.hash = hash.sha512;
  26052. }
  26053. module.exports = EDDSA;
  26054. /**
  26055. * @param {Array|String} message - message bytes
  26056. * @param {Array|String|KeyPair} secret - secret bytes or a keypair
  26057. * @returns {Signature} - signature
  26058. */
  26059. EDDSA.prototype.sign = function sign(message, secret) {
  26060. message = parseBytes(message);
  26061. var key = this.keyFromSecret(secret);
  26062. var r = this.hashInt(key.messagePrefix(), message);
  26063. var R = this.g.mul(r);
  26064. var Rencoded = this.encodePoint(R);
  26065. var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
  26066. .mul(key.priv());
  26067. var S = r.add(s_).umod(this.curve.n);
  26068. return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
  26069. };
  26070. /**
  26071. * @param {Array} message - message bytes
  26072. * @param {Array|String|Signature} sig - sig bytes
  26073. * @param {Array|String|Point|KeyPair} pub - public key
  26074. * @returns {Boolean} - true if public key matches sig of message
  26075. */
  26076. EDDSA.prototype.verify = function verify(message, sig, pub) {
  26077. message = parseBytes(message);
  26078. sig = this.makeSignature(sig);
  26079. var key = this.keyFromPublic(pub);
  26080. var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
  26081. var SG = this.g.mul(sig.S());
  26082. var RplusAh = sig.R().add(key.pub().mul(h));
  26083. return RplusAh.eq(SG);
  26084. };
  26085. EDDSA.prototype.hashInt = function hashInt() {
  26086. var hash = this.hash();
  26087. for (var i = 0; i < arguments.length; i++)
  26088. hash.update(arguments[i]);
  26089. return utils.intFromLE(hash.digest()).umod(this.curve.n);
  26090. };
  26091. EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
  26092. return KeyPair.fromPublic(this, pub);
  26093. };
  26094. EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
  26095. return KeyPair.fromSecret(this, secret);
  26096. };
  26097. EDDSA.prototype.makeSignature = function makeSignature(sig) {
  26098. if (sig instanceof Signature)
  26099. return sig;
  26100. return new Signature(this, sig);
  26101. };
  26102. /**
  26103. * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
  26104. *
  26105. * EDDSA defines methods for encoding and decoding points and integers. These are
  26106. * helper convenience methods, that pass along to utility functions implied
  26107. * parameters.
  26108. *
  26109. */
  26110. EDDSA.prototype.encodePoint = function encodePoint(point) {
  26111. var enc = point.getY().toArray('le', this.encodingLength);
  26112. enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
  26113. return enc;
  26114. };
  26115. EDDSA.prototype.decodePoint = function decodePoint(bytes) {
  26116. bytes = utils.parseBytes(bytes);
  26117. var lastIx = bytes.length - 1;
  26118. var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
  26119. var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
  26120. var y = utils.intFromLE(normed);
  26121. return this.curve.pointFromY(y, xIsOdd);
  26122. };
  26123. EDDSA.prototype.encodeInt = function encodeInt(num) {
  26124. return num.toArray('le', this.encodingLength);
  26125. };
  26126. EDDSA.prototype.decodeInt = function decodeInt(bytes) {
  26127. return utils.intFromLE(bytes);
  26128. };
  26129. EDDSA.prototype.isPoint = function isPoint(val) {
  26130. return val instanceof this.pointClass;
  26131. };
  26132. /***/ }),
  26133. /* 208 */
  26134. /*!*********************************************************!*\
  26135. !*** ./node_modules/elliptic/lib/elliptic/eddsa/key.js ***!
  26136. \*********************************************************/
  26137. /*! no static exports found */
  26138. /***/ (function(module, exports, __webpack_require__) {
  26139. "use strict";
  26140. var utils = __webpack_require__(/*! ../utils */ 182);
  26141. var assert = utils.assert;
  26142. var parseBytes = utils.parseBytes;
  26143. var cachedProperty = utils.cachedProperty;
  26144. /**
  26145. * @param {EDDSA} eddsa - instance
  26146. * @param {Object} params - public/private key parameters
  26147. *
  26148. * @param {Array<Byte>} [params.secret] - secret seed bytes
  26149. * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
  26150. * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
  26151. *
  26152. */
  26153. function KeyPair(eddsa, params) {
  26154. this.eddsa = eddsa;
  26155. this._secret = parseBytes(params.secret);
  26156. if (eddsa.isPoint(params.pub))
  26157. this._pub = params.pub;
  26158. else
  26159. this._pubBytes = parseBytes(params.pub);
  26160. }
  26161. KeyPair.fromPublic = function fromPublic(eddsa, pub) {
  26162. if (pub instanceof KeyPair)
  26163. return pub;
  26164. return new KeyPair(eddsa, { pub: pub });
  26165. };
  26166. KeyPair.fromSecret = function fromSecret(eddsa, secret) {
  26167. if (secret instanceof KeyPair)
  26168. return secret;
  26169. return new KeyPair(eddsa, { secret: secret });
  26170. };
  26171. KeyPair.prototype.secret = function secret() {
  26172. return this._secret;
  26173. };
  26174. cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
  26175. return this.eddsa.encodePoint(this.pub());
  26176. });
  26177. cachedProperty(KeyPair, 'pub', function pub() {
  26178. if (this._pubBytes)
  26179. return this.eddsa.decodePoint(this._pubBytes);
  26180. return this.eddsa.g.mul(this.priv());
  26181. });
  26182. cachedProperty(KeyPair, 'privBytes', function privBytes() {
  26183. var eddsa = this.eddsa;
  26184. var hash = this.hash();
  26185. var lastIx = eddsa.encodingLength - 1;
  26186. var a = hash.slice(0, eddsa.encodingLength);
  26187. a[0] &= 248;
  26188. a[lastIx] &= 127;
  26189. a[lastIx] |= 64;
  26190. return a;
  26191. });
  26192. cachedProperty(KeyPair, 'priv', function priv() {
  26193. return this.eddsa.decodeInt(this.privBytes());
  26194. });
  26195. cachedProperty(KeyPair, 'hash', function hash() {
  26196. return this.eddsa.hash().update(this.secret()).digest();
  26197. });
  26198. cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
  26199. return this.hash().slice(this.eddsa.encodingLength);
  26200. });
  26201. KeyPair.prototype.sign = function sign(message) {
  26202. assert(this._secret, 'KeyPair can only verify');
  26203. return this.eddsa.sign(message, this);
  26204. };
  26205. KeyPair.prototype.verify = function verify(message, sig) {
  26206. return this.eddsa.verify(message, sig, this);
  26207. };
  26208. KeyPair.prototype.getSecret = function getSecret(enc) {
  26209. assert(this._secret, 'KeyPair is public only');
  26210. return utils.encode(this.secret(), enc);
  26211. };
  26212. KeyPair.prototype.getPublic = function getPublic(enc) {
  26213. return utils.encode(this.pubBytes(), enc);
  26214. };
  26215. module.exports = KeyPair;
  26216. /***/ }),
  26217. /* 209 */
  26218. /*!***************************************************************!*\
  26219. !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***!
  26220. \***************************************************************/
  26221. /*! no static exports found */
  26222. /***/ (function(module, exports, __webpack_require__) {
  26223. "use strict";
  26224. var BN = __webpack_require__(/*! bn.js */ 169);
  26225. var utils = __webpack_require__(/*! ../utils */ 182);
  26226. var assert = utils.assert;
  26227. var cachedProperty = utils.cachedProperty;
  26228. var parseBytes = utils.parseBytes;
  26229. /**
  26230. * @param {EDDSA} eddsa - eddsa instance
  26231. * @param {Array<Bytes>|Object} sig -
  26232. * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
  26233. * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
  26234. * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
  26235. * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
  26236. */
  26237. function Signature(eddsa, sig) {
  26238. this.eddsa = eddsa;
  26239. if (typeof sig !== 'object')
  26240. sig = parseBytes(sig);
  26241. if (Array.isArray(sig)) {
  26242. sig = {
  26243. R: sig.slice(0, eddsa.encodingLength),
  26244. S: sig.slice(eddsa.encodingLength)
  26245. };
  26246. }
  26247. assert(sig.R && sig.S, 'Signature without R or S');
  26248. if (eddsa.isPoint(sig.R))
  26249. this._R = sig.R;
  26250. if (sig.S instanceof BN)
  26251. this._S = sig.S;
  26252. this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
  26253. this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
  26254. }
  26255. cachedProperty(Signature, 'S', function S() {
  26256. return this.eddsa.decodeInt(this.Sencoded());
  26257. });
  26258. cachedProperty(Signature, 'R', function R() {
  26259. return this.eddsa.decodePoint(this.Rencoded());
  26260. });
  26261. cachedProperty(Signature, 'Rencoded', function Rencoded() {
  26262. return this.eddsa.encodePoint(this.R());
  26263. });
  26264. cachedProperty(Signature, 'Sencoded', function Sencoded() {
  26265. return this.eddsa.encodeInt(this.S());
  26266. });
  26267. Signature.prototype.toBytes = function toBytes() {
  26268. return this.Rencoded().concat(this.Sencoded());
  26269. };
  26270. Signature.prototype.toHex = function toHex() {
  26271. return utils.encode(this.toBytes(), 'hex').toUpperCase();
  26272. };
  26273. module.exports = Signature;
  26274. /***/ }),
  26275. /* 210 */
  26276. /*!******************************************!*\
  26277. !*** ./node_modules/parse-asn1/index.js ***!
  26278. \******************************************/
  26279. /*! no static exports found */
  26280. /***/ (function(module, exports, __webpack_require__) {
  26281. var asn1 = __webpack_require__(/*! ./asn1 */ 211)
  26282. var aesid = __webpack_require__(/*! ./aesid.json */ 228)
  26283. var fixProc = __webpack_require__(/*! ./fixProc */ 229)
  26284. var ciphers = __webpack_require__(/*! browserify-aes */ 147)
  26285. var compat = __webpack_require__(/*! pbkdf2 */ 132)
  26286. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  26287. module.exports = parseKeys
  26288. function parseKeys (buffer) {
  26289. var password
  26290. if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
  26291. password = buffer.passphrase
  26292. buffer = buffer.key
  26293. }
  26294. if (typeof buffer === 'string') {
  26295. buffer = Buffer.from(buffer)
  26296. }
  26297. var stripped = fixProc(buffer, password)
  26298. var type = stripped.tag
  26299. var data = stripped.data
  26300. var subtype, ndata
  26301. switch (type) {
  26302. case 'CERTIFICATE':
  26303. ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
  26304. // falls through
  26305. case 'PUBLIC KEY':
  26306. if (!ndata) {
  26307. ndata = asn1.PublicKey.decode(data, 'der')
  26308. }
  26309. subtype = ndata.algorithm.algorithm.join('.')
  26310. switch (subtype) {
  26311. case '1.2.840.113549.1.1.1':
  26312. return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
  26313. case '1.2.840.10045.2.1':
  26314. ndata.subjectPrivateKey = ndata.subjectPublicKey
  26315. return {
  26316. type: 'ec',
  26317. data: ndata
  26318. }
  26319. case '1.2.840.10040.4.1':
  26320. ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
  26321. return {
  26322. type: 'dsa',
  26323. data: ndata.algorithm.params
  26324. }
  26325. default: throw new Error('unknown key id ' + subtype)
  26326. }
  26327. throw new Error('unknown key type ' + type)
  26328. case 'ENCRYPTED PRIVATE KEY':
  26329. data = asn1.EncryptedPrivateKey.decode(data, 'der')
  26330. data = decrypt(data, password)
  26331. // falls through
  26332. case 'PRIVATE KEY':
  26333. ndata = asn1.PrivateKey.decode(data, 'der')
  26334. subtype = ndata.algorithm.algorithm.join('.')
  26335. switch (subtype) {
  26336. case '1.2.840.113549.1.1.1':
  26337. return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
  26338. case '1.2.840.10045.2.1':
  26339. return {
  26340. curve: ndata.algorithm.curve,
  26341. privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
  26342. }
  26343. case '1.2.840.10040.4.1':
  26344. ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
  26345. return {
  26346. type: 'dsa',
  26347. params: ndata.algorithm.params
  26348. }
  26349. default: throw new Error('unknown key id ' + subtype)
  26350. }
  26351. throw new Error('unknown key type ' + type)
  26352. case 'RSA PUBLIC KEY':
  26353. return asn1.RSAPublicKey.decode(data, 'der')
  26354. case 'RSA PRIVATE KEY':
  26355. return asn1.RSAPrivateKey.decode(data, 'der')
  26356. case 'DSA PRIVATE KEY':
  26357. return {
  26358. type: 'dsa',
  26359. params: asn1.DSAPrivateKey.decode(data, 'der')
  26360. }
  26361. case 'EC PRIVATE KEY':
  26362. data = asn1.ECPrivateKey.decode(data, 'der')
  26363. return {
  26364. curve: data.parameters.value,
  26365. privateKey: data.privateKey
  26366. }
  26367. default: throw new Error('unknown key type ' + type)
  26368. }
  26369. }
  26370. parseKeys.signature = asn1.signature
  26371. function decrypt (data, password) {
  26372. var salt = data.algorithm.decrypt.kde.kdeparams.salt
  26373. var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
  26374. var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
  26375. var iv = data.algorithm.decrypt.cipher.iv
  26376. var cipherText = data.subjectPrivateKey
  26377. var keylen = parseInt(algo.split('-')[1], 10) / 8
  26378. var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')
  26379. var cipher = ciphers.createDecipheriv(algo, key, iv)
  26380. var out = []
  26381. out.push(cipher.update(cipherText))
  26382. out.push(cipher.final())
  26383. return Buffer.concat(out)
  26384. }
  26385. /***/ }),
  26386. /* 211 */
  26387. /*!*****************************************!*\
  26388. !*** ./node_modules/parse-asn1/asn1.js ***!
  26389. \*****************************************/
  26390. /*! no static exports found */
  26391. /***/ (function(module, exports, __webpack_require__) {
  26392. "use strict";
  26393. // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
  26394. // Fedor, you are amazing.
  26395. var asn1 = __webpack_require__(/*! asn1.js */ 212)
  26396. exports.certificate = __webpack_require__(/*! ./certificate */ 227)
  26397. var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
  26398. this.seq().obj(
  26399. this.key('version').int(),
  26400. this.key('modulus').int(),
  26401. this.key('publicExponent').int(),
  26402. this.key('privateExponent').int(),
  26403. this.key('prime1').int(),
  26404. this.key('prime2').int(),
  26405. this.key('exponent1').int(),
  26406. this.key('exponent2').int(),
  26407. this.key('coefficient').int()
  26408. )
  26409. })
  26410. exports.RSAPrivateKey = RSAPrivateKey
  26411. var RSAPublicKey = asn1.define('RSAPublicKey', function () {
  26412. this.seq().obj(
  26413. this.key('modulus').int(),
  26414. this.key('publicExponent').int()
  26415. )
  26416. })
  26417. exports.RSAPublicKey = RSAPublicKey
  26418. var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
  26419. this.seq().obj(
  26420. this.key('algorithm').use(AlgorithmIdentifier),
  26421. this.key('subjectPublicKey').bitstr()
  26422. )
  26423. })
  26424. exports.PublicKey = PublicKey
  26425. var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
  26426. this.seq().obj(
  26427. this.key('algorithm').objid(),
  26428. this.key('none').null_().optional(),
  26429. this.key('curve').objid().optional(),
  26430. this.key('params').seq().obj(
  26431. this.key('p').int(),
  26432. this.key('q').int(),
  26433. this.key('g').int()
  26434. ).optional()
  26435. )
  26436. })
  26437. var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
  26438. this.seq().obj(
  26439. this.key('version').int(),
  26440. this.key('algorithm').use(AlgorithmIdentifier),
  26441. this.key('subjectPrivateKey').octstr()
  26442. )
  26443. })
  26444. exports.PrivateKey = PrivateKeyInfo
  26445. var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
  26446. this.seq().obj(
  26447. this.key('algorithm').seq().obj(
  26448. this.key('id').objid(),
  26449. this.key('decrypt').seq().obj(
  26450. this.key('kde').seq().obj(
  26451. this.key('id').objid(),
  26452. this.key('kdeparams').seq().obj(
  26453. this.key('salt').octstr(),
  26454. this.key('iters').int()
  26455. )
  26456. ),
  26457. this.key('cipher').seq().obj(
  26458. this.key('algo').objid(),
  26459. this.key('iv').octstr()
  26460. )
  26461. )
  26462. ),
  26463. this.key('subjectPrivateKey').octstr()
  26464. )
  26465. })
  26466. exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
  26467. var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
  26468. this.seq().obj(
  26469. this.key('version').int(),
  26470. this.key('p').int(),
  26471. this.key('q').int(),
  26472. this.key('g').int(),
  26473. this.key('pub_key').int(),
  26474. this.key('priv_key').int()
  26475. )
  26476. })
  26477. exports.DSAPrivateKey = DSAPrivateKey
  26478. exports.DSAparam = asn1.define('DSAparam', function () {
  26479. this.int()
  26480. })
  26481. var ECPrivateKey = asn1.define('ECPrivateKey', function () {
  26482. this.seq().obj(
  26483. this.key('version').int(),
  26484. this.key('privateKey').octstr(),
  26485. this.key('parameters').optional().explicit(0).use(ECParameters),
  26486. this.key('publicKey').optional().explicit(1).bitstr()
  26487. )
  26488. })
  26489. exports.ECPrivateKey = ECPrivateKey
  26490. var ECParameters = asn1.define('ECParameters', function () {
  26491. this.choice({
  26492. namedCurve: this.objid()
  26493. })
  26494. })
  26495. exports.signature = asn1.define('signature', function () {
  26496. this.seq().obj(
  26497. this.key('r').int(),
  26498. this.key('s').int()
  26499. )
  26500. })
  26501. /***/ }),
  26502. /* 212 */
  26503. /*!******************************************!*\
  26504. !*** ./node_modules/asn1.js/lib/asn1.js ***!
  26505. \******************************************/
  26506. /*! no static exports found */
  26507. /***/ (function(module, exports, __webpack_require__) {
  26508. var asn1 = exports;
  26509. asn1.bignum = __webpack_require__(/*! bn.js */ 169);
  26510. asn1.define = __webpack_require__(/*! ./asn1/api */ 213).define;
  26511. asn1.base = __webpack_require__(/*! ./asn1/base */ 215);
  26512. asn1.constants = __webpack_require__(/*! ./asn1/constants */ 219);
  26513. asn1.decoders = __webpack_require__(/*! ./asn1/decoders */ 221);
  26514. asn1.encoders = __webpack_require__(/*! ./asn1/encoders */ 224);
  26515. /***/ }),
  26516. /* 213 */
  26517. /*!**********************************************!*\
  26518. !*** ./node_modules/asn1.js/lib/asn1/api.js ***!
  26519. \**********************************************/
  26520. /*! no static exports found */
  26521. /***/ (function(module, exports, __webpack_require__) {
  26522. var asn1 = __webpack_require__(/*! ../asn1 */ 212);
  26523. var inherits = __webpack_require__(/*! inherits */ 93);
  26524. var api = exports;
  26525. api.define = function define(name, body) {
  26526. return new Entity(name, body);
  26527. };
  26528. function Entity(name, body) {
  26529. this.name = name;
  26530. this.body = body;
  26531. this.decoders = {};
  26532. this.encoders = {};
  26533. };
  26534. Entity.prototype._createNamed = function createNamed(base) {
  26535. var named;
  26536. try {
  26537. named = __webpack_require__(/*! vm */ 214).runInThisContext(
  26538. '(function ' + this.name + '(entity) {\n' +
  26539. ' this._initNamed(entity);\n' +
  26540. '})'
  26541. );
  26542. } catch (e) {
  26543. named = function (entity) {
  26544. this._initNamed(entity);
  26545. };
  26546. }
  26547. inherits(named, base);
  26548. named.prototype._initNamed = function initnamed(entity) {
  26549. base.call(this, entity);
  26550. };
  26551. return new named(this);
  26552. };
  26553. Entity.prototype._getDecoder = function _getDecoder(enc) {
  26554. enc = enc || 'der';
  26555. // Lazily create decoder
  26556. if (!this.decoders.hasOwnProperty(enc))
  26557. this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
  26558. return this.decoders[enc];
  26559. };
  26560. Entity.prototype.decode = function decode(data, enc, options) {
  26561. return this._getDecoder(enc).decode(data, options);
  26562. };
  26563. Entity.prototype._getEncoder = function _getEncoder(enc) {
  26564. enc = enc || 'der';
  26565. // Lazily create encoder
  26566. if (!this.encoders.hasOwnProperty(enc))
  26567. this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
  26568. return this.encoders[enc];
  26569. };
  26570. Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
  26571. return this._getEncoder(enc).encode(data, reporter);
  26572. };
  26573. /***/ }),
  26574. /* 214 */
  26575. /*!*********************************************!*\
  26576. !*** ./node_modules/vm-browserify/index.js ***!
  26577. \*********************************************/
  26578. /*! no static exports found */
  26579. /***/ (function(module, exports) {
  26580. var indexOf = function (xs, item) {
  26581. if (xs.indexOf) return xs.indexOf(item);
  26582. else for (var i = 0; i < xs.length; i++) {
  26583. if (xs[i] === item) return i;
  26584. }
  26585. return -1;
  26586. };
  26587. var Object_keys = function (obj) {
  26588. if (Object.keys) return Object.keys(obj)
  26589. else {
  26590. var res = [];
  26591. for (var key in obj) res.push(key)
  26592. return res;
  26593. }
  26594. };
  26595. var forEach = function (xs, fn) {
  26596. if (xs.forEach) return xs.forEach(fn)
  26597. else for (var i = 0; i < xs.length; i++) {
  26598. fn(xs[i], i, xs);
  26599. }
  26600. };
  26601. var defineProp = (function() {
  26602. try {
  26603. Object.defineProperty({}, '_', {});
  26604. return function(obj, name, value) {
  26605. Object.defineProperty(obj, name, {
  26606. writable: true,
  26607. enumerable: false,
  26608. configurable: true,
  26609. value: value
  26610. })
  26611. };
  26612. } catch(e) {
  26613. return function(obj, name, value) {
  26614. obj[name] = value;
  26615. };
  26616. }
  26617. }());
  26618. var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
  26619. 'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
  26620. 'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
  26621. 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
  26622. 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
  26623. function Context() {}
  26624. Context.prototype = {};
  26625. var Script = exports.Script = function NodeScript (code) {
  26626. if (!(this instanceof Script)) return new Script(code);
  26627. this.code = code;
  26628. };
  26629. Script.prototype.runInContext = function (context) {
  26630. if (!(context instanceof Context)) {
  26631. throw new TypeError("needs a 'context' argument.");
  26632. }
  26633. var iframe = document.createElement('iframe');
  26634. if (!iframe.style) iframe.style = {};
  26635. iframe.style.display = 'none';
  26636. document.body.appendChild(iframe);
  26637. var win = iframe.contentWindow;
  26638. var wEval = win.eval, wExecScript = win.execScript;
  26639. if (!wEval && wExecScript) {
  26640. // win.eval() magically appears when this is called in IE:
  26641. wExecScript.call(win, 'null');
  26642. wEval = win.eval;
  26643. }
  26644. forEach(Object_keys(context), function (key) {
  26645. win[key] = context[key];
  26646. });
  26647. forEach(globals, function (key) {
  26648. if (context[key]) {
  26649. win[key] = context[key];
  26650. }
  26651. });
  26652. var winKeys = Object_keys(win);
  26653. var res = wEval.call(win, this.code);
  26654. forEach(Object_keys(win), function (key) {
  26655. // Avoid copying circular objects like `top` and `window` by only
  26656. // updating existing context properties or new properties in the `win`
  26657. // that was only introduced after the eval.
  26658. if (key in context || indexOf(winKeys, key) === -1) {
  26659. context[key] = win[key];
  26660. }
  26661. });
  26662. forEach(globals, function (key) {
  26663. if (!(key in context)) {
  26664. defineProp(context, key, win[key]);
  26665. }
  26666. });
  26667. document.body.removeChild(iframe);
  26668. return res;
  26669. };
  26670. Script.prototype.runInThisContext = function () {
  26671. return eval(this.code); // maybe...
  26672. };
  26673. Script.prototype.runInNewContext = function (context) {
  26674. var ctx = Script.createContext(context);
  26675. var res = this.runInContext(ctx);
  26676. if (context) {
  26677. forEach(Object_keys(ctx), function (key) {
  26678. context[key] = ctx[key];
  26679. });
  26680. }
  26681. return res;
  26682. };
  26683. forEach(Object_keys(Script.prototype), function (name) {
  26684. exports[name] = Script[name] = function (code) {
  26685. var s = Script(code);
  26686. return s[name].apply(s, [].slice.call(arguments, 1));
  26687. };
  26688. });
  26689. exports.isContext = function (context) {
  26690. return context instanceof Context;
  26691. };
  26692. exports.createScript = function (code) {
  26693. return exports.Script(code);
  26694. };
  26695. exports.createContext = Script.createContext = function (context) {
  26696. var copy = new Context();
  26697. if(typeof context === 'object') {
  26698. forEach(Object_keys(context), function (key) {
  26699. copy[key] = context[key];
  26700. });
  26701. }
  26702. return copy;
  26703. };
  26704. /***/ }),
  26705. /* 215 */
  26706. /*!*****************************************************!*\
  26707. !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***!
  26708. \*****************************************************/
  26709. /*! no static exports found */
  26710. /***/ (function(module, exports, __webpack_require__) {
  26711. var base = exports;
  26712. base.Reporter = __webpack_require__(/*! ./reporter */ 216).Reporter;
  26713. base.DecoderBuffer = __webpack_require__(/*! ./buffer */ 217).DecoderBuffer;
  26714. base.EncoderBuffer = __webpack_require__(/*! ./buffer */ 217).EncoderBuffer;
  26715. base.Node = __webpack_require__(/*! ./node */ 218);
  26716. /***/ }),
  26717. /* 216 */
  26718. /*!********************************************************!*\
  26719. !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***!
  26720. \********************************************************/
  26721. /*! no static exports found */
  26722. /***/ (function(module, exports, __webpack_require__) {
  26723. var inherits = __webpack_require__(/*! inherits */ 93);
  26724. function Reporter(options) {
  26725. this._reporterState = {
  26726. obj: null,
  26727. path: [],
  26728. options: options || {},
  26729. errors: []
  26730. };
  26731. }
  26732. exports.Reporter = Reporter;
  26733. Reporter.prototype.isError = function isError(obj) {
  26734. return obj instanceof ReporterError;
  26735. };
  26736. Reporter.prototype.save = function save() {
  26737. var state = this._reporterState;
  26738. return { obj: state.obj, pathLen: state.path.length };
  26739. };
  26740. Reporter.prototype.restore = function restore(data) {
  26741. var state = this._reporterState;
  26742. state.obj = data.obj;
  26743. state.path = state.path.slice(0, data.pathLen);
  26744. };
  26745. Reporter.prototype.enterKey = function enterKey(key) {
  26746. return this._reporterState.path.push(key);
  26747. };
  26748. Reporter.prototype.exitKey = function exitKey(index) {
  26749. var state = this._reporterState;
  26750. state.path = state.path.slice(0, index - 1);
  26751. };
  26752. Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
  26753. var state = this._reporterState;
  26754. this.exitKey(index);
  26755. if (state.obj !== null)
  26756. state.obj[key] = value;
  26757. };
  26758. Reporter.prototype.path = function path() {
  26759. return this._reporterState.path.join('/');
  26760. };
  26761. Reporter.prototype.enterObject = function enterObject() {
  26762. var state = this._reporterState;
  26763. var prev = state.obj;
  26764. state.obj = {};
  26765. return prev;
  26766. };
  26767. Reporter.prototype.leaveObject = function leaveObject(prev) {
  26768. var state = this._reporterState;
  26769. var now = state.obj;
  26770. state.obj = prev;
  26771. return now;
  26772. };
  26773. Reporter.prototype.error = function error(msg) {
  26774. var err;
  26775. var state = this._reporterState;
  26776. var inherited = msg instanceof ReporterError;
  26777. if (inherited) {
  26778. err = msg;
  26779. } else {
  26780. err = new ReporterError(state.path.map(function(elem) {
  26781. return '[' + JSON.stringify(elem) + ']';
  26782. }).join(''), msg.message || msg, msg.stack);
  26783. }
  26784. if (!state.options.partial)
  26785. throw err;
  26786. if (!inherited)
  26787. state.errors.push(err);
  26788. return err;
  26789. };
  26790. Reporter.prototype.wrapResult = function wrapResult(result) {
  26791. var state = this._reporterState;
  26792. if (!state.options.partial)
  26793. return result;
  26794. return {
  26795. result: this.isError(result) ? null : result,
  26796. errors: state.errors
  26797. };
  26798. };
  26799. function ReporterError(path, msg) {
  26800. this.path = path;
  26801. this.rethrow(msg);
  26802. };
  26803. inherits(ReporterError, Error);
  26804. ReporterError.prototype.rethrow = function rethrow(msg) {
  26805. this.message = msg + ' at: ' + (this.path || '(shallow)');
  26806. if (Error.captureStackTrace)
  26807. Error.captureStackTrace(this, ReporterError);
  26808. if (!this.stack) {
  26809. try {
  26810. // IE only adds stack when thrown
  26811. throw new Error(this.message);
  26812. } catch (e) {
  26813. this.stack = e.stack;
  26814. }
  26815. }
  26816. return this;
  26817. };
  26818. /***/ }),
  26819. /* 217 */
  26820. /*!******************************************************!*\
  26821. !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***!
  26822. \******************************************************/
  26823. /*! no static exports found */
  26824. /***/ (function(module, exports, __webpack_require__) {
  26825. var inherits = __webpack_require__(/*! inherits */ 93);
  26826. var Reporter = __webpack_require__(/*! ../base */ 215).Reporter;
  26827. var Buffer = __webpack_require__(/*! buffer */ 88).Buffer;
  26828. function DecoderBuffer(base, options) {
  26829. Reporter.call(this, options);
  26830. if (!Buffer.isBuffer(base)) {
  26831. this.error('Input not Buffer');
  26832. return;
  26833. }
  26834. this.base = base;
  26835. this.offset = 0;
  26836. this.length = base.length;
  26837. }
  26838. inherits(DecoderBuffer, Reporter);
  26839. exports.DecoderBuffer = DecoderBuffer;
  26840. DecoderBuffer.prototype.save = function save() {
  26841. return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
  26842. };
  26843. DecoderBuffer.prototype.restore = function restore(save) {
  26844. // Return skipped data
  26845. var res = new DecoderBuffer(this.base);
  26846. res.offset = save.offset;
  26847. res.length = this.offset;
  26848. this.offset = save.offset;
  26849. Reporter.prototype.restore.call(this, save.reporter);
  26850. return res;
  26851. };
  26852. DecoderBuffer.prototype.isEmpty = function isEmpty() {
  26853. return this.offset === this.length;
  26854. };
  26855. DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
  26856. if (this.offset + 1 <= this.length)
  26857. return this.base.readUInt8(this.offset++, true);
  26858. else
  26859. return this.error(fail || 'DecoderBuffer overrun');
  26860. }
  26861. DecoderBuffer.prototype.skip = function skip(bytes, fail) {
  26862. if (!(this.offset + bytes <= this.length))
  26863. return this.error(fail || 'DecoderBuffer overrun');
  26864. var res = new DecoderBuffer(this.base);
  26865. // Share reporter state
  26866. res._reporterState = this._reporterState;
  26867. res.offset = this.offset;
  26868. res.length = this.offset + bytes;
  26869. this.offset += bytes;
  26870. return res;
  26871. }
  26872. DecoderBuffer.prototype.raw = function raw(save) {
  26873. return this.base.slice(save ? save.offset : this.offset, this.length);
  26874. }
  26875. function EncoderBuffer(value, reporter) {
  26876. if (Array.isArray(value)) {
  26877. this.length = 0;
  26878. this.value = value.map(function(item) {
  26879. if (!(item instanceof EncoderBuffer))
  26880. item = new EncoderBuffer(item, reporter);
  26881. this.length += item.length;
  26882. return item;
  26883. }, this);
  26884. } else if (typeof value === 'number') {
  26885. if (!(0 <= value && value <= 0xff))
  26886. return reporter.error('non-byte EncoderBuffer value');
  26887. this.value = value;
  26888. this.length = 1;
  26889. } else if (typeof value === 'string') {
  26890. this.value = value;
  26891. this.length = Buffer.byteLength(value);
  26892. } else if (Buffer.isBuffer(value)) {
  26893. this.value = value;
  26894. this.length = value.length;
  26895. } else {
  26896. return reporter.error('Unsupported type: ' + typeof value);
  26897. }
  26898. }
  26899. exports.EncoderBuffer = EncoderBuffer;
  26900. EncoderBuffer.prototype.join = function join(out, offset) {
  26901. if (!out)
  26902. out = new Buffer(this.length);
  26903. if (!offset)
  26904. offset = 0;
  26905. if (this.length === 0)
  26906. return out;
  26907. if (Array.isArray(this.value)) {
  26908. this.value.forEach(function(item) {
  26909. item.join(out, offset);
  26910. offset += item.length;
  26911. });
  26912. } else {
  26913. if (typeof this.value === 'number')
  26914. out[offset] = this.value;
  26915. else if (typeof this.value === 'string')
  26916. out.write(this.value, offset);
  26917. else if (Buffer.isBuffer(this.value))
  26918. this.value.copy(out, offset);
  26919. offset += this.length;
  26920. }
  26921. return out;
  26922. };
  26923. /***/ }),
  26924. /* 218 */
  26925. /*!****************************************************!*\
  26926. !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***!
  26927. \****************************************************/
  26928. /*! no static exports found */
  26929. /***/ (function(module, exports, __webpack_require__) {
  26930. var Reporter = __webpack_require__(/*! ../base */ 215).Reporter;
  26931. var EncoderBuffer = __webpack_require__(/*! ../base */ 215).EncoderBuffer;
  26932. var DecoderBuffer = __webpack_require__(/*! ../base */ 215).DecoderBuffer;
  26933. var assert = __webpack_require__(/*! minimalistic-assert */ 143);
  26934. // Supported tags
  26935. var tags = [
  26936. 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
  26937. 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
  26938. 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
  26939. 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
  26940. ];
  26941. // Public methods list
  26942. var methods = [
  26943. 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
  26944. 'any', 'contains'
  26945. ].concat(tags);
  26946. // Overrided methods list
  26947. var overrided = [
  26948. '_peekTag', '_decodeTag', '_use',
  26949. '_decodeStr', '_decodeObjid', '_decodeTime',
  26950. '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
  26951. '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
  26952. '_encodeNull', '_encodeInt', '_encodeBool'
  26953. ];
  26954. function Node(enc, parent) {
  26955. var state = {};
  26956. this._baseState = state;
  26957. state.enc = enc;
  26958. state.parent = parent || null;
  26959. state.children = null;
  26960. // State
  26961. state.tag = null;
  26962. state.args = null;
  26963. state.reverseArgs = null;
  26964. state.choice = null;
  26965. state.optional = false;
  26966. state.any = false;
  26967. state.obj = false;
  26968. state.use = null;
  26969. state.useDecoder = null;
  26970. state.key = null;
  26971. state['default'] = null;
  26972. state.explicit = null;
  26973. state.implicit = null;
  26974. state.contains = null;
  26975. // Should create new instance on each method
  26976. if (!state.parent) {
  26977. state.children = [];
  26978. this._wrap();
  26979. }
  26980. }
  26981. module.exports = Node;
  26982. var stateProps = [
  26983. 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
  26984. 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
  26985. 'implicit', 'contains'
  26986. ];
  26987. Node.prototype.clone = function clone() {
  26988. var state = this._baseState;
  26989. var cstate = {};
  26990. stateProps.forEach(function(prop) {
  26991. cstate[prop] = state[prop];
  26992. });
  26993. var res = new this.constructor(cstate.parent);
  26994. res._baseState = cstate;
  26995. return res;
  26996. };
  26997. Node.prototype._wrap = function wrap() {
  26998. var state = this._baseState;
  26999. methods.forEach(function(method) {
  27000. this[method] = function _wrappedMethod() {
  27001. var clone = new this.constructor(this);
  27002. state.children.push(clone);
  27003. return clone[method].apply(clone, arguments);
  27004. };
  27005. }, this);
  27006. };
  27007. Node.prototype._init = function init(body) {
  27008. var state = this._baseState;
  27009. assert(state.parent === null);
  27010. body.call(this);
  27011. // Filter children
  27012. state.children = state.children.filter(function(child) {
  27013. return child._baseState.parent === this;
  27014. }, this);
  27015. assert.equal(state.children.length, 1, 'Root node can have only one child');
  27016. };
  27017. Node.prototype._useArgs = function useArgs(args) {
  27018. var state = this._baseState;
  27019. // Filter children and args
  27020. var children = args.filter(function(arg) {
  27021. return arg instanceof this.constructor;
  27022. }, this);
  27023. args = args.filter(function(arg) {
  27024. return !(arg instanceof this.constructor);
  27025. }, this);
  27026. if (children.length !== 0) {
  27027. assert(state.children === null);
  27028. state.children = children;
  27029. // Replace parent to maintain backward link
  27030. children.forEach(function(child) {
  27031. child._baseState.parent = this;
  27032. }, this);
  27033. }
  27034. if (args.length !== 0) {
  27035. assert(state.args === null);
  27036. state.args = args;
  27037. state.reverseArgs = args.map(function(arg) {
  27038. if (typeof arg !== 'object' || arg.constructor !== Object)
  27039. return arg;
  27040. var res = {};
  27041. Object.keys(arg).forEach(function(key) {
  27042. if (key == (key | 0))
  27043. key |= 0;
  27044. var value = arg[key];
  27045. res[value] = key;
  27046. });
  27047. return res;
  27048. });
  27049. }
  27050. };
  27051. //
  27052. // Overrided methods
  27053. //
  27054. overrided.forEach(function(method) {
  27055. Node.prototype[method] = function _overrided() {
  27056. var state = this._baseState;
  27057. throw new Error(method + ' not implemented for encoding: ' + state.enc);
  27058. };
  27059. });
  27060. //
  27061. // Public methods
  27062. //
  27063. tags.forEach(function(tag) {
  27064. Node.prototype[tag] = function _tagMethod() {
  27065. var state = this._baseState;
  27066. var args = Array.prototype.slice.call(arguments);
  27067. assert(state.tag === null);
  27068. state.tag = tag;
  27069. this._useArgs(args);
  27070. return this;
  27071. };
  27072. });
  27073. Node.prototype.use = function use(item) {
  27074. assert(item);
  27075. var state = this._baseState;
  27076. assert(state.use === null);
  27077. state.use = item;
  27078. return this;
  27079. };
  27080. Node.prototype.optional = function optional() {
  27081. var state = this._baseState;
  27082. state.optional = true;
  27083. return this;
  27084. };
  27085. Node.prototype.def = function def(val) {
  27086. var state = this._baseState;
  27087. assert(state['default'] === null);
  27088. state['default'] = val;
  27089. state.optional = true;
  27090. return this;
  27091. };
  27092. Node.prototype.explicit = function explicit(num) {
  27093. var state = this._baseState;
  27094. assert(state.explicit === null && state.implicit === null);
  27095. state.explicit = num;
  27096. return this;
  27097. };
  27098. Node.prototype.implicit = function implicit(num) {
  27099. var state = this._baseState;
  27100. assert(state.explicit === null && state.implicit === null);
  27101. state.implicit = num;
  27102. return this;
  27103. };
  27104. Node.prototype.obj = function obj() {
  27105. var state = this._baseState;
  27106. var args = Array.prototype.slice.call(arguments);
  27107. state.obj = true;
  27108. if (args.length !== 0)
  27109. this._useArgs(args);
  27110. return this;
  27111. };
  27112. Node.prototype.key = function key(newKey) {
  27113. var state = this._baseState;
  27114. assert(state.key === null);
  27115. state.key = newKey;
  27116. return this;
  27117. };
  27118. Node.prototype.any = function any() {
  27119. var state = this._baseState;
  27120. state.any = true;
  27121. return this;
  27122. };
  27123. Node.prototype.choice = function choice(obj) {
  27124. var state = this._baseState;
  27125. assert(state.choice === null);
  27126. state.choice = obj;
  27127. this._useArgs(Object.keys(obj).map(function(key) {
  27128. return obj[key];
  27129. }));
  27130. return this;
  27131. };
  27132. Node.prototype.contains = function contains(item) {
  27133. var state = this._baseState;
  27134. assert(state.use === null);
  27135. state.contains = item;
  27136. return this;
  27137. };
  27138. //
  27139. // Decoding
  27140. //
  27141. Node.prototype._decode = function decode(input, options) {
  27142. var state = this._baseState;
  27143. // Decode root node
  27144. if (state.parent === null)
  27145. return input.wrapResult(state.children[0]._decode(input, options));
  27146. var result = state['default'];
  27147. var present = true;
  27148. var prevKey = null;
  27149. if (state.key !== null)
  27150. prevKey = input.enterKey(state.key);
  27151. // Check if tag is there
  27152. if (state.optional) {
  27153. var tag = null;
  27154. if (state.explicit !== null)
  27155. tag = state.explicit;
  27156. else if (state.implicit !== null)
  27157. tag = state.implicit;
  27158. else if (state.tag !== null)
  27159. tag = state.tag;
  27160. if (tag === null && !state.any) {
  27161. // Trial and Error
  27162. var save = input.save();
  27163. try {
  27164. if (state.choice === null)
  27165. this._decodeGeneric(state.tag, input, options);
  27166. else
  27167. this._decodeChoice(input, options);
  27168. present = true;
  27169. } catch (e) {
  27170. present = false;
  27171. }
  27172. input.restore(save);
  27173. } else {
  27174. present = this._peekTag(input, tag, state.any);
  27175. if (input.isError(present))
  27176. return present;
  27177. }
  27178. }
  27179. // Push object on stack
  27180. var prevObj;
  27181. if (state.obj && present)
  27182. prevObj = input.enterObject();
  27183. if (present) {
  27184. // Unwrap explicit values
  27185. if (state.explicit !== null) {
  27186. var explicit = this._decodeTag(input, state.explicit);
  27187. if (input.isError(explicit))
  27188. return explicit;
  27189. input = explicit;
  27190. }
  27191. var start = input.offset;
  27192. // Unwrap implicit and normal values
  27193. if (state.use === null && state.choice === null) {
  27194. if (state.any)
  27195. var save = input.save();
  27196. var body = this._decodeTag(
  27197. input,
  27198. state.implicit !== null ? state.implicit : state.tag,
  27199. state.any
  27200. );
  27201. if (input.isError(body))
  27202. return body;
  27203. if (state.any)
  27204. result = input.raw(save);
  27205. else
  27206. input = body;
  27207. }
  27208. if (options && options.track && state.tag !== null)
  27209. options.track(input.path(), start, input.length, 'tagged');
  27210. if (options && options.track && state.tag !== null)
  27211. options.track(input.path(), input.offset, input.length, 'content');
  27212. // Select proper method for tag
  27213. if (state.any)
  27214. result = result;
  27215. else if (state.choice === null)
  27216. result = this._decodeGeneric(state.tag, input, options);
  27217. else
  27218. result = this._decodeChoice(input, options);
  27219. if (input.isError(result))
  27220. return result;
  27221. // Decode children
  27222. if (!state.any && state.choice === null && state.children !== null) {
  27223. state.children.forEach(function decodeChildren(child) {
  27224. // NOTE: We are ignoring errors here, to let parser continue with other
  27225. // parts of encoded data
  27226. child._decode(input, options);
  27227. });
  27228. }
  27229. // Decode contained/encoded by schema, only in bit or octet strings
  27230. if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
  27231. var data = new DecoderBuffer(result);
  27232. result = this._getUse(state.contains, input._reporterState.obj)
  27233. ._decode(data, options);
  27234. }
  27235. }
  27236. // Pop object
  27237. if (state.obj && present)
  27238. result = input.leaveObject(prevObj);
  27239. // Set key
  27240. if (state.key !== null && (result !== null || present === true))
  27241. input.leaveKey(prevKey, state.key, result);
  27242. else if (prevKey !== null)
  27243. input.exitKey(prevKey);
  27244. return result;
  27245. };
  27246. Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
  27247. var state = this._baseState;
  27248. if (tag === 'seq' || tag === 'set')
  27249. return null;
  27250. if (tag === 'seqof' || tag === 'setof')
  27251. return this._decodeList(input, tag, state.args[0], options);
  27252. else if (/str$/.test(tag))
  27253. return this._decodeStr(input, tag, options);
  27254. else if (tag === 'objid' && state.args)
  27255. return this._decodeObjid(input, state.args[0], state.args[1], options);
  27256. else if (tag === 'objid')
  27257. return this._decodeObjid(input, null, null, options);
  27258. else if (tag === 'gentime' || tag === 'utctime')
  27259. return this._decodeTime(input, tag, options);
  27260. else if (tag === 'null_')
  27261. return this._decodeNull(input, options);
  27262. else if (tag === 'bool')
  27263. return this._decodeBool(input, options);
  27264. else if (tag === 'objDesc')
  27265. return this._decodeStr(input, tag, options);
  27266. else if (tag === 'int' || tag === 'enum')
  27267. return this._decodeInt(input, state.args && state.args[0], options);
  27268. if (state.use !== null) {
  27269. return this._getUse(state.use, input._reporterState.obj)
  27270. ._decode(input, options);
  27271. } else {
  27272. return input.error('unknown tag: ' + tag);
  27273. }
  27274. };
  27275. Node.prototype._getUse = function _getUse(entity, obj) {
  27276. var state = this._baseState;
  27277. // Create altered use decoder if implicit is set
  27278. state.useDecoder = this._use(entity, obj);
  27279. assert(state.useDecoder._baseState.parent === null);
  27280. state.useDecoder = state.useDecoder._baseState.children[0];
  27281. if (state.implicit !== state.useDecoder._baseState.implicit) {
  27282. state.useDecoder = state.useDecoder.clone();
  27283. state.useDecoder._baseState.implicit = state.implicit;
  27284. }
  27285. return state.useDecoder;
  27286. };
  27287. Node.prototype._decodeChoice = function decodeChoice(input, options) {
  27288. var state = this._baseState;
  27289. var result = null;
  27290. var match = false;
  27291. Object.keys(state.choice).some(function(key) {
  27292. var save = input.save();
  27293. var node = state.choice[key];
  27294. try {
  27295. var value = node._decode(input, options);
  27296. if (input.isError(value))
  27297. return false;
  27298. result = { type: key, value: value };
  27299. match = true;
  27300. } catch (e) {
  27301. input.restore(save);
  27302. return false;
  27303. }
  27304. return true;
  27305. }, this);
  27306. if (!match)
  27307. return input.error('Choice not matched');
  27308. return result;
  27309. };
  27310. //
  27311. // Encoding
  27312. //
  27313. Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
  27314. return new EncoderBuffer(data, this.reporter);
  27315. };
  27316. Node.prototype._encode = function encode(data, reporter, parent) {
  27317. var state = this._baseState;
  27318. if (state['default'] !== null && state['default'] === data)
  27319. return;
  27320. var result = this._encodeValue(data, reporter, parent);
  27321. if (result === undefined)
  27322. return;
  27323. if (this._skipDefault(result, reporter, parent))
  27324. return;
  27325. return result;
  27326. };
  27327. Node.prototype._encodeValue = function encode(data, reporter, parent) {
  27328. var state = this._baseState;
  27329. // Decode root node
  27330. if (state.parent === null)
  27331. return state.children[0]._encode(data, reporter || new Reporter());
  27332. var result = null;
  27333. // Set reporter to share it with a child class
  27334. this.reporter = reporter;
  27335. // Check if data is there
  27336. if (state.optional && data === undefined) {
  27337. if (state['default'] !== null)
  27338. data = state['default']
  27339. else
  27340. return;
  27341. }
  27342. // Encode children first
  27343. var content = null;
  27344. var primitive = false;
  27345. if (state.any) {
  27346. // Anything that was given is translated to buffer
  27347. result = this._createEncoderBuffer(data);
  27348. } else if (state.choice) {
  27349. result = this._encodeChoice(data, reporter);
  27350. } else if (state.contains) {
  27351. content = this._getUse(state.contains, parent)._encode(data, reporter);
  27352. primitive = true;
  27353. } else if (state.children) {
  27354. content = state.children.map(function(child) {
  27355. if (child._baseState.tag === 'null_')
  27356. return child._encode(null, reporter, data);
  27357. if (child._baseState.key === null)
  27358. return reporter.error('Child should have a key');
  27359. var prevKey = reporter.enterKey(child._baseState.key);
  27360. if (typeof data !== 'object')
  27361. return reporter.error('Child expected, but input is not object');
  27362. var res = child._encode(data[child._baseState.key], reporter, data);
  27363. reporter.leaveKey(prevKey);
  27364. return res;
  27365. }, this).filter(function(child) {
  27366. return child;
  27367. });
  27368. content = this._createEncoderBuffer(content);
  27369. } else {
  27370. if (state.tag === 'seqof' || state.tag === 'setof') {
  27371. // TODO(indutny): this should be thrown on DSL level
  27372. if (!(state.args && state.args.length === 1))
  27373. return reporter.error('Too many args for : ' + state.tag);
  27374. if (!Array.isArray(data))
  27375. return reporter.error('seqof/setof, but data is not Array');
  27376. var child = this.clone();
  27377. child._baseState.implicit = null;
  27378. content = this._createEncoderBuffer(data.map(function(item) {
  27379. var state = this._baseState;
  27380. return this._getUse(state.args[0], data)._encode(item, reporter);
  27381. }, child));
  27382. } else if (state.use !== null) {
  27383. result = this._getUse(state.use, parent)._encode(data, reporter);
  27384. } else {
  27385. content = this._encodePrimitive(state.tag, data);
  27386. primitive = true;
  27387. }
  27388. }
  27389. // Encode data itself
  27390. var result;
  27391. if (!state.any && state.choice === null) {
  27392. var tag = state.implicit !== null ? state.implicit : state.tag;
  27393. var cls = state.implicit === null ? 'universal' : 'context';
  27394. if (tag === null) {
  27395. if (state.use === null)
  27396. reporter.error('Tag could be omitted only for .use()');
  27397. } else {
  27398. if (state.use === null)
  27399. result = this._encodeComposite(tag, primitive, cls, content);
  27400. }
  27401. }
  27402. // Wrap in explicit
  27403. if (state.explicit !== null)
  27404. result = this._encodeComposite(state.explicit, false, 'context', result);
  27405. return result;
  27406. };
  27407. Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
  27408. var state = this._baseState;
  27409. var node = state.choice[data.type];
  27410. if (!node) {
  27411. assert(
  27412. false,
  27413. data.type + ' not found in ' +
  27414. JSON.stringify(Object.keys(state.choice)));
  27415. }
  27416. return node._encode(data.value, reporter);
  27417. };
  27418. Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
  27419. var state = this._baseState;
  27420. if (/str$/.test(tag))
  27421. return this._encodeStr(data, tag);
  27422. else if (tag === 'objid' && state.args)
  27423. return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
  27424. else if (tag === 'objid')
  27425. return this._encodeObjid(data, null, null);
  27426. else if (tag === 'gentime' || tag === 'utctime')
  27427. return this._encodeTime(data, tag);
  27428. else if (tag === 'null_')
  27429. return this._encodeNull();
  27430. else if (tag === 'int' || tag === 'enum')
  27431. return this._encodeInt(data, state.args && state.reverseArgs[0]);
  27432. else if (tag === 'bool')
  27433. return this._encodeBool(data);
  27434. else if (tag === 'objDesc')
  27435. return this._encodeStr(data, tag);
  27436. else
  27437. throw new Error('Unsupported tag: ' + tag);
  27438. };
  27439. Node.prototype._isNumstr = function isNumstr(str) {
  27440. return /^[0-9 ]*$/.test(str);
  27441. };
  27442. Node.prototype._isPrintstr = function isPrintstr(str) {
  27443. return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
  27444. };
  27445. /***/ }),
  27446. /* 219 */
  27447. /*!**********************************************************!*\
  27448. !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***!
  27449. \**********************************************************/
  27450. /*! no static exports found */
  27451. /***/ (function(module, exports, __webpack_require__) {
  27452. var constants = exports;
  27453. // Helper
  27454. constants._reverse = function reverse(map) {
  27455. var res = {};
  27456. Object.keys(map).forEach(function(key) {
  27457. // Convert key to integer if it is stringified
  27458. if ((key | 0) == key)
  27459. key = key | 0;
  27460. var value = map[key];
  27461. res[value] = key;
  27462. });
  27463. return res;
  27464. };
  27465. constants.der = __webpack_require__(/*! ./der */ 220);
  27466. /***/ }),
  27467. /* 220 */
  27468. /*!********************************************************!*\
  27469. !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***!
  27470. \********************************************************/
  27471. /*! no static exports found */
  27472. /***/ (function(module, exports, __webpack_require__) {
  27473. var constants = __webpack_require__(/*! ../constants */ 219);
  27474. exports.tagClass = {
  27475. 0: 'universal',
  27476. 1: 'application',
  27477. 2: 'context',
  27478. 3: 'private'
  27479. };
  27480. exports.tagClassByName = constants._reverse(exports.tagClass);
  27481. exports.tag = {
  27482. 0x00: 'end',
  27483. 0x01: 'bool',
  27484. 0x02: 'int',
  27485. 0x03: 'bitstr',
  27486. 0x04: 'octstr',
  27487. 0x05: 'null_',
  27488. 0x06: 'objid',
  27489. 0x07: 'objDesc',
  27490. 0x08: 'external',
  27491. 0x09: 'real',
  27492. 0x0a: 'enum',
  27493. 0x0b: 'embed',
  27494. 0x0c: 'utf8str',
  27495. 0x0d: 'relativeOid',
  27496. 0x10: 'seq',
  27497. 0x11: 'set',
  27498. 0x12: 'numstr',
  27499. 0x13: 'printstr',
  27500. 0x14: 't61str',
  27501. 0x15: 'videostr',
  27502. 0x16: 'ia5str',
  27503. 0x17: 'utctime',
  27504. 0x18: 'gentime',
  27505. 0x19: 'graphstr',
  27506. 0x1a: 'iso646str',
  27507. 0x1b: 'genstr',
  27508. 0x1c: 'unistr',
  27509. 0x1d: 'charstr',
  27510. 0x1e: 'bmpstr'
  27511. };
  27512. exports.tagByName = constants._reverse(exports.tag);
  27513. /***/ }),
  27514. /* 221 */
  27515. /*!*********************************************************!*\
  27516. !*** ./node_modules/asn1.js/lib/asn1/decoders/index.js ***!
  27517. \*********************************************************/
  27518. /*! no static exports found */
  27519. /***/ (function(module, exports, __webpack_require__) {
  27520. var decoders = exports;
  27521. decoders.der = __webpack_require__(/*! ./der */ 222);
  27522. decoders.pem = __webpack_require__(/*! ./pem */ 223);
  27523. /***/ }),
  27524. /* 222 */
  27525. /*!*******************************************************!*\
  27526. !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***!
  27527. \*******************************************************/
  27528. /*! no static exports found */
  27529. /***/ (function(module, exports, __webpack_require__) {
  27530. var inherits = __webpack_require__(/*! inherits */ 93);
  27531. var asn1 = __webpack_require__(/*! ../../asn1 */ 212);
  27532. var base = asn1.base;
  27533. var bignum = asn1.bignum;
  27534. // Import DER constants
  27535. var der = asn1.constants.der;
  27536. function DERDecoder(entity) {
  27537. this.enc = 'der';
  27538. this.name = entity.name;
  27539. this.entity = entity;
  27540. // Construct base tree
  27541. this.tree = new DERNode();
  27542. this.tree._init(entity.body);
  27543. };
  27544. module.exports = DERDecoder;
  27545. DERDecoder.prototype.decode = function decode(data, options) {
  27546. if (!(data instanceof base.DecoderBuffer))
  27547. data = new base.DecoderBuffer(data, options);
  27548. return this.tree._decode(data, options);
  27549. };
  27550. // Tree methods
  27551. function DERNode(parent) {
  27552. base.Node.call(this, 'der', parent);
  27553. }
  27554. inherits(DERNode, base.Node);
  27555. DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
  27556. if (buffer.isEmpty())
  27557. return false;
  27558. var state = buffer.save();
  27559. var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
  27560. if (buffer.isError(decodedTag))
  27561. return decodedTag;
  27562. buffer.restore(state);
  27563. return decodedTag.tag === tag || decodedTag.tagStr === tag ||
  27564. (decodedTag.tagStr + 'of') === tag || any;
  27565. };
  27566. DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
  27567. var decodedTag = derDecodeTag(buffer,
  27568. 'Failed to decode tag of "' + tag + '"');
  27569. if (buffer.isError(decodedTag))
  27570. return decodedTag;
  27571. var len = derDecodeLen(buffer,
  27572. decodedTag.primitive,
  27573. 'Failed to get length of "' + tag + '"');
  27574. // Failure
  27575. if (buffer.isError(len))
  27576. return len;
  27577. if (!any &&
  27578. decodedTag.tag !== tag &&
  27579. decodedTag.tagStr !== tag &&
  27580. decodedTag.tagStr + 'of' !== tag) {
  27581. return buffer.error('Failed to match tag: "' + tag + '"');
  27582. }
  27583. if (decodedTag.primitive || len !== null)
  27584. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  27585. // Indefinite length... find END tag
  27586. var state = buffer.save();
  27587. var res = this._skipUntilEnd(
  27588. buffer,
  27589. 'Failed to skip indefinite length body: "' + this.tag + '"');
  27590. if (buffer.isError(res))
  27591. return res;
  27592. len = buffer.offset - state.offset;
  27593. buffer.restore(state);
  27594. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  27595. };
  27596. DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
  27597. while (true) {
  27598. var tag = derDecodeTag(buffer, fail);
  27599. if (buffer.isError(tag))
  27600. return tag;
  27601. var len = derDecodeLen(buffer, tag.primitive, fail);
  27602. if (buffer.isError(len))
  27603. return len;
  27604. var res;
  27605. if (tag.primitive || len !== null)
  27606. res = buffer.skip(len)
  27607. else
  27608. res = this._skipUntilEnd(buffer, fail);
  27609. // Failure
  27610. if (buffer.isError(res))
  27611. return res;
  27612. if (tag.tagStr === 'end')
  27613. break;
  27614. }
  27615. };
  27616. DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
  27617. options) {
  27618. var result = [];
  27619. while (!buffer.isEmpty()) {
  27620. var possibleEnd = this._peekTag(buffer, 'end');
  27621. if (buffer.isError(possibleEnd))
  27622. return possibleEnd;
  27623. var res = decoder.decode(buffer, 'der', options);
  27624. if (buffer.isError(res) && possibleEnd)
  27625. break;
  27626. result.push(res);
  27627. }
  27628. return result;
  27629. };
  27630. DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
  27631. if (tag === 'bitstr') {
  27632. var unused = buffer.readUInt8();
  27633. if (buffer.isError(unused))
  27634. return unused;
  27635. return { unused: unused, data: buffer.raw() };
  27636. } else if (tag === 'bmpstr') {
  27637. var raw = buffer.raw();
  27638. if (raw.length % 2 === 1)
  27639. return buffer.error('Decoding of string type: bmpstr length mismatch');
  27640. var str = '';
  27641. for (var i = 0; i < raw.length / 2; i++) {
  27642. str += String.fromCharCode(raw.readUInt16BE(i * 2));
  27643. }
  27644. return str;
  27645. } else if (tag === 'numstr') {
  27646. var numstr = buffer.raw().toString('ascii');
  27647. if (!this._isNumstr(numstr)) {
  27648. return buffer.error('Decoding of string type: ' +
  27649. 'numstr unsupported characters');
  27650. }
  27651. return numstr;
  27652. } else if (tag === 'octstr') {
  27653. return buffer.raw();
  27654. } else if (tag === 'objDesc') {
  27655. return buffer.raw();
  27656. } else if (tag === 'printstr') {
  27657. var printstr = buffer.raw().toString('ascii');
  27658. if (!this._isPrintstr(printstr)) {
  27659. return buffer.error('Decoding of string type: ' +
  27660. 'printstr unsupported characters');
  27661. }
  27662. return printstr;
  27663. } else if (/str$/.test(tag)) {
  27664. return buffer.raw().toString();
  27665. } else {
  27666. return buffer.error('Decoding of string type: ' + tag + ' unsupported');
  27667. }
  27668. };
  27669. DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
  27670. var result;
  27671. var identifiers = [];
  27672. var ident = 0;
  27673. while (!buffer.isEmpty()) {
  27674. var subident = buffer.readUInt8();
  27675. ident <<= 7;
  27676. ident |= subident & 0x7f;
  27677. if ((subident & 0x80) === 0) {
  27678. identifiers.push(ident);
  27679. ident = 0;
  27680. }
  27681. }
  27682. if (subident & 0x80)
  27683. identifiers.push(ident);
  27684. var first = (identifiers[0] / 40) | 0;
  27685. var second = identifiers[0] % 40;
  27686. if (relative)
  27687. result = identifiers;
  27688. else
  27689. result = [first, second].concat(identifiers.slice(1));
  27690. if (values) {
  27691. var tmp = values[result.join(' ')];
  27692. if (tmp === undefined)
  27693. tmp = values[result.join('.')];
  27694. if (tmp !== undefined)
  27695. result = tmp;
  27696. }
  27697. return result;
  27698. };
  27699. DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
  27700. var str = buffer.raw().toString();
  27701. if (tag === 'gentime') {
  27702. var year = str.slice(0, 4) | 0;
  27703. var mon = str.slice(4, 6) | 0;
  27704. var day = str.slice(6, 8) | 0;
  27705. var hour = str.slice(8, 10) | 0;
  27706. var min = str.slice(10, 12) | 0;
  27707. var sec = str.slice(12, 14) | 0;
  27708. } else if (tag === 'utctime') {
  27709. var year = str.slice(0, 2) | 0;
  27710. var mon = str.slice(2, 4) | 0;
  27711. var day = str.slice(4, 6) | 0;
  27712. var hour = str.slice(6, 8) | 0;
  27713. var min = str.slice(8, 10) | 0;
  27714. var sec = str.slice(10, 12) | 0;
  27715. if (year < 70)
  27716. year = 2000 + year;
  27717. else
  27718. year = 1900 + year;
  27719. } else {
  27720. return buffer.error('Decoding ' + tag + ' time is not supported yet');
  27721. }
  27722. return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
  27723. };
  27724. DERNode.prototype._decodeNull = function decodeNull(buffer) {
  27725. return null;
  27726. };
  27727. DERNode.prototype._decodeBool = function decodeBool(buffer) {
  27728. var res = buffer.readUInt8();
  27729. if (buffer.isError(res))
  27730. return res;
  27731. else
  27732. return res !== 0;
  27733. };
  27734. DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
  27735. // Bigint, return as it is (assume big endian)
  27736. var raw = buffer.raw();
  27737. var res = new bignum(raw);
  27738. if (values)
  27739. res = values[res.toString(10)] || res;
  27740. return res;
  27741. };
  27742. DERNode.prototype._use = function use(entity, obj) {
  27743. if (typeof entity === 'function')
  27744. entity = entity(obj);
  27745. return entity._getDecoder('der').tree;
  27746. };
  27747. // Utility methods
  27748. function derDecodeTag(buf, fail) {
  27749. var tag = buf.readUInt8(fail);
  27750. if (buf.isError(tag))
  27751. return tag;
  27752. var cls = der.tagClass[tag >> 6];
  27753. var primitive = (tag & 0x20) === 0;
  27754. // Multi-octet tag - load
  27755. if ((tag & 0x1f) === 0x1f) {
  27756. var oct = tag;
  27757. tag = 0;
  27758. while ((oct & 0x80) === 0x80) {
  27759. oct = buf.readUInt8(fail);
  27760. if (buf.isError(oct))
  27761. return oct;
  27762. tag <<= 7;
  27763. tag |= oct & 0x7f;
  27764. }
  27765. } else {
  27766. tag &= 0x1f;
  27767. }
  27768. var tagStr = der.tag[tag];
  27769. return {
  27770. cls: cls,
  27771. primitive: primitive,
  27772. tag: tag,
  27773. tagStr: tagStr
  27774. };
  27775. }
  27776. function derDecodeLen(buf, primitive, fail) {
  27777. var len = buf.readUInt8(fail);
  27778. if (buf.isError(len))
  27779. return len;
  27780. // Indefinite form
  27781. if (!primitive && len === 0x80)
  27782. return null;
  27783. // Definite form
  27784. if ((len & 0x80) === 0) {
  27785. // Short form
  27786. return len;
  27787. }
  27788. // Long form
  27789. var num = len & 0x7f;
  27790. if (num > 4)
  27791. return buf.error('length octect is too long');
  27792. len = 0;
  27793. for (var i = 0; i < num; i++) {
  27794. len <<= 8;
  27795. var j = buf.readUInt8(fail);
  27796. if (buf.isError(j))
  27797. return j;
  27798. len |= j;
  27799. }
  27800. return len;
  27801. }
  27802. /***/ }),
  27803. /* 223 */
  27804. /*!*******************************************************!*\
  27805. !*** ./node_modules/asn1.js/lib/asn1/decoders/pem.js ***!
  27806. \*******************************************************/
  27807. /*! no static exports found */
  27808. /***/ (function(module, exports, __webpack_require__) {
  27809. var inherits = __webpack_require__(/*! inherits */ 93);
  27810. var Buffer = __webpack_require__(/*! buffer */ 88).Buffer;
  27811. var DERDecoder = __webpack_require__(/*! ./der */ 222);
  27812. function PEMDecoder(entity) {
  27813. DERDecoder.call(this, entity);
  27814. this.enc = 'pem';
  27815. };
  27816. inherits(PEMDecoder, DERDecoder);
  27817. module.exports = PEMDecoder;
  27818. PEMDecoder.prototype.decode = function decode(data, options) {
  27819. var lines = data.toString().split(/[\r\n]+/g);
  27820. var label = options.label.toUpperCase();
  27821. var re = /^-----(BEGIN|END) ([^-]+)-----$/;
  27822. var start = -1;
  27823. var end = -1;
  27824. for (var i = 0; i < lines.length; i++) {
  27825. var match = lines[i].match(re);
  27826. if (match === null)
  27827. continue;
  27828. if (match[2] !== label)
  27829. continue;
  27830. if (start === -1) {
  27831. if (match[1] !== 'BEGIN')
  27832. break;
  27833. start = i;
  27834. } else {
  27835. if (match[1] !== 'END')
  27836. break;
  27837. end = i;
  27838. break;
  27839. }
  27840. }
  27841. if (start === -1 || end === -1)
  27842. throw new Error('PEM section not found for: ' + label);
  27843. var base64 = lines.slice(start + 1, end).join('');
  27844. // Remove excessive symbols
  27845. base64.replace(/[^a-z0-9\+\/=]+/gi, '');
  27846. var input = new Buffer(base64, 'base64');
  27847. return DERDecoder.prototype.decode.call(this, input, options);
  27848. };
  27849. /***/ }),
  27850. /* 224 */
  27851. /*!*********************************************************!*\
  27852. !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***!
  27853. \*********************************************************/
  27854. /*! no static exports found */
  27855. /***/ (function(module, exports, __webpack_require__) {
  27856. var encoders = exports;
  27857. encoders.der = __webpack_require__(/*! ./der */ 225);
  27858. encoders.pem = __webpack_require__(/*! ./pem */ 226);
  27859. /***/ }),
  27860. /* 225 */
  27861. /*!*******************************************************!*\
  27862. !*** ./node_modules/asn1.js/lib/asn1/encoders/der.js ***!
  27863. \*******************************************************/
  27864. /*! no static exports found */
  27865. /***/ (function(module, exports, __webpack_require__) {
  27866. var inherits = __webpack_require__(/*! inherits */ 93);
  27867. var Buffer = __webpack_require__(/*! buffer */ 88).Buffer;
  27868. var asn1 = __webpack_require__(/*! ../../asn1 */ 212);
  27869. var base = asn1.base;
  27870. // Import DER constants
  27871. var der = asn1.constants.der;
  27872. function DEREncoder(entity) {
  27873. this.enc = 'der';
  27874. this.name = entity.name;
  27875. this.entity = entity;
  27876. // Construct base tree
  27877. this.tree = new DERNode();
  27878. this.tree._init(entity.body);
  27879. };
  27880. module.exports = DEREncoder;
  27881. DEREncoder.prototype.encode = function encode(data, reporter) {
  27882. return this.tree._encode(data, reporter).join();
  27883. };
  27884. // Tree methods
  27885. function DERNode(parent) {
  27886. base.Node.call(this, 'der', parent);
  27887. }
  27888. inherits(DERNode, base.Node);
  27889. DERNode.prototype._encodeComposite = function encodeComposite(tag,
  27890. primitive,
  27891. cls,
  27892. content) {
  27893. var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
  27894. // Short form
  27895. if (content.length < 0x80) {
  27896. var header = new Buffer(2);
  27897. header[0] = encodedTag;
  27898. header[1] = content.length;
  27899. return this._createEncoderBuffer([ header, content ]);
  27900. }
  27901. // Long form
  27902. // Count octets required to store length
  27903. var lenOctets = 1;
  27904. for (var i = content.length; i >= 0x100; i >>= 8)
  27905. lenOctets++;
  27906. var header = new Buffer(1 + 1 + lenOctets);
  27907. header[0] = encodedTag;
  27908. header[1] = 0x80 | lenOctets;
  27909. for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
  27910. header[i] = j & 0xff;
  27911. return this._createEncoderBuffer([ header, content ]);
  27912. };
  27913. DERNode.prototype._encodeStr = function encodeStr(str, tag) {
  27914. if (tag === 'bitstr') {
  27915. return this._createEncoderBuffer([ str.unused | 0, str.data ]);
  27916. } else if (tag === 'bmpstr') {
  27917. var buf = new Buffer(str.length * 2);
  27918. for (var i = 0; i < str.length; i++) {
  27919. buf.writeUInt16BE(str.charCodeAt(i), i * 2);
  27920. }
  27921. return this._createEncoderBuffer(buf);
  27922. } else if (tag === 'numstr') {
  27923. if (!this._isNumstr(str)) {
  27924. return this.reporter.error('Encoding of string type: numstr supports ' +
  27925. 'only digits and space');
  27926. }
  27927. return this._createEncoderBuffer(str);
  27928. } else if (tag === 'printstr') {
  27929. if (!this._isPrintstr(str)) {
  27930. return this.reporter.error('Encoding of string type: printstr supports ' +
  27931. 'only latin upper and lower case letters, ' +
  27932. 'digits, space, apostrophe, left and rigth ' +
  27933. 'parenthesis, plus sign, comma, hyphen, ' +
  27934. 'dot, slash, colon, equal sign, ' +
  27935. 'question mark');
  27936. }
  27937. return this._createEncoderBuffer(str);
  27938. } else if (/str$/.test(tag)) {
  27939. return this._createEncoderBuffer(str);
  27940. } else if (tag === 'objDesc') {
  27941. return this._createEncoderBuffer(str);
  27942. } else {
  27943. return this.reporter.error('Encoding of string type: ' + tag +
  27944. ' unsupported');
  27945. }
  27946. };
  27947. DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
  27948. if (typeof id === 'string') {
  27949. if (!values)
  27950. return this.reporter.error('string objid given, but no values map found');
  27951. if (!values.hasOwnProperty(id))
  27952. return this.reporter.error('objid not found in values map');
  27953. id = values[id].split(/[\s\.]+/g);
  27954. for (var i = 0; i < id.length; i++)
  27955. id[i] |= 0;
  27956. } else if (Array.isArray(id)) {
  27957. id = id.slice();
  27958. for (var i = 0; i < id.length; i++)
  27959. id[i] |= 0;
  27960. }
  27961. if (!Array.isArray(id)) {
  27962. return this.reporter.error('objid() should be either array or string, ' +
  27963. 'got: ' + JSON.stringify(id));
  27964. }
  27965. if (!relative) {
  27966. if (id[1] >= 40)
  27967. return this.reporter.error('Second objid identifier OOB');
  27968. id.splice(0, 2, id[0] * 40 + id[1]);
  27969. }
  27970. // Count number of octets
  27971. var size = 0;
  27972. for (var i = 0; i < id.length; i++) {
  27973. var ident = id[i];
  27974. for (size++; ident >= 0x80; ident >>= 7)
  27975. size++;
  27976. }
  27977. var objid = new Buffer(size);
  27978. var offset = objid.length - 1;
  27979. for (var i = id.length - 1; i >= 0; i--) {
  27980. var ident = id[i];
  27981. objid[offset--] = ident & 0x7f;
  27982. while ((ident >>= 7) > 0)
  27983. objid[offset--] = 0x80 | (ident & 0x7f);
  27984. }
  27985. return this._createEncoderBuffer(objid);
  27986. };
  27987. function two(num) {
  27988. if (num < 10)
  27989. return '0' + num;
  27990. else
  27991. return num;
  27992. }
  27993. DERNode.prototype._encodeTime = function encodeTime(time, tag) {
  27994. var str;
  27995. var date = new Date(time);
  27996. if (tag === 'gentime') {
  27997. str = [
  27998. two(date.getFullYear()),
  27999. two(date.getUTCMonth() + 1),
  28000. two(date.getUTCDate()),
  28001. two(date.getUTCHours()),
  28002. two(date.getUTCMinutes()),
  28003. two(date.getUTCSeconds()),
  28004. 'Z'
  28005. ].join('');
  28006. } else if (tag === 'utctime') {
  28007. str = [
  28008. two(date.getFullYear() % 100),
  28009. two(date.getUTCMonth() + 1),
  28010. two(date.getUTCDate()),
  28011. two(date.getUTCHours()),
  28012. two(date.getUTCMinutes()),
  28013. two(date.getUTCSeconds()),
  28014. 'Z'
  28015. ].join('');
  28016. } else {
  28017. this.reporter.error('Encoding ' + tag + ' time is not supported yet');
  28018. }
  28019. return this._encodeStr(str, 'octstr');
  28020. };
  28021. DERNode.prototype._encodeNull = function encodeNull() {
  28022. return this._createEncoderBuffer('');
  28023. };
  28024. DERNode.prototype._encodeInt = function encodeInt(num, values) {
  28025. if (typeof num === 'string') {
  28026. if (!values)
  28027. return this.reporter.error('String int or enum given, but no values map');
  28028. if (!values.hasOwnProperty(num)) {
  28029. return this.reporter.error('Values map doesn\'t contain: ' +
  28030. JSON.stringify(num));
  28031. }
  28032. num = values[num];
  28033. }
  28034. // Bignum, assume big endian
  28035. if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
  28036. var numArray = num.toArray();
  28037. if (!num.sign && numArray[0] & 0x80) {
  28038. numArray.unshift(0);
  28039. }
  28040. num = new Buffer(numArray);
  28041. }
  28042. if (Buffer.isBuffer(num)) {
  28043. var size = num.length;
  28044. if (num.length === 0)
  28045. size++;
  28046. var out = new Buffer(size);
  28047. num.copy(out);
  28048. if (num.length === 0)
  28049. out[0] = 0
  28050. return this._createEncoderBuffer(out);
  28051. }
  28052. if (num < 0x80)
  28053. return this._createEncoderBuffer(num);
  28054. if (num < 0x100)
  28055. return this._createEncoderBuffer([0, num]);
  28056. var size = 1;
  28057. for (var i = num; i >= 0x100; i >>= 8)
  28058. size++;
  28059. var out = new Array(size);
  28060. for (var i = out.length - 1; i >= 0; i--) {
  28061. out[i] = num & 0xff;
  28062. num >>= 8;
  28063. }
  28064. if(out[0] & 0x80) {
  28065. out.unshift(0);
  28066. }
  28067. return this._createEncoderBuffer(new Buffer(out));
  28068. };
  28069. DERNode.prototype._encodeBool = function encodeBool(value) {
  28070. return this._createEncoderBuffer(value ? 0xff : 0);
  28071. };
  28072. DERNode.prototype._use = function use(entity, obj) {
  28073. if (typeof entity === 'function')
  28074. entity = entity(obj);
  28075. return entity._getEncoder('der').tree;
  28076. };
  28077. DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
  28078. var state = this._baseState;
  28079. var i;
  28080. if (state['default'] === null)
  28081. return false;
  28082. var data = dataBuffer.join();
  28083. if (state.defaultBuffer === undefined)
  28084. state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
  28085. if (data.length !== state.defaultBuffer.length)
  28086. return false;
  28087. for (i=0; i < data.length; i++)
  28088. if (data[i] !== state.defaultBuffer[i])
  28089. return false;
  28090. return true;
  28091. };
  28092. // Utility methods
  28093. function encodeTag(tag, primitive, cls, reporter) {
  28094. var res;
  28095. if (tag === 'seqof')
  28096. tag = 'seq';
  28097. else if (tag === 'setof')
  28098. tag = 'set';
  28099. if (der.tagByName.hasOwnProperty(tag))
  28100. res = der.tagByName[tag];
  28101. else if (typeof tag === 'number' && (tag | 0) === tag)
  28102. res = tag;
  28103. else
  28104. return reporter.error('Unknown tag: ' + tag);
  28105. if (res >= 0x1f)
  28106. return reporter.error('Multi-octet tag encoding unsupported');
  28107. if (!primitive)
  28108. res |= 0x20;
  28109. res |= (der.tagClassByName[cls || 'universal'] << 6);
  28110. return res;
  28111. }
  28112. /***/ }),
  28113. /* 226 */
  28114. /*!*******************************************************!*\
  28115. !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***!
  28116. \*******************************************************/
  28117. /*! no static exports found */
  28118. /***/ (function(module, exports, __webpack_require__) {
  28119. var inherits = __webpack_require__(/*! inherits */ 93);
  28120. var DEREncoder = __webpack_require__(/*! ./der */ 225);
  28121. function PEMEncoder(entity) {
  28122. DEREncoder.call(this, entity);
  28123. this.enc = 'pem';
  28124. };
  28125. inherits(PEMEncoder, DEREncoder);
  28126. module.exports = PEMEncoder;
  28127. PEMEncoder.prototype.encode = function encode(data, options) {
  28128. var buf = DEREncoder.prototype.encode.call(this, data);
  28129. var p = buf.toString('base64');
  28130. var out = [ '-----BEGIN ' + options.label + '-----' ];
  28131. for (var i = 0; i < p.length; i += 64)
  28132. out.push(p.slice(i, i + 64));
  28133. out.push('-----END ' + options.label + '-----');
  28134. return out.join('\n');
  28135. };
  28136. /***/ }),
  28137. /* 227 */
  28138. /*!************************************************!*\
  28139. !*** ./node_modules/parse-asn1/certificate.js ***!
  28140. \************************************************/
  28141. /*! no static exports found */
  28142. /***/ (function(module, exports, __webpack_require__) {
  28143. "use strict";
  28144. // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
  28145. // thanks to @Rantanen
  28146. var asn = __webpack_require__(/*! asn1.js */ 212)
  28147. var Time = asn.define('Time', function () {
  28148. this.choice({
  28149. utcTime: this.utctime(),
  28150. generalTime: this.gentime()
  28151. })
  28152. })
  28153. var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
  28154. this.seq().obj(
  28155. this.key('type').objid(),
  28156. this.key('value').any()
  28157. )
  28158. })
  28159. var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
  28160. this.seq().obj(
  28161. this.key('algorithm').objid(),
  28162. this.key('parameters').optional(),
  28163. this.key('curve').objid().optional()
  28164. )
  28165. })
  28166. var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
  28167. this.seq().obj(
  28168. this.key('algorithm').use(AlgorithmIdentifier),
  28169. this.key('subjectPublicKey').bitstr()
  28170. )
  28171. })
  28172. var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
  28173. this.setof(AttributeTypeValue)
  28174. })
  28175. var RDNSequence = asn.define('RDNSequence', function () {
  28176. this.seqof(RelativeDistinguishedName)
  28177. })
  28178. var Name = asn.define('Name', function () {
  28179. this.choice({
  28180. rdnSequence: this.use(RDNSequence)
  28181. })
  28182. })
  28183. var Validity = asn.define('Validity', function () {
  28184. this.seq().obj(
  28185. this.key('notBefore').use(Time),
  28186. this.key('notAfter').use(Time)
  28187. )
  28188. })
  28189. var Extension = asn.define('Extension', function () {
  28190. this.seq().obj(
  28191. this.key('extnID').objid(),
  28192. this.key('critical').bool().def(false),
  28193. this.key('extnValue').octstr()
  28194. )
  28195. })
  28196. var TBSCertificate = asn.define('TBSCertificate', function () {
  28197. this.seq().obj(
  28198. this.key('version').explicit(0).int().optional(),
  28199. this.key('serialNumber').int(),
  28200. this.key('signature').use(AlgorithmIdentifier),
  28201. this.key('issuer').use(Name),
  28202. this.key('validity').use(Validity),
  28203. this.key('subject').use(Name),
  28204. this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),
  28205. this.key('issuerUniqueID').implicit(1).bitstr().optional(),
  28206. this.key('subjectUniqueID').implicit(2).bitstr().optional(),
  28207. this.key('extensions').explicit(3).seqof(Extension).optional()
  28208. )
  28209. })
  28210. var X509Certificate = asn.define('X509Certificate', function () {
  28211. this.seq().obj(
  28212. this.key('tbsCertificate').use(TBSCertificate),
  28213. this.key('signatureAlgorithm').use(AlgorithmIdentifier),
  28214. this.key('signatureValue').bitstr()
  28215. )
  28216. })
  28217. module.exports = X509Certificate
  28218. /***/ }),
  28219. /* 228 */
  28220. /*!********************************************!*\
  28221. !*** ./node_modules/parse-asn1/aesid.json ***!
  28222. \********************************************/
  28223. /*! exports provided: 2.16.840.1.101.3.4.1.1, 2.16.840.1.101.3.4.1.2, 2.16.840.1.101.3.4.1.3, 2.16.840.1.101.3.4.1.4, 2.16.840.1.101.3.4.1.21, 2.16.840.1.101.3.4.1.22, 2.16.840.1.101.3.4.1.23, 2.16.840.1.101.3.4.1.24, 2.16.840.1.101.3.4.1.41, 2.16.840.1.101.3.4.1.42, 2.16.840.1.101.3.4.1.43, 2.16.840.1.101.3.4.1.44, default */
  28224. /***/ (function(module) {
  28225. module.exports = JSON.parse("{\"2.16.840.1.101.3.4.1.1\":\"aes-128-ecb\",\"2.16.840.1.101.3.4.1.2\":\"aes-128-cbc\",\"2.16.840.1.101.3.4.1.3\":\"aes-128-ofb\",\"2.16.840.1.101.3.4.1.4\":\"aes-128-cfb\",\"2.16.840.1.101.3.4.1.21\":\"aes-192-ecb\",\"2.16.840.1.101.3.4.1.22\":\"aes-192-cbc\",\"2.16.840.1.101.3.4.1.23\":\"aes-192-ofb\",\"2.16.840.1.101.3.4.1.24\":\"aes-192-cfb\",\"2.16.840.1.101.3.4.1.41\":\"aes-256-ecb\",\"2.16.840.1.101.3.4.1.42\":\"aes-256-cbc\",\"2.16.840.1.101.3.4.1.43\":\"aes-256-ofb\",\"2.16.840.1.101.3.4.1.44\":\"aes-256-cfb\"}");
  28226. /***/ }),
  28227. /* 229 */
  28228. /*!********************************************!*\
  28229. !*** ./node_modules/parse-asn1/fixProc.js ***!
  28230. \********************************************/
  28231. /*! no static exports found */
  28232. /***/ (function(module, exports, __webpack_require__) {
  28233. // adapted from https://github.com/apatil/pemstrip
  28234. var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m
  28235. var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m
  28236. var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m
  28237. var evp = __webpack_require__(/*! evp_bytestokey */ 164)
  28238. var ciphers = __webpack_require__(/*! browserify-aes */ 147)
  28239. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  28240. module.exports = function (okey, password) {
  28241. var key = okey.toString()
  28242. var match = key.match(findProc)
  28243. var decrypted
  28244. if (!match) {
  28245. var match2 = key.match(fullRegex)
  28246. decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64')
  28247. } else {
  28248. var suite = 'aes' + match[1]
  28249. var iv = Buffer.from(match[2], 'hex')
  28250. var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64')
  28251. var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
  28252. var out = []
  28253. var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
  28254. out.push(cipher.update(cipherText))
  28255. out.push(cipher.final())
  28256. decrypted = Buffer.concat(out)
  28257. }
  28258. var tag = key.match(startRegex)[1]
  28259. return {
  28260. tag: tag,
  28261. data: decrypted
  28262. }
  28263. }
  28264. /***/ }),
  28265. /* 230 */
  28266. /*!**********************************************************!*\
  28267. !*** ./node_modules/browserify-sign/browser/curves.json ***!
  28268. \**********************************************************/
  28269. /*! exports provided: 1.3.132.0.10, 1.3.132.0.33, 1.2.840.10045.3.1.1, 1.2.840.10045.3.1.7, 1.3.132.0.34, 1.3.132.0.35, default */
  28270. /***/ (function(module) {
  28271. module.exports = JSON.parse("{\"1.3.132.0.10\":\"secp256k1\",\"1.3.132.0.33\":\"p224\",\"1.2.840.10045.3.1.1\":\"p192\",\"1.2.840.10045.3.1.7\":\"p256\",\"1.3.132.0.34\":\"p384\",\"1.3.132.0.35\":\"p521\"}");
  28272. /***/ }),
  28273. /* 231 */
  28274. /*!********************************************************!*\
  28275. !*** ./node_modules/browserify-sign/browser/verify.js ***!
  28276. \********************************************************/
  28277. /*! no static exports found */
  28278. /***/ (function(module, exports, __webpack_require__) {
  28279. // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  28280. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  28281. var BN = __webpack_require__(/*! bn.js */ 169)
  28282. var EC = __webpack_require__(/*! elliptic */ 180).ec
  28283. var parseKeys = __webpack_require__(/*! parse-asn1 */ 210)
  28284. var curves = __webpack_require__(/*! ./curves.json */ 230)
  28285. function verify (sig, hash, key, signType, tag) {
  28286. var pub = parseKeys(key)
  28287. if (pub.type === 'ec') {
  28288. // rsa keys can be interpreted as ecdsa ones in openssl
  28289. if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
  28290. return ecVerify(sig, hash, pub)
  28291. } else if (pub.type === 'dsa') {
  28292. if (signType !== 'dsa') throw new Error('wrong public key type')
  28293. return dsaVerify(sig, hash, pub)
  28294. } else {
  28295. if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
  28296. }
  28297. hash = Buffer.concat([tag, hash])
  28298. var len = pub.modulus.byteLength()
  28299. var pad = [1]
  28300. var padNum = 0
  28301. while (hash.length + pad.length + 2 < len) {
  28302. pad.push(0xff)
  28303. padNum++
  28304. }
  28305. pad.push(0x00)
  28306. var i = -1
  28307. while (++i < hash.length) {
  28308. pad.push(hash[i])
  28309. }
  28310. pad = Buffer.from(pad)
  28311. var red = BN.mont(pub.modulus)
  28312. sig = new BN(sig).toRed(red)
  28313. sig = sig.redPow(new BN(pub.publicExponent))
  28314. sig = Buffer.from(sig.fromRed().toArray())
  28315. var out = padNum < 8 ? 1 : 0
  28316. len = Math.min(sig.length, pad.length)
  28317. if (sig.length !== pad.length) out = 1
  28318. i = -1
  28319. while (++i < len) out |= sig[i] ^ pad[i]
  28320. return out === 0
  28321. }
  28322. function ecVerify (sig, hash, pub) {
  28323. var curveId = curves[pub.data.algorithm.curve.join('.')]
  28324. if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
  28325. var curve = new EC(curveId)
  28326. var pubkey = pub.data.subjectPrivateKey.data
  28327. return curve.verify(hash, sig, pubkey)
  28328. }
  28329. function dsaVerify (sig, hash, pub) {
  28330. var p = pub.data.p
  28331. var q = pub.data.q
  28332. var g = pub.data.g
  28333. var y = pub.data.pub_key
  28334. var unpacked = parseKeys.signature.decode(sig, 'der')
  28335. var s = unpacked.s
  28336. var r = unpacked.r
  28337. checkValue(s, q)
  28338. checkValue(r, q)
  28339. var montp = BN.mont(p)
  28340. var w = s.invm(q)
  28341. var v = g.toRed(montp)
  28342. .redPow(new BN(hash).mul(w).mod(q))
  28343. .fromRed()
  28344. .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
  28345. .mod(p)
  28346. .mod(q)
  28347. return v.cmp(r) === 0
  28348. }
  28349. function checkValue (b, q) {
  28350. if (b.cmpn(0) <= 0) throw new Error('invalid sig')
  28351. if (b.cmp(q) >= q) throw new Error('invalid sig')
  28352. }
  28353. module.exports = verify
  28354. /***/ }),
  28355. /* 232 */
  28356. /*!*********************************************!*\
  28357. !*** ./node_modules/create-ecdh/browser.js ***!
  28358. \*********************************************/
  28359. /*! no static exports found */
  28360. /***/ (function(module, exports, __webpack_require__) {
  28361. /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(/*! elliptic */ 180)
  28362. var BN = __webpack_require__(/*! bn.js */ 169)
  28363. module.exports = function createECDH (curve) {
  28364. return new ECDH(curve)
  28365. }
  28366. var aliases = {
  28367. secp256k1: {
  28368. name: 'secp256k1',
  28369. byteLength: 32
  28370. },
  28371. secp224r1: {
  28372. name: 'p224',
  28373. byteLength: 28
  28374. },
  28375. prime256v1: {
  28376. name: 'p256',
  28377. byteLength: 32
  28378. },
  28379. prime192v1: {
  28380. name: 'p192',
  28381. byteLength: 24
  28382. },
  28383. ed25519: {
  28384. name: 'ed25519',
  28385. byteLength: 32
  28386. },
  28387. secp384r1: {
  28388. name: 'p384',
  28389. byteLength: 48
  28390. },
  28391. secp521r1: {
  28392. name: 'p521',
  28393. byteLength: 66
  28394. }
  28395. }
  28396. aliases.p224 = aliases.secp224r1
  28397. aliases.p256 = aliases.secp256r1 = aliases.prime256v1
  28398. aliases.p192 = aliases.secp192r1 = aliases.prime192v1
  28399. aliases.p384 = aliases.secp384r1
  28400. aliases.p521 = aliases.secp521r1
  28401. function ECDH (curve) {
  28402. this.curveType = aliases[curve]
  28403. if (!this.curveType) {
  28404. this.curveType = {
  28405. name: curve
  28406. }
  28407. }
  28408. this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
  28409. this.keys = void 0
  28410. }
  28411. ECDH.prototype.generateKeys = function (enc, format) {
  28412. this.keys = this.curve.genKeyPair()
  28413. return this.getPublicKey(enc, format)
  28414. }
  28415. ECDH.prototype.computeSecret = function (other, inenc, enc) {
  28416. inenc = inenc || 'utf8'
  28417. if (!Buffer.isBuffer(other)) {
  28418. other = new Buffer(other, inenc)
  28419. }
  28420. var otherPub = this.curve.keyFromPublic(other).getPublic()
  28421. var out = otherPub.mul(this.keys.getPrivate()).getX()
  28422. return formatReturnValue(out, enc, this.curveType.byteLength)
  28423. }
  28424. ECDH.prototype.getPublicKey = function (enc, format) {
  28425. var key = this.keys.getPublic(format === 'compressed', true)
  28426. if (format === 'hybrid') {
  28427. if (key[key.length - 1] % 2) {
  28428. key[0] = 7
  28429. } else {
  28430. key[0] = 6
  28431. }
  28432. }
  28433. return formatReturnValue(key, enc)
  28434. }
  28435. ECDH.prototype.getPrivateKey = function (enc) {
  28436. return formatReturnValue(this.keys.getPrivate(), enc)
  28437. }
  28438. ECDH.prototype.setPublicKey = function (pub, enc) {
  28439. enc = enc || 'utf8'
  28440. if (!Buffer.isBuffer(pub)) {
  28441. pub = new Buffer(pub, enc)
  28442. }
  28443. this.keys._importPublic(pub)
  28444. return this
  28445. }
  28446. ECDH.prototype.setPrivateKey = function (priv, enc) {
  28447. enc = enc || 'utf8'
  28448. if (!Buffer.isBuffer(priv)) {
  28449. priv = new Buffer(priv, enc)
  28450. }
  28451. var _priv = new BN(priv)
  28452. _priv = _priv.toString(16)
  28453. this.keys = this.curve.genKeyPair()
  28454. this.keys._importPrivate(_priv)
  28455. return this
  28456. }
  28457. function formatReturnValue (bn, enc, len) {
  28458. if (!Array.isArray(bn)) {
  28459. bn = bn.toArray()
  28460. }
  28461. var buf = new Buffer(bn)
  28462. if (len && buf.length < len) {
  28463. var zeros = new Buffer(len - buf.length)
  28464. zeros.fill(0)
  28465. buf = Buffer.concat([zeros, buf])
  28466. }
  28467. if (!enc) {
  28468. return buf
  28469. } else {
  28470. return buf.toString(enc)
  28471. }
  28472. }
  28473. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 88).Buffer))
  28474. /***/ }),
  28475. /* 233 */
  28476. /*!************************************************!*\
  28477. !*** ./node_modules/public-encrypt/browser.js ***!
  28478. \************************************************/
  28479. /*! no static exports found */
  28480. /***/ (function(module, exports, __webpack_require__) {
  28481. exports.publicEncrypt = __webpack_require__(/*! ./publicEncrypt */ 234)
  28482. exports.privateDecrypt = __webpack_require__(/*! ./privateDecrypt */ 238)
  28483. exports.privateEncrypt = function privateEncrypt (key, buf) {
  28484. return exports.publicEncrypt(key, buf, true)
  28485. }
  28486. exports.publicDecrypt = function publicDecrypt (key, buf) {
  28487. return exports.privateDecrypt(key, buf, true)
  28488. }
  28489. /***/ }),
  28490. /* 234 */
  28491. /*!******************************************************!*\
  28492. !*** ./node_modules/public-encrypt/publicEncrypt.js ***!
  28493. \******************************************************/
  28494. /*! no static exports found */
  28495. /***/ (function(module, exports, __webpack_require__) {
  28496. var parseKeys = __webpack_require__(/*! parse-asn1 */ 210)
  28497. var randomBytes = __webpack_require__(/*! randombytes */ 84)
  28498. var createHash = __webpack_require__(/*! create-hash */ 92)
  28499. var mgf = __webpack_require__(/*! ./mgf */ 235)
  28500. var xor = __webpack_require__(/*! ./xor */ 236)
  28501. var BN = __webpack_require__(/*! bn.js */ 169)
  28502. var withPublic = __webpack_require__(/*! ./withPublic */ 237)
  28503. var crt = __webpack_require__(/*! browserify-rsa */ 179)
  28504. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  28505. module.exports = function publicEncrypt (publicKey, msg, reverse) {
  28506. var padding
  28507. if (publicKey.padding) {
  28508. padding = publicKey.padding
  28509. } else if (reverse) {
  28510. padding = 1
  28511. } else {
  28512. padding = 4
  28513. }
  28514. var key = parseKeys(publicKey)
  28515. var paddedMsg
  28516. if (padding === 4) {
  28517. paddedMsg = oaep(key, msg)
  28518. } else if (padding === 1) {
  28519. paddedMsg = pkcs1(key, msg, reverse)
  28520. } else if (padding === 3) {
  28521. paddedMsg = new BN(msg)
  28522. if (paddedMsg.cmp(key.modulus) >= 0) {
  28523. throw new Error('data too long for modulus')
  28524. }
  28525. } else {
  28526. throw new Error('unknown padding')
  28527. }
  28528. if (reverse) {
  28529. return crt(paddedMsg, key)
  28530. } else {
  28531. return withPublic(paddedMsg, key)
  28532. }
  28533. }
  28534. function oaep (key, msg) {
  28535. var k = key.modulus.byteLength()
  28536. var mLen = msg.length
  28537. var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
  28538. var hLen = iHash.length
  28539. var hLen2 = 2 * hLen
  28540. if (mLen > k - hLen2 - 2) {
  28541. throw new Error('message too long')
  28542. }
  28543. var ps = Buffer.alloc(k - mLen - hLen2 - 2)
  28544. var dblen = k - hLen - 1
  28545. var seed = randomBytes(hLen)
  28546. var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))
  28547. var maskedSeed = xor(seed, mgf(maskedDb, hLen))
  28548. return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))
  28549. }
  28550. function pkcs1 (key, msg, reverse) {
  28551. var mLen = msg.length
  28552. var k = key.modulus.byteLength()
  28553. if (mLen > k - 11) {
  28554. throw new Error('message too long')
  28555. }
  28556. var ps
  28557. if (reverse) {
  28558. ps = Buffer.alloc(k - mLen - 3, 0xff)
  28559. } else {
  28560. ps = nonZero(k - mLen - 3)
  28561. }
  28562. return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))
  28563. }
  28564. function nonZero (len) {
  28565. var out = Buffer.allocUnsafe(len)
  28566. var i = 0
  28567. var cache = randomBytes(len * 2)
  28568. var cur = 0
  28569. var num
  28570. while (i < len) {
  28571. if (cur === cache.length) {
  28572. cache = randomBytes(len * 2)
  28573. cur = 0
  28574. }
  28575. num = cache[cur++]
  28576. if (num) {
  28577. out[i++] = num
  28578. }
  28579. }
  28580. return out
  28581. }
  28582. /***/ }),
  28583. /* 235 */
  28584. /*!********************************************!*\
  28585. !*** ./node_modules/public-encrypt/mgf.js ***!
  28586. \********************************************/
  28587. /*! no static exports found */
  28588. /***/ (function(module, exports, __webpack_require__) {
  28589. var createHash = __webpack_require__(/*! create-hash */ 92)
  28590. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  28591. module.exports = function (seed, len) {
  28592. var t = Buffer.alloc(0)
  28593. var i = 0
  28594. var c
  28595. while (t.length < len) {
  28596. c = i2ops(i++)
  28597. t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])
  28598. }
  28599. return t.slice(0, len)
  28600. }
  28601. function i2ops (c) {
  28602. var out = Buffer.allocUnsafe(4)
  28603. out.writeUInt32BE(c, 0)
  28604. return out
  28605. }
  28606. /***/ }),
  28607. /* 236 */
  28608. /*!********************************************!*\
  28609. !*** ./node_modules/public-encrypt/xor.js ***!
  28610. \********************************************/
  28611. /*! no static exports found */
  28612. /***/ (function(module, exports) {
  28613. module.exports = function xor (a, b) {
  28614. var len = a.length
  28615. var i = -1
  28616. while (++i < len) {
  28617. a[i] ^= b[i]
  28618. }
  28619. return a
  28620. }
  28621. /***/ }),
  28622. /* 237 */
  28623. /*!***************************************************!*\
  28624. !*** ./node_modules/public-encrypt/withPublic.js ***!
  28625. \***************************************************/
  28626. /*! no static exports found */
  28627. /***/ (function(module, exports, __webpack_require__) {
  28628. var BN = __webpack_require__(/*! bn.js */ 169)
  28629. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  28630. function withPublic (paddedMsg, key) {
  28631. return Buffer.from(paddedMsg
  28632. .toRed(BN.mont(key.modulus))
  28633. .redPow(new BN(key.publicExponent))
  28634. .fromRed()
  28635. .toArray())
  28636. }
  28637. module.exports = withPublic
  28638. /***/ }),
  28639. /* 238 */
  28640. /*!*******************************************************!*\
  28641. !*** ./node_modules/public-encrypt/privateDecrypt.js ***!
  28642. \*******************************************************/
  28643. /*! no static exports found */
  28644. /***/ (function(module, exports, __webpack_require__) {
  28645. var parseKeys = __webpack_require__(/*! parse-asn1 */ 210)
  28646. var mgf = __webpack_require__(/*! ./mgf */ 235)
  28647. var xor = __webpack_require__(/*! ./xor */ 236)
  28648. var BN = __webpack_require__(/*! bn.js */ 169)
  28649. var crt = __webpack_require__(/*! browserify-rsa */ 179)
  28650. var createHash = __webpack_require__(/*! create-hash */ 92)
  28651. var withPublic = __webpack_require__(/*! ./withPublic */ 237)
  28652. var Buffer = __webpack_require__(/*! safe-buffer */ 87).Buffer
  28653. module.exports = function privateDecrypt (privateKey, enc, reverse) {
  28654. var padding
  28655. if (privateKey.padding) {
  28656. padding = privateKey.padding
  28657. } else if (reverse) {
  28658. padding = 1
  28659. } else {
  28660. padding = 4
  28661. }
  28662. var key = parseKeys(privateKey)
  28663. var k = key.modulus.byteLength()
  28664. if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {
  28665. throw new Error('decryption error')
  28666. }
  28667. var msg
  28668. if (reverse) {
  28669. msg = withPublic(new BN(enc), key)
  28670. } else {
  28671. msg = crt(enc, key)
  28672. }
  28673. var zBuffer = Buffer.alloc(k - msg.length)
  28674. msg = Buffer.concat([zBuffer, msg], k)
  28675. if (padding === 4) {
  28676. return oaep(key, msg)
  28677. } else if (padding === 1) {
  28678. return pkcs1(key, msg, reverse)
  28679. } else if (padding === 3) {
  28680. return msg
  28681. } else {
  28682. throw new Error('unknown padding')
  28683. }
  28684. }
  28685. function oaep (key, msg) {
  28686. var k = key.modulus.byteLength()
  28687. var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
  28688. var hLen = iHash.length
  28689. if (msg[0] !== 0) {
  28690. throw new Error('decryption error')
  28691. }
  28692. var maskedSeed = msg.slice(1, hLen + 1)
  28693. var maskedDb = msg.slice(hLen + 1)
  28694. var seed = xor(maskedSeed, mgf(maskedDb, hLen))
  28695. var db = xor(maskedDb, mgf(seed, k - hLen - 1))
  28696. if (compare(iHash, db.slice(0, hLen))) {
  28697. throw new Error('decryption error')
  28698. }
  28699. var i = hLen
  28700. while (db[i] === 0) {
  28701. i++
  28702. }
  28703. if (db[i++] !== 1) {
  28704. throw new Error('decryption error')
  28705. }
  28706. return db.slice(i)
  28707. }
  28708. function pkcs1 (key, msg, reverse) {
  28709. var p1 = msg.slice(0, 2)
  28710. var i = 2
  28711. var status = 0
  28712. while (msg[i++] !== 0) {
  28713. if (i >= msg.length) {
  28714. status++
  28715. break
  28716. }
  28717. }
  28718. var ps = msg.slice(2, i - 1)
  28719. if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {
  28720. status++
  28721. }
  28722. if (ps.length < 8) {
  28723. status++
  28724. }
  28725. if (status) {
  28726. throw new Error('decryption error')
  28727. }
  28728. return msg.slice(i)
  28729. }
  28730. function compare (a, b) {
  28731. a = Buffer.from(a)
  28732. b = Buffer.from(b)
  28733. var dif = 0
  28734. var len = a.length
  28735. if (a.length !== b.length) {
  28736. dif++
  28737. len = Math.min(a.length, b.length)
  28738. }
  28739. var i = -1
  28740. while (++i < len) {
  28741. dif += (a[i] ^ b[i])
  28742. }
  28743. return dif
  28744. }
  28745. /***/ }),
  28746. /* 239 */
  28747. /*!********************************************!*\
  28748. !*** ./node_modules/randomfill/browser.js ***!
  28749. \********************************************/
  28750. /*! no static exports found */
  28751. /***/ (function(module, exports, __webpack_require__) {
  28752. "use strict";
  28753. /* WEBPACK VAR INJECTION */(function(global, process) {
  28754. function oldBrowser () {
  28755. throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
  28756. }
  28757. var safeBuffer = __webpack_require__(/*! safe-buffer */ 87)
  28758. var randombytes = __webpack_require__(/*! randombytes */ 84)
  28759. var Buffer = safeBuffer.Buffer
  28760. var kBufferMaxLength = safeBuffer.kMaxLength
  28761. var crypto = global.crypto || global.msCrypto
  28762. var kMaxUint32 = Math.pow(2, 32) - 1
  28763. function assertOffset (offset, length) {
  28764. if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare
  28765. throw new TypeError('offset must be a number')
  28766. }
  28767. if (offset > kMaxUint32 || offset < 0) {
  28768. throw new TypeError('offset must be a uint32')
  28769. }
  28770. if (offset > kBufferMaxLength || offset > length) {
  28771. throw new RangeError('offset out of range')
  28772. }
  28773. }
  28774. function assertSize (size, offset, length) {
  28775. if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare
  28776. throw new TypeError('size must be a number')
  28777. }
  28778. if (size > kMaxUint32 || size < 0) {
  28779. throw new TypeError('size must be a uint32')
  28780. }
  28781. if (size + offset > length || size > kBufferMaxLength) {
  28782. throw new RangeError('buffer too small')
  28783. }
  28784. }
  28785. if ((crypto && crypto.getRandomValues) || !process.browser) {
  28786. exports.randomFill = randomFill
  28787. exports.randomFillSync = randomFillSync
  28788. } else {
  28789. exports.randomFill = oldBrowser
  28790. exports.randomFillSync = oldBrowser
  28791. }
  28792. function randomFill (buf, offset, size, cb) {
  28793. if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
  28794. throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
  28795. }
  28796. if (typeof offset === 'function') {
  28797. cb = offset
  28798. offset = 0
  28799. size = buf.length
  28800. } else if (typeof size === 'function') {
  28801. cb = size
  28802. size = buf.length - offset
  28803. } else if (typeof cb !== 'function') {
  28804. throw new TypeError('"cb" argument must be a function')
  28805. }
  28806. assertOffset(offset, buf.length)
  28807. assertSize(size, offset, buf.length)
  28808. return actualFill(buf, offset, size, cb)
  28809. }
  28810. function actualFill (buf, offset, size, cb) {
  28811. if (process.browser) {
  28812. var ourBuf = buf.buffer
  28813. var uint = new Uint8Array(ourBuf, offset, size)
  28814. crypto.getRandomValues(uint)
  28815. if (cb) {
  28816. process.nextTick(function () {
  28817. cb(null, buf)
  28818. })
  28819. return
  28820. }
  28821. return buf
  28822. }
  28823. if (cb) {
  28824. randombytes(size, function (err, bytes) {
  28825. if (err) {
  28826. return cb(err)
  28827. }
  28828. bytes.copy(buf, offset)
  28829. cb(null, buf)
  28830. })
  28831. return
  28832. }
  28833. var bytes = randombytes(size)
  28834. bytes.copy(buf, offset)
  28835. return buf
  28836. }
  28837. function randomFillSync (buf, offset, size) {
  28838. if (typeof offset === 'undefined') {
  28839. offset = 0
  28840. }
  28841. if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
  28842. throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
  28843. }
  28844. assertOffset(offset, buf.length)
  28845. if (size === undefined) size = buf.length - offset
  28846. assertSize(size, offset, buf.length)
  28847. return actualFill(buf, offset, size)
  28848. }
  28849. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 85)))
  28850. /***/ }),
  28851. /* 240 */,
  28852. /* 241 */,
  28853. /* 242 */,
  28854. /* 243 */,
  28855. /* 244 */,
  28856. /* 245 */,
  28857. /* 246 */,
  28858. /* 247 */,
  28859. /* 248 */,
  28860. /* 249 */,
  28861. /* 250 */,
  28862. /* 251 */,
  28863. /* 252 */,
  28864. /* 253 */,
  28865. /* 254 */,
  28866. /* 255 */,
  28867. /* 256 */,
  28868. /* 257 */,
  28869. /* 258 */,
  28870. /* 259 */,
  28871. /* 260 */,
  28872. /* 261 */,
  28873. /* 262 */,
  28874. /* 263 */,
  28875. /* 264 */,
  28876. /* 265 */,
  28877. /* 266 */,
  28878. /* 267 */,
  28879. /* 268 */,
  28880. /* 269 */,
  28881. /* 270 */,
  28882. /* 271 */,
  28883. /* 272 */,
  28884. /* 273 */,
  28885. /* 274 */,
  28886. /* 275 */,
  28887. /* 276 */,
  28888. /* 277 */,
  28889. /* 278 */,
  28890. /* 279 */,
  28891. /* 280 */,
  28892. /* 281 */,
  28893. /* 282 */,
  28894. /* 283 */
  28895. /*!********************************************!*\
  28896. !*** F:/uniapp/sqxp-uniapp/api/applist.js ***!
  28897. \********************************************/
  28898. /*! no static exports found */
  28899. /***/ (function(module, exports, __webpack_require__) {
  28900. "use strict";
  28901. Object.defineProperty(exports, "__esModule", { value: true });exports.featuredAppList = featuredAppList;exports.collectionList = collectionList;exports.getBrowseRecordInfoList = getBrowseRecordInfoList;var _request = _interopRequireDefault(__webpack_require__(/*! @/utils/request */ 13));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
  28902. var baseUrl = 'http://192.168.8.213:8080/zzjs-admin';
  28903. // 查询精选商家列表
  28904. function featuredAppList(params) {
  28905. return (0, _request.default)({
  28906. url: baseUrl + '/student/applet/customer/getCustomerListByCollectionCount',
  28907. method: 'get',
  28908. params: params });
  28909. }
  28910. // 查询用户收藏列表
  28911. function collectionList(params) {
  28912. return (0, _request.default)({
  28913. url: baseUrl + '/student/applet/collection/collectionList',
  28914. method: 'get',
  28915. params: params });
  28916. }
  28917. // 查询用户浏览记录
  28918. function getBrowseRecordInfoList(params) {
  28919. return (0, _request.default)({
  28920. url: baseUrl + '/student/applet/record/info/getBrowseRecordInfoList',
  28921. method: 'get',
  28922. params: params });
  28923. }
  28924. /***/ })
  28925. ]]);
  28926. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map