vendor.js 3.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],[
  2. /* 0 */,
  3. /* 1 */
  4. /*!*********************************************************!*\
  5. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  6. \*********************************************************/
  7. /*! no static exports found */
  8. /***/ (function(module, exports, __webpack_require__) {
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", {
  11. value: true
  12. });
  13. exports.default = void 0;
  14. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  15. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  16. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  17. return this;
  18. }();
  19. var key = ['w', 'x'].join('');
  20. var oldWx = target[key];
  21. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  22. function isWxKey(key) {
  23. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  24. return false;
  25. }
  26. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  27. }
  28. function initWx() {
  29. var newWx = {};
  30. for (var _key in oldWx) {
  31. if (isWxKey(_key)) {
  32. // TODO wrapper function
  33. newWx[_key] = oldWx[_key];
  34. }
  35. }
  36. return newWx;
  37. }
  38. target[key] = initWx();
  39. var _default = target[key];
  40. exports.default = _default;
  41. /***/ }),
  42. /* 2 */
  43. /*!************************************************************!*\
  44. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  45. \************************************************************/
  46. /*! no static exports found */
  47. /***/ (function(module, exports, __webpack_require__) {
  48. "use strict";
  49. /* WEBPACK VAR INJECTION */(function(wx, global) {
  50. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  51. Object.defineProperty(exports, "__esModule", {
  52. value: true
  53. });
  54. exports.createApp = createApp;
  55. exports.createComponent = createComponent;
  56. exports.createPage = createPage;
  57. exports.createPlugin = createPlugin;
  58. exports.createSubpackageApp = createSubpackageApp;
  59. exports.default = void 0;
  60. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  61. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  62. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  63. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  64. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  65. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  66. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  67. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  68. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  69. var realAtob;
  70. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  71. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  72. if (typeof atob !== 'function') {
  73. realAtob = function realAtob(str) {
  74. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  75. if (!b64re.test(str)) {
  76. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  77. }
  78. // Adding the padding if missing, for semplicity
  79. str += '=='.slice(2 - (str.length & 3));
  80. var bitmap;
  81. var result = '';
  82. var r1;
  83. var r2;
  84. var i = 0;
  85. for (; i < str.length;) {
  86. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  87. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  88. }
  89. return result;
  90. };
  91. } else {
  92. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  93. realAtob = atob;
  94. }
  95. function b64DecodeUnicode(str) {
  96. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  97. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  98. }).join(''));
  99. }
  100. function getCurrentUserInfo() {
  101. var token = wx.getStorageSync('uni_id_token') || '';
  102. var tokenArr = token.split('.');
  103. if (!token || tokenArr.length !== 3) {
  104. return {
  105. uid: null,
  106. role: [],
  107. permission: [],
  108. tokenExpired: 0
  109. };
  110. }
  111. var userInfo;
  112. try {
  113. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  114. } catch (error) {
  115. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  116. }
  117. userInfo.tokenExpired = userInfo.exp * 1000;
  118. delete userInfo.exp;
  119. delete userInfo.iat;
  120. return userInfo;
  121. }
  122. function uniIdMixin(Vue) {
  123. Vue.prototype.uniIDHasRole = function (roleId) {
  124. var _getCurrentUserInfo = getCurrentUserInfo(),
  125. role = _getCurrentUserInfo.role;
  126. return role.indexOf(roleId) > -1;
  127. };
  128. Vue.prototype.uniIDHasPermission = function (permissionId) {
  129. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  130. permission = _getCurrentUserInfo2.permission;
  131. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  132. };
  133. Vue.prototype.uniIDTokenValid = function () {
  134. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  135. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  136. return tokenExpired > Date.now();
  137. };
  138. }
  139. var _toString = Object.prototype.toString;
  140. var hasOwnProperty = Object.prototype.hasOwnProperty;
  141. function isFn(fn) {
  142. return typeof fn === 'function';
  143. }
  144. function isStr(str) {
  145. return typeof str === 'string';
  146. }
  147. function isObject(obj) {
  148. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  149. }
  150. function isPlainObject(obj) {
  151. return _toString.call(obj) === '[object Object]';
  152. }
  153. function hasOwn(obj, key) {
  154. return hasOwnProperty.call(obj, key);
  155. }
  156. function noop() {}
  157. /**
  158. * Create a cached version of a pure function.
  159. */
  160. function cached(fn) {
  161. var cache = Object.create(null);
  162. return function cachedFn(str) {
  163. var hit = cache[str];
  164. return hit || (cache[str] = fn(str));
  165. };
  166. }
  167. /**
  168. * Camelize a hyphen-delimited string.
  169. */
  170. var camelizeRE = /-(\w)/g;
  171. var camelize = cached(function (str) {
  172. return str.replace(camelizeRE, function (_, c) {
  173. return c ? c.toUpperCase() : '';
  174. });
  175. });
  176. function sortObject(obj) {
  177. var sortObj = {};
  178. if (isPlainObject(obj)) {
  179. Object.keys(obj).sort().forEach(function (key) {
  180. sortObj[key] = obj[key];
  181. });
  182. }
  183. return !Object.keys(sortObj) ? obj : sortObj;
  184. }
  185. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  186. var globalInterceptors = {};
  187. var scopedInterceptors = {};
  188. function mergeHook(parentVal, childVal) {
  189. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  190. return res ? dedupeHooks(res) : res;
  191. }
  192. function dedupeHooks(hooks) {
  193. var res = [];
  194. for (var i = 0; i < hooks.length; i++) {
  195. if (res.indexOf(hooks[i]) === -1) {
  196. res.push(hooks[i]);
  197. }
  198. }
  199. return res;
  200. }
  201. function removeHook(hooks, hook) {
  202. var index = hooks.indexOf(hook);
  203. if (index !== -1) {
  204. hooks.splice(index, 1);
  205. }
  206. }
  207. function mergeInterceptorHook(interceptor, option) {
  208. Object.keys(option).forEach(function (hook) {
  209. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  210. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  211. }
  212. });
  213. }
  214. function removeInterceptorHook(interceptor, option) {
  215. if (!interceptor || !option) {
  216. return;
  217. }
  218. Object.keys(option).forEach(function (hook) {
  219. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  220. removeHook(interceptor[hook], option[hook]);
  221. }
  222. });
  223. }
  224. function addInterceptor(method, option) {
  225. if (typeof method === 'string' && isPlainObject(option)) {
  226. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  227. } else if (isPlainObject(method)) {
  228. mergeInterceptorHook(globalInterceptors, method);
  229. }
  230. }
  231. function removeInterceptor(method, option) {
  232. if (typeof method === 'string') {
  233. if (isPlainObject(option)) {
  234. removeInterceptorHook(scopedInterceptors[method], option);
  235. } else {
  236. delete scopedInterceptors[method];
  237. }
  238. } else if (isPlainObject(method)) {
  239. removeInterceptorHook(globalInterceptors, method);
  240. }
  241. }
  242. function wrapperHook(hook, params) {
  243. return function (data) {
  244. return hook(data, params) || data;
  245. };
  246. }
  247. function isPromise(obj) {
  248. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  249. }
  250. function queue(hooks, data, params) {
  251. var promise = false;
  252. for (var i = 0; i < hooks.length; i++) {
  253. var hook = hooks[i];
  254. if (promise) {
  255. promise = Promise.resolve(wrapperHook(hook, params));
  256. } else {
  257. var res = hook(data, params);
  258. if (isPromise(res)) {
  259. promise = Promise.resolve(res);
  260. }
  261. if (res === false) {
  262. return {
  263. then: function then() {}
  264. };
  265. }
  266. }
  267. }
  268. return promise || {
  269. then: function then(callback) {
  270. return callback(data);
  271. }
  272. };
  273. }
  274. function wrapperOptions(interceptor) {
  275. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  276. ['success', 'fail', 'complete'].forEach(function (name) {
  277. if (Array.isArray(interceptor[name])) {
  278. var oldCallback = options[name];
  279. options[name] = function callbackInterceptor(res) {
  280. queue(interceptor[name], res, options).then(function (res) {
  281. /* eslint-disable no-mixed-operators */
  282. return isFn(oldCallback) && oldCallback(res) || res;
  283. });
  284. };
  285. }
  286. });
  287. return options;
  288. }
  289. function wrapperReturnValue(method, returnValue) {
  290. var returnValueHooks = [];
  291. if (Array.isArray(globalInterceptors.returnValue)) {
  292. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  293. }
  294. var interceptor = scopedInterceptors[method];
  295. if (interceptor && Array.isArray(interceptor.returnValue)) {
  296. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  297. }
  298. returnValueHooks.forEach(function (hook) {
  299. returnValue = hook(returnValue) || returnValue;
  300. });
  301. return returnValue;
  302. }
  303. function getApiInterceptorHooks(method) {
  304. var interceptor = Object.create(null);
  305. Object.keys(globalInterceptors).forEach(function (hook) {
  306. if (hook !== 'returnValue') {
  307. interceptor[hook] = globalInterceptors[hook].slice();
  308. }
  309. });
  310. var scopedInterceptor = scopedInterceptors[method];
  311. if (scopedInterceptor) {
  312. Object.keys(scopedInterceptor).forEach(function (hook) {
  313. if (hook !== 'returnValue') {
  314. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  315. }
  316. });
  317. }
  318. return interceptor;
  319. }
  320. function invokeApi(method, api, options) {
  321. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  322. params[_key - 3] = arguments[_key];
  323. }
  324. var interceptor = getApiInterceptorHooks(method);
  325. if (interceptor && Object.keys(interceptor).length) {
  326. if (Array.isArray(interceptor.invoke)) {
  327. var res = queue(interceptor.invoke, options);
  328. return res.then(function (options) {
  329. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  330. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  331. });
  332. } else {
  333. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  334. }
  335. }
  336. return api.apply(void 0, [options].concat(params));
  337. }
  338. var promiseInterceptor = {
  339. returnValue: function returnValue(res) {
  340. if (!isPromise(res)) {
  341. return res;
  342. }
  343. return new Promise(function (resolve, reject) {
  344. res.then(function (res) {
  345. if (!res) {
  346. resolve(res);
  347. return;
  348. }
  349. if (res[0]) {
  350. reject(res[0]);
  351. } else {
  352. resolve(res[1]);
  353. }
  354. });
  355. });
  356. }
  357. };
  358. var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|rpx2px|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
  359. var CONTEXT_API_RE = /^create|Manager$/;
  360. // Context例外情况
  361. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  362. // 同步例外情况
  363. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  364. var CALLBACK_API_RE = /^on|^off/;
  365. function isContextApi(name) {
  366. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  367. }
  368. function isSyncApi(name) {
  369. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  370. }
  371. function isCallbackApi(name) {
  372. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  373. }
  374. function handlePromise(promise) {
  375. return promise.then(function (data) {
  376. return [null, data];
  377. }).catch(function (err) {
  378. return [err];
  379. });
  380. }
  381. function shouldPromise(name) {
  382. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  383. return false;
  384. }
  385. return true;
  386. }
  387. /* eslint-disable no-extend-native */
  388. if (!Promise.prototype.finally) {
  389. Promise.prototype.finally = function (callback) {
  390. var promise = this.constructor;
  391. return this.then(function (value) {
  392. return promise.resolve(callback()).then(function () {
  393. return value;
  394. });
  395. }, function (reason) {
  396. return promise.resolve(callback()).then(function () {
  397. throw reason;
  398. });
  399. });
  400. };
  401. }
  402. function promisify(name, api) {
  403. if (!shouldPromise(name) || !isFn(api)) {
  404. return api;
  405. }
  406. return function promiseApi() {
  407. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  408. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  409. params[_key2 - 1] = arguments[_key2];
  410. }
  411. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  412. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  413. }
  414. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  415. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  416. success: resolve,
  417. fail: reject
  418. })].concat(params));
  419. })));
  420. };
  421. }
  422. var EPS = 1e-4;
  423. var BASE_DEVICE_WIDTH = 750;
  424. var isIOS = false;
  425. var deviceWidth = 0;
  426. var deviceDPR = 0;
  427. function checkDeviceWidth() {
  428. var _Object$assign = Object.assign({}, wx.getWindowInfo(), {
  429. platform: wx.getDeviceInfo().platform
  430. }),
  431. windowWidth = _Object$assign.windowWidth,
  432. pixelRatio = _Object$assign.pixelRatio,
  433. platform = _Object$assign.platform; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  434. deviceWidth = windowWidth;
  435. deviceDPR = pixelRatio;
  436. isIOS = platform === 'ios';
  437. }
  438. function upx2px(number, newDeviceWidth) {
  439. if (deviceWidth === 0) {
  440. checkDeviceWidth();
  441. }
  442. number = Number(number);
  443. if (number === 0) {
  444. return 0;
  445. }
  446. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  447. if (result < 0) {
  448. result = -result;
  449. }
  450. result = Math.floor(result + EPS);
  451. if (result === 0) {
  452. if (deviceDPR === 1 || !isIOS) {
  453. result = 1;
  454. } else {
  455. result = 0.5;
  456. }
  457. }
  458. return number < 0 ? -result : result;
  459. }
  460. var LOCALE_ZH_HANS = 'zh-Hans';
  461. var LOCALE_ZH_HANT = 'zh-Hant';
  462. var LOCALE_EN = 'en';
  463. var LOCALE_FR = 'fr';
  464. var LOCALE_ES = 'es';
  465. var messages = {};
  466. var locale;
  467. {
  468. locale = normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN;
  469. }
  470. function initI18nMessages() {
  471. if (!isEnableLocale()) {
  472. return;
  473. }
  474. var localeKeys = Object.keys(__uniConfig.locales);
  475. if (localeKeys.length) {
  476. localeKeys.forEach(function (locale) {
  477. var curMessages = messages[locale];
  478. var userMessages = __uniConfig.locales[locale];
  479. if (curMessages) {
  480. Object.assign(curMessages, userMessages);
  481. } else {
  482. messages[locale] = userMessages;
  483. }
  484. });
  485. }
  486. }
  487. initI18nMessages();
  488. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  489. var t = i18n.t;
  490. var i18nMixin = i18n.mixin = {
  491. beforeCreate: function beforeCreate() {
  492. var _this = this;
  493. var unwatch = i18n.i18n.watchLocale(function () {
  494. _this.$forceUpdate();
  495. });
  496. this.$once('hook:beforeDestroy', function () {
  497. unwatch();
  498. });
  499. },
  500. methods: {
  501. $$t: function $$t(key, values) {
  502. return t(key, values);
  503. }
  504. }
  505. };
  506. var setLocale = i18n.setLocale;
  507. var getLocale = i18n.getLocale;
  508. function initAppLocale(Vue, appVm, locale) {
  509. var state = Vue.observable({
  510. locale: locale || i18n.getLocale()
  511. });
  512. var localeWatchers = [];
  513. appVm.$watchLocale = function (fn) {
  514. localeWatchers.push(fn);
  515. };
  516. Object.defineProperty(appVm, '$locale', {
  517. get: function get() {
  518. return state.locale;
  519. },
  520. set: function set(v) {
  521. state.locale = v;
  522. localeWatchers.forEach(function (watch) {
  523. return watch(v);
  524. });
  525. }
  526. });
  527. }
  528. function isEnableLocale() {
  529. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  530. }
  531. function include(str, parts) {
  532. return !!parts.find(function (part) {
  533. return str.indexOf(part) !== -1;
  534. });
  535. }
  536. function startsWith(str, parts) {
  537. return parts.find(function (part) {
  538. return str.indexOf(part) === 0;
  539. });
  540. }
  541. function normalizeLocale(locale, messages) {
  542. if (!locale) {
  543. return;
  544. }
  545. locale = locale.trim().replace(/_/g, '-');
  546. if (messages && messages[locale]) {
  547. return locale;
  548. }
  549. locale = locale.toLowerCase();
  550. if (locale === 'chinese') {
  551. // 支付宝
  552. return LOCALE_ZH_HANS;
  553. }
  554. if (locale.indexOf('zh') === 0) {
  555. if (locale.indexOf('-hans') > -1) {
  556. return LOCALE_ZH_HANS;
  557. }
  558. if (locale.indexOf('-hant') > -1) {
  559. return LOCALE_ZH_HANT;
  560. }
  561. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  562. return LOCALE_ZH_HANT;
  563. }
  564. return LOCALE_ZH_HANS;
  565. }
  566. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  567. if (lang) {
  568. return lang;
  569. }
  570. }
  571. // export function initI18n() {
  572. // const localeKeys = Object.keys(__uniConfig.locales || {})
  573. // if (localeKeys.length) {
  574. // localeKeys.forEach((locale) =>
  575. // i18n.add(locale, __uniConfig.locales[locale])
  576. // )
  577. // }
  578. // }
  579. function getLocale$1() {
  580. // 优先使用 $locale
  581. if (isFn(getApp)) {
  582. var app = getApp({
  583. allowDefault: true
  584. });
  585. if (app && app.$vm) {
  586. return app.$vm.$locale;
  587. }
  588. }
  589. return normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN;
  590. }
  591. function setLocale$1(locale) {
  592. var app = isFn(getApp) ? getApp() : false;
  593. if (!app) {
  594. return false;
  595. }
  596. var oldLocale = app.$vm.$locale;
  597. if (oldLocale !== locale) {
  598. app.$vm.$locale = locale;
  599. onLocaleChangeCallbacks.forEach(function (fn) {
  600. return fn({
  601. locale: locale
  602. });
  603. });
  604. return true;
  605. }
  606. return false;
  607. }
  608. var onLocaleChangeCallbacks = [];
  609. function onLocaleChange(fn) {
  610. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  611. onLocaleChangeCallbacks.push(fn);
  612. }
  613. }
  614. if (typeof global !== 'undefined') {
  615. global.getLocale = getLocale$1;
  616. }
  617. var interceptors = {
  618. promiseInterceptor: promiseInterceptor
  619. };
  620. var baseApi = /*#__PURE__*/Object.freeze({
  621. __proto__: null,
  622. upx2px: upx2px,
  623. rpx2px: upx2px,
  624. getLocale: getLocale$1,
  625. setLocale: setLocale$1,
  626. onLocaleChange: onLocaleChange,
  627. addInterceptor: addInterceptor,
  628. removeInterceptor: removeInterceptor,
  629. interceptors: interceptors
  630. });
  631. function findExistsPageIndex(url) {
  632. var pages = getCurrentPages();
  633. var len = pages.length;
  634. while (len--) {
  635. var page = pages[len];
  636. if (page.$page && page.$page.fullPath === url) {
  637. return len;
  638. }
  639. }
  640. return -1;
  641. }
  642. var redirectTo = {
  643. name: function name(fromArgs) {
  644. if (fromArgs.exists === 'back' && fromArgs.delta) {
  645. return 'navigateBack';
  646. }
  647. return 'redirectTo';
  648. },
  649. args: function args(fromArgs) {
  650. if (fromArgs.exists === 'back' && fromArgs.url) {
  651. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  652. if (existsPageIndex !== -1) {
  653. var delta = getCurrentPages().length - 1 - existsPageIndex;
  654. if (delta > 0) {
  655. fromArgs.delta = delta;
  656. }
  657. }
  658. }
  659. }
  660. };
  661. var previewImage = {
  662. args: function args(fromArgs) {
  663. var currentIndex = parseInt(fromArgs.current);
  664. if (isNaN(currentIndex)) {
  665. return;
  666. }
  667. var urls = fromArgs.urls;
  668. if (!Array.isArray(urls)) {
  669. return;
  670. }
  671. var len = urls.length;
  672. if (!len) {
  673. return;
  674. }
  675. if (currentIndex < 0) {
  676. currentIndex = 0;
  677. } else if (currentIndex >= len) {
  678. currentIndex = len - 1;
  679. }
  680. if (currentIndex > 0) {
  681. fromArgs.current = urls[currentIndex];
  682. fromArgs.urls = urls.filter(function (item, index) {
  683. return index < currentIndex ? item !== urls[currentIndex] : true;
  684. });
  685. } else {
  686. fromArgs.current = urls[0];
  687. }
  688. return {
  689. indicator: false,
  690. loop: false
  691. };
  692. }
  693. };
  694. var UUID_KEY = '__DC_STAT_UUID';
  695. var deviceId;
  696. function useDeviceId(result) {
  697. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  698. if (!deviceId) {
  699. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  700. wx.setStorage({
  701. key: UUID_KEY,
  702. data: deviceId
  703. });
  704. }
  705. result.deviceId = deviceId;
  706. }
  707. function addSafeAreaInsets(result) {
  708. if (result.safeArea) {
  709. var safeArea = result.safeArea;
  710. result.safeAreaInsets = {
  711. top: safeArea.top,
  712. left: safeArea.left,
  713. right: result.windowWidth - safeArea.right,
  714. bottom: result.screenHeight - safeArea.bottom
  715. };
  716. }
  717. }
  718. function populateParameters(result) {
  719. var _result$brand = result.brand,
  720. brand = _result$brand === void 0 ? '' : _result$brand,
  721. _result$model = result.model,
  722. model = _result$model === void 0 ? '' : _result$model,
  723. _result$system = result.system,
  724. system = _result$system === void 0 ? '' : _result$system,
  725. _result$language = result.language,
  726. language = _result$language === void 0 ? '' : _result$language,
  727. theme = result.theme,
  728. version = result.version,
  729. platform = result.platform,
  730. fontSizeSetting = result.fontSizeSetting,
  731. SDKVersion = result.SDKVersion,
  732. pixelRatio = result.pixelRatio,
  733. deviceOrientation = result.deviceOrientation;
  734. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  735. var extraParam = {};
  736. // osName osVersion
  737. var osName = '';
  738. var osVersion = '';
  739. {
  740. osName = system.split(' ')[0] || '';
  741. osVersion = system.split(' ')[1] || '';
  742. }
  743. var hostVersion = version;
  744. // deviceType
  745. var deviceType = getGetDeviceType(result, model);
  746. // deviceModel
  747. var deviceBrand = getDeviceBrand(brand);
  748. // hostName
  749. var _hostName = getHostName(result);
  750. // deviceOrientation
  751. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  752. // devicePixelRatio
  753. var _devicePixelRatio = pixelRatio;
  754. // SDKVersion
  755. var _SDKVersion = SDKVersion;
  756. // hostLanguage
  757. var hostLanguage = (language || '').replace(/_/g, '-');
  758. // wx.getAccountInfoSync
  759. var parameters = {
  760. appId: "__UNI__4A158B4",
  761. appName: "v3-H5",
  762. appVersion: "1.0.0",
  763. appVersionCode: "100",
  764. appLanguage: getAppLanguage(hostLanguage),
  765. uniCompileVersion: "4.45",
  766. uniCompilerVersion: "4.45",
  767. uniRuntimeVersion: "4.45",
  768. uniPlatform: undefined || "mp-weixin",
  769. deviceBrand: deviceBrand,
  770. deviceModel: model,
  771. deviceType: deviceType,
  772. devicePixelRatio: _devicePixelRatio,
  773. deviceOrientation: _deviceOrientation,
  774. osName: osName.toLocaleLowerCase(),
  775. osVersion: osVersion,
  776. hostTheme: theme,
  777. hostVersion: hostVersion,
  778. hostLanguage: hostLanguage,
  779. hostName: _hostName,
  780. hostSDKVersion: _SDKVersion,
  781. hostFontSizeSetting: fontSizeSetting,
  782. windowTop: 0,
  783. windowBottom: 0,
  784. // TODO
  785. osLanguage: undefined,
  786. osTheme: undefined,
  787. ua: undefined,
  788. hostPackageName: undefined,
  789. browserName: undefined,
  790. browserVersion: undefined,
  791. isUniAppX: false
  792. };
  793. Object.assign(result, parameters, extraParam);
  794. }
  795. function getGetDeviceType(result, model) {
  796. var deviceType = result.deviceType || 'phone';
  797. {
  798. var deviceTypeMaps = {
  799. ipad: 'pad',
  800. windows: 'pc',
  801. mac: 'pc'
  802. };
  803. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  804. var _model = model.toLocaleLowerCase();
  805. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  806. var _m = deviceTypeMapsKeys[index];
  807. if (_model.indexOf(_m) !== -1) {
  808. deviceType = deviceTypeMaps[_m];
  809. break;
  810. }
  811. }
  812. }
  813. return deviceType;
  814. }
  815. function getDeviceBrand(brand) {
  816. var deviceBrand = brand;
  817. if (deviceBrand) {
  818. deviceBrand = brand.toLocaleLowerCase();
  819. }
  820. return deviceBrand;
  821. }
  822. function getAppLanguage(defaultLanguage) {
  823. return getLocale$1 ? getLocale$1() : defaultLanguage;
  824. }
  825. function getHostName(result) {
  826. var _platform = 'WeChat';
  827. var _hostName = result.hostName || _platform; // mp-jd
  828. {
  829. if (result.environment) {
  830. _hostName = result.environment;
  831. } else if (result.host && result.host.env) {
  832. _hostName = result.host.env;
  833. }
  834. }
  835. return _hostName;
  836. }
  837. var getSystemInfo = {
  838. returnValue: function returnValue(result) {
  839. useDeviceId(result);
  840. addSafeAreaInsets(result);
  841. populateParameters(result);
  842. }
  843. };
  844. var showActionSheet = {
  845. args: function args(fromArgs) {
  846. if ((0, _typeof2.default)(fromArgs) === 'object') {
  847. fromArgs.alertText = fromArgs.title;
  848. }
  849. }
  850. };
  851. var getAppBaseInfo = {
  852. returnValue: function returnValue(result) {
  853. var _result = result,
  854. version = _result.version,
  855. language = _result.language,
  856. SDKVersion = _result.SDKVersion,
  857. theme = _result.theme;
  858. var _hostName = getHostName(result);
  859. var hostLanguage = (language || '').replace('_', '-');
  860. result = sortObject(Object.assign(result, {
  861. appId: "__UNI__4A158B4",
  862. appName: "v3-H5",
  863. appVersion: "1.0.0",
  864. appVersionCode: "100",
  865. appLanguage: getAppLanguage(hostLanguage),
  866. hostVersion: version,
  867. hostLanguage: hostLanguage,
  868. hostName: _hostName,
  869. hostSDKVersion: SDKVersion,
  870. hostTheme: theme,
  871. isUniAppX: false,
  872. uniPlatform: undefined || "mp-weixin",
  873. uniCompileVersion: "4.45",
  874. uniCompilerVersion: "4.45",
  875. uniRuntimeVersion: "4.45"
  876. }));
  877. }
  878. };
  879. var getDeviceInfo = {
  880. returnValue: function returnValue(result) {
  881. var _result2 = result,
  882. brand = _result2.brand,
  883. model = _result2.model;
  884. var deviceType = getGetDeviceType(result, model);
  885. var deviceBrand = getDeviceBrand(brand);
  886. useDeviceId(result);
  887. result = sortObject(Object.assign(result, {
  888. deviceType: deviceType,
  889. deviceBrand: deviceBrand,
  890. deviceModel: model
  891. }));
  892. }
  893. };
  894. var getWindowInfo = {
  895. returnValue: function returnValue(result) {
  896. addSafeAreaInsets(result);
  897. result = sortObject(Object.assign(result, {
  898. windowTop: 0,
  899. windowBottom: 0
  900. }));
  901. }
  902. };
  903. var getAppAuthorizeSetting = {
  904. returnValue: function returnValue(result) {
  905. var locationReducedAccuracy = result.locationReducedAccuracy;
  906. result.locationAccuracy = 'unsupported';
  907. if (locationReducedAccuracy === true) {
  908. result.locationAccuracy = 'reduced';
  909. } else if (locationReducedAccuracy === false) {
  910. result.locationAccuracy = 'full';
  911. }
  912. }
  913. };
  914. // import navigateTo from 'uni-helpers/navigate-to'
  915. var compressImage = {
  916. args: function args(fromArgs) {
  917. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  918. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  919. fromArgs.compressHeight = fromArgs.compressedHeight;
  920. }
  921. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  922. fromArgs.compressWidth = fromArgs.compressedWidth;
  923. }
  924. }
  925. };
  926. var protocols = {
  927. redirectTo: redirectTo,
  928. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  929. previewImage: previewImage,
  930. getSystemInfo: getSystemInfo,
  931. getSystemInfoSync: getSystemInfo,
  932. showActionSheet: showActionSheet,
  933. getAppBaseInfo: getAppBaseInfo,
  934. getDeviceInfo: getDeviceInfo,
  935. getWindowInfo: getWindowInfo,
  936. getAppAuthorizeSetting: getAppAuthorizeSetting,
  937. compressImage: compressImage
  938. };
  939. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  940. var canIUses = [];
  941. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  942. function processCallback(methodName, method, returnValue) {
  943. return function (res) {
  944. return method(processReturnValue(methodName, res, returnValue));
  945. };
  946. }
  947. function processArgs(methodName, fromArgs) {
  948. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  949. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  950. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  951. if (isPlainObject(fromArgs)) {
  952. // 一般 api 的参数解析
  953. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  954. if (isFn(argsOption)) {
  955. argsOption = argsOption(fromArgs, toArgs) || {};
  956. }
  957. for (var key in fromArgs) {
  958. if (hasOwn(argsOption, key)) {
  959. var keyOption = argsOption[key];
  960. if (isFn(keyOption)) {
  961. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  962. }
  963. if (!keyOption) {
  964. // 不支持的参数
  965. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  966. } else if (isStr(keyOption)) {
  967. // 重写参数 key
  968. toArgs[keyOption] = fromArgs[key];
  969. } else if (isPlainObject(keyOption)) {
  970. // {name:newName,value:value}可重新指定参数 key:value
  971. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  972. }
  973. } else if (CALLBACKS.indexOf(key) !== -1) {
  974. if (isFn(fromArgs[key])) {
  975. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  976. }
  977. } else {
  978. if (!keepFromArgs) {
  979. toArgs[key] = fromArgs[key];
  980. }
  981. }
  982. }
  983. return toArgs;
  984. } else if (isFn(fromArgs)) {
  985. fromArgs = processCallback(methodName, fromArgs, returnValue);
  986. }
  987. return fromArgs;
  988. }
  989. function processReturnValue(methodName, res, returnValue) {
  990. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  991. if (isFn(protocols.returnValue)) {
  992. // 处理通用 returnValue
  993. res = protocols.returnValue(methodName, res);
  994. }
  995. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  996. }
  997. function wrapper(methodName, method) {
  998. if (hasOwn(protocols, methodName)) {
  999. var protocol = protocols[methodName];
  1000. if (!protocol) {
  1001. // 暂不支持的 api
  1002. return function () {
  1003. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  1004. };
  1005. }
  1006. return function (arg1, arg2) {
  1007. // 目前 api 最多两个参数
  1008. var options = protocol;
  1009. if (isFn(protocol)) {
  1010. options = protocol(arg1);
  1011. }
  1012. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1013. var args = [arg1];
  1014. if (typeof arg2 !== 'undefined') {
  1015. args.push(arg2);
  1016. }
  1017. if (isFn(options.name)) {
  1018. methodName = options.name(arg1);
  1019. } else if (isStr(options.name)) {
  1020. methodName = options.name;
  1021. }
  1022. var returnValue = wx[methodName].apply(wx, args);
  1023. if (isSyncApi(methodName)) {
  1024. // 同步 api
  1025. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1026. }
  1027. return returnValue;
  1028. };
  1029. }
  1030. return method;
  1031. }
  1032. var todoApis = Object.create(null);
  1033. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  1034. function createTodoApi(name) {
  1035. return function todoApi(_ref) {
  1036. var fail = _ref.fail,
  1037. complete = _ref.complete;
  1038. var res = {
  1039. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  1040. };
  1041. isFn(fail) && fail(res);
  1042. isFn(complete) && complete(res);
  1043. };
  1044. }
  1045. TODOS.forEach(function (name) {
  1046. todoApis[name] = createTodoApi(name);
  1047. });
  1048. var providers = {
  1049. oauth: ['weixin'],
  1050. share: ['weixin'],
  1051. payment: ['wxpay'],
  1052. push: ['weixin']
  1053. };
  1054. function getProvider(_ref2) {
  1055. var service = _ref2.service,
  1056. success = _ref2.success,
  1057. fail = _ref2.fail,
  1058. complete = _ref2.complete;
  1059. var res = false;
  1060. if (providers[service]) {
  1061. res = {
  1062. errMsg: 'getProvider:ok',
  1063. service: service,
  1064. provider: providers[service]
  1065. };
  1066. isFn(success) && success(res);
  1067. } else {
  1068. res = {
  1069. errMsg: 'getProvider:fail service not found'
  1070. };
  1071. isFn(fail) && fail(res);
  1072. }
  1073. isFn(complete) && complete(res);
  1074. }
  1075. var extraApi = /*#__PURE__*/Object.freeze({
  1076. __proto__: null,
  1077. getProvider: getProvider
  1078. });
  1079. var getEmitter = function () {
  1080. var Emitter;
  1081. return function getUniEmitter() {
  1082. if (!Emitter) {
  1083. Emitter = new _vue.default();
  1084. }
  1085. return Emitter;
  1086. };
  1087. }();
  1088. function apply(ctx, method, args) {
  1089. return ctx[method].apply(ctx, args);
  1090. }
  1091. function $on() {
  1092. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  1093. }
  1094. function $off() {
  1095. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  1096. }
  1097. function $once() {
  1098. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  1099. }
  1100. function $emit() {
  1101. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  1102. }
  1103. var eventApi = /*#__PURE__*/Object.freeze({
  1104. __proto__: null,
  1105. $on: $on,
  1106. $off: $off,
  1107. $once: $once,
  1108. $emit: $emit
  1109. });
  1110. /**
  1111. * 框架内 try-catch
  1112. */
  1113. /**
  1114. * 开发者 try-catch
  1115. */
  1116. function tryCatch(fn) {
  1117. return function () {
  1118. try {
  1119. return fn.apply(fn, arguments);
  1120. } catch (e) {
  1121. // TODO
  1122. console.error(e);
  1123. }
  1124. };
  1125. }
  1126. function getApiCallbacks(params) {
  1127. var apiCallbacks = {};
  1128. for (var name in params) {
  1129. var param = params[name];
  1130. if (isFn(param)) {
  1131. apiCallbacks[name] = tryCatch(param);
  1132. delete params[name];
  1133. }
  1134. }
  1135. return apiCallbacks;
  1136. }
  1137. var cid;
  1138. var cidErrMsg;
  1139. var enabled;
  1140. function normalizePushMessage(message) {
  1141. try {
  1142. return JSON.parse(message);
  1143. } catch (e) {}
  1144. return message;
  1145. }
  1146. function invokePushCallback(args) {
  1147. if (args.type === 'enabled') {
  1148. enabled = true;
  1149. } else if (args.type === 'clientId') {
  1150. cid = args.cid;
  1151. cidErrMsg = args.errMsg;
  1152. invokeGetPushCidCallbacks(cid, args.errMsg);
  1153. } else if (args.type === 'pushMsg') {
  1154. var message = {
  1155. type: 'receive',
  1156. data: normalizePushMessage(args.message)
  1157. };
  1158. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  1159. var callback = onPushMessageCallbacks[i];
  1160. callback(message);
  1161. // 该消息已被阻止
  1162. if (message.stopped) {
  1163. break;
  1164. }
  1165. }
  1166. } else if (args.type === 'click') {
  1167. onPushMessageCallbacks.forEach(function (callback) {
  1168. callback({
  1169. type: 'click',
  1170. data: normalizePushMessage(args.message)
  1171. });
  1172. });
  1173. }
  1174. }
  1175. var getPushCidCallbacks = [];
  1176. function invokeGetPushCidCallbacks(cid, errMsg) {
  1177. getPushCidCallbacks.forEach(function (callback) {
  1178. callback(cid, errMsg);
  1179. });
  1180. getPushCidCallbacks.length = 0;
  1181. }
  1182. function getPushClientId(args) {
  1183. if (!isPlainObject(args)) {
  1184. args = {};
  1185. }
  1186. var _getApiCallbacks = getApiCallbacks(args),
  1187. success = _getApiCallbacks.success,
  1188. fail = _getApiCallbacks.fail,
  1189. complete = _getApiCallbacks.complete;
  1190. var hasSuccess = isFn(success);
  1191. var hasFail = isFn(fail);
  1192. var hasComplete = isFn(complete);
  1193. Promise.resolve().then(function () {
  1194. if (typeof enabled === 'undefined') {
  1195. enabled = false;
  1196. cid = '';
  1197. cidErrMsg = 'uniPush is not enabled';
  1198. }
  1199. getPushCidCallbacks.push(function (cid, errMsg) {
  1200. var res;
  1201. if (cid) {
  1202. res = {
  1203. errMsg: 'getPushClientId:ok',
  1204. cid: cid
  1205. };
  1206. hasSuccess && success(res);
  1207. } else {
  1208. res = {
  1209. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  1210. };
  1211. hasFail && fail(res);
  1212. }
  1213. hasComplete && complete(res);
  1214. });
  1215. if (typeof cid !== 'undefined') {
  1216. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1217. }
  1218. });
  1219. }
  1220. var onPushMessageCallbacks = [];
  1221. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1222. var onPushMessage = function onPushMessage(fn) {
  1223. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1224. onPushMessageCallbacks.push(fn);
  1225. }
  1226. };
  1227. var offPushMessage = function offPushMessage(fn) {
  1228. if (!fn) {
  1229. onPushMessageCallbacks.length = 0;
  1230. } else {
  1231. var index = onPushMessageCallbacks.indexOf(fn);
  1232. if (index > -1) {
  1233. onPushMessageCallbacks.splice(index, 1);
  1234. }
  1235. }
  1236. };
  1237. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  1238. if (!baseInfo) {
  1239. baseInfo = wx.getSystemInfoSync();
  1240. }
  1241. var host = baseInfo ? baseInfo.host : null;
  1242. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  1243. var api = /*#__PURE__*/Object.freeze({
  1244. __proto__: null,
  1245. shareVideoMessage: shareVideoMessage,
  1246. getPushClientId: getPushClientId,
  1247. onPushMessage: onPushMessage,
  1248. offPushMessage: offPushMessage,
  1249. invokePushCallback: invokePushCallback
  1250. });
  1251. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1252. function findVmByVueId(vm, vuePid) {
  1253. var $children = vm.$children;
  1254. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1255. for (var i = $children.length - 1; i >= 0; i--) {
  1256. var childVm = $children[i];
  1257. if (childVm.$scope._$vueId === vuePid) {
  1258. return childVm;
  1259. }
  1260. }
  1261. // 反向递归查找
  1262. var parentVm;
  1263. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1264. parentVm = findVmByVueId($children[_i], vuePid);
  1265. if (parentVm) {
  1266. return parentVm;
  1267. }
  1268. }
  1269. }
  1270. function initBehavior(options) {
  1271. return Behavior(options);
  1272. }
  1273. function isPage() {
  1274. return !!this.route;
  1275. }
  1276. function initRelation(detail) {
  1277. this.triggerEvent('__l', detail);
  1278. }
  1279. function selectAllComponents(mpInstance, selector, $refs) {
  1280. var components = mpInstance.selectAllComponents(selector) || [];
  1281. components.forEach(function (component) {
  1282. var ref = component.dataset.ref;
  1283. $refs[ref] = component.$vm || toSkip(component);
  1284. {
  1285. if (component.dataset.vueGeneric === 'scoped') {
  1286. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1287. selectAllComponents(scopedComponent, selector, $refs);
  1288. });
  1289. }
  1290. }
  1291. });
  1292. }
  1293. function syncRefs(refs, newRefs) {
  1294. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  1295. var newKeys = Object.keys(newRefs);
  1296. newKeys.forEach(function (key) {
  1297. var oldValue = refs[key];
  1298. var newValue = newRefs[key];
  1299. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  1300. return oldValue.includes(value);
  1301. })) {
  1302. return;
  1303. }
  1304. refs[key] = newValue;
  1305. oldKeys.delete(key);
  1306. });
  1307. oldKeys.forEach(function (key) {
  1308. delete refs[key];
  1309. });
  1310. return refs;
  1311. }
  1312. function initRefs(vm) {
  1313. var mpInstance = vm.$scope;
  1314. var refs = {};
  1315. Object.defineProperty(vm, '$refs', {
  1316. get: function get() {
  1317. var $refs = {};
  1318. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1319. // TODO 暂不考虑 for 中的 scoped
  1320. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  1321. forComponents.forEach(function (component) {
  1322. var ref = component.dataset.ref;
  1323. if (!$refs[ref]) {
  1324. $refs[ref] = [];
  1325. }
  1326. $refs[ref].push(component.$vm || toSkip(component));
  1327. });
  1328. return syncRefs(refs, $refs);
  1329. }
  1330. });
  1331. }
  1332. function handleLink(event) {
  1333. var _ref3 = event.detail || event.value,
  1334. vuePid = _ref3.vuePid,
  1335. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  1336. var parentVm;
  1337. if (vuePid) {
  1338. parentVm = findVmByVueId(this.$vm, vuePid);
  1339. }
  1340. if (!parentVm) {
  1341. parentVm = this.$vm;
  1342. }
  1343. vueOptions.parent = parentVm;
  1344. }
  1345. function markMPComponent(component) {
  1346. // 在 Vue 中标记为小程序组件
  1347. var IS_MP = '__v_isMPComponent';
  1348. Object.defineProperty(component, IS_MP, {
  1349. configurable: true,
  1350. enumerable: false,
  1351. value: true
  1352. });
  1353. return component;
  1354. }
  1355. function toSkip(obj) {
  1356. var OB = '__ob__';
  1357. var SKIP = '__v_skip';
  1358. if (isObject(obj) && Object.isExtensible(obj)) {
  1359. // 避免被 @vue/composition-api 观测
  1360. Object.defineProperty(obj, OB, {
  1361. configurable: true,
  1362. enumerable: false,
  1363. value: (0, _defineProperty2.default)({}, SKIP, true)
  1364. });
  1365. }
  1366. return obj;
  1367. }
  1368. var WORKLET_RE = /_(.*)_worklet_factory_/;
  1369. function initWorkletMethods(mpMethods, vueMethods) {
  1370. if (vueMethods) {
  1371. Object.keys(vueMethods).forEach(function (name) {
  1372. var matches = name.match(WORKLET_RE);
  1373. if (matches) {
  1374. var workletName = matches[1];
  1375. mpMethods[name] = vueMethods[name];
  1376. mpMethods[workletName] = vueMethods[workletName];
  1377. }
  1378. });
  1379. }
  1380. }
  1381. var MPPage = Page;
  1382. var MPComponent = Component;
  1383. var customizeRE = /:/g;
  1384. var customize = cached(function (str) {
  1385. return camelize(str.replace(customizeRE, '-'));
  1386. });
  1387. function initTriggerEvent(mpInstance) {
  1388. var oldTriggerEvent = mpInstance.triggerEvent;
  1389. var newTriggerEvent = function newTriggerEvent(event) {
  1390. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  1391. args[_key3 - 1] = arguments[_key3];
  1392. }
  1393. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  1394. if (this.$vm || this.dataset && this.dataset.comType) {
  1395. event = customize(event);
  1396. } else {
  1397. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  1398. var newEvent = customize(event);
  1399. if (newEvent !== event) {
  1400. oldTriggerEvent.apply(this, [newEvent].concat(args));
  1401. }
  1402. }
  1403. return oldTriggerEvent.apply(this, [event].concat(args));
  1404. };
  1405. try {
  1406. // 京东小程序 triggerEvent 为只读
  1407. mpInstance.triggerEvent = newTriggerEvent;
  1408. } catch (error) {
  1409. mpInstance._triggerEvent = newTriggerEvent;
  1410. }
  1411. }
  1412. function initHook(name, options, isComponent) {
  1413. var oldHook = options[name];
  1414. options[name] = function () {
  1415. markMPComponent(this);
  1416. initTriggerEvent(this);
  1417. if (oldHook) {
  1418. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1419. args[_key4] = arguments[_key4];
  1420. }
  1421. return oldHook.apply(this, args);
  1422. }
  1423. };
  1424. }
  1425. if (!MPPage.__$wrappered) {
  1426. MPPage.__$wrappered = true;
  1427. Page = function Page() {
  1428. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1429. initHook('onLoad', options);
  1430. return MPPage(options);
  1431. };
  1432. Page.after = MPPage.after;
  1433. Component = function Component() {
  1434. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1435. initHook('created', options);
  1436. return MPComponent(options);
  1437. };
  1438. }
  1439. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  1440. function initMocks(vm, mocks) {
  1441. var mpInstance = vm.$mp[vm.mpType];
  1442. mocks.forEach(function (mock) {
  1443. if (hasOwn(mpInstance, mock)) {
  1444. vm[mock] = mpInstance[mock];
  1445. }
  1446. });
  1447. }
  1448. function hasHook(hook, vueOptions) {
  1449. if (!vueOptions) {
  1450. return true;
  1451. }
  1452. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1453. return true;
  1454. }
  1455. vueOptions = vueOptions.default || vueOptions;
  1456. if (isFn(vueOptions)) {
  1457. if (isFn(vueOptions.extendOptions[hook])) {
  1458. return true;
  1459. }
  1460. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  1461. return true;
  1462. }
  1463. return false;
  1464. }
  1465. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  1466. return true;
  1467. }
  1468. var mixins = vueOptions.mixins;
  1469. if (Array.isArray(mixins)) {
  1470. return !!mixins.find(function (mixin) {
  1471. return hasHook(hook, mixin);
  1472. });
  1473. }
  1474. }
  1475. function initHooks(mpOptions, hooks, vueOptions) {
  1476. hooks.forEach(function (hook) {
  1477. if (hasHook(hook, vueOptions)) {
  1478. mpOptions[hook] = function (args) {
  1479. return this.$vm && this.$vm.__call_hook(hook, args);
  1480. };
  1481. }
  1482. });
  1483. }
  1484. function initUnknownHooks(mpOptions, vueOptions) {
  1485. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1486. findHooks(vueOptions).forEach(function (hook) {
  1487. return initHook$1(mpOptions, hook, excludes);
  1488. });
  1489. }
  1490. function findHooks(vueOptions) {
  1491. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  1492. if (vueOptions) {
  1493. Object.keys(vueOptions).forEach(function (name) {
  1494. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  1495. hooks.push(name);
  1496. }
  1497. });
  1498. }
  1499. return hooks;
  1500. }
  1501. function initHook$1(mpOptions, hook, excludes) {
  1502. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  1503. mpOptions[hook] = function (args) {
  1504. return this.$vm && this.$vm.__call_hook(hook, args);
  1505. };
  1506. }
  1507. }
  1508. function initVueComponent(Vue, vueOptions) {
  1509. vueOptions = vueOptions.default || vueOptions;
  1510. var VueComponent;
  1511. if (isFn(vueOptions)) {
  1512. VueComponent = vueOptions;
  1513. } else {
  1514. VueComponent = Vue.extend(vueOptions);
  1515. }
  1516. vueOptions = VueComponent.options;
  1517. return [VueComponent, vueOptions];
  1518. }
  1519. function initSlots(vm, vueSlots) {
  1520. if (Array.isArray(vueSlots) && vueSlots.length) {
  1521. var $slots = Object.create(null);
  1522. vueSlots.forEach(function (slotName) {
  1523. $slots[slotName] = true;
  1524. });
  1525. vm.$scopedSlots = vm.$slots = $slots;
  1526. }
  1527. }
  1528. function initVueIds(vueIds, mpInstance) {
  1529. vueIds = (vueIds || '').split(',');
  1530. var len = vueIds.length;
  1531. if (len === 1) {
  1532. mpInstance._$vueId = vueIds[0];
  1533. } else if (len === 2) {
  1534. mpInstance._$vueId = vueIds[0];
  1535. mpInstance._$vuePid = vueIds[1];
  1536. }
  1537. }
  1538. function initData(vueOptions, context) {
  1539. var data = vueOptions.data || {};
  1540. var methods = vueOptions.methods || {};
  1541. if (typeof data === 'function') {
  1542. try {
  1543. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1544. } catch (e) {
  1545. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1546. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1547. }
  1548. }
  1549. } else {
  1550. try {
  1551. // 对 data 格式化
  1552. data = JSON.parse(JSON.stringify(data));
  1553. } catch (e) {}
  1554. }
  1555. if (!isPlainObject(data)) {
  1556. data = {};
  1557. }
  1558. Object.keys(methods).forEach(function (methodName) {
  1559. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1560. data[methodName] = methods[methodName];
  1561. }
  1562. });
  1563. return data;
  1564. }
  1565. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1566. function createObserver(name) {
  1567. return function observer(newVal, oldVal) {
  1568. if (this.$vm) {
  1569. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1570. }
  1571. };
  1572. }
  1573. function initBehaviors(vueOptions, initBehavior) {
  1574. var vueBehaviors = vueOptions.behaviors;
  1575. var vueExtends = vueOptions.extends;
  1576. var vueMixins = vueOptions.mixins;
  1577. var vueProps = vueOptions.props;
  1578. if (!vueProps) {
  1579. vueOptions.props = vueProps = [];
  1580. }
  1581. var behaviors = [];
  1582. if (Array.isArray(vueBehaviors)) {
  1583. vueBehaviors.forEach(function (behavior) {
  1584. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1585. if (behavior === 'uni://form-field') {
  1586. if (Array.isArray(vueProps)) {
  1587. vueProps.push('name');
  1588. vueProps.push('value');
  1589. } else {
  1590. vueProps.name = {
  1591. type: String,
  1592. default: ''
  1593. };
  1594. vueProps.value = {
  1595. type: [String, Number, Boolean, Array, Object, Date],
  1596. default: ''
  1597. };
  1598. }
  1599. }
  1600. });
  1601. }
  1602. if (isPlainObject(vueExtends) && vueExtends.props) {
  1603. behaviors.push(initBehavior({
  1604. properties: initProperties(vueExtends.props, true)
  1605. }));
  1606. }
  1607. if (Array.isArray(vueMixins)) {
  1608. vueMixins.forEach(function (vueMixin) {
  1609. if (isPlainObject(vueMixin) && vueMixin.props) {
  1610. behaviors.push(initBehavior({
  1611. properties: initProperties(vueMixin.props, true)
  1612. }));
  1613. }
  1614. });
  1615. }
  1616. return behaviors;
  1617. }
  1618. function parsePropType(key, type, defaultValue, file) {
  1619. // [String]=>String
  1620. if (Array.isArray(type) && type.length === 1) {
  1621. return type[0];
  1622. }
  1623. return type;
  1624. }
  1625. function initProperties(props) {
  1626. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1627. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  1628. var options = arguments.length > 3 ? arguments[3] : undefined;
  1629. var properties = {};
  1630. if (!isBehavior) {
  1631. properties.vueId = {
  1632. type: String,
  1633. value: ''
  1634. };
  1635. {
  1636. if (options.virtualHost) {
  1637. properties.virtualHostStyle = {
  1638. type: null,
  1639. value: ''
  1640. };
  1641. properties.virtualHostClass = {
  1642. type: null,
  1643. value: ''
  1644. };
  1645. }
  1646. }
  1647. // scopedSlotsCompiler auto
  1648. properties.scopedSlotsCompiler = {
  1649. type: String,
  1650. value: ''
  1651. };
  1652. properties.vueSlots = {
  1653. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1654. type: null,
  1655. value: [],
  1656. observer: function observer(newVal, oldVal) {
  1657. var $slots = Object.create(null);
  1658. newVal.forEach(function (slotName) {
  1659. $slots[slotName] = true;
  1660. });
  1661. this.setData({
  1662. $slots: $slots
  1663. });
  1664. }
  1665. };
  1666. }
  1667. if (Array.isArray(props)) {
  1668. // ['title']
  1669. props.forEach(function (key) {
  1670. properties[key] = {
  1671. type: null,
  1672. observer: createObserver(key)
  1673. };
  1674. });
  1675. } else if (isPlainObject(props)) {
  1676. // {title:{type:String,default:''},content:String}
  1677. Object.keys(props).forEach(function (key) {
  1678. var opts = props[key];
  1679. if (isPlainObject(opts)) {
  1680. // title:{type:String,default:''}
  1681. var value = opts.default;
  1682. if (isFn(value)) {
  1683. value = value();
  1684. }
  1685. opts.type = parsePropType(key, opts.type);
  1686. properties[key] = {
  1687. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1688. value: value,
  1689. observer: createObserver(key)
  1690. };
  1691. } else {
  1692. // content:String
  1693. var type = parsePropType(key, opts);
  1694. properties[key] = {
  1695. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1696. observer: createObserver(key)
  1697. };
  1698. }
  1699. });
  1700. }
  1701. return properties;
  1702. }
  1703. function wrapper$1(event) {
  1704. // TODO 又得兼容 mpvue 的 mp 对象
  1705. try {
  1706. event.mp = JSON.parse(JSON.stringify(event));
  1707. } catch (e) {}
  1708. event.stopPropagation = noop;
  1709. event.preventDefault = noop;
  1710. event.target = event.target || {};
  1711. if (!hasOwn(event, 'detail')) {
  1712. event.detail = {};
  1713. }
  1714. if (hasOwn(event, 'markerId')) {
  1715. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  1716. event.detail.markerId = event.markerId;
  1717. }
  1718. if (isPlainObject(event.detail)) {
  1719. event.target = Object.assign({}, event.target, event.detail);
  1720. }
  1721. return event;
  1722. }
  1723. function getExtraValue(vm, dataPathsArray) {
  1724. var context = vm;
  1725. dataPathsArray.forEach(function (dataPathArray) {
  1726. var dataPath = dataPathArray[0];
  1727. var value = dataPathArray[2];
  1728. if (dataPath || typeof value !== 'undefined') {
  1729. // ['','',index,'disable']
  1730. var propPath = dataPathArray[1];
  1731. var valuePath = dataPathArray[3];
  1732. var vFor;
  1733. if (Number.isInteger(dataPath)) {
  1734. vFor = dataPath;
  1735. } else if (!dataPath) {
  1736. vFor = context;
  1737. } else if (typeof dataPath === 'string' && dataPath) {
  1738. if (dataPath.indexOf('#s#') === 0) {
  1739. vFor = dataPath.substr(3);
  1740. } else {
  1741. vFor = vm.__get_value(dataPath, context);
  1742. }
  1743. }
  1744. if (Number.isInteger(vFor)) {
  1745. context = value;
  1746. } else if (!propPath) {
  1747. context = vFor[value];
  1748. } else {
  1749. if (Array.isArray(vFor)) {
  1750. context = vFor.find(function (vForItem) {
  1751. return vm.__get_value(propPath, vForItem) === value;
  1752. });
  1753. } else if (isPlainObject(vFor)) {
  1754. context = Object.keys(vFor).find(function (vForKey) {
  1755. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1756. });
  1757. } else {
  1758. console.error('v-for 暂不支持循环数据:', vFor);
  1759. }
  1760. }
  1761. if (valuePath) {
  1762. context = vm.__get_value(valuePath, context);
  1763. }
  1764. }
  1765. });
  1766. return context;
  1767. }
  1768. function processEventExtra(vm, extra, event, __args__) {
  1769. var extraObj = {};
  1770. if (Array.isArray(extra) && extra.length) {
  1771. /**
  1772. *[
  1773. * ['data.items', 'data.id', item.data.id],
  1774. * ['metas', 'id', meta.id]
  1775. *],
  1776. *[
  1777. * ['data.items', 'data.id', item.data.id],
  1778. * ['metas', 'id', meta.id]
  1779. *],
  1780. *'test'
  1781. */
  1782. extra.forEach(function (dataPath, index) {
  1783. if (typeof dataPath === 'string') {
  1784. if (!dataPath) {
  1785. // model,prop.sync
  1786. extraObj['$' + index] = vm;
  1787. } else {
  1788. if (dataPath === '$event') {
  1789. // $event
  1790. extraObj['$' + index] = event;
  1791. } else if (dataPath === 'arguments') {
  1792. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  1793. } else if (dataPath.indexOf('$event.') === 0) {
  1794. // $event.target.value
  1795. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1796. } else {
  1797. extraObj['$' + index] = vm.__get_value(dataPath);
  1798. }
  1799. }
  1800. } else {
  1801. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1802. }
  1803. });
  1804. }
  1805. return extraObj;
  1806. }
  1807. function getObjByArray(arr) {
  1808. var obj = {};
  1809. for (var i = 1; i < arr.length; i++) {
  1810. var element = arr[i];
  1811. obj[element[0]] = element[1];
  1812. }
  1813. return obj;
  1814. }
  1815. function processEventArgs(vm, event) {
  1816. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  1817. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  1818. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  1819. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1820. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1821. // fixed 用户直接触发 mpInstance.triggerEvent
  1822. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  1823. if (isCustom) {
  1824. // 自定义事件
  1825. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  1826. if (!args.length) {
  1827. // 无参数,直接传入 event 或 detail 数组
  1828. if (isCustomMPEvent) {
  1829. return [event];
  1830. }
  1831. return __args__;
  1832. }
  1833. }
  1834. var extraObj = processEventExtra(vm, extra, event, __args__);
  1835. var ret = [];
  1836. args.forEach(function (arg) {
  1837. if (arg === '$event') {
  1838. if (methodName === '__set_model' && !isCustom) {
  1839. // input v-model value
  1840. ret.push(event.target.value);
  1841. } else {
  1842. if (isCustom && !isCustomMPEvent) {
  1843. ret.push(__args__[0]);
  1844. } else {
  1845. // wxcomponent 组件或内置组件
  1846. ret.push(event);
  1847. }
  1848. }
  1849. } else {
  1850. if (Array.isArray(arg) && arg[0] === 'o') {
  1851. ret.push(getObjByArray(arg));
  1852. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1853. ret.push(extraObj[arg]);
  1854. } else {
  1855. ret.push(arg);
  1856. }
  1857. }
  1858. });
  1859. return ret;
  1860. }
  1861. var ONCE = '~';
  1862. var CUSTOM = '^';
  1863. function isMatchEventType(eventType, optType) {
  1864. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  1865. }
  1866. function getContextVm(vm) {
  1867. var $parent = vm.$parent;
  1868. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1869. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1870. $parent = $parent.$parent;
  1871. }
  1872. return $parent && $parent.$parent;
  1873. }
  1874. function handleEvent(event) {
  1875. var _this2 = this;
  1876. event = wrapper$1(event);
  1877. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1878. var dataset = (event.currentTarget || event.target).dataset;
  1879. if (!dataset) {
  1880. return console.warn('事件信息不存在');
  1881. }
  1882. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1883. if (!eventOpts) {
  1884. return console.warn('事件信息不存在');
  1885. }
  1886. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1887. var eventType = event.type;
  1888. var ret = [];
  1889. eventOpts.forEach(function (eventOpt) {
  1890. var type = eventOpt[0];
  1891. var eventsArray = eventOpt[1];
  1892. var isCustom = type.charAt(0) === CUSTOM;
  1893. type = isCustom ? type.slice(1) : type;
  1894. var isOnce = type.charAt(0) === ONCE;
  1895. type = isOnce ? type.slice(1) : type;
  1896. if (eventsArray && isMatchEventType(eventType, type)) {
  1897. eventsArray.forEach(function (eventArray) {
  1898. var methodName = eventArray[0];
  1899. if (methodName) {
  1900. var handlerCtx = _this2.$vm;
  1901. if (handlerCtx.$options.generic) {
  1902. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1903. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1904. }
  1905. if (methodName === '$emit') {
  1906. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  1907. return;
  1908. }
  1909. var handler = handlerCtx[methodName];
  1910. if (!isFn(handler)) {
  1911. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1912. var path = _this2.route || _this2.is;
  1913. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1914. }
  1915. if (isOnce) {
  1916. if (handler.once) {
  1917. return;
  1918. }
  1919. handler.once = true;
  1920. }
  1921. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  1922. params = Array.isArray(params) ? params : [];
  1923. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1924. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1925. // eslint-disable-next-line no-sparse-arrays
  1926. params = params.concat([,,,,,,,,,, event]);
  1927. }
  1928. ret.push(handler.apply(handlerCtx, params));
  1929. }
  1930. });
  1931. }
  1932. });
  1933. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  1934. return ret[0];
  1935. }
  1936. }
  1937. var eventChannels = {};
  1938. function getEventChannel(id) {
  1939. var eventChannel = eventChannels[id];
  1940. delete eventChannels[id];
  1941. return eventChannel;
  1942. }
  1943. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  1944. function initEventChannel() {
  1945. _vue.default.prototype.getOpenerEventChannel = function () {
  1946. // 微信小程序使用自身getOpenerEventChannel
  1947. {
  1948. return this.$scope.getOpenerEventChannel();
  1949. }
  1950. };
  1951. var callHook = _vue.default.prototype.__call_hook;
  1952. _vue.default.prototype.__call_hook = function (hook, args) {
  1953. if (hook === 'onLoad' && args && args.__id__) {
  1954. this.__eventChannel__ = getEventChannel(args.__id__);
  1955. delete args.__id__;
  1956. }
  1957. return callHook.call(this, hook, args);
  1958. };
  1959. }
  1960. function initScopedSlotsParams() {
  1961. var center = {};
  1962. var parents = {};
  1963. function currentId(fn) {
  1964. var vueIds = this.$options.propsData.vueId;
  1965. if (vueIds) {
  1966. var vueId = vueIds.split(',')[0];
  1967. fn(vueId);
  1968. }
  1969. }
  1970. _vue.default.prototype.$hasSSP = function (vueId) {
  1971. var slot = center[vueId];
  1972. if (!slot) {
  1973. parents[vueId] = this;
  1974. this.$on('hook:destroyed', function () {
  1975. delete parents[vueId];
  1976. });
  1977. }
  1978. return slot;
  1979. };
  1980. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  1981. var slot = center[vueId];
  1982. if (slot) {
  1983. var params = slot[name] || [];
  1984. if (needAll) {
  1985. return params;
  1986. }
  1987. return params[0];
  1988. }
  1989. };
  1990. _vue.default.prototype.$setSSP = function (name, value) {
  1991. var index = 0;
  1992. currentId.call(this, function (vueId) {
  1993. var slot = center[vueId];
  1994. var params = slot[name] = slot[name] || [];
  1995. params.push(value);
  1996. index = params.length - 1;
  1997. });
  1998. return index;
  1999. };
  2000. _vue.default.prototype.$initSSP = function () {
  2001. currentId.call(this, function (vueId) {
  2002. center[vueId] = {};
  2003. });
  2004. };
  2005. _vue.default.prototype.$callSSP = function () {
  2006. currentId.call(this, function (vueId) {
  2007. if (parents[vueId]) {
  2008. parents[vueId].$forceUpdate();
  2009. }
  2010. });
  2011. };
  2012. _vue.default.mixin({
  2013. destroyed: function destroyed() {
  2014. var propsData = this.$options.propsData;
  2015. var vueId = propsData && propsData.vueId;
  2016. if (vueId) {
  2017. delete center[vueId];
  2018. delete parents[vueId];
  2019. }
  2020. }
  2021. });
  2022. }
  2023. function parseBaseApp(vm, _ref4) {
  2024. var mocks = _ref4.mocks,
  2025. initRefs = _ref4.initRefs;
  2026. initEventChannel();
  2027. {
  2028. initScopedSlotsParams();
  2029. }
  2030. if (vm.$options.store) {
  2031. _vue.default.prototype.$store = vm.$options.store;
  2032. }
  2033. uniIdMixin(_vue.default);
  2034. _vue.default.prototype.mpHost = "mp-weixin";
  2035. _vue.default.mixin({
  2036. beforeCreate: function beforeCreate() {
  2037. if (!this.$options.mpType) {
  2038. return;
  2039. }
  2040. this.mpType = this.$options.mpType;
  2041. this.$mp = (0, _defineProperty2.default)({
  2042. data: {}
  2043. }, this.mpType, this.$options.mpInstance);
  2044. this.$scope = this.$options.mpInstance;
  2045. delete this.$options.mpType;
  2046. delete this.$options.mpInstance;
  2047. if (this.mpType === 'page' && typeof getApp === 'function') {
  2048. // hack vue-i18n
  2049. var app = getApp();
  2050. if (app.$vm && app.$vm.$i18n) {
  2051. this._i18n = app.$vm.$i18n;
  2052. }
  2053. }
  2054. if (this.mpType !== 'app') {
  2055. initRefs(this);
  2056. initMocks(this, mocks);
  2057. }
  2058. }
  2059. });
  2060. var appOptions = {
  2061. onLaunch: function onLaunch(args) {
  2062. if (this.$vm) {
  2063. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  2064. return;
  2065. }
  2066. {
  2067. if (wx.canIUse && !wx.canIUse('nextTick')) {
  2068. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  2069. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  2070. }
  2071. }
  2072. this.$vm = vm;
  2073. this.$vm.$mp = {
  2074. app: this
  2075. };
  2076. this.$vm.$scope = this;
  2077. // vm 上也挂载 globalData
  2078. this.$vm.globalData = this.globalData;
  2079. this.$vm._isMounted = true;
  2080. this.$vm.__call_hook('mounted', args);
  2081. this.$vm.__call_hook('onLaunch', args);
  2082. }
  2083. };
  2084. // 兼容旧版本 globalData
  2085. appOptions.globalData = vm.$options.globalData || {};
  2086. // 将 methods 中的方法挂在 getApp() 中
  2087. var methods = vm.$options.methods;
  2088. if (methods) {
  2089. Object.keys(methods).forEach(function (name) {
  2090. appOptions[name] = methods[name];
  2091. });
  2092. }
  2093. initAppLocale(_vue.default, vm, normalizeLocale(wx.getAppBaseInfo().language) || LOCALE_EN);
  2094. initHooks(appOptions, hooks);
  2095. initUnknownHooks(appOptions, vm.$options);
  2096. return appOptions;
  2097. }
  2098. function parseApp(vm) {
  2099. return parseBaseApp(vm, {
  2100. mocks: mocks,
  2101. initRefs: initRefs
  2102. });
  2103. }
  2104. function createApp(vm) {
  2105. App(parseApp(vm));
  2106. return vm;
  2107. }
  2108. var encodeReserveRE = /[!'()*]/g;
  2109. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  2110. return '%' + c.charCodeAt(0).toString(16);
  2111. };
  2112. var commaRE = /%2C/g;
  2113. // fixed encodeURIComponent which is more conformant to RFC3986:
  2114. // - escapes [!'()*]
  2115. // - preserve commas
  2116. var encode = function encode(str) {
  2117. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  2118. };
  2119. function stringifyQuery(obj) {
  2120. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  2121. var res = obj ? Object.keys(obj).map(function (key) {
  2122. var val = obj[key];
  2123. if (val === undefined) {
  2124. return '';
  2125. }
  2126. if (val === null) {
  2127. return encodeStr(key);
  2128. }
  2129. if (Array.isArray(val)) {
  2130. var result = [];
  2131. val.forEach(function (val2) {
  2132. if (val2 === undefined) {
  2133. return;
  2134. }
  2135. if (val2 === null) {
  2136. result.push(encodeStr(key));
  2137. } else {
  2138. result.push(encodeStr(key) + '=' + encodeStr(val2));
  2139. }
  2140. });
  2141. return result.join('&');
  2142. }
  2143. return encodeStr(key) + '=' + encodeStr(val);
  2144. }).filter(function (x) {
  2145. return x.length > 0;
  2146. }).join('&') : null;
  2147. return res ? "?".concat(res) : '';
  2148. }
  2149. function parseBaseComponent(vueComponentOptions) {
  2150. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  2151. isPage = _ref5.isPage,
  2152. initRelation = _ref5.initRelation;
  2153. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  2154. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  2155. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  2156. VueComponent = _initVueComponent2[0],
  2157. vueOptions = _initVueComponent2[1];
  2158. var options = _objectSpread({
  2159. multipleSlots: true,
  2160. // styleIsolation: 'apply-shared',
  2161. addGlobalClass: true
  2162. }, vueOptions.options || {});
  2163. {
  2164. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  2165. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  2166. Object.assign(options, vueOptions['mp-weixin'].options);
  2167. }
  2168. }
  2169. var componentOptions = {
  2170. options: options,
  2171. data: initData(vueOptions, _vue.default.prototype),
  2172. behaviors: initBehaviors(vueOptions, initBehavior),
  2173. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  2174. lifetimes: {
  2175. attached: function attached() {
  2176. var properties = this.properties;
  2177. var options = {
  2178. mpType: isPage.call(this) ? 'page' : 'component',
  2179. mpInstance: this,
  2180. propsData: properties
  2181. };
  2182. initVueIds(properties.vueId, this);
  2183. // 处理父子关系
  2184. initRelation.call(this, {
  2185. vuePid: this._$vuePid,
  2186. vueOptions: options
  2187. });
  2188. // 初始化 vue 实例
  2189. this.$vm = new VueComponent(options);
  2190. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  2191. initSlots(this.$vm, properties.vueSlots);
  2192. // 触发首次 setData
  2193. this.$vm.$mount();
  2194. },
  2195. ready: function ready() {
  2196. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  2197. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  2198. if (this.$vm) {
  2199. this.$vm._isMounted = true;
  2200. this.$vm.__call_hook('mounted');
  2201. this.$vm.__call_hook('onReady');
  2202. }
  2203. },
  2204. detached: function detached() {
  2205. this.$vm && this.$vm.$destroy();
  2206. }
  2207. },
  2208. pageLifetimes: {
  2209. show: function show(args) {
  2210. this.$vm && this.$vm.__call_hook('onPageShow', args);
  2211. },
  2212. hide: function hide() {
  2213. this.$vm && this.$vm.__call_hook('onPageHide');
  2214. },
  2215. resize: function resize(size) {
  2216. this.$vm && this.$vm.__call_hook('onPageResize', size);
  2217. }
  2218. },
  2219. methods: {
  2220. __l: handleLink,
  2221. __e: handleEvent
  2222. }
  2223. };
  2224. // externalClasses
  2225. if (vueOptions.externalClasses) {
  2226. componentOptions.externalClasses = vueOptions.externalClasses;
  2227. }
  2228. if (Array.isArray(vueOptions.wxsCallMethods)) {
  2229. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  2230. componentOptions.methods[callMethod] = function (args) {
  2231. return this.$vm[callMethod](args);
  2232. };
  2233. });
  2234. }
  2235. if (needVueOptions) {
  2236. return [componentOptions, vueOptions, VueComponent];
  2237. }
  2238. if (isPage) {
  2239. return componentOptions;
  2240. }
  2241. return [componentOptions, VueComponent];
  2242. }
  2243. function parseComponent(vueComponentOptions, needVueOptions) {
  2244. return parseBaseComponent(vueComponentOptions, {
  2245. isPage: isPage,
  2246. initRelation: initRelation
  2247. }, needVueOptions);
  2248. }
  2249. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  2250. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  2251. function parseBasePage(vuePageOptions) {
  2252. var _parseComponent = parseComponent(vuePageOptions, true),
  2253. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  2254. pageOptions = _parseComponent2[0],
  2255. vueOptions = _parseComponent2[1];
  2256. initHooks(pageOptions.methods, hooks$1, vueOptions);
  2257. pageOptions.methods.onLoad = function (query) {
  2258. this.options = query;
  2259. var copyQuery = Object.assign({}, query);
  2260. delete copyQuery.__id__;
  2261. this.$page = {
  2262. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  2263. };
  2264. this.$vm.$mp.query = query; // 兼容 mpvue
  2265. this.$vm.__call_hook('onLoad', query);
  2266. };
  2267. {
  2268. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  2269. }
  2270. {
  2271. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  2272. }
  2273. return pageOptions;
  2274. }
  2275. function parsePage(vuePageOptions) {
  2276. return parseBasePage(vuePageOptions);
  2277. }
  2278. function createPage(vuePageOptions) {
  2279. {
  2280. return Component(parsePage(vuePageOptions));
  2281. }
  2282. }
  2283. function createComponent(vueOptions) {
  2284. {
  2285. return Component(parseComponent(vueOptions));
  2286. }
  2287. }
  2288. function createSubpackageApp(vm) {
  2289. var appOptions = parseApp(vm);
  2290. var app = getApp({
  2291. allowDefault: true
  2292. });
  2293. vm.$scope = app;
  2294. var globalData = app.globalData;
  2295. if (globalData) {
  2296. Object.keys(appOptions.globalData).forEach(function (name) {
  2297. if (!hasOwn(globalData, name)) {
  2298. globalData[name] = appOptions.globalData[name];
  2299. }
  2300. });
  2301. }
  2302. Object.keys(appOptions).forEach(function (name) {
  2303. if (!hasOwn(app, name)) {
  2304. app[name] = appOptions[name];
  2305. }
  2306. });
  2307. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2308. wx.onAppShow(function () {
  2309. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  2310. args[_key5] = arguments[_key5];
  2311. }
  2312. vm.__call_hook('onShow', args);
  2313. });
  2314. }
  2315. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2316. wx.onAppHide(function () {
  2317. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  2318. args[_key6] = arguments[_key6];
  2319. }
  2320. vm.__call_hook('onHide', args);
  2321. });
  2322. }
  2323. if (isFn(appOptions.onLaunch)) {
  2324. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2325. vm.__call_hook('onLaunch', args);
  2326. }
  2327. return vm;
  2328. }
  2329. function createPlugin(vm) {
  2330. var appOptions = parseApp(vm);
  2331. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2332. wx.onAppShow(function () {
  2333. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  2334. args[_key7] = arguments[_key7];
  2335. }
  2336. vm.__call_hook('onShow', args);
  2337. });
  2338. }
  2339. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2340. wx.onAppHide(function () {
  2341. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  2342. args[_key8] = arguments[_key8];
  2343. }
  2344. vm.__call_hook('onHide', args);
  2345. });
  2346. }
  2347. if (isFn(appOptions.onLaunch)) {
  2348. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2349. vm.__call_hook('onLaunch', args);
  2350. }
  2351. return vm;
  2352. }
  2353. todos.forEach(function (todoApi) {
  2354. protocols[todoApi] = false;
  2355. });
  2356. canIUses.forEach(function (canIUseApi) {
  2357. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  2358. if (!wx.canIUse(apiName)) {
  2359. protocols[canIUseApi] = false;
  2360. }
  2361. });
  2362. var uni = {};
  2363. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2364. uni = new Proxy({}, {
  2365. get: function get(target, name) {
  2366. if (hasOwn(target, name)) {
  2367. return target[name];
  2368. }
  2369. if (baseApi[name]) {
  2370. return baseApi[name];
  2371. }
  2372. if (api[name]) {
  2373. return promisify(name, api[name]);
  2374. }
  2375. {
  2376. if (extraApi[name]) {
  2377. return promisify(name, extraApi[name]);
  2378. }
  2379. if (todoApis[name]) {
  2380. return promisify(name, todoApis[name]);
  2381. }
  2382. }
  2383. if (eventApi[name]) {
  2384. return eventApi[name];
  2385. }
  2386. return promisify(name, wrapper(name, wx[name]));
  2387. },
  2388. set: function set(target, name, value) {
  2389. target[name] = value;
  2390. return true;
  2391. }
  2392. });
  2393. } else {
  2394. Object.keys(baseApi).forEach(function (name) {
  2395. uni[name] = baseApi[name];
  2396. });
  2397. {
  2398. Object.keys(todoApis).forEach(function (name) {
  2399. uni[name] = promisify(name, todoApis[name]);
  2400. });
  2401. Object.keys(extraApi).forEach(function (name) {
  2402. uni[name] = promisify(name, extraApi[name]);
  2403. });
  2404. }
  2405. Object.keys(eventApi).forEach(function (name) {
  2406. uni[name] = eventApi[name];
  2407. });
  2408. Object.keys(api).forEach(function (name) {
  2409. uni[name] = promisify(name, api[name]);
  2410. });
  2411. Object.keys(wx).forEach(function (name) {
  2412. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2413. uni[name] = promisify(name, wrapper(name, wx[name]));
  2414. }
  2415. });
  2416. }
  2417. wx.createApp = createApp;
  2418. wx.createPage = createPage;
  2419. wx.createComponent = createComponent;
  2420. wx.createSubpackageApp = createSubpackageApp;
  2421. wx.createPlugin = createPlugin;
  2422. var uni$1 = uni;
  2423. var _default = uni$1;
  2424. exports.default = _default;
  2425. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  2426. /***/ }),
  2427. /* 3 */
  2428. /*!***********************************!*\
  2429. !*** (webpack)/buildin/global.js ***!
  2430. \***********************************/
  2431. /*! no static exports found */
  2432. /***/ (function(module, exports) {
  2433. var g;
  2434. // This works in non-strict mode
  2435. g = (function() {
  2436. return this;
  2437. })();
  2438. try {
  2439. // This works if eval is allowed (see CSP)
  2440. g = g || new Function("return this")();
  2441. } catch (e) {
  2442. // This works if the window reference is available
  2443. if (typeof window === "object") g = window;
  2444. }
  2445. // g can still be undefined, but nothing to do about it...
  2446. // We return undefined, instead of nothing here, so it's
  2447. // easier to handle this case. if(!global) { ...}
  2448. module.exports = g;
  2449. /***/ }),
  2450. /* 4 */
  2451. /*!**********************************************************************!*\
  2452. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  2453. \**********************************************************************/
  2454. /*! no static exports found */
  2455. /***/ (function(module, exports) {
  2456. function _interopRequireDefault(obj) {
  2457. return obj && obj.__esModule ? obj : {
  2458. "default": obj
  2459. };
  2460. }
  2461. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2462. /***/ }),
  2463. /* 5 */
  2464. /*!**************************************************************!*\
  2465. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  2466. \**************************************************************/
  2467. /*! no static exports found */
  2468. /***/ (function(module, exports, __webpack_require__) {
  2469. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  2470. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  2471. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  2472. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  2473. function _slicedToArray(arr, i) {
  2474. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  2475. }
  2476. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2477. /***/ }),
  2478. /* 6 */
  2479. /*!***************************************************************!*\
  2480. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  2481. \***************************************************************/
  2482. /*! no static exports found */
  2483. /***/ (function(module, exports) {
  2484. function _arrayWithHoles(arr) {
  2485. if (Array.isArray(arr)) return arr;
  2486. }
  2487. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2488. /***/ }),
  2489. /* 7 */
  2490. /*!*********************************************************************!*\
  2491. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  2492. \*********************************************************************/
  2493. /*! no static exports found */
  2494. /***/ (function(module, exports) {
  2495. function _iterableToArrayLimit(r, l) {
  2496. var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  2497. if (null != t) {
  2498. var e,
  2499. n,
  2500. i,
  2501. u,
  2502. a = [],
  2503. f = !0,
  2504. o = !1;
  2505. try {
  2506. if (i = (t = t.call(r)).next, 0 === l) {
  2507. if (Object(t) !== t) return;
  2508. f = !1;
  2509. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) {
  2510. ;
  2511. }
  2512. } catch (r) {
  2513. o = !0, n = r;
  2514. } finally {
  2515. try {
  2516. if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
  2517. } finally {
  2518. if (o) throw n;
  2519. }
  2520. }
  2521. return a;
  2522. }
  2523. }
  2524. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2525. /***/ }),
  2526. /* 8 */
  2527. /*!***************************************************************************!*\
  2528. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  2529. \***************************************************************************/
  2530. /*! no static exports found */
  2531. /***/ (function(module, exports, __webpack_require__) {
  2532. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  2533. function _unsupportedIterableToArray(o, minLen) {
  2534. if (!o) return;
  2535. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  2536. var n = Object.prototype.toString.call(o).slice(8, -1);
  2537. if (n === "Object" && o.constructor) n = o.constructor.name;
  2538. if (n === "Map" || n === "Set") return Array.from(o);
  2539. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  2540. }
  2541. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2542. /***/ }),
  2543. /* 9 */
  2544. /*!*****************************************************************!*\
  2545. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  2546. \*****************************************************************/
  2547. /*! no static exports found */
  2548. /***/ (function(module, exports) {
  2549. function _arrayLikeToArray(arr, len) {
  2550. if (len == null || len > arr.length) len = arr.length;
  2551. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  2552. arr2[i] = arr[i];
  2553. }
  2554. return arr2;
  2555. }
  2556. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2557. /***/ }),
  2558. /* 10 */
  2559. /*!****************************************************************!*\
  2560. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  2561. \****************************************************************/
  2562. /*! no static exports found */
  2563. /***/ (function(module, exports) {
  2564. function _nonIterableRest() {
  2565. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2566. }
  2567. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2568. /***/ }),
  2569. /* 11 */
  2570. /*!***************************************************************!*\
  2571. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  2572. \***************************************************************/
  2573. /*! no static exports found */
  2574. /***/ (function(module, exports, __webpack_require__) {
  2575. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  2576. function _defineProperty(obj, key, value) {
  2577. key = toPropertyKey(key);
  2578. if (key in obj) {
  2579. Object.defineProperty(obj, key, {
  2580. value: value,
  2581. enumerable: true,
  2582. configurable: true,
  2583. writable: true
  2584. });
  2585. } else {
  2586. obj[key] = value;
  2587. }
  2588. return obj;
  2589. }
  2590. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2591. /***/ }),
  2592. /* 12 */
  2593. /*!**************************************************************!*\
  2594. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  2595. \**************************************************************/
  2596. /*! no static exports found */
  2597. /***/ (function(module, exports, __webpack_require__) {
  2598. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  2599. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  2600. function toPropertyKey(t) {
  2601. var i = toPrimitive(t, "string");
  2602. return "symbol" == _typeof(i) ? i : i + "";
  2603. }
  2604. module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2605. /***/ }),
  2606. /* 13 */
  2607. /*!*******************************************************!*\
  2608. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  2609. \*******************************************************/
  2610. /*! no static exports found */
  2611. /***/ (function(module, exports) {
  2612. function _typeof(o) {
  2613. "@babel/helpers - typeof";
  2614. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
  2615. return typeof o;
  2616. } : function (o) {
  2617. return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  2618. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
  2619. }
  2620. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2621. /***/ }),
  2622. /* 14 */
  2623. /*!************************************************************!*\
  2624. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  2625. \************************************************************/
  2626. /*! no static exports found */
  2627. /***/ (function(module, exports, __webpack_require__) {
  2628. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  2629. function toPrimitive(t, r) {
  2630. if ("object" != _typeof(t) || !t) return t;
  2631. var e = t[Symbol.toPrimitive];
  2632. if (void 0 !== e) {
  2633. var i = e.call(t, r || "default");
  2634. if ("object" != _typeof(i)) return i;
  2635. throw new TypeError("@@toPrimitive must return a primitive value.");
  2636. }
  2637. return ("string" === r ? String : Number)(t);
  2638. }
  2639. module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2640. /***/ }),
  2641. /* 15 */
  2642. /*!**********************************************************!*\
  2643. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  2644. \**********************************************************/
  2645. /*! no static exports found */
  2646. /***/ (function(module, exports, __webpack_require__) {
  2647. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  2648. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  2649. function _construct(t, e, r) {
  2650. if (isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
  2651. var o = [null];
  2652. o.push.apply(o, e);
  2653. var p = new (t.bind.apply(t, o))();
  2654. return r && setPrototypeOf(p, r.prototype), p;
  2655. }
  2656. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2657. /***/ }),
  2658. /* 16 */
  2659. /*!***************************************************************!*\
  2660. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  2661. \***************************************************************/
  2662. /*! no static exports found */
  2663. /***/ (function(module, exports) {
  2664. function _setPrototypeOf(o, p) {
  2665. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  2666. o.__proto__ = p;
  2667. return o;
  2668. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2669. return _setPrototypeOf(o, p);
  2670. }
  2671. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2672. /***/ }),
  2673. /* 17 */
  2674. /*!*************************************************************************!*\
  2675. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  2676. \*************************************************************************/
  2677. /*! no static exports found */
  2678. /***/ (function(module, exports) {
  2679. function _isNativeReflectConstruct() {
  2680. try {
  2681. var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  2682. } catch (t) {}
  2683. return (module.exports = _isNativeReflectConstruct = function _isNativeReflectConstruct() {
  2684. return !!t;
  2685. }, module.exports.__esModule = true, module.exports["default"] = module.exports)();
  2686. }
  2687. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2688. /***/ }),
  2689. /* 18 */
  2690. /*!******************************************************************!*\
  2691. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  2692. \******************************************************************/
  2693. /*! no static exports found */
  2694. /***/ (function(module, exports, __webpack_require__) {
  2695. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  2696. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  2697. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  2698. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  2699. function _toConsumableArray(arr) {
  2700. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  2701. }
  2702. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2703. /***/ }),
  2704. /* 19 */
  2705. /*!******************************************************************!*\
  2706. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  2707. \******************************************************************/
  2708. /*! no static exports found */
  2709. /***/ (function(module, exports, __webpack_require__) {
  2710. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  2711. function _arrayWithoutHoles(arr) {
  2712. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  2713. }
  2714. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2715. /***/ }),
  2716. /* 20 */
  2717. /*!****************************************************************!*\
  2718. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  2719. \****************************************************************/
  2720. /*! no static exports found */
  2721. /***/ (function(module, exports) {
  2722. function _iterableToArray(iter) {
  2723. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  2724. }
  2725. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2726. /***/ }),
  2727. /* 21 */
  2728. /*!******************************************************************!*\
  2729. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  2730. \******************************************************************/
  2731. /*! no static exports found */
  2732. /***/ (function(module, exports) {
  2733. function _nonIterableSpread() {
  2734. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2735. }
  2736. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  2737. /***/ }),
  2738. /* 22 */
  2739. /*!*************************************************************!*\
  2740. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  2741. \*************************************************************/
  2742. /*! no static exports found */
  2743. /***/ (function(module, exports, __webpack_require__) {
  2744. "use strict";
  2745. /* WEBPACK VAR INJECTION */(function(uni, global) {
  2746. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  2747. Object.defineProperty(exports, "__esModule", {
  2748. value: true
  2749. });
  2750. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  2751. exports.compileI18nJsonStr = compileI18nJsonStr;
  2752. exports.hasI18nJson = hasI18nJson;
  2753. exports.initVueI18n = initVueI18n;
  2754. exports.isI18nStr = isI18nStr;
  2755. exports.isString = void 0;
  2756. exports.normalizeLocale = normalizeLocale;
  2757. exports.parseI18nJson = parseI18nJson;
  2758. exports.resolveLocale = resolveLocale;
  2759. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  2760. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  2761. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  2762. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  2763. var isObject = function isObject(val) {
  2764. return val !== null && (0, _typeof2.default)(val) === 'object';
  2765. };
  2766. var defaultDelimiters = ['{', '}'];
  2767. var BaseFormatter = /*#__PURE__*/function () {
  2768. function BaseFormatter() {
  2769. (0, _classCallCheck2.default)(this, BaseFormatter);
  2770. this._caches = Object.create(null);
  2771. }
  2772. (0, _createClass2.default)(BaseFormatter, [{
  2773. key: "interpolate",
  2774. value: function interpolate(message, values) {
  2775. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  2776. if (!values) {
  2777. return [message];
  2778. }
  2779. var tokens = this._caches[message];
  2780. if (!tokens) {
  2781. tokens = parse(message, delimiters);
  2782. this._caches[message] = tokens;
  2783. }
  2784. return compile(tokens, values);
  2785. }
  2786. }]);
  2787. return BaseFormatter;
  2788. }();
  2789. exports.Formatter = BaseFormatter;
  2790. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  2791. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  2792. function parse(format, _ref) {
  2793. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  2794. startDelimiter = _ref2[0],
  2795. endDelimiter = _ref2[1];
  2796. var tokens = [];
  2797. var position = 0;
  2798. var text = '';
  2799. while (position < format.length) {
  2800. var char = format[position++];
  2801. if (char === startDelimiter) {
  2802. if (text) {
  2803. tokens.push({
  2804. type: 'text',
  2805. value: text
  2806. });
  2807. }
  2808. text = '';
  2809. var sub = '';
  2810. char = format[position++];
  2811. while (char !== undefined && char !== endDelimiter) {
  2812. sub += char;
  2813. char = format[position++];
  2814. }
  2815. var isClosed = char === endDelimiter;
  2816. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  2817. tokens.push({
  2818. value: sub,
  2819. type: type
  2820. });
  2821. }
  2822. // else if (char === '%') {
  2823. // // when found rails i18n syntax, skip text capture
  2824. // if (format[position] !== '{') {
  2825. // text += char
  2826. // }
  2827. // }
  2828. else {
  2829. text += char;
  2830. }
  2831. }
  2832. text && tokens.push({
  2833. type: 'text',
  2834. value: text
  2835. });
  2836. return tokens;
  2837. }
  2838. function compile(tokens, values) {
  2839. var compiled = [];
  2840. var index = 0;
  2841. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  2842. if (mode === 'unknown') {
  2843. return compiled;
  2844. }
  2845. while (index < tokens.length) {
  2846. var token = tokens[index];
  2847. switch (token.type) {
  2848. case 'text':
  2849. compiled.push(token.value);
  2850. break;
  2851. case 'list':
  2852. compiled.push(values[parseInt(token.value, 10)]);
  2853. break;
  2854. case 'named':
  2855. if (mode === 'named') {
  2856. compiled.push(values[token.value]);
  2857. } else {
  2858. if (true) {
  2859. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  2860. }
  2861. }
  2862. break;
  2863. case 'unknown':
  2864. if (true) {
  2865. console.warn("Detect 'unknown' type of token!");
  2866. }
  2867. break;
  2868. }
  2869. index++;
  2870. }
  2871. return compiled;
  2872. }
  2873. var LOCALE_ZH_HANS = 'zh-Hans';
  2874. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  2875. var LOCALE_ZH_HANT = 'zh-Hant';
  2876. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  2877. var LOCALE_EN = 'en';
  2878. exports.LOCALE_EN = LOCALE_EN;
  2879. var LOCALE_FR = 'fr';
  2880. exports.LOCALE_FR = LOCALE_FR;
  2881. var LOCALE_ES = 'es';
  2882. exports.LOCALE_ES = LOCALE_ES;
  2883. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2884. var hasOwn = function hasOwn(val, key) {
  2885. return hasOwnProperty.call(val, key);
  2886. };
  2887. var defaultFormatter = new BaseFormatter();
  2888. function include(str, parts) {
  2889. return !!parts.find(function (part) {
  2890. return str.indexOf(part) !== -1;
  2891. });
  2892. }
  2893. function startsWith(str, parts) {
  2894. return parts.find(function (part) {
  2895. return str.indexOf(part) === 0;
  2896. });
  2897. }
  2898. function normalizeLocale(locale, messages) {
  2899. if (!locale) {
  2900. return;
  2901. }
  2902. locale = locale.trim().replace(/_/g, '-');
  2903. if (messages && messages[locale]) {
  2904. return locale;
  2905. }
  2906. locale = locale.toLowerCase();
  2907. if (locale === 'chinese') {
  2908. // 支付宝
  2909. return LOCALE_ZH_HANS;
  2910. }
  2911. if (locale.indexOf('zh') === 0) {
  2912. if (locale.indexOf('-hans') > -1) {
  2913. return LOCALE_ZH_HANS;
  2914. }
  2915. if (locale.indexOf('-hant') > -1) {
  2916. return LOCALE_ZH_HANT;
  2917. }
  2918. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  2919. return LOCALE_ZH_HANT;
  2920. }
  2921. return LOCALE_ZH_HANS;
  2922. }
  2923. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  2924. if (messages && Object.keys(messages).length > 0) {
  2925. locales = Object.keys(messages);
  2926. }
  2927. var lang = startsWith(locale, locales);
  2928. if (lang) {
  2929. return lang;
  2930. }
  2931. }
  2932. var I18n = /*#__PURE__*/function () {
  2933. function I18n(_ref3) {
  2934. var locale = _ref3.locale,
  2935. fallbackLocale = _ref3.fallbackLocale,
  2936. messages = _ref3.messages,
  2937. watcher = _ref3.watcher,
  2938. formater = _ref3.formater;
  2939. (0, _classCallCheck2.default)(this, I18n);
  2940. this.locale = LOCALE_EN;
  2941. this.fallbackLocale = LOCALE_EN;
  2942. this.message = {};
  2943. this.messages = {};
  2944. this.watchers = [];
  2945. if (fallbackLocale) {
  2946. this.fallbackLocale = fallbackLocale;
  2947. }
  2948. this.formater = formater || defaultFormatter;
  2949. this.messages = messages || {};
  2950. this.setLocale(locale || LOCALE_EN);
  2951. if (watcher) {
  2952. this.watchLocale(watcher);
  2953. }
  2954. }
  2955. (0, _createClass2.default)(I18n, [{
  2956. key: "setLocale",
  2957. value: function setLocale(locale) {
  2958. var _this = this;
  2959. var oldLocale = this.locale;
  2960. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  2961. if (!this.messages[this.locale]) {
  2962. // 可能初始化时不存在
  2963. this.messages[this.locale] = {};
  2964. }
  2965. this.message = this.messages[this.locale];
  2966. // 仅发生变化时,通知
  2967. if (oldLocale !== this.locale) {
  2968. this.watchers.forEach(function (watcher) {
  2969. watcher(_this.locale, oldLocale);
  2970. });
  2971. }
  2972. }
  2973. }, {
  2974. key: "getLocale",
  2975. value: function getLocale() {
  2976. return this.locale;
  2977. }
  2978. }, {
  2979. key: "watchLocale",
  2980. value: function watchLocale(fn) {
  2981. var _this2 = this;
  2982. var index = this.watchers.push(fn) - 1;
  2983. return function () {
  2984. _this2.watchers.splice(index, 1);
  2985. };
  2986. }
  2987. }, {
  2988. key: "add",
  2989. value: function add(locale, message) {
  2990. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  2991. var curMessages = this.messages[locale];
  2992. if (curMessages) {
  2993. if (override) {
  2994. Object.assign(curMessages, message);
  2995. } else {
  2996. Object.keys(message).forEach(function (key) {
  2997. if (!hasOwn(curMessages, key)) {
  2998. curMessages[key] = message[key];
  2999. }
  3000. });
  3001. }
  3002. } else {
  3003. this.messages[locale] = message;
  3004. }
  3005. }
  3006. }, {
  3007. key: "f",
  3008. value: function f(message, values, delimiters) {
  3009. return this.formater.interpolate(message, values, delimiters).join('');
  3010. }
  3011. }, {
  3012. key: "t",
  3013. value: function t(key, locale, values) {
  3014. var message = this.message;
  3015. if (typeof locale === 'string') {
  3016. locale = normalizeLocale(locale, this.messages);
  3017. locale && (message = this.messages[locale]);
  3018. } else {
  3019. values = locale;
  3020. }
  3021. if (!hasOwn(message, key)) {
  3022. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3023. return key;
  3024. }
  3025. return this.formater.interpolate(message[key], values).join('');
  3026. }
  3027. }]);
  3028. return I18n;
  3029. }();
  3030. exports.I18n = I18n;
  3031. function watchAppLocale(appVm, i18n) {
  3032. // 需要保证 watch 的触发在组件渲染之前
  3033. if (appVm.$watchLocale) {
  3034. // vue2
  3035. appVm.$watchLocale(function (newLocale) {
  3036. i18n.setLocale(newLocale);
  3037. });
  3038. } else {
  3039. appVm.$watch(function () {
  3040. return appVm.$locale;
  3041. }, function (newLocale) {
  3042. i18n.setLocale(newLocale);
  3043. });
  3044. }
  3045. }
  3046. function getDefaultLocale() {
  3047. if (typeof uni !== 'undefined' && uni.getLocale) {
  3048. return uni.getLocale();
  3049. }
  3050. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3051. if (typeof global !== 'undefined' && global.getLocale) {
  3052. return global.getLocale();
  3053. }
  3054. return LOCALE_EN;
  3055. }
  3056. function initVueI18n(locale) {
  3057. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3058. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3059. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3060. // 兼容旧版本入参
  3061. if (typeof locale !== 'string') {
  3062. var _ref4 = [messages, locale];
  3063. locale = _ref4[0];
  3064. messages = _ref4[1];
  3065. }
  3066. if (typeof locale !== 'string') {
  3067. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3068. locale = getDefaultLocale();
  3069. }
  3070. if (typeof fallbackLocale !== 'string') {
  3071. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3072. }
  3073. var i18n = new I18n({
  3074. locale: locale,
  3075. fallbackLocale: fallbackLocale,
  3076. messages: messages,
  3077. watcher: watcher
  3078. });
  3079. var _t = function t(key, values) {
  3080. if (typeof getApp !== 'function') {
  3081. // app view
  3082. /* eslint-disable no-func-assign */
  3083. _t = function t(key, values) {
  3084. return i18n.t(key, values);
  3085. };
  3086. } else {
  3087. var isWatchedAppLocale = false;
  3088. _t = function t(key, values) {
  3089. var appVm = getApp().$vm;
  3090. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3091. // options: {
  3092. // type: Array,
  3093. // default () {
  3094. // return [{
  3095. // icon: 'shop',
  3096. // text: t("uni-goods-nav.options.shop"),
  3097. // }, {
  3098. // icon: 'cart',
  3099. // text: t("uni-goods-nav.options.cart")
  3100. // }]
  3101. // }
  3102. // },
  3103. if (appVm) {
  3104. // 触发响应式
  3105. appVm.$locale;
  3106. if (!isWatchedAppLocale) {
  3107. isWatchedAppLocale = true;
  3108. watchAppLocale(appVm, i18n);
  3109. }
  3110. }
  3111. return i18n.t(key, values);
  3112. };
  3113. }
  3114. return _t(key, values);
  3115. };
  3116. return {
  3117. i18n: i18n,
  3118. f: function f(message, values, delimiters) {
  3119. return i18n.f(message, values, delimiters);
  3120. },
  3121. t: function t(key, values) {
  3122. return _t(key, values);
  3123. },
  3124. add: function add(locale, message) {
  3125. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3126. return i18n.add(locale, message, override);
  3127. },
  3128. watch: function watch(fn) {
  3129. return i18n.watchLocale(fn);
  3130. },
  3131. getLocale: function getLocale() {
  3132. return i18n.getLocale();
  3133. },
  3134. setLocale: function setLocale(newLocale) {
  3135. return i18n.setLocale(newLocale);
  3136. }
  3137. };
  3138. }
  3139. var isString = function isString(val) {
  3140. return typeof val === 'string';
  3141. };
  3142. exports.isString = isString;
  3143. var formater;
  3144. function hasI18nJson(jsonObj, delimiters) {
  3145. if (!formater) {
  3146. formater = new BaseFormatter();
  3147. }
  3148. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3149. var value = jsonObj[key];
  3150. if (isString(value)) {
  3151. if (isI18nStr(value, delimiters)) {
  3152. return true;
  3153. }
  3154. } else {
  3155. return hasI18nJson(value, delimiters);
  3156. }
  3157. });
  3158. }
  3159. function parseI18nJson(jsonObj, values, delimiters) {
  3160. if (!formater) {
  3161. formater = new BaseFormatter();
  3162. }
  3163. walkJsonObj(jsonObj, function (jsonObj, key) {
  3164. var value = jsonObj[key];
  3165. if (isString(value)) {
  3166. if (isI18nStr(value, delimiters)) {
  3167. jsonObj[key] = compileStr(value, values, delimiters);
  3168. }
  3169. } else {
  3170. parseI18nJson(value, values, delimiters);
  3171. }
  3172. });
  3173. return jsonObj;
  3174. }
  3175. function compileI18nJsonStr(jsonStr, _ref5) {
  3176. var locale = _ref5.locale,
  3177. locales = _ref5.locales,
  3178. delimiters = _ref5.delimiters;
  3179. if (!isI18nStr(jsonStr, delimiters)) {
  3180. return jsonStr;
  3181. }
  3182. if (!formater) {
  3183. formater = new BaseFormatter();
  3184. }
  3185. var localeValues = [];
  3186. Object.keys(locales).forEach(function (name) {
  3187. if (name !== locale) {
  3188. localeValues.push({
  3189. locale: name,
  3190. values: locales[name]
  3191. });
  3192. }
  3193. });
  3194. localeValues.unshift({
  3195. locale: locale,
  3196. values: locales[locale]
  3197. });
  3198. try {
  3199. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  3200. } catch (e) {}
  3201. return jsonStr;
  3202. }
  3203. function isI18nStr(value, delimiters) {
  3204. return value.indexOf(delimiters[0]) > -1;
  3205. }
  3206. function compileStr(value, values, delimiters) {
  3207. return formater.interpolate(value, values, delimiters).join('');
  3208. }
  3209. function compileValue(jsonObj, key, localeValues, delimiters) {
  3210. var value = jsonObj[key];
  3211. if (isString(value)) {
  3212. // 存在国际化
  3213. if (isI18nStr(value, delimiters)) {
  3214. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  3215. if (localeValues.length > 1) {
  3216. // 格式化国际化语言
  3217. var valueLocales = jsonObj[key + 'Locales'] = {};
  3218. localeValues.forEach(function (localValue) {
  3219. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  3220. });
  3221. }
  3222. }
  3223. } else {
  3224. compileJsonObj(value, localeValues, delimiters);
  3225. }
  3226. }
  3227. function compileJsonObj(jsonObj, localeValues, delimiters) {
  3228. walkJsonObj(jsonObj, function (jsonObj, key) {
  3229. compileValue(jsonObj, key, localeValues, delimiters);
  3230. });
  3231. return jsonObj;
  3232. }
  3233. function walkJsonObj(jsonObj, walk) {
  3234. if (Array.isArray(jsonObj)) {
  3235. for (var i = 0; i < jsonObj.length; i++) {
  3236. if (walk(jsonObj, i)) {
  3237. return true;
  3238. }
  3239. }
  3240. } else if (isObject(jsonObj)) {
  3241. for (var key in jsonObj) {
  3242. if (walk(jsonObj, key)) {
  3243. return true;
  3244. }
  3245. }
  3246. }
  3247. return false;
  3248. }
  3249. function resolveLocale(locales) {
  3250. return function (locale) {
  3251. if (!locale) {
  3252. return locale;
  3253. }
  3254. locale = normalizeLocale(locale) || locale;
  3255. return resolveLocaleChain(locale).find(function (locale) {
  3256. return locales.indexOf(locale) > -1;
  3257. });
  3258. };
  3259. }
  3260. function resolveLocaleChain(locale) {
  3261. var chain = [];
  3262. var tokens = locale.split('-');
  3263. while (tokens.length) {
  3264. chain.push(tokens.join('-'));
  3265. tokens.pop();
  3266. }
  3267. return chain;
  3268. }
  3269. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  3270. /***/ }),
  3271. /* 23 */
  3272. /*!***************************************************************!*\
  3273. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  3274. \***************************************************************/
  3275. /*! no static exports found */
  3276. /***/ (function(module, exports) {
  3277. function _classCallCheck(instance, Constructor) {
  3278. if (!(instance instanceof Constructor)) {
  3279. throw new TypeError("Cannot call a class as a function");
  3280. }
  3281. }
  3282. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3283. /***/ }),
  3284. /* 24 */
  3285. /*!************************************************************!*\
  3286. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  3287. \************************************************************/
  3288. /*! no static exports found */
  3289. /***/ (function(module, exports, __webpack_require__) {
  3290. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  3291. function _defineProperties(target, props) {
  3292. for (var i = 0; i < props.length; i++) {
  3293. var descriptor = props[i];
  3294. descriptor.enumerable = descriptor.enumerable || false;
  3295. descriptor.configurable = true;
  3296. if ("value" in descriptor) descriptor.writable = true;
  3297. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  3298. }
  3299. }
  3300. function _createClass(Constructor, protoProps, staticProps) {
  3301. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3302. if (staticProps) _defineProperties(Constructor, staticProps);
  3303. Object.defineProperty(Constructor, "prototype", {
  3304. writable: false
  3305. });
  3306. return Constructor;
  3307. }
  3308. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3309. /***/ }),
  3310. /* 25 */
  3311. /*!******************************************************************************************!*\
  3312. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  3313. \******************************************************************************************/
  3314. /*! exports provided: default */
  3315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3316. "use strict";
  3317. __webpack_require__.r(__webpack_exports__);
  3318. /* WEBPACK VAR INJECTION */(function(global) {/*!
  3319. * Vue.js v2.6.11
  3320. * (c) 2014-2024 Evan You
  3321. * Released under the MIT License.
  3322. */
  3323. /* */
  3324. var emptyObject = Object.freeze({});
  3325. // These helpers produce better VM code in JS engines due to their
  3326. // explicitness and function inlining.
  3327. function isUndef (v) {
  3328. return v === undefined || v === null
  3329. }
  3330. function isDef (v) {
  3331. return v !== undefined && v !== null
  3332. }
  3333. function isTrue (v) {
  3334. return v === true
  3335. }
  3336. function isFalse (v) {
  3337. return v === false
  3338. }
  3339. /**
  3340. * Check if value is primitive.
  3341. */
  3342. function isPrimitive (value) {
  3343. return (
  3344. typeof value === 'string' ||
  3345. typeof value === 'number' ||
  3346. // $flow-disable-line
  3347. typeof value === 'symbol' ||
  3348. typeof value === 'boolean'
  3349. )
  3350. }
  3351. /**
  3352. * Quick object check - this is primarily used to tell
  3353. * Objects from primitive values when we know the value
  3354. * is a JSON-compliant type.
  3355. */
  3356. function isObject (obj) {
  3357. return obj !== null && typeof obj === 'object'
  3358. }
  3359. /**
  3360. * Get the raw type string of a value, e.g., [object Object].
  3361. */
  3362. var _toString = Object.prototype.toString;
  3363. function toRawType (value) {
  3364. return _toString.call(value).slice(8, -1)
  3365. }
  3366. /**
  3367. * Strict object type check. Only returns true
  3368. * for plain JavaScript objects.
  3369. */
  3370. function isPlainObject (obj) {
  3371. return _toString.call(obj) === '[object Object]'
  3372. }
  3373. function isRegExp (v) {
  3374. return _toString.call(v) === '[object RegExp]'
  3375. }
  3376. /**
  3377. * Check if val is a valid array index.
  3378. */
  3379. function isValidArrayIndex (val) {
  3380. var n = parseFloat(String(val));
  3381. return n >= 0 && Math.floor(n) === n && isFinite(val)
  3382. }
  3383. function isPromise (val) {
  3384. return (
  3385. isDef(val) &&
  3386. typeof val.then === 'function' &&
  3387. typeof val.catch === 'function'
  3388. )
  3389. }
  3390. /**
  3391. * Convert a value to a string that is actually rendered.
  3392. */
  3393. function toString (val) {
  3394. return val == null
  3395. ? ''
  3396. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  3397. ? JSON.stringify(val, null, 2)
  3398. : String(val)
  3399. }
  3400. /**
  3401. * Convert an input value to a number for persistence.
  3402. * If the conversion fails, return original string.
  3403. */
  3404. function toNumber (val) {
  3405. var n = parseFloat(val);
  3406. return isNaN(n) ? val : n
  3407. }
  3408. /**
  3409. * Make a map and return a function for checking if a key
  3410. * is in that map.
  3411. */
  3412. function makeMap (
  3413. str,
  3414. expectsLowerCase
  3415. ) {
  3416. var map = Object.create(null);
  3417. var list = str.split(',');
  3418. for (var i = 0; i < list.length; i++) {
  3419. map[list[i]] = true;
  3420. }
  3421. return expectsLowerCase
  3422. ? function (val) { return map[val.toLowerCase()]; }
  3423. : function (val) { return map[val]; }
  3424. }
  3425. /**
  3426. * Check if a tag is a built-in tag.
  3427. */
  3428. var isBuiltInTag = makeMap('slot,component', true);
  3429. /**
  3430. * Check if an attribute is a reserved attribute.
  3431. */
  3432. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  3433. /**
  3434. * Remove an item from an array.
  3435. */
  3436. function remove (arr, item) {
  3437. if (arr.length) {
  3438. var index = arr.indexOf(item);
  3439. if (index > -1) {
  3440. return arr.splice(index, 1)
  3441. }
  3442. }
  3443. }
  3444. /**
  3445. * Check whether an object has the property.
  3446. */
  3447. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3448. function hasOwn (obj, key) {
  3449. return hasOwnProperty.call(obj, key)
  3450. }
  3451. /**
  3452. * Create a cached version of a pure function.
  3453. */
  3454. function cached (fn) {
  3455. var cache = Object.create(null);
  3456. return (function cachedFn (str) {
  3457. var hit = cache[str];
  3458. return hit || (cache[str] = fn(str))
  3459. })
  3460. }
  3461. /**
  3462. * Camelize a hyphen-delimited string.
  3463. */
  3464. var camelizeRE = /-(\w)/g;
  3465. var camelize = cached(function (str) {
  3466. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  3467. });
  3468. /**
  3469. * Capitalize a string.
  3470. */
  3471. var capitalize = cached(function (str) {
  3472. return str.charAt(0).toUpperCase() + str.slice(1)
  3473. });
  3474. /**
  3475. * Hyphenate a camelCase string.
  3476. */
  3477. var hyphenateRE = /\B([A-Z])/g;
  3478. var hyphenate = cached(function (str) {
  3479. return str.replace(hyphenateRE, '-$1').toLowerCase()
  3480. });
  3481. /**
  3482. * Simple bind polyfill for environments that do not support it,
  3483. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  3484. * since native bind is now performant enough in most browsers.
  3485. * But removing it would mean breaking code that was able to run in
  3486. * PhantomJS 1.x, so this must be kept for backward compatibility.
  3487. */
  3488. /* istanbul ignore next */
  3489. function polyfillBind (fn, ctx) {
  3490. function boundFn (a) {
  3491. var l = arguments.length;
  3492. return l
  3493. ? l > 1
  3494. ? fn.apply(ctx, arguments)
  3495. : fn.call(ctx, a)
  3496. : fn.call(ctx)
  3497. }
  3498. boundFn._length = fn.length;
  3499. return boundFn
  3500. }
  3501. function nativeBind (fn, ctx) {
  3502. return fn.bind(ctx)
  3503. }
  3504. var bind = Function.prototype.bind
  3505. ? nativeBind
  3506. : polyfillBind;
  3507. /**
  3508. * Convert an Array-like object to a real Array.
  3509. */
  3510. function toArray (list, start) {
  3511. start = start || 0;
  3512. var i = list.length - start;
  3513. var ret = new Array(i);
  3514. while (i--) {
  3515. ret[i] = list[i + start];
  3516. }
  3517. return ret
  3518. }
  3519. /**
  3520. * Mix properties into target object.
  3521. */
  3522. function extend (to, _from) {
  3523. for (var key in _from) {
  3524. to[key] = _from[key];
  3525. }
  3526. return to
  3527. }
  3528. /**
  3529. * Merge an Array of Objects into a single Object.
  3530. */
  3531. function toObject (arr) {
  3532. var res = {};
  3533. for (var i = 0; i < arr.length; i++) {
  3534. if (arr[i]) {
  3535. extend(res, arr[i]);
  3536. }
  3537. }
  3538. return res
  3539. }
  3540. /* eslint-disable no-unused-vars */
  3541. /**
  3542. * Perform no operation.
  3543. * Stubbing args to make Flow happy without leaving useless transpiled code
  3544. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  3545. */
  3546. function noop (a, b, c) {}
  3547. /**
  3548. * Always return false.
  3549. */
  3550. var no = function (a, b, c) { return false; };
  3551. /* eslint-enable no-unused-vars */
  3552. /**
  3553. * Return the same value.
  3554. */
  3555. var identity = function (_) { return _; };
  3556. /**
  3557. * Check if two values are loosely equal - that is,
  3558. * if they are plain objects, do they have the same shape?
  3559. */
  3560. function looseEqual (a, b) {
  3561. if (a === b) { return true }
  3562. var isObjectA = isObject(a);
  3563. var isObjectB = isObject(b);
  3564. if (isObjectA && isObjectB) {
  3565. try {
  3566. var isArrayA = Array.isArray(a);
  3567. var isArrayB = Array.isArray(b);
  3568. if (isArrayA && isArrayB) {
  3569. return a.length === b.length && a.every(function (e, i) {
  3570. return looseEqual(e, b[i])
  3571. })
  3572. } else if (a instanceof Date && b instanceof Date) {
  3573. return a.getTime() === b.getTime()
  3574. } else if (!isArrayA && !isArrayB) {
  3575. var keysA = Object.keys(a);
  3576. var keysB = Object.keys(b);
  3577. return keysA.length === keysB.length && keysA.every(function (key) {
  3578. return looseEqual(a[key], b[key])
  3579. })
  3580. } else {
  3581. /* istanbul ignore next */
  3582. return false
  3583. }
  3584. } catch (e) {
  3585. /* istanbul ignore next */
  3586. return false
  3587. }
  3588. } else if (!isObjectA && !isObjectB) {
  3589. return String(a) === String(b)
  3590. } else {
  3591. return false
  3592. }
  3593. }
  3594. /**
  3595. * Return the first index at which a loosely equal value can be
  3596. * found in the array (if value is a plain object, the array must
  3597. * contain an object of the same shape), or -1 if it is not present.
  3598. */
  3599. function looseIndexOf (arr, val) {
  3600. for (var i = 0; i < arr.length; i++) {
  3601. if (looseEqual(arr[i], val)) { return i }
  3602. }
  3603. return -1
  3604. }
  3605. /**
  3606. * Ensure a function is called only once.
  3607. */
  3608. function once (fn) {
  3609. var called = false;
  3610. return function () {
  3611. if (!called) {
  3612. called = true;
  3613. fn.apply(this, arguments);
  3614. }
  3615. }
  3616. }
  3617. var ASSET_TYPES = [
  3618. 'component',
  3619. 'directive',
  3620. 'filter'
  3621. ];
  3622. var LIFECYCLE_HOOKS = [
  3623. 'beforeCreate',
  3624. 'created',
  3625. 'beforeMount',
  3626. 'mounted',
  3627. 'beforeUpdate',
  3628. 'updated',
  3629. 'beforeDestroy',
  3630. 'destroyed',
  3631. 'activated',
  3632. 'deactivated',
  3633. 'errorCaptured',
  3634. 'serverPrefetch'
  3635. ];
  3636. /* */
  3637. var config = ({
  3638. /**
  3639. * Option merge strategies (used in core/util/options)
  3640. */
  3641. // $flow-disable-line
  3642. optionMergeStrategies: Object.create(null),
  3643. /**
  3644. * Whether to suppress warnings.
  3645. */
  3646. silent: false,
  3647. /**
  3648. * Show production mode tip message on boot?
  3649. */
  3650. productionTip: "development" !== 'production',
  3651. /**
  3652. * Whether to enable devtools
  3653. */
  3654. devtools: "development" !== 'production',
  3655. /**
  3656. * Whether to record perf
  3657. */
  3658. performance: false,
  3659. /**
  3660. * Error handler for watcher errors
  3661. */
  3662. errorHandler: null,
  3663. /**
  3664. * Warn handler for watcher warns
  3665. */
  3666. warnHandler: null,
  3667. /**
  3668. * Ignore certain custom elements
  3669. */
  3670. ignoredElements: [],
  3671. /**
  3672. * Custom user key aliases for v-on
  3673. */
  3674. // $flow-disable-line
  3675. keyCodes: Object.create(null),
  3676. /**
  3677. * Check if a tag is reserved so that it cannot be registered as a
  3678. * component. This is platform-dependent and may be overwritten.
  3679. */
  3680. isReservedTag: no,
  3681. /**
  3682. * Check if an attribute is reserved so that it cannot be used as a component
  3683. * prop. This is platform-dependent and may be overwritten.
  3684. */
  3685. isReservedAttr: no,
  3686. /**
  3687. * Check if a tag is an unknown element.
  3688. * Platform-dependent.
  3689. */
  3690. isUnknownElement: no,
  3691. /**
  3692. * Get the namespace of an element
  3693. */
  3694. getTagNamespace: noop,
  3695. /**
  3696. * Parse the real tag name for the specific platform.
  3697. */
  3698. parsePlatformTagName: identity,
  3699. /**
  3700. * Check if an attribute must be bound using property, e.g. value
  3701. * Platform-dependent.
  3702. */
  3703. mustUseProp: no,
  3704. /**
  3705. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  3706. * This will significantly reduce performance if set to false.
  3707. */
  3708. async: true,
  3709. /**
  3710. * Exposed for legacy reasons
  3711. */
  3712. _lifecycleHooks: LIFECYCLE_HOOKS
  3713. });
  3714. /* */
  3715. /**
  3716. * unicode letters used for parsing html tags, component names and property paths.
  3717. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  3718. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  3719. */
  3720. 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/;
  3721. /**
  3722. * Check if a string starts with $ or _
  3723. */
  3724. function isReserved (str) {
  3725. var c = (str + '').charCodeAt(0);
  3726. return c === 0x24 || c === 0x5F
  3727. }
  3728. /**
  3729. * Define a property.
  3730. */
  3731. function def (obj, key, val, enumerable) {
  3732. Object.defineProperty(obj, key, {
  3733. value: val,
  3734. enumerable: !!enumerable,
  3735. writable: true,
  3736. configurable: true
  3737. });
  3738. }
  3739. /**
  3740. * Parse simple path.
  3741. */
  3742. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  3743. function parsePath (path) {
  3744. if (bailRE.test(path)) {
  3745. return
  3746. }
  3747. var segments = path.split('.');
  3748. return function (obj) {
  3749. for (var i = 0; i < segments.length; i++) {
  3750. if (!obj) { return }
  3751. obj = obj[segments[i]];
  3752. }
  3753. return obj
  3754. }
  3755. }
  3756. /* */
  3757. // can we use __proto__?
  3758. var hasProto = '__proto__' in {};
  3759. // Browser environment sniffing
  3760. var inBrowser = typeof window !== 'undefined';
  3761. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  3762. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  3763. var UA = inBrowser && window.navigator && window.navigator.userAgent.toLowerCase();
  3764. var isIE = UA && /msie|trident/.test(UA);
  3765. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  3766. var isEdge = UA && UA.indexOf('edge/') > 0;
  3767. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  3768. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  3769. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  3770. var isPhantomJS = UA && /phantomjs/.test(UA);
  3771. var isFF = UA && UA.match(/firefox\/(\d+)/);
  3772. // Firefox has a "watch" function on Object.prototype...
  3773. var nativeWatch = ({}).watch;
  3774. if (inBrowser) {
  3775. try {
  3776. var opts = {};
  3777. Object.defineProperty(opts, 'passive', ({
  3778. get: function get () {
  3779. }
  3780. })); // https://github.com/facebook/flow/issues/285
  3781. window.addEventListener('test-passive', null, opts);
  3782. } catch (e) {}
  3783. }
  3784. // this needs to be lazy-evaled because vue may be required before
  3785. // vue-server-renderer can set VUE_ENV
  3786. var _isServer;
  3787. var isServerRendering = function () {
  3788. if (_isServer === undefined) {
  3789. /* istanbul ignore if */
  3790. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  3791. // detect presence of vue-server-renderer and avoid
  3792. // Webpack shimming the process
  3793. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  3794. } else {
  3795. _isServer = false;
  3796. }
  3797. }
  3798. return _isServer
  3799. };
  3800. // detect devtools
  3801. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  3802. /* istanbul ignore next */
  3803. function isNative (Ctor) {
  3804. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  3805. }
  3806. var hasSymbol =
  3807. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  3808. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  3809. var _Set;
  3810. /* istanbul ignore if */ // $flow-disable-line
  3811. if (typeof Set !== 'undefined' && isNative(Set)) {
  3812. // use native Set when available.
  3813. _Set = Set;
  3814. } else {
  3815. // a non-standard Set polyfill that only works with primitive keys.
  3816. _Set = /*@__PURE__*/(function () {
  3817. function Set () {
  3818. this.set = Object.create(null);
  3819. }
  3820. Set.prototype.has = function has (key) {
  3821. return this.set[key] === true
  3822. };
  3823. Set.prototype.add = function add (key) {
  3824. this.set[key] = true;
  3825. };
  3826. Set.prototype.clear = function clear () {
  3827. this.set = Object.create(null);
  3828. };
  3829. return Set;
  3830. }());
  3831. }
  3832. /* */
  3833. var warn = noop;
  3834. var tip = noop;
  3835. var generateComponentTrace = (noop); // work around flow check
  3836. var formatComponentName = (noop);
  3837. if (true) {
  3838. var hasConsole = typeof console !== 'undefined';
  3839. var classifyRE = /(?:^|[-_])(\w)/g;
  3840. var classify = function (str) { return str
  3841. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  3842. .replace(/[-_]/g, ''); };
  3843. warn = function (msg, vm) {
  3844. var trace = vm ? generateComponentTrace(vm) : '';
  3845. if (config.warnHandler) {
  3846. config.warnHandler.call(null, msg, vm, trace);
  3847. } else if (hasConsole && (!config.silent)) {
  3848. console.error(("[Vue warn]: " + msg + trace));
  3849. }
  3850. };
  3851. tip = function (msg, vm) {
  3852. if (hasConsole && (!config.silent)) {
  3853. console.warn("[Vue tip]: " + msg + (
  3854. vm ? generateComponentTrace(vm) : ''
  3855. ));
  3856. }
  3857. };
  3858. formatComponentName = function (vm, includeFile) {
  3859. if (vm.$root === vm) {
  3860. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  3861. return ('') + vm.$options.__file
  3862. }
  3863. return '<Root>'
  3864. }
  3865. var options = typeof vm === 'function' && vm.cid != null
  3866. ? vm.options
  3867. : vm._isVue
  3868. ? vm.$options || vm.constructor.options
  3869. : vm;
  3870. var name = options.name || options._componentTag;
  3871. var file = options.__file;
  3872. if (!name && file) {
  3873. var match = file.match(/([^/\\]+)\.vue$/);
  3874. name = match && match[1];
  3875. }
  3876. return (
  3877. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  3878. (file && includeFile !== false ? (" at " + file) : '')
  3879. )
  3880. };
  3881. var repeat = function (str, n) {
  3882. var res = '';
  3883. while (n) {
  3884. if (n % 2 === 1) { res += str; }
  3885. if (n > 1) { str += str; }
  3886. n >>= 1;
  3887. }
  3888. return res
  3889. };
  3890. generateComponentTrace = function (vm) {
  3891. if (vm._isVue && vm.$parent) {
  3892. var tree = [];
  3893. var currentRecursiveSequence = 0;
  3894. while (vm && vm.$options.name !== 'PageBody') {
  3895. if (tree.length > 0) {
  3896. var last = tree[tree.length - 1];
  3897. if (last.constructor === vm.constructor) {
  3898. currentRecursiveSequence++;
  3899. vm = vm.$parent;
  3900. continue
  3901. } else if (currentRecursiveSequence > 0) {
  3902. tree[tree.length - 1] = [last, currentRecursiveSequence];
  3903. currentRecursiveSequence = 0;
  3904. }
  3905. }
  3906. !vm.$options.isReserved && tree.push(vm);
  3907. vm = vm.$parent;
  3908. }
  3909. return '\n\nfound in\n\n' + tree
  3910. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  3911. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  3912. : formatComponentName(vm))); })
  3913. .join('\n')
  3914. } else {
  3915. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  3916. }
  3917. };
  3918. }
  3919. /* */
  3920. var uid = 0;
  3921. /**
  3922. * A dep is an observable that can have multiple
  3923. * directives subscribing to it.
  3924. */
  3925. var Dep = function Dep () {
  3926. this.id = uid++;
  3927. this.subs = [];
  3928. };
  3929. Dep.prototype.addSub = function addSub (sub) {
  3930. this.subs.push(sub);
  3931. };
  3932. Dep.prototype.removeSub = function removeSub (sub) {
  3933. remove(this.subs, sub);
  3934. };
  3935. Dep.prototype.depend = function depend () {
  3936. if (Dep.SharedObject.target) {
  3937. Dep.SharedObject.target.addDep(this);
  3938. }
  3939. };
  3940. Dep.prototype.notify = function notify () {
  3941. // stabilize the subscriber list first
  3942. var subs = this.subs.slice();
  3943. if ( true && !config.async) {
  3944. // subs aren't sorted in scheduler if not running async
  3945. // we need to sort them now to make sure they fire in correct
  3946. // order
  3947. subs.sort(function (a, b) { return a.id - b.id; });
  3948. }
  3949. for (var i = 0, l = subs.length; i < l; i++) {
  3950. subs[i].update();
  3951. }
  3952. };
  3953. // The current target watcher being evaluated.
  3954. // This is globally unique because only one watcher
  3955. // can be evaluated at a time.
  3956. // fixed by xxxxxx (nvue shared vuex)
  3957. /* eslint-disable no-undef */
  3958. Dep.SharedObject = {};
  3959. Dep.SharedObject.target = null;
  3960. Dep.SharedObject.targetStack = [];
  3961. function pushTarget (target) {
  3962. Dep.SharedObject.targetStack.push(target);
  3963. Dep.SharedObject.target = target;
  3964. Dep.target = target;
  3965. }
  3966. function popTarget () {
  3967. Dep.SharedObject.targetStack.pop();
  3968. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  3969. Dep.target = Dep.SharedObject.target;
  3970. }
  3971. /* */
  3972. var VNode = function VNode (
  3973. tag,
  3974. data,
  3975. children,
  3976. text,
  3977. elm,
  3978. context,
  3979. componentOptions,
  3980. asyncFactory
  3981. ) {
  3982. this.tag = tag;
  3983. this.data = data;
  3984. this.children = children;
  3985. this.text = text;
  3986. this.elm = elm;
  3987. this.ns = undefined;
  3988. this.context = context;
  3989. this.fnContext = undefined;
  3990. this.fnOptions = undefined;
  3991. this.fnScopeId = undefined;
  3992. this.key = data && data.key;
  3993. this.componentOptions = componentOptions;
  3994. this.componentInstance = undefined;
  3995. this.parent = undefined;
  3996. this.raw = false;
  3997. this.isStatic = false;
  3998. this.isRootInsert = true;
  3999. this.isComment = false;
  4000. this.isCloned = false;
  4001. this.isOnce = false;
  4002. this.asyncFactory = asyncFactory;
  4003. this.asyncMeta = undefined;
  4004. this.isAsyncPlaceholder = false;
  4005. };
  4006. var prototypeAccessors = { child: { configurable: true } };
  4007. // DEPRECATED: alias for componentInstance for backwards compat.
  4008. /* istanbul ignore next */
  4009. prototypeAccessors.child.get = function () {
  4010. return this.componentInstance
  4011. };
  4012. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4013. var createEmptyVNode = function (text) {
  4014. if ( text === void 0 ) text = '';
  4015. var node = new VNode();
  4016. node.text = text;
  4017. node.isComment = true;
  4018. return node
  4019. };
  4020. function createTextVNode (val) {
  4021. return new VNode(undefined, undefined, undefined, String(val))
  4022. }
  4023. // optimized shallow clone
  4024. // used for static nodes and slot nodes because they may be reused across
  4025. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4026. // on their elm reference.
  4027. function cloneVNode (vnode) {
  4028. var cloned = new VNode(
  4029. vnode.tag,
  4030. vnode.data,
  4031. // #7975
  4032. // clone children array to avoid mutating original in case of cloning
  4033. // a child.
  4034. vnode.children && vnode.children.slice(),
  4035. vnode.text,
  4036. vnode.elm,
  4037. vnode.context,
  4038. vnode.componentOptions,
  4039. vnode.asyncFactory
  4040. );
  4041. cloned.ns = vnode.ns;
  4042. cloned.isStatic = vnode.isStatic;
  4043. cloned.key = vnode.key;
  4044. cloned.isComment = vnode.isComment;
  4045. cloned.fnContext = vnode.fnContext;
  4046. cloned.fnOptions = vnode.fnOptions;
  4047. cloned.fnScopeId = vnode.fnScopeId;
  4048. cloned.asyncMeta = vnode.asyncMeta;
  4049. cloned.isCloned = true;
  4050. return cloned
  4051. }
  4052. /*
  4053. * not type checking this file because flow doesn't play well with
  4054. * dynamically accessing methods on Array prototype
  4055. */
  4056. var arrayProto = Array.prototype;
  4057. var arrayMethods = Object.create(arrayProto);
  4058. var methodsToPatch = [
  4059. 'push',
  4060. 'pop',
  4061. 'shift',
  4062. 'unshift',
  4063. 'splice',
  4064. 'sort',
  4065. 'reverse'
  4066. ];
  4067. /**
  4068. * Intercept mutating methods and emit events
  4069. */
  4070. methodsToPatch.forEach(function (method) {
  4071. // cache original method
  4072. var original = arrayProto[method];
  4073. def(arrayMethods, method, function mutator () {
  4074. var args = [], len = arguments.length;
  4075. while ( len-- ) args[ len ] = arguments[ len ];
  4076. var result = original.apply(this, args);
  4077. var ob = this.__ob__;
  4078. var inserted;
  4079. switch (method) {
  4080. case 'push':
  4081. case 'unshift':
  4082. inserted = args;
  4083. break
  4084. case 'splice':
  4085. inserted = args.slice(2);
  4086. break
  4087. }
  4088. if (inserted) { ob.observeArray(inserted); }
  4089. // notify change
  4090. ob.dep.notify();
  4091. return result
  4092. });
  4093. });
  4094. /* */
  4095. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4096. /**
  4097. * In some cases we may want to disable observation inside a component's
  4098. * update computation.
  4099. */
  4100. var shouldObserve = true;
  4101. function toggleObserving (value) {
  4102. shouldObserve = value;
  4103. }
  4104. /**
  4105. * Observer class that is attached to each observed
  4106. * object. Once attached, the observer converts the target
  4107. * object's property keys into getter/setters that
  4108. * collect dependencies and dispatch updates.
  4109. */
  4110. var Observer = function Observer (value) {
  4111. this.value = value;
  4112. this.dep = new Dep();
  4113. this.vmCount = 0;
  4114. def(value, '__ob__', this);
  4115. if (Array.isArray(value)) {
  4116. if (hasProto) {
  4117. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4118. if(value.push !== value.__proto__.push){
  4119. copyAugment(value, arrayMethods, arrayKeys);
  4120. } else {
  4121. protoAugment(value, arrayMethods);
  4122. }
  4123. }
  4124. } else {
  4125. copyAugment(value, arrayMethods, arrayKeys);
  4126. }
  4127. this.observeArray(value);
  4128. } else {
  4129. this.walk(value);
  4130. }
  4131. };
  4132. /**
  4133. * Walk through all properties and convert them into
  4134. * getter/setters. This method should only be called when
  4135. * value type is Object.
  4136. */
  4137. Observer.prototype.walk = function walk (obj) {
  4138. var keys = Object.keys(obj);
  4139. for (var i = 0; i < keys.length; i++) {
  4140. defineReactive$$1(obj, keys[i]);
  4141. }
  4142. };
  4143. /**
  4144. * Observe a list of Array items.
  4145. */
  4146. Observer.prototype.observeArray = function observeArray (items) {
  4147. for (var i = 0, l = items.length; i < l; i++) {
  4148. observe(items[i]);
  4149. }
  4150. };
  4151. // helpers
  4152. /**
  4153. * Augment a target Object or Array by intercepting
  4154. * the prototype chain using __proto__
  4155. */
  4156. function protoAugment (target, src) {
  4157. /* eslint-disable no-proto */
  4158. target.__proto__ = src;
  4159. /* eslint-enable no-proto */
  4160. }
  4161. /**
  4162. * Augment a target Object or Array by defining
  4163. * hidden properties.
  4164. */
  4165. /* istanbul ignore next */
  4166. function copyAugment (target, src, keys) {
  4167. for (var i = 0, l = keys.length; i < l; i++) {
  4168. var key = keys[i];
  4169. def(target, key, src[key]);
  4170. }
  4171. }
  4172. /**
  4173. * Attempt to create an observer instance for a value,
  4174. * returns the new observer if successfully observed,
  4175. * or the existing observer if the value already has one.
  4176. */
  4177. function observe (value, asRootData) {
  4178. if (!isObject(value) || value instanceof VNode) {
  4179. return
  4180. }
  4181. var ob;
  4182. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  4183. ob = value.__ob__;
  4184. } else if (
  4185. shouldObserve &&
  4186. !isServerRendering() &&
  4187. (Array.isArray(value) || isPlainObject(value)) &&
  4188. Object.isExtensible(value) &&
  4189. !value._isVue &&
  4190. !value.__v_isMPComponent
  4191. ) {
  4192. ob = new Observer(value);
  4193. }
  4194. if (asRootData && ob) {
  4195. ob.vmCount++;
  4196. }
  4197. return ob
  4198. }
  4199. /**
  4200. * Define a reactive property on an Object.
  4201. */
  4202. function defineReactive$$1 (
  4203. obj,
  4204. key,
  4205. val,
  4206. customSetter,
  4207. shallow
  4208. ) {
  4209. var dep = new Dep();
  4210. var property = Object.getOwnPropertyDescriptor(obj, key);
  4211. if (property && property.configurable === false) {
  4212. return
  4213. }
  4214. // cater for pre-defined getter/setters
  4215. var getter = property && property.get;
  4216. var setter = property && property.set;
  4217. if ((!getter || setter) && arguments.length === 2) {
  4218. val = obj[key];
  4219. }
  4220. var childOb = !shallow && observe(val);
  4221. Object.defineProperty(obj, key, {
  4222. enumerable: true,
  4223. configurable: true,
  4224. get: function reactiveGetter () {
  4225. var value = getter ? getter.call(obj) : val;
  4226. if (Dep.SharedObject.target) { // fixed by xxxxxx
  4227. dep.depend();
  4228. if (childOb) {
  4229. childOb.dep.depend();
  4230. if (Array.isArray(value)) {
  4231. dependArray(value);
  4232. }
  4233. }
  4234. }
  4235. return value
  4236. },
  4237. set: function reactiveSetter (newVal) {
  4238. var value = getter ? getter.call(obj) : val;
  4239. /* eslint-disable no-self-compare */
  4240. if (newVal === value || (newVal !== newVal && value !== value)) {
  4241. return
  4242. }
  4243. /* eslint-enable no-self-compare */
  4244. if ( true && customSetter) {
  4245. customSetter();
  4246. }
  4247. // #7981: for accessor properties without setter
  4248. if (getter && !setter) { return }
  4249. if (setter) {
  4250. setter.call(obj, newVal);
  4251. } else {
  4252. val = newVal;
  4253. }
  4254. childOb = !shallow && observe(newVal);
  4255. dep.notify();
  4256. }
  4257. });
  4258. }
  4259. /**
  4260. * Set a property on an object. Adds the new property and
  4261. * triggers change notification if the property doesn't
  4262. * already exist.
  4263. */
  4264. function set (target, key, val) {
  4265. if ( true &&
  4266. (isUndef(target) || isPrimitive(target))
  4267. ) {
  4268. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  4269. }
  4270. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4271. target.length = Math.max(target.length, key);
  4272. target.splice(key, 1, val);
  4273. return val
  4274. }
  4275. if (key in target && !(key in Object.prototype)) {
  4276. target[key] = val;
  4277. return val
  4278. }
  4279. var ob = (target).__ob__;
  4280. if (target._isVue || (ob && ob.vmCount)) {
  4281. true && warn(
  4282. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  4283. 'at runtime - declare it upfront in the data option.'
  4284. );
  4285. return val
  4286. }
  4287. if (!ob) {
  4288. target[key] = val;
  4289. return val
  4290. }
  4291. defineReactive$$1(ob.value, key, val);
  4292. ob.dep.notify();
  4293. return val
  4294. }
  4295. /**
  4296. * Delete a property and trigger change if necessary.
  4297. */
  4298. function del (target, key) {
  4299. if ( true &&
  4300. (isUndef(target) || isPrimitive(target))
  4301. ) {
  4302. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  4303. }
  4304. if (Array.isArray(target) && isValidArrayIndex(key)) {
  4305. target.splice(key, 1);
  4306. return
  4307. }
  4308. var ob = (target).__ob__;
  4309. if (target._isVue || (ob && ob.vmCount)) {
  4310. true && warn(
  4311. 'Avoid deleting properties on a Vue instance or its root $data ' +
  4312. '- just set it to null.'
  4313. );
  4314. return
  4315. }
  4316. if (!hasOwn(target, key)) {
  4317. return
  4318. }
  4319. delete target[key];
  4320. if (!ob) {
  4321. return
  4322. }
  4323. ob.dep.notify();
  4324. }
  4325. /**
  4326. * Collect dependencies on array elements when the array is touched, since
  4327. * we cannot intercept array element access like property getters.
  4328. */
  4329. function dependArray (value) {
  4330. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  4331. e = value[i];
  4332. e && e.__ob__ && e.__ob__.dep.depend();
  4333. if (Array.isArray(e)) {
  4334. dependArray(e);
  4335. }
  4336. }
  4337. }
  4338. /* */
  4339. /**
  4340. * Option overwriting strategies are functions that handle
  4341. * how to merge a parent option value and a child option
  4342. * value into the final value.
  4343. */
  4344. var strats = config.optionMergeStrategies;
  4345. /**
  4346. * Options with restrictions
  4347. */
  4348. if (true) {
  4349. strats.el = strats.propsData = function (parent, child, vm, key) {
  4350. if (!vm) {
  4351. warn(
  4352. "option \"" + key + "\" can only be used during instance " +
  4353. 'creation with the `new` keyword.'
  4354. );
  4355. }
  4356. return defaultStrat(parent, child)
  4357. };
  4358. }
  4359. /**
  4360. * Helper that recursively merges two data objects together.
  4361. */
  4362. function mergeData (to, from) {
  4363. if (!from) { return to }
  4364. var key, toVal, fromVal;
  4365. var keys = hasSymbol
  4366. ? Reflect.ownKeys(from)
  4367. : Object.keys(from);
  4368. for (var i = 0; i < keys.length; i++) {
  4369. key = keys[i];
  4370. // in case the object is already observed...
  4371. if (key === '__ob__') { continue }
  4372. toVal = to[key];
  4373. fromVal = from[key];
  4374. if (!hasOwn(to, key)) {
  4375. set(to, key, fromVal);
  4376. } else if (
  4377. toVal !== fromVal &&
  4378. isPlainObject(toVal) &&
  4379. isPlainObject(fromVal)
  4380. ) {
  4381. mergeData(toVal, fromVal);
  4382. }
  4383. }
  4384. return to
  4385. }
  4386. /**
  4387. * Data
  4388. */
  4389. function mergeDataOrFn (
  4390. parentVal,
  4391. childVal,
  4392. vm
  4393. ) {
  4394. if (!vm) {
  4395. // in a Vue.extend merge, both should be functions
  4396. if (!childVal) {
  4397. return parentVal
  4398. }
  4399. if (!parentVal) {
  4400. return childVal
  4401. }
  4402. // when parentVal & childVal are both present,
  4403. // we need to return a function that returns the
  4404. // merged result of both functions... no need to
  4405. // check if parentVal is a function here because
  4406. // it has to be a function to pass previous merges.
  4407. return function mergedDataFn () {
  4408. return mergeData(
  4409. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  4410. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  4411. )
  4412. }
  4413. } else {
  4414. return function mergedInstanceDataFn () {
  4415. // instance merge
  4416. var instanceData = typeof childVal === 'function'
  4417. ? childVal.call(vm, vm)
  4418. : childVal;
  4419. var defaultData = typeof parentVal === 'function'
  4420. ? parentVal.call(vm, vm)
  4421. : parentVal;
  4422. if (instanceData) {
  4423. return mergeData(instanceData, defaultData)
  4424. } else {
  4425. return defaultData
  4426. }
  4427. }
  4428. }
  4429. }
  4430. strats.data = function (
  4431. parentVal,
  4432. childVal,
  4433. vm
  4434. ) {
  4435. if (!vm) {
  4436. if (childVal && typeof childVal !== 'function') {
  4437. true && warn(
  4438. 'The "data" option should be a function ' +
  4439. 'that returns a per-instance value in component ' +
  4440. 'definitions.',
  4441. vm
  4442. );
  4443. return parentVal
  4444. }
  4445. return mergeDataOrFn(parentVal, childVal)
  4446. }
  4447. return mergeDataOrFn(parentVal, childVal, vm)
  4448. };
  4449. /**
  4450. * Hooks and props are merged as arrays.
  4451. */
  4452. function mergeHook (
  4453. parentVal,
  4454. childVal
  4455. ) {
  4456. var res = childVal
  4457. ? parentVal
  4458. ? parentVal.concat(childVal)
  4459. : Array.isArray(childVal)
  4460. ? childVal
  4461. : [childVal]
  4462. : parentVal;
  4463. return res
  4464. ? dedupeHooks(res)
  4465. : res
  4466. }
  4467. function dedupeHooks (hooks) {
  4468. var res = [];
  4469. for (var i = 0; i < hooks.length; i++) {
  4470. if (res.indexOf(hooks[i]) === -1) {
  4471. res.push(hooks[i]);
  4472. }
  4473. }
  4474. return res
  4475. }
  4476. LIFECYCLE_HOOKS.forEach(function (hook) {
  4477. strats[hook] = mergeHook;
  4478. });
  4479. /**
  4480. * Assets
  4481. *
  4482. * When a vm is present (instance creation), we need to do
  4483. * a three-way merge between constructor options, instance
  4484. * options and parent options.
  4485. */
  4486. function mergeAssets (
  4487. parentVal,
  4488. childVal,
  4489. vm,
  4490. key
  4491. ) {
  4492. var res = Object.create(parentVal || null);
  4493. if (childVal) {
  4494. true && assertObjectType(key, childVal, vm);
  4495. return extend(res, childVal)
  4496. } else {
  4497. return res
  4498. }
  4499. }
  4500. ASSET_TYPES.forEach(function (type) {
  4501. strats[type + 's'] = mergeAssets;
  4502. });
  4503. /**
  4504. * Watchers.
  4505. *
  4506. * Watchers hashes should not overwrite one
  4507. * another, so we merge them as arrays.
  4508. */
  4509. strats.watch = function (
  4510. parentVal,
  4511. childVal,
  4512. vm,
  4513. key
  4514. ) {
  4515. // work around Firefox's Object.prototype.watch...
  4516. if (parentVal === nativeWatch) { parentVal = undefined; }
  4517. if (childVal === nativeWatch) { childVal = undefined; }
  4518. /* istanbul ignore if */
  4519. if (!childVal) { return Object.create(parentVal || null) }
  4520. if (true) {
  4521. assertObjectType(key, childVal, vm);
  4522. }
  4523. if (!parentVal) { return childVal }
  4524. var ret = {};
  4525. extend(ret, parentVal);
  4526. for (var key$1 in childVal) {
  4527. var parent = ret[key$1];
  4528. var child = childVal[key$1];
  4529. if (parent && !Array.isArray(parent)) {
  4530. parent = [parent];
  4531. }
  4532. ret[key$1] = parent
  4533. ? parent.concat(child)
  4534. : Array.isArray(child) ? child : [child];
  4535. }
  4536. return ret
  4537. };
  4538. /**
  4539. * Other object hashes.
  4540. */
  4541. strats.props =
  4542. strats.methods =
  4543. strats.inject =
  4544. strats.computed = function (
  4545. parentVal,
  4546. childVal,
  4547. vm,
  4548. key
  4549. ) {
  4550. if (childVal && "development" !== 'production') {
  4551. assertObjectType(key, childVal, vm);
  4552. }
  4553. if (!parentVal) { return childVal }
  4554. var ret = Object.create(null);
  4555. extend(ret, parentVal);
  4556. if (childVal) { extend(ret, childVal); }
  4557. return ret
  4558. };
  4559. strats.provide = mergeDataOrFn;
  4560. /**
  4561. * Default strategy.
  4562. */
  4563. var defaultStrat = function (parentVal, childVal) {
  4564. return childVal === undefined
  4565. ? parentVal
  4566. : childVal
  4567. };
  4568. /**
  4569. * Validate component names
  4570. */
  4571. function checkComponents (options) {
  4572. for (var key in options.components) {
  4573. validateComponentName(key);
  4574. }
  4575. }
  4576. function validateComponentName (name) {
  4577. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  4578. warn(
  4579. 'Invalid component name: "' + name + '". Component names ' +
  4580. 'should conform to valid custom element name in html5 specification.'
  4581. );
  4582. }
  4583. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  4584. warn(
  4585. 'Do not use built-in or reserved HTML elements as component ' +
  4586. 'id: ' + name
  4587. );
  4588. }
  4589. }
  4590. /**
  4591. * Ensure all props option syntax are normalized into the
  4592. * Object-based format.
  4593. */
  4594. function normalizeProps (options, vm) {
  4595. var props = options.props;
  4596. if (!props) { return }
  4597. var res = {};
  4598. var i, val, name;
  4599. if (Array.isArray(props)) {
  4600. i = props.length;
  4601. while (i--) {
  4602. val = props[i];
  4603. if (typeof val === 'string') {
  4604. name = camelize(val);
  4605. res[name] = { type: null };
  4606. } else if (true) {
  4607. warn('props must be strings when using array syntax.');
  4608. }
  4609. }
  4610. } else if (isPlainObject(props)) {
  4611. for (var key in props) {
  4612. val = props[key];
  4613. name = camelize(key);
  4614. res[name] = isPlainObject(val)
  4615. ? val
  4616. : { type: val };
  4617. }
  4618. } else if (true) {
  4619. warn(
  4620. "Invalid value for option \"props\": expected an Array or an Object, " +
  4621. "but got " + (toRawType(props)) + ".",
  4622. vm
  4623. );
  4624. }
  4625. options.props = res;
  4626. }
  4627. /**
  4628. * Normalize all injections into Object-based format
  4629. */
  4630. function normalizeInject (options, vm) {
  4631. var inject = options.inject;
  4632. if (!inject) { return }
  4633. var normalized = options.inject = {};
  4634. if (Array.isArray(inject)) {
  4635. for (var i = 0; i < inject.length; i++) {
  4636. normalized[inject[i]] = { from: inject[i] };
  4637. }
  4638. } else if (isPlainObject(inject)) {
  4639. for (var key in inject) {
  4640. var val = inject[key];
  4641. normalized[key] = isPlainObject(val)
  4642. ? extend({ from: key }, val)
  4643. : { from: val };
  4644. }
  4645. } else if (true) {
  4646. warn(
  4647. "Invalid value for option \"inject\": expected an Array or an Object, " +
  4648. "but got " + (toRawType(inject)) + ".",
  4649. vm
  4650. );
  4651. }
  4652. }
  4653. /**
  4654. * Normalize raw function directives into object format.
  4655. */
  4656. function normalizeDirectives (options) {
  4657. var dirs = options.directives;
  4658. if (dirs) {
  4659. for (var key in dirs) {
  4660. var def$$1 = dirs[key];
  4661. if (typeof def$$1 === 'function') {
  4662. dirs[key] = { bind: def$$1, update: def$$1 };
  4663. }
  4664. }
  4665. }
  4666. }
  4667. function assertObjectType (name, value, vm) {
  4668. if (!isPlainObject(value)) {
  4669. warn(
  4670. "Invalid value for option \"" + name + "\": expected an Object, " +
  4671. "but got " + (toRawType(value)) + ".",
  4672. vm
  4673. );
  4674. }
  4675. }
  4676. /**
  4677. * Merge two option objects into a new one.
  4678. * Core utility used in both instantiation and inheritance.
  4679. */
  4680. function mergeOptions (
  4681. parent,
  4682. child,
  4683. vm
  4684. ) {
  4685. if (true) {
  4686. checkComponents(child);
  4687. }
  4688. if (typeof child === 'function') {
  4689. child = child.options;
  4690. }
  4691. normalizeProps(child, vm);
  4692. normalizeInject(child, vm);
  4693. normalizeDirectives(child);
  4694. // Apply extends and mixins on the child options,
  4695. // but only if it is a raw options object that isn't
  4696. // the result of another mergeOptions call.
  4697. // Only merged options has the _base property.
  4698. if (!child._base) {
  4699. if (child.extends) {
  4700. parent = mergeOptions(parent, child.extends, vm);
  4701. }
  4702. if (child.mixins) {
  4703. for (var i = 0, l = child.mixins.length; i < l; i++) {
  4704. parent = mergeOptions(parent, child.mixins[i], vm);
  4705. }
  4706. }
  4707. }
  4708. var options = {};
  4709. var key;
  4710. for (key in parent) {
  4711. mergeField(key);
  4712. }
  4713. for (key in child) {
  4714. if (!hasOwn(parent, key)) {
  4715. mergeField(key);
  4716. }
  4717. }
  4718. function mergeField (key) {
  4719. var strat = strats[key] || defaultStrat;
  4720. options[key] = strat(parent[key], child[key], vm, key);
  4721. }
  4722. return options
  4723. }
  4724. /**
  4725. * Resolve an asset.
  4726. * This function is used because child instances need access
  4727. * to assets defined in its ancestor chain.
  4728. */
  4729. function resolveAsset (
  4730. options,
  4731. type,
  4732. id,
  4733. warnMissing
  4734. ) {
  4735. /* istanbul ignore if */
  4736. if (typeof id !== 'string') {
  4737. return
  4738. }
  4739. var assets = options[type];
  4740. // check local registration variations first
  4741. if (hasOwn(assets, id)) { return assets[id] }
  4742. var camelizedId = camelize(id);
  4743. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  4744. var PascalCaseId = capitalize(camelizedId);
  4745. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  4746. // fallback to prototype chain
  4747. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  4748. if ( true && warnMissing && !res) {
  4749. warn(
  4750. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  4751. options
  4752. );
  4753. }
  4754. return res
  4755. }
  4756. /* */
  4757. function validateProp (
  4758. key,
  4759. propOptions,
  4760. propsData,
  4761. vm
  4762. ) {
  4763. var prop = propOptions[key];
  4764. var absent = !hasOwn(propsData, key);
  4765. var value = propsData[key];
  4766. // boolean casting
  4767. var booleanIndex = getTypeIndex(Boolean, prop.type);
  4768. if (booleanIndex > -1) {
  4769. if (absent && !hasOwn(prop, 'default')) {
  4770. value = false;
  4771. } else if (value === '' || value === hyphenate(key)) {
  4772. // only cast empty string / same name to boolean if
  4773. // boolean has higher priority
  4774. var stringIndex = getTypeIndex(String, prop.type);
  4775. if (stringIndex < 0 || booleanIndex < stringIndex) {
  4776. value = true;
  4777. }
  4778. }
  4779. }
  4780. // check default value
  4781. if (value === undefined) {
  4782. value = getPropDefaultValue(vm, prop, key);
  4783. // since the default value is a fresh copy,
  4784. // make sure to observe it.
  4785. var prevShouldObserve = shouldObserve;
  4786. toggleObserving(true);
  4787. observe(value);
  4788. toggleObserving(prevShouldObserve);
  4789. }
  4790. if (
  4791. true
  4792. ) {
  4793. assertProp(prop, key, value, vm, absent);
  4794. }
  4795. return value
  4796. }
  4797. /**
  4798. * Get the default value of a prop.
  4799. */
  4800. function getPropDefaultValue (vm, prop, key) {
  4801. // no default, return undefined
  4802. if (!hasOwn(prop, 'default')) {
  4803. return undefined
  4804. }
  4805. var def = prop.default;
  4806. // warn against non-factory defaults for Object & Array
  4807. if ( true && isObject(def)) {
  4808. warn(
  4809. 'Invalid default value for prop "' + key + '": ' +
  4810. 'Props with type Object/Array must use a factory function ' +
  4811. 'to return the default value.',
  4812. vm
  4813. );
  4814. }
  4815. // the raw prop value was also undefined from previous render,
  4816. // return previous default value to avoid unnecessary watcher trigger
  4817. if (vm && vm.$options.propsData &&
  4818. vm.$options.propsData[key] === undefined &&
  4819. vm._props[key] !== undefined
  4820. ) {
  4821. return vm._props[key]
  4822. }
  4823. // call factory function for non-Function types
  4824. // a value is Function if its prototype is function even across different execution context
  4825. return typeof def === 'function' && getType(prop.type) !== 'Function'
  4826. ? def.call(vm)
  4827. : def
  4828. }
  4829. /**
  4830. * Assert whether a prop is valid.
  4831. */
  4832. function assertProp (
  4833. prop,
  4834. name,
  4835. value,
  4836. vm,
  4837. absent
  4838. ) {
  4839. if (prop.required && absent) {
  4840. warn(
  4841. 'Missing required prop: "' + name + '"',
  4842. vm
  4843. );
  4844. return
  4845. }
  4846. if (value == null && !prop.required) {
  4847. return
  4848. }
  4849. var type = prop.type;
  4850. var valid = !type || type === true;
  4851. var expectedTypes = [];
  4852. if (type) {
  4853. if (!Array.isArray(type)) {
  4854. type = [type];
  4855. }
  4856. for (var i = 0; i < type.length && !valid; i++) {
  4857. var assertedType = assertType(value, type[i]);
  4858. expectedTypes.push(assertedType.expectedType || '');
  4859. valid = assertedType.valid;
  4860. }
  4861. }
  4862. if (!valid) {
  4863. warn(
  4864. getInvalidTypeMessage(name, value, expectedTypes),
  4865. vm
  4866. );
  4867. return
  4868. }
  4869. var validator = prop.validator;
  4870. if (validator) {
  4871. if (!validator(value)) {
  4872. warn(
  4873. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  4874. vm
  4875. );
  4876. }
  4877. }
  4878. }
  4879. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  4880. function assertType (value, type) {
  4881. var valid;
  4882. var expectedType = getType(type);
  4883. if (simpleCheckRE.test(expectedType)) {
  4884. var t = typeof value;
  4885. valid = t === expectedType.toLowerCase();
  4886. // for primitive wrapper objects
  4887. if (!valid && t === 'object') {
  4888. valid = value instanceof type;
  4889. }
  4890. } else if (expectedType === 'Object') {
  4891. valid = isPlainObject(value);
  4892. } else if (expectedType === 'Array') {
  4893. valid = Array.isArray(value);
  4894. } else {
  4895. valid = value instanceof type;
  4896. }
  4897. return {
  4898. valid: valid,
  4899. expectedType: expectedType
  4900. }
  4901. }
  4902. /**
  4903. * Use function string name to check built-in types,
  4904. * because a simple equality check will fail when running
  4905. * across different vms / iframes.
  4906. */
  4907. function getType (fn) {
  4908. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  4909. return match ? match[1] : ''
  4910. }
  4911. function isSameType (a, b) {
  4912. return getType(a) === getType(b)
  4913. }
  4914. function getTypeIndex (type, expectedTypes) {
  4915. if (!Array.isArray(expectedTypes)) {
  4916. return isSameType(expectedTypes, type) ? 0 : -1
  4917. }
  4918. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  4919. if (isSameType(expectedTypes[i], type)) {
  4920. return i
  4921. }
  4922. }
  4923. return -1
  4924. }
  4925. function getInvalidTypeMessage (name, value, expectedTypes) {
  4926. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  4927. " Expected " + (expectedTypes.map(capitalize).join(', '));
  4928. var expectedType = expectedTypes[0];
  4929. var receivedType = toRawType(value);
  4930. var expectedValue = styleValue(value, expectedType);
  4931. var receivedValue = styleValue(value, receivedType);
  4932. // check if we need to specify expected value
  4933. if (expectedTypes.length === 1 &&
  4934. isExplicable(expectedType) &&
  4935. !isBoolean(expectedType, receivedType)) {
  4936. message += " with value " + expectedValue;
  4937. }
  4938. message += ", got " + receivedType + " ";
  4939. // check if we need to specify received value
  4940. if (isExplicable(receivedType)) {
  4941. message += "with value " + receivedValue + ".";
  4942. }
  4943. return message
  4944. }
  4945. function styleValue (value, type) {
  4946. if (type === 'String') {
  4947. return ("\"" + value + "\"")
  4948. } else if (type === 'Number') {
  4949. return ("" + (Number(value)))
  4950. } else {
  4951. return ("" + value)
  4952. }
  4953. }
  4954. function isExplicable (value) {
  4955. var explicitTypes = ['string', 'number', 'boolean'];
  4956. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  4957. }
  4958. function isBoolean () {
  4959. var args = [], len = arguments.length;
  4960. while ( len-- ) args[ len ] = arguments[ len ];
  4961. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  4962. }
  4963. /* */
  4964. function handleError (err, vm, info) {
  4965. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  4966. // See: https://github.com/vuejs/vuex/issues/1505
  4967. pushTarget();
  4968. try {
  4969. if (vm) {
  4970. var cur = vm;
  4971. while ((cur = cur.$parent)) {
  4972. var hooks = cur.$options.errorCaptured;
  4973. if (hooks) {
  4974. for (var i = 0; i < hooks.length; i++) {
  4975. try {
  4976. var capture = hooks[i].call(cur, err, vm, info) === false;
  4977. if (capture) { return }
  4978. } catch (e) {
  4979. globalHandleError(e, cur, 'errorCaptured hook');
  4980. }
  4981. }
  4982. }
  4983. }
  4984. }
  4985. globalHandleError(err, vm, info);
  4986. } finally {
  4987. popTarget();
  4988. }
  4989. }
  4990. function invokeWithErrorHandling (
  4991. handler,
  4992. context,
  4993. args,
  4994. vm,
  4995. info
  4996. ) {
  4997. var res;
  4998. try {
  4999. res = args ? handler.apply(context, args) : handler.call(context);
  5000. if (res && !res._isVue && isPromise(res) && !res._handled) {
  5001. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  5002. // issue #9511
  5003. // avoid catch triggering multiple times when nested calls
  5004. res._handled = true;
  5005. }
  5006. } catch (e) {
  5007. handleError(e, vm, info);
  5008. }
  5009. return res
  5010. }
  5011. function globalHandleError (err, vm, info) {
  5012. if (config.errorHandler) {
  5013. try {
  5014. return config.errorHandler.call(null, err, vm, info)
  5015. } catch (e) {
  5016. // if the user intentionally throws the original error in the handler,
  5017. // do not log it twice
  5018. if (e !== err) {
  5019. logError(e, null, 'config.errorHandler');
  5020. }
  5021. }
  5022. }
  5023. logError(err, vm, info);
  5024. }
  5025. function logError (err, vm, info) {
  5026. if (true) {
  5027. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5028. }
  5029. /* istanbul ignore else */
  5030. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5031. console.error(err);
  5032. } else {
  5033. throw err
  5034. }
  5035. }
  5036. /* */
  5037. var callbacks = [];
  5038. var pending = false;
  5039. function flushCallbacks () {
  5040. pending = false;
  5041. var copies = callbacks.slice(0);
  5042. callbacks.length = 0;
  5043. for (var i = 0; i < copies.length; i++) {
  5044. copies[i]();
  5045. }
  5046. }
  5047. // Here we have async deferring wrappers using microtasks.
  5048. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5049. // However, it has subtle problems when state is changed right before repaint
  5050. // (e.g. #6813, out-in transitions).
  5051. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5052. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5053. // So we now use microtasks everywhere, again.
  5054. // A major drawback of this tradeoff is that there are some scenarios
  5055. // where microtasks have too high a priority and fire in between supposedly
  5056. // sequential events (e.g. #4521, #6690, which have workarounds)
  5057. // or even between bubbling of the same event (#6566).
  5058. var timerFunc;
  5059. // The nextTick behavior leverages the microtask queue, which can be accessed
  5060. // via either native Promise.then or MutationObserver.
  5061. // MutationObserver has wider support, however it is seriously bugged in
  5062. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5063. // completely stops working after triggering a few times... so, if native
  5064. // Promise is available, we will use it:
  5065. /* istanbul ignore next, $flow-disable-line */
  5066. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5067. var p = Promise.resolve();
  5068. timerFunc = function () {
  5069. p.then(flushCallbacks);
  5070. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5071. // it can get stuck in a weird state where callbacks are pushed into the
  5072. // microtask queue but the queue isn't being flushed, until the browser
  5073. // needs to do some other work, e.g. handle a timer. Therefore we can
  5074. // "force" the microtask queue to be flushed by adding an empty timer.
  5075. if (isIOS) { setTimeout(noop); }
  5076. };
  5077. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5078. isNative(MutationObserver) ||
  5079. // PhantomJS and iOS 7.x
  5080. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5081. )) {
  5082. // Use MutationObserver where native Promise is not available,
  5083. // e.g. PhantomJS, iOS7, Android 4.4
  5084. // (#6466 MutationObserver is unreliable in IE11)
  5085. var counter = 1;
  5086. var observer = new MutationObserver(flushCallbacks);
  5087. var textNode = document.createTextNode(String(counter));
  5088. observer.observe(textNode, {
  5089. characterData: true
  5090. });
  5091. timerFunc = function () {
  5092. counter = (counter + 1) % 2;
  5093. textNode.data = String(counter);
  5094. };
  5095. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5096. // Fallback to setImmediate.
  5097. // Technically it leverages the (macro) task queue,
  5098. // but it is still a better choice than setTimeout.
  5099. timerFunc = function () {
  5100. setImmediate(flushCallbacks);
  5101. };
  5102. } else {
  5103. // Fallback to setTimeout.
  5104. timerFunc = function () {
  5105. setTimeout(flushCallbacks, 0);
  5106. };
  5107. }
  5108. function nextTick (cb, ctx) {
  5109. var _resolve;
  5110. callbacks.push(function () {
  5111. if (cb) {
  5112. try {
  5113. cb.call(ctx);
  5114. } catch (e) {
  5115. handleError(e, ctx, 'nextTick');
  5116. }
  5117. } else if (_resolve) {
  5118. _resolve(ctx);
  5119. }
  5120. });
  5121. if (!pending) {
  5122. pending = true;
  5123. timerFunc();
  5124. }
  5125. // $flow-disable-line
  5126. if (!cb && typeof Promise !== 'undefined') {
  5127. return new Promise(function (resolve) {
  5128. _resolve = resolve;
  5129. })
  5130. }
  5131. }
  5132. /* */
  5133. /* not type checking this file because flow doesn't play well with Proxy */
  5134. var initProxy;
  5135. if (true) {
  5136. var allowedGlobals = makeMap(
  5137. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5138. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5139. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5140. 'require' // for Webpack/Browserify
  5141. );
  5142. var warnNonPresent = function (target, key) {
  5143. warn(
  5144. "Property or method \"" + key + "\" is not defined on the instance but " +
  5145. 'referenced during render. Make sure that this property is reactive, ' +
  5146. 'either in the data option, or for class-based components, by ' +
  5147. 'initializing the property. ' +
  5148. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5149. target
  5150. );
  5151. };
  5152. var warnReservedPrefix = function (target, key) {
  5153. warn(
  5154. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5155. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  5156. 'prevent conflicts with Vue internals. ' +
  5157. 'See: https://vuejs.org/v2/api/#data',
  5158. target
  5159. );
  5160. };
  5161. var hasProxy =
  5162. typeof Proxy !== 'undefined' && isNative(Proxy);
  5163. if (hasProxy) {
  5164. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  5165. config.keyCodes = new Proxy(config.keyCodes, {
  5166. set: function set (target, key, value) {
  5167. if (isBuiltInModifier(key)) {
  5168. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  5169. return false
  5170. } else {
  5171. target[key] = value;
  5172. return true
  5173. }
  5174. }
  5175. });
  5176. }
  5177. var hasHandler = {
  5178. has: function has (target, key) {
  5179. var has = key in target;
  5180. var isAllowed = allowedGlobals(key) ||
  5181. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  5182. if (!has && !isAllowed) {
  5183. if (key in target.$data) { warnReservedPrefix(target, key); }
  5184. else { warnNonPresent(target, key); }
  5185. }
  5186. return has || !isAllowed
  5187. }
  5188. };
  5189. var getHandler = {
  5190. get: function get (target, key) {
  5191. if (typeof key === 'string' && !(key in target)) {
  5192. if (key in target.$data) { warnReservedPrefix(target, key); }
  5193. else { warnNonPresent(target, key); }
  5194. }
  5195. return target[key]
  5196. }
  5197. };
  5198. initProxy = function initProxy (vm) {
  5199. if (hasProxy) {
  5200. // determine which proxy handler to use
  5201. var options = vm.$options;
  5202. var handlers = options.render && options.render._withStripped
  5203. ? getHandler
  5204. : hasHandler;
  5205. vm._renderProxy = new Proxy(vm, handlers);
  5206. } else {
  5207. vm._renderProxy = vm;
  5208. }
  5209. };
  5210. }
  5211. /* */
  5212. var seenObjects = new _Set();
  5213. /**
  5214. * Recursively traverse an object to evoke all converted
  5215. * getters, so that every nested property inside the object
  5216. * is collected as a "deep" dependency.
  5217. */
  5218. function traverse (val) {
  5219. _traverse(val, seenObjects);
  5220. seenObjects.clear();
  5221. }
  5222. function _traverse (val, seen) {
  5223. var i, keys;
  5224. var isA = Array.isArray(val);
  5225. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  5226. return
  5227. }
  5228. if (val.__ob__) {
  5229. var depId = val.__ob__.dep.id;
  5230. if (seen.has(depId)) {
  5231. return
  5232. }
  5233. seen.add(depId);
  5234. }
  5235. if (isA) {
  5236. i = val.length;
  5237. while (i--) { _traverse(val[i], seen); }
  5238. } else {
  5239. keys = Object.keys(val);
  5240. i = keys.length;
  5241. while (i--) { _traverse(val[keys[i]], seen); }
  5242. }
  5243. }
  5244. var mark;
  5245. var measure;
  5246. if (true) {
  5247. var perf = inBrowser && window.performance;
  5248. /* istanbul ignore if */
  5249. if (
  5250. perf &&
  5251. perf.mark &&
  5252. perf.measure &&
  5253. perf.clearMarks &&
  5254. perf.clearMeasures
  5255. ) {
  5256. mark = function (tag) { return perf.mark(tag); };
  5257. measure = function (name, startTag, endTag) {
  5258. perf.measure(name, startTag, endTag);
  5259. perf.clearMarks(startTag);
  5260. perf.clearMarks(endTag);
  5261. // perf.clearMeasures(name)
  5262. };
  5263. }
  5264. }
  5265. /* */
  5266. var normalizeEvent = cached(function (name) {
  5267. var passive = name.charAt(0) === '&';
  5268. name = passive ? name.slice(1) : name;
  5269. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  5270. name = once$$1 ? name.slice(1) : name;
  5271. var capture = name.charAt(0) === '!';
  5272. name = capture ? name.slice(1) : name;
  5273. return {
  5274. name: name,
  5275. once: once$$1,
  5276. capture: capture,
  5277. passive: passive
  5278. }
  5279. });
  5280. function createFnInvoker (fns, vm) {
  5281. function invoker () {
  5282. var arguments$1 = arguments;
  5283. var fns = invoker.fns;
  5284. if (Array.isArray(fns)) {
  5285. var cloned = fns.slice();
  5286. for (var i = 0; i < cloned.length; i++) {
  5287. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  5288. }
  5289. } else {
  5290. // return handler return value for single handlers
  5291. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  5292. }
  5293. }
  5294. invoker.fns = fns;
  5295. return invoker
  5296. }
  5297. function updateListeners (
  5298. on,
  5299. oldOn,
  5300. add,
  5301. remove$$1,
  5302. createOnceHandler,
  5303. vm
  5304. ) {
  5305. var name, def$$1, cur, old, event;
  5306. for (name in on) {
  5307. def$$1 = cur = on[name];
  5308. old = oldOn[name];
  5309. event = normalizeEvent(name);
  5310. if (isUndef(cur)) {
  5311. true && warn(
  5312. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  5313. vm
  5314. );
  5315. } else if (isUndef(old)) {
  5316. if (isUndef(cur.fns)) {
  5317. cur = on[name] = createFnInvoker(cur, vm);
  5318. }
  5319. if (isTrue(event.once)) {
  5320. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  5321. }
  5322. add(event.name, cur, event.capture, event.passive, event.params);
  5323. } else if (cur !== old) {
  5324. old.fns = cur;
  5325. on[name] = old;
  5326. }
  5327. }
  5328. for (name in oldOn) {
  5329. if (isUndef(on[name])) {
  5330. event = normalizeEvent(name);
  5331. remove$$1(event.name, oldOn[name], event.capture);
  5332. }
  5333. }
  5334. }
  5335. /* */
  5336. /* */
  5337. // fixed by xxxxxx (mp properties)
  5338. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  5339. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  5340. if (isUndef(propOptions)) {
  5341. return res
  5342. }
  5343. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  5344. var attrs = data.attrs;
  5345. var props = data.props;
  5346. if (isDef(attrs) || isDef(props)) {
  5347. for (var key in propOptions) {
  5348. var altKey = hyphenate(key);
  5349. var result = checkProp(res, props, key, altKey, true) ||
  5350. checkProp(res, attrs, key, altKey, false);
  5351. // externalClass
  5352. if (
  5353. result &&
  5354. res[key] &&
  5355. externalClasses.indexOf(altKey) !== -1 &&
  5356. context[camelize(res[key])]
  5357. ) {
  5358. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  5359. res[key] = context[camelize(res[key])];
  5360. }
  5361. }
  5362. }
  5363. return res
  5364. }
  5365. function extractPropsFromVNodeData (
  5366. data,
  5367. Ctor,
  5368. tag,
  5369. context// fixed by xxxxxx
  5370. ) {
  5371. // we are only extracting raw values here.
  5372. // validation and default values are handled in the child
  5373. // component itself.
  5374. var propOptions = Ctor.options.props;
  5375. if (isUndef(propOptions)) {
  5376. // fixed by xxxxxx
  5377. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  5378. }
  5379. var res = {};
  5380. var attrs = data.attrs;
  5381. var props = data.props;
  5382. if (isDef(attrs) || isDef(props)) {
  5383. for (var key in propOptions) {
  5384. var altKey = hyphenate(key);
  5385. if (true) {
  5386. var keyInLowerCase = key.toLowerCase();
  5387. if (
  5388. key !== keyInLowerCase &&
  5389. attrs && hasOwn(attrs, keyInLowerCase)
  5390. ) {
  5391. tip(
  5392. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  5393. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  5394. " \"" + key + "\". " +
  5395. "Note that HTML attributes are case-insensitive and camelCased " +
  5396. "props need to use their kebab-case equivalents when using in-DOM " +
  5397. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  5398. );
  5399. }
  5400. }
  5401. checkProp(res, props, key, altKey, true) ||
  5402. checkProp(res, attrs, key, altKey, false);
  5403. }
  5404. }
  5405. // fixed by xxxxxx
  5406. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  5407. }
  5408. function checkProp (
  5409. res,
  5410. hash,
  5411. key,
  5412. altKey,
  5413. preserve
  5414. ) {
  5415. if (isDef(hash)) {
  5416. if (hasOwn(hash, key)) {
  5417. res[key] = hash[key];
  5418. if (!preserve) {
  5419. delete hash[key];
  5420. }
  5421. return true
  5422. } else if (hasOwn(hash, altKey)) {
  5423. res[key] = hash[altKey];
  5424. if (!preserve) {
  5425. delete hash[altKey];
  5426. }
  5427. return true
  5428. }
  5429. }
  5430. return false
  5431. }
  5432. /* */
  5433. // The template compiler attempts to minimize the need for normalization by
  5434. // statically analyzing the template at compile time.
  5435. //
  5436. // For plain HTML markup, normalization can be completely skipped because the
  5437. // generated render function is guaranteed to return Array<VNode>. There are
  5438. // two cases where extra normalization is needed:
  5439. // 1. When the children contains components - because a functional component
  5440. // may return an Array instead of a single root. In this case, just a simple
  5441. // normalization is needed - if any child is an Array, we flatten the whole
  5442. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  5443. // because functional components already normalize their own children.
  5444. function simpleNormalizeChildren (children) {
  5445. for (var i = 0; i < children.length; i++) {
  5446. if (Array.isArray(children[i])) {
  5447. return Array.prototype.concat.apply([], children)
  5448. }
  5449. }
  5450. return children
  5451. }
  5452. // 2. When the children contains constructs that always generated nested Arrays,
  5453. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  5454. // with hand-written render functions / JSX. In such cases a full normalization
  5455. // is needed to cater to all possible types of children values.
  5456. function normalizeChildren (children) {
  5457. return isPrimitive(children)
  5458. ? [createTextVNode(children)]
  5459. : Array.isArray(children)
  5460. ? normalizeArrayChildren(children)
  5461. : undefined
  5462. }
  5463. function isTextNode (node) {
  5464. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  5465. }
  5466. function normalizeArrayChildren (children, nestedIndex) {
  5467. var res = [];
  5468. var i, c, lastIndex, last;
  5469. for (i = 0; i < children.length; i++) {
  5470. c = children[i];
  5471. if (isUndef(c) || typeof c === 'boolean') { continue }
  5472. lastIndex = res.length - 1;
  5473. last = res[lastIndex];
  5474. // nested
  5475. if (Array.isArray(c)) {
  5476. if (c.length > 0) {
  5477. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  5478. // merge adjacent text nodes
  5479. if (isTextNode(c[0]) && isTextNode(last)) {
  5480. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  5481. c.shift();
  5482. }
  5483. res.push.apply(res, c);
  5484. }
  5485. } else if (isPrimitive(c)) {
  5486. if (isTextNode(last)) {
  5487. // merge adjacent text nodes
  5488. // this is necessary for SSR hydration because text nodes are
  5489. // essentially merged when rendered to HTML strings
  5490. res[lastIndex] = createTextVNode(last.text + c);
  5491. } else if (c !== '') {
  5492. // convert primitive to vnode
  5493. res.push(createTextVNode(c));
  5494. }
  5495. } else {
  5496. if (isTextNode(c) && isTextNode(last)) {
  5497. // merge adjacent text nodes
  5498. res[lastIndex] = createTextVNode(last.text + c.text);
  5499. } else {
  5500. // default key for nested array children (likely generated by v-for)
  5501. if (isTrue(children._isVList) &&
  5502. isDef(c.tag) &&
  5503. isUndef(c.key) &&
  5504. isDef(nestedIndex)) {
  5505. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  5506. }
  5507. res.push(c);
  5508. }
  5509. }
  5510. }
  5511. return res
  5512. }
  5513. /* */
  5514. function initProvide (vm) {
  5515. var provide = vm.$options.provide;
  5516. if (provide) {
  5517. vm._provided = typeof provide === 'function'
  5518. ? provide.call(vm)
  5519. : provide;
  5520. }
  5521. }
  5522. function initInjections (vm) {
  5523. var result = resolveInject(vm.$options.inject, vm);
  5524. if (result) {
  5525. toggleObserving(false);
  5526. Object.keys(result).forEach(function (key) {
  5527. /* istanbul ignore else */
  5528. if (true) {
  5529. defineReactive$$1(vm, key, result[key], function () {
  5530. warn(
  5531. "Avoid mutating an injected value directly since the changes will be " +
  5532. "overwritten whenever the provided component re-renders. " +
  5533. "injection being mutated: \"" + key + "\"",
  5534. vm
  5535. );
  5536. });
  5537. } else {}
  5538. });
  5539. toggleObserving(true);
  5540. }
  5541. }
  5542. function resolveInject (inject, vm) {
  5543. if (inject) {
  5544. // inject is :any because flow is not smart enough to figure out cached
  5545. var result = Object.create(null);
  5546. var keys = hasSymbol
  5547. ? Reflect.ownKeys(inject)
  5548. : Object.keys(inject);
  5549. for (var i = 0; i < keys.length; i++) {
  5550. var key = keys[i];
  5551. // #6574 in case the inject object is observed...
  5552. if (key === '__ob__') { continue }
  5553. var provideKey = inject[key].from;
  5554. var source = vm;
  5555. while (source) {
  5556. if (source._provided && hasOwn(source._provided, provideKey)) {
  5557. result[key] = source._provided[provideKey];
  5558. break
  5559. }
  5560. source = source.$parent;
  5561. }
  5562. if (!source) {
  5563. if ('default' in inject[key]) {
  5564. var provideDefault = inject[key].default;
  5565. result[key] = typeof provideDefault === 'function'
  5566. ? provideDefault.call(vm)
  5567. : provideDefault;
  5568. } else if (true) {
  5569. warn(("Injection \"" + key + "\" not found"), vm);
  5570. }
  5571. }
  5572. }
  5573. return result
  5574. }
  5575. }
  5576. /* */
  5577. /**
  5578. * Runtime helper for resolving raw children VNodes into a slot object.
  5579. */
  5580. function resolveSlots (
  5581. children,
  5582. context
  5583. ) {
  5584. if (!children || !children.length) {
  5585. return {}
  5586. }
  5587. var slots = {};
  5588. for (var i = 0, l = children.length; i < l; i++) {
  5589. var child = children[i];
  5590. var data = child.data;
  5591. // remove slot attribute if the node is resolved as a Vue slot node
  5592. if (data && data.attrs && data.attrs.slot) {
  5593. delete data.attrs.slot;
  5594. }
  5595. // named slots should only be respected if the vnode was rendered in the
  5596. // same context.
  5597. if ((child.context === context || child.fnContext === context) &&
  5598. data && data.slot != null
  5599. ) {
  5600. var name = data.slot;
  5601. var slot = (slots[name] || (slots[name] = []));
  5602. if (child.tag === 'template') {
  5603. slot.push.apply(slot, child.children || []);
  5604. } else {
  5605. slot.push(child);
  5606. }
  5607. } else {
  5608. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  5609. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  5610. (slots['page'] || (slots['page'] = [])).push(child);
  5611. }else{
  5612. (slots.default || (slots.default = [])).push(child);
  5613. }
  5614. }
  5615. }
  5616. // ignore slots that contains only whitespace
  5617. for (var name$1 in slots) {
  5618. if (slots[name$1].every(isWhitespace)) {
  5619. delete slots[name$1];
  5620. }
  5621. }
  5622. return slots
  5623. }
  5624. function isWhitespace (node) {
  5625. return (node.isComment && !node.asyncFactory) || node.text === ' '
  5626. }
  5627. /* */
  5628. function normalizeScopedSlots (
  5629. slots,
  5630. normalSlots,
  5631. prevSlots
  5632. ) {
  5633. var res;
  5634. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  5635. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  5636. var key = slots && slots.$key;
  5637. if (!slots) {
  5638. res = {};
  5639. } else if (slots._normalized) {
  5640. // fast path 1: child component re-render only, parent did not change
  5641. return slots._normalized
  5642. } else if (
  5643. isStable &&
  5644. prevSlots &&
  5645. prevSlots !== emptyObject &&
  5646. key === prevSlots.$key &&
  5647. !hasNormalSlots &&
  5648. !prevSlots.$hasNormal
  5649. ) {
  5650. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  5651. // only need to normalize once
  5652. return prevSlots
  5653. } else {
  5654. res = {};
  5655. for (var key$1 in slots) {
  5656. if (slots[key$1] && key$1[0] !== '$') {
  5657. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  5658. }
  5659. }
  5660. }
  5661. // expose normal slots on scopedSlots
  5662. for (var key$2 in normalSlots) {
  5663. if (!(key$2 in res)) {
  5664. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  5665. }
  5666. }
  5667. // avoriaz seems to mock a non-extensible $scopedSlots object
  5668. // and when that is passed down this would cause an error
  5669. if (slots && Object.isExtensible(slots)) {
  5670. (slots)._normalized = res;
  5671. }
  5672. def(res, '$stable', isStable);
  5673. def(res, '$key', key);
  5674. def(res, '$hasNormal', hasNormalSlots);
  5675. return res
  5676. }
  5677. function normalizeScopedSlot(normalSlots, key, fn) {
  5678. var normalized = function () {
  5679. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  5680. res = res && typeof res === 'object' && !Array.isArray(res)
  5681. ? [res] // single vnode
  5682. : normalizeChildren(res);
  5683. return res && (
  5684. res.length === 0 ||
  5685. (res.length === 1 && res[0].isComment) // #9658
  5686. ) ? undefined
  5687. : res
  5688. };
  5689. // this is a slot using the new v-slot syntax without scope. although it is
  5690. // compiled as a scoped slot, render fn users would expect it to be present
  5691. // on this.$slots because the usage is semantically a normal slot.
  5692. if (fn.proxy) {
  5693. Object.defineProperty(normalSlots, key, {
  5694. get: normalized,
  5695. enumerable: true,
  5696. configurable: true
  5697. });
  5698. }
  5699. return normalized
  5700. }
  5701. function proxyNormalSlot(slots, key) {
  5702. return function () { return slots[key]; }
  5703. }
  5704. /* */
  5705. /**
  5706. * Runtime helper for rendering v-for lists.
  5707. */
  5708. function renderList (
  5709. val,
  5710. render
  5711. ) {
  5712. var ret, i, l, keys, key;
  5713. if (Array.isArray(val) || typeof val === 'string') {
  5714. ret = new Array(val.length);
  5715. for (i = 0, l = val.length; i < l; i++) {
  5716. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  5717. }
  5718. } else if (typeof val === 'number') {
  5719. ret = new Array(val);
  5720. for (i = 0; i < val; i++) {
  5721. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  5722. }
  5723. } else if (isObject(val)) {
  5724. if (hasSymbol && val[Symbol.iterator]) {
  5725. ret = [];
  5726. var iterator = val[Symbol.iterator]();
  5727. var result = iterator.next();
  5728. while (!result.done) {
  5729. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  5730. result = iterator.next();
  5731. }
  5732. } else {
  5733. keys = Object.keys(val);
  5734. ret = new Array(keys.length);
  5735. for (i = 0, l = keys.length; i < l; i++) {
  5736. key = keys[i];
  5737. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  5738. }
  5739. }
  5740. }
  5741. if (!isDef(ret)) {
  5742. ret = [];
  5743. }
  5744. (ret)._isVList = true;
  5745. return ret
  5746. }
  5747. /* */
  5748. /**
  5749. * Runtime helper for rendering <slot>
  5750. */
  5751. function renderSlot (
  5752. name,
  5753. fallback,
  5754. props,
  5755. bindObject
  5756. ) {
  5757. var scopedSlotFn = this.$scopedSlots[name];
  5758. var nodes;
  5759. if (scopedSlotFn) { // scoped slot
  5760. props = props || {};
  5761. if (bindObject) {
  5762. if ( true && !isObject(bindObject)) {
  5763. warn(
  5764. 'slot v-bind without argument expects an Object',
  5765. this
  5766. );
  5767. }
  5768. props = extend(extend({}, bindObject), props);
  5769. }
  5770. // fixed by xxxxxx app-plus scopedSlot
  5771. nodes = scopedSlotFn(props, this, props._i) || fallback;
  5772. } else {
  5773. nodes = this.$slots[name] || fallback;
  5774. }
  5775. var target = props && props.slot;
  5776. if (target) {
  5777. return this.$createElement('template', { slot: target }, nodes)
  5778. } else {
  5779. return nodes
  5780. }
  5781. }
  5782. /* */
  5783. /**
  5784. * Runtime helper for resolving filters
  5785. */
  5786. function resolveFilter (id) {
  5787. return resolveAsset(this.$options, 'filters', id, true) || identity
  5788. }
  5789. /* */
  5790. function isKeyNotMatch (expect, actual) {
  5791. if (Array.isArray(expect)) {
  5792. return expect.indexOf(actual) === -1
  5793. } else {
  5794. return expect !== actual
  5795. }
  5796. }
  5797. /**
  5798. * Runtime helper for checking keyCodes from config.
  5799. * exposed as Vue.prototype._k
  5800. * passing in eventKeyName as last argument separately for backwards compat
  5801. */
  5802. function checkKeyCodes (
  5803. eventKeyCode,
  5804. key,
  5805. builtInKeyCode,
  5806. eventKeyName,
  5807. builtInKeyName
  5808. ) {
  5809. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  5810. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  5811. return isKeyNotMatch(builtInKeyName, eventKeyName)
  5812. } else if (mappedKeyCode) {
  5813. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  5814. } else if (eventKeyName) {
  5815. return hyphenate(eventKeyName) !== key
  5816. }
  5817. }
  5818. /* */
  5819. /**
  5820. * Runtime helper for merging v-bind="object" into a VNode's data.
  5821. */
  5822. function bindObjectProps (
  5823. data,
  5824. tag,
  5825. value,
  5826. asProp,
  5827. isSync
  5828. ) {
  5829. if (value) {
  5830. if (!isObject(value)) {
  5831. true && warn(
  5832. 'v-bind without argument expects an Object or Array value',
  5833. this
  5834. );
  5835. } else {
  5836. if (Array.isArray(value)) {
  5837. value = toObject(value);
  5838. }
  5839. var hash;
  5840. var loop = function ( key ) {
  5841. if (
  5842. key === 'class' ||
  5843. key === 'style' ||
  5844. isReservedAttribute(key)
  5845. ) {
  5846. hash = data;
  5847. } else {
  5848. var type = data.attrs && data.attrs.type;
  5849. hash = asProp || config.mustUseProp(tag, type, key)
  5850. ? data.domProps || (data.domProps = {})
  5851. : data.attrs || (data.attrs = {});
  5852. }
  5853. var camelizedKey = camelize(key);
  5854. var hyphenatedKey = hyphenate(key);
  5855. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  5856. hash[key] = value[key];
  5857. if (isSync) {
  5858. var on = data.on || (data.on = {});
  5859. on[("update:" + key)] = function ($event) {
  5860. value[key] = $event;
  5861. };
  5862. }
  5863. }
  5864. };
  5865. for (var key in value) loop( key );
  5866. }
  5867. }
  5868. return data
  5869. }
  5870. /* */
  5871. /**
  5872. * Runtime helper for rendering static trees.
  5873. */
  5874. function renderStatic (
  5875. index,
  5876. isInFor
  5877. ) {
  5878. var cached = this._staticTrees || (this._staticTrees = []);
  5879. var tree = cached[index];
  5880. // if has already-rendered static tree and not inside v-for,
  5881. // we can reuse the same tree.
  5882. if (tree && !isInFor) {
  5883. return tree
  5884. }
  5885. // otherwise, render a fresh tree.
  5886. tree = cached[index] = this.$options.staticRenderFns[index].call(
  5887. this._renderProxy,
  5888. null,
  5889. this // for render fns generated for functional component templates
  5890. );
  5891. markStatic(tree, ("__static__" + index), false);
  5892. return tree
  5893. }
  5894. /**
  5895. * Runtime helper for v-once.
  5896. * Effectively it means marking the node as static with a unique key.
  5897. */
  5898. function markOnce (
  5899. tree,
  5900. index,
  5901. key
  5902. ) {
  5903. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  5904. return tree
  5905. }
  5906. function markStatic (
  5907. tree,
  5908. key,
  5909. isOnce
  5910. ) {
  5911. if (Array.isArray(tree)) {
  5912. for (var i = 0; i < tree.length; i++) {
  5913. if (tree[i] && typeof tree[i] !== 'string') {
  5914. markStaticNode(tree[i], (key + "_" + i), isOnce);
  5915. }
  5916. }
  5917. } else {
  5918. markStaticNode(tree, key, isOnce);
  5919. }
  5920. }
  5921. function markStaticNode (node, key, isOnce) {
  5922. node.isStatic = true;
  5923. node.key = key;
  5924. node.isOnce = isOnce;
  5925. }
  5926. /* */
  5927. function bindObjectListeners (data, value) {
  5928. if (value) {
  5929. if (!isPlainObject(value)) {
  5930. true && warn(
  5931. 'v-on without argument expects an Object value',
  5932. this
  5933. );
  5934. } else {
  5935. var on = data.on = data.on ? extend({}, data.on) : {};
  5936. for (var key in value) {
  5937. var existing = on[key];
  5938. var ours = value[key];
  5939. on[key] = existing ? [].concat(existing, ours) : ours;
  5940. }
  5941. }
  5942. }
  5943. return data
  5944. }
  5945. /* */
  5946. function resolveScopedSlots (
  5947. fns, // see flow/vnode
  5948. res,
  5949. // the following are added in 2.6
  5950. hasDynamicKeys,
  5951. contentHashKey
  5952. ) {
  5953. res = res || { $stable: !hasDynamicKeys };
  5954. for (var i = 0; i < fns.length; i++) {
  5955. var slot = fns[i];
  5956. if (Array.isArray(slot)) {
  5957. resolveScopedSlots(slot, res, hasDynamicKeys);
  5958. } else if (slot) {
  5959. // marker for reverse proxying v-slot without scope on this.$slots
  5960. if (slot.proxy) {
  5961. slot.fn.proxy = true;
  5962. }
  5963. res[slot.key] = slot.fn;
  5964. }
  5965. }
  5966. if (contentHashKey) {
  5967. (res).$key = contentHashKey;
  5968. }
  5969. return res
  5970. }
  5971. /* */
  5972. function bindDynamicKeys (baseObj, values) {
  5973. for (var i = 0; i < values.length; i += 2) {
  5974. var key = values[i];
  5975. if (typeof key === 'string' && key) {
  5976. baseObj[values[i]] = values[i + 1];
  5977. } else if ( true && key !== '' && key !== null) {
  5978. // null is a special value for explicitly removing a binding
  5979. warn(
  5980. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  5981. this
  5982. );
  5983. }
  5984. }
  5985. return baseObj
  5986. }
  5987. // helper to dynamically append modifier runtime markers to event names.
  5988. // ensure only append when value is already string, otherwise it will be cast
  5989. // to string and cause the type check to miss.
  5990. function prependModifier (value, symbol) {
  5991. return typeof value === 'string' ? symbol + value : value
  5992. }
  5993. /* */
  5994. function installRenderHelpers (target) {
  5995. target._o = markOnce;
  5996. target._n = toNumber;
  5997. target._s = toString;
  5998. target._l = renderList;
  5999. target._t = renderSlot;
  6000. target._q = looseEqual;
  6001. target._i = looseIndexOf;
  6002. target._m = renderStatic;
  6003. target._f = resolveFilter;
  6004. target._k = checkKeyCodes;
  6005. target._b = bindObjectProps;
  6006. target._v = createTextVNode;
  6007. target._e = createEmptyVNode;
  6008. target._u = resolveScopedSlots;
  6009. target._g = bindObjectListeners;
  6010. target._d = bindDynamicKeys;
  6011. target._p = prependModifier;
  6012. }
  6013. /* */
  6014. function FunctionalRenderContext (
  6015. data,
  6016. props,
  6017. children,
  6018. parent,
  6019. Ctor
  6020. ) {
  6021. var this$1 = this;
  6022. var options = Ctor.options;
  6023. // ensure the createElement function in functional components
  6024. // gets a unique context - this is necessary for correct named slot check
  6025. var contextVm;
  6026. if (hasOwn(parent, '_uid')) {
  6027. contextVm = Object.create(parent);
  6028. // $flow-disable-line
  6029. contextVm._original = parent;
  6030. } else {
  6031. // the context vm passed in is a functional context as well.
  6032. // in this case we want to make sure we are able to get a hold to the
  6033. // real context instance.
  6034. contextVm = parent;
  6035. // $flow-disable-line
  6036. parent = parent._original;
  6037. }
  6038. var isCompiled = isTrue(options._compiled);
  6039. var needNormalization = !isCompiled;
  6040. this.data = data;
  6041. this.props = props;
  6042. this.children = children;
  6043. this.parent = parent;
  6044. this.listeners = data.on || emptyObject;
  6045. this.injections = resolveInject(options.inject, parent);
  6046. this.slots = function () {
  6047. if (!this$1.$slots) {
  6048. normalizeScopedSlots(
  6049. data.scopedSlots,
  6050. this$1.$slots = resolveSlots(children, parent)
  6051. );
  6052. }
  6053. return this$1.$slots
  6054. };
  6055. Object.defineProperty(this, 'scopedSlots', ({
  6056. enumerable: true,
  6057. get: function get () {
  6058. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6059. }
  6060. }));
  6061. // support for compiled functional template
  6062. if (isCompiled) {
  6063. // exposing $options for renderStatic()
  6064. this.$options = options;
  6065. // pre-resolve slots for renderSlot()
  6066. this.$slots = this.slots();
  6067. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6068. }
  6069. if (options._scopeId) {
  6070. this._c = function (a, b, c, d) {
  6071. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6072. if (vnode && !Array.isArray(vnode)) {
  6073. vnode.fnScopeId = options._scopeId;
  6074. vnode.fnContext = parent;
  6075. }
  6076. return vnode
  6077. };
  6078. } else {
  6079. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6080. }
  6081. }
  6082. installRenderHelpers(FunctionalRenderContext.prototype);
  6083. function createFunctionalComponent (
  6084. Ctor,
  6085. propsData,
  6086. data,
  6087. contextVm,
  6088. children
  6089. ) {
  6090. var options = Ctor.options;
  6091. var props = {};
  6092. var propOptions = options.props;
  6093. if (isDef(propOptions)) {
  6094. for (var key in propOptions) {
  6095. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6096. }
  6097. } else {
  6098. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6099. if (isDef(data.props)) { mergeProps(props, data.props); }
  6100. }
  6101. var renderContext = new FunctionalRenderContext(
  6102. data,
  6103. props,
  6104. children,
  6105. contextVm,
  6106. Ctor
  6107. );
  6108. var vnode = options.render.call(null, renderContext._c, renderContext);
  6109. if (vnode instanceof VNode) {
  6110. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6111. } else if (Array.isArray(vnode)) {
  6112. var vnodes = normalizeChildren(vnode) || [];
  6113. var res = new Array(vnodes.length);
  6114. for (var i = 0; i < vnodes.length; i++) {
  6115. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6116. }
  6117. return res
  6118. }
  6119. }
  6120. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6121. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6122. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6123. // that should not be matched to match.
  6124. var clone = cloneVNode(vnode);
  6125. clone.fnContext = contextVm;
  6126. clone.fnOptions = options;
  6127. if (true) {
  6128. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6129. }
  6130. if (data.slot) {
  6131. (clone.data || (clone.data = {})).slot = data.slot;
  6132. }
  6133. return clone
  6134. }
  6135. function mergeProps (to, from) {
  6136. for (var key in from) {
  6137. to[camelize(key)] = from[key];
  6138. }
  6139. }
  6140. /* */
  6141. /* */
  6142. /* */
  6143. /* */
  6144. // inline hooks to be invoked on component VNodes during patch
  6145. var componentVNodeHooks = {
  6146. init: function init (vnode, hydrating) {
  6147. if (
  6148. vnode.componentInstance &&
  6149. !vnode.componentInstance._isDestroyed &&
  6150. vnode.data.keepAlive
  6151. ) {
  6152. // kept-alive components, treat as a patch
  6153. var mountedNode = vnode; // work around flow
  6154. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6155. } else {
  6156. var child = vnode.componentInstance = createComponentInstanceForVnode(
  6157. vnode,
  6158. activeInstance
  6159. );
  6160. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  6161. }
  6162. },
  6163. prepatch: function prepatch (oldVnode, vnode) {
  6164. var options = vnode.componentOptions;
  6165. var child = vnode.componentInstance = oldVnode.componentInstance;
  6166. updateChildComponent(
  6167. child,
  6168. options.propsData, // updated props
  6169. options.listeners, // updated listeners
  6170. vnode, // new parent vnode
  6171. options.children // new children
  6172. );
  6173. },
  6174. insert: function insert (vnode) {
  6175. var context = vnode.context;
  6176. var componentInstance = vnode.componentInstance;
  6177. if (!componentInstance._isMounted) {
  6178. callHook(componentInstance, 'onServiceCreated');
  6179. callHook(componentInstance, 'onServiceAttached');
  6180. componentInstance._isMounted = true;
  6181. callHook(componentInstance, 'mounted');
  6182. }
  6183. if (vnode.data.keepAlive) {
  6184. if (context._isMounted) {
  6185. // vue-router#1212
  6186. // During updates, a kept-alive component's child components may
  6187. // change, so directly walking the tree here may call activated hooks
  6188. // on incorrect children. Instead we push them into a queue which will
  6189. // be processed after the whole patch process ended.
  6190. queueActivatedComponent(componentInstance);
  6191. } else {
  6192. activateChildComponent(componentInstance, true /* direct */);
  6193. }
  6194. }
  6195. },
  6196. destroy: function destroy (vnode) {
  6197. var componentInstance = vnode.componentInstance;
  6198. if (!componentInstance._isDestroyed) {
  6199. if (!vnode.data.keepAlive) {
  6200. componentInstance.$destroy();
  6201. } else {
  6202. deactivateChildComponent(componentInstance, true /* direct */);
  6203. }
  6204. }
  6205. }
  6206. };
  6207. var hooksToMerge = Object.keys(componentVNodeHooks);
  6208. function createComponent (
  6209. Ctor,
  6210. data,
  6211. context,
  6212. children,
  6213. tag
  6214. ) {
  6215. if (isUndef(Ctor)) {
  6216. return
  6217. }
  6218. var baseCtor = context.$options._base;
  6219. // plain options object: turn it into a constructor
  6220. if (isObject(Ctor)) {
  6221. Ctor = baseCtor.extend(Ctor);
  6222. }
  6223. // if at this stage it's not a constructor or an async component factory,
  6224. // reject.
  6225. if (typeof Ctor !== 'function') {
  6226. if (true) {
  6227. warn(("Invalid Component definition: " + (String(Ctor))), context);
  6228. }
  6229. return
  6230. }
  6231. // async component
  6232. var asyncFactory;
  6233. if (isUndef(Ctor.cid)) {
  6234. asyncFactory = Ctor;
  6235. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  6236. if (Ctor === undefined) {
  6237. // return a placeholder node for async component, which is rendered
  6238. // as a comment node but preserves all the raw information for the node.
  6239. // the information will be used for async server-rendering and hydration.
  6240. return createAsyncPlaceholder(
  6241. asyncFactory,
  6242. data,
  6243. context,
  6244. children,
  6245. tag
  6246. )
  6247. }
  6248. }
  6249. data = data || {};
  6250. // resolve constructor options in case global mixins are applied after
  6251. // component constructor creation
  6252. resolveConstructorOptions(Ctor);
  6253. // transform component v-model data into props & events
  6254. if (isDef(data.model)) {
  6255. transformModel(Ctor.options, data);
  6256. }
  6257. // extract props
  6258. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  6259. // functional component
  6260. if (isTrue(Ctor.options.functional)) {
  6261. return createFunctionalComponent(Ctor, propsData, data, context, children)
  6262. }
  6263. // extract listeners, since these needs to be treated as
  6264. // child component listeners instead of DOM listeners
  6265. var listeners = data.on;
  6266. // replace with listeners with .native modifier
  6267. // so it gets processed during parent component patch.
  6268. data.on = data.nativeOn;
  6269. if (isTrue(Ctor.options.abstract)) {
  6270. // abstract components do not keep anything
  6271. // other than props & listeners & slot
  6272. // work around flow
  6273. var slot = data.slot;
  6274. data = {};
  6275. if (slot) {
  6276. data.slot = slot;
  6277. }
  6278. }
  6279. // install component management hooks onto the placeholder node
  6280. installComponentHooks(data);
  6281. // return a placeholder vnode
  6282. var name = Ctor.options.name || tag;
  6283. var vnode = new VNode(
  6284. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  6285. data, undefined, undefined, undefined, context,
  6286. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  6287. asyncFactory
  6288. );
  6289. return vnode
  6290. }
  6291. function createComponentInstanceForVnode (
  6292. vnode, // we know it's MountedComponentVNode but flow doesn't
  6293. parent // activeInstance in lifecycle state
  6294. ) {
  6295. var options = {
  6296. _isComponent: true,
  6297. _parentVnode: vnode,
  6298. parent: parent
  6299. };
  6300. // check inline-template render functions
  6301. var inlineTemplate = vnode.data.inlineTemplate;
  6302. if (isDef(inlineTemplate)) {
  6303. options.render = inlineTemplate.render;
  6304. options.staticRenderFns = inlineTemplate.staticRenderFns;
  6305. }
  6306. return new vnode.componentOptions.Ctor(options)
  6307. }
  6308. function installComponentHooks (data) {
  6309. var hooks = data.hook || (data.hook = {});
  6310. for (var i = 0; i < hooksToMerge.length; i++) {
  6311. var key = hooksToMerge[i];
  6312. var existing = hooks[key];
  6313. var toMerge = componentVNodeHooks[key];
  6314. if (existing !== toMerge && !(existing && existing._merged)) {
  6315. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  6316. }
  6317. }
  6318. }
  6319. function mergeHook$1 (f1, f2) {
  6320. var merged = function (a, b) {
  6321. // flow complains about extra args which is why we use any
  6322. f1(a, b);
  6323. f2(a, b);
  6324. };
  6325. merged._merged = true;
  6326. return merged
  6327. }
  6328. // transform component v-model info (value and callback) into
  6329. // prop and event handler respectively.
  6330. function transformModel (options, data) {
  6331. var prop = (options.model && options.model.prop) || 'value';
  6332. var event = (options.model && options.model.event) || 'input'
  6333. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  6334. var on = data.on || (data.on = {});
  6335. var existing = on[event];
  6336. var callback = data.model.callback;
  6337. if (isDef(existing)) {
  6338. if (
  6339. Array.isArray(existing)
  6340. ? existing.indexOf(callback) === -1
  6341. : existing !== callback
  6342. ) {
  6343. on[event] = [callback].concat(existing);
  6344. }
  6345. } else {
  6346. on[event] = callback;
  6347. }
  6348. }
  6349. /* */
  6350. var SIMPLE_NORMALIZE = 1;
  6351. var ALWAYS_NORMALIZE = 2;
  6352. // wrapper function for providing a more flexible interface
  6353. // without getting yelled at by flow
  6354. function createElement (
  6355. context,
  6356. tag,
  6357. data,
  6358. children,
  6359. normalizationType,
  6360. alwaysNormalize
  6361. ) {
  6362. if (Array.isArray(data) || isPrimitive(data)) {
  6363. normalizationType = children;
  6364. children = data;
  6365. data = undefined;
  6366. }
  6367. if (isTrue(alwaysNormalize)) {
  6368. normalizationType = ALWAYS_NORMALIZE;
  6369. }
  6370. return _createElement(context, tag, data, children, normalizationType)
  6371. }
  6372. function _createElement (
  6373. context,
  6374. tag,
  6375. data,
  6376. children,
  6377. normalizationType
  6378. ) {
  6379. if (isDef(data) && isDef((data).__ob__)) {
  6380. true && warn(
  6381. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  6382. 'Always create fresh vnode data objects in each render!',
  6383. context
  6384. );
  6385. return createEmptyVNode()
  6386. }
  6387. // object syntax in v-bind
  6388. if (isDef(data) && isDef(data.is)) {
  6389. tag = data.is;
  6390. }
  6391. if (!tag) {
  6392. // in case of component :is set to falsy value
  6393. return createEmptyVNode()
  6394. }
  6395. // warn against non-primitive key
  6396. if ( true &&
  6397. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  6398. ) {
  6399. {
  6400. warn(
  6401. 'Avoid using non-primitive value as key, ' +
  6402. 'use string/number value instead.',
  6403. context
  6404. );
  6405. }
  6406. }
  6407. // support single function children as default scoped slot
  6408. if (Array.isArray(children) &&
  6409. typeof children[0] === 'function'
  6410. ) {
  6411. data = data || {};
  6412. data.scopedSlots = { default: children[0] };
  6413. children.length = 0;
  6414. }
  6415. if (normalizationType === ALWAYS_NORMALIZE) {
  6416. children = normalizeChildren(children);
  6417. } else if (normalizationType === SIMPLE_NORMALIZE) {
  6418. children = simpleNormalizeChildren(children);
  6419. }
  6420. var vnode, ns;
  6421. if (typeof tag === 'string') {
  6422. var Ctor;
  6423. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  6424. if (config.isReservedTag(tag)) {
  6425. // platform built-in elements
  6426. if ( true && isDef(data) && isDef(data.nativeOn)) {
  6427. warn(
  6428. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  6429. context
  6430. );
  6431. }
  6432. vnode = new VNode(
  6433. config.parsePlatformTagName(tag), data, children,
  6434. undefined, undefined, context
  6435. );
  6436. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  6437. // component
  6438. vnode = createComponent(Ctor, data, context, children, tag);
  6439. } else {
  6440. // unknown or unlisted namespaced elements
  6441. // check at runtime because it may get assigned a namespace when its
  6442. // parent normalizes children
  6443. vnode = new VNode(
  6444. tag, data, children,
  6445. undefined, undefined, context
  6446. );
  6447. }
  6448. } else {
  6449. // direct component options / constructor
  6450. vnode = createComponent(tag, data, context, children);
  6451. }
  6452. if (Array.isArray(vnode)) {
  6453. return vnode
  6454. } else if (isDef(vnode)) {
  6455. if (isDef(ns)) { applyNS(vnode, ns); }
  6456. if (isDef(data)) { registerDeepBindings(data); }
  6457. return vnode
  6458. } else {
  6459. return createEmptyVNode()
  6460. }
  6461. }
  6462. function applyNS (vnode, ns, force) {
  6463. vnode.ns = ns;
  6464. if (vnode.tag === 'foreignObject') {
  6465. // use default namespace inside foreignObject
  6466. ns = undefined;
  6467. force = true;
  6468. }
  6469. if (isDef(vnode.children)) {
  6470. for (var i = 0, l = vnode.children.length; i < l; i++) {
  6471. var child = vnode.children[i];
  6472. if (isDef(child.tag) && (
  6473. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  6474. applyNS(child, ns, force);
  6475. }
  6476. }
  6477. }
  6478. }
  6479. // ref #5318
  6480. // necessary to ensure parent re-render when deep bindings like :style and
  6481. // :class are used on slot nodes
  6482. function registerDeepBindings (data) {
  6483. if (isObject(data.style)) {
  6484. traverse(data.style);
  6485. }
  6486. if (isObject(data.class)) {
  6487. traverse(data.class);
  6488. }
  6489. }
  6490. /* */
  6491. function initRender (vm) {
  6492. vm._vnode = null; // the root of the child tree
  6493. vm._staticTrees = null; // v-once cached trees
  6494. var options = vm.$options;
  6495. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  6496. var renderContext = parentVnode && parentVnode.context;
  6497. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  6498. vm.$scopedSlots = emptyObject;
  6499. // bind the createElement fn to this instance
  6500. // so that we get proper render context inside it.
  6501. // args order: tag, data, children, normalizationType, alwaysNormalize
  6502. // internal version is used by render functions compiled from templates
  6503. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  6504. // normalization is always applied for the public version, used in
  6505. // user-written render functions.
  6506. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  6507. // $attrs & $listeners are exposed for easier HOC creation.
  6508. // they need to be reactive so that HOCs using them are always updated
  6509. var parentData = parentVnode && parentVnode.data;
  6510. /* istanbul ignore else */
  6511. if (true) {
  6512. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  6513. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  6514. }, true);
  6515. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  6516. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  6517. }, true);
  6518. } else {}
  6519. }
  6520. var currentRenderingInstance = null;
  6521. function renderMixin (Vue) {
  6522. // install runtime convenience helpers
  6523. installRenderHelpers(Vue.prototype);
  6524. Vue.prototype.$nextTick = function (fn) {
  6525. return nextTick(fn, this)
  6526. };
  6527. Vue.prototype._render = function () {
  6528. var vm = this;
  6529. var ref = vm.$options;
  6530. var render = ref.render;
  6531. var _parentVnode = ref._parentVnode;
  6532. if (_parentVnode) {
  6533. vm.$scopedSlots = normalizeScopedSlots(
  6534. _parentVnode.data.scopedSlots,
  6535. vm.$slots,
  6536. vm.$scopedSlots
  6537. );
  6538. }
  6539. // set parent vnode. this allows render functions to have access
  6540. // to the data on the placeholder node.
  6541. vm.$vnode = _parentVnode;
  6542. // render self
  6543. var vnode;
  6544. try {
  6545. // There's no need to maintain a stack because all render fns are called
  6546. // separately from one another. Nested component's render fns are called
  6547. // when parent component is patched.
  6548. currentRenderingInstance = vm;
  6549. vnode = render.call(vm._renderProxy, vm.$createElement);
  6550. } catch (e) {
  6551. handleError(e, vm, "render");
  6552. // return error render result,
  6553. // or previous vnode to prevent render error causing blank component
  6554. /* istanbul ignore else */
  6555. if ( true && vm.$options.renderError) {
  6556. try {
  6557. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  6558. } catch (e) {
  6559. handleError(e, vm, "renderError");
  6560. vnode = vm._vnode;
  6561. }
  6562. } else {
  6563. vnode = vm._vnode;
  6564. }
  6565. } finally {
  6566. currentRenderingInstance = null;
  6567. }
  6568. // if the returned array contains only a single node, allow it
  6569. if (Array.isArray(vnode) && vnode.length === 1) {
  6570. vnode = vnode[0];
  6571. }
  6572. // return empty vnode in case the render function errored out
  6573. if (!(vnode instanceof VNode)) {
  6574. if ( true && Array.isArray(vnode)) {
  6575. warn(
  6576. 'Multiple root nodes returned from render function. Render function ' +
  6577. 'should return a single root node.',
  6578. vm
  6579. );
  6580. }
  6581. vnode = createEmptyVNode();
  6582. }
  6583. // set parent
  6584. vnode.parent = _parentVnode;
  6585. return vnode
  6586. };
  6587. }
  6588. /* */
  6589. function ensureCtor (comp, base) {
  6590. if (
  6591. comp.__esModule ||
  6592. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  6593. ) {
  6594. comp = comp.default;
  6595. }
  6596. return isObject(comp)
  6597. ? base.extend(comp)
  6598. : comp
  6599. }
  6600. function createAsyncPlaceholder (
  6601. factory,
  6602. data,
  6603. context,
  6604. children,
  6605. tag
  6606. ) {
  6607. var node = createEmptyVNode();
  6608. node.asyncFactory = factory;
  6609. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  6610. return node
  6611. }
  6612. function resolveAsyncComponent (
  6613. factory,
  6614. baseCtor
  6615. ) {
  6616. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  6617. return factory.errorComp
  6618. }
  6619. if (isDef(factory.resolved)) {
  6620. return factory.resolved
  6621. }
  6622. var owner = currentRenderingInstance;
  6623. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  6624. // already pending
  6625. factory.owners.push(owner);
  6626. }
  6627. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  6628. return factory.loadingComp
  6629. }
  6630. if (owner && !isDef(factory.owners)) {
  6631. var owners = factory.owners = [owner];
  6632. var sync = true;
  6633. var timerLoading = null;
  6634. var timerTimeout = null
  6635. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  6636. var forceRender = function (renderCompleted) {
  6637. for (var i = 0, l = owners.length; i < l; i++) {
  6638. (owners[i]).$forceUpdate();
  6639. }
  6640. if (renderCompleted) {
  6641. owners.length = 0;
  6642. if (timerLoading !== null) {
  6643. clearTimeout(timerLoading);
  6644. timerLoading = null;
  6645. }
  6646. if (timerTimeout !== null) {
  6647. clearTimeout(timerTimeout);
  6648. timerTimeout = null;
  6649. }
  6650. }
  6651. };
  6652. var resolve = once(function (res) {
  6653. // cache resolved
  6654. factory.resolved = ensureCtor(res, baseCtor);
  6655. // invoke callbacks only if this is not a synchronous resolve
  6656. // (async resolves are shimmed as synchronous during SSR)
  6657. if (!sync) {
  6658. forceRender(true);
  6659. } else {
  6660. owners.length = 0;
  6661. }
  6662. });
  6663. var reject = once(function (reason) {
  6664. true && warn(
  6665. "Failed to resolve async component: " + (String(factory)) +
  6666. (reason ? ("\nReason: " + reason) : '')
  6667. );
  6668. if (isDef(factory.errorComp)) {
  6669. factory.error = true;
  6670. forceRender(true);
  6671. }
  6672. });
  6673. var res = factory(resolve, reject);
  6674. if (isObject(res)) {
  6675. if (isPromise(res)) {
  6676. // () => Promise
  6677. if (isUndef(factory.resolved)) {
  6678. res.then(resolve, reject);
  6679. }
  6680. } else if (isPromise(res.component)) {
  6681. res.component.then(resolve, reject);
  6682. if (isDef(res.error)) {
  6683. factory.errorComp = ensureCtor(res.error, baseCtor);
  6684. }
  6685. if (isDef(res.loading)) {
  6686. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  6687. if (res.delay === 0) {
  6688. factory.loading = true;
  6689. } else {
  6690. timerLoading = setTimeout(function () {
  6691. timerLoading = null;
  6692. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  6693. factory.loading = true;
  6694. forceRender(false);
  6695. }
  6696. }, res.delay || 200);
  6697. }
  6698. }
  6699. if (isDef(res.timeout)) {
  6700. timerTimeout = setTimeout(function () {
  6701. timerTimeout = null;
  6702. if (isUndef(factory.resolved)) {
  6703. reject(
  6704. true
  6705. ? ("timeout (" + (res.timeout) + "ms)")
  6706. : undefined
  6707. );
  6708. }
  6709. }, res.timeout);
  6710. }
  6711. }
  6712. }
  6713. sync = false;
  6714. // return in case resolved synchronously
  6715. return factory.loading
  6716. ? factory.loadingComp
  6717. : factory.resolved
  6718. }
  6719. }
  6720. /* */
  6721. function isAsyncPlaceholder (node) {
  6722. return node.isComment && node.asyncFactory
  6723. }
  6724. /* */
  6725. function getFirstComponentChild (children) {
  6726. if (Array.isArray(children)) {
  6727. for (var i = 0; i < children.length; i++) {
  6728. var c = children[i];
  6729. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  6730. return c
  6731. }
  6732. }
  6733. }
  6734. }
  6735. /* */
  6736. /* */
  6737. function initEvents (vm) {
  6738. vm._events = Object.create(null);
  6739. vm._hasHookEvent = false;
  6740. // init parent attached events
  6741. var listeners = vm.$options._parentListeners;
  6742. if (listeners) {
  6743. updateComponentListeners(vm, listeners);
  6744. }
  6745. }
  6746. var target;
  6747. function add (event, fn) {
  6748. target.$on(event, fn);
  6749. }
  6750. function remove$1 (event, fn) {
  6751. target.$off(event, fn);
  6752. }
  6753. function createOnceHandler (event, fn) {
  6754. var _target = target;
  6755. return function onceHandler () {
  6756. var res = fn.apply(null, arguments);
  6757. if (res !== null) {
  6758. _target.$off(event, onceHandler);
  6759. }
  6760. }
  6761. }
  6762. function updateComponentListeners (
  6763. vm,
  6764. listeners,
  6765. oldListeners
  6766. ) {
  6767. target = vm;
  6768. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  6769. target = undefined;
  6770. }
  6771. function eventsMixin (Vue) {
  6772. var hookRE = /^hook:/;
  6773. Vue.prototype.$on = function (event, fn) {
  6774. var vm = this;
  6775. if (Array.isArray(event)) {
  6776. for (var i = 0, l = event.length; i < l; i++) {
  6777. vm.$on(event[i], fn);
  6778. }
  6779. } else {
  6780. (vm._events[event] || (vm._events[event] = [])).push(fn);
  6781. // optimize hook:event cost by using a boolean flag marked at registration
  6782. // instead of a hash lookup
  6783. if (hookRE.test(event)) {
  6784. vm._hasHookEvent = true;
  6785. }
  6786. }
  6787. return vm
  6788. };
  6789. Vue.prototype.$once = function (event, fn) {
  6790. var vm = this;
  6791. function on () {
  6792. vm.$off(event, on);
  6793. fn.apply(vm, arguments);
  6794. }
  6795. on.fn = fn;
  6796. vm.$on(event, on);
  6797. return vm
  6798. };
  6799. Vue.prototype.$off = function (event, fn) {
  6800. var vm = this;
  6801. // all
  6802. if (!arguments.length) {
  6803. vm._events = Object.create(null);
  6804. return vm
  6805. }
  6806. // array of events
  6807. if (Array.isArray(event)) {
  6808. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  6809. vm.$off(event[i$1], fn);
  6810. }
  6811. return vm
  6812. }
  6813. // specific event
  6814. var cbs = vm._events[event];
  6815. if (!cbs) {
  6816. return vm
  6817. }
  6818. if (!fn) {
  6819. vm._events[event] = null;
  6820. return vm
  6821. }
  6822. // specific handler
  6823. var cb;
  6824. var i = cbs.length;
  6825. while (i--) {
  6826. cb = cbs[i];
  6827. if (cb === fn || cb.fn === fn) {
  6828. cbs.splice(i, 1);
  6829. break
  6830. }
  6831. }
  6832. return vm
  6833. };
  6834. Vue.prototype.$emit = function (event) {
  6835. var vm = this;
  6836. if (true) {
  6837. var lowerCaseEvent = event.toLowerCase();
  6838. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  6839. tip(
  6840. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  6841. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  6842. "Note that HTML attributes are case-insensitive and you cannot use " +
  6843. "v-on to listen to camelCase events when using in-DOM templates. " +
  6844. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  6845. );
  6846. }
  6847. }
  6848. var cbs = vm._events[event];
  6849. if (cbs) {
  6850. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  6851. var args = toArray(arguments, 1);
  6852. var info = "event handler for \"" + event + "\"";
  6853. for (var i = 0, l = cbs.length; i < l; i++) {
  6854. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  6855. }
  6856. }
  6857. return vm
  6858. };
  6859. }
  6860. /* */
  6861. var activeInstance = null;
  6862. var isUpdatingChildComponent = false;
  6863. function setActiveInstance(vm) {
  6864. var prevActiveInstance = activeInstance;
  6865. activeInstance = vm;
  6866. return function () {
  6867. activeInstance = prevActiveInstance;
  6868. }
  6869. }
  6870. function initLifecycle (vm) {
  6871. var options = vm.$options;
  6872. // locate first non-abstract parent
  6873. var parent = options.parent;
  6874. if (parent && !options.abstract) {
  6875. while (parent.$options.abstract && parent.$parent) {
  6876. parent = parent.$parent;
  6877. }
  6878. parent.$children.push(vm);
  6879. }
  6880. vm.$parent = parent;
  6881. vm.$root = parent ? parent.$root : vm;
  6882. vm.$children = [];
  6883. vm.$refs = {};
  6884. vm._watcher = null;
  6885. vm._inactive = null;
  6886. vm._directInactive = false;
  6887. vm._isMounted = false;
  6888. vm._isDestroyed = false;
  6889. vm._isBeingDestroyed = false;
  6890. }
  6891. function lifecycleMixin (Vue) {
  6892. Vue.prototype._update = function (vnode, hydrating) {
  6893. var vm = this;
  6894. var prevEl = vm.$el;
  6895. var prevVnode = vm._vnode;
  6896. var restoreActiveInstance = setActiveInstance(vm);
  6897. vm._vnode = vnode;
  6898. // Vue.prototype.__patch__ is injected in entry points
  6899. // based on the rendering backend used.
  6900. if (!prevVnode) {
  6901. // initial render
  6902. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  6903. } else {
  6904. // updates
  6905. vm.$el = vm.__patch__(prevVnode, vnode);
  6906. }
  6907. restoreActiveInstance();
  6908. // update __vue__ reference
  6909. if (prevEl) {
  6910. prevEl.__vue__ = null;
  6911. }
  6912. if (vm.$el) {
  6913. vm.$el.__vue__ = vm;
  6914. }
  6915. // if parent is an HOC, update its $el as well
  6916. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  6917. vm.$parent.$el = vm.$el;
  6918. }
  6919. // updated hook is called by the scheduler to ensure that children are
  6920. // updated in a parent's updated hook.
  6921. };
  6922. Vue.prototype.$forceUpdate = function () {
  6923. var vm = this;
  6924. if (vm._watcher) {
  6925. vm._watcher.update();
  6926. }
  6927. };
  6928. Vue.prototype.$destroy = function () {
  6929. var vm = this;
  6930. if (vm._isBeingDestroyed) {
  6931. return
  6932. }
  6933. callHook(vm, 'beforeDestroy');
  6934. vm._isBeingDestroyed = true;
  6935. // remove self from parent
  6936. var parent = vm.$parent;
  6937. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  6938. remove(parent.$children, vm);
  6939. }
  6940. // teardown watchers
  6941. if (vm._watcher) {
  6942. vm._watcher.teardown();
  6943. }
  6944. var i = vm._watchers.length;
  6945. while (i--) {
  6946. vm._watchers[i].teardown();
  6947. }
  6948. // remove reference from data ob
  6949. // frozen object may not have observer.
  6950. if (vm._data.__ob__) {
  6951. vm._data.__ob__.vmCount--;
  6952. }
  6953. // call the last hook...
  6954. vm._isDestroyed = true;
  6955. // invoke destroy hooks on current rendered tree
  6956. vm.__patch__(vm._vnode, null);
  6957. // fire destroyed hook
  6958. callHook(vm, 'destroyed');
  6959. // turn off all instance listeners.
  6960. vm.$off();
  6961. // remove __vue__ reference
  6962. if (vm.$el) {
  6963. vm.$el.__vue__ = null;
  6964. }
  6965. // release circular reference (#6759)
  6966. if (vm.$vnode) {
  6967. vm.$vnode.parent = null;
  6968. }
  6969. };
  6970. }
  6971. function updateChildComponent (
  6972. vm,
  6973. propsData,
  6974. listeners,
  6975. parentVnode,
  6976. renderChildren
  6977. ) {
  6978. if (true) {
  6979. isUpdatingChildComponent = true;
  6980. }
  6981. // determine whether component has slot children
  6982. // we need to do this before overwriting $options._renderChildren.
  6983. // check if there are dynamic scopedSlots (hand-written or compiled but with
  6984. // dynamic slot names). Static scoped slots compiled from template has the
  6985. // "$stable" marker.
  6986. var newScopedSlots = parentVnode.data.scopedSlots;
  6987. var oldScopedSlots = vm.$scopedSlots;
  6988. var hasDynamicScopedSlot = !!(
  6989. (newScopedSlots && !newScopedSlots.$stable) ||
  6990. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  6991. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  6992. );
  6993. // Any static slot children from the parent may have changed during parent's
  6994. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  6995. // update is necessary to ensure correctness.
  6996. var needsForceUpdate = !!(
  6997. renderChildren || // has new static slots
  6998. vm.$options._renderChildren || // has old static slots
  6999. hasDynamicScopedSlot
  7000. );
  7001. vm.$options._parentVnode = parentVnode;
  7002. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7003. if (vm._vnode) { // update child tree's parent
  7004. vm._vnode.parent = parentVnode;
  7005. }
  7006. vm.$options._renderChildren = renderChildren;
  7007. // update $attrs and $listeners hash
  7008. // these are also reactive so they may trigger child update if the child
  7009. // used them during render
  7010. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7011. vm.$listeners = listeners || emptyObject;
  7012. // update props
  7013. if (propsData && vm.$options.props) {
  7014. toggleObserving(false);
  7015. var props = vm._props;
  7016. var propKeys = vm.$options._propKeys || [];
  7017. for (var i = 0; i < propKeys.length; i++) {
  7018. var key = propKeys[i];
  7019. var propOptions = vm.$options.props; // wtf flow?
  7020. props[key] = validateProp(key, propOptions, propsData, vm);
  7021. }
  7022. toggleObserving(true);
  7023. // keep a copy of raw propsData
  7024. vm.$options.propsData = propsData;
  7025. }
  7026. // fixed by xxxxxx update properties(mp runtime)
  7027. vm._$updateProperties && vm._$updateProperties(vm);
  7028. // update listeners
  7029. listeners = listeners || emptyObject;
  7030. var oldListeners = vm.$options._parentListeners;
  7031. vm.$options._parentListeners = listeners;
  7032. updateComponentListeners(vm, listeners, oldListeners);
  7033. // resolve slots + force update if has children
  7034. if (needsForceUpdate) {
  7035. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7036. vm.$forceUpdate();
  7037. }
  7038. if (true) {
  7039. isUpdatingChildComponent = false;
  7040. }
  7041. }
  7042. function isInInactiveTree (vm) {
  7043. while (vm && (vm = vm.$parent)) {
  7044. if (vm._inactive) { return true }
  7045. }
  7046. return false
  7047. }
  7048. function activateChildComponent (vm, direct) {
  7049. if (direct) {
  7050. vm._directInactive = false;
  7051. if (isInInactiveTree(vm)) {
  7052. return
  7053. }
  7054. } else if (vm._directInactive) {
  7055. return
  7056. }
  7057. if (vm._inactive || vm._inactive === null) {
  7058. vm._inactive = false;
  7059. for (var i = 0; i < vm.$children.length; i++) {
  7060. activateChildComponent(vm.$children[i]);
  7061. }
  7062. callHook(vm, 'activated');
  7063. }
  7064. }
  7065. function deactivateChildComponent (vm, direct) {
  7066. if (direct) {
  7067. vm._directInactive = true;
  7068. if (isInInactiveTree(vm)) {
  7069. return
  7070. }
  7071. }
  7072. if (!vm._inactive) {
  7073. vm._inactive = true;
  7074. for (var i = 0; i < vm.$children.length; i++) {
  7075. deactivateChildComponent(vm.$children[i]);
  7076. }
  7077. callHook(vm, 'deactivated');
  7078. }
  7079. }
  7080. function callHook (vm, hook) {
  7081. // #7573 disable dep collection when invoking lifecycle hooks
  7082. pushTarget();
  7083. var handlers = vm.$options[hook];
  7084. var info = hook + " hook";
  7085. if (handlers) {
  7086. for (var i = 0, j = handlers.length; i < j; i++) {
  7087. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7088. }
  7089. }
  7090. if (vm._hasHookEvent) {
  7091. vm.$emit('hook:' + hook);
  7092. }
  7093. popTarget();
  7094. }
  7095. /* */
  7096. var MAX_UPDATE_COUNT = 100;
  7097. var queue = [];
  7098. var activatedChildren = [];
  7099. var has = {};
  7100. var circular = {};
  7101. var waiting = false;
  7102. var flushing = false;
  7103. var index = 0;
  7104. /**
  7105. * Reset the scheduler's state.
  7106. */
  7107. function resetSchedulerState () {
  7108. index = queue.length = activatedChildren.length = 0;
  7109. has = {};
  7110. if (true) {
  7111. circular = {};
  7112. }
  7113. waiting = flushing = false;
  7114. }
  7115. // Async edge case #6566 requires saving the timestamp when event listeners are
  7116. // attached. However, calling performance.now() has a perf overhead especially
  7117. // if the page has thousands of event listeners. Instead, we take a timestamp
  7118. // every time the scheduler flushes and use that for all event listeners
  7119. // attached during that flush.
  7120. var currentFlushTimestamp = 0;
  7121. // Async edge case fix requires storing an event listener's attach timestamp.
  7122. var getNow = Date.now;
  7123. // Determine what event timestamp the browser is using. Annoyingly, the
  7124. // timestamp can either be hi-res (relative to page load) or low-res
  7125. // (relative to UNIX epoch), so in order to compare time we have to use the
  7126. // same timestamp type when saving the flush timestamp.
  7127. // All IE versions use low-res event timestamps, and have problematic clock
  7128. // implementations (#9632)
  7129. if (inBrowser && !isIE) {
  7130. var performance = window.performance;
  7131. if (
  7132. performance &&
  7133. typeof performance.now === 'function' &&
  7134. getNow() > document.createEvent('Event').timeStamp
  7135. ) {
  7136. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7137. // smaller than it, it means the event is using a hi-res timestamp,
  7138. // and we need to use the hi-res version for event listener timestamps as
  7139. // well.
  7140. getNow = function () { return performance.now(); };
  7141. }
  7142. }
  7143. /**
  7144. * Flush both queues and run the watchers.
  7145. */
  7146. function flushSchedulerQueue () {
  7147. currentFlushTimestamp = getNow();
  7148. flushing = true;
  7149. var watcher, id;
  7150. // Sort queue before flush.
  7151. // This ensures that:
  7152. // 1. Components are updated from parent to child. (because parent is always
  7153. // created before the child)
  7154. // 2. A component's user watchers are run before its render watcher (because
  7155. // user watchers are created before the render watcher)
  7156. // 3. If a component is destroyed during a parent component's watcher run,
  7157. // its watchers can be skipped.
  7158. queue.sort(function (a, b) { return a.id - b.id; });
  7159. // do not cache length because more watchers might be pushed
  7160. // as we run existing watchers
  7161. for (index = 0; index < queue.length; index++) {
  7162. watcher = queue[index];
  7163. if (watcher.before) {
  7164. watcher.before();
  7165. }
  7166. id = watcher.id;
  7167. has[id] = null;
  7168. watcher.run();
  7169. // in dev build, check and stop circular updates.
  7170. if ( true && has[id] != null) {
  7171. circular[id] = (circular[id] || 0) + 1;
  7172. if (circular[id] > MAX_UPDATE_COUNT) {
  7173. warn(
  7174. 'You may have an infinite update loop ' + (
  7175. watcher.user
  7176. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  7177. : "in a component render function."
  7178. ),
  7179. watcher.vm
  7180. );
  7181. break
  7182. }
  7183. }
  7184. }
  7185. // keep copies of post queues before resetting state
  7186. var activatedQueue = activatedChildren.slice();
  7187. var updatedQueue = queue.slice();
  7188. resetSchedulerState();
  7189. // call component updated and activated hooks
  7190. callActivatedHooks(activatedQueue);
  7191. callUpdatedHooks(updatedQueue);
  7192. // devtool hook
  7193. /* istanbul ignore if */
  7194. if (devtools && config.devtools) {
  7195. devtools.emit('flush');
  7196. }
  7197. }
  7198. function callUpdatedHooks (queue) {
  7199. var i = queue.length;
  7200. while (i--) {
  7201. var watcher = queue[i];
  7202. var vm = watcher.vm;
  7203. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  7204. callHook(vm, 'updated');
  7205. }
  7206. }
  7207. }
  7208. /**
  7209. * Queue a kept-alive component that was activated during patch.
  7210. * The queue will be processed after the entire tree has been patched.
  7211. */
  7212. function queueActivatedComponent (vm) {
  7213. // setting _inactive to false here so that a render function can
  7214. // rely on checking whether it's in an inactive tree (e.g. router-view)
  7215. vm._inactive = false;
  7216. activatedChildren.push(vm);
  7217. }
  7218. function callActivatedHooks (queue) {
  7219. for (var i = 0; i < queue.length; i++) {
  7220. queue[i]._inactive = true;
  7221. activateChildComponent(queue[i], true /* true */);
  7222. }
  7223. }
  7224. /**
  7225. * Push a watcher into the watcher queue.
  7226. * Jobs with duplicate IDs will be skipped unless it's
  7227. * pushed when the queue is being flushed.
  7228. */
  7229. function queueWatcher (watcher) {
  7230. var id = watcher.id;
  7231. if (has[id] == null) {
  7232. has[id] = true;
  7233. if (!flushing) {
  7234. queue.push(watcher);
  7235. } else {
  7236. // if already flushing, splice the watcher based on its id
  7237. // if already past its id, it will be run next immediately.
  7238. var i = queue.length - 1;
  7239. while (i > index && queue[i].id > watcher.id) {
  7240. i--;
  7241. }
  7242. queue.splice(i + 1, 0, watcher);
  7243. }
  7244. // queue the flush
  7245. if (!waiting) {
  7246. waiting = true;
  7247. if ( true && !config.async) {
  7248. flushSchedulerQueue();
  7249. return
  7250. }
  7251. nextTick(flushSchedulerQueue);
  7252. }
  7253. }
  7254. }
  7255. /* */
  7256. var uid$2 = 0;
  7257. /**
  7258. * A watcher parses an expression, collects dependencies,
  7259. * and fires callback when the expression value changes.
  7260. * This is used for both the $watch() api and directives.
  7261. */
  7262. var Watcher = function Watcher (
  7263. vm,
  7264. expOrFn,
  7265. cb,
  7266. options,
  7267. isRenderWatcher
  7268. ) {
  7269. this.vm = vm;
  7270. if (isRenderWatcher) {
  7271. vm._watcher = this;
  7272. }
  7273. vm._watchers.push(this);
  7274. // options
  7275. if (options) {
  7276. this.deep = !!options.deep;
  7277. this.user = !!options.user;
  7278. this.lazy = !!options.lazy;
  7279. this.sync = !!options.sync;
  7280. this.before = options.before;
  7281. } else {
  7282. this.deep = this.user = this.lazy = this.sync = false;
  7283. }
  7284. this.cb = cb;
  7285. this.id = ++uid$2; // uid for batching
  7286. this.active = true;
  7287. this.dirty = this.lazy; // for lazy watchers
  7288. this.deps = [];
  7289. this.newDeps = [];
  7290. this.depIds = new _Set();
  7291. this.newDepIds = new _Set();
  7292. this.expression = true
  7293. ? expOrFn.toString()
  7294. : undefined;
  7295. // parse expression for getter
  7296. if (typeof expOrFn === 'function') {
  7297. this.getter = expOrFn;
  7298. } else {
  7299. this.getter = parsePath(expOrFn);
  7300. if (!this.getter) {
  7301. this.getter = noop;
  7302. true && warn(
  7303. "Failed watching path: \"" + expOrFn + "\" " +
  7304. 'Watcher only accepts simple dot-delimited paths. ' +
  7305. 'For full control, use a function instead.',
  7306. vm
  7307. );
  7308. }
  7309. }
  7310. this.value = this.lazy
  7311. ? undefined
  7312. : this.get();
  7313. };
  7314. /**
  7315. * Evaluate the getter, and re-collect dependencies.
  7316. */
  7317. Watcher.prototype.get = function get () {
  7318. pushTarget(this);
  7319. var value;
  7320. var vm = this.vm;
  7321. try {
  7322. value = this.getter.call(vm, vm);
  7323. } catch (e) {
  7324. if (this.user) {
  7325. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  7326. } else {
  7327. throw e
  7328. }
  7329. } finally {
  7330. // "touch" every property so they are all tracked as
  7331. // dependencies for deep watching
  7332. if (this.deep) {
  7333. traverse(value);
  7334. }
  7335. popTarget();
  7336. this.cleanupDeps();
  7337. }
  7338. return value
  7339. };
  7340. /**
  7341. * Add a dependency to this directive.
  7342. */
  7343. Watcher.prototype.addDep = function addDep (dep) {
  7344. var id = dep.id;
  7345. if (!this.newDepIds.has(id)) {
  7346. this.newDepIds.add(id);
  7347. this.newDeps.push(dep);
  7348. if (!this.depIds.has(id)) {
  7349. dep.addSub(this);
  7350. }
  7351. }
  7352. };
  7353. /**
  7354. * Clean up for dependency collection.
  7355. */
  7356. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  7357. var i = this.deps.length;
  7358. while (i--) {
  7359. var dep = this.deps[i];
  7360. if (!this.newDepIds.has(dep.id)) {
  7361. dep.removeSub(this);
  7362. }
  7363. }
  7364. var tmp = this.depIds;
  7365. this.depIds = this.newDepIds;
  7366. this.newDepIds = tmp;
  7367. this.newDepIds.clear();
  7368. tmp = this.deps;
  7369. this.deps = this.newDeps;
  7370. this.newDeps = tmp;
  7371. this.newDeps.length = 0;
  7372. };
  7373. /**
  7374. * Subscriber interface.
  7375. * Will be called when a dependency changes.
  7376. */
  7377. Watcher.prototype.update = function update () {
  7378. /* istanbul ignore else */
  7379. if (this.lazy) {
  7380. this.dirty = true;
  7381. } else if (this.sync) {
  7382. this.run();
  7383. } else {
  7384. queueWatcher(this);
  7385. }
  7386. };
  7387. /**
  7388. * Scheduler job interface.
  7389. * Will be called by the scheduler.
  7390. */
  7391. Watcher.prototype.run = function run () {
  7392. if (this.active) {
  7393. var value = this.get();
  7394. if (
  7395. value !== this.value ||
  7396. // Deep watchers and watchers on Object/Arrays should fire even
  7397. // when the value is the same, because the value may
  7398. // have mutated.
  7399. isObject(value) ||
  7400. this.deep
  7401. ) {
  7402. // set new value
  7403. var oldValue = this.value;
  7404. this.value = value;
  7405. if (this.user) {
  7406. try {
  7407. this.cb.call(this.vm, value, oldValue);
  7408. } catch (e) {
  7409. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  7410. }
  7411. } else {
  7412. this.cb.call(this.vm, value, oldValue);
  7413. }
  7414. }
  7415. }
  7416. };
  7417. /**
  7418. * Evaluate the value of the watcher.
  7419. * This only gets called for lazy watchers.
  7420. */
  7421. Watcher.prototype.evaluate = function evaluate () {
  7422. this.value = this.get();
  7423. this.dirty = false;
  7424. };
  7425. /**
  7426. * Depend on all deps collected by this watcher.
  7427. */
  7428. Watcher.prototype.depend = function depend () {
  7429. var i = this.deps.length;
  7430. while (i--) {
  7431. this.deps[i].depend();
  7432. }
  7433. };
  7434. /**
  7435. * Remove self from all dependencies' subscriber list.
  7436. */
  7437. Watcher.prototype.teardown = function teardown () {
  7438. if (this.active) {
  7439. // remove self from vm's watcher list
  7440. // this is a somewhat expensive operation so we skip it
  7441. // if the vm is being destroyed.
  7442. if (!this.vm._isBeingDestroyed) {
  7443. remove(this.vm._watchers, this);
  7444. }
  7445. var i = this.deps.length;
  7446. while (i--) {
  7447. this.deps[i].removeSub(this);
  7448. }
  7449. this.active = false;
  7450. }
  7451. };
  7452. /* */
  7453. var sharedPropertyDefinition = {
  7454. enumerable: true,
  7455. configurable: true,
  7456. get: noop,
  7457. set: noop
  7458. };
  7459. function proxy (target, sourceKey, key) {
  7460. sharedPropertyDefinition.get = function proxyGetter () {
  7461. return this[sourceKey][key]
  7462. };
  7463. sharedPropertyDefinition.set = function proxySetter (val) {
  7464. this[sourceKey][key] = val;
  7465. };
  7466. Object.defineProperty(target, key, sharedPropertyDefinition);
  7467. }
  7468. function initState (vm) {
  7469. vm._watchers = [];
  7470. var opts = vm.$options;
  7471. if (opts.props) { initProps(vm, opts.props); }
  7472. if (opts.methods) { initMethods(vm, opts.methods); }
  7473. if (opts.data) {
  7474. initData(vm);
  7475. } else {
  7476. observe(vm._data = {}, true /* asRootData */);
  7477. }
  7478. if (opts.computed) { initComputed(vm, opts.computed); }
  7479. if (opts.watch && opts.watch !== nativeWatch) {
  7480. initWatch(vm, opts.watch);
  7481. }
  7482. }
  7483. function initProps (vm, propsOptions) {
  7484. var propsData = vm.$options.propsData || {};
  7485. var props = vm._props = {};
  7486. // cache prop keys so that future props updates can iterate using Array
  7487. // instead of dynamic object key enumeration.
  7488. var keys = vm.$options._propKeys = [];
  7489. var isRoot = !vm.$parent;
  7490. // root instance props should be converted
  7491. if (!isRoot) {
  7492. toggleObserving(false);
  7493. }
  7494. var loop = function ( key ) {
  7495. keys.push(key);
  7496. var value = validateProp(key, propsOptions, propsData, vm);
  7497. /* istanbul ignore else */
  7498. if (true) {
  7499. var hyphenatedKey = hyphenate(key);
  7500. if (isReservedAttribute(hyphenatedKey) ||
  7501. config.isReservedAttr(hyphenatedKey)) {
  7502. warn(
  7503. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  7504. vm
  7505. );
  7506. }
  7507. defineReactive$$1(props, key, value, function () {
  7508. if (!isRoot && !isUpdatingChildComponent) {
  7509. {
  7510. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  7511. return
  7512. }
  7513. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  7514. if(
  7515. key === 'value' &&
  7516. Array.isArray(vm.$options.behaviors) &&
  7517. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  7518. ){
  7519. return
  7520. }
  7521. if(vm._getFormData){
  7522. return
  7523. }
  7524. var $parent = vm.$parent;
  7525. while($parent){
  7526. if($parent.__next_tick_pending){
  7527. return
  7528. }
  7529. $parent = $parent.$parent;
  7530. }
  7531. }
  7532. warn(
  7533. "Avoid mutating a prop directly since the value will be " +
  7534. "overwritten whenever the parent component re-renders. " +
  7535. "Instead, use a data or computed property based on the prop's " +
  7536. "value. Prop being mutated: \"" + key + "\"",
  7537. vm
  7538. );
  7539. }
  7540. });
  7541. } else {}
  7542. // static props are already proxied on the component's prototype
  7543. // during Vue.extend(). We only need to proxy props defined at
  7544. // instantiation here.
  7545. if (!(key in vm)) {
  7546. proxy(vm, "_props", key);
  7547. }
  7548. };
  7549. for (var key in propsOptions) loop( key );
  7550. toggleObserving(true);
  7551. }
  7552. function initData (vm) {
  7553. var data = vm.$options.data;
  7554. data = vm._data = typeof data === 'function'
  7555. ? getData(data, vm)
  7556. : data || {};
  7557. if (!isPlainObject(data)) {
  7558. data = {};
  7559. true && warn(
  7560. 'data functions should return an object:\n' +
  7561. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  7562. vm
  7563. );
  7564. }
  7565. // proxy data on instance
  7566. var keys = Object.keys(data);
  7567. var props = vm.$options.props;
  7568. var methods = vm.$options.methods;
  7569. var i = keys.length;
  7570. while (i--) {
  7571. var key = keys[i];
  7572. if (true) {
  7573. if (methods && hasOwn(methods, key)) {
  7574. warn(
  7575. ("Method \"" + key + "\" has already been defined as a data property."),
  7576. vm
  7577. );
  7578. }
  7579. }
  7580. if (props && hasOwn(props, key)) {
  7581. true && warn(
  7582. "The data property \"" + key + "\" is already declared as a prop. " +
  7583. "Use prop default value instead.",
  7584. vm
  7585. );
  7586. } else if (!isReserved(key)) {
  7587. proxy(vm, "_data", key);
  7588. }
  7589. }
  7590. // observe data
  7591. observe(data, true /* asRootData */);
  7592. }
  7593. function getData (data, vm) {
  7594. // #7573 disable dep collection when invoking data getters
  7595. pushTarget();
  7596. try {
  7597. return data.call(vm, vm)
  7598. } catch (e) {
  7599. handleError(e, vm, "data()");
  7600. return {}
  7601. } finally {
  7602. popTarget();
  7603. }
  7604. }
  7605. var computedWatcherOptions = { lazy: true };
  7606. function initComputed (vm, computed) {
  7607. // $flow-disable-line
  7608. var watchers = vm._computedWatchers = Object.create(null);
  7609. // computed properties are just getters during SSR
  7610. var isSSR = isServerRendering();
  7611. for (var key in computed) {
  7612. var userDef = computed[key];
  7613. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  7614. if ( true && getter == null) {
  7615. warn(
  7616. ("Getter is missing for computed property \"" + key + "\"."),
  7617. vm
  7618. );
  7619. }
  7620. if (!isSSR) {
  7621. // create internal watcher for the computed property.
  7622. watchers[key] = new Watcher(
  7623. vm,
  7624. getter || noop,
  7625. noop,
  7626. computedWatcherOptions
  7627. );
  7628. }
  7629. // component-defined computed properties are already defined on the
  7630. // component prototype. We only need to define computed properties defined
  7631. // at instantiation here.
  7632. if (!(key in vm)) {
  7633. defineComputed(vm, key, userDef);
  7634. } else if (true) {
  7635. if (key in vm.$data) {
  7636. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  7637. } else if (vm.$options.props && key in vm.$options.props) {
  7638. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  7639. }
  7640. }
  7641. }
  7642. }
  7643. function defineComputed (
  7644. target,
  7645. key,
  7646. userDef
  7647. ) {
  7648. var shouldCache = !isServerRendering();
  7649. if (typeof userDef === 'function') {
  7650. sharedPropertyDefinition.get = shouldCache
  7651. ? createComputedGetter(key)
  7652. : createGetterInvoker(userDef);
  7653. sharedPropertyDefinition.set = noop;
  7654. } else {
  7655. sharedPropertyDefinition.get = userDef.get
  7656. ? shouldCache && userDef.cache !== false
  7657. ? createComputedGetter(key)
  7658. : createGetterInvoker(userDef.get)
  7659. : noop;
  7660. sharedPropertyDefinition.set = userDef.set || noop;
  7661. }
  7662. if ( true &&
  7663. sharedPropertyDefinition.set === noop) {
  7664. sharedPropertyDefinition.set = function () {
  7665. warn(
  7666. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  7667. this
  7668. );
  7669. };
  7670. }
  7671. Object.defineProperty(target, key, sharedPropertyDefinition);
  7672. }
  7673. function createComputedGetter (key) {
  7674. return function computedGetter () {
  7675. var watcher = this._computedWatchers && this._computedWatchers[key];
  7676. if (watcher) {
  7677. if (watcher.dirty) {
  7678. watcher.evaluate();
  7679. }
  7680. if (Dep.SharedObject.target) {// fixed by xxxxxx
  7681. watcher.depend();
  7682. }
  7683. return watcher.value
  7684. }
  7685. }
  7686. }
  7687. function createGetterInvoker(fn) {
  7688. return function computedGetter () {
  7689. return fn.call(this, this)
  7690. }
  7691. }
  7692. function initMethods (vm, methods) {
  7693. var props = vm.$options.props;
  7694. for (var key in methods) {
  7695. if (true) {
  7696. if (typeof methods[key] !== 'function') {
  7697. warn(
  7698. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  7699. "Did you reference the function correctly?",
  7700. vm
  7701. );
  7702. }
  7703. if (props && hasOwn(props, key)) {
  7704. warn(
  7705. ("Method \"" + key + "\" has already been defined as a prop."),
  7706. vm
  7707. );
  7708. }
  7709. if ((key in vm) && isReserved(key)) {
  7710. warn(
  7711. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  7712. "Avoid defining component methods that start with _ or $."
  7713. );
  7714. }
  7715. }
  7716. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  7717. }
  7718. }
  7719. function initWatch (vm, watch) {
  7720. for (var key in watch) {
  7721. var handler = watch[key];
  7722. if (Array.isArray(handler)) {
  7723. for (var i = 0; i < handler.length; i++) {
  7724. createWatcher(vm, key, handler[i]);
  7725. }
  7726. } else {
  7727. createWatcher(vm, key, handler);
  7728. }
  7729. }
  7730. }
  7731. function createWatcher (
  7732. vm,
  7733. expOrFn,
  7734. handler,
  7735. options
  7736. ) {
  7737. if (isPlainObject(handler)) {
  7738. options = handler;
  7739. handler = handler.handler;
  7740. }
  7741. if (typeof handler === 'string') {
  7742. handler = vm[handler];
  7743. }
  7744. return vm.$watch(expOrFn, handler, options)
  7745. }
  7746. function stateMixin (Vue) {
  7747. // flow somehow has problems with directly declared definition object
  7748. // when using Object.defineProperty, so we have to procedurally build up
  7749. // the object here.
  7750. var dataDef = {};
  7751. dataDef.get = function () { return this._data };
  7752. var propsDef = {};
  7753. propsDef.get = function () { return this._props };
  7754. if (true) {
  7755. dataDef.set = function () {
  7756. warn(
  7757. 'Avoid replacing instance root $data. ' +
  7758. 'Use nested data properties instead.',
  7759. this
  7760. );
  7761. };
  7762. propsDef.set = function () {
  7763. warn("$props is readonly.", this);
  7764. };
  7765. }
  7766. Object.defineProperty(Vue.prototype, '$data', dataDef);
  7767. Object.defineProperty(Vue.prototype, '$props', propsDef);
  7768. Vue.prototype.$set = set;
  7769. Vue.prototype.$delete = del;
  7770. Vue.prototype.$watch = function (
  7771. expOrFn,
  7772. cb,
  7773. options
  7774. ) {
  7775. var vm = this;
  7776. if (isPlainObject(cb)) {
  7777. return createWatcher(vm, expOrFn, cb, options)
  7778. }
  7779. options = options || {};
  7780. options.user = true;
  7781. var watcher = new Watcher(vm, expOrFn, cb, options);
  7782. if (options.immediate) {
  7783. try {
  7784. cb.call(vm, watcher.value);
  7785. } catch (error) {
  7786. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  7787. }
  7788. }
  7789. return function unwatchFn () {
  7790. watcher.teardown();
  7791. }
  7792. };
  7793. }
  7794. /* */
  7795. var uid$3 = 0;
  7796. function initMixin (Vue) {
  7797. Vue.prototype._init = function (options) {
  7798. var vm = this;
  7799. // a uid
  7800. vm._uid = uid$3++;
  7801. var startTag, endTag;
  7802. /* istanbul ignore if */
  7803. if ( true && config.performance && mark) {
  7804. startTag = "vue-perf-start:" + (vm._uid);
  7805. endTag = "vue-perf-end:" + (vm._uid);
  7806. mark(startTag);
  7807. }
  7808. // a flag to avoid this being observed
  7809. vm._isVue = true;
  7810. // merge options
  7811. if (options && options._isComponent) {
  7812. // optimize internal component instantiation
  7813. // since dynamic options merging is pretty slow, and none of the
  7814. // internal component options needs special treatment.
  7815. initInternalComponent(vm, options);
  7816. } else {
  7817. vm.$options = mergeOptions(
  7818. resolveConstructorOptions(vm.constructor),
  7819. options || {},
  7820. vm
  7821. );
  7822. }
  7823. /* istanbul ignore else */
  7824. if (true) {
  7825. initProxy(vm);
  7826. } else {}
  7827. // expose real self
  7828. vm._self = vm;
  7829. initLifecycle(vm);
  7830. initEvents(vm);
  7831. initRender(vm);
  7832. callHook(vm, 'beforeCreate');
  7833. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  7834. initState(vm);
  7835. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  7836. !vm._$fallback && callHook(vm, 'created');
  7837. /* istanbul ignore if */
  7838. if ( true && config.performance && mark) {
  7839. vm._name = formatComponentName(vm, false);
  7840. mark(endTag);
  7841. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  7842. }
  7843. if (vm.$options.el) {
  7844. vm.$mount(vm.$options.el);
  7845. }
  7846. };
  7847. }
  7848. function initInternalComponent (vm, options) {
  7849. var opts = vm.$options = Object.create(vm.constructor.options);
  7850. // doing this because it's faster than dynamic enumeration.
  7851. var parentVnode = options._parentVnode;
  7852. opts.parent = options.parent;
  7853. opts._parentVnode = parentVnode;
  7854. var vnodeComponentOptions = parentVnode.componentOptions;
  7855. opts.propsData = vnodeComponentOptions.propsData;
  7856. opts._parentListeners = vnodeComponentOptions.listeners;
  7857. opts._renderChildren = vnodeComponentOptions.children;
  7858. opts._componentTag = vnodeComponentOptions.tag;
  7859. if (options.render) {
  7860. opts.render = options.render;
  7861. opts.staticRenderFns = options.staticRenderFns;
  7862. }
  7863. }
  7864. function resolveConstructorOptions (Ctor) {
  7865. var options = Ctor.options;
  7866. if (Ctor.super) {
  7867. var superOptions = resolveConstructorOptions(Ctor.super);
  7868. var cachedSuperOptions = Ctor.superOptions;
  7869. if (superOptions !== cachedSuperOptions) {
  7870. // super option changed,
  7871. // need to resolve new options.
  7872. Ctor.superOptions = superOptions;
  7873. // check if there are any late-modified/attached options (#4976)
  7874. var modifiedOptions = resolveModifiedOptions(Ctor);
  7875. // update base extend options
  7876. if (modifiedOptions) {
  7877. extend(Ctor.extendOptions, modifiedOptions);
  7878. }
  7879. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  7880. if (options.name) {
  7881. options.components[options.name] = Ctor;
  7882. }
  7883. }
  7884. }
  7885. return options
  7886. }
  7887. function resolveModifiedOptions (Ctor) {
  7888. var modified;
  7889. var latest = Ctor.options;
  7890. var sealed = Ctor.sealedOptions;
  7891. for (var key in latest) {
  7892. if (latest[key] !== sealed[key]) {
  7893. if (!modified) { modified = {}; }
  7894. modified[key] = latest[key];
  7895. }
  7896. }
  7897. return modified
  7898. }
  7899. function Vue (options) {
  7900. if ( true &&
  7901. !(this instanceof Vue)
  7902. ) {
  7903. warn('Vue is a constructor and should be called with the `new` keyword');
  7904. }
  7905. this._init(options);
  7906. }
  7907. initMixin(Vue);
  7908. stateMixin(Vue);
  7909. eventsMixin(Vue);
  7910. lifecycleMixin(Vue);
  7911. renderMixin(Vue);
  7912. /* */
  7913. function initUse (Vue) {
  7914. Vue.use = function (plugin) {
  7915. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  7916. if (installedPlugins.indexOf(plugin) > -1) {
  7917. return this
  7918. }
  7919. // additional parameters
  7920. var args = toArray(arguments, 1);
  7921. args.unshift(this);
  7922. if (typeof plugin.install === 'function') {
  7923. plugin.install.apply(plugin, args);
  7924. } else if (typeof plugin === 'function') {
  7925. plugin.apply(null, args);
  7926. }
  7927. installedPlugins.push(plugin);
  7928. return this
  7929. };
  7930. }
  7931. /* */
  7932. function initMixin$1 (Vue) {
  7933. Vue.mixin = function (mixin) {
  7934. this.options = mergeOptions(this.options, mixin);
  7935. return this
  7936. };
  7937. }
  7938. /* */
  7939. function initExtend (Vue) {
  7940. /**
  7941. * Each instance constructor, including Vue, has a unique
  7942. * cid. This enables us to create wrapped "child
  7943. * constructors" for prototypal inheritance and cache them.
  7944. */
  7945. Vue.cid = 0;
  7946. var cid = 1;
  7947. /**
  7948. * Class inheritance
  7949. */
  7950. Vue.extend = function (extendOptions) {
  7951. extendOptions = extendOptions || {};
  7952. var Super = this;
  7953. var SuperId = Super.cid;
  7954. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  7955. if (cachedCtors[SuperId]) {
  7956. return cachedCtors[SuperId]
  7957. }
  7958. var name = extendOptions.name || Super.options.name;
  7959. if ( true && name) {
  7960. validateComponentName(name);
  7961. }
  7962. var Sub = function VueComponent (options) {
  7963. this._init(options);
  7964. };
  7965. Sub.prototype = Object.create(Super.prototype);
  7966. Sub.prototype.constructor = Sub;
  7967. Sub.cid = cid++;
  7968. Sub.options = mergeOptions(
  7969. Super.options,
  7970. extendOptions
  7971. );
  7972. Sub['super'] = Super;
  7973. // For props and computed properties, we define the proxy getters on
  7974. // the Vue instances at extension time, on the extended prototype. This
  7975. // avoids Object.defineProperty calls for each instance created.
  7976. if (Sub.options.props) {
  7977. initProps$1(Sub);
  7978. }
  7979. if (Sub.options.computed) {
  7980. initComputed$1(Sub);
  7981. }
  7982. // allow further extension/mixin/plugin usage
  7983. Sub.extend = Super.extend;
  7984. Sub.mixin = Super.mixin;
  7985. Sub.use = Super.use;
  7986. // create asset registers, so extended classes
  7987. // can have their private assets too.
  7988. ASSET_TYPES.forEach(function (type) {
  7989. Sub[type] = Super[type];
  7990. });
  7991. // enable recursive self-lookup
  7992. if (name) {
  7993. Sub.options.components[name] = Sub;
  7994. }
  7995. // keep a reference to the super options at extension time.
  7996. // later at instantiation we can check if Super's options have
  7997. // been updated.
  7998. Sub.superOptions = Super.options;
  7999. Sub.extendOptions = extendOptions;
  8000. Sub.sealedOptions = extend({}, Sub.options);
  8001. // cache constructor
  8002. cachedCtors[SuperId] = Sub;
  8003. return Sub
  8004. };
  8005. }
  8006. function initProps$1 (Comp) {
  8007. var props = Comp.options.props;
  8008. for (var key in props) {
  8009. proxy(Comp.prototype, "_props", key);
  8010. }
  8011. }
  8012. function initComputed$1 (Comp) {
  8013. var computed = Comp.options.computed;
  8014. for (var key in computed) {
  8015. defineComputed(Comp.prototype, key, computed[key]);
  8016. }
  8017. }
  8018. /* */
  8019. function initAssetRegisters (Vue) {
  8020. /**
  8021. * Create asset registration methods.
  8022. */
  8023. ASSET_TYPES.forEach(function (type) {
  8024. Vue[type] = function (
  8025. id,
  8026. definition
  8027. ) {
  8028. if (!definition) {
  8029. return this.options[type + 's'][id]
  8030. } else {
  8031. /* istanbul ignore if */
  8032. if ( true && type === 'component') {
  8033. validateComponentName(id);
  8034. }
  8035. if (type === 'component' && isPlainObject(definition)) {
  8036. definition.name = definition.name || id;
  8037. definition = this.options._base.extend(definition);
  8038. }
  8039. if (type === 'directive' && typeof definition === 'function') {
  8040. definition = { bind: definition, update: definition };
  8041. }
  8042. this.options[type + 's'][id] = definition;
  8043. return definition
  8044. }
  8045. };
  8046. });
  8047. }
  8048. /* */
  8049. function getComponentName (opts) {
  8050. return opts && (opts.Ctor.options.name || opts.tag)
  8051. }
  8052. function matches (pattern, name) {
  8053. if (Array.isArray(pattern)) {
  8054. return pattern.indexOf(name) > -1
  8055. } else if (typeof pattern === 'string') {
  8056. return pattern.split(',').indexOf(name) > -1
  8057. } else if (isRegExp(pattern)) {
  8058. return pattern.test(name)
  8059. }
  8060. /* istanbul ignore next */
  8061. return false
  8062. }
  8063. function pruneCache (keepAliveInstance, filter) {
  8064. var cache = keepAliveInstance.cache;
  8065. var keys = keepAliveInstance.keys;
  8066. var _vnode = keepAliveInstance._vnode;
  8067. for (var key in cache) {
  8068. var cachedNode = cache[key];
  8069. if (cachedNode) {
  8070. var name = getComponentName(cachedNode.componentOptions);
  8071. if (name && !filter(name)) {
  8072. pruneCacheEntry(cache, key, keys, _vnode);
  8073. }
  8074. }
  8075. }
  8076. }
  8077. function pruneCacheEntry (
  8078. cache,
  8079. key,
  8080. keys,
  8081. current
  8082. ) {
  8083. var cached$$1 = cache[key];
  8084. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8085. cached$$1.componentInstance.$destroy();
  8086. }
  8087. cache[key] = null;
  8088. remove(keys, key);
  8089. }
  8090. var patternTypes = [String, RegExp, Array];
  8091. var KeepAlive = {
  8092. name: 'keep-alive',
  8093. abstract: true,
  8094. props: {
  8095. include: patternTypes,
  8096. exclude: patternTypes,
  8097. max: [String, Number]
  8098. },
  8099. created: function created () {
  8100. this.cache = Object.create(null);
  8101. this.keys = [];
  8102. },
  8103. destroyed: function destroyed () {
  8104. for (var key in this.cache) {
  8105. pruneCacheEntry(this.cache, key, this.keys);
  8106. }
  8107. },
  8108. mounted: function mounted () {
  8109. var this$1 = this;
  8110. this.$watch('include', function (val) {
  8111. pruneCache(this$1, function (name) { return matches(val, name); });
  8112. });
  8113. this.$watch('exclude', function (val) {
  8114. pruneCache(this$1, function (name) { return !matches(val, name); });
  8115. });
  8116. },
  8117. render: function render () {
  8118. var slot = this.$slots.default;
  8119. var vnode = getFirstComponentChild(slot);
  8120. var componentOptions = vnode && vnode.componentOptions;
  8121. if (componentOptions) {
  8122. // check pattern
  8123. var name = getComponentName(componentOptions);
  8124. var ref = this;
  8125. var include = ref.include;
  8126. var exclude = ref.exclude;
  8127. if (
  8128. // not included
  8129. (include && (!name || !matches(include, name))) ||
  8130. // excluded
  8131. (exclude && name && matches(exclude, name))
  8132. ) {
  8133. return vnode
  8134. }
  8135. var ref$1 = this;
  8136. var cache = ref$1.cache;
  8137. var keys = ref$1.keys;
  8138. var key = vnode.key == null
  8139. // same constructor may get registered as different local components
  8140. // so cid alone is not enough (#3269)
  8141. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8142. : vnode.key;
  8143. if (cache[key]) {
  8144. vnode.componentInstance = cache[key].componentInstance;
  8145. // make current key freshest
  8146. remove(keys, key);
  8147. keys.push(key);
  8148. } else {
  8149. cache[key] = vnode;
  8150. keys.push(key);
  8151. // prune oldest entry
  8152. if (this.max && keys.length > parseInt(this.max)) {
  8153. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8154. }
  8155. }
  8156. vnode.data.keepAlive = true;
  8157. }
  8158. return vnode || (slot && slot[0])
  8159. }
  8160. };
  8161. var builtInComponents = {
  8162. KeepAlive: KeepAlive
  8163. };
  8164. /* */
  8165. function initGlobalAPI (Vue) {
  8166. // config
  8167. var configDef = {};
  8168. configDef.get = function () { return config; };
  8169. if (true) {
  8170. configDef.set = function () {
  8171. warn(
  8172. 'Do not replace the Vue.config object, set individual fields instead.'
  8173. );
  8174. };
  8175. }
  8176. Object.defineProperty(Vue, 'config', configDef);
  8177. // exposed util methods.
  8178. // NOTE: these are not considered part of the public API - avoid relying on
  8179. // them unless you are aware of the risk.
  8180. Vue.util = {
  8181. warn: warn,
  8182. extend: extend,
  8183. mergeOptions: mergeOptions,
  8184. defineReactive: defineReactive$$1
  8185. };
  8186. Vue.set = set;
  8187. Vue.delete = del;
  8188. Vue.nextTick = nextTick;
  8189. // 2.6 explicit observable API
  8190. Vue.observable = function (obj) {
  8191. observe(obj);
  8192. return obj
  8193. };
  8194. Vue.options = Object.create(null);
  8195. ASSET_TYPES.forEach(function (type) {
  8196. Vue.options[type + 's'] = Object.create(null);
  8197. });
  8198. // this is used to identify the "base" constructor to extend all plain-object
  8199. // components with in Weex's multi-instance scenarios.
  8200. Vue.options._base = Vue;
  8201. extend(Vue.options.components, builtInComponents);
  8202. initUse(Vue);
  8203. initMixin$1(Vue);
  8204. initExtend(Vue);
  8205. initAssetRegisters(Vue);
  8206. }
  8207. initGlobalAPI(Vue);
  8208. Object.defineProperty(Vue.prototype, '$isServer', {
  8209. get: isServerRendering
  8210. });
  8211. Object.defineProperty(Vue.prototype, '$ssrContext', {
  8212. get: function get () {
  8213. /* istanbul ignore next */
  8214. return this.$vnode && this.$vnode.ssrContext
  8215. }
  8216. });
  8217. // expose FunctionalRenderContext for ssr runtime helper installation
  8218. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  8219. value: FunctionalRenderContext
  8220. });
  8221. Vue.version = '2.6.11';
  8222. /**
  8223. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  8224. */
  8225. var ARRAYTYPE = '[object Array]';
  8226. var OBJECTTYPE = '[object Object]';
  8227. var NULLTYPE = '[object Null]';
  8228. var UNDEFINEDTYPE = '[object Undefined]';
  8229. // const FUNCTIONTYPE = '[object Function]'
  8230. function diff(current, pre) {
  8231. var result = {};
  8232. syncKeys(current, pre);
  8233. _diff(current, pre, '', result);
  8234. return result
  8235. }
  8236. function syncKeys(current, pre) {
  8237. if (current === pre) { return }
  8238. var rootCurrentType = type(current);
  8239. var rootPreType = type(pre);
  8240. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  8241. if(Object.keys(current).length >= Object.keys(pre).length){
  8242. for (var key in pre) {
  8243. var currentValue = current[key];
  8244. if (currentValue === undefined) {
  8245. current[key] = null;
  8246. } else {
  8247. syncKeys(currentValue, pre[key]);
  8248. }
  8249. }
  8250. }
  8251. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  8252. if (current.length >= pre.length) {
  8253. pre.forEach(function (item, index) {
  8254. syncKeys(current[index], item);
  8255. });
  8256. }
  8257. }
  8258. }
  8259. function nullOrUndefined(currentType, preType) {
  8260. if(
  8261. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  8262. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  8263. ) {
  8264. return false
  8265. }
  8266. return true
  8267. }
  8268. function _diff(current, pre, path, result) {
  8269. if (current === pre) { return }
  8270. var rootCurrentType = type(current);
  8271. var rootPreType = type(pre);
  8272. if (rootCurrentType == OBJECTTYPE) {
  8273. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  8274. setResult(result, path, current);
  8275. } else {
  8276. var loop = function ( key ) {
  8277. var currentValue = current[key];
  8278. var preValue = pre[key];
  8279. var currentType = type(currentValue);
  8280. var preType = type(preValue);
  8281. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  8282. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  8283. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8284. }
  8285. } else if (currentType == ARRAYTYPE) {
  8286. if (preType != ARRAYTYPE) {
  8287. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8288. } else {
  8289. if (currentValue.length < preValue.length) {
  8290. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8291. } else {
  8292. currentValue.forEach(function (item, index) {
  8293. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  8294. });
  8295. }
  8296. }
  8297. } else if (currentType == OBJECTTYPE) {
  8298. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  8299. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  8300. } else {
  8301. for (var subKey in currentValue) {
  8302. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  8303. }
  8304. }
  8305. }
  8306. };
  8307. for (var key in current) loop( key );
  8308. }
  8309. } else if (rootCurrentType == ARRAYTYPE) {
  8310. if (rootPreType != ARRAYTYPE) {
  8311. setResult(result, path, current);
  8312. } else {
  8313. if (current.length < pre.length) {
  8314. setResult(result, path, current);
  8315. } else {
  8316. current.forEach(function (item, index) {
  8317. _diff(item, pre[index], path + '[' + index + ']', result);
  8318. });
  8319. }
  8320. }
  8321. } else {
  8322. setResult(result, path, current);
  8323. }
  8324. }
  8325. function setResult(result, k, v) {
  8326. // if (type(v) != FUNCTIONTYPE) {
  8327. result[k] = v;
  8328. // }
  8329. }
  8330. function type(obj) {
  8331. return Object.prototype.toString.call(obj)
  8332. }
  8333. /* */
  8334. function flushCallbacks$1(vm) {
  8335. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  8336. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8337. var mpInstance = vm.$scope;
  8338. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8339. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  8340. }
  8341. var copies = vm.__next_tick_callbacks.slice(0);
  8342. vm.__next_tick_callbacks.length = 0;
  8343. for (var i = 0; i < copies.length; i++) {
  8344. copies[i]();
  8345. }
  8346. }
  8347. }
  8348. function hasRenderWatcher(vm) {
  8349. return queue.find(function (watcher) { return vm._watcher === watcher; })
  8350. }
  8351. function nextTick$1(vm, cb) {
  8352. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  8353. //2.nextTick 之前存在 render watcher
  8354. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  8355. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  8356. var mpInstance = vm.$scope;
  8357. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  8358. ']:nextVueTick');
  8359. }
  8360. return nextTick(cb, vm)
  8361. }else{
  8362. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  8363. var mpInstance$1 = vm.$scope;
  8364. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  8365. ']:nextMPTick');
  8366. }
  8367. }
  8368. var _resolve;
  8369. if (!vm.__next_tick_callbacks) {
  8370. vm.__next_tick_callbacks = [];
  8371. }
  8372. vm.__next_tick_callbacks.push(function () {
  8373. if (cb) {
  8374. try {
  8375. cb.call(vm);
  8376. } catch (e) {
  8377. handleError(e, vm, 'nextTick');
  8378. }
  8379. } else if (_resolve) {
  8380. _resolve(vm);
  8381. }
  8382. });
  8383. // $flow-disable-line
  8384. if (!cb && typeof Promise !== 'undefined') {
  8385. return new Promise(function (resolve) {
  8386. _resolve = resolve;
  8387. })
  8388. }
  8389. }
  8390. /* */
  8391. function clearInstance(key, value) {
  8392. // 简易去除 Vue 和小程序组件实例
  8393. if (value) {
  8394. if (value._isVue || value.__v_isMPComponent) {
  8395. return {}
  8396. }
  8397. }
  8398. return value
  8399. }
  8400. function cloneWithData(vm) {
  8401. // 确保当前 vm 所有数据被同步
  8402. var ret = Object.create(null);
  8403. var dataKeys = [].concat(
  8404. Object.keys(vm._data || {}),
  8405. Object.keys(vm._computedWatchers || {}));
  8406. dataKeys.reduce(function(ret, key) {
  8407. ret[key] = vm[key];
  8408. return ret
  8409. }, ret);
  8410. // vue-composition-api
  8411. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  8412. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  8413. if (rawBindings) {
  8414. Object.keys(rawBindings).forEach(function (key) {
  8415. ret[key] = vm[key];
  8416. });
  8417. }
  8418. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  8419. Object.assign(ret, vm.$mp.data || {});
  8420. if (
  8421. Array.isArray(vm.$options.behaviors) &&
  8422. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8423. ) { //form-field
  8424. ret['name'] = vm.name;
  8425. ret['value'] = vm.value;
  8426. }
  8427. return JSON.parse(JSON.stringify(ret, clearInstance))
  8428. }
  8429. var patch = function(oldVnode, vnode) {
  8430. var this$1 = this;
  8431. if (vnode === null) { //destroy
  8432. return
  8433. }
  8434. if (this.mpType === 'page' || this.mpType === 'component') {
  8435. var mpInstance = this.$scope;
  8436. var data = Object.create(null);
  8437. try {
  8438. data = cloneWithData(this);
  8439. } catch (err) {
  8440. console.error(err);
  8441. }
  8442. data.__webviewId__ = mpInstance.data.__webviewId__;
  8443. var mpData = Object.create(null);
  8444. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  8445. mpData[key] = mpInstance.data[key];
  8446. });
  8447. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  8448. if (Object.keys(diffData).length) {
  8449. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"v3-H5","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  8450. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  8451. ']差量更新',
  8452. JSON.stringify(diffData));
  8453. }
  8454. this.__next_tick_pending = true;
  8455. mpInstance.setData(diffData, function () {
  8456. this$1.__next_tick_pending = false;
  8457. flushCallbacks$1(this$1);
  8458. });
  8459. } else {
  8460. flushCallbacks$1(this);
  8461. }
  8462. }
  8463. };
  8464. /* */
  8465. function createEmptyRender() {
  8466. }
  8467. function mountComponent$1(
  8468. vm,
  8469. el,
  8470. hydrating
  8471. ) {
  8472. if (!vm.mpType) {//main.js 中的 new Vue
  8473. return vm
  8474. }
  8475. if (vm.mpType === 'app') {
  8476. vm.$options.render = createEmptyRender;
  8477. }
  8478. if (!vm.$options.render) {
  8479. vm.$options.render = createEmptyRender;
  8480. if (true) {
  8481. /* istanbul ignore if */
  8482. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  8483. vm.$options.el || el) {
  8484. warn(
  8485. 'You are using the runtime-only build of Vue where the template ' +
  8486. 'compiler is not available. Either pre-compile the templates into ' +
  8487. 'render functions, or use the compiler-included build.',
  8488. vm
  8489. );
  8490. } else {
  8491. warn(
  8492. 'Failed to mount component: template or render function not defined.',
  8493. vm
  8494. );
  8495. }
  8496. }
  8497. }
  8498. !vm._$fallback && callHook(vm, 'beforeMount');
  8499. var updateComponent = function () {
  8500. vm._update(vm._render(), hydrating);
  8501. };
  8502. // we set this to vm._watcher inside the watcher's constructor
  8503. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  8504. // component's mounted hook), which relies on vm._watcher being already defined
  8505. new Watcher(vm, updateComponent, noop, {
  8506. before: function before() {
  8507. if (vm._isMounted && !vm._isDestroyed) {
  8508. callHook(vm, 'beforeUpdate');
  8509. }
  8510. }
  8511. }, true /* isRenderWatcher */);
  8512. hydrating = false;
  8513. return vm
  8514. }
  8515. /* */
  8516. function renderClass (
  8517. staticClass,
  8518. dynamicClass
  8519. ) {
  8520. if (isDef(staticClass) || isDef(dynamicClass)) {
  8521. return concat(staticClass, stringifyClass(dynamicClass))
  8522. }
  8523. /* istanbul ignore next */
  8524. return ''
  8525. }
  8526. function concat (a, b) {
  8527. return a ? b ? (a + ' ' + b) : a : (b || '')
  8528. }
  8529. function stringifyClass (value) {
  8530. if (Array.isArray(value)) {
  8531. return stringifyArray(value)
  8532. }
  8533. if (isObject(value)) {
  8534. return stringifyObject(value)
  8535. }
  8536. if (typeof value === 'string') {
  8537. return value
  8538. }
  8539. /* istanbul ignore next */
  8540. return ''
  8541. }
  8542. function stringifyArray (value) {
  8543. var res = '';
  8544. var stringified;
  8545. for (var i = 0, l = value.length; i < l; i++) {
  8546. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  8547. if (res) { res += ' '; }
  8548. res += stringified;
  8549. }
  8550. }
  8551. return res
  8552. }
  8553. function stringifyObject (value) {
  8554. var res = '';
  8555. for (var key in value) {
  8556. if (value[key]) {
  8557. if (res) { res += ' '; }
  8558. res += key;
  8559. }
  8560. }
  8561. return res
  8562. }
  8563. /* */
  8564. var parseStyleText = cached(function (cssText) {
  8565. var res = {};
  8566. var listDelimiter = /;(?![^(]*\))/g;
  8567. var propertyDelimiter = /:(.+)/;
  8568. cssText.split(listDelimiter).forEach(function (item) {
  8569. if (item) {
  8570. var tmp = item.split(propertyDelimiter);
  8571. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  8572. }
  8573. });
  8574. return res
  8575. });
  8576. // normalize possible array / string values into Object
  8577. function normalizeStyleBinding (bindingStyle) {
  8578. if (Array.isArray(bindingStyle)) {
  8579. return toObject(bindingStyle)
  8580. }
  8581. if (typeof bindingStyle === 'string') {
  8582. return parseStyleText(bindingStyle)
  8583. }
  8584. return bindingStyle
  8585. }
  8586. /* */
  8587. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  8588. function getTarget(obj, path) {
  8589. var parts = path.split('.');
  8590. var key = parts[0];
  8591. if (key.indexOf('__$n') === 0) { //number index
  8592. key = parseInt(key.replace('__$n', ''));
  8593. }
  8594. if (parts.length === 1) {
  8595. return obj[key]
  8596. }
  8597. return getTarget(obj[key], parts.slice(1).join('.'))
  8598. }
  8599. function internalMixin(Vue) {
  8600. Vue.config.errorHandler = function(err, vm, info) {
  8601. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  8602. console.error(err);
  8603. /* eslint-disable no-undef */
  8604. var app = typeof getApp === 'function' && getApp();
  8605. if (app && app.onError) {
  8606. app.onError(err);
  8607. }
  8608. };
  8609. var oldEmit = Vue.prototype.$emit;
  8610. Vue.prototype.$emit = function(event) {
  8611. if (this.$scope && event) {
  8612. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  8613. if (triggerEvent) {
  8614. try {
  8615. triggerEvent.call(this.$scope, event, {
  8616. __args__: toArray(arguments, 1)
  8617. });
  8618. } catch (error) {
  8619. }
  8620. }
  8621. }
  8622. return oldEmit.apply(this, arguments)
  8623. };
  8624. Vue.prototype.$nextTick = function(fn) {
  8625. return nextTick$1(this, fn)
  8626. };
  8627. MP_METHODS.forEach(function (method) {
  8628. Vue.prototype[method] = function(args) {
  8629. if (this.$scope && this.$scope[method]) {
  8630. return this.$scope[method](args)
  8631. }
  8632. // mp-alipay
  8633. if (typeof my === 'undefined') {
  8634. return
  8635. }
  8636. if (method === 'createSelectorQuery') {
  8637. /* eslint-disable no-undef */
  8638. return my.createSelectorQuery(args)
  8639. } else if (method === 'createIntersectionObserver') {
  8640. /* eslint-disable no-undef */
  8641. return my.createIntersectionObserver(args)
  8642. }
  8643. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  8644. };
  8645. });
  8646. Vue.prototype.__init_provide = initProvide;
  8647. Vue.prototype.__init_injections = initInjections;
  8648. Vue.prototype.__call_hook = function(hook, args) {
  8649. var vm = this;
  8650. // #7573 disable dep collection when invoking lifecycle hooks
  8651. pushTarget();
  8652. var handlers = vm.$options[hook];
  8653. var info = hook + " hook";
  8654. var ret;
  8655. if (handlers) {
  8656. for (var i = 0, j = handlers.length; i < j; i++) {
  8657. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  8658. }
  8659. }
  8660. if (vm._hasHookEvent) {
  8661. vm.$emit('hook:' + hook, args);
  8662. }
  8663. popTarget();
  8664. return ret
  8665. };
  8666. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  8667. if (Array.isArray(modifiers)) {
  8668. if (modifiers.indexOf('trim') !== -1) {
  8669. value = value.trim();
  8670. }
  8671. if (modifiers.indexOf('number') !== -1) {
  8672. value = this._n(value);
  8673. }
  8674. }
  8675. if (!target) {
  8676. target = this;
  8677. }
  8678. // 解决动态属性添加
  8679. Vue.set(target, key, value);
  8680. };
  8681. Vue.prototype.__set_sync = function(target, key, value) {
  8682. if (!target) {
  8683. target = this;
  8684. }
  8685. // 解决动态属性添加
  8686. Vue.set(target, key, value);
  8687. };
  8688. Vue.prototype.__get_orig = function(item) {
  8689. if (isPlainObject(item)) {
  8690. return item['$orig'] || item
  8691. }
  8692. return item
  8693. };
  8694. Vue.prototype.__get_value = function(dataPath, target) {
  8695. return getTarget(target || this, dataPath)
  8696. };
  8697. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  8698. return renderClass(staticClass, dynamicClass)
  8699. };
  8700. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  8701. if (!dynamicStyle && !staticStyle) {
  8702. return ''
  8703. }
  8704. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  8705. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  8706. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  8707. };
  8708. Vue.prototype.__map = function(val, iteratee) {
  8709. //TODO 暂不考虑 string
  8710. var ret, i, l, keys, key;
  8711. if (Array.isArray(val)) {
  8712. ret = new Array(val.length);
  8713. for (i = 0, l = val.length; i < l; i++) {
  8714. ret[i] = iteratee(val[i], i);
  8715. }
  8716. return ret
  8717. } else if (isObject(val)) {
  8718. keys = Object.keys(val);
  8719. ret = Object.create(null);
  8720. for (i = 0, l = keys.length; i < l; i++) {
  8721. key = keys[i];
  8722. ret[key] = iteratee(val[key], key, i);
  8723. }
  8724. return ret
  8725. } else if (typeof val === 'number') {
  8726. ret = new Array(val);
  8727. for (i = 0, l = val; i < l; i++) {
  8728. // 第一个参数暂时仍和小程序一致
  8729. ret[i] = iteratee(i, i);
  8730. }
  8731. return ret
  8732. }
  8733. return []
  8734. };
  8735. }
  8736. /* */
  8737. var LIFECYCLE_HOOKS$1 = [
  8738. //App
  8739. 'onLaunch',
  8740. 'onShow',
  8741. 'onHide',
  8742. 'onUniNViewMessage',
  8743. 'onPageNotFound',
  8744. 'onThemeChange',
  8745. 'onError',
  8746. 'onUnhandledRejection',
  8747. //Page
  8748. 'onInit',
  8749. 'onLoad',
  8750. // 'onShow',
  8751. 'onReady',
  8752. // 'onHide',
  8753. 'onUnload',
  8754. 'onPullDownRefresh',
  8755. 'onReachBottom',
  8756. 'onTabItemTap',
  8757. 'onAddToFavorites',
  8758. 'onShareTimeline',
  8759. 'onShareAppMessage',
  8760. 'onResize',
  8761. 'onPageScroll',
  8762. 'onNavigationBarButtonTap',
  8763. 'onBackPress',
  8764. 'onNavigationBarSearchInputChanged',
  8765. 'onNavigationBarSearchInputConfirmed',
  8766. 'onNavigationBarSearchInputClicked',
  8767. 'onUploadDouyinVideo',
  8768. 'onNFCReadMessage',
  8769. //Component
  8770. // 'onReady', // 兼容旧版本,应该移除该事件
  8771. 'onPageShow',
  8772. 'onPageHide',
  8773. 'onPageResize'
  8774. ];
  8775. function lifecycleMixin$1(Vue) {
  8776. //fixed vue-class-component
  8777. var oldExtend = Vue.extend;
  8778. Vue.extend = function(extendOptions) {
  8779. extendOptions = extendOptions || {};
  8780. var methods = extendOptions.methods;
  8781. if (methods) {
  8782. Object.keys(methods).forEach(function (methodName) {
  8783. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  8784. extendOptions[methodName] = methods[methodName];
  8785. delete methods[methodName];
  8786. }
  8787. });
  8788. }
  8789. return oldExtend.call(this, extendOptions)
  8790. };
  8791. var strategies = Vue.config.optionMergeStrategies;
  8792. var mergeHook = strategies.created;
  8793. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  8794. strategies[hook] = mergeHook;
  8795. });
  8796. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  8797. }
  8798. /* */
  8799. // install platform patch function
  8800. Vue.prototype.__patch__ = patch;
  8801. // public mount method
  8802. Vue.prototype.$mount = function(
  8803. el ,
  8804. hydrating
  8805. ) {
  8806. return mountComponent$1(this, el, hydrating)
  8807. };
  8808. lifecycleMixin$1(Vue);
  8809. internalMixin(Vue);
  8810. /* */
  8811. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  8812. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  8813. /***/ }),
  8814. /* 26 */
  8815. /*!**************************************!*\
  8816. !*** E:/git/2021项目/v3-H5/pages.json ***!
  8817. \**************************************/
  8818. /*! no static exports found */
  8819. /***/ (function(module, exports) {
  8820. /***/ }),
  8821. /* 27 */,
  8822. /* 28 */,
  8823. /* 29 */,
  8824. /* 30 */,
  8825. /* 31 */,
  8826. /* 32 */
  8827. /*!**********************************************************************************************************!*\
  8828. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  8829. \**********************************************************************************************************/
  8830. /*! exports provided: default */
  8831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8832. "use strict";
  8833. __webpack_require__.r(__webpack_exports__);
  8834. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  8835. /* globals __VUE_SSR_CONTEXT__ */
  8836. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  8837. // This module is a runtime utility for cleaner component module output and will
  8838. // be included in the final webpack user bundle.
  8839. function normalizeComponent (
  8840. scriptExports,
  8841. render,
  8842. staticRenderFns,
  8843. functionalTemplate,
  8844. injectStyles,
  8845. scopeId,
  8846. moduleIdentifier, /* server only */
  8847. shadowMode, /* vue-cli only */
  8848. components, // fixed by xxxxxx auto components
  8849. renderjs // fixed by xxxxxx renderjs
  8850. ) {
  8851. // Vue.extend constructor export interop
  8852. var options = typeof scriptExports === 'function'
  8853. ? scriptExports.options
  8854. : scriptExports
  8855. // fixed by xxxxxx auto components
  8856. if (components) {
  8857. if (!options.components) {
  8858. options.components = {}
  8859. }
  8860. var hasOwn = Object.prototype.hasOwnProperty
  8861. for (var name in components) {
  8862. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  8863. options.components[name] = components[name]
  8864. }
  8865. }
  8866. }
  8867. // fixed by xxxxxx renderjs
  8868. if (renderjs) {
  8869. if(typeof renderjs.beforeCreate === 'function'){
  8870. renderjs.beforeCreate = [renderjs.beforeCreate]
  8871. }
  8872. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  8873. this[renderjs.__module] = this
  8874. });
  8875. (options.mixins || (options.mixins = [])).push(renderjs)
  8876. }
  8877. // render functions
  8878. if (render) {
  8879. options.render = render
  8880. options.staticRenderFns = staticRenderFns
  8881. options._compiled = true
  8882. }
  8883. // functional template
  8884. if (functionalTemplate) {
  8885. options.functional = true
  8886. }
  8887. // scopedId
  8888. if (scopeId) {
  8889. options._scopeId = 'data-v-' + scopeId
  8890. }
  8891. var hook
  8892. if (moduleIdentifier) { // server build
  8893. hook = function (context) {
  8894. // 2.3 injection
  8895. context =
  8896. context || // cached call
  8897. (this.$vnode && this.$vnode.ssrContext) || // stateful
  8898. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  8899. // 2.2 with runInNewContext: true
  8900. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  8901. context = __VUE_SSR_CONTEXT__
  8902. }
  8903. // inject component styles
  8904. if (injectStyles) {
  8905. injectStyles.call(this, context)
  8906. }
  8907. // register component module identifier for async chunk inferrence
  8908. if (context && context._registeredComponents) {
  8909. context._registeredComponents.add(moduleIdentifier)
  8910. }
  8911. }
  8912. // used by ssr in case component is cached and beforeCreate
  8913. // never gets called
  8914. options._ssrRegister = hook
  8915. } else if (injectStyles) {
  8916. hook = shadowMode
  8917. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  8918. : injectStyles
  8919. }
  8920. if (hook) {
  8921. if (options.functional) {
  8922. // for template-only hot-reload because in that case the render fn doesn't
  8923. // go through the normalizer
  8924. options._injectStyles = hook
  8925. // register for functioal component in vue file
  8926. var originalRender = options.render
  8927. options.render = function renderWithStyleInjection (h, context) {
  8928. hook.call(context)
  8929. return originalRender(h, context)
  8930. }
  8931. } else {
  8932. // inject component registration as beforeCreate hook
  8933. var existing = options.beforeCreate
  8934. options.beforeCreate = existing
  8935. ? [].concat(existing, hook)
  8936. : [hook]
  8937. }
  8938. }
  8939. return {
  8940. exports: scriptExports,
  8941. options: options
  8942. }
  8943. }
  8944. /***/ }),
  8945. /* 33 */
  8946. /*!*************************************************!*\
  8947. !*** E:/git/2021项目/v3-H5/api/request/config.js ***!
  8948. \*************************************************/
  8949. /*! no static exports found */
  8950. /***/ (function(module, exports, __webpack_require__) {
  8951. "use strict";
  8952. Object.defineProperty(exports, "__esModule", {
  8953. value: true
  8954. });
  8955. exports.config = void 0;
  8956. var config = {
  8957. /************************************ 后台服务地址 ************************************/
  8958. // base_url: 'http://192.168.1.43/api', //43服务器
  8959. // base_url: 'http://192.168.1.8/api',//1.8服务器
  8960. // base_url: 'http://192.168.1.88/labSystem',//1.88服务器
  8961. // base_url: 'http://192.168.1.9:8080',//柴
  8962. // base_url: 'http://192.168.1.24:8080',//林总
  8963. // base_url: 'http://192.168.1.7:8080',//刘波
  8964. // base_url: 'http://192.168.1.17:8080',//小飞
  8965. // base_url: 'http://192.168.1.43/api',//小飞
  8966. // base_url: 'http://192.168.1.20:8080',//志伟
  8967. // base_url: 'http://192.168.1.39:8080',//高升
  8968. // base_url: 'http://192.168.1.29:8080',//何成
  8969. // base_url: 'https://demo.zjznai.com/xzgd/',
  8970. // base_url: 'https://lab.zjznai.com/labNhSystem/',//43服务器高升测试
  8971. // base_url: 'https://lab.zjznai.com/labTest/',//1.8外网
  8972. // base_url: 'https://lab.zjznai.com/labapp/',//43服务器线上
  8973. base_url: 'https://lab.zjznai.com/appTest/',
  8974. //88服务器线上
  8975. // base_url: 'https://lab.zjznai.com/labSystem/', //矿大地址
  8976. // base_url: 'https://lab.zjznai.com/jdlabSystem/', //交大地址
  8977. // base_url: 'https://lab.zjznai.com/jndxlabSystem/', //暨大地址
  8978. // base_url: 'https://lab.zjznai.com/api/', //暨大化材
  8979. // base_url: 'https://lab.zjznai.com/kdwclabSystem/', //矿大文昌地址
  8980. //base_url: 'https://znyj.zjznai.suda.edu.cn/labSystem/', //苏大临时地址
  8981. // base_url: 'https://labcontrol.nwafu.edu.cn/api/', //西北农林
  8982. // base_url: 'http://172.16.0.65/api/', //西北农林
  8983. //base_url: 'https://lab.zjznai.com/labapp/', //43测试
  8984. // base_url: 'https://metersphere.zjznai.com/labSystem/', //中国海关
  8985. /************************************ 图片服务地址 ************************************/
  8986. //(imagesUrl.styl 文件内还需要配置一次css相关地址注意是否与imagesUrl.styl一致)
  8987. imagesUrl: 'https://zj-wechat.oss-cn-beijing.aliyuncs.com/xcx_images/xcx_v3/',
  8988. /************************************ 扫一扫 ************************************/
  8989. //1.MSDS说明书 2.安全制度 3.危险源详情 地址配置
  8990. saoCodeTypeUrl: 'http://192.168.1.88/labSystem/admin/#/codeHtml?',
  8991. /************************************ 校级管理员身份ID ************************************/
  8992. schoolId: '1815293314666532865',
  8993. /************************************ 院级管理员身份ID ************************************/
  8994. collegeId: '1815336278075838465',
  8995. /************************************ 版本标识-用于区别各学校差异化代码 ************************************/
  8996. VERSION_DIFFERENCE_FIELD: 'xiBeiNongLinDaXue',
  8997. /************************************ H5统一认证地址-用于H5版本统一认证 ************************************/
  8998. UNIFIED_CERTIFICATION_URL: 'https://labcontrol.nwafu.edu.cn/api/auth/cas/logout/applet'
  8999. };
  9000. exports.config = config;
  9001. /***/ }),
  9002. /* 34 */
  9003. /*!****************************************************!*\
  9004. !*** E:/git/2021项目/v3-H5/uni.promisify.adaptor.js ***!
  9005. \****************************************************/
  9006. /*! no static exports found */
  9007. /***/ (function(module, exports, __webpack_require__) {
  9008. /* WEBPACK VAR INJECTION */(function(uni) {var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  9009. uni.addInterceptor({
  9010. returnValue: function returnValue(res) {
  9011. if (!(!!res && (_typeof(res) === "object" || typeof res === "function") && typeof res.then === "function")) {
  9012. return res;
  9013. }
  9014. return new Promise(function (resolve, reject) {
  9015. res.then(function (res) {
  9016. if (!res) return resolve(res);
  9017. return res[0] ? reject(res[0]) : resolve(res[1]);
  9018. });
  9019. });
  9020. }
  9021. });
  9022. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9023. /***/ }),
  9024. /* 35 */
  9025. /*!*********************************************!*\
  9026. !*** E:/git/2021项目/v3-H5/devTools/index.js ***!
  9027. \*********************************************/
  9028. /*! no static exports found */
  9029. /***/ (function(module, exports, __webpack_require__) {
  9030. "use strict";
  9031. /* WEBPACK VAR INJECTION */(function(uni) {
  9032. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9033. Object.defineProperty(exports, "__esModule", {
  9034. value: true
  9035. });
  9036. exports.default = void 0;
  9037. var _drawView = _interopRequireDefault(__webpack_require__(/*! ./core/libs/drawView */ 36));
  9038. var _logReport = _interopRequireDefault(__webpack_require__(/*! ./core/libs/logReport */ 37));
  9039. var _errorReport = _interopRequireDefault(__webpack_require__(/*! ./core/libs/errorReport */ 41));
  9040. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./core/libs/devOptions */ 39));
  9041. var _createH5Bubble = _interopRequireDefault(__webpack_require__(/*! ./core/libs/createH5Bubble */ 42));
  9042. var _vueMixin = _interopRequireDefault(__webpack_require__(/*! ./core/proxy/vueMixin */ 43));
  9043. var _index = _interopRequireDefault(__webpack_require__(/*! ./core/proxy/index */ 47));
  9044. var _pageLinkList = _interopRequireDefault(__webpack_require__(/*! ./core/libs/pageLinkList */ 44));
  9045. /**
  9046. * @type {Vue}
  9047. */
  9048. var that;
  9049. var devTools = {
  9050. options: null,
  9051. /**
  9052. * 挂载安装APP页面
  9053. */
  9054. install: function install(vm, options) {
  9055. try {
  9056. that = vm;
  9057. var _this = this;
  9058. if (vm && vm.config && vm.config.globalProperties) {
  9059. vm.config.globalProperties.$logReport = _logReport.default;
  9060. } else {
  9061. vm.prototype.$logReport = _logReport.default;
  9062. }
  9063. //! 初始化配置项
  9064. _devOptions.default.setOptions(options);
  9065. options = _devOptions.default.getOptions();
  9066. _this.options = options;
  9067. if (!options || !options.status) {
  9068. return console.log("%c devTools 调试工具未运行!", 'padding: 4px;background-color: red;color: #fff;font-size: 15px;');
  9069. }
  9070. //! 挂载dev工具
  9071. if (vm && vm.config && vm.config.globalProperties) {
  9072. vm.config.globalProperties.$devTools = devTools;
  9073. } else {
  9074. vm.prototype.$devTools = devTools;
  9075. }
  9076. if (options.error.status) {
  9077. //! 挂载vue报错
  9078. vm.config.errorHandler = function (err, vm, trace) {
  9079. (0, _errorReport.default)(err, trace, "ve");
  9080. };
  9081. //! 挂载vue警告
  9082. vm.config.warnHandler = function (err, vm, trace) {
  9083. (0, _errorReport.default)(err, trace, "vw");
  9084. };
  9085. }
  9086. //!混入生命周期监听器
  9087. vm.mixin(_vueMixin.default);
  9088. //!绘制环境变量小标签
  9089. //!调试工具全局拦截器挂载
  9090. (0, _index.default)(options);
  9091. //! 注册dev弹窗打开事件
  9092. uni.$on("devTools_showDialog", function () {
  9093. _this.show();
  9094. });
  9095. //! 注册dev弹窗关闭事件
  9096. uni.$on("devTools_closeDialog", function (options) {
  9097. _this.hide(options);
  9098. });
  9099. //! 挂载uni对象
  9100. uni.$dev = {
  9101. show: function show() {
  9102. _this.show();
  9103. },
  9104. hide: function hide() {
  9105. _this.hide();
  9106. },
  9107. errorReport: _errorReport.default,
  9108. logReport: _logReport.default
  9109. };
  9110. //! 注册jsRunner执行事件
  9111. uni.$on("devTools_jsRunner", function (code) {
  9112. var result = undefined;
  9113. try {
  9114. var fun = ("ev" + "__混淆__" + "al").replace("__混淆__", "");
  9115. result = globalThis[fun](code);
  9116. // result = eval(code);
  9117. } catch (error) {
  9118. if (error && error.message) {
  9119. result = error.message;
  9120. }
  9121. }
  9122. uni.$emit("devTools_jsRunnerCallback", result);
  9123. });
  9124. // ! 页面路由列表
  9125. _pageLinkList.default.install();
  9126. } catch (error) {
  9127. console.log("devTools install error", error);
  9128. }
  9129. },
  9130. /**
  9131. * 打开调试弹窗
  9132. */
  9133. show: function show() {
  9134. var pages = getCurrentPages();
  9135. //! 已经打开了调试工具,不要重复显示
  9136. if (pages[pages.length - 1].route == this.options.devRoute) {
  9137. return false;
  9138. }
  9139. uni.navigateTo({
  9140. url: this.options.route,
  9141. animationType: 'none',
  9142. animationDuration: 0
  9143. });
  9144. },
  9145. /**
  9146. * 隐藏调试弹窗
  9147. */
  9148. hide: function hide(options) {
  9149. uni.navigateBack();
  9150. if (options && options.navigateToUrl) {
  9151. var t = 600;
  9152. t = 200;
  9153. setTimeout(function () {
  9154. uni.navigateTo({
  9155. url: options.navigateToUrl
  9156. });
  9157. }, t);
  9158. }
  9159. },
  9160. errorReport: _errorReport.default,
  9161. logReport: _logReport.default
  9162. };
  9163. var _default = devTools;
  9164. exports.default = _default;
  9165. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9166. /***/ }),
  9167. /* 36 */
  9168. /*!**********************************************************!*\
  9169. !*** E:/git/2021项目/v3-H5/devTools/core/libs/drawView.js ***!
  9170. \**********************************************************/
  9171. /*! no static exports found */
  9172. /***/ (function(module, exports, __webpack_require__) {
  9173. "use strict";
  9174. /* WEBPACK VAR INJECTION */(function(uni) {
  9175. Object.defineProperty(exports, "__esModule", {
  9176. value: true
  9177. });
  9178. exports.default = void 0;
  9179. /**
  9180. * 绘制调试工具
  9181. */
  9182. /**
  9183. * 入口文件
  9184. */
  9185. function init(options, devTools) {
  9186. var sysInfo = uni.getSystemInfoSync();
  9187. var tagConfig = uni.getStorageSync("devTools_tagConfig");
  9188. if (!tagConfig) {
  9189. tagConfig = {};
  9190. }
  9191. tagConfig = Object.assign({
  9192. show: options.bubble.status,
  9193. x: sysInfo.screenWidth - 90,
  9194. y: sysInfo.screenHeight - 90
  9195. }, tagConfig);
  9196. tagConfig.show = options.bubble.status;
  9197. // 拖动范围限制
  9198. var dragLimit = {
  9199. min: {
  9200. x: 0,
  9201. y: 0
  9202. },
  9203. max: {
  9204. x: sysInfo.screenWidth - 70,
  9205. y: sysInfo.screenHeight - 24
  9206. }
  9207. };
  9208. var view = new plus.nativeObj.View('debugTag', {
  9209. top: tagConfig.y + 'px',
  9210. left: tagConfig.x + 'px',
  9211. height: '24px',
  9212. width: '70px',
  9213. backgroundColor: options.bubble.bgColor
  9214. });
  9215. view.drawText(options.bubble.text, {}, {
  9216. size: '12px',
  9217. color: options.bubble.color,
  9218. weight: 'bold'
  9219. });
  9220. if (tagConfig.show) {
  9221. view.show();
  9222. }
  9223. var isTouch = false;
  9224. var touchStart = {
  9225. l: 0,
  9226. t: 0,
  9227. x: 0,
  9228. y: 0,
  9229. time: 0,
  9230. hasMove: false
  9231. };
  9232. view.addEventListener("touchstart", function (e) {
  9233. isTouch = true;
  9234. touchStart.l = e.clientX;
  9235. touchStart.t = e.clientY;
  9236. touchStart.time = new Date().getTime();
  9237. touchStart.hasMove = false;
  9238. });
  9239. view.addEventListener("touchmove", function (e) {
  9240. if (!isTouch) return;
  9241. if (!touchStart.hasMove) {
  9242. touchStart.hasMove = true;
  9243. }
  9244. var x = e.screenX - touchStart.l;
  9245. var y = e.screenY - touchStart.t;
  9246. x = Math.min(Math.max(x, dragLimit.min.x), dragLimit.max.x);
  9247. y = Math.min(Math.max(y, dragLimit.min.y), dragLimit.max.y);
  9248. view.setStyle({
  9249. top: y + 'px',
  9250. left: x + 'px'
  9251. });
  9252. touchStart.x = x;
  9253. touchStart.y = y;
  9254. });
  9255. view.addEventListener("touchend", function (e) {
  9256. isTouch = false;
  9257. if (!touchStart.hasMove || touchStart.time > new Date().getTime() - 300) {
  9258. // 单击事件
  9259. var pages = getCurrentPages();
  9260. var route = options.route.substring(1, options.route.length - 2);
  9261. if (pages[pages.length - 1].route == route) {
  9262. // 已经处于debug页面,不响应点击事件
  9263. return;
  9264. }
  9265. devTools.show();
  9266. } else {
  9267. //拖拽结束事件
  9268. tagConfig.x = touchStart.x;
  9269. tagConfig.y = touchStart.y;
  9270. uni.setStorageSync("devTools_tagConfig", tagConfig);
  9271. }
  9272. });
  9273. uni.setStorageSync("devTools_tagConfig", tagConfig);
  9274. }
  9275. var _default = init;
  9276. exports.default = _default;
  9277. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9278. /***/ }),
  9279. /* 37 */
  9280. /*!***********************************************************!*\
  9281. !*** E:/git/2021项目/v3-H5/devTools/core/libs/logReport.js ***!
  9282. \***********************************************************/
  9283. /*! no static exports found */
  9284. /***/ (function(module, exports, __webpack_require__) {
  9285. "use strict";
  9286. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9287. Object.defineProperty(exports, "__esModule", {
  9288. value: true
  9289. });
  9290. exports.default = void 0;
  9291. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9292. var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
  9293. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
  9294. var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ./jsonCompress */ 40));
  9295. /**
  9296. * ! 运行日志提交工具
  9297. */
  9298. /**
  9299. * 日志上报
  9300. */
  9301. function logReport(msg) {
  9302. try {
  9303. if (!msg) return false;
  9304. var options = _devOptions.default.getOptions();
  9305. if (!options.status) {
  9306. console.error("日志上报失败!dev工具未启用 msg:" + msg);
  9307. return;
  9308. }
  9309. if (!options.logs.status) {
  9310. console.error("日志上报失败!dev logs未启用 msg:" + msg);
  9311. return;
  9312. }
  9313. try {
  9314. var pages = getCurrentPages();
  9315. if (pages[pages.length - 1].route == options.devRoute) {
  9316. // 不记录调试工具报出的日志
  9317. return false;
  9318. }
  9319. } catch (error) {}
  9320. if ((0, _typeof2.default)(msg) == "object") {
  9321. try {
  9322. msg = JSON.stringify(msg);
  9323. } catch (error) {
  9324. msg = "logReport:error";
  9325. }
  9326. }
  9327. var log = {
  9328. t: new Date().getTime(),
  9329. m: ""
  9330. };
  9331. var logSize = _jsonCompress.default.calculateStringByteSize(log);
  9332. msg = String(msg);
  9333. msg = _jsonCompress.default.compressObject(msg, options.logs.cache.rowSize - logSize);
  9334. log.m = msg;
  9335. var logs = _devCache.default.get("logReport");
  9336. if (!logs) logs = [];
  9337. logs.unshift(log);
  9338. logs = _jsonCompress.default.compressArray(logs, "end", options.logs.cache.size);
  9339. _devCache.default.set("logReport", logs);
  9340. } catch (error) {
  9341. console.log("logReport error", error);
  9342. }
  9343. }
  9344. var _default = logReport;
  9345. exports.default = _default;
  9346. /***/ }),
  9347. /* 38 */
  9348. /*!**********************************************************!*\
  9349. !*** E:/git/2021项目/v3-H5/devTools/core/libs/devCache.js ***!
  9350. \**********************************************************/
  9351. /*! no static exports found */
  9352. /***/ (function(module, exports, __webpack_require__) {
  9353. "use strict";
  9354. /* WEBPACK VAR INJECTION */(function(uni) {
  9355. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9356. Object.defineProperty(exports, "__esModule", {
  9357. value: true
  9358. });
  9359. exports.default = void 0;
  9360. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
  9361. /**
  9362. * dev工具缓存管理
  9363. */
  9364. var _default = {
  9365. /**
  9366. * 存储的键开始名称
  9367. */
  9368. cacheKey: "devTools_v3_",
  9369. options: null,
  9370. /**
  9371. * 临时缓存对象
  9372. */
  9373. tempCache: {
  9374. errorReport: [],
  9375. logReport: [],
  9376. console: [],
  9377. request: [],
  9378. uniBus: []
  9379. },
  9380. /**
  9381. * 临时数据存放
  9382. */
  9383. tempData: {},
  9384. /**
  9385. * 向缓存内写入数据
  9386. */
  9387. set: function set(key, value) {
  9388. try {
  9389. if (['errorReport', 'logReport', 'console', 'request', 'uniBus'].indexOf(key) != -1) {
  9390. var setting = this.getLongListSetting(key);
  9391. if (!setting.status) return;
  9392. if (!setting.cache.status) {
  9393. // !不使用缓存
  9394. this.tempCache[key] = value;
  9395. return;
  9396. }
  9397. }
  9398. key = "".concat(this.cacheKey).concat(key);
  9399. this.tempData[key] = value;
  9400. } catch (error) {
  9401. console.log("devCache.set error", error);
  9402. }
  9403. },
  9404. /**
  9405. * 同步读取缓存数据
  9406. */
  9407. get: function get(key) {
  9408. try {
  9409. if (['errorReport', 'logReport', 'console', 'request', 'uniBus'].indexOf(key) != -1) {
  9410. var setting = this.getLongListSetting(key);
  9411. if (!setting.status) return [];
  9412. if (!setting.cache.status) {
  9413. // !不使用缓存
  9414. return this.tempCache[key];
  9415. }
  9416. }
  9417. key = "".concat(this.cacheKey).concat(key);
  9418. if (this.tempData.hasOwnProperty(key)) {
  9419. return this.tempData[key];
  9420. } else {
  9421. var value = uni.getStorageSync(key);
  9422. this.tempData[key] = value;
  9423. return value;
  9424. }
  9425. } catch (error) {
  9426. console.log("devCache.get error", error);
  9427. return "";
  9428. }
  9429. },
  9430. getLongListSetting: function getLongListSetting(key) {
  9431. var optionsKey = {
  9432. errorReport: 'error',
  9433. logReport: 'logs',
  9434. console: 'console',
  9435. request: 'network',
  9436. uniBus: 'uniBus'
  9437. };
  9438. if (this.options) return this.options[optionsKey[key]];
  9439. this.options = _devOptions.default.getOptions();
  9440. return this.options[optionsKey[key]];
  9441. },
  9442. /**
  9443. * 同步本地缓存
  9444. */
  9445. syncLocalCache: function syncLocalCache() {
  9446. var that = this;
  9447. setTimeout(function () {
  9448. try {
  9449. var waitSetKeys = Object.keys(that.tempData);
  9450. var _loop = function _loop(i) {
  9451. var key = waitSetKeys[i];
  9452. uni.setStorage({
  9453. key: key,
  9454. data: that.tempData[key],
  9455. success: function success() {
  9456. // console.log("set " + key + " success,length=" + that.tempData[key].length);
  9457. delete that.tempData[key];
  9458. }
  9459. });
  9460. };
  9461. for (var i = 0; i < waitSetKeys.length; i++) {
  9462. _loop(i);
  9463. }
  9464. } catch (error) {
  9465. console.log("devCache error: ", error);
  9466. }
  9467. setTimeout(function () {
  9468. that.syncLocalCache();
  9469. }, 500);
  9470. }, Math.round(Math.random() * 3 * 1000) + 2000);
  9471. }
  9472. };
  9473. exports.default = _default;
  9474. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  9475. /***/ }),
  9476. /* 39 */
  9477. /*!************************************************************!*\
  9478. !*** E:/git/2021项目/v3-H5/devTools/core/libs/devOptions.js ***!
  9479. \************************************************************/
  9480. /*! no static exports found */
  9481. /***/ (function(module, exports, __webpack_require__) {
  9482. "use strict";
  9483. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9484. Object.defineProperty(exports, "__esModule", {
  9485. value: true
  9486. });
  9487. exports.default = void 0;
  9488. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  9489. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9490. var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
  9491. /**
  9492. * 设置各端大小 kb
  9493. */
  9494. var defSize = function defSize(h5, app, mp) {
  9495. var r = 0;
  9496. r = mp;
  9497. return Math.ceil(r * 1024);
  9498. };
  9499. /**
  9500. * 获取配置
  9501. */
  9502. var _default = {
  9503. /**
  9504. * 配置缓存key
  9505. */
  9506. cacheKey: "options_v8",
  9507. /**
  9508. * 默认配置项
  9509. */
  9510. defaultOptions: {
  9511. version: 3.81,
  9512. status: false,
  9513. //调试工具总开关
  9514. route: "/devTools/page/index",
  9515. // 调试页面的路由,不建议更改
  9516. bubble: {
  9517. //调试弹窗气泡设置
  9518. status: false,
  9519. // 气泡标签是否显示,生产环境建议关闭
  9520. text: "调试工具",
  9521. // 气泡上展示的文字
  9522. color: "#ffffff",
  9523. // 气泡文字颜色
  9524. bgColor: "rgba(250, 53, 52,0.7)" // 气泡背景颜色
  9525. },
  9526. console: {
  9527. status: true,
  9528. // 开关
  9529. isOutput: true,
  9530. //打印的日志是否对外输出到浏览器调试界面,建议在生产环境时开启
  9531. cache: {
  9532. status: true,
  9533. //是否启用console缓存
  9534. size: defSize(512, 1024 * 2, 512),
  9535. rowSize: defSize(5.12, 20, 10)
  9536. }
  9537. },
  9538. error: {
  9539. status: true,
  9540. cache: {
  9541. status: true,
  9542. size: defSize(512, 1024 * 2, 512),
  9543. rowSize: defSize(5.12, 20, 10)
  9544. }
  9545. },
  9546. network: {
  9547. status: true,
  9548. cache: {
  9549. status: true,
  9550. size: defSize(512, 1024 * 2, 512),
  9551. rowSize: defSize(5.12, 20, 10)
  9552. }
  9553. },
  9554. logs: {
  9555. status: true,
  9556. cache: {
  9557. status: true,
  9558. size: defSize(512, 1024 * 2, 512),
  9559. rowSize: defSize(0.4, 0.4, 0.4)
  9560. }
  9561. },
  9562. // 页面统计开关
  9563. pageStatistics: {
  9564. status: true,
  9565. // 统计状态开关
  9566. size: defSize(200, 1024 * 2, 512),
  9567. dayOnlineRowMax: 60 // 日活跃时间的保存条数
  9568. },
  9569. // uni event bus 监听设置
  9570. uniBus: {
  9571. status: true,
  9572. cache: {
  9573. status: true,
  9574. size: defSize(512, 1024 * 2, 512),
  9575. rowSize: defSize(5.12, 20, 10),
  9576. countMaxSize: defSize(512, 1024 * 2, 512) // bus统计上限 kb
  9577. }
  9578. }
  9579. },
  9580. /**
  9581. * 获取配置信息
  9582. */
  9583. getOptions: function getOptions() {
  9584. try {
  9585. var options = _devCache.default.get(this.cacheKey);
  9586. if (!options) {
  9587. return {
  9588. status: false //默认关闭调试工具
  9589. };
  9590. }
  9591. var r = String(options.route);
  9592. // ! 增加 devRoute 参数
  9593. options.devRoute = r.substring(1, r.length);
  9594. return options;
  9595. } catch (error) {
  9596. console.log("devOptions.getOptions error: ", error);
  9597. return {
  9598. status: false //默认关闭调试工具
  9599. };
  9600. }
  9601. },
  9602. /**
  9603. * 保存配置项
  9604. */
  9605. setOptions: function setOptions(options) {
  9606. try {
  9607. if (!options) {
  9608. options = this.defaultOptions;
  9609. }
  9610. if (options.status) {
  9611. if (!options.route || typeof options.route != "string" || options.route.indexOf("/") != 0) {
  9612. return this.outputError("devTools \u8C03\u8BD5\u5DE5\u5177\u914D\u7F6E\u51FA\u9519: [route] \u53C2\u6570\u914D\u7F6E\u9519\u8BEF\uFF01");
  9613. }
  9614. }
  9615. var data = deepMerge(this.defaultOptions, options);
  9616. _devCache.default.set(this.cacheKey, data);
  9617. } catch (error) {
  9618. console.log("devOptions.setOptions error: ", error);
  9619. }
  9620. },
  9621. /**
  9622. * 弹出错误信息
  9623. */
  9624. outputError: function outputError(msg) {
  9625. console.log('%c' + msg, "\n padding: 4px;\n background-color: red;\n color: #fff;\n font-size: 15px;\n ");
  9626. }
  9627. };
  9628. /**
  9629. * 深度合并对象
  9630. */
  9631. exports.default = _default;
  9632. function deepMerge(target) {
  9633. try {
  9634. for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  9635. sources[_key - 1] = arguments[_key];
  9636. }
  9637. if (!sources.length) return target; // 如果没有源对象则直接返回目标对象
  9638. var source = sources[0];
  9639. for (var key in source) {
  9640. if (source.hasOwnProperty(key)) {
  9641. if ((0, _typeof2.default)(source[key]) === 'object' && (0, _typeof2.default)(target[key]) !== undefined) {
  9642. target[key] = deepMerge({}, target[key], source[key]); // 若属性值为对象类型且目标对象已存在该属性,则递归调用deepMerge函数进行合并
  9643. } else {
  9644. target[key] = source[key]; // 否则将源对象的属性赋值到目标对象上
  9645. }
  9646. }
  9647. }
  9648. return deepMerge.apply(void 0, [target].concat((0, _toConsumableArray2.default)(sources.slice(1)))); // 处理完第一个源对象后再次调用deepMerge函数处理其他源对象
  9649. } catch (error) {
  9650. console.log("deepMerge error", error);
  9651. return {};
  9652. }
  9653. }
  9654. /***/ }),
  9655. /* 40 */
  9656. /*!**************************************************************!*\
  9657. !*** E:/git/2021项目/v3-H5/devTools/core/libs/jsonCompress.js ***!
  9658. \**************************************************************/
  9659. /*! no static exports found */
  9660. /***/ (function(module, exports, __webpack_require__) {
  9661. "use strict";
  9662. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9663. Object.defineProperty(exports, "__esModule", {
  9664. value: true
  9665. });
  9666. exports.default = void 0;
  9667. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  9668. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9669. /**
  9670. * json压缩工具
  9671. */
  9672. var _default = {
  9673. /**
  9674. * 压缩js对象成json字符串,并控制json字节大小,多余部分裁剪
  9675. */
  9676. compressObject: function compressObject() {
  9677. var _this = this;
  9678. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  9679. var maxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1024 * 10.24;
  9680. try {
  9681. if (obj === undefined || obj === null) return obj;
  9682. if (typeof obj == "string") {
  9683. return this.truncateStrBySize(obj, maxSize);
  9684. }
  9685. if (typeof obj == "number") {
  9686. return obj;
  9687. }
  9688. var t = new Date().getTime();
  9689. var type = (0, _typeof2.default)(obj);
  9690. if (type === 'symbol') {
  9691. obj = "Symbol->" + obj.toString();
  9692. } else if (type === 'bigint') {
  9693. obj = "bigint->" + obj.toString();
  9694. } else if (typeof Error != "undefined" && obj instanceof Error) {
  9695. obj = "Error->".concat(obj.name, "\n").concat(obj.message, "\n").concat(obj.stack);
  9696. } else if (typeof Date != "undefined" && obj instanceof Date) {
  9697. obj = "Date->" + obj.toISOString();
  9698. } else if (typeof obj == "function") {
  9699. obj = "Function->" + obj.toString();
  9700. } else if (typeof RegExp != "undefined" && obj instanceof RegExp) {
  9701. obj = "RegExp->" + obj.toString();
  9702. } else if (typeof Map != "undefined" && obj instanceof Map) {
  9703. obj = "Map->(".concat(obj.size, ") { ").concat(Array.from(obj.entries()).map(function (_ref) {
  9704. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  9705. key = _ref2[0],
  9706. value = _ref2[1];
  9707. return "".concat(convertToString(key), " => ").concat(convertToString(value));
  9708. }).join(', '), " }");
  9709. } else if (typeof Set != "undefined" && obj instanceof Set) {
  9710. obj = "Set->(".concat(obj.size, ") { ").concat(Array.from(obj.values()).map(function (value) {
  9711. return convertToString(value);
  9712. }).join(', '), " }");
  9713. } else if (typeof Blob != "undefined" && obj instanceof Blob) {
  9714. obj = "Blob->{ size: ".concat(obj.size, ", type: ").concat(obj.type, " }");
  9715. } else if (typeof File != "undefined" && obj instanceof File) {
  9716. obj = "File->{ name: \"".concat(obj.name, "\", size: ").concat(obj.size, ", type: ").concat(obj.type, ", lastModified: ").concat(new Date(obj.lastModified).toISOString(), " }");
  9717. } else if (typeof URL != "undefined" && obj instanceof URL) {
  9718. obj = "URL->{ href: \"".concat(obj.href, "\", protocol: \"").concat(obj.protocol, "\", host: \"").concat(obj.host, "\", pathname: \"").concat(obj.pathname, "\", search: \"").concat(obj.search, "\", hash: \"").concat(obj.hash, "\" }");
  9719. } else if (typeof FormData != "undefined" && obj instanceof FormData) {
  9720. var entries = [];
  9721. obj.forEach(function (key, item) {
  9722. entries.push(key);
  9723. });
  9724. obj = "FormData->{ ".concat(entries.join(', '), " }");
  9725. } else if (typeof Location != "undefined" && obj instanceof Location) {
  9726. obj = "Location->{ href: \"".concat(obj.href, "\", protocol: \"").concat(obj.protocol, "\", host: \"").concat(obj.host, "\", pathname: \"").concat(obj.pathname, "\", search: \"").concat(obj.search, "\", hash: \"").concat(obj.hash, "\" }");
  9727. } else if (typeof Document != "undefined" && obj instanceof Document) {
  9728. obj = "Document->{ title: \"".concat(obj.title, "\", URL: \"").concat(obj.URL, "\" }");
  9729. } else if (typeof Window !== "undefined" && obj instanceof Window) {
  9730. obj = "Window->{ location: ".concat(this.compressObject(obj.location), ", document: ").concat(this.compressObject(obj.document), " }");
  9731. } else if (typeof Element != "undefined" && obj instanceof Element) {
  9732. obj = "Element->{ tagName: \"".concat(obj.tagName, "\", id: \"").concat(obj.id, "\", class: \"").concat(obj.className, "\" }");
  9733. } else if (typeof HTMLCanvasElement != "undefined" && obj instanceof HTMLCanvasElement) {
  9734. obj = "Canvas->{ width: ".concat(obj.width, ", height: ").concat(obj.height, " }");
  9735. } else if (typeof HTMLAudioElement != "undefined" && obj instanceof HTMLAudioElement) {
  9736. obj = "Audio->{ src: \"".concat(obj.src, "\", duration: ").concat(obj.duration, " }");
  9737. } else if (typeof HTMLVideoElement != "undefined" && obj instanceof HTMLVideoElement) {
  9738. obj = "Video->{ src: \"".concat(obj.src, "\", width: ").concat(obj.videoWidth, ", height: ").concat(obj.videoHeight, ", duration: ").concat(obj.duration, " }");
  9739. } else if (typeof Storage != "undefined" && obj instanceof Storage) {
  9740. obj = "Storage->{ length: ".concat(obj.length, " }");
  9741. } else if (typeof Worker != "undefined" && typeof ServiceWorker != "undefined" && typeof SharedWorker != "undefined" && (obj instanceof Worker || obj instanceof ServiceWorker || obj instanceof SharedWorker)) {
  9742. obj = "Worker->".concat(obj.constructor.name, " { scriptURL: \"").concat(obj.scriptURL, "\" }");
  9743. } else if (typeof WebSocket != "undefined" && obj instanceof WebSocket) {
  9744. obj = "WebSocket->{ url: \"".concat(obj.url, "\", readyState: ").concat(obj.readyState, " }");
  9745. } else if (typeof XMLHttpRequest != "undefined" && obj instanceof XMLHttpRequest) {
  9746. obj = "XMLHttpRequest->{ readyState: ".concat(obj.readyState, ", status: ").concat(obj.status, " }");
  9747. } else if (typeof EventSource != "undefined" && obj instanceof EventSource) {
  9748. obj = "EventSource->{ url: \"".concat(obj.url, "\", readyState: ").concat(obj.readyState, " }");
  9749. } else if (typeof MediaStream != "undefined" && obj instanceof MediaStream) {
  9750. obj = "MediaStream->{ id: \"".concat(obj.id, "\", active: ").concat(obj.active, " }");
  9751. } else if (typeof RTCPeerConnection != "undefined" && obj instanceof RTCPeerConnection) {
  9752. obj = "RTCPeerConnection->{ connectionState: \"".concat(obj.connectionState, "\" }");
  9753. } else if (typeof AudioContext != "undefined" && obj instanceof AudioContext) {
  9754. obj = "AudioContext->{ state: \"".concat(obj.state, "\" }");
  9755. } else if (typeof Element != "undefined" && obj instanceof Element) {
  9756. obj = "Element->{ tagName: \"".concat(obj.tagName, "\", id: \"").concat(obj.id, "\", class: \"").concat(obj.className, "\" }");
  9757. } else if (typeof HTMLCanvasElement != "undefined" && obj instanceof HTMLCanvasElement) {
  9758. obj = "Canvas->{ width: ".concat(obj.width, ", height: ").concat(obj.height, " }");
  9759. } else if (typeof HTMLAudioElement != "undefined" && obj instanceof HTMLAudioElement) {
  9760. obj = "Audio->{ src: \"".concat(obj.src, "\", duration: ").concat(obj.duration, " }");
  9761. } else if (typeof HTMLVideoElement != "undefined" && obj instanceof HTMLVideoElement) {
  9762. obj = "Video->{ src: \"".concat(obj.src, "\", width: ").concat(obj.videoWidth, ", height: ").concat(obj.videoHeight, ", duration: ").concat(obj.duration, " }");
  9763. } else if (typeof Geolocation != "undefined" && obj instanceof Geolocation) {
  9764. obj = "Geolocation->{ }";
  9765. } else if (typeof Performance != "undefined" && obj instanceof Performance) {
  9766. obj = "Performance->{ now: ".concat(obj.now(), " }");
  9767. } else if (typeof Event != "undefined" && obj instanceof Event) {
  9768. obj = "Event->{ type: \"".concat(obj.type, "\", target: \"").concat(obj.target, "\" }");
  9769. }
  9770. if (typeof obj == "string") {
  9771. return this.truncateStrBySize(obj, maxSize);
  9772. }
  9773. if ((0, _typeof2.default)(obj) != "object") {
  9774. return obj;
  9775. }
  9776. if (maxSize < 2) return {};
  9777. var addEndOut = false;
  9778. if (maxSize > 50) {
  9779. var objSize = this.calculateStringByteSize(obj);
  9780. if (objSize > maxSize) {
  9781. maxSize = maxSize - 50;
  9782. addEndOut = true;
  9783. }
  9784. }
  9785. var sizeCount = 2;
  9786. var str = this.safeJsonStringify(obj, function (key, value) {
  9787. var keySize = _this.calculateStringByteSize(key);
  9788. if ((0, _typeof2.default)(value) == "object") {
  9789. if (sizeCount + keySize + 6 > maxSize) {
  9790. return;
  9791. }
  9792. sizeCount = sizeCount + keySize + 6;
  9793. return value;
  9794. }
  9795. var valueSize = _this.calculateStringByteSize(value);
  9796. var rowSize = keySize + valueSize + 6;
  9797. if (rowSize + sizeCount > maxSize) return;
  9798. sizeCount = sizeCount + rowSize;
  9799. return value;
  9800. });
  9801. var outPut = JSON.parse(str);
  9802. if (addEndOut) {
  9803. if (Array.isArray(outPut)) {
  9804. outPut.push('(已截断其余部分)');
  9805. } else if ((0, _typeof2.default)(outPut) == "object") {
  9806. outPut["*注意"] = "(已截断其余部分)";
  9807. }
  9808. }
  9809. // console.log("compressObject use time: " + (new Date().getTime() - t));
  9810. return outPut;
  9811. } catch (error) {
  9812. console.log("compressObject error", error);
  9813. return "";
  9814. }
  9815. },
  9816. /**
  9817. * 压缩数组不超过特定大小
  9818. * @param {any[]} [arr=[]] 需要处理的数组
  9819. * @param {string} [delType='start'] 数组超出后删除的开始位置
  9820. * @param {number} [maxSize=1024 * 972] 数组最大字节数
  9821. */
  9822. compressArray: function compressArray() {
  9823. var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  9824. var delType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "start";
  9825. var maxSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024 * 972;
  9826. var t = new Date().getTime();
  9827. try {
  9828. if (!arr || arr.length == 0 || !arr[0]) return [];
  9829. var i = 0;
  9830. while (true) {
  9831. i = i + 1;
  9832. if (i > 999999) return arr;
  9833. if (!arr || arr.length == 0) {
  9834. return [];
  9835. }
  9836. if (this.calculateStringByteSize(arr) <= maxSize) {
  9837. // consoleLog("compressArray t=>" + (new Date().getTime() - t) + " i=>" + i)
  9838. return arr;
  9839. }
  9840. if (delType == "start") {
  9841. arr.splice(0, 1);
  9842. } else {
  9843. arr.splice(arr.length - 1, 1);
  9844. }
  9845. }
  9846. } catch (error) {
  9847. console.log("compressArray error", error);
  9848. return [];
  9849. }
  9850. },
  9851. /**
  9852. * 计算对象或字符串占用的字节大小,传入对象将自动转json
  9853. */
  9854. calculateStringByteSize: function calculateStringByteSize(str) {
  9855. try {
  9856. var type = (0, _typeof2.default)(str);
  9857. if (type == "bigint" || type == "number" || type == "boolean") {
  9858. return str.toString().length;
  9859. } else if (type == "function") {
  9860. str = str.toString().length;
  9861. } else if (str === null || str === undefined) {
  9862. return 0;
  9863. } else {
  9864. try {
  9865. str = this.safeJsonStringify(str);
  9866. if (str && str.hasOwnProperty) {
  9867. return str.length;
  9868. } else {
  9869. return 1024 * 20;
  9870. }
  9871. } catch (error) {
  9872. console.log("calculateStringByteSize error", error);
  9873. return 1024 * 20;
  9874. }
  9875. }
  9876. var size = 0;
  9877. for (var i = 0; i < str.length; i++) {
  9878. var charCode = str.charCodeAt(i);
  9879. if (charCode < 0x0080) {
  9880. size += 1;
  9881. } else if (charCode < 0x0800) {
  9882. size += 2;
  9883. } else if (charCode >= 0xD800 && charCode <= 0xDFFF) {
  9884. size += 4;
  9885. i++;
  9886. } else {
  9887. size += 3;
  9888. }
  9889. }
  9890. return size;
  9891. } catch (error) {
  9892. console.log("calculateStringByteSize error", error);
  9893. return 1024 * 1024;
  9894. }
  9895. },
  9896. /**
  9897. * 安全的js对象转字符串
  9898. */
  9899. safeJsonStringify: function safeJsonStringify(obj, handleValue) {
  9900. if (!obj) return "{}";
  9901. try {
  9902. if (handleValue) {
  9903. return JSON.stringify(obj, function (key, value) {
  9904. return handleValue(key, value);
  9905. });
  9906. } else {
  9907. return JSON.stringify(obj, function (key, value) {
  9908. return value;
  9909. });
  9910. }
  9911. } catch (error) {
  9912. // 尝试解析json失败,可能是变量循环引用的问题,继续尝试增加WeakSet解析
  9913. }
  9914. try {
  9915. var seen = new WeakSet();
  9916. var jsonStr = JSON.stringify(obj, function (key, value) {
  9917. if ((0, _typeof2.default)(value) == "object") {
  9918. try {
  9919. if (value instanceof File) {
  9920. value = "js:File";
  9921. }
  9922. if (value && value.constructor && value.constructor.name && typeof value.constructor.name == "string") {
  9923. var className = value.constructor.name;
  9924. if (className == "VueComponent") {
  9925. return "js:Object:VueComponent";
  9926. }
  9927. }
  9928. } catch (error) {}
  9929. }
  9930. if (typeof value == "function") {
  9931. try {
  9932. value = value.toString();
  9933. } catch (error) {
  9934. value = "js:function";
  9935. }
  9936. }
  9937. if ((0, _typeof2.default)(value) === "object" && value !== null) {
  9938. // 处理循环引用问题
  9939. if (seen.has(value)) {
  9940. return;
  9941. }
  9942. seen.add(value);
  9943. }
  9944. if (handleValue && typeof handleValue == "function") {
  9945. try {
  9946. return handleValue(key, value);
  9947. } catch (error) {
  9948. console.log("handleValue error", error);
  9949. }
  9950. return;
  9951. }
  9952. return value;
  9953. });
  9954. seen = null;
  9955. return jsonStr;
  9956. } catch (error) {
  9957. return "{}";
  9958. }
  9959. },
  9960. /**
  9961. * 根据限制的字节大小截取字符串
  9962. */
  9963. truncateStrBySize: function truncateStrBySize() {
  9964. var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  9965. var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20 * 1024;
  9966. try {
  9967. if (size < 1) return "";
  9968. if (this.calculateStringByteSize(str) <= size) return str;
  9969. var endStr = "";
  9970. if (size > 30) {
  9971. endStr = "(已截断多余部分)";
  9972. size = size - 30;
  9973. }
  9974. var low = 0,
  9975. high = str.length,
  9976. mid;
  9977. while (low < high) {
  9978. mid = Math.floor((low + high) / 2);
  9979. var currentSize = this.calculateStringByteSize(str.substring(0, mid));
  9980. if (currentSize > size) {
  9981. // 如果大于限制值,减小高边界
  9982. high = mid;
  9983. } else {
  9984. // 如果小于或等于限制值,增加低边界
  9985. low = mid + 1;
  9986. }
  9987. }
  9988. // 返回截断的字符串,注意low-1是因为low是最后一次检查超出大小时的位置
  9989. return str.substring(0, low - 1) + endStr;
  9990. } catch (error) {
  9991. console.log("truncateStrBySize error", error);
  9992. return "";
  9993. }
  9994. }
  9995. };
  9996. exports.default = _default;
  9997. /***/ }),
  9998. /* 41 */
  9999. /*!*************************************************************!*\
  10000. !*** E:/git/2021项目/v3-H5/devTools/core/libs/errorReport.js ***!
  10001. \*************************************************************/
  10002. /*! no static exports found */
  10003. /***/ (function(module, exports, __webpack_require__) {
  10004. "use strict";
  10005. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10006. Object.defineProperty(exports, "__esModule", {
  10007. value: true
  10008. });
  10009. exports.default = void 0;
  10010. var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
  10011. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
  10012. var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ./jsonCompress */ 40));
  10013. /**
  10014. * ! vue报错捕获
  10015. */
  10016. /**
  10017. * * vue错误日志上报
  10018. * @param {'ve'|'vw'|'oe'|'n'} type 错误类型
  10019. */
  10020. function errorReport(msg, trace) {
  10021. var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "n";
  10022. try {
  10023. if (!msg) return false;
  10024. if (msg instanceof Error) {
  10025. msg = msg.message;
  10026. }
  10027. var options = _devOptions.default.getOptions();
  10028. if (!options.error.status) return;
  10029. var page = "未知";
  10030. try {
  10031. var pages = getCurrentPages();
  10032. var item = pages[pages.length - 1];
  10033. if (item && item.route) {
  10034. page = item.route;
  10035. }
  10036. } catch (error) {}
  10037. var logs = _devCache.default.get("errorReport");
  10038. if (!logs) logs = [];
  10039. if (logs.length >= options.error.cache.rowMax) {
  10040. logs = logs.splice(0, options.error.cache.rowMax);
  10041. }
  10042. msg = String(msg);
  10043. msg = _jsonCompress.default.compressObject(msg, options.error.cache.rowSize / 2);
  10044. trace = String(trace);
  10045. trace = _jsonCompress.default.compressObject(trace, options.error.cache.rowSize / 2);
  10046. logs.unshift({
  10047. t: new Date().getTime(),
  10048. m: msg,
  10049. tr: trace,
  10050. p: page,
  10051. type: type
  10052. });
  10053. console.error("__ignoreReport__", msg, trace);
  10054. logs = _jsonCompress.default.compressArray(logs, "end", options.error.cache.size);
  10055. _devCache.default.set("errorReport", logs);
  10056. } catch (error) {
  10057. console.log("errorReport error: ", error);
  10058. }
  10059. }
  10060. var _default = errorReport;
  10061. exports.default = _default;
  10062. /***/ }),
  10063. /* 42 */
  10064. /*!****************************************************************!*\
  10065. !*** E:/git/2021项目/v3-H5/devTools/core/libs/createH5Bubble.js ***!
  10066. \****************************************************************/
  10067. /*! no static exports found */
  10068. /***/ (function(module, exports, __webpack_require__) {
  10069. "use strict";
  10070. Object.defineProperty(exports, "__esModule", {
  10071. value: true
  10072. });
  10073. exports.default = void 0;
  10074. /**
  10075. *! 创建h5页面上拖动的气泡标签
  10076. */
  10077. function createH5Bubble(options, devTools) {
  10078. var tagConfig = localStorage.getItem("devTools_tagConfig");
  10079. if (!tagConfig) {
  10080. tagConfig = {};
  10081. } else {
  10082. tagConfig = JSON.parse(tagConfig);
  10083. }
  10084. tagConfig = Object.assign({
  10085. show: options.bubble.status,
  10086. x: window.innerWidth - 90,
  10087. y: window.innerHeight - 90
  10088. }, tagConfig);
  10089. tagConfig.show = options.bubble.status;
  10090. // 拖动范围限制
  10091. var dragLimit = {
  10092. min: {
  10093. x: 0,
  10094. y: 0
  10095. },
  10096. max: {
  10097. x: window.innerWidth - 70,
  10098. y: window.innerHeight - 24
  10099. }
  10100. };
  10101. tagConfig.x = Math.min(Math.max(tagConfig.x, dragLimit.min.x), dragLimit.max.x);
  10102. tagConfig.y = Math.min(Math.max(tagConfig.y, dragLimit.min.y), dragLimit.max.y);
  10103. var tag = document.createElement("div");
  10104. tag.style = "\n box-sizing: border-box;\n position: fixed;\n z-index: 9999999;\n left: ".concat(tagConfig.x, "px;\n top: ").concat(tagConfig.y, "px;\n width: 70px;\n height: 24px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 4px;\n border-radius: 6px;\n background-color: ").concat(options.bubble.bgColor, ";\n color: ").concat(options.bubble.color, ";\n font-size: 10px;\n cursor: grab;\n box-shadow: 0px 0px 6px ").concat(options.bubble.bgColor, ";\n backdrop-filter: blur(1px);\n ");
  10105. tag.innerHTML = options.bubble.text;
  10106. tag.setAttribute("id", "debugTag");
  10107. if (tagConfig.show) {
  10108. document.body.appendChild(tag);
  10109. }
  10110. /**
  10111. * 标签单击事件
  10112. */
  10113. function tagClick() {
  10114. var pages = getCurrentPages();
  10115. var route = options.route.substring(1, options.route.length - 2);
  10116. if (pages[pages.length - 1].route == route) {
  10117. // 已经处于debug页面,不响应点击事件
  10118. return;
  10119. }
  10120. devTools.show();
  10121. }
  10122. var isTouch = false;
  10123. var touchStartPoint = {
  10124. clientX: 0,
  10125. clientY: 0,
  10126. tagX: tagConfig.x,
  10127. tagY: tagConfig.y,
  10128. hasMove: false
  10129. };
  10130. function touchStart(e) {
  10131. if (isTouch) return;
  10132. if (e.preventDefault) {
  10133. e.preventDefault();
  10134. }
  10135. var clientX = e.clientX ? e.clientX : e.targetTouches[0].clientX;
  10136. var clientY = e.clientX ? e.clientY : e.targetTouches[0].clientY;
  10137. touchStartPoint.clientX = clientX;
  10138. touchStartPoint.clientY = clientY;
  10139. touchStartPoint.tagX = tagConfig.x;
  10140. touchStartPoint.tagY = tagConfig.y;
  10141. touchStartPoint.hasMove = false;
  10142. isTouch = true;
  10143. }
  10144. function touchMove(e) {
  10145. if (!isTouch) return;
  10146. if (e.preventDefault) {
  10147. e.preventDefault();
  10148. }
  10149. var clientX = e.clientX ? e.clientX : e.targetTouches[0].clientX;
  10150. var clientY = e.clientX ? e.clientY : e.targetTouches[0].clientY;
  10151. touchStartPoint.hasMove = true;
  10152. var offsetX = touchStartPoint.clientX - clientX;
  10153. var offsetY = touchStartPoint.clientY - clientY;
  10154. var tx = touchStartPoint.tagX - offsetX;
  10155. var ty = touchStartPoint.tagY - offsetY;
  10156. tx = Math.min(Math.max(tx, dragLimit.min.x), dragLimit.max.x);
  10157. ty = Math.min(Math.max(ty, dragLimit.min.y), dragLimit.max.y);
  10158. tag.style.left = "".concat(tx, "px");
  10159. tag.style.top = "".concat(ty, "px");
  10160. tagConfig.x = tx;
  10161. tagConfig.y = ty;
  10162. }
  10163. function touchEnd(e) {
  10164. if (!isTouch) return;
  10165. if (e.preventDefault) {
  10166. e.preventDefault();
  10167. }
  10168. isTouch = false;
  10169. localStorage.setItem("devTools_tagConfig", JSON.stringify(tagConfig));
  10170. if (!touchStartPoint.hasMove) {
  10171. tagClick();
  10172. }
  10173. }
  10174. tag.addEventListener("touchstart", touchStart);
  10175. tag.addEventListener("touchmove", touchMove);
  10176. tag.addEventListener("touchend", touchEnd);
  10177. tag.addEventListener("mousedown", touchStart);
  10178. document.addEventListener("mousemove", touchMove);
  10179. document.addEventListener("mouseup", touchEnd);
  10180. localStorage.setItem("devTools_tagConfig", JSON.stringify(tagConfig));
  10181. }
  10182. var _default = createH5Bubble;
  10183. exports.default = _default;
  10184. /***/ }),
  10185. /* 43 */
  10186. /*!***********************************************************!*\
  10187. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/vueMixin.js ***!
  10188. \***********************************************************/
  10189. /*! no static exports found */
  10190. /***/ (function(module, exports, __webpack_require__) {
  10191. "use strict";
  10192. /* WEBPACK VAR INJECTION */(function(uni) {
  10193. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10194. Object.defineProperty(exports, "__esModule", {
  10195. value: true
  10196. });
  10197. exports.default = void 0;
  10198. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
  10199. var _logReport = _interopRequireDefault(__webpack_require__(/*! ../libs/logReport */ 37));
  10200. var _pageLinkList = _interopRequireDefault(__webpack_require__(/*! ../libs/pageLinkList */ 44));
  10201. var _pageStatistics = _interopRequireDefault(__webpack_require__(/*! ../libs/pageStatistics */ 45));
  10202. /**
  10203. * ! Vue页面混入,监听生命周期
  10204. */
  10205. var _default = {
  10206. data: function data() {
  10207. return {
  10208. /**
  10209. * 挂载dev页面对象
  10210. */
  10211. devTools_pageData: {
  10212. route: '',
  10213. // 页面路径
  10214. isOnShow: false,
  10215. // 是否处于展示状态
  10216. activeTime: 0 //活跃时间
  10217. }
  10218. };
  10219. },
  10220. /**
  10221. * *页面载入事件
  10222. */
  10223. onLoad: function onLoad(pageInitParams) {
  10224. var that = this;
  10225. // ! 注入 Eruda
  10226. var isInjectEruda = uni.getStorageSync("devTools_isInjectEruda") == "yes";
  10227. if (isInjectEruda) {
  10228. var ErudaCode = "\n if(!window.isInjectEruda){\n window.isInjectEruda = true;\n var script = document.createElement('script');\n script.src=\"https://cdn.jsdelivr.net/npm/eruda\";\n document.body.append(script);\n script.onload = function () {\n eruda.init();\n }\n }\n ";
  10229. var fun = 'e' + ['v'][0] + 'a' + ['l'][0];
  10230. try {} catch (error) {
  10231. console.log("devTools mixin onLoad injectEruda error ", error);
  10232. }
  10233. }
  10234. // ! 注入 vConsole
  10235. var isInjectVConsole = uni.getStorageSync("devTools_isInjectVConsole") == "yes";
  10236. if (isInjectVConsole) {
  10237. var vConsoleCode = "\n if(!window.isInjectVConsole){\n window.isInjectVConsole = true;\n var script = document.createElement('script');\n script.src=\"https://cdn.jsdelivr.net/npm/vconsole@latest/dist/vconsole.min.js\";\n document.body.append(script);\n script.onload = function () {\n let vConsoleObj = new window.VConsole();\n }\n }\n ";
  10238. var _fun = 'e' + ['v'][0] + 'a' + ['l'][0];
  10239. try {} catch (error) {
  10240. console.log("devTools mixin onLoad injectVConsole error ", error);
  10241. }
  10242. }
  10243. try {
  10244. var pages = getCurrentPages();
  10245. var pageItem = pages && pages.length > 0 ? pages[pages.length - 1] : null;
  10246. if (pageItem) {
  10247. var devSetting = _devOptions.default.getOptions();
  10248. if (pageItem.route == devSetting.devRoute) {
  10249. that.devTools_pageData = false;
  10250. } else {
  10251. that.devTools_pageData.route = pageItem.route;
  10252. (0, _logReport.default)("onLoad>".concat(pageItem.route, ">") + (pageInitParams ? JSON.stringify(pageInitParams) : ''));
  10253. setInterval(function () {
  10254. if (that.devTools_pageData && that.devTools_pageData.isOnShow) {
  10255. that.devTools_pageData.activeTime = that.devTools_pageData.activeTime + 1;
  10256. }
  10257. }, 1000);
  10258. }
  10259. }
  10260. _pageLinkList.default.pushPageRouteMap(pages);
  10261. } catch (error) {
  10262. console.log("devTools mixin onLoad error ", error);
  10263. }
  10264. },
  10265. /**
  10266. * *页面展示事件
  10267. */
  10268. onShow: function onShow() {
  10269. try {
  10270. var that = this;
  10271. if (that.devTools_pageData) {
  10272. that.devTools_pageData.isOnShow = true;
  10273. that.devTools_pageData.activeTime = 0;
  10274. }
  10275. } catch (error) {
  10276. console.log("devTools mixin onShow error ", error);
  10277. }
  10278. },
  10279. /**
  10280. * *页面隐藏事件
  10281. */
  10282. onHide: function onHide() {
  10283. try {
  10284. var that = this;
  10285. if (that.devTools_pageData) {
  10286. that.devTools_pageData.isOnShow = false;
  10287. (0, _pageStatistics.default)(that.devTools_pageData.route, that.devTools_pageData.activeTime);
  10288. that.devTools_pageData.activeTime = 0;
  10289. }
  10290. } catch (error) {
  10291. console.log("devTools mixin onHide error ", error);
  10292. }
  10293. },
  10294. /**
  10295. * * 页面卸载事件
  10296. */
  10297. onUnload: function onUnload() {
  10298. try {
  10299. var that = this;
  10300. (0, _logReport.default)("onUnload>".concat(that.devTools_pageData.route));
  10301. that.devTools_pageData = null;
  10302. } catch (error) {
  10303. console.log("devTools mixin onUnload error ", error);
  10304. }
  10305. }
  10306. };
  10307. exports.default = _default;
  10308. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10309. /***/ }),
  10310. /* 44 */
  10311. /*!**************************************************************!*\
  10312. !*** E:/git/2021项目/v3-H5/devTools/core/libs/pageLinkList.js ***!
  10313. \**************************************************************/
  10314. /*! no static exports found */
  10315. /***/ (function(module, exports, __webpack_require__) {
  10316. "use strict";
  10317. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10318. Object.defineProperty(exports, "__esModule", {
  10319. value: true
  10320. });
  10321. exports.default = void 0;
  10322. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10323. var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
  10324. var _default = {
  10325. pageRouteMap: [],
  10326. pageRouteKeyMap: {},
  10327. /**
  10328. * 安装路径分析插件
  10329. */
  10330. install: function install() {
  10331. var allRoutes = this.getAllRoutes();
  10332. var pageRouteKeyMap = _devCache.default.get("pageRouteKeyMap");
  10333. if (!pageRouteKeyMap || (0, _typeof2.default)(pageRouteKeyMap) != "object") {
  10334. pageRouteKeyMap = {};
  10335. }
  10336. var lastNo = 0;
  10337. Object.keys(pageRouteKeyMap).forEach(function (key) {
  10338. var item = Number(pageRouteKeyMap[key]);
  10339. if (item > lastNo) {
  10340. lastNo = item;
  10341. }
  10342. });
  10343. allRoutes.forEach(function (item) {
  10344. if (!pageRouteKeyMap[item.path]) {
  10345. pageRouteKeyMap[item.path] = lastNo + 1;
  10346. lastNo = lastNo + 1;
  10347. }
  10348. });
  10349. _devCache.default.set("pageRouteKeyMap", pageRouteKeyMap);
  10350. this.pageRouteKeyMap = pageRouteKeyMap;
  10351. var pageRouteMap = _devCache.default.get("pageRouteMap");
  10352. if (!pageRouteMap || (0, _typeof2.default)(pageRouteMap) != "object") {
  10353. pageRouteMap = {};
  10354. }
  10355. Object.keys(pageRouteMap).forEach(function (key) {
  10356. try {
  10357. var n = Number(pageRouteMap[key]);
  10358. if (!Number.isInteger(n) || n < 0) {
  10359. pageRouteMap[key] = 1;
  10360. }
  10361. } catch (error) {}
  10362. });
  10363. this.pageRouteMap = pageRouteMap;
  10364. this.saveData();
  10365. },
  10366. /**
  10367. * 获取APP注册的所有路由
  10368. * @returns {{path: string}[]} 返回路由列表
  10369. */
  10370. getAllRoutes: function getAllRoutes() {
  10371. var pages = [];
  10372. try {
  10373. var wxPages = __wxConfig.pages;
  10374. wxPages.map(function (item) {
  10375. pages.push({
  10376. path: "/" + item
  10377. });
  10378. });
  10379. } catch (error) {
  10380. pages = [];
  10381. }
  10382. return pages;
  10383. },
  10384. /**
  10385. * 写入路由列表
  10386. */
  10387. pushPageRouteMap: function pushPageRouteMap() {
  10388. var _this = this;
  10389. var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  10390. if (!list || list.length == 0) {
  10391. list = getCurrentPages();
  10392. }
  10393. var key = "";
  10394. list.forEach(function (item) {
  10395. var path = item.route.indexOf("/") == 0 ? item.route : "/" + item.route;
  10396. var keyItem = _this.pageRouteKeyMap[path];
  10397. if (!keyItem) {
  10398. keyItem = path;
  10399. }
  10400. if (key == "") {
  10401. key = keyItem + "";
  10402. } else {
  10403. key = key + "," + keyItem;
  10404. }
  10405. });
  10406. if (this.pageRouteMap[key]) {
  10407. this.pageRouteMap[key] = this.pageRouteMap[key] + 1;
  10408. } else {
  10409. this.pageRouteMap[key] = 1;
  10410. }
  10411. },
  10412. /**
  10413. * 保存路由缓存
  10414. */
  10415. saveData: function saveData() {
  10416. var that = this;
  10417. setTimeout(function () {
  10418. _devCache.default.set("pageRouteMap", that.pageRouteMap);
  10419. setTimeout(function () {
  10420. that.saveData();
  10421. }, 500);
  10422. }, Math.round(Math.random() * 3 * 1000) + 2000);
  10423. }
  10424. };
  10425. exports.default = _default;
  10426. /***/ }),
  10427. /* 45 */
  10428. /*!****************************************************************!*\
  10429. !*** E:/git/2021项目/v3-H5/devTools/core/libs/pageStatistics.js ***!
  10430. \****************************************************************/
  10431. /*! no static exports found */
  10432. /***/ (function(module, exports, __webpack_require__) {
  10433. "use strict";
  10434. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10435. Object.defineProperty(exports, "__esModule", {
  10436. value: true
  10437. });
  10438. exports.default = void 0;
  10439. var _devCache = _interopRequireDefault(__webpack_require__(/*! ./devCache */ 38));
  10440. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ./devOptions */ 39));
  10441. var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ./jsonCompress */ 40));
  10442. var _timeFormat = __webpack_require__(/*! ./timeFormat */ 46);
  10443. /**
  10444. * !页面统计:访问次数、停留时长
  10445. */
  10446. /**
  10447. * 页面注销时提交
  10448. */
  10449. function pageStatisticsReport(route, activeTime) {
  10450. try {
  10451. if (!route) return false;
  10452. var options = _devOptions.default.getOptions();
  10453. if (!options.pageStatistics.status) return; //! 配置文件关闭页面统计
  10454. var logs = _devCache.default.get("pageCount");
  10455. if (!logs) logs = [];
  10456. var pageIndex = logs.findIndex(function (x) {
  10457. return x.route == route;
  10458. });
  10459. if (pageIndex == -1) {
  10460. logs.push({
  10461. route: route,
  10462. activeTimeCount: activeTime
  10463. });
  10464. } else {
  10465. logs[pageIndex].activeTimeCount = activeTime + logs[pageIndex].activeTimeCount;
  10466. }
  10467. logs = _jsonCompress.default.compressArray(logs, "end", options.pageStatistics.size);
  10468. _devCache.default.set("pageCount", logs);
  10469. var now = new Date().getTime();
  10470. var date = (0, _timeFormat.timeFormat)(now, "yyyy-mm-dd");
  10471. var dayOnline = _devCache.default.get("dayOnline");
  10472. if (!dayOnline) dayOnline = [];
  10473. var i = dayOnline.findIndex(function (x) {
  10474. return x.date == date;
  10475. });
  10476. if (i == -1) {
  10477. dayOnline.unshift({
  10478. date: date,
  10479. activeTimeCount: activeTime,
  10480. page: [{
  10481. r: route,
  10482. t: activeTime
  10483. }]
  10484. });
  10485. } else {
  10486. dayOnline[i].activeTimeCount = dayOnline[i].activeTimeCount + activeTime;
  10487. var pi = dayOnline[i].page.findIndex(function (x) {
  10488. return x.r == route;
  10489. });
  10490. if (pi == -1) {
  10491. dayOnline[i].page.push({
  10492. r: route,
  10493. t: activeTime
  10494. });
  10495. } else {
  10496. dayOnline[i].page[pi].t = dayOnline[i].page[pi].t + activeTime;
  10497. }
  10498. }
  10499. if (dayOnline.length > options.pageStatistics.dayOnlineRowMax) {
  10500. dayOnline = dayOnline.splice(0, options.pageStatistics.dayOnlineRowMax);
  10501. }
  10502. dayOnline = _jsonCompress.default.compressArray(dayOnline, "end", options.pageStatistics.size);
  10503. _devCache.default.set("dayOnline", dayOnline);
  10504. } catch (error) {
  10505. console.log("pageStatistics error", error);
  10506. }
  10507. }
  10508. var _default = pageStatisticsReport;
  10509. exports.default = _default;
  10510. /***/ }),
  10511. /* 46 */
  10512. /*!************************************************************!*\
  10513. !*** E:/git/2021项目/v3-H5/devTools/core/libs/timeFormat.js ***!
  10514. \************************************************************/
  10515. /*! no static exports found */
  10516. /***/ (function(module, exports, __webpack_require__) {
  10517. "use strict";
  10518. Object.defineProperty(exports, "__esModule", {
  10519. value: true
  10520. });
  10521. exports.timeFormat = timeFormat;
  10522. exports.timeFromNow = timeFromNow;
  10523. // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
  10524. // 所以这里做一个兼容polyfill的兼容处理
  10525. try {
  10526. if (!String.prototype.padStart) {
  10527. // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
  10528. String.prototype.padStart = function (maxLength) {
  10529. var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
  10530. if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError('fillString must be String');
  10531. var str = this;
  10532. // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
  10533. if (str.length >= maxLength) return String(str);
  10534. var fillLength = maxLength - str.length,
  10535. times = Math.ceil(fillLength / fillString.length);
  10536. while (times >>= 1) {
  10537. fillString += fillString;
  10538. if (times === 1) {
  10539. fillString += fillString;
  10540. }
  10541. }
  10542. return fillString.slice(0, fillLength) + str;
  10543. };
  10544. }
  10545. } catch (error) {
  10546. console.log("timeFormat fillString error", error);
  10547. }
  10548. // 其他更多是格式化有如下:
  10549. // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
  10550. function timeFormat() {
  10551. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  10552. var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd hh:MM:ss';
  10553. try {
  10554. // 如果为null,则格式化当前时间
  10555. if (!dateTime) dateTime = Number(new Date());
  10556. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  10557. if (dateTime.toString().length == 10) dateTime *= 1000;
  10558. var date = new Date(dateTime);
  10559. var ret;
  10560. var opt = {
  10561. "y+": date.getFullYear().toString(),
  10562. // 年
  10563. "m+": (date.getMonth() + 1).toString(),
  10564. // 月
  10565. "d+": date.getDate().toString(),
  10566. // 日
  10567. "h+": date.getHours().toString(),
  10568. // 时
  10569. "M+": date.getMinutes().toString(),
  10570. // 分
  10571. "s+": date.getSeconds().toString() // 秒
  10572. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  10573. };
  10574. for (var k in opt) {
  10575. ret = new RegExp("(" + k + ")").exec(fmt);
  10576. if (ret) {
  10577. fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
  10578. }
  10579. ;
  10580. }
  10581. ;
  10582. return fmt;
  10583. } catch (error) {
  10584. console.log("timeFormat error", error);
  10585. return "unknown error";
  10586. }
  10587. }
  10588. function timeFromNow(timestamp) {
  10589. try {
  10590. var now = new Date().getTime();
  10591. var diff = timestamp - now;
  10592. // 确定是过去还是未来
  10593. var suffix = diff > 0 ? "后" : "前";
  10594. diff = Math.abs(diff);
  10595. // 计算时间差异
  10596. var seconds = Math.floor(diff / 1000);
  10597. var minutes = Math.floor(seconds / 60);
  10598. var hours = Math.floor(minutes / 60);
  10599. var days = Math.floor(hours / 24);
  10600. var months = Math.floor(days / 30);
  10601. var years = Math.floor(days / 365);
  10602. // 根据时间差异返回相应的字符串
  10603. if (seconds < 60) {
  10604. return "".concat(seconds, "\u79D2").concat(suffix);
  10605. } else if (minutes < 60) {
  10606. return "".concat(minutes, "\u5206\u949F").concat(suffix);
  10607. } else if (hours < 24) {
  10608. return "".concat(hours, "\u5C0F\u65F6").concat(suffix);
  10609. } else if (days < 30) {
  10610. return "".concat(days, "\u5929").concat(suffix);
  10611. } else if (months < 12) {
  10612. return "".concat(months, "\u4E2A\u6708").concat(suffix);
  10613. } else {
  10614. return "".concat(years, "\u5E74").concat(suffix);
  10615. }
  10616. } catch (error) {
  10617. console.log("timeFromNow error", error);
  10618. }
  10619. }
  10620. /***/ }),
  10621. /* 47 */
  10622. /*!********************************************************!*\
  10623. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/index.js ***!
  10624. \********************************************************/
  10625. /*! no static exports found */
  10626. /***/ (function(module, exports, __webpack_require__) {
  10627. "use strict";
  10628. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10629. Object.defineProperty(exports, "__esModule", {
  10630. value: true
  10631. });
  10632. exports.default = devToolsProxyInstall;
  10633. var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
  10634. var _console = _interopRequireDefault(__webpack_require__(/*! ./console */ 48));
  10635. var _request = _interopRequireDefault(__webpack_require__(/*! ./request */ 49));
  10636. var _storage = _interopRequireDefault(__webpack_require__(/*! ./storage */ 53));
  10637. var _uniBus = _interopRequireDefault(__webpack_require__(/*! ./uniBus */ 54));
  10638. var _uniListen = _interopRequireDefault(__webpack_require__(/*! ./uniListen */ 55));
  10639. /**
  10640. * dev调试工具初始化
  10641. */
  10642. function devToolsProxyInstall(options) {
  10643. try {
  10644. if (options.network && options.network.status) {
  10645. _request.default.install();
  10646. }
  10647. if (options.console && options.console.status) {
  10648. _console.default.install();
  10649. }
  10650. if (options.logs && options.logs.status) {
  10651. _uniListen.default.install();
  10652. }
  10653. _storage.default.install();
  10654. if (options.uniBus && options.uniBus.status) {
  10655. _uniBus.default.install();
  10656. }
  10657. _devCache.default.syncLocalCache();
  10658. } catch (error) {
  10659. _console.default.log("devToolsProxyInstall error", error);
  10660. }
  10661. }
  10662. /***/ }),
  10663. /* 48 */
  10664. /*!**********************************************************!*\
  10665. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/console.js ***!
  10666. \**********************************************************/
  10667. /*! no static exports found */
  10668. /***/ (function(module, exports, __webpack_require__) {
  10669. "use strict";
  10670. /* WEBPACK VAR INJECTION */(function(uni) {
  10671. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10672. Object.defineProperty(exports, "__esModule", {
  10673. value: true
  10674. });
  10675. exports.default = void 0;
  10676. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  10677. var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
  10678. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
  10679. var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ../libs/jsonCompress */ 40));
  10680. var _default = {
  10681. logList: [],
  10682. options: null,
  10683. /**
  10684. * 挂载打印拦截器
  10685. */
  10686. install: function install() {
  10687. var that = this;
  10688. this.options = _devOptions.default.getOptions();
  10689. if (!this.options.console.status) return;
  10690. this.logList = _devCache.default.get("console");
  10691. if (!this.logList) this.logList = [];
  10692. this.syncReqData(); //同步缓存
  10693. if (uni.__log__) {
  10694. // ! VUE3在app端时有这个特殊的方法
  10695. that.mountUniConsole();
  10696. } else {
  10697. that.mountJsConsole();
  10698. }
  10699. //! 删除指定记录
  10700. uni.$on("devTools_delConsoleItem", function (item) {
  10701. var i = that.logList.findIndex(function (x) {
  10702. var t = JSON.stringify(x.list);
  10703. return t == JSON.stringify(item.list) && x.time == item.time && x.page == item.page && x.type == item.type;
  10704. });
  10705. if (i != -1) {
  10706. that.logList.splice(i, 1);
  10707. }
  10708. that.saveData();
  10709. });
  10710. //! 清空console日志
  10711. uni.$on("devTools_delConsoleAll", function () {
  10712. that.logList = [];
  10713. that.saveData();
  10714. });
  10715. },
  10716. /**
  10717. * 同步请求信息到缓存数据中
  10718. */
  10719. syncReqData: function syncReqData() {
  10720. var that = this;
  10721. setTimeout(function () {
  10722. try {
  10723. that.saveData();
  10724. } catch (error) {
  10725. console.log("console.syncReqData error", error);
  10726. }
  10727. that.syncReqData();
  10728. }, 3000);
  10729. },
  10730. /**
  10731. * 同步数据到缓存
  10732. */
  10733. saveData: function saveData() {
  10734. var that = this;
  10735. that.logList = _jsonCompress.default.compressArray(that.logList, 'end', that.options.console.cache.size);
  10736. _devCache.default.set("console", that.logList);
  10737. },
  10738. /**
  10739. * 挂载监听js自带的console函数
  10740. */
  10741. mountJsConsole: function mountJsConsole() {
  10742. var that = this;
  10743. try {
  10744. var _error = function _error() {
  10745. try {
  10746. var args = Array.prototype.slice.call(arguments);
  10747. if (args[0] && typeof args[0] == "string" && (args[0] == "__ignoreReport__" //! 忽略错误日志上报
  10748. || args[0].indexOf("__ignoreReport__") == 0)) {
  10749. var _args = [];
  10750. if (args.length > 1) {
  10751. for (var _i2 = 0; _i2 < args.length; _i2++) {
  10752. if (_i2 != 0) {
  10753. _args.push(args[_i2]);
  10754. }
  10755. }
  10756. } else {
  10757. _args[0] = args[0];
  10758. _args[0] = _args[0].replace("__ignoreReport__", "");
  10759. }
  10760. if (that.options.console.isOutput) {
  10761. _e.apply(void 0, _args);
  10762. }
  10763. return;
  10764. }
  10765. replaceConsole("error", args);
  10766. } catch (error) {
  10767. _e("监听console.error出错", error);
  10768. }
  10769. };
  10770. /**
  10771. * 替换系统打印函数
  10772. */
  10773. var replaceConsole = function replaceConsole(type, args) {
  10774. try {
  10775. var data = [];
  10776. if (args && args.length > 0) {
  10777. var argList = args;
  10778. var oneSize = that.options.console.cache.rowSize / argList.length;
  10779. for (var _i3 = 0; _i3 < argList.length; _i3++) {
  10780. var row = _jsonCompress.default.compressObject(argList[_i3], oneSize);
  10781. data.push(row);
  10782. }
  10783. } else {
  10784. data = [];
  10785. }
  10786. var page = "未知";
  10787. try {
  10788. var pages = getCurrentPages();
  10789. var item = pages[pages.length - 1];
  10790. if (item && item.route) {
  10791. page = item.route;
  10792. }
  10793. } catch (error) {}
  10794. that.logList.unshift({
  10795. list: data,
  10796. time: new Date().getTime(),
  10797. page: page,
  10798. type: type
  10799. });
  10800. if (that.options.console.isOutput) {
  10801. if (type == "error") {
  10802. _e.apply(void 0, (0, _toConsumableArray2.default)(args));
  10803. } else if (type == "warn") {
  10804. _w.apply(void 0, (0, _toConsumableArray2.default)(args));
  10805. } else if (type == "info") {
  10806. _i.apply(void 0, (0, _toConsumableArray2.default)(args));
  10807. } else {
  10808. _l.apply(void 0, (0, _toConsumableArray2.default)(args));
  10809. }
  10810. }
  10811. } catch (error) {
  10812. if (that.options.console.isOutput) {
  10813. _e("监听console出错", error);
  10814. }
  10815. }
  10816. };
  10817. var _l = console.log;
  10818. try {
  10819. globalThis.consoleLog = function () {
  10820. var _console;
  10821. (_console = console).log.apply(_console, arguments);
  10822. };
  10823. } catch (error) {}
  10824. try {
  10825. window.consoleLog = function () {
  10826. var _console2;
  10827. (_console2 = console).log.apply(_console2, arguments);
  10828. };
  10829. } catch (error) {}
  10830. console.log = function () {
  10831. replaceConsole("log", arguments);
  10832. };
  10833. var _e = console.error;
  10834. console.error = _error;
  10835. var _w = console.warn;
  10836. console.warn = function () {
  10837. replaceConsole("warn", arguments);
  10838. };
  10839. var _i = console.info;
  10840. console.info = function () {
  10841. replaceConsole("info", arguments);
  10842. };
  10843. } catch (error) {
  10844. console.log("console.install error", error);
  10845. }
  10846. },
  10847. /**
  10848. * 挂载监听uni自带的打印函数
  10849. */
  10850. mountUniConsole: function mountUniConsole() {
  10851. var that = this;
  10852. try {
  10853. /**
  10854. * 替换系统打印函数
  10855. */
  10856. var replaceConsole = function replaceConsole(type, args) {
  10857. try {
  10858. var data = [];
  10859. if (args && args.length > 0) {
  10860. var argList = args;
  10861. var oneSize = that.options.console.cache.rowSize / argList.length;
  10862. for (var _i6 = 0; _i6 < argList.length; _i6++) {
  10863. var row = _jsonCompress.default.compressObject(argList[_i6], oneSize);
  10864. data.push(row);
  10865. }
  10866. } else {
  10867. data = [];
  10868. }
  10869. var page = "未知";
  10870. try {
  10871. var pages = getCurrentPages();
  10872. var item = pages[pages.length - 1];
  10873. if (item && item.route) {
  10874. page = item.route;
  10875. }
  10876. } catch (error) {}
  10877. that.logList.unshift({
  10878. list: data,
  10879. time: new Date().getTime(),
  10880. page: page,
  10881. type: type
  10882. });
  10883. if (that.options.console.isOutput) {
  10884. if (type == "error") {
  10885. e.apply(void 0, (0, _toConsumableArray2.default)(args));
  10886. } else if (type == "warn") {
  10887. w.apply(void 0, (0, _toConsumableArray2.default)(args));
  10888. } else if (type == "info") {
  10889. i.apply(void 0, (0, _toConsumableArray2.default)(args));
  10890. } else {
  10891. l.apply(void 0, (0, _toConsumableArray2.default)(args));
  10892. }
  10893. }
  10894. } catch (error) {
  10895. if (that.options.console.isOutput) {
  10896. e("监听console出错", error);
  10897. }
  10898. }
  10899. };
  10900. var uniSysConsole = uni.__log__;
  10901. try {
  10902. globalThis.consoleLog = function () {
  10903. var _uni;
  10904. (_uni = uni).__log__.apply(_uni, ["log", "未知来源"].concat(Array.prototype.slice.call(arguments)));
  10905. };
  10906. } catch (error) {}
  10907. try {
  10908. window.consoleLog = function () {
  10909. var _uni2;
  10910. (_uni2 = uni).__log__.apply(_uni2, ["log", "未知来源"].concat(Array.prototype.slice.call(arguments)));
  10911. };
  10912. } catch (error) {}
  10913. uni.__log__ = function (type, line) {
  10914. try {
  10915. for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
  10916. args[_key - 2] = arguments[_key];
  10917. }
  10918. // 处理特殊情况 "__ignoreReport__" 忽略错误日志上报
  10919. if (type == "error") {
  10920. if (args[0] && typeof args[0] == "string" && (args[0] == "__ignoreReport__" //! 忽略错误日志上报
  10921. || args[0].indexOf("__ignoreReport__") == 0)) {
  10922. var _args = [];
  10923. if (args.length > 1) {
  10924. for (var _i4 = 0; _i4 < args.length; _i4++) {
  10925. if (_i4 != 0) {
  10926. _args.push(args[_i4]);
  10927. }
  10928. }
  10929. } else {
  10930. _args[0] = args[0];
  10931. _args[0] = _args[0].replace("__ignoreReport__", "");
  10932. }
  10933. if (that.options.console.isOutput) {
  10934. uniSysConsole.apply(void 0, [type, line].concat(_args));
  10935. }
  10936. return;
  10937. }
  10938. }
  10939. var data = [];
  10940. if (args && args.length > 0) {
  10941. var argList = args;
  10942. var oneSize = that.options.console.cache.rowSize / argList.length;
  10943. for (var _i5 = 0; _i5 < argList.length; _i5++) {
  10944. var row = _jsonCompress.default.compressObject(argList[_i5], oneSize);
  10945. data.push(row);
  10946. }
  10947. } else {
  10948. data = [];
  10949. }
  10950. var page = "未知";
  10951. try {
  10952. var pages = getCurrentPages();
  10953. var item = pages[pages.length - 1];
  10954. if (item && item.route) {
  10955. page = item.route;
  10956. }
  10957. } catch (error) {}
  10958. data.push(line);
  10959. that.logList.unshift({
  10960. list: data,
  10961. time: new Date().getTime(),
  10962. page: page,
  10963. type: type
  10964. });
  10965. if (that.options.console.isOutput) {
  10966. uniSysConsole.apply(void 0, [type, line].concat((0, _toConsumableArray2.default)(data)));
  10967. }
  10968. } catch (error) {
  10969. if (that.options.console.isOutput) {
  10970. uniSysConsole("error", "监听console出错", error);
  10971. }
  10972. }
  10973. };
  10974. } catch (error) {
  10975. console.log("console.install error", error);
  10976. }
  10977. }
  10978. };
  10979. exports.default = _default;
  10980. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10981. /***/ }),
  10982. /* 49 */
  10983. /*!**********************************************************!*\
  10984. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/request.js ***!
  10985. \**********************************************************/
  10986. /*! no static exports found */
  10987. /***/ (function(module, exports, __webpack_require__) {
  10988. "use strict";
  10989. /* WEBPACK VAR INJECTION */(function(uni) {
  10990. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10991. Object.defineProperty(exports, "__esModule", {
  10992. value: true
  10993. });
  10994. exports.default = void 0;
  10995. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 50));
  10996. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10997. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 52));
  10998. var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
  10999. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
  11000. var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ../libs/jsonCompress */ 40));
  11001. var _default = {
  11002. /**
  11003. * 请求日志示例
  11004. */
  11005. ajaxLogData: {
  11006. id: 0,
  11007. //请求id
  11008. type: 0,
  11009. // 0发起请求中 1请求成功 2请求失败
  11010. sendTime: 0,
  11011. //发送请求的时间
  11012. responseTime: 0,
  11013. //响应时间
  11014. useTime: 0,
  11015. //请求总耗时
  11016. url: "",
  11017. //请求地址
  11018. header: "",
  11019. //请求头
  11020. method: "get",
  11021. //请求方式
  11022. data: "",
  11023. //请求参数
  11024. responseBody: "",
  11025. //响应主体
  11026. responseHeader: "",
  11027. //响应头
  11028. responseStatus: "",
  11029. //响应编码
  11030. responseMsg: "" //响应报错信息
  11031. },
  11032. options: null,
  11033. /**
  11034. * 请求的数据列表
  11035. */
  11036. ajaxData: [],
  11037. /**
  11038. * 挂载请求拦截器
  11039. */
  11040. install: function install() {
  11041. var _this = this;
  11042. var that = this;
  11043. try {
  11044. this.options = _devOptions.default.getOptions();
  11045. if (!this.options.network.status) return;
  11046. this.ajaxData = _devCache.default.get("request");
  11047. if (!this.ajaxData) this.ajaxData = [];
  11048. this.syncReqData(); //同步缓存
  11049. uni.addInterceptor('request', {
  11050. /**
  11051. * 入参
  11052. */
  11053. invoke: function invoke(args) {
  11054. try {
  11055. args._id_ = new Date().getTime() + '_' + Number(Math.random().toString().replace("0.", ""));
  11056. var copyData = JSON.parse(JSON.stringify(that.ajaxLogData));
  11057. copyData.id = args._id_;
  11058. copyData.sendTime = new Date().getTime();
  11059. copyData.url = that.dataCopy(args.url);
  11060. copyData.header = that.dataCopy(args.header);
  11061. if (!args.method) {
  11062. copyData.method = "get";
  11063. } else {
  11064. copyData.method = that.dataCopy(args.method);
  11065. }
  11066. var cSize = _jsonCompress.default.calculateStringByteSize(copyData);
  11067. if (cSize > that.options.network.cache.rowSize) {
  11068. copyData = _jsonCompress.default.compressObject(copyData, that.options.network.cache.rowSize);
  11069. } else {
  11070. var data = _jsonCompress.default.compressObject(args.data, that.options.network.cache.rowSize - cSize);
  11071. try {
  11072. data = JSON.parse(data);
  11073. } catch (error) {}
  11074. copyData.data = data;
  11075. }
  11076. that.ajaxData.unshift(copyData);
  11077. } catch (error) {
  11078. console.error("request拦截器invoke出错", error);
  11079. }
  11080. },
  11081. success: function success(response, request) {
  11082. return new Promise( /*#__PURE__*/function () {
  11083. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(yes, err) {
  11084. var speedLimit, delayDuration, sleepParam, sleepTime, resTimeout, isFail, targetPro, randPro, item, size, data, json;
  11085. return _regenerator.default.wrap(function _callee$(_context) {
  11086. while (1) {
  11087. switch (_context.prev = _context.next) {
  11088. case 0:
  11089. //! 延迟请求返回,模拟弱网环境
  11090. speedLimit = uni.getStorageSync("devtools_uniResLimitType");
  11091. if (!speedLimit) {
  11092. _context.next = 9;
  11093. break;
  11094. }
  11095. delayDuration = {
  11096. "2g": [30, 60],
  11097. "3g-": [10, 30],
  11098. "3g": [3, 10],
  11099. "4g": [0.5, 3]
  11100. };
  11101. sleepParam = delayDuration[speedLimit];
  11102. if (!sleepParam) {
  11103. _context.next = 9;
  11104. break;
  11105. }
  11106. sleepTime = rNum(sleepParam[0], sleepParam[1]);
  11107. _context.next = 8;
  11108. return sleep(sleepTime * 1000);
  11109. case 8:
  11110. response.errMsg = response.errMsg + " | [devtools\u6A21\u62DF\u5F31\u7F51\u5EF6\u8FDF:".concat(sleepTime, "s]");
  11111. case 9:
  11112. // ! 随机响应失败概率
  11113. resTimeout = uni.getStorageSync("devtools_uniResTimeout");
  11114. isFail = false;
  11115. if (resTimeout && resTimeout > 1) {
  11116. targetPro = Number(resTimeout);
  11117. randPro = rNum(0, 100);
  11118. if (randPro < targetPro) {
  11119. // 命中失败
  11120. response.statusCode = rNum(400, 600); //生成随机400 ~ 600之间的状态码
  11121. response.errMsg = response.errMsg + " | [devtools\u968F\u673A\u8D85\u65F6\u62A5\u9519\uFF0C\u5F53\u524D\u547D\u4E2D\u7684\u6982\u7387\u9636\u5C42\u4E3A:".concat(targetPro, "%\uFF0C\u751F\u6210\u7684\u968F\u673A\u6570\u4E3A\uFF1A").concat(randPro, "]");
  11122. response.data = "[devTools]模拟请求失败结果!";
  11123. isFail = true;
  11124. }
  11125. }
  11126. // ! 记录响应内容
  11127. _context.prev = 12;
  11128. item = that.ajaxData.find(function (x) {
  11129. return x.id == request._id_;
  11130. });
  11131. if (item) {
  11132. _context.next = 16;
  11133. break;
  11134. }
  11135. return _context.abrupt("return");
  11136. case 16:
  11137. item.responseBodySize = _jsonCompress.default.calculateStringByteSize(response.data);
  11138. item.responseMsg = response.errMsg;
  11139. item.responseStatus = response.statusCode;
  11140. item.responseHeader = response.header;
  11141. item.type = 1;
  11142. item.responseTime = new Date().getTime();
  11143. item.useTime = ((item.responseTime - item.sendTime) / 1000).toFixed(3);
  11144. size = _jsonCompress.default.calculateStringByteSize(item);
  11145. if (size > that.options.network.cache.rowSize) {
  11146. item.responseBody = "[内容太长已截断多余部分]";
  11147. data = _jsonCompress.default.compressObject(item, that.options.network.cache.rowSize);
  11148. that.ajaxData[that.ajaxData.findIndex(function (x) {
  11149. return x.id == request._id_;
  11150. })] = data;
  11151. } else {
  11152. json = response.data;
  11153. try {
  11154. json = JSON.parse(JSON.stringify(json));
  11155. } catch (error) {}
  11156. item.responseBody = _jsonCompress.default.compressObject(json, that.options.network.cache.rowSize - size);
  11157. }
  11158. _context.next = 30;
  11159. break;
  11160. case 27:
  11161. _context.prev = 27;
  11162. _context.t0 = _context["catch"](12);
  11163. console.error("request拦截器success出错", _context.t0);
  11164. case 30:
  11165. if (isFail) {
  11166. err(response.data);
  11167. } else {
  11168. yes(response);
  11169. }
  11170. case 31:
  11171. case "end":
  11172. return _context.stop();
  11173. }
  11174. }
  11175. }, _callee, null, [[12, 27]]);
  11176. }));
  11177. return function (_x, _x2) {
  11178. return _ref.apply(this, arguments);
  11179. };
  11180. }());
  11181. },
  11182. fail: function fail(err, request) {
  11183. try {
  11184. var item = that.ajaxData.find(function (x) {
  11185. return x.id == request._id_;
  11186. });
  11187. if (!item) return;
  11188. item.type = 2;
  11189. item.responseTime = new Date().getTime();
  11190. item.useTime = ((item.responseTime - item.sendTime) / 1000).toFixed(3);
  11191. item.responseMsg = err.errMsg;
  11192. } catch (error) {
  11193. console.error("request拦截器fail出错", error);
  11194. }
  11195. },
  11196. complete: function complete(res) {}
  11197. });
  11198. // ! 删除指定请求记录
  11199. uni.$on("devTools_delNetworkItemById", function (id) {
  11200. var i = _this.ajaxData.findIndex(function (x) {
  11201. return x.id == id;
  11202. });
  11203. if (i != -1) {
  11204. _this.ajaxData.splice(i, 1);
  11205. }
  11206. _this.saveData();
  11207. });
  11208. // ! 清空请求记录
  11209. uni.$on("devTools_delNetworkAll", function () {
  11210. _this.ajaxData = [];
  11211. _this.saveData();
  11212. });
  11213. } catch (error) {
  11214. console.log("request.install error", error);
  11215. }
  11216. },
  11217. /**
  11218. * 同步请求信息到缓存数据中
  11219. */
  11220. syncReqData: function syncReqData() {
  11221. var that = this;
  11222. setTimeout(function () {
  11223. try {
  11224. that.saveData();
  11225. } catch (error) {
  11226. console.log("request.syncReqData", error);
  11227. }
  11228. that.syncReqData();
  11229. }, 4000);
  11230. },
  11231. /**
  11232. * 保存数据到缓存中
  11233. */
  11234. saveData: function saveData() {
  11235. var that = this;
  11236. that.ajaxData = _jsonCompress.default.compressArray(that.ajaxData, that.options.network.cache.size);
  11237. _devCache.default.set("request", that.ajaxData);
  11238. },
  11239. /**
  11240. * 复制对象
  11241. */
  11242. dataCopy: function dataCopy(data) {
  11243. try {
  11244. if ((0, _typeof2.default)(data) == "object") {
  11245. return JSON.parse(JSON.stringify([data]))[0];
  11246. } else {
  11247. return data;
  11248. }
  11249. } catch (error) {
  11250. console.log("request.dataCopy", error);
  11251. return "";
  11252. }
  11253. }
  11254. };
  11255. /**
  11256. * 随机生成n~m的数,支持两位小数
  11257. */
  11258. exports.default = _default;
  11259. function rNum(n, m) {
  11260. return Number((Math.random() * (m - n) + n).toFixed(2));
  11261. }
  11262. /**
  11263. * 休眠指定时长
  11264. */
  11265. function sleep(t) {
  11266. return new Promise(function (y) {
  11267. setTimeout(y, t);
  11268. });
  11269. }
  11270. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11271. /***/ }),
  11272. /* 50 */
  11273. /*!************************************************************************************************!*\
  11274. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  11275. \************************************************************************************************/
  11276. /*! no static exports found */
  11277. /***/ (function(module, exports, __webpack_require__) {
  11278. // TODO(Babel 8): Remove this file.
  11279. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 51)();
  11280. module.exports = runtime;
  11281. /***/ }),
  11282. /* 51 */
  11283. /*!*******************************************************************!*\
  11284. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  11285. \*******************************************************************/
  11286. /*! no static exports found */
  11287. /***/ (function(module, exports, __webpack_require__) {
  11288. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  11289. function _regeneratorRuntime() {
  11290. "use strict";
  11291. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  11292. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  11293. return e;
  11294. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11295. var t,
  11296. e = {},
  11297. r = Object.prototype,
  11298. n = r.hasOwnProperty,
  11299. o = Object.defineProperty || function (t, e, r) {
  11300. t[e] = r.value;
  11301. },
  11302. i = "function" == typeof Symbol ? Symbol : {},
  11303. a = i.iterator || "@@iterator",
  11304. c = i.asyncIterator || "@@asyncIterator",
  11305. u = i.toStringTag || "@@toStringTag";
  11306. function define(t, e, r) {
  11307. return Object.defineProperty(t, e, {
  11308. value: r,
  11309. enumerable: !0,
  11310. configurable: !0,
  11311. writable: !0
  11312. }), t[e];
  11313. }
  11314. try {
  11315. define({}, "");
  11316. } catch (t) {
  11317. define = function define(t, e, r) {
  11318. return t[e] = r;
  11319. };
  11320. }
  11321. function wrap(t, e, r, n) {
  11322. var i = e && e.prototype instanceof Generator ? e : Generator,
  11323. a = Object.create(i.prototype),
  11324. c = new Context(n || []);
  11325. return o(a, "_invoke", {
  11326. value: makeInvokeMethod(t, r, c)
  11327. }), a;
  11328. }
  11329. function tryCatch(t, e, r) {
  11330. try {
  11331. return {
  11332. type: "normal",
  11333. arg: t.call(e, r)
  11334. };
  11335. } catch (t) {
  11336. return {
  11337. type: "throw",
  11338. arg: t
  11339. };
  11340. }
  11341. }
  11342. e.wrap = wrap;
  11343. var h = "suspendedStart",
  11344. l = "suspendedYield",
  11345. f = "executing",
  11346. s = "completed",
  11347. y = {};
  11348. function Generator() {}
  11349. function GeneratorFunction() {}
  11350. function GeneratorFunctionPrototype() {}
  11351. var p = {};
  11352. define(p, a, function () {
  11353. return this;
  11354. });
  11355. var d = Object.getPrototypeOf,
  11356. v = d && d(d(values([])));
  11357. v && v !== r && n.call(v, a) && (p = v);
  11358. var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  11359. function defineIteratorMethods(t) {
  11360. ["next", "throw", "return"].forEach(function (e) {
  11361. define(t, e, function (t) {
  11362. return this._invoke(e, t);
  11363. });
  11364. });
  11365. }
  11366. function AsyncIterator(t, e) {
  11367. function invoke(r, o, i, a) {
  11368. var c = tryCatch(t[r], t, o);
  11369. if ("throw" !== c.type) {
  11370. var u = c.arg,
  11371. h = u.value;
  11372. return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
  11373. invoke("next", t, i, a);
  11374. }, function (t) {
  11375. invoke("throw", t, i, a);
  11376. }) : e.resolve(h).then(function (t) {
  11377. u.value = t, i(u);
  11378. }, function (t) {
  11379. return invoke("throw", t, i, a);
  11380. });
  11381. }
  11382. a(c.arg);
  11383. }
  11384. var r;
  11385. o(this, "_invoke", {
  11386. value: function value(t, n) {
  11387. function callInvokeWithMethodAndArg() {
  11388. return new e(function (e, r) {
  11389. invoke(t, n, e, r);
  11390. });
  11391. }
  11392. return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  11393. }
  11394. });
  11395. }
  11396. function makeInvokeMethod(e, r, n) {
  11397. var o = h;
  11398. return function (i, a) {
  11399. if (o === f) throw Error("Generator is already running");
  11400. if (o === s) {
  11401. if ("throw" === i) throw a;
  11402. return {
  11403. value: t,
  11404. done: !0
  11405. };
  11406. }
  11407. for (n.method = i, n.arg = a;;) {
  11408. var c = n.delegate;
  11409. if (c) {
  11410. var u = maybeInvokeDelegate(c, n);
  11411. if (u) {
  11412. if (u === y) continue;
  11413. return u;
  11414. }
  11415. }
  11416. if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
  11417. if (o === h) throw o = s, n.arg;
  11418. n.dispatchException(n.arg);
  11419. } else "return" === n.method && n.abrupt("return", n.arg);
  11420. o = f;
  11421. var p = tryCatch(e, r, n);
  11422. if ("normal" === p.type) {
  11423. if (o = n.done ? s : l, p.arg === y) continue;
  11424. return {
  11425. value: p.arg,
  11426. done: n.done
  11427. };
  11428. }
  11429. "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
  11430. }
  11431. };
  11432. }
  11433. function maybeInvokeDelegate(e, r) {
  11434. var n = r.method,
  11435. o = e.iterator[n];
  11436. if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
  11437. var i = tryCatch(o, e.iterator, r.arg);
  11438. if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
  11439. var a = i.arg;
  11440. return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
  11441. }
  11442. function pushTryEntry(t) {
  11443. var e = {
  11444. tryLoc: t[0]
  11445. };
  11446. 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
  11447. }
  11448. function resetTryEntry(t) {
  11449. var e = t.completion || {};
  11450. e.type = "normal", delete e.arg, t.completion = e;
  11451. }
  11452. function Context(t) {
  11453. this.tryEntries = [{
  11454. tryLoc: "root"
  11455. }], t.forEach(pushTryEntry, this), this.reset(!0);
  11456. }
  11457. function values(e) {
  11458. if (e || "" === e) {
  11459. var r = e[a];
  11460. if (r) return r.call(e);
  11461. if ("function" == typeof e.next) return e;
  11462. if (!isNaN(e.length)) {
  11463. var o = -1,
  11464. i = function next() {
  11465. for (; ++o < e.length;) {
  11466. if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
  11467. }
  11468. return next.value = t, next.done = !0, next;
  11469. };
  11470. return i.next = i;
  11471. }
  11472. }
  11473. throw new TypeError(_typeof(e) + " is not iterable");
  11474. }
  11475. return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
  11476. value: GeneratorFunctionPrototype,
  11477. configurable: !0
  11478. }), o(GeneratorFunctionPrototype, "constructor", {
  11479. value: GeneratorFunction,
  11480. configurable: !0
  11481. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
  11482. var e = "function" == typeof t && t.constructor;
  11483. return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
  11484. }, e.mark = function (t) {
  11485. return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
  11486. }, e.awrap = function (t) {
  11487. return {
  11488. __await: t
  11489. };
  11490. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
  11491. return this;
  11492. }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
  11493. void 0 === i && (i = Promise);
  11494. var a = new AsyncIterator(wrap(t, r, n, o), i);
  11495. return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
  11496. return t.done ? t.value : a.next();
  11497. });
  11498. }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
  11499. return this;
  11500. }), define(g, "toString", function () {
  11501. return "[object Generator]";
  11502. }), e.keys = function (t) {
  11503. var e = Object(t),
  11504. r = [];
  11505. for (var n in e) {
  11506. r.push(n);
  11507. }
  11508. return r.reverse(), function next() {
  11509. for (; r.length;) {
  11510. var t = r.pop();
  11511. if (t in e) return next.value = t, next.done = !1, next;
  11512. }
  11513. return next.done = !0, next;
  11514. };
  11515. }, e.values = values, Context.prototype = {
  11516. constructor: Context,
  11517. reset: function reset(e) {
  11518. if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) {
  11519. "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
  11520. }
  11521. },
  11522. stop: function stop() {
  11523. this.done = !0;
  11524. var t = this.tryEntries[0].completion;
  11525. if ("throw" === t.type) throw t.arg;
  11526. return this.rval;
  11527. },
  11528. dispatchException: function dispatchException(e) {
  11529. if (this.done) throw e;
  11530. var r = this;
  11531. function handle(n, o) {
  11532. return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
  11533. }
  11534. for (var o = this.tryEntries.length - 1; o >= 0; --o) {
  11535. var i = this.tryEntries[o],
  11536. a = i.completion;
  11537. if ("root" === i.tryLoc) return handle("end");
  11538. if (i.tryLoc <= this.prev) {
  11539. var c = n.call(i, "catchLoc"),
  11540. u = n.call(i, "finallyLoc");
  11541. if (c && u) {
  11542. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  11543. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  11544. } else if (c) {
  11545. if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
  11546. } else {
  11547. if (!u) throw Error("try statement without catch or finally");
  11548. if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
  11549. }
  11550. }
  11551. }
  11552. },
  11553. abrupt: function abrupt(t, e) {
  11554. for (var r = this.tryEntries.length - 1; r >= 0; --r) {
  11555. var o = this.tryEntries[r];
  11556. if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
  11557. var i = o;
  11558. break;
  11559. }
  11560. }
  11561. i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
  11562. var a = i ? i.completion : {};
  11563. return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
  11564. },
  11565. complete: function complete(t, e) {
  11566. if ("throw" === t.type) throw t.arg;
  11567. return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
  11568. },
  11569. finish: function finish(t) {
  11570. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  11571. var r = this.tryEntries[e];
  11572. if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
  11573. }
  11574. },
  11575. "catch": function _catch(t) {
  11576. for (var e = this.tryEntries.length - 1; e >= 0; --e) {
  11577. var r = this.tryEntries[e];
  11578. if (r.tryLoc === t) {
  11579. var n = r.completion;
  11580. if ("throw" === n.type) {
  11581. var o = n.arg;
  11582. resetTryEntry(r);
  11583. }
  11584. return o;
  11585. }
  11586. }
  11587. throw Error("illegal catch attempt");
  11588. },
  11589. delegateYield: function delegateYield(e, r, n) {
  11590. return this.delegate = {
  11591. iterator: values(e),
  11592. resultName: r,
  11593. nextLoc: n
  11594. }, "next" === this.method && (this.arg = t), y;
  11595. }
  11596. }, e;
  11597. }
  11598. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11599. /***/ }),
  11600. /* 52 */
  11601. /*!*****************************************************************!*\
  11602. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  11603. \*****************************************************************/
  11604. /*! no static exports found */
  11605. /***/ (function(module, exports) {
  11606. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  11607. try {
  11608. var info = gen[key](arg);
  11609. var value = info.value;
  11610. } catch (error) {
  11611. reject(error);
  11612. return;
  11613. }
  11614. if (info.done) {
  11615. resolve(value);
  11616. } else {
  11617. Promise.resolve(value).then(_next, _throw);
  11618. }
  11619. }
  11620. function _asyncToGenerator(fn) {
  11621. return function () {
  11622. var self = this,
  11623. args = arguments;
  11624. return new Promise(function (resolve, reject) {
  11625. var gen = fn.apply(self, args);
  11626. function _next(value) {
  11627. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  11628. }
  11629. function _throw(err) {
  11630. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  11631. }
  11632. _next(undefined);
  11633. });
  11634. };
  11635. }
  11636. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11637. /***/ }),
  11638. /* 53 */
  11639. /*!**********************************************************!*\
  11640. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/storage.js ***!
  11641. \**********************************************************/
  11642. /*! no static exports found */
  11643. /***/ (function(module, exports, __webpack_require__) {
  11644. "use strict";
  11645. /* WEBPACK VAR INJECTION */(function(uni) {
  11646. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11647. Object.defineProperty(exports, "__esModule", {
  11648. value: true
  11649. });
  11650. exports.default = void 0;
  11651. var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
  11652. var _default = {
  11653. /**
  11654. * 挂载缓存监听
  11655. */
  11656. install: function install() {
  11657. try {
  11658. var setStorage = function setStorage() {
  11659. try {
  11660. if (arguments[0] && arguments[0].key && arguments[0].key.indexOf("devTools_") != 0) {
  11661. that.addCacheKey(arguments[0].key);
  11662. }
  11663. } catch (error) {}
  11664. return _setStorage.apply(void 0, arguments);
  11665. };
  11666. var setStorageSync = function setStorageSync() {
  11667. try {
  11668. if (arguments[0] && arguments[0].indexOf("devTools_") != 0) {
  11669. that.addCacheKey(arguments[0]);
  11670. }
  11671. } catch (error) {}
  11672. return _setStorageSync.apply(void 0, arguments);
  11673. };
  11674. var removeStorage = function removeStorage() {
  11675. try {
  11676. if (arguments[0] && arguments[0].key && arguments[0].key.indexOf("devTools_") != 0) {
  11677. that.delCacheKey(arguments[0].key);
  11678. }
  11679. } catch (error) {}
  11680. return _removeStorage.apply(void 0, arguments);
  11681. };
  11682. var removeStorageSync = function removeStorageSync() {
  11683. try {
  11684. if (arguments[0] && arguments[0].indexOf("devTools_") != 0) {
  11685. that.delCacheKey(arguments[0]);
  11686. }
  11687. } catch (error) {}
  11688. return _removeStorageSync.apply(void 0, arguments);
  11689. };
  11690. var that = this;
  11691. var _setStorage = uni.setStorage;
  11692. uni.setStorage = setStorage;
  11693. var _setStorageSync = uni.setStorageSync;
  11694. uni.setStorageSync = setStorageSync;
  11695. var _removeStorage = uni.removeStorage;
  11696. uni.removeStorage = removeStorage;
  11697. var _removeStorageSync = uni.removeStorageSync;
  11698. uni.removeStorageSync = removeStorageSync;
  11699. } catch (error) {
  11700. console.log("devTools storage.install error", error);
  11701. }
  11702. },
  11703. /**
  11704. * 添加缓存key
  11705. */
  11706. addCacheKey: function addCacheKey(key) {
  11707. try {
  11708. if (key && typeof key == "string") {
  11709. var storageList = _devCache.default.get("storage");
  11710. if (!storageList) storageList = [];
  11711. if (storageList.indexOf(key) == -1) {
  11712. storageList.push(key);
  11713. _devCache.default.set("storage", storageList);
  11714. }
  11715. }
  11716. } catch (error) {
  11717. console.log("devTools storage.addCacheKey error", error);
  11718. }
  11719. },
  11720. /**
  11721. * 删除指定缓存key
  11722. */
  11723. delCacheKey: function delCacheKey(key) {
  11724. try {
  11725. if (key && typeof key == "string") {
  11726. var storageList = _devCache.default.get("storage");
  11727. if (!storageList) storageList = [];
  11728. var index = storageList.indexOf(key);
  11729. if (index > -1) {
  11730. storageList.splice(index, 1);
  11731. _devCache.default.set("storage", storageList);
  11732. }
  11733. }
  11734. } catch (error) {
  11735. console.log("devTools storage.delCacheKey error", error);
  11736. }
  11737. }
  11738. };
  11739. exports.default = _default;
  11740. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11741. /***/ }),
  11742. /* 54 */
  11743. /*!*********************************************************!*\
  11744. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/uniBus.js ***!
  11745. \*********************************************************/
  11746. /*! no static exports found */
  11747. /***/ (function(module, exports, __webpack_require__) {
  11748. "use strict";
  11749. /* WEBPACK VAR INJECTION */(function(uni) {
  11750. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11751. Object.defineProperty(exports, "__esModule", {
  11752. value: true
  11753. });
  11754. exports.default = void 0;
  11755. var _devCache = _interopRequireDefault(__webpack_require__(/*! ../libs/devCache */ 38));
  11756. var _devOptions = _interopRequireDefault(__webpack_require__(/*! ../libs/devOptions */ 39));
  11757. var _jsonCompress = _interopRequireDefault(__webpack_require__(/*! ../libs/jsonCompress */ 40));
  11758. var _default = {
  11759. logList: [],
  11760. busCount: [],
  11761. options: null,
  11762. /**
  11763. * 挂载打印拦截器
  11764. */
  11765. install: function install() {
  11766. try {
  11767. /**
  11768. * 统计总次数
  11769. */
  11770. var addCount = function addCount(name) {
  11771. var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "on";
  11772. var i = that.busCount.findIndex(function (x) {
  11773. return x.e == name;
  11774. });
  11775. if (i == -1) {
  11776. var item = {
  11777. e: name,
  11778. on: 0,
  11779. off: 0,
  11780. emit: 0,
  11781. once: 0
  11782. };
  11783. item[type] = item[type] + 1;
  11784. that.busCount.push(item);
  11785. } else {
  11786. that.busCount[i][type] = that.busCount[i][type] + 1;
  11787. }
  11788. }; // ! 清空全部记录
  11789. var that = this;
  11790. this.options = _devOptions.default.getOptions();
  11791. if (!this.options.uniBus.status) return;
  11792. this.logList = _devCache.default.get("uniBus");
  11793. if (!this.logList) this.logList = [];
  11794. this.busCount = _devCache.default.get("busCount");
  11795. if (!this.busCount) this.busCount = [];
  11796. this.syncReqData(); //同步缓存
  11797. var now = function now() {
  11798. return new Date().getTime();
  11799. };
  11800. var _on = uni.$on;
  11801. uni.$on = function () {
  11802. try {
  11803. var n = arguments[0];
  11804. if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
  11805. that.logList.unshift({
  11806. t: now(),
  11807. e: _jsonCompress.default.compressObject("on>".concat(n), that.options.uniBus.cache.rowMax)
  11808. });
  11809. addCount(n, "on");
  11810. }
  11811. } catch (error) {
  11812. console.error("uni.$on出错", error);
  11813. }
  11814. _on.apply(void 0, arguments);
  11815. };
  11816. var _once = uni.$once;
  11817. uni.$once = function () {
  11818. try {
  11819. var n = arguments[0];
  11820. if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
  11821. that.logList.unshift({
  11822. t: now(),
  11823. e: _jsonCompress.default.compressObject("once>".concat(n), that.options.uniBus.cache.rowMax)
  11824. });
  11825. addCount(n, "once");
  11826. }
  11827. } catch (error) {
  11828. console.error("uni.$once出错", error);
  11829. }
  11830. _once.apply(void 0, arguments);
  11831. };
  11832. var _emit = uni.$emit;
  11833. uni.$emit = function () {
  11834. try {
  11835. var n = arguments[0];
  11836. var p = arguments[1];
  11837. if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
  11838. that.logList.unshift({
  11839. t: now(),
  11840. e: _jsonCompress.default.compressObject("emit>".concat(n) + (p ? '>' + JSON.stringify(p) : ''), that.options.uniBus.cache.rowMax)
  11841. });
  11842. addCount(n, "emit");
  11843. }
  11844. } catch (error) {
  11845. console.error("uni.$emit出错", error);
  11846. }
  11847. _emit.apply(void 0, arguments);
  11848. };
  11849. var _off = uni.$off;
  11850. uni.$off = function () {
  11851. try {
  11852. var n = arguments[0];
  11853. if (n && typeof n == "string" && n.length < 200 && n.indexOf("devTools_") == -1) {
  11854. that.logList.unshift({
  11855. t: now(),
  11856. e: _jsonCompress.default.compressObject("off>".concat(n) + arguments[0], that.options.uniBus.cache.rowMax)
  11857. });
  11858. addCount(n, "off");
  11859. }
  11860. } catch (error) {
  11861. console.error("uni.$off出错", error);
  11862. }
  11863. _off.apply(void 0, arguments);
  11864. };
  11865. uni.$on("devTools_delUniBusAll", function () {
  11866. that.logList = [];
  11867. that.busCount = [];
  11868. });
  11869. } catch (error) {
  11870. console.log("devTools uniBus.install error", error);
  11871. }
  11872. },
  11873. /**
  11874. * 同步请求信息到缓存数据中
  11875. */
  11876. syncReqData: function syncReqData() {
  11877. var that = this;
  11878. setTimeout(function () {
  11879. try {
  11880. that.logList = _jsonCompress.default.compressArray(that.logList, "end", that.options.uniBus.cache.rowMax);
  11881. _devCache.default.set("uniBus", that.logList);
  11882. that.busCount = _jsonCompress.default.compressArray(that.busCount, "end", that.options.uniBus.cache.countMaxSize);
  11883. _devCache.default.set("busCount", that.busCount);
  11884. } catch (error) {
  11885. console.log("devTools uniBus.syncReqData error", error);
  11886. }
  11887. that.syncReqData();
  11888. }, 5000);
  11889. }
  11890. };
  11891. exports.default = _default;
  11892. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11893. /***/ }),
  11894. /* 55 */
  11895. /*!************************************************************!*\
  11896. !*** E:/git/2021项目/v3-H5/devTools/core/proxy/uniListen.js ***!
  11897. \************************************************************/
  11898. /*! no static exports found */
  11899. /***/ (function(module, exports, __webpack_require__) {
  11900. "use strict";
  11901. /* WEBPACK VAR INJECTION */(function(uni) {
  11902. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11903. Object.defineProperty(exports, "__esModule", {
  11904. value: true
  11905. });
  11906. exports.default = void 0;
  11907. var _logReport = _interopRequireDefault(__webpack_require__(/*! ../libs/logReport */ 37));
  11908. var _default = {
  11909. /**
  11910. * 挂载uni大部分api监听器
  11911. */
  11912. install: function install() {
  11913. try {
  11914. this.addDefUniApiListen();
  11915. this.onNetworkStatusChange();
  11916. this.scanCodeListen();
  11917. this.onLocaleChange();
  11918. } catch (error) {
  11919. console.log("uniListen error", error);
  11920. }
  11921. },
  11922. /**
  11923. * 批量挂载api调用日志
  11924. */
  11925. addDefUniApiListen: function addDefUniApiListen() {
  11926. /**
  11927. * 需要挂载监听的api列表
  11928. */
  11929. var diyListenApi = {
  11930. downloadFile: function downloadFile(args) {
  11931. (0, _logReport.default)("downloadFile>" + (args && args.url ? args.url : ''));
  11932. },
  11933. connectSocket: function connectSocket(args) {
  11934. (0, _logReport.default)("connectSocket>" + args.url);
  11935. },
  11936. makePhoneCall: function makePhoneCall(args) {
  11937. (0, _logReport.default)("makePhoneCall>" + args.phoneNumber);
  11938. },
  11939. addPhoneContact: function addPhoneContact(args) {
  11940. (0, _logReport.default)("addPhoneContact>" + args.name);
  11941. },
  11942. showToast: function showToast(args) {
  11943. (0, _logReport.default)("showToast>" + args.title);
  11944. },
  11945. showModal: function showModal(args) {
  11946. (0, _logReport.default)("showModal>" + args.title + '>' + args.content);
  11947. },
  11948. setLocale: function setLocale(args) {
  11949. (0, _logReport.default)("setLocale>" + args);
  11950. },
  11951. saveFile: function saveFile(args) {
  11952. (0, _logReport.default)("saveFile>" + args.tempFilePath);
  11953. },
  11954. login: function login(args) {
  11955. (0, _logReport.default)("login>" + JSON.stringify(args));
  11956. },
  11957. share: function share(args) {
  11958. (0, _logReport.default)("share>" + JSON.stringify(args));
  11959. },
  11960. shareWithSystem: function shareWithSystem(args) {
  11961. (0, _logReport.default)("shareWithSystem>" + JSON.stringify(args));
  11962. },
  11963. requestPayment: function requestPayment(args) {
  11964. (0, _logReport.default)("requestPayment>" + JSON.stringify(args));
  11965. },
  11966. authorize: function authorize(args) {
  11967. (0, _logReport.default)("requestPayment>" + args.scope);
  11968. },
  11969. navigateToMiniProgram: function navigateToMiniProgram(args) {
  11970. (0, _logReport.default)("navigateToMiniProgram>" + args.appId + '>' + args.path);
  11971. },
  11972. openDocument: function openDocument(args) {
  11973. (0, _logReport.default)("openDocument>" + args.filePath);
  11974. }
  11975. };
  11976. /**
  11977. * 需要监听打印日志的api名称列表
  11978. */
  11979. var waitListenApiNames = ["uploadFile", "closeSocket", "getLocation", "chooseLocation", "openLocation", "chooseImage", "previewImage", "saveImageToPhotosAlbum", "chooseFile", "chooseVideo", "chooseMedia", "saveVideoToPhotosAlbum", "openVideoEditor", "openAppAuthorizeSetting", "startAccelerometer", "startCompass", "startGyroscope", "setScreenBrightness", "vibrate", "vibrateLong", "vibrateShort", "openBluetoothAdapter", "startBeaconDiscovery", "startSoterAuthentication", "hideKeyboard", "showActionSheet", "startPullDownRefresh", "showShareMenu", "startFacialRecognitionVerify", "openSetting", "chooseAddress", "chooseInvoiceTitle", "openEmbeddedMiniProgram"];
  11980. var _loop = function _loop(key) {
  11981. uni.addInterceptor(key, {
  11982. invoke: function invoke(_args) {
  11983. try {
  11984. diyListenApi[key](_args);
  11985. } catch (error) {
  11986. console.error("addInterceptor=>" + key, error);
  11987. }
  11988. }
  11989. });
  11990. };
  11991. for (var key in diyListenApi) {
  11992. _loop(key);
  11993. }
  11994. waitListenApiNames.map(function (key) {
  11995. uni.addInterceptor(key, {
  11996. invoke: function invoke(args) {
  11997. try {
  11998. (0, _logReport.default)(key);
  11999. } catch (error) {
  12000. console.error("addInterceptor>" + key, error);
  12001. }
  12002. }
  12003. });
  12004. });
  12005. },
  12006. /**
  12007. * 添加网络状态监听
  12008. */
  12009. onNetworkStatusChange: function onNetworkStatusChange() {
  12010. uni.onNetworkStatusChange(function (res) {
  12011. try {
  12012. (0, _logReport.default)("onNetworkStatusChange>isConnected:" + (res.isConnected ? 'true' : 'false') + '>networkType:' + res.networkType);
  12013. } catch (error) {
  12014. console.log("onNetworkStatusChange", error);
  12015. }
  12016. });
  12017. },
  12018. /**
  12019. * 添加系统主题切换监听
  12020. */
  12021. onThemeChange: function onThemeChange() {
  12022. uni.onThemeChange(function (res) {
  12023. try {
  12024. (0, _logReport.default)("onThemeChange>" + res.theme);
  12025. } catch (error) {
  12026. console.log("onThemeChange", error);
  12027. }
  12028. });
  12029. },
  12030. /**
  12031. * 监听扫码结果
  12032. */
  12033. scanCodeListen: function scanCodeListen() {
  12034. uni.addInterceptor('scanCode', {
  12035. success: function success(res) {
  12036. try {
  12037. (0, _logReport.default)("scanCodeSuccess>" + JSON.stringify({
  12038. scanType: res.scanType,
  12039. result: res.result
  12040. }));
  12041. } catch (error) {
  12042. console.log("scanCode", error);
  12043. }
  12044. }
  12045. });
  12046. },
  12047. /**
  12048. * 监听系统语言切换
  12049. */
  12050. onLocaleChange: function onLocaleChange() {
  12051. uni.onLocaleChange(function (locale) {
  12052. try {
  12053. (0, _logReport.default)("onLocaleChange>" + locale);
  12054. } catch (error) {
  12055. console.log("onLocaleChange", error);
  12056. }
  12057. });
  12058. }
  12059. };
  12060. exports.default = _default;
  12061. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  12062. /***/ }),
  12063. /* 56 */
  12064. /*!**********************************************!*\
  12065. !*** E:/git/2021项目/v3-H5/devTools/config.js ***!
  12066. \**********************************************/
  12067. /*! no static exports found */
  12068. /***/ (function(module, exports, __webpack_require__) {
  12069. "use strict";
  12070. Object.defineProperty(exports, "__esModule", {
  12071. value: true
  12072. });
  12073. exports.default = void 0;
  12074. var config = {
  12075. status: true,
  12076. //调试工具总开关
  12077. route: "/devTools/page/index",
  12078. // 调试页面的路由,不建议更改
  12079. bubble: {
  12080. //调试弹窗气泡设置
  12081. status: true,
  12082. // 气泡标签是否显示,生产环境建议关闭
  12083. text: "DevTools",
  12084. // 气泡上展示的文字
  12085. color: "#ffffff",
  12086. // 气泡文字颜色
  12087. bgColor: "rgba(250, 53, 52,0.7)" // 气泡背景颜色
  12088. },
  12089. // 注意: 以下配置不建议更改
  12090. pageStatistics: {
  12091. // 页面统计开关
  12092. status: true,
  12093. // 统计状态开关
  12094. size: 1024 * 100,
  12095. // 缓存上限,单位byte
  12096. dayOnlineRowMax: 30 // 活跃数据缓存天数
  12097. },
  12098. console: {
  12099. //console日志配置
  12100. status: true,
  12101. //功能总开关
  12102. isOutput: true,
  12103. //打印的日志是否对外输出到浏览器调试界面,建议在生产环境时关闭
  12104. cache: {
  12105. status: true,
  12106. //是否启用本地缓存
  12107. size: 512 * 1024,
  12108. //缓存上限,单位byte
  12109. rowSize: 1024 * 4 //单条记录缓存上限,单位byte
  12110. }
  12111. },
  12112. uniBus: {
  12113. // uni event bus 监听设置
  12114. status: true,
  12115. cache: {
  12116. status: true,
  12117. size: 1024 * 512,
  12118. // bus调用日志上限 byte
  12119. rowSize: 1024 * 10,
  12120. countMaxSize: 1024 * 10 // bus统计上限 byte
  12121. }
  12122. },
  12123. error: {
  12124. //报错拦截配置
  12125. status: true,
  12126. cache: {
  12127. status: true,
  12128. size: 512 * 1024,
  12129. rowSize: 1024 * 4
  12130. }
  12131. },
  12132. network: {
  12133. //请求拦截配置
  12134. status: true,
  12135. cache: {
  12136. status: true,
  12137. size: 512 * 1024,
  12138. rowSize: 1024 * 4
  12139. }
  12140. },
  12141. logs: {
  12142. //运行日志
  12143. status: true,
  12144. cache: {
  12145. status: true,
  12146. size: 512 * 1024,
  12147. rowSize: 1024 * 4
  12148. }
  12149. }
  12150. };
  12151. var _default = config;
  12152. exports.default = _default;
  12153. /***/ }),
  12154. /* 57 */,
  12155. /* 58 */,
  12156. /* 59 */,
  12157. /* 60 */,
  12158. /* 61 */,
  12159. /* 62 */,
  12160. /* 63 */
  12161. /*!**********************************************!*\
  12162. !*** E:/git/2021项目/v3-H5/pages/api/index.js ***!
  12163. \**********************************************/
  12164. /*! no static exports found */
  12165. /***/ (function(module, exports, __webpack_require__) {
  12166. "use strict";
  12167. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12168. Object.defineProperty(exports, "__esModule", {
  12169. value: true
  12170. });
  12171. exports.examPointsRecordGetMyPointsLogInfo = exports.creditAppletGetMyPointsLogInfo = exports.configInfo = exports.chemicalAppletSelectStockInfo = exports.chemicalAppletGetStockDetail = exports.chemicalAppletGetCabinetByChemical = exports.chemicalAppletCabinetDetail = exports.chemicalAioVerifyScanLogin = exports.chemicalAioVerifyAppletLogin = exports.chemicalAioIdentityScanLogin = exports.authGetAppletUser = void 0;
  12172. exports.getConfigByType = getConfigByType;
  12173. exports.systemUserProfile = exports.systemUserPersonalData = exports.systemUserDropList = exports.systemSubjectCheckIsAdminOrSafeUser = exports.systemNoticeGetNoticeType = exports.systemNoticeGetNoticeList = exports.systemNoticeGetNoticeDetail = exports.systemNoticeGetNoticeCount = exports.systemMineUserEdit = exports.systemDeptDropList = exports.systemAppletRolePermission = exports.systemAppletLayoutSelect = exports.studentinfoFacemy = exports.securityDataStatisticsGetUserIdentity = exports.securityCheckPlanPlantList = exports.securityCheckDangerNotHazardOneCollect = exports.securityCheckDangerHazardOneCollect = exports.reportAppletReportBsEquipStatusList = exports.reportAppletReportBsEquipDangerList = exports.reportAppletReportBsEquipDangerCheckList = exports.reportAppletReportBsEquipAppointTopList = exports.reportAppletReportApiResourceRateResourceList = exports.reportAppletReportApiResourceRateAnalysisList = exports.reportAppletReportApiEquipRankTopList = exports.reportAppletReportApiEquipOverdueList = exports.reportAppletReportApiEquipOverdueGetLifePageList = exports.reportAppletReportApiEquipLifeList = exports.reportAppletReportApiEquipLifeGetReportBsEquipLifeList = exports.reportAppletReportApiDeviceStatGetDeviceStat = exports.reportAppletReportApiCageRateList = exports.reportAppletReportApiCageRateCageRateList = exports.reportAppStatisticsWarningHandle = exports.reportAppStatisticsPersonDeviceSafety = exports.reportAppStatisticsLabStateStatistics = exports.reportAppStatisticsLabNumberPeople = exports.reportAppStatisticsHazardTotalSort = exports.reportAppStatisticsDangerSort = exports.reportAppStatisticsCountStatistics = exports.reportAppStatisticsChemicalStockSort = exports.outSubjectPhoto = exports.logout = exports.login = exports.laboratorySubPassOutIsotopeSubSign = exports.laboratoryPlanCloseRiskPlan = exports.laboratoryClassTypeGetList = exports.laboratoryClassLevelGetList = exports.laboratoryBigViewSelectTriggerInfo = exports.laboratoryBigViewGetFloorByBigView = exports.laboratoryAppletSubList = exports.laboratoryAppletGetSubDetailInfo = exports.laboratoryAppletCheckPassOrNo = exports.laboratoryAppletCheckApplyPending = exports.laboratoryAppBoardScanCodeVerification = exports.iotAppSpeakerPlayVoice = exports.iotAppSpeakerFindHorn = exports.gradingControl = exports.getLogoInfo = void 0;
  12174. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  12175. var _request = __webpack_require__(/*! @/api/request/request.js */ 64);
  12176. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  12177. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  12178. //登录
  12179. var login = function login(data) {
  12180. return (0, _request.apiResquest)({
  12181. url: "/auth/appletLogin",
  12182. method: 'POST',
  12183. data: _objectSpread({}, data)
  12184. });
  12185. };
  12186. //退出登录
  12187. exports.login = login;
  12188. var logout = function logout(data) {
  12189. return (0, _request.apiResquest)({
  12190. url: "/auth/logout",
  12191. method: 'GET',
  12192. data: data
  12193. });
  12194. };
  12195. //查询公共配置
  12196. exports.logout = logout;
  12197. var configInfo = function configInfo(data) {
  12198. return (0, _request.apiResquest)({
  12199. url: "/auth/configInfo",
  12200. method: 'GET',
  12201. data: data
  12202. });
  12203. };
  12204. //获取公共配置的图片
  12205. exports.configInfo = configInfo;
  12206. var getLogoInfo = function getLogoInfo(data) {
  12207. return (0, _request.apiResquest)({
  12208. url: "/system/config/info/getConfigByType",
  12209. method: 'GET',
  12210. data: data
  12211. });
  12212. };
  12213. //化学品登录-扫码验证
  12214. exports.getLogoInfo = getLogoInfo;
  12215. var chemicalAioIdentityScanLogin = function chemicalAioIdentityScanLogin(data) {
  12216. return (0, _request.apiResquest)({
  12217. url: "/chemical/aio/identity/scanLogin",
  12218. method: 'GET',
  12219. data: data
  12220. });
  12221. };
  12222. //实验室-列表
  12223. exports.chemicalAioIdentityScanLogin = chemicalAioIdentityScanLogin;
  12224. var laboratoryAppletSubList = function laboratoryAppletSubList(data) {
  12225. return (0, _request.apiResquest)({
  12226. url: "/laboratory/applet/subList",
  12227. method: 'POST',
  12228. data: _objectSpread({}, data)
  12229. });
  12230. };
  12231. //实验室-详情
  12232. exports.laboratoryAppletSubList = laboratoryAppletSubList;
  12233. var laboratoryAppletGetSubDetailInfo = function laboratoryAppletGetSubDetailInfo(data) {
  12234. return (0, _request.apiResquest)({
  12235. url: "/laboratory/applet/getSubDetailInfo",
  12236. method: 'GET',
  12237. data: data
  12238. });
  12239. };
  12240. //实验室-查询喇叭列表
  12241. exports.laboratoryAppletGetSubDetailInfo = laboratoryAppletGetSubDetailInfo;
  12242. var iotAppSpeakerFindHorn = function iotAppSpeakerFindHorn(data) {
  12243. return (0, _request.apiResquest)({
  12244. url: "/iot/app/speaker/findHorn",
  12245. method: 'GET',
  12246. data: data
  12247. });
  12248. };
  12249. //实验室-喇叭播放
  12250. exports.iotAppSpeakerFindHorn = iotAppSpeakerFindHorn;
  12251. var iotAppSpeakerPlayVoice = function iotAppSpeakerPlayVoice(data) {
  12252. return (0, _request.apiResquest)({
  12253. url: "/iot/app/speaker/playVoice",
  12254. method: 'GET',
  12255. data: data
  12256. });
  12257. };
  12258. //扫码-查询化学品详情
  12259. exports.iotAppSpeakerPlayVoice = iotAppSpeakerPlayVoice;
  12260. var chemicalAppletCabinetDetail = function chemicalAppletCabinetDetail(data) {
  12261. return (0, _request.apiResquest)({
  12262. url: "/chemical/applet/cabinetDetail",
  12263. method: 'GET',
  12264. data: data
  12265. });
  12266. };
  12267. //查询化学品目录清单
  12268. exports.chemicalAppletCabinetDetail = chemicalAppletCabinetDetail;
  12269. var chemicalAppletGetCabinetByChemical = function chemicalAppletGetCabinetByChemical(data) {
  12270. return (0, _request.apiResquest)({
  12271. url: "/chemical/applet/getCabinetByChemical",
  12272. method: 'GET',
  12273. data: data
  12274. });
  12275. };
  12276. //扫码-查询化学品信息
  12277. exports.chemicalAppletGetCabinetByChemical = chemicalAppletGetCabinetByChemical;
  12278. var chemicalAppletGetStockDetail = function chemicalAppletGetStockDetail(data) {
  12279. return (0, _request.apiResquest)({
  12280. url: "/chemical/applet/getStockDetail",
  12281. method: 'GET',
  12282. data: data
  12283. });
  12284. };
  12285. //个人中心-获取个人信息
  12286. exports.chemicalAppletGetStockDetail = chemicalAppletGetStockDetail;
  12287. var systemUserProfile = function systemUserProfile(data) {
  12288. return (0, _request.apiResquest)({
  12289. url: "/system/user/profile",
  12290. method: 'GET',
  12291. data: data
  12292. });
  12293. };
  12294. //用户修改头像接口
  12295. exports.systemUserProfile = systemUserProfile;
  12296. var systemMineUserEdit = function systemMineUserEdit(data) {
  12297. return (0, _request.apiResquest)({
  12298. url: "/system/mine/user/edit",
  12299. method: 'POST',
  12300. data: _objectSpread({}, data)
  12301. });
  12302. };
  12303. /*查询用户列表-下拉列表
  12304. * userName : '', 名称
  12305. * userType: '', 0.系统 1.老师 2.学生
  12306. */
  12307. exports.systemMineUserEdit = systemMineUserEdit;
  12308. var systemUserDropList = function systemUserDropList(data) {
  12309. return (0, _request.apiResquest)({
  12310. url: "/system/user/dropList",
  12311. method: 'POST',
  12312. data: _objectSpread({}, data)
  12313. });
  12314. };
  12315. /* 分类获取公共配置
  12316. * category 1.系统参数 2.公共配置
  12317. * configType 1.基础配置 2.管控一体机 3.化学品终端 4.小程序配置 5.开发配置 6.首页配置
  12318. */
  12319. exports.systemUserDropList = systemUserDropList;
  12320. function getConfigByType(data) {
  12321. return (0, _request.apiResquest)({
  12322. url: '/system/config/info/getConfigByType',
  12323. method: 'post',
  12324. data: _objectSpread({}, data)
  12325. });
  12326. }
  12327. //查询人员身份标识
  12328. var securityDataStatisticsGetUserIdentity = function securityDataStatisticsGetUserIdentity(data) {
  12329. return (0, _request.apiResquest)({
  12330. url: "/security/dataStatistics/getUserIdentity",
  12331. method: 'GET',
  12332. data: data
  12333. });
  12334. };
  12335. //查询小程序布局配置
  12336. exports.securityDataStatisticsGetUserIdentity = securityDataStatisticsGetUserIdentity;
  12337. var systemAppletLayoutSelect = function systemAppletLayoutSelect(data) {
  12338. return (0, _request.apiResquest)({
  12339. url: '/system/applet/layout/select',
  12340. method: 'GET',
  12341. data: data
  12342. });
  12343. };
  12344. //查询权限字段
  12345. exports.systemAppletLayoutSelect = systemAppletLayoutSelect;
  12346. var systemAppletRolePermission = function systemAppletRolePermission(data) {
  12347. return (0, _request.apiResquest)({
  12348. url: '/system/applet/role/permission',
  12349. method: 'GET',
  12350. data: data
  12351. });
  12352. };
  12353. /* 数据看板 */
  12354. //人数统计
  12355. exports.systemAppletRolePermission = systemAppletRolePermission;
  12356. var reportAppStatisticsCountStatistics = function reportAppStatisticsCountStatistics(data) {
  12357. return (0, _request.apiResquest)({
  12358. url: '/report/app/statistics/countStatistics',
  12359. method: 'GET',
  12360. data: data
  12361. });
  12362. };
  12363. //实验室使用、空闲、异常数量
  12364. exports.reportAppStatisticsCountStatistics = reportAppStatisticsCountStatistics;
  12365. var reportAppStatisticsLabStateStatistics = function reportAppStatisticsLabStateStatistics(data) {
  12366. return (0, _request.apiResquest)({
  12367. url: '/report/app/statistics/labStateStatistics',
  12368. method: 'GET',
  12369. data: data
  12370. });
  12371. };
  12372. //实验室-图表
  12373. exports.reportAppStatisticsLabStateStatistics = reportAppStatisticsLabStateStatistics;
  12374. var reportAppStatisticsLabNumberPeople = function reportAppStatisticsLabNumberPeople(data) {
  12375. return (0, _request.apiResquest)({
  12376. url: '/report/app/statistics/labNumberPeople',
  12377. method: 'GET',
  12378. data: data
  12379. });
  12380. };
  12381. //学院人员设备列表
  12382. exports.reportAppStatisticsLabNumberPeople = reportAppStatisticsLabNumberPeople;
  12383. var reportAppStatisticsPersonDeviceSafety = function reportAppStatisticsPersonDeviceSafety(data) {
  12384. return (0, _request.apiResquest)({
  12385. url: '/report/app/statistics/personDeviceSafety',
  12386. method: 'GET',
  12387. data: data
  12388. });
  12389. };
  12390. //危险源
  12391. exports.reportAppStatisticsPersonDeviceSafety = reportAppStatisticsPersonDeviceSafety;
  12392. var reportAppStatisticsHazardTotalSort = function reportAppStatisticsHazardTotalSort(data) {
  12393. return (0, _request.apiResquest)({
  12394. url: '/report/app/statistics/hazardTotalSort',
  12395. method: 'GET',
  12396. data: data
  12397. });
  12398. };
  12399. //危化品
  12400. exports.reportAppStatisticsHazardTotalSort = reportAppStatisticsHazardTotalSort;
  12401. var reportAppStatisticsChemicalStockSort = function reportAppStatisticsChemicalStockSort(data) {
  12402. return (0, _request.apiResquest)({
  12403. url: '/report/app/statistics/chemicalStockSort',
  12404. method: 'GET',
  12405. data: data
  12406. });
  12407. };
  12408. //安全隐患-查询计划标题
  12409. exports.reportAppStatisticsChemicalStockSort = reportAppStatisticsChemicalStockSort;
  12410. var securityCheckPlanPlantList = function securityCheckPlanPlantList(data) {
  12411. return (0, _request.apiResquest)({
  12412. url: "/security/checkPlan/plantList",
  12413. method: 'POST',
  12414. data: _objectSpread({}, data)
  12415. });
  12416. };
  12417. //安全隐患-安全隐患排行
  12418. exports.securityCheckPlanPlantList = securityCheckPlanPlantList;
  12419. var reportAppStatisticsDangerSort = function reportAppStatisticsDangerSort(data) {
  12420. return (0, _request.apiResquest)({
  12421. url: '/report/app/statistics/dangerSort',
  12422. method: 'GET',
  12423. data: data
  12424. });
  12425. };
  12426. //安全隐患-一级指标
  12427. exports.reportAppStatisticsDangerSort = reportAppStatisticsDangerSort;
  12428. var securityCheckDangerHazardOneCollect = function securityCheckDangerHazardOneCollect(data) {
  12429. return (0, _request.apiResquest)({
  12430. url: '/security/checkDanger/hazardOneCollect',
  12431. method: 'GET',
  12432. data: data
  12433. });
  12434. };
  12435. //安全隐患-暂无法整改
  12436. exports.securityCheckDangerHazardOneCollect = securityCheckDangerHazardOneCollect;
  12437. var securityCheckDangerNotHazardOneCollect = function securityCheckDangerNotHazardOneCollect(data) {
  12438. return (0, _request.apiResquest)({
  12439. url: '/security/checkDanger/notHazardOneCollect',
  12440. method: 'POST',
  12441. data: _objectSpread({}, data)
  12442. });
  12443. };
  12444. //安全隐患-预警处置
  12445. exports.securityCheckDangerNotHazardOneCollect = securityCheckDangerNotHazardOneCollect;
  12446. var reportAppStatisticsWarningHandle = function reportAppStatisticsWarningHandle(data) {
  12447. return (0, _request.apiResquest)({
  12448. url: '/report/app/statistics/warningHandle',
  12449. method: 'GET',
  12450. data: data
  12451. });
  12452. };
  12453. //设备管控-top
  12454. exports.reportAppStatisticsWarningHandle = reportAppStatisticsWarningHandle;
  12455. var reportAppletReportApiDeviceStatGetDeviceStat = function reportAppletReportApiDeviceStatGetDeviceStat(data) {
  12456. return (0, _request.apiResquest)({
  12457. url: '/report/applet/reportApiDeviceStat/getDeviceStat',
  12458. method: 'GET',
  12459. data: data
  12460. });
  12461. };
  12462. //设备管控-安全检查指标
  12463. exports.reportAppletReportApiDeviceStatGetDeviceStat = reportAppletReportApiDeviceStatGetDeviceStat;
  12464. var reportAppletReportBsEquipDangerCheckList = function reportAppletReportBsEquipDangerCheckList(data) {
  12465. return (0, _request.apiResquest)({
  12466. url: "/report/applet/reportBsEquipDanger/checkList",
  12467. method: 'GET',
  12468. data: data
  12469. });
  12470. };
  12471. //设备管控-特种设备与常规冷热设备安全隐患统计
  12472. exports.reportAppletReportBsEquipDangerCheckList = reportAppletReportBsEquipDangerCheckList;
  12473. var reportAppletReportBsEquipDangerList = function reportAppletReportBsEquipDangerList(data) {
  12474. return (0, _request.apiResquest)({
  12475. url: "/report/applet/reportBsEquipDanger/list",
  12476. method: 'POST',
  12477. data: _objectSpread({}, data)
  12478. });
  12479. };
  12480. //设备管控-超期服役设备-统计
  12481. exports.reportAppletReportBsEquipDangerList = reportAppletReportBsEquipDangerList;
  12482. var reportAppletReportApiEquipOverdueList = function reportAppletReportApiEquipOverdueList(data) {
  12483. return (0, _request.apiResquest)({
  12484. url: "/report/applet/reportApiEquipOverdue/list",
  12485. method: 'GET',
  12486. data: data
  12487. });
  12488. };
  12489. //设备管控-设备使用寿命-统计
  12490. exports.reportAppletReportApiEquipOverdueList = reportAppletReportApiEquipOverdueList;
  12491. var reportAppletReportApiEquipLifeList = function reportAppletReportApiEquipLifeList(data) {
  12492. return (0, _request.apiResquest)({
  12493. url: "/report/applet/reportApiEquipLife/list",
  12494. method: 'GET',
  12495. data: data
  12496. });
  12497. };
  12498. //设备管控-超期服役设备-列表
  12499. exports.reportAppletReportApiEquipLifeList = reportAppletReportApiEquipLifeList;
  12500. var reportAppletReportApiEquipOverdueGetLifePageList = function reportAppletReportApiEquipOverdueGetLifePageList(data) {
  12501. return (0, _request.apiResquest)({
  12502. url: "/report/applet/reportApiEquipOverdue/getLifePageList",
  12503. method: 'GET',
  12504. data: data
  12505. });
  12506. };
  12507. //设备管控-设备使用寿命-列表
  12508. exports.reportAppletReportApiEquipOverdueGetLifePageList = reportAppletReportApiEquipOverdueGetLifePageList;
  12509. var reportAppletReportApiEquipLifeGetReportBsEquipLifeList = function reportAppletReportApiEquipLifeGetReportBsEquipLifeList(data) {
  12510. return (0, _request.apiResquest)({
  12511. url: "/report/applet/reportApiEquipLife/getReportBsEquipLifeList",
  12512. method: 'POST',
  12513. data: _objectSpread({}, data)
  12514. });
  12515. };
  12516. //大仪预约-使用使用排行TOP10
  12517. exports.reportAppletReportApiEquipLifeGetReportBsEquipLifeList = reportAppletReportApiEquipLifeGetReportBsEquipLifeList;
  12518. var reportAppletReportApiEquipRankTopList = function reportAppletReportApiEquipRankTopList(data) {
  12519. return (0, _request.apiResquest)({
  12520. url: "/report/applet/reportApiEquipRank/topList",
  12521. method: 'GET',
  12522. data: data
  12523. });
  12524. };
  12525. //大仪预约-大仪预约排行
  12526. exports.reportAppletReportApiEquipRankTopList = reportAppletReportApiEquipRankTopList;
  12527. var reportAppletReportBsEquipAppointTopList = function reportAppletReportBsEquipAppointTopList(data) {
  12528. return (0, _request.apiResquest)({
  12529. url: "/report/applet/reportBsEquipAppoint/topList",
  12530. method: 'GET',
  12531. data: data
  12532. });
  12533. };
  12534. //大仪预约-设备总数
  12535. exports.reportAppletReportBsEquipAppointTopList = reportAppletReportBsEquipAppointTopList;
  12536. var reportAppletReportBsEquipStatusList = function reportAppletReportBsEquipStatusList(data) {
  12537. return (0, _request.apiResquest)({
  12538. url: "/report/applet/reportBsEquipStatus/list",
  12539. method: 'GET',
  12540. data: data
  12541. });
  12542. };
  12543. //笼位预约概况
  12544. exports.reportAppletReportBsEquipStatusList = reportAppletReportBsEquipStatusList;
  12545. var reportAppletReportApiCageRateList = function reportAppletReportApiCageRateList(data) {
  12546. return (0, _request.apiResquest)({
  12547. url: "/report/applet/reportApiCageRate/list",
  12548. method: 'GET',
  12549. data: data
  12550. });
  12551. };
  12552. //笼位预约-实验室A-B楼
  12553. exports.reportAppletReportApiCageRateList = reportAppletReportApiCageRateList;
  12554. var reportAppletReportApiCageRateCageRateList = function reportAppletReportApiCageRateCageRateList(data) {
  12555. return (0, _request.apiResquest)({
  12556. url: "/report/applet/reportApiCageRate/cageRateList",
  12557. method: 'GET',
  12558. data: data
  12559. });
  12560. };
  12561. //资源预约情况
  12562. exports.reportAppletReportApiCageRateCageRateList = reportAppletReportApiCageRateCageRateList;
  12563. var reportAppletReportApiResourceRateResourceList = function reportAppletReportApiResourceRateResourceList(data) {
  12564. return (0, _request.apiResquest)({
  12565. url: "/report/applet/reportApiResourceRate/resourceList",
  12566. method: 'GET',
  12567. data: data
  12568. });
  12569. };
  12570. //资源室隐患统计
  12571. exports.reportAppletReportApiResourceRateResourceList = reportAppletReportApiResourceRateResourceList;
  12572. var reportAppletReportApiResourceRateAnalysisList = function reportAppletReportApiResourceRateAnalysisList(data) {
  12573. return (0, _request.apiResquest)({
  12574. url: "/report/applet/reportApiResourceRate/analysisList",
  12575. method: 'GET',
  12576. data: data
  12577. });
  12578. };
  12579. /************************扫码相关************************/
  12580. //化学品终端-扫码登录
  12581. exports.reportAppletReportApiResourceRateAnalysisList = reportAppletReportApiResourceRateAnalysisList;
  12582. var chemicalAioVerifyScanLogin = function chemicalAioVerifyScanLogin(data) {
  12583. return (0, _request.apiResquest)({
  12584. url: "/chemical/aio/verify/scanLogin",
  12585. method: 'GET',
  12586. data: data
  12587. });
  12588. };
  12589. //化学品终端-双人认证
  12590. exports.chemicalAioVerifyScanLogin = chemicalAioVerifyScanLogin;
  12591. var chemicalAioVerifyAppletLogin = function chemicalAioVerifyAppletLogin(data) {
  12592. return (0, _request.apiResquest)({
  12593. url: "/chemical/aio/verify/appletLogin",
  12594. method: 'GET',
  12595. data: data
  12596. });
  12597. };
  12598. //电子信息牌二维码-小程序扫码验证
  12599. exports.chemicalAioVerifyAppletLogin = chemicalAioVerifyAppletLogin;
  12600. var laboratoryAppBoardScanCodeVerification = function laboratoryAppBoardScanCodeVerification(data) {
  12601. return (0, _request.apiResquest)({
  12602. url: "/laboratory/app/board/scanCodeVerification",
  12603. method: 'POST',
  12604. data: _objectSpread({}, data)
  12605. });
  12606. };
  12607. /************************消息相关************************/
  12608. //消息-未读消息数量
  12609. exports.laboratoryAppBoardScanCodeVerification = laboratoryAppBoardScanCodeVerification;
  12610. var systemNoticeGetNoticeCount = function systemNoticeGetNoticeCount(id, data) {
  12611. return (0, _request.apiResquest)({
  12612. url: "/system/notice/getNoticeCount",
  12613. method: 'GET',
  12614. data: data
  12615. });
  12616. };
  12617. //消息-列表
  12618. exports.systemNoticeGetNoticeCount = systemNoticeGetNoticeCount;
  12619. var systemNoticeGetNoticeList = function systemNoticeGetNoticeList(data) {
  12620. return (0, _request.apiResquest)({
  12621. url: "/system/notice/getNoticeList",
  12622. method: 'GET',
  12623. data: data
  12624. });
  12625. };
  12626. //消息-详情
  12627. exports.systemNoticeGetNoticeList = systemNoticeGetNoticeList;
  12628. var systemNoticeGetNoticeDetail = function systemNoticeGetNoticeDetail(data) {
  12629. return (0, _request.apiResquest)({
  12630. url: "/system/notice/getNoticeDetail",
  12631. method: 'GET',
  12632. data: data
  12633. });
  12634. };
  12635. //消息-获取系统消息类型
  12636. exports.systemNoticeGetNoticeDetail = systemNoticeGetNoticeDetail;
  12637. var systemNoticeGetNoticeType = function systemNoticeGetNoticeType(data) {
  12638. return (0, _request.apiResquest)({
  12639. url: "/system/notice/getNoticeType",
  12640. method: 'GET',
  12641. data: data
  12642. });
  12643. };
  12644. //查询人脸信息与认证状态
  12645. exports.systemNoticeGetNoticeType = systemNoticeGetNoticeType;
  12646. var studentinfoFacemy = function studentinfoFacemy(data) {
  12647. return (0, _request.apiResquest)({
  12648. url: "/base/app/lab/api/studentinfo/my",
  12649. method: 'GET'
  12650. });
  12651. };
  12652. /************************未调试************************/
  12653. //获取离开检查配置
  12654. exports.studentinfoFacemy = studentinfoFacemy;
  12655. var outSubjectPhoto = function outSubjectPhoto(id, data) {
  12656. return (0, _request.apiResquestForm)({
  12657. url: "/base/app/lab/api/outSubjectPhoto",
  12658. method: 'GET',
  12659. data: data
  12660. });
  12661. };
  12662. //分级管控未完成工作列表
  12663. exports.outSubjectPhoto = outSubjectPhoto;
  12664. var gradingControl = function gradingControl(data) {
  12665. return (0, _request.apiResquest)({
  12666. url: "/base/app/lab/manage/havingList",
  12667. method: 'POST',
  12668. data: _objectSpread({}, data)
  12669. });
  12670. };
  12671. //积分信息
  12672. exports.gradingControl = gradingControl;
  12673. var examPointsRecordGetMyPointsLogInfo = function examPointsRecordGetMyPointsLogInfo(data) {
  12674. return (0, _request.apiResquest)({
  12675. url: "/exam/points/record/getMyPointsLogInfo",
  12676. method: 'POST',
  12677. data: _objectSpread({}, data)
  12678. });
  12679. };
  12680. //积分信息(新-对接学习考试后的)
  12681. exports.examPointsRecordGetMyPointsLogInfo = examPointsRecordGetMyPointsLogInfo;
  12682. var creditAppletGetMyPointsLogInfo = function creditAppletGetMyPointsLogInfo(data) {
  12683. return (0, _request.apiResquest)({
  12684. url: "/credit/applet/getMyPointsLogInfo",
  12685. method: 'POST',
  12686. data: _objectSpread({}, data)
  12687. });
  12688. };
  12689. //实验室-列表-获取学院列表下拉列表
  12690. exports.creditAppletGetMyPointsLogInfo = creditAppletGetMyPointsLogInfo;
  12691. var systemDeptDropList = function systemDeptDropList(data) {
  12692. return (0, _request.apiResquest)({
  12693. url: "/system/dept/dropList",
  12694. method: 'POST',
  12695. data: _objectSpread({}, data)
  12696. });
  12697. };
  12698. //实验室-列表-获取分类下拉列表
  12699. exports.systemDeptDropList = systemDeptDropList;
  12700. var laboratoryClassTypeGetList = function laboratoryClassTypeGetList(data) {
  12701. return (0, _request.apiResquest)({
  12702. url: "/laboratory/typeConfig/getList",
  12703. method: 'POST',
  12704. data: _objectSpread({}, data)
  12705. });
  12706. };
  12707. //实验室-列表-获取分级
  12708. exports.laboratoryClassTypeGetList = laboratoryClassTypeGetList;
  12709. var laboratoryClassLevelGetList = function laboratoryClassLevelGetList(data) {
  12710. return (0, _request.apiResquest)({
  12711. url: "/laboratory/levelConfig/getLevelTitleList",
  12712. method: 'POST',
  12713. data: _objectSpread({}, data)
  12714. });
  12715. };
  12716. //查询用户信息-(初始密码/手机号/导师/身份)
  12717. exports.laboratoryClassLevelGetList = laboratoryClassLevelGetList;
  12718. var systemUserPersonalData = function systemUserPersonalData(data) {
  12719. return (0, _request.apiResquest)({
  12720. url: "/system/user/personalData",
  12721. method: 'get'
  12722. });
  12723. };
  12724. //根据 token 获取用户信息
  12725. exports.systemUserPersonalData = systemUserPersonalData;
  12726. var authGetAppletUser = function authGetAppletUser(data) {
  12727. return (0, _request.apiResquest)({
  12728. url: "/auth/getAppletUser",
  12729. method: 'POST',
  12730. data: _objectSpread({}, data)
  12731. });
  12732. };
  12733. //查询是否是同位素实验并且有签退
  12734. exports.authGetAppletUser = authGetAppletUser;
  12735. var laboratorySubPassOutIsotopeSubSign = function laboratorySubPassOutIsotopeSubSign(data) {
  12736. return (0, _request.apiResquest)({
  12737. url: "/laboratory/subPassOut/isotopeSubSign",
  12738. method: 'GET',
  12739. data: data
  12740. });
  12741. };
  12742. //扫码查询-化学品基本信息
  12743. exports.laboratorySubPassOutIsotopeSubSign = laboratorySubPassOutIsotopeSubSign;
  12744. var chemicalAppletSelectStockInfo = function chemicalAppletSelectStockInfo(data) {
  12745. return (0, _request.apiResquest)({
  12746. url: "/chemical/applet/selectStockInfo",
  12747. method: 'POST',
  12748. data: _objectSpread({}, data)
  12749. });
  12750. };
  12751. //查询当前用户下的预案触发数据
  12752. exports.chemicalAppletSelectStockInfo = chemicalAppletSelectStockInfo;
  12753. var laboratoryBigViewSelectTriggerInfo = function laboratoryBigViewSelectTriggerInfo(data) {
  12754. return (0, _request.apiResquest)({
  12755. url: "/laboratory/bigView/selectTriggerInfo",
  12756. method: 'GET',
  12757. data: data
  12758. });
  12759. };
  12760. //应急处置-结束预案
  12761. exports.laboratoryBigViewSelectTriggerInfo = laboratoryBigViewSelectTriggerInfo;
  12762. var laboratoryPlanCloseRiskPlan = function laboratoryPlanCloseRiskPlan(data) {
  12763. return (0, _request.apiResquest)({
  12764. url: "/laboratory/plan/closeRiskPlan",
  12765. method: 'GET',
  12766. data: data
  12767. });
  12768. };
  12769. //-应急处置-楼层布局数据
  12770. exports.laboratoryPlanCloseRiskPlan = laboratoryPlanCloseRiskPlan;
  12771. var laboratoryBigViewGetFloorByBigView = function laboratoryBigViewGetFloorByBigView(data) {
  12772. return (0, _request.apiResquest)({
  12773. url: "/laboratory/bigView/getFloorByBigView",
  12774. method: 'GET',
  12775. data: data
  12776. });
  12777. };
  12778. //查询是否是管理员/安全员
  12779. exports.laboratoryBigViewGetFloorByBigView = laboratoryBigViewGetFloorByBigView;
  12780. var systemSubjectCheckIsAdminOrSafeUser = function systemSubjectCheckIsAdminOrSafeUser(data) {
  12781. return (0, _request.apiResquest)({
  12782. url: "/system/subject/checkIsAdminOrSafeUser",
  12783. method: 'GET',
  12784. data: data
  12785. });
  12786. };
  12787. //查询安全准入是否有-待审核
  12788. exports.systemSubjectCheckIsAdminOrSafeUser = systemSubjectCheckIsAdminOrSafeUser;
  12789. var laboratoryAppletCheckApplyPending = function laboratoryAppletCheckApplyPending(data) {
  12790. return (0, _request.apiResquest)({
  12791. url: "/laboratory/applet/checkApplyPending",
  12792. method: 'GET',
  12793. data: data
  12794. });
  12795. };
  12796. //查询申请列表是否有未查看-通过/驳回
  12797. exports.laboratoryAppletCheckApplyPending = laboratoryAppletCheckApplyPending;
  12798. var laboratoryAppletCheckPassOrNo = function laboratoryAppletCheckPassOrNo(data) {
  12799. return (0, _request.apiResquest)({
  12800. url: "/laboratory/applet/checkPassOrNo",
  12801. method: 'GET',
  12802. data: data
  12803. });
  12804. };
  12805. exports.laboratoryAppletCheckPassOrNo = laboratoryAppletCheckPassOrNo;
  12806. /***/ }),
  12807. /* 64 */
  12808. /*!**************************************************!*\
  12809. !*** E:/git/2021项目/v3-H5/api/request/request.js ***!
  12810. \**************************************************/
  12811. /*! no static exports found */
  12812. /***/ (function(module, exports, __webpack_require__) {
  12813. "use strict";
  12814. /* WEBPACK VAR INJECTION */(function(uni) {
  12815. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12816. Object.defineProperty(exports, "__esModule", {
  12817. value: true
  12818. });
  12819. exports.apiResquestTimer = exports.apiResquestOutside = exports.apiResquestJsonList = exports.apiResquestFormVideo = exports.apiResquestForm = exports.apiResquest = void 0;
  12820. exports.loginTimeout = loginTimeout;
  12821. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  12822. var _config = __webpack_require__(/*! ./config.js */ 33);
  12823. var _util = __webpack_require__(/*! ./util.js */ 65);
  12824. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  12825. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  12826. var apiResquest = function apiResquest(prams) {
  12827. return new Promise(function (resolve, reject) {
  12828. var url = _config.config.base_url + prams.url;
  12829. uni.showLoading({
  12830. title: '加载中',
  12831. mask: true
  12832. });
  12833. // get请求映射params参数
  12834. if (prams.method === 'GET' && prams.data) {
  12835. url = url + '?' + (0, _util.tansParams)(prams.data);
  12836. url = url.slice(0, -1);
  12837. prams.data = {};
  12838. }
  12839. return uni.request({
  12840. timeout: 10000,
  12841. url: url,
  12842. data: _objectSpread({}, prams.data),
  12843. method: prams.method,
  12844. header: {
  12845. 'content-type': 'application/json;charset=utf-8',
  12846. 'Authorization': uni.getStorageSync('token')
  12847. },
  12848. success: function success(res) {
  12849. // 成功
  12850. uni.hideLoading();
  12851. if (res.statusCode == 200) {
  12852. if (res.data.code == 200) {
  12853. resolve(res);
  12854. } else if (res.data.code == 401) {
  12855. loginTimeout();
  12856. } else {
  12857. uni.showToast({
  12858. mask: true,
  12859. icon: "none",
  12860. position: "center",
  12861. title: res.data.message,
  12862. duration: 2000
  12863. });
  12864. resolve(res);
  12865. }
  12866. } else if (res.statusCode == 401) {
  12867. loginTimeout();
  12868. } else {
  12869. uni.showToast({
  12870. mask: true,
  12871. icon: "none",
  12872. position: "center",
  12873. title: '连接异常,请联系管理员.',
  12874. duration: 2000
  12875. });
  12876. resolve(res);
  12877. }
  12878. },
  12879. fail: function fail(err) {
  12880. // 失败
  12881. uni.hideLoading();
  12882. uni.showToast({
  12883. mask: true,
  12884. icon: "none",
  12885. position: "center",
  12886. title: '出错啦~请联系管理员!',
  12887. duration: 2000
  12888. });
  12889. },
  12890. complete: function complete() {
  12891. // 完成
  12892. }
  12893. });
  12894. });
  12895. };
  12896. exports.apiResquest = apiResquest;
  12897. var apiResquestOutside = function apiResquestOutside(prams) {
  12898. return new Promise(function (resolve, reject) {
  12899. var url = prams.url;
  12900. uni.showLoading({
  12901. title: '加载中',
  12902. mask: true
  12903. });
  12904. // get请求映射params参数
  12905. if (prams.method === 'GET' && prams.data) {
  12906. url = url + '?' + (0, _util.tansParams)(prams.data);
  12907. url = url.slice(0, -1);
  12908. prams.data = {};
  12909. }
  12910. return uni.request({
  12911. timeout: 10000,
  12912. url: url,
  12913. data: _objectSpread({}, prams.data),
  12914. method: prams.method,
  12915. header: {
  12916. 'content-type': 'application/json;charset=utf-8',
  12917. 'Authorization': uni.getStorageSync('token')
  12918. },
  12919. success: function success(res) {
  12920. // 成功
  12921. uni.hideLoading();
  12922. if (res.statusCode == 200) {
  12923. if (res.data.code == 200) {
  12924. resolve(res);
  12925. } else if (res.data.code == 401) {
  12926. loginTimeout();
  12927. } else {
  12928. uni.showToast({
  12929. mask: true,
  12930. icon: "none",
  12931. position: "center",
  12932. title: res.data.message,
  12933. duration: 2000
  12934. });
  12935. resolve(res);
  12936. }
  12937. } else if (res.statusCode == 401) {
  12938. loginTimeout();
  12939. } else {
  12940. uni.showToast({
  12941. mask: true,
  12942. icon: "none",
  12943. position: "center",
  12944. title: '连接异常,请联系管理员.',
  12945. duration: 2000
  12946. });
  12947. resolve(res);
  12948. }
  12949. },
  12950. fail: function fail(err) {
  12951. // 失败
  12952. uni.hideLoading();
  12953. uni.showToast({
  12954. mask: true,
  12955. icon: "none",
  12956. position: "center",
  12957. title: '出错啦~请联系管理员!',
  12958. duration: 2000
  12959. });
  12960. },
  12961. complete: function complete() {
  12962. // 完成
  12963. }
  12964. });
  12965. });
  12966. };
  12967. exports.apiResquestOutside = apiResquestOutside;
  12968. var apiResquestForm = function apiResquestForm(prams) {
  12969. return new Promise(function (resolve, reject) {
  12970. var url = _config.config.base_url + prams.url;
  12971. uni.showLoading({
  12972. title: '加载中',
  12973. mask: true
  12974. });
  12975. // get请求映射params参数
  12976. if (prams.method === 'GET' && prams.data) {
  12977. url = url + '?' + (0, _util.tansParams)(prams.data);
  12978. url = url.slice(0, -1);
  12979. prams.data = {};
  12980. }
  12981. return uni.request({
  12982. timeout: 10000,
  12983. url: url,
  12984. data: _objectSpread({}, prams.data),
  12985. method: prams.method,
  12986. header: {
  12987. 'content-type': 'application/x-www-form-urlencoded',
  12988. 'Authorization': uni.getStorageSync('token')
  12989. },
  12990. success: function success(res) {
  12991. // 成功
  12992. uni.hideLoading();
  12993. if (res.statusCode == 200) {
  12994. if (res.data.code == 200) {
  12995. resolve(res);
  12996. } else if (res.data.code == 401) {
  12997. loginTimeout();
  12998. } else {
  12999. uni.showToast({
  13000. mask: true,
  13001. icon: "none",
  13002. position: "center",
  13003. title: res.data.message,
  13004. duration: 2000
  13005. });
  13006. resolve(res);
  13007. }
  13008. } else if (res.statusCode == 401) {
  13009. loginTimeout();
  13010. } else {
  13011. uni.showToast({
  13012. mask: true,
  13013. icon: "none",
  13014. position: "center",
  13015. title: '连接异常,请联系管理员.',
  13016. duration: 2000
  13017. });
  13018. resolve(res);
  13019. }
  13020. },
  13021. fail: function fail(err) {
  13022. // 失败
  13023. uni.hideLoading();
  13024. uni.showToast({
  13025. mask: true,
  13026. icon: "none",
  13027. position: "center",
  13028. title: '出错啦~请联系管理员!',
  13029. duration: 2000
  13030. });
  13031. },
  13032. complete: function complete() {
  13033. // 完成
  13034. }
  13035. });
  13036. });
  13037. };
  13038. exports.apiResquestForm = apiResquestForm;
  13039. var apiResquestJsonList = function apiResquestJsonList(prams) {
  13040. return new Promise(function (resolve, reject) {
  13041. var url = _config.config.base_url + prams.url;
  13042. uni.showLoading({
  13043. title: '加载中',
  13044. mask: true
  13045. });
  13046. // get请求映射params参数
  13047. if (prams.method === 'GET' && prams.data) {
  13048. url = url + '?' + (0, _util.tansParams)(prams.data);
  13049. url = url.slice(0, -1);
  13050. prams.data = {};
  13051. }
  13052. return uni.request({
  13053. timeout: 10000,
  13054. url: url,
  13055. data: prams.data,
  13056. method: prams.method,
  13057. header: {
  13058. 'content-type': 'application/json',
  13059. 'Authorization': uni.getStorageSync('token')
  13060. },
  13061. success: function success(res) {
  13062. // 成功
  13063. uni.hideLoading();
  13064. if (res.statusCode == 200) {
  13065. if (res.data.code == 200) {
  13066. resolve(res);
  13067. } else if (res.data.code == 401) {
  13068. loginTimeout();
  13069. } else {
  13070. uni.showToast({
  13071. mask: true,
  13072. icon: "none",
  13073. position: "center",
  13074. title: res.data.message,
  13075. duration: 2000
  13076. });
  13077. resolve(res);
  13078. }
  13079. } else if (res.statusCode == 401) {
  13080. loginTimeout();
  13081. } else {
  13082. uni.showToast({
  13083. mask: true,
  13084. icon: "none",
  13085. position: "center",
  13086. title: '连接异常,请联系管理员.',
  13087. duration: 2000
  13088. });
  13089. resolve(res);
  13090. }
  13091. },
  13092. fail: function fail(err) {
  13093. // 失败
  13094. uni.hideLoading();
  13095. uni.showToast({
  13096. mask: true,
  13097. icon: "none",
  13098. position: "center",
  13099. title: '出错啦~请联系管理员!',
  13100. duration: 2000
  13101. });
  13102. },
  13103. complete: function complete() {
  13104. // 完成
  13105. }
  13106. });
  13107. });
  13108. };
  13109. exports.apiResquestJsonList = apiResquestJsonList;
  13110. var apiResquestFormVideo = function apiResquestFormVideo(prams) {
  13111. return new Promise(function (resolve, reject) {
  13112. var url = uni.getStorageSync('cameraExtranetAgent') + prams.url;
  13113. uni.showLoading({
  13114. title: '加载中',
  13115. mask: true
  13116. });
  13117. // get请求映射params参数
  13118. if (prams.method === 'GET' && prams.data) {
  13119. url = url + '?' + (0, _util.tansParams)(prams.data);
  13120. url = url.slice(0, -1);
  13121. prams.data = {};
  13122. }
  13123. return uni.request({
  13124. timeout: 10000,
  13125. url: url,
  13126. data: _objectSpread({}, prams.data),
  13127. method: prams.method,
  13128. header: {
  13129. 'content-type': 'application/x-www-form-urlencoded',
  13130. 'Authorization': uni.getStorageSync('token')
  13131. },
  13132. success: function success(res) {
  13133. // 成功
  13134. uni.hideLoading();
  13135. if (res.statusCode == 200) {
  13136. if (res.data.code == 200) {
  13137. resolve(res);
  13138. } else if (res.data.code == 401) {
  13139. loginTimeout();
  13140. } else {
  13141. uni.showToast({
  13142. mask: true,
  13143. icon: "none",
  13144. position: "center",
  13145. title: res.data.message,
  13146. duration: 2000
  13147. });
  13148. resolve(res);
  13149. }
  13150. } else if (res.statusCode == 401) {
  13151. loginTimeout();
  13152. } else {
  13153. uni.showToast({
  13154. mask: true,
  13155. icon: "none",
  13156. position: "center",
  13157. title: '连接异常,请联系管理员.',
  13158. duration: 2000
  13159. });
  13160. resolve(res);
  13161. }
  13162. },
  13163. fail: function fail(err) {
  13164. // 失败
  13165. uni.hideLoading();
  13166. uni.showToast({
  13167. mask: true,
  13168. icon: "none",
  13169. position: "center",
  13170. title: '出错啦~请联系管理员!',
  13171. duration: 2000
  13172. });
  13173. },
  13174. complete: function complete() {
  13175. // 完成
  13176. }
  13177. });
  13178. });
  13179. };
  13180. exports.apiResquestFormVideo = apiResquestFormVideo;
  13181. var apiResquestTimer = function apiResquestTimer(prams) {
  13182. return new Promise(function (resolve, reject) {
  13183. var url = _config.config.base_url + prams.url;
  13184. // get请求映射params参数
  13185. if (prams.method === 'GET' && prams.data) {
  13186. url = url + '?' + (0, _util.tansParams)(prams.data);
  13187. url = url.slice(0, -1);
  13188. prams.data = {};
  13189. }
  13190. return uni.request({
  13191. timeout: 10000,
  13192. url: url,
  13193. data: _objectSpread({}, prams.data),
  13194. method: prams.method,
  13195. header: {
  13196. 'content-type': 'application/json;charset=utf-8',
  13197. 'Authorization': uni.getStorageSync('token')
  13198. },
  13199. success: function success(res) {
  13200. // 成功
  13201. uni.hideLoading();
  13202. if (res.statusCode == 200) {
  13203. if (res.data.code == 200) {
  13204. resolve(res);
  13205. } else if (res.data.code == 401) {
  13206. loginTimeout();
  13207. } else {
  13208. uni.showToast({
  13209. mask: true,
  13210. icon: "none",
  13211. position: "center",
  13212. title: res.data.message,
  13213. duration: 2000
  13214. });
  13215. resolve(res);
  13216. }
  13217. } else if (res.statusCode == 401) {
  13218. loginTimeout();
  13219. } else {
  13220. uni.showToast({
  13221. mask: true,
  13222. icon: "none",
  13223. position: "center",
  13224. title: '连接异常,请联系管理员.',
  13225. duration: 2000
  13226. });
  13227. resolve(res);
  13228. }
  13229. },
  13230. fail: function fail(err) {
  13231. // 失败
  13232. uni.hideLoading();
  13233. uni.showToast({
  13234. mask: true,
  13235. icon: "none",
  13236. position: "center",
  13237. title: '出错啦~请联系管理员!',
  13238. duration: 2000
  13239. });
  13240. },
  13241. complete: function complete() {
  13242. // 完成
  13243. }
  13244. });
  13245. });
  13246. };
  13247. //登录超时-退出至登录页面
  13248. exports.apiResquestTimer = apiResquestTimer;
  13249. function loginTimeout(params) {
  13250. uni.showToast({
  13251. mask: true,
  13252. icon: "none",
  13253. position: "center",
  13254. title: "登录超时,请重新登录~",
  13255. duration: 2000
  13256. });
  13257. uni.removeStorageSync('token');
  13258. uni.removeStorageSync('userId');
  13259. uni.removeStorageSync('userType');
  13260. setTimeout(function () {
  13261. uni.redirectTo({
  13262. url: '/pages/views/login/login'
  13263. });
  13264. }, 2000);
  13265. }
  13266. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  13267. /***/ }),
  13268. /* 65 */
  13269. /*!***********************************************!*\
  13270. !*** E:/git/2021项目/v3-H5/api/request/util.js ***!
  13271. \***********************************************/
  13272. /*! no static exports found */
  13273. /***/ (function(module, exports, __webpack_require__) {
  13274. "use strict";
  13275. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  13276. Object.defineProperty(exports, "__esModule", {
  13277. value: true
  13278. });
  13279. exports.tansParams = tansParams;
  13280. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  13281. function tansParams(params) {
  13282. var result = '';
  13283. for (var _i = 0, _Object$keys = Object.keys(params); _i < _Object$keys.length; _i++) {
  13284. var propName = _Object$keys[_i];
  13285. var value = params[propName];
  13286. var part = encodeURIComponent(propName) + "=";
  13287. if (value !== null && typeof value !== "undefined") {
  13288. if ((0, _typeof2.default)(value) === 'object') {
  13289. for (var _i2 = 0, _Object$keys2 = Object.keys(value); _i2 < _Object$keys2.length; _i2++) {
  13290. var key = _Object$keys2[_i2];
  13291. if (value[key] !== null && typeof value[key] !== 'undefined') {
  13292. var _params = propName + '[' + key + ']';
  13293. var subPart = encodeURIComponent(_params) + "=";
  13294. result += subPart + encodeURIComponent(value[key]) + "&";
  13295. }
  13296. }
  13297. } else {
  13298. result += part + encodeURIComponent(value) + "&";
  13299. }
  13300. }
  13301. }
  13302. return result;
  13303. }
  13304. /***/ }),
  13305. /* 66 */,
  13306. /* 67 */,
  13307. /* 68 */,
  13308. /* 69 */,
  13309. /* 70 */,
  13310. /* 71 */,
  13311. /* 72 */,
  13312. /* 73 */,
  13313. /* 74 */
  13314. /*!*********************************************!*\
  13315. !*** E:/git/2021项目/v3-H5/utils/mqtt.min.js ***!
  13316. \*********************************************/
  13317. /*! no static exports found */
  13318. /***/ (function(module, exports, __webpack_require__) {
  13319. /* WEBPACK VAR INJECTION */(function(global, wx) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  13320. (function (f) {
  13321. if (( false ? undefined : _typeof(exports)) === "object" && typeof module !== "undefined") {
  13322. module.exports = f();
  13323. } else if (true) {
  13324. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (f),
  13325. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  13326. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  13327. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  13328. } else { var g; }
  13329. })(function () {
  13330. var define, module, exports;
  13331. return function () {
  13332. function r(e, n, t) {
  13333. function o(i, f) {
  13334. if (!n[i]) {
  13335. if (!e[i]) {
  13336. var c = "function" == typeof require && require;
  13337. if (!f && c) return require(i, !0);
  13338. if (u) return u(i, !0);
  13339. var a = new Error("Cannot find module '" + i + "'");
  13340. throw a.code = "MODULE_NOT_FOUND", a;
  13341. }
  13342. var p = n[i] = {
  13343. exports: {}
  13344. };
  13345. e[i][0].call(p.exports, function (r) {
  13346. var n = e[i][1][r];
  13347. return o(n || r);
  13348. }, p, p.exports, r, e, n, t);
  13349. }
  13350. return n[i].exports;
  13351. }
  13352. for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {
  13353. o(t[i]);
  13354. }
  13355. return o;
  13356. }
  13357. return r;
  13358. }()({
  13359. 1: [function (require, module, exports) {
  13360. (function (process, global) {
  13361. "use strict";
  13362. var events = require("events");
  13363. var Store = require("./store");
  13364. var mqttPacket = require("mqtt-packet");
  13365. var Writable = require("readable-stream").Writable;
  13366. var inherits = require("inherits");
  13367. var reInterval = require("reinterval");
  13368. var validations = require("./validations");
  13369. var xtend = require("xtend");
  13370. var setImmediate = global.setImmediate || function (callback) {
  13371. process.nextTick(callback);
  13372. };
  13373. var defaultConnectOptions = {
  13374. keepalive: 60,
  13375. reschedulePings: true,
  13376. protocolId: "MQTT",
  13377. protocolVersion: 4,
  13378. reconnectPeriod: 1e3,
  13379. connectTimeout: 30 * 1e3,
  13380. clean: true,
  13381. resubscribe: true
  13382. };
  13383. var errors = {
  13384. 0: "",
  13385. 1: "Unacceptable protocol version",
  13386. 2: "Identifier rejected",
  13387. 3: "Server unavailable",
  13388. 4: "Bad username or password",
  13389. 5: "Not authorized",
  13390. 16: "No matching subscribers",
  13391. 17: "No subscription existed",
  13392. 128: "Unspecified error",
  13393. 129: "Malformed Packet",
  13394. 130: "Protocol Error",
  13395. 131: "Implementation specific error",
  13396. 132: "Unsupported Protocol Version",
  13397. 133: "Client Identifier not valid",
  13398. 134: "Bad User Name or Password",
  13399. 135: "Not authorized",
  13400. 136: "Server unavailable",
  13401. 137: "Server busy",
  13402. 138: "Banned",
  13403. 139: "Server shutting down",
  13404. 140: "Bad authentication method",
  13405. 141: "Keep Alive timeout",
  13406. 142: "Session taken over",
  13407. 143: "Topic Filter invalid",
  13408. 144: "Topic Name invalid",
  13409. 145: "Packet identifier in use",
  13410. 146: "Packet Identifier not found",
  13411. 147: "Receive Maximum exceeded",
  13412. 148: "Topic Alias invalid",
  13413. 149: "Packet too large",
  13414. 150: "Message rate too high",
  13415. 151: "Quota exceeded",
  13416. 152: "Administrative action",
  13417. 153: "Payload format invalid",
  13418. 154: "Retain not supported",
  13419. 155: "QoS not supported",
  13420. 156: "Use another server",
  13421. 157: "Server moved",
  13422. 158: "Shared Subscriptions not supported",
  13423. 159: "Connection rate exceeded",
  13424. 160: "Maximum connect time",
  13425. 161: "Subscription Identifiers not supported",
  13426. 162: "Wildcard Subscriptions not supported"
  13427. };
  13428. function defaultId() {
  13429. return "mqttjs_" + Math.random().toString(16).substr(2, 8);
  13430. }
  13431. function sendPacket(client, packet, cb) {
  13432. client.emit("packetsend", packet);
  13433. var result = mqttPacket.writeToStream(packet, client.stream, client.options);
  13434. if (!result && cb) {
  13435. client.stream.once("drain", cb);
  13436. } else if (cb) {
  13437. cb();
  13438. }
  13439. }
  13440. function flush(queue) {
  13441. if (queue) {
  13442. Object.keys(queue).forEach(function (messageId) {
  13443. if (typeof queue[messageId].cb === "function") {
  13444. queue[messageId].cb(new Error("Connection closed"));
  13445. delete queue[messageId];
  13446. }
  13447. });
  13448. }
  13449. }
  13450. function flushVolatile(queue) {
  13451. if (queue) {
  13452. Object.keys(queue).forEach(function (messageId) {
  13453. if (queue[messageId].volatile && typeof queue[messageId].cb === "function") {
  13454. queue[messageId].cb(new Error("Connection closed"));
  13455. delete queue[messageId];
  13456. }
  13457. });
  13458. }
  13459. }
  13460. function storeAndSend(client, packet, cb, cbStorePut) {
  13461. client.outgoingStore.put(packet, function storedPacket(err) {
  13462. if (err) {
  13463. return cb && cb(err);
  13464. }
  13465. cbStorePut();
  13466. sendPacket(client, packet, cb);
  13467. });
  13468. }
  13469. function nop() {}
  13470. function MqttClient(streamBuilder, options) {
  13471. var k;
  13472. var that = this;
  13473. if (!(this instanceof MqttClient)) {
  13474. return new MqttClient(streamBuilder, options);
  13475. }
  13476. this.options = options || {};
  13477. for (k in defaultConnectOptions) {
  13478. if (typeof this.options[k] === "undefined") {
  13479. this.options[k] = defaultConnectOptions[k];
  13480. } else {
  13481. this.options[k] = options[k];
  13482. }
  13483. }
  13484. this.options.clientId = typeof options.clientId === "string" ? options.clientId : defaultId();
  13485. this.options.customHandleAcks = options.protocolVersion === 5 && options.customHandleAcks ? options.customHandleAcks : function () {
  13486. arguments[3](0);
  13487. };
  13488. this.streamBuilder = streamBuilder;
  13489. this.outgoingStore = options.outgoingStore || new Store();
  13490. this.incomingStore = options.incomingStore || new Store();
  13491. this.queueQoSZero = options.queueQoSZero === undefined ? true : options.queueQoSZero;
  13492. this._resubscribeTopics = {};
  13493. this.messageIdToTopic = {};
  13494. this.pingTimer = null;
  13495. this.connected = false;
  13496. this.disconnecting = false;
  13497. this.queue = [];
  13498. this.connackTimer = null;
  13499. this.reconnectTimer = null;
  13500. this._storeProcessing = false;
  13501. this._packetIdsDuringStoreProcessing = {};
  13502. this.nextId = Math.max(1, Math.floor(Math.random() * 65535));
  13503. this.outgoing = {};
  13504. this._firstConnection = true;
  13505. this.on("close", function () {
  13506. this.connected = false;
  13507. clearTimeout(this.connackTimer);
  13508. });
  13509. this.on("connect", function () {
  13510. var queue = this.queue;
  13511. function deliver() {
  13512. var entry = queue.shift();
  13513. var packet = null;
  13514. if (!entry) {
  13515. return;
  13516. }
  13517. packet = entry.packet;
  13518. that._sendPacket(packet, function (err) {
  13519. if (entry.cb) {
  13520. entry.cb(err);
  13521. }
  13522. deliver();
  13523. });
  13524. }
  13525. deliver();
  13526. });
  13527. this.on("close", function () {
  13528. if (that.pingTimer !== null) {
  13529. that.pingTimer.clear();
  13530. that.pingTimer = null;
  13531. }
  13532. });
  13533. this.on("close", this._setupReconnect);
  13534. events.EventEmitter.call(this);
  13535. this._setupStream();
  13536. }
  13537. inherits(MqttClient, events.EventEmitter);
  13538. MqttClient.prototype._setupStream = function () {
  13539. var connectPacket;
  13540. var that = this;
  13541. var writable = new Writable();
  13542. var parser = mqttPacket.parser(this.options);
  13543. var completeParse = null;
  13544. var packets = [];
  13545. this._clearReconnect();
  13546. this.stream = this.streamBuilder(this);
  13547. parser.on("packet", function (packet) {
  13548. packets.push(packet);
  13549. });
  13550. function nextTickWork() {
  13551. if (packets.length) {
  13552. process.nextTick(work);
  13553. } else {
  13554. var done = completeParse;
  13555. completeParse = null;
  13556. done();
  13557. }
  13558. }
  13559. function work() {
  13560. var packet = packets.shift();
  13561. if (packet) {
  13562. that._handlePacket(packet, nextTickWork);
  13563. } else {
  13564. var done = completeParse;
  13565. completeParse = null;
  13566. if (done) done();
  13567. }
  13568. }
  13569. writable._write = function (buf, enc, done) {
  13570. completeParse = done;
  13571. parser.parse(buf);
  13572. work();
  13573. };
  13574. this.stream.pipe(writable);
  13575. this.stream.on("error", nop);
  13576. this.stream.on("close", function () {
  13577. flushVolatile(that.outgoing);
  13578. that.emit("close");
  13579. });
  13580. connectPacket = Object.create(this.options);
  13581. connectPacket.cmd = "connect";
  13582. sendPacket(this, connectPacket);
  13583. parser.on("error", this.emit.bind(this, "error"));
  13584. if (this.options.properties) {
  13585. if (!this.options.properties.authenticationMethod && this.options.properties.authenticationData) {
  13586. this.emit("error", new Error("Packet has no Authentication Method"));
  13587. return this;
  13588. }
  13589. if (this.options.properties.authenticationMethod && this.options.authPacket && _typeof(this.options.authPacket) === "object") {
  13590. var authPacket = xtend({
  13591. cmd: "auth",
  13592. reasonCode: 0
  13593. }, this.options.authPacket);
  13594. sendPacket(this, authPacket);
  13595. }
  13596. }
  13597. this.stream.setMaxListeners(1e3);
  13598. clearTimeout(this.connackTimer);
  13599. this.connackTimer = setTimeout(function () {
  13600. that._cleanUp(true);
  13601. }, this.options.connectTimeout);
  13602. };
  13603. MqttClient.prototype._handlePacket = function (packet, done) {
  13604. var options = this.options;
  13605. if (options.protocolVersion === 5 && options.properties && options.properties.maximumPacketSize && options.properties.maximumPacketSize < packet.length) {
  13606. this.emit("error", new Error("exceeding packets size " + packet.cmd));
  13607. this.end({
  13608. reasonCode: 149,
  13609. properties: {
  13610. reasonString: "Maximum packet size was exceeded"
  13611. }
  13612. });
  13613. return this;
  13614. }
  13615. this.emit("packetreceive", packet);
  13616. switch (packet.cmd) {
  13617. case "publish":
  13618. this._handlePublish(packet, done);
  13619. break;
  13620. case "puback":
  13621. case "pubrec":
  13622. case "pubcomp":
  13623. case "suback":
  13624. case "unsuback":
  13625. this._handleAck(packet);
  13626. done();
  13627. break;
  13628. case "pubrel":
  13629. this._handlePubrel(packet, done);
  13630. break;
  13631. case "connack":
  13632. this._handleConnack(packet);
  13633. done();
  13634. break;
  13635. case "pingresp":
  13636. this._handlePingresp(packet);
  13637. done();
  13638. break;
  13639. case "disconnect":
  13640. this._handleDisconnect(packet);
  13641. done();
  13642. break;
  13643. default:
  13644. break;
  13645. }
  13646. };
  13647. MqttClient.prototype._checkDisconnecting = function (callback) {
  13648. if (this.disconnecting) {
  13649. if (callback) {
  13650. callback(new Error("client disconnecting"));
  13651. } else {
  13652. this.emit("error", new Error("client disconnecting"));
  13653. }
  13654. }
  13655. return this.disconnecting;
  13656. };
  13657. MqttClient.prototype.publish = function (topic, message, opts, callback) {
  13658. var packet;
  13659. var options = this.options;
  13660. if (typeof opts === "function") {
  13661. callback = opts;
  13662. opts = null;
  13663. }
  13664. var defaultOpts = {
  13665. qos: 0,
  13666. retain: false,
  13667. dup: false
  13668. };
  13669. opts = xtend(defaultOpts, opts);
  13670. if (this._checkDisconnecting(callback)) {
  13671. return this;
  13672. }
  13673. packet = {
  13674. cmd: "publish",
  13675. topic: topic,
  13676. payload: message,
  13677. qos: opts.qos,
  13678. retain: opts.retain,
  13679. messageId: this._nextId(),
  13680. dup: opts.dup
  13681. };
  13682. if (options.protocolVersion === 5) {
  13683. packet.properties = opts.properties;
  13684. if (!options.properties && packet.properties && packet.properties.topicAlias || opts.properties && options.properties && (opts.properties.topicAlias && options.properties.topicAliasMaximum && opts.properties.topicAlias > options.properties.topicAliasMaximum || !options.properties.topicAliasMaximum && opts.properties.topicAlias)) {
  13685. delete packet.properties.topicAlias;
  13686. }
  13687. }
  13688. switch (opts.qos) {
  13689. case 1:
  13690. case 2:
  13691. this.outgoing[packet.messageId] = {
  13692. volatile: false,
  13693. cb: callback || nop
  13694. };
  13695. if (this._storeProcessing) {
  13696. this._packetIdsDuringStoreProcessing[packet.messageId] = false;
  13697. this._storePacket(packet, undefined, opts.cbStorePut);
  13698. } else {
  13699. this._sendPacket(packet, undefined, opts.cbStorePut);
  13700. }
  13701. break;
  13702. default:
  13703. if (this._storeProcessing) {
  13704. this._storePacket(packet, callback, opts.cbStorePut);
  13705. } else {
  13706. this._sendPacket(packet, callback, opts.cbStorePut);
  13707. }
  13708. break;
  13709. }
  13710. return this;
  13711. };
  13712. MqttClient.prototype.subscribe = function () {
  13713. var packet;
  13714. var args = new Array(arguments.length);
  13715. for (var i = 0; i < arguments.length; i++) {
  13716. args[i] = arguments[i];
  13717. }
  13718. var subs = [];
  13719. var obj = args.shift();
  13720. var resubscribe = obj.resubscribe;
  13721. var callback = args.pop() || nop;
  13722. var opts = args.pop();
  13723. var invalidTopic;
  13724. var that = this;
  13725. var version = this.options.protocolVersion;
  13726. delete obj.resubscribe;
  13727. if (typeof obj === "string") {
  13728. obj = [obj];
  13729. }
  13730. if (typeof callback !== "function") {
  13731. opts = callback;
  13732. callback = nop;
  13733. }
  13734. invalidTopic = validations.validateTopics(obj);
  13735. if (invalidTopic !== null) {
  13736. setImmediate(callback, new Error("Invalid topic " + invalidTopic));
  13737. return this;
  13738. }
  13739. if (this._checkDisconnecting(callback)) {
  13740. return this;
  13741. }
  13742. var defaultOpts = {
  13743. qos: 0
  13744. };
  13745. if (version === 5) {
  13746. defaultOpts.nl = false;
  13747. defaultOpts.rap = false;
  13748. defaultOpts.rh = 0;
  13749. }
  13750. opts = xtend(defaultOpts, opts);
  13751. if (Array.isArray(obj)) {
  13752. obj.forEach(function (topic) {
  13753. if (!that._resubscribeTopics.hasOwnProperty(topic) || that._resubscribeTopics[topic].qos < opts.qos || resubscribe) {
  13754. var currentOpts = {
  13755. topic: topic,
  13756. qos: opts.qos
  13757. };
  13758. if (version === 5) {
  13759. currentOpts.nl = opts.nl;
  13760. currentOpts.rap = opts.rap;
  13761. currentOpts.rh = opts.rh;
  13762. currentOpts.properties = opts.properties;
  13763. }
  13764. subs.push(currentOpts);
  13765. }
  13766. });
  13767. } else {
  13768. Object.keys(obj).forEach(function (k) {
  13769. if (!that._resubscribeTopics.hasOwnProperty(k) || that._resubscribeTopics[k].qos < obj[k].qos || resubscribe) {
  13770. var currentOpts = {
  13771. topic: k,
  13772. qos: obj[k].qos
  13773. };
  13774. if (version === 5) {
  13775. currentOpts.nl = obj[k].nl;
  13776. currentOpts.rap = obj[k].rap;
  13777. currentOpts.rh = obj[k].rh;
  13778. currentOpts.properties = opts.properties;
  13779. }
  13780. subs.push(currentOpts);
  13781. }
  13782. });
  13783. }
  13784. packet = {
  13785. cmd: "subscribe",
  13786. subscriptions: subs,
  13787. qos: 1,
  13788. retain: false,
  13789. dup: false,
  13790. messageId: this._nextId()
  13791. };
  13792. if (opts.properties) {
  13793. packet.properties = opts.properties;
  13794. }
  13795. if (!subs.length) {
  13796. callback(null, []);
  13797. return;
  13798. }
  13799. if (this.options.resubscribe) {
  13800. var topics = [];
  13801. subs.forEach(function (sub) {
  13802. if (that.options.reconnectPeriod > 0) {
  13803. var topic = {
  13804. qos: sub.qos
  13805. };
  13806. if (version === 5) {
  13807. topic.nl = sub.nl || false;
  13808. topic.rap = sub.rap || false;
  13809. topic.rh = sub.rh || 0;
  13810. topic.properties = sub.properties;
  13811. }
  13812. that._resubscribeTopics[sub.topic] = topic;
  13813. topics.push(sub.topic);
  13814. }
  13815. });
  13816. that.messageIdToTopic[packet.messageId] = topics;
  13817. }
  13818. this.outgoing[packet.messageId] = {
  13819. volatile: true,
  13820. cb: function cb(err, packet) {
  13821. if (!err) {
  13822. var granted = packet.granted;
  13823. for (var i = 0; i < granted.length; i += 1) {
  13824. subs[i].qos = granted[i];
  13825. }
  13826. }
  13827. callback(err, subs);
  13828. }
  13829. };
  13830. this._sendPacket(packet);
  13831. return this;
  13832. };
  13833. MqttClient.prototype.unsubscribe = function () {
  13834. var packet = {
  13835. cmd: "unsubscribe",
  13836. qos: 1,
  13837. messageId: this._nextId()
  13838. };
  13839. var that = this;
  13840. var args = new Array(arguments.length);
  13841. for (var i = 0; i < arguments.length; i++) {
  13842. args[i] = arguments[i];
  13843. }
  13844. var topic = args.shift();
  13845. var callback = args.pop() || nop;
  13846. var opts = args.pop();
  13847. if (typeof topic === "string") {
  13848. topic = [topic];
  13849. }
  13850. if (typeof callback !== "function") {
  13851. opts = callback;
  13852. callback = nop;
  13853. }
  13854. if (this._checkDisconnecting(callback)) {
  13855. return this;
  13856. }
  13857. if (typeof topic === "string") {
  13858. packet.unsubscriptions = [topic];
  13859. } else if (_typeof(topic) === "object" && topic.length) {
  13860. packet.unsubscriptions = topic;
  13861. }
  13862. if (this.options.resubscribe) {
  13863. packet.unsubscriptions.forEach(function (topic) {
  13864. delete that._resubscribeTopics[topic];
  13865. });
  13866. }
  13867. if (_typeof(opts) === "object" && opts.properties) {
  13868. packet.properties = opts.properties;
  13869. }
  13870. this.outgoing[packet.messageId] = {
  13871. volatile: true,
  13872. cb: callback
  13873. };
  13874. this._sendPacket(packet);
  13875. return this;
  13876. };
  13877. MqttClient.prototype.end = function () {
  13878. var that = this;
  13879. var force = arguments[0];
  13880. var opts = arguments[1];
  13881. var cb = arguments[2];
  13882. if (force == null || typeof force !== "boolean") {
  13883. cb = opts || nop;
  13884. opts = force;
  13885. force = false;
  13886. if (_typeof(opts) !== "object") {
  13887. cb = opts;
  13888. opts = null;
  13889. if (typeof cb !== "function") {
  13890. cb = nop;
  13891. }
  13892. }
  13893. }
  13894. if (_typeof(opts) !== "object") {
  13895. cb = opts;
  13896. opts = null;
  13897. }
  13898. cb = cb || nop;
  13899. function closeStores() {
  13900. that.disconnected = true;
  13901. that.incomingStore.close(function () {
  13902. that.outgoingStore.close(function () {
  13903. if (cb) {
  13904. cb.apply(null, arguments);
  13905. }
  13906. that.emit("end");
  13907. });
  13908. });
  13909. if (that._deferredReconnect) {
  13910. that._deferredReconnect();
  13911. }
  13912. }
  13913. function finish() {
  13914. that._cleanUp(force, setImmediate.bind(null, closeStores), opts);
  13915. }
  13916. if (this.disconnecting) {
  13917. return this;
  13918. }
  13919. this._clearReconnect();
  13920. this.disconnecting = true;
  13921. if (!force && Object.keys(this.outgoing).length > 0) {
  13922. this.once("outgoingEmpty", setTimeout.bind(null, finish, 10));
  13923. } else {
  13924. finish();
  13925. }
  13926. return this;
  13927. };
  13928. MqttClient.prototype.removeOutgoingMessage = function (mid) {
  13929. var cb = this.outgoing[mid] ? this.outgoing[mid].cb : null;
  13930. delete this.outgoing[mid];
  13931. this.outgoingStore.del({
  13932. messageId: mid
  13933. }, function () {
  13934. cb(new Error("Message removed"));
  13935. });
  13936. return this;
  13937. };
  13938. MqttClient.prototype.reconnect = function (opts) {
  13939. var that = this;
  13940. var f = function f() {
  13941. if (opts) {
  13942. that.options.incomingStore = opts.incomingStore;
  13943. that.options.outgoingStore = opts.outgoingStore;
  13944. } else {
  13945. that.options.incomingStore = null;
  13946. that.options.outgoingStore = null;
  13947. }
  13948. that.incomingStore = that.options.incomingStore || new Store();
  13949. that.outgoingStore = that.options.outgoingStore || new Store();
  13950. that.disconnecting = false;
  13951. that.disconnected = false;
  13952. that._deferredReconnect = null;
  13953. that._reconnect();
  13954. };
  13955. if (this.disconnecting && !this.disconnected) {
  13956. this._deferredReconnect = f;
  13957. } else {
  13958. f();
  13959. }
  13960. return this;
  13961. };
  13962. MqttClient.prototype._reconnect = function () {
  13963. this.emit("reconnect");
  13964. this._setupStream();
  13965. };
  13966. MqttClient.prototype._setupReconnect = function () {
  13967. var that = this;
  13968. if (!that.disconnecting && !that.reconnectTimer && that.options.reconnectPeriod > 0) {
  13969. if (!this.reconnecting) {
  13970. this.emit("offline");
  13971. this.reconnecting = true;
  13972. }
  13973. that.reconnectTimer = setInterval(function () {
  13974. that._reconnect();
  13975. }, that.options.reconnectPeriod);
  13976. }
  13977. };
  13978. MqttClient.prototype._clearReconnect = function () {
  13979. if (this.reconnectTimer) {
  13980. clearInterval(this.reconnectTimer);
  13981. this.reconnectTimer = null;
  13982. }
  13983. };
  13984. MqttClient.prototype._cleanUp = function (forced, done) {
  13985. var opts = arguments[2];
  13986. if (done) {
  13987. this.stream.on("close", done);
  13988. }
  13989. if (forced) {
  13990. if (this.options.reconnectPeriod === 0 && this.options.clean) {
  13991. flush(this.outgoing);
  13992. }
  13993. this.stream.destroy();
  13994. } else {
  13995. var packet = xtend({
  13996. cmd: "disconnect"
  13997. }, opts);
  13998. this._sendPacket(packet, setImmediate.bind(null, this.stream.end.bind(this.stream)));
  13999. }
  14000. if (!this.disconnecting) {
  14001. this._clearReconnect();
  14002. this._setupReconnect();
  14003. }
  14004. if (this.pingTimer !== null) {
  14005. this.pingTimer.clear();
  14006. this.pingTimer = null;
  14007. }
  14008. if (done && !this.connected) {
  14009. this.stream.removeListener("close", done);
  14010. done();
  14011. }
  14012. };
  14013. MqttClient.prototype._sendPacket = function (packet, cb, cbStorePut) {
  14014. cbStorePut = cbStorePut || nop;
  14015. if (!this.connected) {
  14016. this._storePacket(packet, cb, cbStorePut);
  14017. return;
  14018. }
  14019. this._shiftPingInterval();
  14020. switch (packet.cmd) {
  14021. case "publish":
  14022. break;
  14023. case "pubrel":
  14024. storeAndSend(this, packet, cb, cbStorePut);
  14025. return;
  14026. default:
  14027. sendPacket(this, packet, cb);
  14028. return;
  14029. }
  14030. switch (packet.qos) {
  14031. case 2:
  14032. case 1:
  14033. storeAndSend(this, packet, cb, cbStorePut);
  14034. break;
  14035. case 0:
  14036. default:
  14037. sendPacket(this, packet, cb);
  14038. break;
  14039. }
  14040. };
  14041. MqttClient.prototype._storePacket = function (packet, cb, cbStorePut) {
  14042. cbStorePut = cbStorePut || nop;
  14043. if ((packet.qos || 0) === 0 && this.queueQoSZero || packet.cmd !== "publish") {
  14044. this.queue.push({
  14045. packet: packet,
  14046. cb: cb
  14047. });
  14048. } else if (packet.qos > 0) {
  14049. cb = this.outgoing[packet.messageId] ? this.outgoing[packet.messageId].cb : null;
  14050. this.outgoingStore.put(packet, function (err) {
  14051. if (err) {
  14052. return cb && cb(err);
  14053. }
  14054. cbStorePut();
  14055. });
  14056. } else if (cb) {
  14057. cb(new Error("No connection to broker"));
  14058. }
  14059. };
  14060. MqttClient.prototype._setupPingTimer = function () {
  14061. var that = this;
  14062. if (!this.pingTimer && this.options.keepalive) {
  14063. this.pingResp = true;
  14064. this.pingTimer = reInterval(function () {
  14065. that._checkPing();
  14066. }, this.options.keepalive * 1e3);
  14067. }
  14068. };
  14069. MqttClient.prototype._shiftPingInterval = function () {
  14070. if (this.pingTimer && this.options.keepalive && this.options.reschedulePings) {
  14071. this.pingTimer.reschedule(this.options.keepalive * 1e3);
  14072. }
  14073. };
  14074. MqttClient.prototype._checkPing = function () {
  14075. if (this.pingResp) {
  14076. this.pingResp = false;
  14077. this._sendPacket({
  14078. cmd: "pingreq"
  14079. });
  14080. } else {
  14081. this._cleanUp(true);
  14082. }
  14083. };
  14084. MqttClient.prototype._handlePingresp = function () {
  14085. this.pingResp = true;
  14086. };
  14087. MqttClient.prototype._handleConnack = function (packet) {
  14088. var options = this.options;
  14089. var version = options.protocolVersion;
  14090. var rc = version === 5 ? packet.reasonCode : packet.returnCode;
  14091. clearTimeout(this.connackTimer);
  14092. if (packet.properties) {
  14093. if (packet.properties.topicAliasMaximum) {
  14094. if (!options.properties) {
  14095. options.properties = {};
  14096. }
  14097. options.properties.topicAliasMaximum = packet.properties.topicAliasMaximum;
  14098. }
  14099. if (packet.properties.serverKeepAlive && options.keepalive) {
  14100. options.keepalive = packet.properties.serverKeepAlive;
  14101. this._shiftPingInterval();
  14102. }
  14103. if (packet.properties.maximumPacketSize) {
  14104. if (!options.properties) {
  14105. options.properties = {};
  14106. }
  14107. options.properties.maximumPacketSize = packet.properties.maximumPacketSize;
  14108. }
  14109. }
  14110. if (rc === 0) {
  14111. this.reconnecting = false;
  14112. this._onConnect(packet);
  14113. } else if (rc > 0) {
  14114. var err = new Error("Connection refused: " + errors[rc]);
  14115. err.code = rc;
  14116. this.emit("error", err);
  14117. }
  14118. };
  14119. MqttClient.prototype._handlePublish = function (packet, done) {
  14120. done = typeof done !== "undefined" ? done : nop;
  14121. var topic = packet.topic.toString();
  14122. var message = packet.payload;
  14123. var qos = packet.qos;
  14124. var mid = packet.messageId;
  14125. var that = this;
  14126. var options = this.options;
  14127. var validReasonCodes = [0, 16, 128, 131, 135, 144, 145, 151, 153];
  14128. switch (qos) {
  14129. case 2:
  14130. {
  14131. options.customHandleAcks(topic, message, packet, function (error, code) {
  14132. if (!(error instanceof Error)) {
  14133. code = error;
  14134. error = null;
  14135. }
  14136. if (error) {
  14137. return that.emit("error", error);
  14138. }
  14139. if (validReasonCodes.indexOf(code) === -1) {
  14140. return that.emit("error", new Error("Wrong reason code for pubrec"));
  14141. }
  14142. if (code) {
  14143. that._sendPacket({
  14144. cmd: "pubrec",
  14145. messageId: mid,
  14146. reasonCode: code
  14147. }, done);
  14148. } else {
  14149. that.incomingStore.put(packet, function () {
  14150. that._sendPacket({
  14151. cmd: "pubrec",
  14152. messageId: mid
  14153. }, done);
  14154. });
  14155. }
  14156. });
  14157. break;
  14158. }
  14159. case 1:
  14160. {
  14161. options.customHandleAcks(topic, message, packet, function (error, code) {
  14162. if (!(error instanceof Error)) {
  14163. code = error;
  14164. error = null;
  14165. }
  14166. if (error) {
  14167. return that.emit("error", error);
  14168. }
  14169. if (validReasonCodes.indexOf(code) === -1) {
  14170. return that.emit("error", new Error("Wrong reason code for puback"));
  14171. }
  14172. if (!code) {
  14173. that.emit("message", topic, message, packet);
  14174. }
  14175. that.handleMessage(packet, function (err) {
  14176. if (err) {
  14177. return done && done(err);
  14178. }
  14179. that._sendPacket({
  14180. cmd: "puback",
  14181. messageId: mid,
  14182. reasonCode: code
  14183. }, done);
  14184. });
  14185. });
  14186. break;
  14187. }
  14188. case 0:
  14189. this.emit("message", topic, message, packet);
  14190. this.handleMessage(packet, done);
  14191. break;
  14192. default:
  14193. break;
  14194. }
  14195. };
  14196. MqttClient.prototype.handleMessage = function (packet, callback) {
  14197. callback();
  14198. };
  14199. MqttClient.prototype._handleAck = function (packet) {
  14200. var mid = packet.messageId;
  14201. var type = packet.cmd;
  14202. var response = null;
  14203. var cb = this.outgoing[mid] ? this.outgoing[mid].cb : null;
  14204. var that = this;
  14205. var err;
  14206. if (!cb) {
  14207. return;
  14208. }
  14209. switch (type) {
  14210. case "pubcomp":
  14211. case "puback":
  14212. var pubackRC = packet.reasonCode;
  14213. if (pubackRC && pubackRC > 0 && pubackRC !== 16) {
  14214. err = new Error("Publish error: " + errors[pubackRC]);
  14215. err.code = pubackRC;
  14216. cb(err, packet);
  14217. }
  14218. delete this.outgoing[mid];
  14219. this.outgoingStore.del(packet, cb);
  14220. break;
  14221. case "pubrec":
  14222. response = {
  14223. cmd: "pubrel",
  14224. qos: 2,
  14225. messageId: mid
  14226. };
  14227. var pubrecRC = packet.reasonCode;
  14228. if (pubrecRC && pubrecRC > 0 && pubrecRC !== 16) {
  14229. err = new Error("Publish error: " + errors[pubrecRC]);
  14230. err.code = pubrecRC;
  14231. cb(err, packet);
  14232. } else {
  14233. this._sendPacket(response);
  14234. }
  14235. break;
  14236. case "suback":
  14237. delete this.outgoing[mid];
  14238. for (var grantedI = 0; grantedI < packet.granted.length; grantedI++) {
  14239. if ((packet.granted[grantedI] & 128) !== 0) {
  14240. var topics = this.messageIdToTopic[mid];
  14241. if (topics) {
  14242. topics.forEach(function (topic) {
  14243. delete that._resubscribeTopics[topic];
  14244. });
  14245. }
  14246. }
  14247. }
  14248. cb(null, packet);
  14249. break;
  14250. case "unsuback":
  14251. delete this.outgoing[mid];
  14252. cb(null);
  14253. break;
  14254. default:
  14255. that.emit("error", new Error("unrecognized packet type"));
  14256. }
  14257. if (this.disconnecting && Object.keys(this.outgoing).length === 0) {
  14258. this.emit("outgoingEmpty");
  14259. }
  14260. };
  14261. MqttClient.prototype._handlePubrel = function (packet, callback) {
  14262. callback = typeof callback !== "undefined" ? callback : nop;
  14263. var mid = packet.messageId;
  14264. var that = this;
  14265. var comp = {
  14266. cmd: "pubcomp",
  14267. messageId: mid
  14268. };
  14269. that.incomingStore.get(packet, function (err, pub) {
  14270. if (!err) {
  14271. that.emit("message", pub.topic, pub.payload, pub);
  14272. that.handleMessage(pub, function (err) {
  14273. if (err) {
  14274. return callback(err);
  14275. }
  14276. that.incomingStore.del(pub, nop);
  14277. that._sendPacket(comp, callback);
  14278. });
  14279. } else {
  14280. that._sendPacket(comp, callback);
  14281. }
  14282. });
  14283. };
  14284. MqttClient.prototype._handleDisconnect = function (packet) {
  14285. this.emit("disconnect", packet);
  14286. };
  14287. MqttClient.prototype._nextId = function () {
  14288. var id = this.nextId++;
  14289. if (this.nextId === 65536) {
  14290. this.nextId = 1;
  14291. }
  14292. return id;
  14293. };
  14294. MqttClient.prototype.getLastMessageId = function () {
  14295. return this.nextId === 1 ? 65535 : this.nextId - 1;
  14296. };
  14297. MqttClient.prototype._resubscribe = function (connack) {
  14298. var _resubscribeTopicsKeys = Object.keys(this._resubscribeTopics);
  14299. if (!this._firstConnection && (this.options.clean || this.options.protocolVersion === 5 && !connack.sessionPresent) && _resubscribeTopicsKeys.length > 0) {
  14300. if (this.options.resubscribe) {
  14301. if (this.options.protocolVersion === 5) {
  14302. for (var topicI = 0; topicI < _resubscribeTopicsKeys.length; topicI++) {
  14303. var resubscribeTopic = {};
  14304. resubscribeTopic[_resubscribeTopicsKeys[topicI]] = this._resubscribeTopics[_resubscribeTopicsKeys[topicI]];
  14305. resubscribeTopic.resubscribe = true;
  14306. this.subscribe(resubscribeTopic, {
  14307. properties: resubscribeTopic[_resubscribeTopicsKeys[topicI]].properties
  14308. });
  14309. }
  14310. } else {
  14311. this._resubscribeTopics.resubscribe = true;
  14312. this.subscribe(this._resubscribeTopics);
  14313. }
  14314. } else {
  14315. this._resubscribeTopics = {};
  14316. }
  14317. }
  14318. this._firstConnection = false;
  14319. };
  14320. MqttClient.prototype._onConnect = function (packet) {
  14321. if (this.disconnected) {
  14322. this.emit("connect", packet);
  14323. return;
  14324. }
  14325. var that = this;
  14326. this._setupPingTimer();
  14327. this._resubscribe(packet);
  14328. this.connected = true;
  14329. function startStreamProcess() {
  14330. var outStore = that.outgoingStore.createStream();
  14331. function clearStoreProcessing() {
  14332. that._storeProcessing = false;
  14333. that._packetIdsDuringStoreProcessing = {};
  14334. }
  14335. that.once("close", remove);
  14336. outStore.on("error", function (err) {
  14337. clearStoreProcessing();
  14338. that.removeListener("close", remove);
  14339. that.emit("error", err);
  14340. });
  14341. function remove() {
  14342. outStore.destroy();
  14343. outStore = null;
  14344. clearStoreProcessing();
  14345. }
  14346. function storeDeliver() {
  14347. if (!outStore) {
  14348. return;
  14349. }
  14350. that._storeProcessing = true;
  14351. var packet = outStore.read(1);
  14352. var _cb;
  14353. if (!packet) {
  14354. outStore.once("readable", storeDeliver);
  14355. return;
  14356. }
  14357. if (that._packetIdsDuringStoreProcessing[packet.messageId]) {
  14358. storeDeliver();
  14359. return;
  14360. }
  14361. if (!that.disconnecting && !that.reconnectTimer) {
  14362. _cb = that.outgoing[packet.messageId] ? that.outgoing[packet.messageId].cb : null;
  14363. that.outgoing[packet.messageId] = {
  14364. volatile: false,
  14365. cb: function cb(err, status) {
  14366. if (_cb) {
  14367. _cb(err, status);
  14368. }
  14369. storeDeliver();
  14370. }
  14371. };
  14372. that._packetIdsDuringStoreProcessing[packet.messageId] = true;
  14373. that._sendPacket(packet);
  14374. } else if (outStore.destroy) {
  14375. outStore.destroy();
  14376. }
  14377. }
  14378. outStore.on("end", function () {
  14379. var allProcessed = true;
  14380. for (var id in that._packetIdsDuringStoreProcessing) {
  14381. if (!that._packetIdsDuringStoreProcessing[id]) {
  14382. allProcessed = false;
  14383. break;
  14384. }
  14385. }
  14386. if (allProcessed) {
  14387. clearStoreProcessing();
  14388. that.removeListener("close", remove);
  14389. that.emit("connect", packet);
  14390. } else {
  14391. startStreamProcess();
  14392. }
  14393. });
  14394. storeDeliver();
  14395. }
  14396. startStreamProcess();
  14397. };
  14398. module.exports = MqttClient;
  14399. }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  14400. }, {
  14401. "./store": 7,
  14402. "./validations": 8,
  14403. _process: 92,
  14404. events: 13,
  14405. inherits: 80,
  14406. "mqtt-packet": 84,
  14407. "readable-stream": 108,
  14408. reinterval: 109,
  14409. xtend: 121
  14410. }],
  14411. 2: [function (require, module, exports) {
  14412. (function (Buffer) {
  14413. "use strict";
  14414. var Transform = require("readable-stream").Transform;
  14415. var duplexify = require("duplexify");
  14416. var base64 = require("base64-js");
  14417. var my;
  14418. var proxy;
  14419. var stream;
  14420. var isInitialized = false;
  14421. function buildProxy() {
  14422. var proxy = new Transform();
  14423. proxy._write = function (chunk, encoding, next) {
  14424. my.sendSocketMessage({
  14425. data: chunk.buffer,
  14426. success: function success() {
  14427. next();
  14428. },
  14429. fail: function fail() {
  14430. next(new Error());
  14431. }
  14432. });
  14433. };
  14434. proxy._flush = function socketEnd(done) {
  14435. my.closeSocket({
  14436. success: function success() {
  14437. done();
  14438. }
  14439. });
  14440. };
  14441. return proxy;
  14442. }
  14443. function setDefaultOpts(opts) {
  14444. if (!opts.hostname) {
  14445. opts.hostname = "localhost";
  14446. }
  14447. if (!opts.path) {
  14448. opts.path = "/";
  14449. }
  14450. if (!opts.wsOptions) {
  14451. opts.wsOptions = {};
  14452. }
  14453. }
  14454. function buildUrl(opts, client) {
  14455. var protocol = opts.protocol === "alis" ? "wss" : "ws";
  14456. var url = protocol + "://" + opts.hostname + opts.path;
  14457. if (opts.port && opts.port !== 80 && opts.port !== 443) {
  14458. url = protocol + "://" + opts.hostname + ":" + opts.port + opts.path;
  14459. }
  14460. if (typeof opts.transformWsUrl === "function") {
  14461. url = opts.transformWsUrl(url, opts, client);
  14462. }
  14463. return url;
  14464. }
  14465. function bindEventHandler() {
  14466. if (isInitialized) return;
  14467. isInitialized = true;
  14468. my.onSocketOpen(function () {
  14469. stream.setReadable(proxy);
  14470. stream.setWritable(proxy);
  14471. stream.emit("connect");
  14472. });
  14473. my.onSocketMessage(function (res) {
  14474. if (typeof res.data === "string") {
  14475. var array = base64.toByteArray(res.data);
  14476. var buffer = Buffer.from(array);
  14477. proxy.push(buffer);
  14478. } else {
  14479. var reader = new FileReader();
  14480. reader.addEventListener("load", function () {
  14481. var data = reader.result;
  14482. if (data instanceof ArrayBuffer) data = Buffer.from(data);else data = Buffer.from(data, "utf8");
  14483. proxy.push(data);
  14484. });
  14485. reader.readAsArrayBuffer(res.data);
  14486. }
  14487. });
  14488. my.onSocketClose(function () {
  14489. stream.end();
  14490. stream.destroy();
  14491. });
  14492. my.onSocketError(function (res) {
  14493. stream.destroy(res);
  14494. });
  14495. }
  14496. function buildStream(client, opts) {
  14497. opts.hostname = opts.hostname || opts.host;
  14498. if (!opts.hostname) {
  14499. throw new Error("Could not determine host. Specify host manually.");
  14500. }
  14501. var websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
  14502. setDefaultOpts(opts);
  14503. var url = buildUrl(opts, client);
  14504. my = opts.my;
  14505. my.connectSocket({
  14506. url: url,
  14507. protocols: websocketSubProtocol
  14508. });
  14509. proxy = buildProxy();
  14510. stream = duplexify.obj();
  14511. bindEventHandler();
  14512. return stream;
  14513. }
  14514. module.exports = buildStream;
  14515. }).call(this, require("buffer").Buffer);
  14516. }, {
  14517. "base64-js": 10,
  14518. buffer: 12,
  14519. duplexify: 17,
  14520. "readable-stream": 108
  14521. }],
  14522. 3: [function (require, module, exports) {
  14523. "use strict";
  14524. var net = require("net");
  14525. function buildBuilder(client, opts) {
  14526. var port, host;
  14527. opts.port = opts.port || 1883;
  14528. opts.hostname = opts.hostname || opts.host || "localhost";
  14529. port = opts.port;
  14530. host = opts.hostname;
  14531. return net.createConnection(port, host);
  14532. }
  14533. module.exports = buildBuilder;
  14534. }, {
  14535. net: 11
  14536. }],
  14537. 4: [function (require, module, exports) {
  14538. "use strict";
  14539. var tls = require("tls");
  14540. function buildBuilder(mqttClient, opts) {
  14541. var connection;
  14542. opts.port = opts.port || 8883;
  14543. opts.host = opts.hostname || opts.host || "localhost";
  14544. opts.rejectUnauthorized = opts.rejectUnauthorized !== false;
  14545. delete opts.path;
  14546. connection = tls.connect(opts);
  14547. connection.on("secureConnect", function () {
  14548. if (opts.rejectUnauthorized && !connection.authorized) {
  14549. connection.emit("error", new Error("TLS not authorized"));
  14550. } else {
  14551. connection.removeListener("error", handleTLSerrors);
  14552. }
  14553. });
  14554. function handleTLSerrors(err) {
  14555. if (opts.rejectUnauthorized) {
  14556. mqttClient.emit("error", err);
  14557. }
  14558. connection.end();
  14559. }
  14560. connection.on("error", handleTLSerrors);
  14561. return connection;
  14562. }
  14563. module.exports = buildBuilder;
  14564. }, {
  14565. tls: 11
  14566. }],
  14567. 5: [function (require, module, exports) {
  14568. (function (process) {
  14569. "use strict";
  14570. var websocket = require("websocket-stream");
  14571. var urlModule = require("url");
  14572. var WSS_OPTIONS = ["rejectUnauthorized", "ca", "cert", "key", "pfx", "passphrase"];
  14573. var IS_BROWSER = process.title === "browser";
  14574. function buildUrl(opts, client) {
  14575. var url = opts.protocol + "://" + opts.hostname + ":" + opts.port + opts.path;
  14576. if (typeof opts.transformWsUrl === "function") {
  14577. url = opts.transformWsUrl(url, opts, client);
  14578. }
  14579. return url;
  14580. }
  14581. function setDefaultOpts(opts) {
  14582. if (!opts.hostname) {
  14583. opts.hostname = "localhost";
  14584. }
  14585. if (!opts.port) {
  14586. if (opts.protocol === "wss") {
  14587. opts.port = 443;
  14588. } else {
  14589. opts.port = 80;
  14590. }
  14591. }
  14592. if (!opts.path) {
  14593. opts.path = "/";
  14594. }
  14595. if (!opts.wsOptions) {
  14596. opts.wsOptions = {};
  14597. }
  14598. if (!IS_BROWSER && opts.protocol === "wss") {
  14599. WSS_OPTIONS.forEach(function (prop) {
  14600. if (opts.hasOwnProperty(prop) && !opts.wsOptions.hasOwnProperty(prop)) {
  14601. opts.wsOptions[prop] = opts[prop];
  14602. }
  14603. });
  14604. }
  14605. }
  14606. function createWebSocket(client, opts) {
  14607. var websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
  14608. setDefaultOpts(opts);
  14609. var url = buildUrl(opts, client);
  14610. return websocket(url, [websocketSubProtocol], opts.wsOptions);
  14611. }
  14612. function buildBuilder(client, opts) {
  14613. return createWebSocket(client, opts);
  14614. }
  14615. function buildBuilderBrowser(client, opts) {
  14616. if (!opts.hostname) {
  14617. opts.hostname = opts.host;
  14618. }
  14619. if (!opts.hostname) {
  14620. if (typeof document === "undefined") {
  14621. throw new Error("Could not determine host. Specify host manually.");
  14622. }
  14623. var parsed = urlModule.parse(document.URL);
  14624. opts.hostname = parsed.hostname;
  14625. if (!opts.port) {
  14626. opts.port = parsed.port;
  14627. }
  14628. }
  14629. return createWebSocket(client, opts);
  14630. }
  14631. if (IS_BROWSER) {
  14632. module.exports = buildBuilderBrowser;
  14633. } else {
  14634. module.exports = buildBuilder;
  14635. }
  14636. }).call(this, require("_process"));
  14637. }, {
  14638. _process: 92,
  14639. url: 113,
  14640. "websocket-stream": 118
  14641. }],
  14642. 6: [function (require, module, exports) {
  14643. (function (process, Buffer) {
  14644. "use strict";
  14645. var Transform = require("readable-stream").Transform;
  14646. var duplexify = require("duplexify");
  14647. var socketTask;
  14648. var proxy;
  14649. var stream;
  14650. function buildProxy() {
  14651. var proxy = new Transform();
  14652. proxy._write = function (chunk, encoding, next) {
  14653. socketTask.send({
  14654. data: chunk.buffer,
  14655. success: function success() {
  14656. next();
  14657. },
  14658. fail: function fail(errMsg) {
  14659. next(new Error(errMsg));
  14660. }
  14661. });
  14662. };
  14663. proxy._flush = function socketEnd(done) {
  14664. socketTask.close({
  14665. success: function success() {
  14666. done();
  14667. }
  14668. });
  14669. };
  14670. return proxy;
  14671. }
  14672. function setDefaultOpts(opts) {
  14673. if (!opts.hostname) {
  14674. opts.hostname = "localhost";
  14675. }
  14676. if (!opts.path) {
  14677. opts.path = "/";
  14678. }
  14679. if (!opts.wsOptions) {
  14680. opts.wsOptions = {};
  14681. }
  14682. }
  14683. function buildUrl(opts, client) {
  14684. var protocol = opts.protocol === "wxs" ? "wss" : "ws";
  14685. var url = protocol + "://" + opts.hostname + opts.path;
  14686. if (opts.port && opts.port !== 80 && opts.port !== 443) {
  14687. url = protocol + "://" + opts.hostname + ":" + opts.port + opts.path;
  14688. }
  14689. if (typeof opts.transformWsUrl === "function") {
  14690. url = opts.transformWsUrl(url, opts, client);
  14691. }
  14692. return url;
  14693. }
  14694. function bindEventHandler() {
  14695. socketTask.onOpen(function () {
  14696. stream.setReadable(proxy);
  14697. stream.setWritable(proxy);
  14698. stream.emit("connect");
  14699. });
  14700. socketTask.onMessage(function (res) {
  14701. var data = res.data;
  14702. if (data instanceof ArrayBuffer) data = Buffer.from(data);else data = Buffer.from(data, "utf8");
  14703. proxy.push(data);
  14704. });
  14705. socketTask.onClose(function () {
  14706. stream.end();
  14707. stream.destroy();
  14708. });
  14709. socketTask.onError(function (res) {
  14710. stream.destroy(new Error(res.errMsg));
  14711. });
  14712. }
  14713. function buildStream(client, opts) {
  14714. opts.hostname = opts.hostname || opts.host;
  14715. if (!opts.hostname) {
  14716. throw new Error("Could not determine host. Specify host manually.");
  14717. }
  14718. var websocketSubProtocol = opts.protocolId === "MQIsdp" && opts.protocolVersion === 3 ? "mqttv3.1" : "mqtt";
  14719. setDefaultOpts(opts);
  14720. var url = buildUrl(opts, client);
  14721. socketTask = wx.connectSocket({
  14722. url: url,
  14723. protocols: websocketSubProtocol
  14724. });
  14725. proxy = buildProxy();
  14726. stream = duplexify.obj();
  14727. stream._destroy = function (err, cb) {
  14728. socketTask.close({
  14729. success: function success() {
  14730. cb && cb(err);
  14731. }
  14732. });
  14733. };
  14734. var destroyRef = stream.destroy;
  14735. stream.destroy = function () {
  14736. stream.destroy = destroyRef;
  14737. var self = this;
  14738. process.nextTick(function () {
  14739. socketTask.close({
  14740. fail: function fail() {
  14741. self._destroy(new Error());
  14742. }
  14743. });
  14744. });
  14745. }.bind(stream);
  14746. bindEventHandler();
  14747. return stream;
  14748. }
  14749. module.exports = buildStream;
  14750. }).call(this, require("_process"), require("buffer").Buffer);
  14751. }, {
  14752. _process: 92,
  14753. buffer: 12,
  14754. duplexify: 17,
  14755. "readable-stream": 108
  14756. }],
  14757. 7: [function (require, module, exports) {
  14758. (function (process) {
  14759. "use strict";
  14760. var xtend = require("xtend");
  14761. var Readable = require("readable-stream").Readable;
  14762. var streamsOpts = {
  14763. objectMode: true
  14764. };
  14765. var defaultStoreOptions = {
  14766. clean: true
  14767. };
  14768. var Map = require("es6-map");
  14769. function Store(options) {
  14770. if (!(this instanceof Store)) {
  14771. return new Store(options);
  14772. }
  14773. this.options = options || {};
  14774. this.options = xtend(defaultStoreOptions, options);
  14775. this._inflights = new Map();
  14776. }
  14777. Store.prototype.put = function (packet, cb) {
  14778. this._inflights.set(packet.messageId, packet);
  14779. if (cb) {
  14780. cb();
  14781. }
  14782. return this;
  14783. };
  14784. Store.prototype.createStream = function () {
  14785. var stream = new Readable(streamsOpts);
  14786. var destroyed = false;
  14787. var values = [];
  14788. var i = 0;
  14789. this._inflights.forEach(function (value, key) {
  14790. values.push(value);
  14791. });
  14792. stream._read = function () {
  14793. if (!destroyed && i < values.length) {
  14794. this.push(values[i++]);
  14795. } else {
  14796. this.push(null);
  14797. }
  14798. };
  14799. stream.destroy = function () {
  14800. if (destroyed) {
  14801. return;
  14802. }
  14803. var self = this;
  14804. destroyed = true;
  14805. process.nextTick(function () {
  14806. self.emit("close");
  14807. });
  14808. };
  14809. return stream;
  14810. };
  14811. Store.prototype.del = function (packet, cb) {
  14812. packet = this._inflights.get(packet.messageId);
  14813. if (packet) {
  14814. this._inflights.delete(packet.messageId);
  14815. cb(null, packet);
  14816. } else if (cb) {
  14817. cb(new Error("missing packet"));
  14818. }
  14819. return this;
  14820. };
  14821. Store.prototype.get = function (packet, cb) {
  14822. packet = this._inflights.get(packet.messageId);
  14823. if (packet) {
  14824. cb(null, packet);
  14825. } else if (cb) {
  14826. cb(new Error("missing packet"));
  14827. }
  14828. return this;
  14829. };
  14830. Store.prototype.close = function (cb) {
  14831. if (this.options.clean) {
  14832. this._inflights = null;
  14833. }
  14834. if (cb) {
  14835. cb();
  14836. }
  14837. };
  14838. module.exports = Store;
  14839. }).call(this, require("_process"));
  14840. }, {
  14841. _process: 92,
  14842. "es6-map": 67,
  14843. "readable-stream": 108,
  14844. xtend: 121
  14845. }],
  14846. 8: [function (require, module, exports) {
  14847. "use strict";
  14848. function validateTopic(topic) {
  14849. var parts = topic.split("/");
  14850. for (var i = 0; i < parts.length; i++) {
  14851. if (parts[i] === "+") {
  14852. continue;
  14853. }
  14854. if (parts[i] === "#") {
  14855. return i === parts.length - 1;
  14856. }
  14857. if (parts[i].indexOf("+") !== -1 || parts[i].indexOf("#") !== -1) {
  14858. return false;
  14859. }
  14860. }
  14861. return true;
  14862. }
  14863. function validateTopics(topics) {
  14864. if (topics.length === 0) {
  14865. return "empty_topic_list";
  14866. }
  14867. for (var i = 0; i < topics.length; i++) {
  14868. if (!validateTopic(topics[i])) {
  14869. return topics[i];
  14870. }
  14871. }
  14872. return null;
  14873. }
  14874. module.exports = {
  14875. validateTopics: validateTopics
  14876. };
  14877. }, {}],
  14878. 9: [function (require, module, exports) {
  14879. (function (process) {
  14880. "use strict";
  14881. var MqttClient = require("../client");
  14882. var Store = require("../store");
  14883. var url = require("url");
  14884. var xtend = require("xtend");
  14885. var protocols = {};
  14886. if (process.title !== "browser") {
  14887. protocols.mqtt = require("./tcp");
  14888. protocols.tcp = require("./tcp");
  14889. protocols.ssl = require("./tls");
  14890. protocols.tls = require("./tls");
  14891. protocols.mqtts = require("./tls");
  14892. } else {
  14893. protocols.wx = require("./wx");
  14894. protocols.wxs = require("./wx");
  14895. protocols.ali = require("./ali");
  14896. protocols.alis = require("./ali");
  14897. }
  14898. protocols.ws = require("./ws");
  14899. protocols.wss = require("./ws");
  14900. function parseAuthOptions(opts) {
  14901. var matches;
  14902. if (opts.auth) {
  14903. matches = opts.auth.match(/^(.+):(.+)$/);
  14904. if (matches) {
  14905. opts.username = matches[1];
  14906. opts.password = matches[2];
  14907. } else {
  14908. opts.username = opts.auth;
  14909. }
  14910. }
  14911. }
  14912. function connect(brokerUrl, opts) {
  14913. if (_typeof(brokerUrl) === "object" && !opts) {
  14914. opts = brokerUrl;
  14915. brokerUrl = null;
  14916. }
  14917. opts = opts || {};
  14918. if (brokerUrl) {
  14919. var parsed = url.parse(brokerUrl, true);
  14920. if (parsed.port != null) {
  14921. parsed.port = Number(parsed.port);
  14922. }
  14923. opts = xtend(parsed, opts);
  14924. if (opts.protocol === null) {
  14925. throw new Error("Missing protocol");
  14926. }
  14927. opts.protocol = opts.protocol.replace(/:$/, "");
  14928. }
  14929. parseAuthOptions(opts);
  14930. if (opts.query && typeof opts.query.clientId === "string") {
  14931. opts.clientId = opts.query.clientId;
  14932. }
  14933. if (opts.cert && opts.key) {
  14934. if (opts.protocol) {
  14935. if (["mqtts", "wss", "wxs", "alis"].indexOf(opts.protocol) === -1) {
  14936. switch (opts.protocol) {
  14937. case "mqtt":
  14938. opts.protocol = "mqtts";
  14939. break;
  14940. case "ws":
  14941. opts.protocol = "wss";
  14942. break;
  14943. case "wx":
  14944. opts.protocol = "wxs";
  14945. break;
  14946. case "ali":
  14947. opts.protocol = "alis";
  14948. break;
  14949. default:
  14950. throw new Error('Unknown protocol for secure connection: "' + opts.protocol + '"!');
  14951. }
  14952. }
  14953. } else {
  14954. throw new Error("Missing secure protocol key");
  14955. }
  14956. }
  14957. if (!protocols[opts.protocol]) {
  14958. var isSecure = ["mqtts", "wss"].indexOf(opts.protocol) !== -1;
  14959. opts.protocol = ["mqtt", "mqtts", "ws", "wss", "wx", "wxs", "ali", "alis"].filter(function (key, index) {
  14960. if (isSecure && index % 2 === 0) {
  14961. return false;
  14962. }
  14963. return typeof protocols[key] === "function";
  14964. })[0];
  14965. }
  14966. if (opts.clean === false && !opts.clientId) {
  14967. throw new Error("Missing clientId for unclean clients");
  14968. }
  14969. if (opts.protocol) {
  14970. opts.defaultProtocol = opts.protocol;
  14971. }
  14972. function wrapper(client) {
  14973. if (opts.servers) {
  14974. if (!client._reconnectCount || client._reconnectCount === opts.servers.length) {
  14975. client._reconnectCount = 0;
  14976. }
  14977. opts.host = opts.servers[client._reconnectCount].host;
  14978. opts.port = opts.servers[client._reconnectCount].port;
  14979. opts.protocol = !opts.servers[client._reconnectCount].protocol ? opts.defaultProtocol : opts.servers[client._reconnectCount].protocol;
  14980. opts.hostname = opts.host;
  14981. client._reconnectCount++;
  14982. }
  14983. return protocols[opts.protocol](client, opts);
  14984. }
  14985. return new MqttClient(wrapper, opts);
  14986. }
  14987. module.exports = connect;
  14988. module.exports.connect = connect;
  14989. module.exports.MqttClient = MqttClient;
  14990. module.exports.Store = Store;
  14991. }).call(this, require("_process"));
  14992. }, {
  14993. "../client": 1,
  14994. "../store": 7,
  14995. "./ali": 2,
  14996. "./tcp": 3,
  14997. "./tls": 4,
  14998. "./ws": 5,
  14999. "./wx": 6,
  15000. _process: 92,
  15001. url: 113,
  15002. xtend: 121
  15003. }],
  15004. 10: [function (require, module, exports) {
  15005. "use strict";
  15006. exports.byteLength = byteLength;
  15007. exports.toByteArray = toByteArray;
  15008. exports.fromByteArray = fromByteArray;
  15009. var lookup = [];
  15010. var revLookup = [];
  15011. var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
  15012. var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  15013. for (var i = 0, len = code.length; i < len; ++i) {
  15014. lookup[i] = code[i];
  15015. revLookup[code.charCodeAt(i)] = i;
  15016. }
  15017. revLookup["-".charCodeAt(0)] = 62;
  15018. revLookup["_".charCodeAt(0)] = 63;
  15019. function getLens(b64) {
  15020. var len = b64.length;
  15021. if (len % 4 > 0) {
  15022. throw new Error("Invalid string. Length must be a multiple of 4");
  15023. }
  15024. var validLen = b64.indexOf("=");
  15025. if (validLen === -1) validLen = len;
  15026. var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
  15027. return [validLen, placeHoldersLen];
  15028. }
  15029. function byteLength(b64) {
  15030. var lens = getLens(b64);
  15031. var validLen = lens[0];
  15032. var placeHoldersLen = lens[1];
  15033. return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
  15034. }
  15035. function _byteLength(b64, validLen, placeHoldersLen) {
  15036. return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
  15037. }
  15038. function toByteArray(b64) {
  15039. var tmp;
  15040. var lens = getLens(b64);
  15041. var validLen = lens[0];
  15042. var placeHoldersLen = lens[1];
  15043. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
  15044. var curByte = 0;
  15045. var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
  15046. for (var i = 0; i < len; i += 4) {
  15047. tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
  15048. arr[curByte++] = tmp >> 16 & 255;
  15049. arr[curByte++] = tmp >> 8 & 255;
  15050. arr[curByte++] = tmp & 255;
  15051. }
  15052. if (placeHoldersLen === 2) {
  15053. tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
  15054. arr[curByte++] = tmp & 255;
  15055. }
  15056. if (placeHoldersLen === 1) {
  15057. tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
  15058. arr[curByte++] = tmp >> 8 & 255;
  15059. arr[curByte++] = tmp & 255;
  15060. }
  15061. return arr;
  15062. }
  15063. function tripletToBase64(num) {
  15064. return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
  15065. }
  15066. function encodeChunk(uint8, start, end) {
  15067. var tmp;
  15068. var output = [];
  15069. for (var i = start; i < end; i += 3) {
  15070. tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
  15071. output.push(tripletToBase64(tmp));
  15072. }
  15073. return output.join("");
  15074. }
  15075. function fromByteArray(uint8) {
  15076. var tmp;
  15077. var len = uint8.length;
  15078. var extraBytes = len % 3;
  15079. var parts = [];
  15080. var maxChunkLength = 16383;
  15081. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  15082. parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
  15083. }
  15084. if (extraBytes === 1) {
  15085. tmp = uint8[len - 1];
  15086. parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
  15087. } else if (extraBytes === 2) {
  15088. tmp = (uint8[len - 2] << 8) + uint8[len - 1];
  15089. parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
  15090. }
  15091. return parts.join("");
  15092. }
  15093. }, {}],
  15094. 11: [function (require, module, exports) {}, {}],
  15095. 12: [function (require, module, exports) {
  15096. "use strict";
  15097. var base64 = require("base64-js");
  15098. var ieee754 = require("ieee754");
  15099. exports.Buffer = Buffer;
  15100. exports.SlowBuffer = SlowBuffer;
  15101. exports.INSPECT_MAX_BYTES = 50;
  15102. var K_MAX_LENGTH = 2147483647;
  15103. exports.kMaxLength = K_MAX_LENGTH;
  15104. Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
  15105. if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
  15106. console.error("This browser lacks typed array (Uint8Array) support which is required by " + "`buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
  15107. }
  15108. function typedArraySupport() {
  15109. try {
  15110. var arr = new Uint8Array(1);
  15111. arr.__proto__ = {
  15112. __proto__: Uint8Array.prototype,
  15113. foo: function foo() {
  15114. return 42;
  15115. }
  15116. };
  15117. return arr.foo() === 42;
  15118. } catch (e) {
  15119. return false;
  15120. }
  15121. }
  15122. Object.defineProperty(Buffer.prototype, "parent", {
  15123. enumerable: true,
  15124. get: function get() {
  15125. if (!Buffer.isBuffer(this)) return undefined;
  15126. return this.buffer;
  15127. }
  15128. });
  15129. Object.defineProperty(Buffer.prototype, "offset", {
  15130. enumerable: true,
  15131. get: function get() {
  15132. if (!Buffer.isBuffer(this)) return undefined;
  15133. return this.byteOffset;
  15134. }
  15135. });
  15136. function createBuffer(length) {
  15137. if (length > K_MAX_LENGTH) {
  15138. throw new RangeError('The value "' + length + '" is invalid for option "size"');
  15139. }
  15140. var buf = new Uint8Array(length);
  15141. buf.__proto__ = Buffer.prototype;
  15142. return buf;
  15143. }
  15144. function Buffer(arg, encodingOrOffset, length) {
  15145. if (typeof arg === "number") {
  15146. if (typeof encodingOrOffset === "string") {
  15147. throw new TypeError('The "string" argument must be of type string. Received type number');
  15148. }
  15149. return allocUnsafe(arg);
  15150. }
  15151. return from(arg, encodingOrOffset, length);
  15152. }
  15153. if (typeof Symbol !== "undefined" && Symbol.species != null && Buffer[Symbol.species] === Buffer) {
  15154. Object.defineProperty(Buffer, Symbol.species, {
  15155. value: null,
  15156. configurable: true,
  15157. enumerable: false,
  15158. writable: false
  15159. });
  15160. }
  15161. Buffer.poolSize = 8192;
  15162. function from(value, encodingOrOffset, length) {
  15163. if (typeof value === "string") {
  15164. return fromString(value, encodingOrOffset);
  15165. }
  15166. if (ArrayBuffer.isView(value)) {
  15167. return fromArrayLike(value);
  15168. }
  15169. if (value == null) {
  15170. throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + _typeof(value));
  15171. }
  15172. if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
  15173. return fromArrayBuffer(value, encodingOrOffset, length);
  15174. }
  15175. if (typeof value === "number") {
  15176. throw new TypeError('The "value" argument must not be of type number. Received type number');
  15177. }
  15178. var valueOf = value.valueOf && value.valueOf();
  15179. if (valueOf != null && valueOf !== value) {
  15180. return Buffer.from(valueOf, encodingOrOffset, length);
  15181. }
  15182. var b = fromObject(value);
  15183. if (b) return b;
  15184. if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
  15185. return Buffer.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
  15186. }
  15187. throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + _typeof(value));
  15188. }
  15189. Buffer.from = function (value, encodingOrOffset, length) {
  15190. return from(value, encodingOrOffset, length);
  15191. };
  15192. Buffer.prototype.__proto__ = Uint8Array.prototype;
  15193. Buffer.__proto__ = Uint8Array;
  15194. function assertSize(size) {
  15195. if (typeof size !== "number") {
  15196. throw new TypeError('"size" argument must be of type number');
  15197. } else if (size < 0) {
  15198. throw new RangeError('The value "' + size + '" is invalid for option "size"');
  15199. }
  15200. }
  15201. function alloc(size, fill, encoding) {
  15202. assertSize(size);
  15203. if (size <= 0) {
  15204. return createBuffer(size);
  15205. }
  15206. if (fill !== undefined) {
  15207. return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
  15208. }
  15209. return createBuffer(size);
  15210. }
  15211. Buffer.alloc = function (size, fill, encoding) {
  15212. return alloc(size, fill, encoding);
  15213. };
  15214. function allocUnsafe(size) {
  15215. assertSize(size);
  15216. return createBuffer(size < 0 ? 0 : checked(size) | 0);
  15217. }
  15218. Buffer.allocUnsafe = function (size) {
  15219. return allocUnsafe(size);
  15220. };
  15221. Buffer.allocUnsafeSlow = function (size) {
  15222. return allocUnsafe(size);
  15223. };
  15224. function fromString(string, encoding) {
  15225. if (typeof encoding !== "string" || encoding === "") {
  15226. encoding = "utf8";
  15227. }
  15228. if (!Buffer.isEncoding(encoding)) {
  15229. throw new TypeError("Unknown encoding: " + encoding);
  15230. }
  15231. var length = byteLength(string, encoding) | 0;
  15232. var buf = createBuffer(length);
  15233. var actual = buf.write(string, encoding);
  15234. if (actual !== length) {
  15235. buf = buf.slice(0, actual);
  15236. }
  15237. return buf;
  15238. }
  15239. function fromArrayLike(array) {
  15240. var length = array.length < 0 ? 0 : checked(array.length) | 0;
  15241. var buf = createBuffer(length);
  15242. for (var i = 0; i < length; i += 1) {
  15243. buf[i] = array[i] & 255;
  15244. }
  15245. return buf;
  15246. }
  15247. function fromArrayBuffer(array, byteOffset, length) {
  15248. if (byteOffset < 0 || array.byteLength < byteOffset) {
  15249. throw new RangeError('"offset" is outside of buffer bounds');
  15250. }
  15251. if (array.byteLength < byteOffset + (length || 0)) {
  15252. throw new RangeError('"length" is outside of buffer bounds');
  15253. }
  15254. var buf;
  15255. if (byteOffset === undefined && length === undefined) {
  15256. buf = new Uint8Array(array);
  15257. } else if (length === undefined) {
  15258. buf = new Uint8Array(array, byteOffset);
  15259. } else {
  15260. buf = new Uint8Array(array, byteOffset, length);
  15261. }
  15262. buf.__proto__ = Buffer.prototype;
  15263. return buf;
  15264. }
  15265. function fromObject(obj) {
  15266. if (Buffer.isBuffer(obj)) {
  15267. var len = checked(obj.length) | 0;
  15268. var buf = createBuffer(len);
  15269. if (buf.length === 0) {
  15270. return buf;
  15271. }
  15272. obj.copy(buf, 0, 0, len);
  15273. return buf;
  15274. }
  15275. if (obj.length !== undefined) {
  15276. if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
  15277. return createBuffer(0);
  15278. }
  15279. return fromArrayLike(obj);
  15280. }
  15281. if (obj.type === "Buffer" && Array.isArray(obj.data)) {
  15282. return fromArrayLike(obj.data);
  15283. }
  15284. }
  15285. function checked(length) {
  15286. if (length >= K_MAX_LENGTH) {
  15287. throw new RangeError("Attempt to allocate Buffer larger than maximum " + "size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
  15288. }
  15289. return length | 0;
  15290. }
  15291. function SlowBuffer(length) {
  15292. if (+length != length) {
  15293. length = 0;
  15294. }
  15295. return Buffer.alloc(+length);
  15296. }
  15297. Buffer.isBuffer = function isBuffer(b) {
  15298. return b != null && b._isBuffer === true && b !== Buffer.prototype;
  15299. };
  15300. Buffer.compare = function compare(a, b) {
  15301. if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
  15302. if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
  15303. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  15304. throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
  15305. }
  15306. if (a === b) return 0;
  15307. var x = a.length;
  15308. var y = b.length;
  15309. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  15310. if (a[i] !== b[i]) {
  15311. x = a[i];
  15312. y = b[i];
  15313. break;
  15314. }
  15315. }
  15316. if (x < y) return -1;
  15317. if (y < x) return 1;
  15318. return 0;
  15319. };
  15320. Buffer.isEncoding = function isEncoding(encoding) {
  15321. switch (String(encoding).toLowerCase()) {
  15322. case "hex":
  15323. case "utf8":
  15324. case "utf-8":
  15325. case "ascii":
  15326. case "latin1":
  15327. case "binary":
  15328. case "base64":
  15329. case "ucs2":
  15330. case "ucs-2":
  15331. case "utf16le":
  15332. case "utf-16le":
  15333. return true;
  15334. default:
  15335. return false;
  15336. }
  15337. };
  15338. Buffer.concat = function concat(list, length) {
  15339. if (!Array.isArray(list)) {
  15340. throw new TypeError('"list" argument must be an Array of Buffers');
  15341. }
  15342. if (list.length === 0) {
  15343. return Buffer.alloc(0);
  15344. }
  15345. var i;
  15346. if (length === undefined) {
  15347. length = 0;
  15348. for (i = 0; i < list.length; ++i) {
  15349. length += list[i].length;
  15350. }
  15351. }
  15352. var buffer = Buffer.allocUnsafe(length);
  15353. var pos = 0;
  15354. for (i = 0; i < list.length; ++i) {
  15355. var buf = list[i];
  15356. if (isInstance(buf, Uint8Array)) {
  15357. buf = Buffer.from(buf);
  15358. }
  15359. if (!Buffer.isBuffer(buf)) {
  15360. throw new TypeError('"list" argument must be an Array of Buffers');
  15361. }
  15362. buf.copy(buffer, pos);
  15363. pos += buf.length;
  15364. }
  15365. return buffer;
  15366. };
  15367. function byteLength(string, encoding) {
  15368. if (Buffer.isBuffer(string)) {
  15369. return string.length;
  15370. }
  15371. if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
  15372. return string.byteLength;
  15373. }
  15374. if (typeof string !== "string") {
  15375. throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + "Received type " + _typeof(string));
  15376. }
  15377. var len = string.length;
  15378. var mustMatch = arguments.length > 2 && arguments[2] === true;
  15379. if (!mustMatch && len === 0) return 0;
  15380. var loweredCase = false;
  15381. for (;;) {
  15382. switch (encoding) {
  15383. case "ascii":
  15384. case "latin1":
  15385. case "binary":
  15386. return len;
  15387. case "utf8":
  15388. case "utf-8":
  15389. return utf8ToBytes(string).length;
  15390. case "ucs2":
  15391. case "ucs-2":
  15392. case "utf16le":
  15393. case "utf-16le":
  15394. return len * 2;
  15395. case "hex":
  15396. return len >>> 1;
  15397. case "base64":
  15398. return base64ToBytes(string).length;
  15399. default:
  15400. if (loweredCase) {
  15401. return mustMatch ? -1 : utf8ToBytes(string).length;
  15402. }
  15403. encoding = ("" + encoding).toLowerCase();
  15404. loweredCase = true;
  15405. }
  15406. }
  15407. }
  15408. Buffer.byteLength = byteLength;
  15409. function slowToString(encoding, start, end) {
  15410. var loweredCase = false;
  15411. if (start === undefined || start < 0) {
  15412. start = 0;
  15413. }
  15414. if (start > this.length) {
  15415. return "";
  15416. }
  15417. if (end === undefined || end > this.length) {
  15418. end = this.length;
  15419. }
  15420. if (end <= 0) {
  15421. return "";
  15422. }
  15423. end >>>= 0;
  15424. start >>>= 0;
  15425. if (end <= start) {
  15426. return "";
  15427. }
  15428. if (!encoding) encoding = "utf8";
  15429. while (true) {
  15430. switch (encoding) {
  15431. case "hex":
  15432. return hexSlice(this, start, end);
  15433. case "utf8":
  15434. case "utf-8":
  15435. return utf8Slice(this, start, end);
  15436. case "ascii":
  15437. return asciiSlice(this, start, end);
  15438. case "latin1":
  15439. case "binary":
  15440. return latin1Slice(this, start, end);
  15441. case "base64":
  15442. return base64Slice(this, start, end);
  15443. case "ucs2":
  15444. case "ucs-2":
  15445. case "utf16le":
  15446. case "utf-16le":
  15447. return utf16leSlice(this, start, end);
  15448. default:
  15449. if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
  15450. encoding = (encoding + "").toLowerCase();
  15451. loweredCase = true;
  15452. }
  15453. }
  15454. }
  15455. Buffer.prototype._isBuffer = true;
  15456. function swap(b, n, m) {
  15457. var i = b[n];
  15458. b[n] = b[m];
  15459. b[m] = i;
  15460. }
  15461. Buffer.prototype.swap16 = function swap16() {
  15462. var len = this.length;
  15463. if (len % 2 !== 0) {
  15464. throw new RangeError("Buffer size must be a multiple of 16-bits");
  15465. }
  15466. for (var i = 0; i < len; i += 2) {
  15467. swap(this, i, i + 1);
  15468. }
  15469. return this;
  15470. };
  15471. Buffer.prototype.swap32 = function swap32() {
  15472. var len = this.length;
  15473. if (len % 4 !== 0) {
  15474. throw new RangeError("Buffer size must be a multiple of 32-bits");
  15475. }
  15476. for (var i = 0; i < len; i += 4) {
  15477. swap(this, i, i + 3);
  15478. swap(this, i + 1, i + 2);
  15479. }
  15480. return this;
  15481. };
  15482. Buffer.prototype.swap64 = function swap64() {
  15483. var len = this.length;
  15484. if (len % 8 !== 0) {
  15485. throw new RangeError("Buffer size must be a multiple of 64-bits");
  15486. }
  15487. for (var i = 0; i < len; i += 8) {
  15488. swap(this, i, i + 7);
  15489. swap(this, i + 1, i + 6);
  15490. swap(this, i + 2, i + 5);
  15491. swap(this, i + 3, i + 4);
  15492. }
  15493. return this;
  15494. };
  15495. Buffer.prototype.toString = function toString() {
  15496. var length = this.length;
  15497. if (length === 0) return "";
  15498. if (arguments.length === 0) return utf8Slice(this, 0, length);
  15499. return slowToString.apply(this, arguments);
  15500. };
  15501. Buffer.prototype.toLocaleString = Buffer.prototype.toString;
  15502. Buffer.prototype.equals = function equals(b) {
  15503. if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
  15504. if (this === b) return true;
  15505. return Buffer.compare(this, b) === 0;
  15506. };
  15507. Buffer.prototype.inspect = function inspect() {
  15508. var str = "";
  15509. var max = exports.INSPECT_MAX_BYTES;
  15510. str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
  15511. if (this.length > max) str += " ... ";
  15512. return "<Buffer " + str + ">";
  15513. };
  15514. Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
  15515. if (isInstance(target, Uint8Array)) {
  15516. target = Buffer.from(target, target.offset, target.byteLength);
  15517. }
  15518. if (!Buffer.isBuffer(target)) {
  15519. throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. ' + "Received type " + _typeof(target));
  15520. }
  15521. if (start === undefined) {
  15522. start = 0;
  15523. }
  15524. if (end === undefined) {
  15525. end = target ? target.length : 0;
  15526. }
  15527. if (thisStart === undefined) {
  15528. thisStart = 0;
  15529. }
  15530. if (thisEnd === undefined) {
  15531. thisEnd = this.length;
  15532. }
  15533. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  15534. throw new RangeError("out of range index");
  15535. }
  15536. if (thisStart >= thisEnd && start >= end) {
  15537. return 0;
  15538. }
  15539. if (thisStart >= thisEnd) {
  15540. return -1;
  15541. }
  15542. if (start >= end) {
  15543. return 1;
  15544. }
  15545. start >>>= 0;
  15546. end >>>= 0;
  15547. thisStart >>>= 0;
  15548. thisEnd >>>= 0;
  15549. if (this === target) return 0;
  15550. var x = thisEnd - thisStart;
  15551. var y = end - start;
  15552. var len = Math.min(x, y);
  15553. var thisCopy = this.slice(thisStart, thisEnd);
  15554. var targetCopy = target.slice(start, end);
  15555. for (var i = 0; i < len; ++i) {
  15556. if (thisCopy[i] !== targetCopy[i]) {
  15557. x = thisCopy[i];
  15558. y = targetCopy[i];
  15559. break;
  15560. }
  15561. }
  15562. if (x < y) return -1;
  15563. if (y < x) return 1;
  15564. return 0;
  15565. };
  15566. function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
  15567. if (buffer.length === 0) return -1;
  15568. if (typeof byteOffset === "string") {
  15569. encoding = byteOffset;
  15570. byteOffset = 0;
  15571. } else if (byteOffset > 2147483647) {
  15572. byteOffset = 2147483647;
  15573. } else if (byteOffset < -2147483648) {
  15574. byteOffset = -2147483648;
  15575. }
  15576. byteOffset = +byteOffset;
  15577. if (numberIsNaN(byteOffset)) {
  15578. byteOffset = dir ? 0 : buffer.length - 1;
  15579. }
  15580. if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
  15581. if (byteOffset >= buffer.length) {
  15582. if (dir) return -1;else byteOffset = buffer.length - 1;
  15583. } else if (byteOffset < 0) {
  15584. if (dir) byteOffset = 0;else return -1;
  15585. }
  15586. if (typeof val === "string") {
  15587. val = Buffer.from(val, encoding);
  15588. }
  15589. if (Buffer.isBuffer(val)) {
  15590. if (val.length === 0) {
  15591. return -1;
  15592. }
  15593. return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
  15594. } else if (typeof val === "number") {
  15595. val = val & 255;
  15596. if (typeof Uint8Array.prototype.indexOf === "function") {
  15597. if (dir) {
  15598. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
  15599. } else {
  15600. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
  15601. }
  15602. }
  15603. return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
  15604. }
  15605. throw new TypeError("val must be string, number or Buffer");
  15606. }
  15607. function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
  15608. var indexSize = 1;
  15609. var arrLength = arr.length;
  15610. var valLength = val.length;
  15611. if (encoding !== undefined) {
  15612. encoding = String(encoding).toLowerCase();
  15613. if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
  15614. if (arr.length < 2 || val.length < 2) {
  15615. return -1;
  15616. }
  15617. indexSize = 2;
  15618. arrLength /= 2;
  15619. valLength /= 2;
  15620. byteOffset /= 2;
  15621. }
  15622. }
  15623. function read(buf, i) {
  15624. if (indexSize === 1) {
  15625. return buf[i];
  15626. } else {
  15627. return buf.readUInt16BE(i * indexSize);
  15628. }
  15629. }
  15630. var i;
  15631. if (dir) {
  15632. var foundIndex = -1;
  15633. for (i = byteOffset; i < arrLength; i++) {
  15634. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  15635. if (foundIndex === -1) foundIndex = i;
  15636. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
  15637. } else {
  15638. if (foundIndex !== -1) i -= i - foundIndex;
  15639. foundIndex = -1;
  15640. }
  15641. }
  15642. } else {
  15643. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
  15644. for (i = byteOffset; i >= 0; i--) {
  15645. var found = true;
  15646. for (var j = 0; j < valLength; j++) {
  15647. if (read(arr, i + j) !== read(val, j)) {
  15648. found = false;
  15649. break;
  15650. }
  15651. }
  15652. if (found) return i;
  15653. }
  15654. }
  15655. return -1;
  15656. }
  15657. Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
  15658. return this.indexOf(val, byteOffset, encoding) !== -1;
  15659. };
  15660. Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
  15661. return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
  15662. };
  15663. Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
  15664. return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
  15665. };
  15666. function hexWrite(buf, string, offset, length) {
  15667. offset = Number(offset) || 0;
  15668. var remaining = buf.length - offset;
  15669. if (!length) {
  15670. length = remaining;
  15671. } else {
  15672. length = Number(length);
  15673. if (length > remaining) {
  15674. length = remaining;
  15675. }
  15676. }
  15677. var strLen = string.length;
  15678. if (length > strLen / 2) {
  15679. length = strLen / 2;
  15680. }
  15681. for (var i = 0; i < length; ++i) {
  15682. var parsed = parseInt(string.substr(i * 2, 2), 16);
  15683. if (numberIsNaN(parsed)) return i;
  15684. buf[offset + i] = parsed;
  15685. }
  15686. return i;
  15687. }
  15688. function utf8Write(buf, string, offset, length) {
  15689. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
  15690. }
  15691. function asciiWrite(buf, string, offset, length) {
  15692. return blitBuffer(asciiToBytes(string), buf, offset, length);
  15693. }
  15694. function latin1Write(buf, string, offset, length) {
  15695. return asciiWrite(buf, string, offset, length);
  15696. }
  15697. function base64Write(buf, string, offset, length) {
  15698. return blitBuffer(base64ToBytes(string), buf, offset, length);
  15699. }
  15700. function ucs2Write(buf, string, offset, length) {
  15701. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
  15702. }
  15703. Buffer.prototype.write = function write(string, offset, length, encoding) {
  15704. if (offset === undefined) {
  15705. encoding = "utf8";
  15706. length = this.length;
  15707. offset = 0;
  15708. } else if (length === undefined && typeof offset === "string") {
  15709. encoding = offset;
  15710. length = this.length;
  15711. offset = 0;
  15712. } else if (isFinite(offset)) {
  15713. offset = offset >>> 0;
  15714. if (isFinite(length)) {
  15715. length = length >>> 0;
  15716. if (encoding === undefined) encoding = "utf8";
  15717. } else {
  15718. encoding = length;
  15719. length = undefined;
  15720. }
  15721. } else {
  15722. throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
  15723. }
  15724. var remaining = this.length - offset;
  15725. if (length === undefined || length > remaining) length = remaining;
  15726. if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
  15727. throw new RangeError("Attempt to write outside buffer bounds");
  15728. }
  15729. if (!encoding) encoding = "utf8";
  15730. var loweredCase = false;
  15731. for (;;) {
  15732. switch (encoding) {
  15733. case "hex":
  15734. return hexWrite(this, string, offset, length);
  15735. case "utf8":
  15736. case "utf-8":
  15737. return utf8Write(this, string, offset, length);
  15738. case "ascii":
  15739. return asciiWrite(this, string, offset, length);
  15740. case "latin1":
  15741. case "binary":
  15742. return latin1Write(this, string, offset, length);
  15743. case "base64":
  15744. return base64Write(this, string, offset, length);
  15745. case "ucs2":
  15746. case "ucs-2":
  15747. case "utf16le":
  15748. case "utf-16le":
  15749. return ucs2Write(this, string, offset, length);
  15750. default:
  15751. if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
  15752. encoding = ("" + encoding).toLowerCase();
  15753. loweredCase = true;
  15754. }
  15755. }
  15756. };
  15757. Buffer.prototype.toJSON = function toJSON() {
  15758. return {
  15759. type: "Buffer",
  15760. data: Array.prototype.slice.call(this._arr || this, 0)
  15761. };
  15762. };
  15763. function base64Slice(buf, start, end) {
  15764. if (start === 0 && end === buf.length) {
  15765. return base64.fromByteArray(buf);
  15766. } else {
  15767. return base64.fromByteArray(buf.slice(start, end));
  15768. }
  15769. }
  15770. function utf8Slice(buf, start, end) {
  15771. end = Math.min(buf.length, end);
  15772. var res = [];
  15773. var i = start;
  15774. while (i < end) {
  15775. var firstByte = buf[i];
  15776. var codePoint = null;
  15777. var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
  15778. if (i + bytesPerSequence <= end) {
  15779. var secondByte, thirdByte, fourthByte, tempCodePoint;
  15780. switch (bytesPerSequence) {
  15781. case 1:
  15782. if (firstByte < 128) {
  15783. codePoint = firstByte;
  15784. }
  15785. break;
  15786. case 2:
  15787. secondByte = buf[i + 1];
  15788. if ((secondByte & 192) === 128) {
  15789. tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
  15790. if (tempCodePoint > 127) {
  15791. codePoint = tempCodePoint;
  15792. }
  15793. }
  15794. break;
  15795. case 3:
  15796. secondByte = buf[i + 1];
  15797. thirdByte = buf[i + 2];
  15798. if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
  15799. tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
  15800. if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
  15801. codePoint = tempCodePoint;
  15802. }
  15803. }
  15804. break;
  15805. case 4:
  15806. secondByte = buf[i + 1];
  15807. thirdByte = buf[i + 2];
  15808. fourthByte = buf[i + 3];
  15809. if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
  15810. tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
  15811. if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
  15812. codePoint = tempCodePoint;
  15813. }
  15814. }
  15815. }
  15816. }
  15817. if (codePoint === null) {
  15818. codePoint = 65533;
  15819. bytesPerSequence = 1;
  15820. } else if (codePoint > 65535) {
  15821. codePoint -= 65536;
  15822. res.push(codePoint >>> 10 & 1023 | 55296);
  15823. codePoint = 56320 | codePoint & 1023;
  15824. }
  15825. res.push(codePoint);
  15826. i += bytesPerSequence;
  15827. }
  15828. return decodeCodePointsArray(res);
  15829. }
  15830. var MAX_ARGUMENTS_LENGTH = 4096;
  15831. function decodeCodePointsArray(codePoints) {
  15832. var len = codePoints.length;
  15833. if (len <= MAX_ARGUMENTS_LENGTH) {
  15834. return String.fromCharCode.apply(String, codePoints);
  15835. }
  15836. var res = "";
  15837. var i = 0;
  15838. while (i < len) {
  15839. res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
  15840. }
  15841. return res;
  15842. }
  15843. function asciiSlice(buf, start, end) {
  15844. var ret = "";
  15845. end = Math.min(buf.length, end);
  15846. for (var i = start; i < end; ++i) {
  15847. ret += String.fromCharCode(buf[i] & 127);
  15848. }
  15849. return ret;
  15850. }
  15851. function latin1Slice(buf, start, end) {
  15852. var ret = "";
  15853. end = Math.min(buf.length, end);
  15854. for (var i = start; i < end; ++i) {
  15855. ret += String.fromCharCode(buf[i]);
  15856. }
  15857. return ret;
  15858. }
  15859. function hexSlice(buf, start, end) {
  15860. var len = buf.length;
  15861. if (!start || start < 0) start = 0;
  15862. if (!end || end < 0 || end > len) end = len;
  15863. var out = "";
  15864. for (var i = start; i < end; ++i) {
  15865. out += toHex(buf[i]);
  15866. }
  15867. return out;
  15868. }
  15869. function utf16leSlice(buf, start, end) {
  15870. var bytes = buf.slice(start, end);
  15871. var res = "";
  15872. for (var i = 0; i < bytes.length; i += 2) {
  15873. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
  15874. }
  15875. return res;
  15876. }
  15877. Buffer.prototype.slice = function slice(start, end) {
  15878. var len = this.length;
  15879. start = ~~start;
  15880. end = end === undefined ? len : ~~end;
  15881. if (start < 0) {
  15882. start += len;
  15883. if (start < 0) start = 0;
  15884. } else if (start > len) {
  15885. start = len;
  15886. }
  15887. if (end < 0) {
  15888. end += len;
  15889. if (end < 0) end = 0;
  15890. } else if (end > len) {
  15891. end = len;
  15892. }
  15893. if (end < start) end = start;
  15894. var newBuf = this.subarray(start, end);
  15895. newBuf.__proto__ = Buffer.prototype;
  15896. return newBuf;
  15897. };
  15898. function checkOffset(offset, ext, length) {
  15899. if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
  15900. if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
  15901. }
  15902. Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
  15903. offset = offset >>> 0;
  15904. byteLength = byteLength >>> 0;
  15905. if (!noAssert) checkOffset(offset, byteLength, this.length);
  15906. var val = this[offset];
  15907. var mul = 1;
  15908. var i = 0;
  15909. while (++i < byteLength && (mul *= 256)) {
  15910. val += this[offset + i] * mul;
  15911. }
  15912. return val;
  15913. };
  15914. Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
  15915. offset = offset >>> 0;
  15916. byteLength = byteLength >>> 0;
  15917. if (!noAssert) {
  15918. checkOffset(offset, byteLength, this.length);
  15919. }
  15920. var val = this[offset + --byteLength];
  15921. var mul = 1;
  15922. while (byteLength > 0 && (mul *= 256)) {
  15923. val += this[offset + --byteLength] * mul;
  15924. }
  15925. return val;
  15926. };
  15927. Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
  15928. offset = offset >>> 0;
  15929. if (!noAssert) checkOffset(offset, 1, this.length);
  15930. return this[offset];
  15931. };
  15932. Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
  15933. offset = offset >>> 0;
  15934. if (!noAssert) checkOffset(offset, 2, this.length);
  15935. return this[offset] | this[offset + 1] << 8;
  15936. };
  15937. Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
  15938. offset = offset >>> 0;
  15939. if (!noAssert) checkOffset(offset, 2, this.length);
  15940. return this[offset] << 8 | this[offset + 1];
  15941. };
  15942. Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
  15943. offset = offset >>> 0;
  15944. if (!noAssert) checkOffset(offset, 4, this.length);
  15945. return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
  15946. };
  15947. Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
  15948. offset = offset >>> 0;
  15949. if (!noAssert) checkOffset(offset, 4, this.length);
  15950. return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
  15951. };
  15952. Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
  15953. offset = offset >>> 0;
  15954. byteLength = byteLength >>> 0;
  15955. if (!noAssert) checkOffset(offset, byteLength, this.length);
  15956. var val = this[offset];
  15957. var mul = 1;
  15958. var i = 0;
  15959. while (++i < byteLength && (mul *= 256)) {
  15960. val += this[offset + i] * mul;
  15961. }
  15962. mul *= 128;
  15963. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  15964. return val;
  15965. };
  15966. Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
  15967. offset = offset >>> 0;
  15968. byteLength = byteLength >>> 0;
  15969. if (!noAssert) checkOffset(offset, byteLength, this.length);
  15970. var i = byteLength;
  15971. var mul = 1;
  15972. var val = this[offset + --i];
  15973. while (i > 0 && (mul *= 256)) {
  15974. val += this[offset + --i] * mul;
  15975. }
  15976. mul *= 128;
  15977. if (val >= mul) val -= Math.pow(2, 8 * byteLength);
  15978. return val;
  15979. };
  15980. Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
  15981. offset = offset >>> 0;
  15982. if (!noAssert) checkOffset(offset, 1, this.length);
  15983. if (!(this[offset] & 128)) return this[offset];
  15984. return (255 - this[offset] + 1) * -1;
  15985. };
  15986. Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
  15987. offset = offset >>> 0;
  15988. if (!noAssert) checkOffset(offset, 2, this.length);
  15989. var val = this[offset] | this[offset + 1] << 8;
  15990. return val & 32768 ? val | 4294901760 : val;
  15991. };
  15992. Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
  15993. offset = offset >>> 0;
  15994. if (!noAssert) checkOffset(offset, 2, this.length);
  15995. var val = this[offset + 1] | this[offset] << 8;
  15996. return val & 32768 ? val | 4294901760 : val;
  15997. };
  15998. Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
  15999. offset = offset >>> 0;
  16000. if (!noAssert) checkOffset(offset, 4, this.length);
  16001. return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
  16002. };
  16003. Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
  16004. offset = offset >>> 0;
  16005. if (!noAssert) checkOffset(offset, 4, this.length);
  16006. return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
  16007. };
  16008. Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
  16009. offset = offset >>> 0;
  16010. if (!noAssert) checkOffset(offset, 4, this.length);
  16011. return ieee754.read(this, offset, true, 23, 4);
  16012. };
  16013. Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
  16014. offset = offset >>> 0;
  16015. if (!noAssert) checkOffset(offset, 4, this.length);
  16016. return ieee754.read(this, offset, false, 23, 4);
  16017. };
  16018. Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
  16019. offset = offset >>> 0;
  16020. if (!noAssert) checkOffset(offset, 8, this.length);
  16021. return ieee754.read(this, offset, true, 52, 8);
  16022. };
  16023. Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
  16024. offset = offset >>> 0;
  16025. if (!noAssert) checkOffset(offset, 8, this.length);
  16026. return ieee754.read(this, offset, false, 52, 8);
  16027. };
  16028. function checkInt(buf, value, offset, ext, max, min) {
  16029. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
  16030. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
  16031. if (offset + ext > buf.length) throw new RangeError("Index out of range");
  16032. }
  16033. Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
  16034. value = +value;
  16035. offset = offset >>> 0;
  16036. byteLength = byteLength >>> 0;
  16037. if (!noAssert) {
  16038. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  16039. checkInt(this, value, offset, byteLength, maxBytes, 0);
  16040. }
  16041. var mul = 1;
  16042. var i = 0;
  16043. this[offset] = value & 255;
  16044. while (++i < byteLength && (mul *= 256)) {
  16045. this[offset + i] = value / mul & 255;
  16046. }
  16047. return offset + byteLength;
  16048. };
  16049. Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
  16050. value = +value;
  16051. offset = offset >>> 0;
  16052. byteLength = byteLength >>> 0;
  16053. if (!noAssert) {
  16054. var maxBytes = Math.pow(2, 8 * byteLength) - 1;
  16055. checkInt(this, value, offset, byteLength, maxBytes, 0);
  16056. }
  16057. var i = byteLength - 1;
  16058. var mul = 1;
  16059. this[offset + i] = value & 255;
  16060. while (--i >= 0 && (mul *= 256)) {
  16061. this[offset + i] = value / mul & 255;
  16062. }
  16063. return offset + byteLength;
  16064. };
  16065. Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
  16066. value = +value;
  16067. offset = offset >>> 0;
  16068. if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
  16069. this[offset] = value & 255;
  16070. return offset + 1;
  16071. };
  16072. Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
  16073. value = +value;
  16074. offset = offset >>> 0;
  16075. if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
  16076. this[offset] = value & 255;
  16077. this[offset + 1] = value >>> 8;
  16078. return offset + 2;
  16079. };
  16080. Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
  16081. value = +value;
  16082. offset = offset >>> 0;
  16083. if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
  16084. this[offset] = value >>> 8;
  16085. this[offset + 1] = value & 255;
  16086. return offset + 2;
  16087. };
  16088. Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
  16089. value = +value;
  16090. offset = offset >>> 0;
  16091. if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
  16092. this[offset + 3] = value >>> 24;
  16093. this[offset + 2] = value >>> 16;
  16094. this[offset + 1] = value >>> 8;
  16095. this[offset] = value & 255;
  16096. return offset + 4;
  16097. };
  16098. Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
  16099. value = +value;
  16100. offset = offset >>> 0;
  16101. if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
  16102. this[offset] = value >>> 24;
  16103. this[offset + 1] = value >>> 16;
  16104. this[offset + 2] = value >>> 8;
  16105. this[offset + 3] = value & 255;
  16106. return offset + 4;
  16107. };
  16108. Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
  16109. value = +value;
  16110. offset = offset >>> 0;
  16111. if (!noAssert) {
  16112. var limit = Math.pow(2, 8 * byteLength - 1);
  16113. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  16114. }
  16115. var i = 0;
  16116. var mul = 1;
  16117. var sub = 0;
  16118. this[offset] = value & 255;
  16119. while (++i < byteLength && (mul *= 256)) {
  16120. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  16121. sub = 1;
  16122. }
  16123. this[offset + i] = (value / mul >> 0) - sub & 255;
  16124. }
  16125. return offset + byteLength;
  16126. };
  16127. Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
  16128. value = +value;
  16129. offset = offset >>> 0;
  16130. if (!noAssert) {
  16131. var limit = Math.pow(2, 8 * byteLength - 1);
  16132. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  16133. }
  16134. var i = byteLength - 1;
  16135. var mul = 1;
  16136. var sub = 0;
  16137. this[offset + i] = value & 255;
  16138. while (--i >= 0 && (mul *= 256)) {
  16139. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  16140. sub = 1;
  16141. }
  16142. this[offset + i] = (value / mul >> 0) - sub & 255;
  16143. }
  16144. return offset + byteLength;
  16145. };
  16146. Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
  16147. value = +value;
  16148. offset = offset >>> 0;
  16149. if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
  16150. if (value < 0) value = 255 + value + 1;
  16151. this[offset] = value & 255;
  16152. return offset + 1;
  16153. };
  16154. Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
  16155. value = +value;
  16156. offset = offset >>> 0;
  16157. if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
  16158. this[offset] = value & 255;
  16159. this[offset + 1] = value >>> 8;
  16160. return offset + 2;
  16161. };
  16162. Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
  16163. value = +value;
  16164. offset = offset >>> 0;
  16165. if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
  16166. this[offset] = value >>> 8;
  16167. this[offset + 1] = value & 255;
  16168. return offset + 2;
  16169. };
  16170. Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
  16171. value = +value;
  16172. offset = offset >>> 0;
  16173. if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
  16174. this[offset] = value & 255;
  16175. this[offset + 1] = value >>> 8;
  16176. this[offset + 2] = value >>> 16;
  16177. this[offset + 3] = value >>> 24;
  16178. return offset + 4;
  16179. };
  16180. Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
  16181. value = +value;
  16182. offset = offset >>> 0;
  16183. if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
  16184. if (value < 0) value = 4294967295 + value + 1;
  16185. this[offset] = value >>> 24;
  16186. this[offset + 1] = value >>> 16;
  16187. this[offset + 2] = value >>> 8;
  16188. this[offset + 3] = value & 255;
  16189. return offset + 4;
  16190. };
  16191. function checkIEEE754(buf, value, offset, ext, max, min) {
  16192. if (offset + ext > buf.length) throw new RangeError("Index out of range");
  16193. if (offset < 0) throw new RangeError("Index out of range");
  16194. }
  16195. function writeFloat(buf, value, offset, littleEndian, noAssert) {
  16196. value = +value;
  16197. offset = offset >>> 0;
  16198. if (!noAssert) {
  16199. checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
  16200. }
  16201. ieee754.write(buf, value, offset, littleEndian, 23, 4);
  16202. return offset + 4;
  16203. }
  16204. Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
  16205. return writeFloat(this, value, offset, true, noAssert);
  16206. };
  16207. Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
  16208. return writeFloat(this, value, offset, false, noAssert);
  16209. };
  16210. function writeDouble(buf, value, offset, littleEndian, noAssert) {
  16211. value = +value;
  16212. offset = offset >>> 0;
  16213. if (!noAssert) {
  16214. checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
  16215. }
  16216. ieee754.write(buf, value, offset, littleEndian, 52, 8);
  16217. return offset + 8;
  16218. }
  16219. Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
  16220. return writeDouble(this, value, offset, true, noAssert);
  16221. };
  16222. Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
  16223. return writeDouble(this, value, offset, false, noAssert);
  16224. };
  16225. Buffer.prototype.copy = function copy(target, targetStart, start, end) {
  16226. if (!Buffer.isBuffer(target)) throw new TypeError("argument should be a Buffer");
  16227. if (!start) start = 0;
  16228. if (!end && end !== 0) end = this.length;
  16229. if (targetStart >= target.length) targetStart = target.length;
  16230. if (!targetStart) targetStart = 0;
  16231. if (end > 0 && end < start) end = start;
  16232. if (end === start) return 0;
  16233. if (target.length === 0 || this.length === 0) return 0;
  16234. if (targetStart < 0) {
  16235. throw new RangeError("targetStart out of bounds");
  16236. }
  16237. if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
  16238. if (end < 0) throw new RangeError("sourceEnd out of bounds");
  16239. if (end > this.length) end = this.length;
  16240. if (target.length - targetStart < end - start) {
  16241. end = target.length - targetStart + start;
  16242. }
  16243. var len = end - start;
  16244. if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
  16245. this.copyWithin(targetStart, start, end);
  16246. } else if (this === target && start < targetStart && targetStart < end) {
  16247. for (var i = len - 1; i >= 0; --i) {
  16248. target[i + targetStart] = this[i + start];
  16249. }
  16250. } else {
  16251. Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
  16252. }
  16253. return len;
  16254. };
  16255. Buffer.prototype.fill = function fill(val, start, end, encoding) {
  16256. if (typeof val === "string") {
  16257. if (typeof start === "string") {
  16258. encoding = start;
  16259. start = 0;
  16260. end = this.length;
  16261. } else if (typeof end === "string") {
  16262. encoding = end;
  16263. end = this.length;
  16264. }
  16265. if (encoding !== undefined && typeof encoding !== "string") {
  16266. throw new TypeError("encoding must be a string");
  16267. }
  16268. if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
  16269. throw new TypeError("Unknown encoding: " + encoding);
  16270. }
  16271. if (val.length === 1) {
  16272. var code = val.charCodeAt(0);
  16273. if (encoding === "utf8" && code < 128 || encoding === "latin1") {
  16274. val = code;
  16275. }
  16276. }
  16277. } else if (typeof val === "number") {
  16278. val = val & 255;
  16279. }
  16280. if (start < 0 || this.length < start || this.length < end) {
  16281. throw new RangeError("Out of range index");
  16282. }
  16283. if (end <= start) {
  16284. return this;
  16285. }
  16286. start = start >>> 0;
  16287. end = end === undefined ? this.length : end >>> 0;
  16288. if (!val) val = 0;
  16289. var i;
  16290. if (typeof val === "number") {
  16291. for (i = start; i < end; ++i) {
  16292. this[i] = val;
  16293. }
  16294. } else {
  16295. var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
  16296. var len = bytes.length;
  16297. if (len === 0) {
  16298. throw new TypeError('The value "' + val + '" is invalid for argument "value"');
  16299. }
  16300. for (i = 0; i < end - start; ++i) {
  16301. this[i + start] = bytes[i % len];
  16302. }
  16303. }
  16304. return this;
  16305. };
  16306. var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
  16307. function base64clean(str) {
  16308. str = str.split("=")[0];
  16309. str = str.trim().replace(INVALID_BASE64_RE, "");
  16310. if (str.length < 2) return "";
  16311. while (str.length % 4 !== 0) {
  16312. str = str + "=";
  16313. }
  16314. return str;
  16315. }
  16316. function toHex(n) {
  16317. if (n < 16) return "0" + n.toString(16);
  16318. return n.toString(16);
  16319. }
  16320. function utf8ToBytes(string, units) {
  16321. units = units || Infinity;
  16322. var codePoint;
  16323. var length = string.length;
  16324. var leadSurrogate = null;
  16325. var bytes = [];
  16326. for (var i = 0; i < length; ++i) {
  16327. codePoint = string.charCodeAt(i);
  16328. if (codePoint > 55295 && codePoint < 57344) {
  16329. if (!leadSurrogate) {
  16330. if (codePoint > 56319) {
  16331. if ((units -= 3) > -1) bytes.push(239, 191, 189);
  16332. continue;
  16333. } else if (i + 1 === length) {
  16334. if ((units -= 3) > -1) bytes.push(239, 191, 189);
  16335. continue;
  16336. }
  16337. leadSurrogate = codePoint;
  16338. continue;
  16339. }
  16340. if (codePoint < 56320) {
  16341. if ((units -= 3) > -1) bytes.push(239, 191, 189);
  16342. leadSurrogate = codePoint;
  16343. continue;
  16344. }
  16345. codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
  16346. } else if (leadSurrogate) {
  16347. if ((units -= 3) > -1) bytes.push(239, 191, 189);
  16348. }
  16349. leadSurrogate = null;
  16350. if (codePoint < 128) {
  16351. if ((units -= 1) < 0) break;
  16352. bytes.push(codePoint);
  16353. } else if (codePoint < 2048) {
  16354. if ((units -= 2) < 0) break;
  16355. bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
  16356. } else if (codePoint < 65536) {
  16357. if ((units -= 3) < 0) break;
  16358. bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  16359. } else if (codePoint < 1114112) {
  16360. if ((units -= 4) < 0) break;
  16361. bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  16362. } else {
  16363. throw new Error("Invalid code point");
  16364. }
  16365. }
  16366. return bytes;
  16367. }
  16368. function asciiToBytes(str) {
  16369. var byteArray = [];
  16370. for (var i = 0; i < str.length; ++i) {
  16371. byteArray.push(str.charCodeAt(i) & 255);
  16372. }
  16373. return byteArray;
  16374. }
  16375. function utf16leToBytes(str, units) {
  16376. var c, hi, lo;
  16377. var byteArray = [];
  16378. for (var i = 0; i < str.length; ++i) {
  16379. if ((units -= 2) < 0) break;
  16380. c = str.charCodeAt(i);
  16381. hi = c >> 8;
  16382. lo = c % 256;
  16383. byteArray.push(lo);
  16384. byteArray.push(hi);
  16385. }
  16386. return byteArray;
  16387. }
  16388. function base64ToBytes(str) {
  16389. return base64.toByteArray(base64clean(str));
  16390. }
  16391. function blitBuffer(src, dst, offset, length) {
  16392. for (var i = 0; i < length; ++i) {
  16393. if (i + offset >= dst.length || i >= src.length) break;
  16394. dst[i + offset] = src[i];
  16395. }
  16396. return i;
  16397. }
  16398. function isInstance(obj, type) {
  16399. return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
  16400. }
  16401. function numberIsNaN(obj) {
  16402. return obj !== obj;
  16403. }
  16404. }, {
  16405. "base64-js": 10,
  16406. ieee754: 79
  16407. }],
  16408. 13: [function (require, module, exports) {
  16409. var objectCreate = Object.create || objectCreatePolyfill;
  16410. var objectKeys = Object.keys || objectKeysPolyfill;
  16411. var bind = Function.prototype.bind || functionBindPolyfill;
  16412. function EventEmitter() {
  16413. if (!this._events || !Object.prototype.hasOwnProperty.call(this, "_events")) {
  16414. this._events = objectCreate(null);
  16415. this._eventsCount = 0;
  16416. }
  16417. this._maxListeners = this._maxListeners || undefined;
  16418. }
  16419. module.exports = EventEmitter;
  16420. EventEmitter.EventEmitter = EventEmitter;
  16421. EventEmitter.prototype._events = undefined;
  16422. EventEmitter.prototype._maxListeners = undefined;
  16423. var defaultMaxListeners = 10;
  16424. var hasDefineProperty;
  16425. try {
  16426. var o = {};
  16427. if (Object.defineProperty) Object.defineProperty(o, "x", {
  16428. value: 0
  16429. });
  16430. hasDefineProperty = o.x === 0;
  16431. } catch (err) {
  16432. hasDefineProperty = false;
  16433. }
  16434. if (hasDefineProperty) {
  16435. Object.defineProperty(EventEmitter, "defaultMaxListeners", {
  16436. enumerable: true,
  16437. get: function get() {
  16438. return defaultMaxListeners;
  16439. },
  16440. set: function set(arg) {
  16441. if (typeof arg !== "number" || arg < 0 || arg !== arg) throw new TypeError('"defaultMaxListeners" must be a positive number');
  16442. defaultMaxListeners = arg;
  16443. }
  16444. });
  16445. } else {
  16446. EventEmitter.defaultMaxListeners = defaultMaxListeners;
  16447. }
  16448. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  16449. if (typeof n !== "number" || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number');
  16450. this._maxListeners = n;
  16451. return this;
  16452. };
  16453. function $getMaxListeners(that) {
  16454. if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners;
  16455. return that._maxListeners;
  16456. }
  16457. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  16458. return $getMaxListeners(this);
  16459. };
  16460. function emitNone(handler, isFn, self) {
  16461. if (isFn) handler.call(self);else {
  16462. var len = handler.length;
  16463. var listeners = arrayClone(handler, len);
  16464. for (var i = 0; i < len; ++i) {
  16465. listeners[i].call(self);
  16466. }
  16467. }
  16468. }
  16469. function emitOne(handler, isFn, self, arg1) {
  16470. if (isFn) handler.call(self, arg1);else {
  16471. var len = handler.length;
  16472. var listeners = arrayClone(handler, len);
  16473. for (var i = 0; i < len; ++i) {
  16474. listeners[i].call(self, arg1);
  16475. }
  16476. }
  16477. }
  16478. function emitTwo(handler, isFn, self, arg1, arg2) {
  16479. if (isFn) handler.call(self, arg1, arg2);else {
  16480. var len = handler.length;
  16481. var listeners = arrayClone(handler, len);
  16482. for (var i = 0; i < len; ++i) {
  16483. listeners[i].call(self, arg1, arg2);
  16484. }
  16485. }
  16486. }
  16487. function emitThree(handler, isFn, self, arg1, arg2, arg3) {
  16488. if (isFn) handler.call(self, arg1, arg2, arg3);else {
  16489. var len = handler.length;
  16490. var listeners = arrayClone(handler, len);
  16491. for (var i = 0; i < len; ++i) {
  16492. listeners[i].call(self, arg1, arg2, arg3);
  16493. }
  16494. }
  16495. }
  16496. function emitMany(handler, isFn, self, args) {
  16497. if (isFn) handler.apply(self, args);else {
  16498. var len = handler.length;
  16499. var listeners = arrayClone(handler, len);
  16500. for (var i = 0; i < len; ++i) {
  16501. listeners[i].apply(self, args);
  16502. }
  16503. }
  16504. }
  16505. EventEmitter.prototype.emit = function emit(type) {
  16506. var er, handler, len, args, i, events;
  16507. var doError = type === "error";
  16508. events = this._events;
  16509. if (events) doError = doError && events.error == null;else if (!doError) return false;
  16510. if (doError) {
  16511. if (arguments.length > 1) er = arguments[1];
  16512. if (er instanceof Error) {
  16513. throw er;
  16514. } else {
  16515. var err = new Error('Unhandled "error" event. (' + er + ")");
  16516. err.context = er;
  16517. throw err;
  16518. }
  16519. return false;
  16520. }
  16521. handler = events[type];
  16522. if (!handler) return false;
  16523. var isFn = typeof handler === "function";
  16524. len = arguments.length;
  16525. switch (len) {
  16526. case 1:
  16527. emitNone(handler, isFn, this);
  16528. break;
  16529. case 2:
  16530. emitOne(handler, isFn, this, arguments[1]);
  16531. break;
  16532. case 3:
  16533. emitTwo(handler, isFn, this, arguments[1], arguments[2]);
  16534. break;
  16535. case 4:
  16536. emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
  16537. break;
  16538. default:
  16539. args = new Array(len - 1);
  16540. for (i = 1; i < len; i++) {
  16541. args[i - 1] = arguments[i];
  16542. }
  16543. emitMany(handler, isFn, this, args);
  16544. }
  16545. return true;
  16546. };
  16547. function _addListener(target, type, listener, prepend) {
  16548. var m;
  16549. var events;
  16550. var existing;
  16551. if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
  16552. events = target._events;
  16553. if (!events) {
  16554. events = target._events = objectCreate(null);
  16555. target._eventsCount = 0;
  16556. } else {
  16557. if (events.newListener) {
  16558. target.emit("newListener", type, listener.listener ? listener.listener : listener);
  16559. events = target._events;
  16560. }
  16561. existing = events[type];
  16562. }
  16563. if (!existing) {
  16564. existing = events[type] = listener;
  16565. ++target._eventsCount;
  16566. } else {
  16567. if (typeof existing === "function") {
  16568. existing = events[type] = prepend ? [listener, existing] : [existing, listener];
  16569. } else {
  16570. if (prepend) {
  16571. existing.unshift(listener);
  16572. } else {
  16573. existing.push(listener);
  16574. }
  16575. }
  16576. if (!existing.warned) {
  16577. m = $getMaxListeners(target);
  16578. if (m && m > 0 && existing.length > m) {
  16579. existing.warned = true;
  16580. var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + ' "' + String(type) + '" listeners ' + "added. Use emitter.setMaxListeners() to " + "increase limit.");
  16581. w.name = "MaxListenersExceededWarning";
  16582. w.emitter = target;
  16583. w.type = type;
  16584. w.count = existing.length;
  16585. if ((typeof console === "undefined" ? "undefined" : _typeof(console)) === "object" && console.warn) {
  16586. console.warn("%s: %s", w.name, w.message);
  16587. }
  16588. }
  16589. }
  16590. }
  16591. return target;
  16592. }
  16593. EventEmitter.prototype.addListener = function addListener(type, listener) {
  16594. return _addListener(this, type, listener, false);
  16595. };
  16596. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  16597. EventEmitter.prototype.prependListener = function prependListener(type, listener) {
  16598. return _addListener(this, type, listener, true);
  16599. };
  16600. function onceWrapper() {
  16601. if (!this.fired) {
  16602. this.target.removeListener(this.type, this.wrapFn);
  16603. this.fired = true;
  16604. switch (arguments.length) {
  16605. case 0:
  16606. return this.listener.call(this.target);
  16607. case 1:
  16608. return this.listener.call(this.target, arguments[0]);
  16609. case 2:
  16610. return this.listener.call(this.target, arguments[0], arguments[1]);
  16611. case 3:
  16612. return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]);
  16613. default:
  16614. var args = new Array(arguments.length);
  16615. for (var i = 0; i < args.length; ++i) {
  16616. args[i] = arguments[i];
  16617. }
  16618. this.listener.apply(this.target, args);
  16619. }
  16620. }
  16621. }
  16622. function _onceWrap(target, type, listener) {
  16623. var state = {
  16624. fired: false,
  16625. wrapFn: undefined,
  16626. target: target,
  16627. type: type,
  16628. listener: listener
  16629. };
  16630. var wrapped = bind.call(onceWrapper, state);
  16631. wrapped.listener = listener;
  16632. state.wrapFn = wrapped;
  16633. return wrapped;
  16634. }
  16635. EventEmitter.prototype.once = function once(type, listener) {
  16636. if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
  16637. this.on(type, _onceWrap(this, type, listener));
  16638. return this;
  16639. };
  16640. EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
  16641. if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
  16642. this.prependListener(type, _onceWrap(this, type, listener));
  16643. return this;
  16644. };
  16645. EventEmitter.prototype.removeListener = function removeListener(type, listener) {
  16646. var list, events, position, i, originalListener;
  16647. if (typeof listener !== "function") throw new TypeError('"listener" argument must be a function');
  16648. events = this._events;
  16649. if (!events) return this;
  16650. list = events[type];
  16651. if (!list) return this;
  16652. if (list === listener || list.listener === listener) {
  16653. if (--this._eventsCount === 0) this._events = objectCreate(null);else {
  16654. delete events[type];
  16655. if (events.removeListener) this.emit("removeListener", type, list.listener || listener);
  16656. }
  16657. } else if (typeof list !== "function") {
  16658. position = -1;
  16659. for (i = list.length - 1; i >= 0; i--) {
  16660. if (list[i] === listener || list[i].listener === listener) {
  16661. originalListener = list[i].listener;
  16662. position = i;
  16663. break;
  16664. }
  16665. }
  16666. if (position < 0) return this;
  16667. if (position === 0) list.shift();else spliceOne(list, position);
  16668. if (list.length === 1) events[type] = list[0];
  16669. if (events.removeListener) this.emit("removeListener", type, originalListener || listener);
  16670. }
  16671. return this;
  16672. };
  16673. EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
  16674. var listeners, events, i;
  16675. events = this._events;
  16676. if (!events) return this;
  16677. if (!events.removeListener) {
  16678. if (arguments.length === 0) {
  16679. this._events = objectCreate(null);
  16680. this._eventsCount = 0;
  16681. } else if (events[type]) {
  16682. if (--this._eventsCount === 0) this._events = objectCreate(null);else delete events[type];
  16683. }
  16684. return this;
  16685. }
  16686. if (arguments.length === 0) {
  16687. var keys = objectKeys(events);
  16688. var key;
  16689. for (i = 0; i < keys.length; ++i) {
  16690. key = keys[i];
  16691. if (key === "removeListener") continue;
  16692. this.removeAllListeners(key);
  16693. }
  16694. this.removeAllListeners("removeListener");
  16695. this._events = objectCreate(null);
  16696. this._eventsCount = 0;
  16697. return this;
  16698. }
  16699. listeners = events[type];
  16700. if (typeof listeners === "function") {
  16701. this.removeListener(type, listeners);
  16702. } else if (listeners) {
  16703. for (i = listeners.length - 1; i >= 0; i--) {
  16704. this.removeListener(type, listeners[i]);
  16705. }
  16706. }
  16707. return this;
  16708. };
  16709. function _listeners(target, type, unwrap) {
  16710. var events = target._events;
  16711. if (!events) return [];
  16712. var evlistener = events[type];
  16713. if (!evlistener) return [];
  16714. if (typeof evlistener === "function") return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  16715. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  16716. }
  16717. EventEmitter.prototype.listeners = function listeners(type) {
  16718. return _listeners(this, type, true);
  16719. };
  16720. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  16721. return _listeners(this, type, false);
  16722. };
  16723. EventEmitter.listenerCount = function (emitter, type) {
  16724. if (typeof emitter.listenerCount === "function") {
  16725. return emitter.listenerCount(type);
  16726. } else {
  16727. return listenerCount.call(emitter, type);
  16728. }
  16729. };
  16730. EventEmitter.prototype.listenerCount = listenerCount;
  16731. function listenerCount(type) {
  16732. var events = this._events;
  16733. if (events) {
  16734. var evlistener = events[type];
  16735. if (typeof evlistener === "function") {
  16736. return 1;
  16737. } else if (evlistener) {
  16738. return evlistener.length;
  16739. }
  16740. }
  16741. return 0;
  16742. }
  16743. EventEmitter.prototype.eventNames = function eventNames() {
  16744. return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
  16745. };
  16746. function spliceOne(list, index) {
  16747. for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
  16748. list[i] = list[k];
  16749. }
  16750. list.pop();
  16751. }
  16752. function arrayClone(arr, n) {
  16753. var copy = new Array(n);
  16754. for (var i = 0; i < n; ++i) {
  16755. copy[i] = arr[i];
  16756. }
  16757. return copy;
  16758. }
  16759. function unwrapListeners(arr) {
  16760. var ret = new Array(arr.length);
  16761. for (var i = 0; i < ret.length; ++i) {
  16762. ret[i] = arr[i].listener || arr[i];
  16763. }
  16764. return ret;
  16765. }
  16766. function objectCreatePolyfill(proto) {
  16767. var F = function F() {};
  16768. F.prototype = proto;
  16769. return new F();
  16770. }
  16771. function objectKeysPolyfill(obj) {
  16772. var keys = [];
  16773. for (var k in obj) {
  16774. if (Object.prototype.hasOwnProperty.call(obj, k)) {
  16775. keys.push(k);
  16776. }
  16777. }
  16778. return k;
  16779. }
  16780. function functionBindPolyfill(context) {
  16781. var fn = this;
  16782. return function () {
  16783. return fn.apply(context, arguments);
  16784. };
  16785. }
  16786. }, {}],
  16787. 14: [function (require, module, exports) {
  16788. (function (Buffer) {
  16789. function isArray(arg) {
  16790. if (Array.isArray) {
  16791. return Array.isArray(arg);
  16792. }
  16793. return objectToString(arg) === "[object Array]";
  16794. }
  16795. exports.isArray = isArray;
  16796. function isBoolean(arg) {
  16797. return typeof arg === "boolean";
  16798. }
  16799. exports.isBoolean = isBoolean;
  16800. function isNull(arg) {
  16801. return arg === null;
  16802. }
  16803. exports.isNull = isNull;
  16804. function isNullOrUndefined(arg) {
  16805. return arg == null;
  16806. }
  16807. exports.isNullOrUndefined = isNullOrUndefined;
  16808. function isNumber(arg) {
  16809. return typeof arg === "number";
  16810. }
  16811. exports.isNumber = isNumber;
  16812. function isString(arg) {
  16813. return typeof arg === "string";
  16814. }
  16815. exports.isString = isString;
  16816. function isSymbol(arg) {
  16817. return _typeof(arg) === "symbol";
  16818. }
  16819. exports.isSymbol = isSymbol;
  16820. function isUndefined(arg) {
  16821. return arg === void 0;
  16822. }
  16823. exports.isUndefined = isUndefined;
  16824. function isRegExp(re) {
  16825. return objectToString(re) === "[object RegExp]";
  16826. }
  16827. exports.isRegExp = isRegExp;
  16828. function isObject(arg) {
  16829. return _typeof(arg) === "object" && arg !== null;
  16830. }
  16831. exports.isObject = isObject;
  16832. function isDate(d) {
  16833. return objectToString(d) === "[object Date]";
  16834. }
  16835. exports.isDate = isDate;
  16836. function isError(e) {
  16837. return objectToString(e) === "[object Error]" || e instanceof Error;
  16838. }
  16839. exports.isError = isError;
  16840. function isFunction(arg) {
  16841. return typeof arg === "function";
  16842. }
  16843. exports.isFunction = isFunction;
  16844. function isPrimitive(arg) {
  16845. return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || _typeof(arg) === "symbol" || typeof arg === "undefined";
  16846. }
  16847. exports.isPrimitive = isPrimitive;
  16848. exports.isBuffer = Buffer.isBuffer;
  16849. function objectToString(o) {
  16850. return Object.prototype.toString.call(o);
  16851. }
  16852. }).call(this, {
  16853. isBuffer: require("../../is-buffer/index.js")
  16854. });
  16855. }, {
  16856. "../../is-buffer/index.js": 81
  16857. }],
  16858. 15: [function (require, module, exports) {
  16859. "use strict";
  16860. var copy = require("es5-ext/object/copy"),
  16861. normalizeOptions = require("es5-ext/object/normalize-options"),
  16862. ensureCallable = require("es5-ext/object/valid-callable"),
  16863. map = require("es5-ext/object/map"),
  16864. callable = require("es5-ext/object/valid-callable"),
  16865. validValue = require("es5-ext/object/valid-value"),
  16866. bind = Function.prototype.bind,
  16867. defineProperty = Object.defineProperty,
  16868. hasOwnProperty = Object.prototype.hasOwnProperty,
  16869. define;
  16870. define = function define(name, desc, options) {
  16871. var value = validValue(desc) && callable(desc.value),
  16872. dgs;
  16873. dgs = copy(desc);
  16874. delete dgs.writable;
  16875. delete dgs.value;
  16876. dgs.get = function () {
  16877. if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
  16878. desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
  16879. defineProperty(this, name, desc);
  16880. return this[name];
  16881. };
  16882. return dgs;
  16883. };
  16884. module.exports = function (props) {
  16885. var options = normalizeOptions(arguments[1]);
  16886. if (options.resolveContext != null) ensureCallable(options.resolveContext);
  16887. return map(props, function (desc, name) {
  16888. return define(name, desc, options);
  16889. });
  16890. };
  16891. }, {
  16892. "es5-ext/object/copy": 39,
  16893. "es5-ext/object/map": 48,
  16894. "es5-ext/object/normalize-options": 49,
  16895. "es5-ext/object/valid-callable": 54,
  16896. "es5-ext/object/valid-value": 55
  16897. }],
  16898. 16: [function (require, module, exports) {
  16899. "use strict";
  16900. var assign = require("es5-ext/object/assign"),
  16901. normalizeOpts = require("es5-ext/object/normalize-options"),
  16902. isCallable = require("es5-ext/object/is-callable"),
  16903. contains = require("es5-ext/string/#/contains"),
  16904. d;
  16905. d = module.exports = function (dscr, value) {
  16906. var c, e, w, options, desc;
  16907. if (arguments.length < 2 || typeof dscr !== "string") {
  16908. options = value;
  16909. value = dscr;
  16910. dscr = null;
  16911. } else {
  16912. options = arguments[2];
  16913. }
  16914. if (dscr == null) {
  16915. c = w = true;
  16916. e = false;
  16917. } else {
  16918. c = contains.call(dscr, "c");
  16919. e = contains.call(dscr, "e");
  16920. w = contains.call(dscr, "w");
  16921. }
  16922. desc = {
  16923. value: value,
  16924. configurable: c,
  16925. enumerable: e,
  16926. writable: w
  16927. };
  16928. return !options ? desc : assign(normalizeOpts(options), desc);
  16929. };
  16930. d.gs = function (dscr, get, set) {
  16931. var c, e, options, desc;
  16932. if (typeof dscr !== "string") {
  16933. options = set;
  16934. set = get;
  16935. get = dscr;
  16936. dscr = null;
  16937. } else {
  16938. options = arguments[3];
  16939. }
  16940. if (get == null) {
  16941. get = undefined;
  16942. } else if (!isCallable(get)) {
  16943. options = get;
  16944. get = set = undefined;
  16945. } else if (set == null) {
  16946. set = undefined;
  16947. } else if (!isCallable(set)) {
  16948. options = set;
  16949. set = undefined;
  16950. }
  16951. if (dscr == null) {
  16952. c = true;
  16953. e = false;
  16954. } else {
  16955. c = contains.call(dscr, "c");
  16956. e = contains.call(dscr, "e");
  16957. }
  16958. desc = {
  16959. get: get,
  16960. set: set,
  16961. configurable: c,
  16962. enumerable: e
  16963. };
  16964. return !options ? desc : assign(normalizeOpts(options), desc);
  16965. };
  16966. }, {
  16967. "es5-ext/object/assign": 36,
  16968. "es5-ext/object/is-callable": 42,
  16969. "es5-ext/object/normalize-options": 49,
  16970. "es5-ext/string/#/contains": 56
  16971. }],
  16972. 17: [function (require, module, exports) {
  16973. (function (process, Buffer) {
  16974. var stream = require("readable-stream");
  16975. var eos = require("end-of-stream");
  16976. var inherits = require("inherits");
  16977. var shift = require("stream-shift");
  16978. var SIGNAL_FLUSH = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from([0]) : new Buffer([0]);
  16979. var onuncork = function onuncork(self, fn) {
  16980. if (self._corked) self.once("uncork", fn);else fn();
  16981. };
  16982. var autoDestroy = function autoDestroy(self, err) {
  16983. if (self._autoDestroy) self.destroy(err);
  16984. };
  16985. var destroyer = function destroyer(self, end) {
  16986. return function (err) {
  16987. if (err) autoDestroy(self, err.message === "premature close" ? null : err);else if (end && !self._ended) self.end();
  16988. };
  16989. };
  16990. var end = function end(ws, fn) {
  16991. if (!ws) return fn();
  16992. if (ws._writableState && ws._writableState.finished) return fn();
  16993. if (ws._writableState) return ws.end(fn);
  16994. ws.end();
  16995. fn();
  16996. };
  16997. var toStreams2 = function toStreams2(rs) {
  16998. return new stream.Readable({
  16999. objectMode: true,
  17000. highWaterMark: 16
  17001. }).wrap(rs);
  17002. };
  17003. var Duplexify = function Duplexify(writable, readable, opts) {
  17004. if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts);
  17005. stream.Duplex.call(this, opts);
  17006. this._writable = null;
  17007. this._readable = null;
  17008. this._readable2 = null;
  17009. this._autoDestroy = !opts || opts.autoDestroy !== false;
  17010. this._forwardDestroy = !opts || opts.destroy !== false;
  17011. this._forwardEnd = !opts || opts.end !== false;
  17012. this._corked = 1;
  17013. this._ondrain = null;
  17014. this._drained = false;
  17015. this._forwarding = false;
  17016. this._unwrite = null;
  17017. this._unread = null;
  17018. this._ended = false;
  17019. this.destroyed = false;
  17020. if (writable) this.setWritable(writable);
  17021. if (readable) this.setReadable(readable);
  17022. };
  17023. inherits(Duplexify, stream.Duplex);
  17024. Duplexify.obj = function (writable, readable, opts) {
  17025. if (!opts) opts = {};
  17026. opts.objectMode = true;
  17027. opts.highWaterMark = 16;
  17028. return new Duplexify(writable, readable, opts);
  17029. };
  17030. Duplexify.prototype.cork = function () {
  17031. if (++this._corked === 1) this.emit("cork");
  17032. };
  17033. Duplexify.prototype.uncork = function () {
  17034. if (this._corked && --this._corked === 0) this.emit("uncork");
  17035. };
  17036. Duplexify.prototype.setWritable = function (writable) {
  17037. if (this._unwrite) this._unwrite();
  17038. if (this.destroyed) {
  17039. if (writable && writable.destroy) writable.destroy();
  17040. return;
  17041. }
  17042. if (writable === null || writable === false) {
  17043. this.end();
  17044. return;
  17045. }
  17046. var self = this;
  17047. var unend = eos(writable, {
  17048. writable: true,
  17049. readable: false
  17050. }, destroyer(this, this._forwardEnd));
  17051. var ondrain = function ondrain() {
  17052. var ondrain = self._ondrain;
  17053. self._ondrain = null;
  17054. if (ondrain) ondrain();
  17055. };
  17056. var clear = function clear() {
  17057. self._writable.removeListener("drain", ondrain);
  17058. unend();
  17059. };
  17060. if (this._unwrite) process.nextTick(ondrain);
  17061. this._writable = writable;
  17062. this._writable.on("drain", ondrain);
  17063. this._unwrite = clear;
  17064. this.uncork();
  17065. };
  17066. Duplexify.prototype.setReadable = function (readable) {
  17067. if (this._unread) this._unread();
  17068. if (this.destroyed) {
  17069. if (readable && readable.destroy) readable.destroy();
  17070. return;
  17071. }
  17072. if (readable === null || readable === false) {
  17073. this.push(null);
  17074. this.resume();
  17075. return;
  17076. }
  17077. var self = this;
  17078. var unend = eos(readable, {
  17079. writable: false,
  17080. readable: true
  17081. }, destroyer(this));
  17082. var onreadable = function onreadable() {
  17083. self._forward();
  17084. };
  17085. var onend = function onend() {
  17086. self.push(null);
  17087. };
  17088. var clear = function clear() {
  17089. self._readable2.removeListener("readable", onreadable);
  17090. self._readable2.removeListener("end", onend);
  17091. unend();
  17092. };
  17093. this._drained = true;
  17094. this._readable = readable;
  17095. this._readable2 = readable._readableState ? readable : toStreams2(readable);
  17096. this._readable2.on("readable", onreadable);
  17097. this._readable2.on("end", onend);
  17098. this._unread = clear;
  17099. this._forward();
  17100. };
  17101. Duplexify.prototype._read = function () {
  17102. this._drained = true;
  17103. this._forward();
  17104. };
  17105. Duplexify.prototype._forward = function () {
  17106. if (this._forwarding || !this._readable2 || !this._drained) return;
  17107. this._forwarding = true;
  17108. var data;
  17109. while (this._drained && (data = shift(this._readable2)) !== null) {
  17110. if (this.destroyed) continue;
  17111. this._drained = this.push(data);
  17112. }
  17113. this._forwarding = false;
  17114. };
  17115. Duplexify.prototype.destroy = function (err) {
  17116. if (this.destroyed) return;
  17117. this.destroyed = true;
  17118. var self = this;
  17119. process.nextTick(function () {
  17120. self._destroy(err);
  17121. });
  17122. };
  17123. Duplexify.prototype._destroy = function (err) {
  17124. if (err) {
  17125. var ondrain = this._ondrain;
  17126. this._ondrain = null;
  17127. if (ondrain) ondrain(err);else this.emit("error", err);
  17128. }
  17129. if (this._forwardDestroy) {
  17130. if (this._readable && this._readable.destroy) this._readable.destroy();
  17131. if (this._writable && this._writable.destroy) this._writable.destroy();
  17132. }
  17133. this.emit("close");
  17134. };
  17135. Duplexify.prototype._write = function (data, enc, cb) {
  17136. if (this.destroyed) return cb();
  17137. if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb));
  17138. if (data === SIGNAL_FLUSH) return this._finish(cb);
  17139. if (!this._writable) return cb();
  17140. if (this._writable.write(data) === false) this._ondrain = cb;else cb();
  17141. };
  17142. Duplexify.prototype._finish = function (cb) {
  17143. var self = this;
  17144. this.emit("preend");
  17145. onuncork(this, function () {
  17146. end(self._forwardEnd && self._writable, function () {
  17147. if (self._writableState.prefinished === false) self._writableState.prefinished = true;
  17148. self.emit("prefinish");
  17149. onuncork(self, cb);
  17150. });
  17151. });
  17152. };
  17153. Duplexify.prototype.end = function (data, enc, cb) {
  17154. if (typeof data === "function") return this.end(null, null, data);
  17155. if (typeof enc === "function") return this.end(data, null, enc);
  17156. this._ended = true;
  17157. if (data) this.write(data);
  17158. if (!this._writableState.ending) this.write(SIGNAL_FLUSH);
  17159. return stream.Writable.prototype.end.call(this, cb);
  17160. };
  17161. module.exports = Duplexify;
  17162. }).call(this, require("_process"), require("buffer").Buffer);
  17163. }, {
  17164. _process: 92,
  17165. buffer: 12,
  17166. "end-of-stream": 18,
  17167. inherits: 80,
  17168. "readable-stream": 108,
  17169. "stream-shift": 111
  17170. }],
  17171. 18: [function (require, module, exports) {
  17172. var once = require("once");
  17173. var noop = function noop() {};
  17174. var isRequest = function isRequest(stream) {
  17175. return stream.setHeader && typeof stream.abort === "function";
  17176. };
  17177. var isChildProcess = function isChildProcess(stream) {
  17178. return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
  17179. };
  17180. var eos = function eos(stream, opts, callback) {
  17181. if (typeof opts === "function") return eos(stream, null, opts);
  17182. if (!opts) opts = {};
  17183. callback = once(callback || noop);
  17184. var ws = stream._writableState;
  17185. var rs = stream._readableState;
  17186. var readable = opts.readable || opts.readable !== false && stream.readable;
  17187. var writable = opts.writable || opts.writable !== false && stream.writable;
  17188. var onlegacyfinish = function onlegacyfinish() {
  17189. if (!stream.writable) onfinish();
  17190. };
  17191. var onfinish = function onfinish() {
  17192. writable = false;
  17193. if (!readable) callback.call(stream);
  17194. };
  17195. var onend = function onend() {
  17196. readable = false;
  17197. if (!writable) callback.call(stream);
  17198. };
  17199. var onexit = function onexit(exitCode) {
  17200. callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
  17201. };
  17202. var onerror = function onerror(err) {
  17203. callback.call(stream, err);
  17204. };
  17205. var onclose = function onclose() {
  17206. if (readable && !(rs && rs.ended)) return callback.call(stream, new Error("premature close"));
  17207. if (writable && !(ws && ws.ended)) return callback.call(stream, new Error("premature close"));
  17208. };
  17209. var onrequest = function onrequest() {
  17210. stream.req.on("finish", onfinish);
  17211. };
  17212. if (isRequest(stream)) {
  17213. stream.on("complete", onfinish);
  17214. stream.on("abort", onclose);
  17215. if (stream.req) onrequest();else stream.on("request", onrequest);
  17216. } else if (writable && !ws) {
  17217. stream.on("end", onlegacyfinish);
  17218. stream.on("close", onlegacyfinish);
  17219. }
  17220. if (isChildProcess(stream)) stream.on("exit", onexit);
  17221. stream.on("end", onend);
  17222. stream.on("finish", onfinish);
  17223. if (opts.error !== false) stream.on("error", onerror);
  17224. stream.on("close", onclose);
  17225. return function () {
  17226. stream.removeListener("complete", onfinish);
  17227. stream.removeListener("abort", onclose);
  17228. stream.removeListener("request", onrequest);
  17229. if (stream.req) stream.req.removeListener("finish", onfinish);
  17230. stream.removeListener("end", onlegacyfinish);
  17231. stream.removeListener("close", onlegacyfinish);
  17232. stream.removeListener("finish", onfinish);
  17233. stream.removeListener("exit", onexit);
  17234. stream.removeListener("end", onend);
  17235. stream.removeListener("error", onerror);
  17236. stream.removeListener("close", onclose);
  17237. };
  17238. };
  17239. module.exports = eos;
  17240. }, {
  17241. once: 90
  17242. }],
  17243. 19: [function (require, module, exports) {
  17244. "use strict";
  17245. var value = require("../../object/valid-value");
  17246. module.exports = function () {
  17247. value(this).length = 0;
  17248. return this;
  17249. };
  17250. }, {
  17251. "../../object/valid-value": 55
  17252. }],
  17253. 20: [function (require, module, exports) {
  17254. "use strict";
  17255. var numberIsNaN = require("../../number/is-nan"),
  17256. toPosInt = require("../../number/to-pos-integer"),
  17257. value = require("../../object/valid-value"),
  17258. indexOf = Array.prototype.indexOf,
  17259. objHasOwnProperty = Object.prototype.hasOwnProperty,
  17260. abs = Math.abs,
  17261. floor = Math.floor;
  17262. module.exports = function (searchElement) {
  17263. var i, length, fromIndex, val;
  17264. if (!numberIsNaN(searchElement)) return indexOf.apply(this, arguments);
  17265. length = toPosInt(value(this).length);
  17266. fromIndex = arguments[1];
  17267. if (isNaN(fromIndex)) fromIndex = 0;else if (fromIndex >= 0) fromIndex = floor(fromIndex);else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
  17268. for (i = fromIndex; i < length; ++i) {
  17269. if (objHasOwnProperty.call(this, i)) {
  17270. val = this[i];
  17271. if (numberIsNaN(val)) return i;
  17272. }
  17273. }
  17274. return -1;
  17275. };
  17276. }, {
  17277. "../../number/is-nan": 30,
  17278. "../../number/to-pos-integer": 34,
  17279. "../../object/valid-value": 55
  17280. }],
  17281. 21: [function (require, module, exports) {
  17282. "use strict";
  17283. module.exports = require("./is-implemented")() ? Array.from : require("./shim");
  17284. }, {
  17285. "./is-implemented": 22,
  17286. "./shim": 23
  17287. }],
  17288. 22: [function (require, module, exports) {
  17289. "use strict";
  17290. module.exports = function () {
  17291. var from = Array.from,
  17292. arr,
  17293. result;
  17294. if (typeof from !== "function") return false;
  17295. arr = ["raz", "dwa"];
  17296. result = from(arr);
  17297. return Boolean(result && result !== arr && result[1] === "dwa");
  17298. };
  17299. }, {}],
  17300. 23: [function (require, module, exports) {
  17301. "use strict";
  17302. var iteratorSymbol = require("es6-symbol").iterator,
  17303. isArguments = require("../../function/is-arguments"),
  17304. isFunction = require("../../function/is-function"),
  17305. toPosInt = require("../../number/to-pos-integer"),
  17306. callable = require("../../object/valid-callable"),
  17307. validValue = require("../../object/valid-value"),
  17308. isValue = require("../../object/is-value"),
  17309. isString = require("../../string/is-string"),
  17310. isArray = Array.isArray,
  17311. call = Function.prototype.call,
  17312. desc = {
  17313. configurable: true,
  17314. enumerable: true,
  17315. writable: true,
  17316. value: null
  17317. },
  17318. defineProperty = Object.defineProperty;
  17319. module.exports = function (arrayLike) {
  17320. var mapFn = arguments[1],
  17321. thisArg = arguments[2],
  17322. Context,
  17323. i,
  17324. j,
  17325. arr,
  17326. length,
  17327. code,
  17328. iterator,
  17329. result,
  17330. getIterator,
  17331. value;
  17332. arrayLike = Object(validValue(arrayLike));
  17333. if (isValue(mapFn)) callable(mapFn);
  17334. if (!this || this === Array || !isFunction(this)) {
  17335. if (!mapFn) {
  17336. if (isArguments(arrayLike)) {
  17337. length = arrayLike.length;
  17338. if (length !== 1) return Array.apply(null, arrayLike);
  17339. arr = new Array(1);
  17340. arr[0] = arrayLike[0];
  17341. return arr;
  17342. }
  17343. if (isArray(arrayLike)) {
  17344. arr = new Array(length = arrayLike.length);
  17345. for (i = 0; i < length; ++i) {
  17346. arr[i] = arrayLike[i];
  17347. }
  17348. return arr;
  17349. }
  17350. }
  17351. arr = [];
  17352. } else {
  17353. Context = this;
  17354. }
  17355. if (!isArray(arrayLike)) {
  17356. if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
  17357. iterator = callable(getIterator).call(arrayLike);
  17358. if (Context) arr = new Context();
  17359. result = iterator.next();
  17360. i = 0;
  17361. while (!result.done) {
  17362. value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
  17363. if (Context) {
  17364. desc.value = value;
  17365. defineProperty(arr, i, desc);
  17366. } else {
  17367. arr[i] = value;
  17368. }
  17369. result = iterator.next();
  17370. ++i;
  17371. }
  17372. length = i;
  17373. } else if (isString(arrayLike)) {
  17374. length = arrayLike.length;
  17375. if (Context) arr = new Context();
  17376. for (i = 0, j = 0; i < length; ++i) {
  17377. value = arrayLike[i];
  17378. if (i + 1 < length) {
  17379. code = value.charCodeAt(0);
  17380. if (code >= 55296 && code <= 56319) value += arrayLike[++i];
  17381. }
  17382. value = mapFn ? call.call(mapFn, thisArg, value, j) : value;
  17383. if (Context) {
  17384. desc.value = value;
  17385. defineProperty(arr, j, desc);
  17386. } else {
  17387. arr[j] = value;
  17388. }
  17389. ++j;
  17390. }
  17391. length = j;
  17392. }
  17393. }
  17394. if (length === undefined) {
  17395. length = toPosInt(arrayLike.length);
  17396. if (Context) arr = new Context(length);
  17397. for (i = 0; i < length; ++i) {
  17398. value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];
  17399. if (Context) {
  17400. desc.value = value;
  17401. defineProperty(arr, i, desc);
  17402. } else {
  17403. arr[i] = value;
  17404. }
  17405. }
  17406. }
  17407. if (Context) {
  17408. desc.value = null;
  17409. arr.length = length;
  17410. }
  17411. return arr;
  17412. };
  17413. }, {
  17414. "../../function/is-arguments": 24,
  17415. "../../function/is-function": 25,
  17416. "../../number/to-pos-integer": 34,
  17417. "../../object/is-value": 44,
  17418. "../../object/valid-callable": 54,
  17419. "../../object/valid-value": 55,
  17420. "../../string/is-string": 59,
  17421. "es6-symbol": 73
  17422. }],
  17423. 24: [function (require, module, exports) {
  17424. "use strict";
  17425. var objToString = Object.prototype.toString,
  17426. id = objToString.call(function () {
  17427. return arguments;
  17428. }());
  17429. module.exports = function (value) {
  17430. return objToString.call(value) === id;
  17431. };
  17432. }, {}],
  17433. 25: [function (require, module, exports) {
  17434. "use strict";
  17435. var objToString = Object.prototype.toString,
  17436. id = objToString.call(require("./noop"));
  17437. module.exports = function (value) {
  17438. return typeof value === "function" && objToString.call(value) === id;
  17439. };
  17440. }, {
  17441. "./noop": 26
  17442. }],
  17443. 26: [function (require, module, exports) {
  17444. "use strict";
  17445. module.exports = function () {};
  17446. }, {}],
  17447. 27: [function (require, module, exports) {
  17448. "use strict";
  17449. module.exports = require("./is-implemented")() ? Math.sign : require("./shim");
  17450. }, {
  17451. "./is-implemented": 28,
  17452. "./shim": 29
  17453. }],
  17454. 28: [function (require, module, exports) {
  17455. "use strict";
  17456. module.exports = function () {
  17457. var sign = Math.sign;
  17458. if (typeof sign !== "function") return false;
  17459. return sign(10) === 1 && sign(-20) === -1;
  17460. };
  17461. }, {}],
  17462. 29: [function (require, module, exports) {
  17463. "use strict";
  17464. module.exports = function (value) {
  17465. value = Number(value);
  17466. if (isNaN(value) || value === 0) return value;
  17467. return value > 0 ? 1 : -1;
  17468. };
  17469. }, {}],
  17470. 30: [function (require, module, exports) {
  17471. "use strict";
  17472. module.exports = require("./is-implemented")() ? Number.isNaN : require("./shim");
  17473. }, {
  17474. "./is-implemented": 31,
  17475. "./shim": 32
  17476. }],
  17477. 31: [function (require, module, exports) {
  17478. "use strict";
  17479. module.exports = function () {
  17480. var numberIsNaN = Number.isNaN;
  17481. if (typeof numberIsNaN !== "function") return false;
  17482. return !numberIsNaN({}) && numberIsNaN(NaN) && !numberIsNaN(34);
  17483. };
  17484. }, {}],
  17485. 32: [function (require, module, exports) {
  17486. "use strict";
  17487. module.exports = function (value) {
  17488. return value !== value;
  17489. };
  17490. }, {}],
  17491. 33: [function (require, module, exports) {
  17492. "use strict";
  17493. var sign = require("../math/sign"),
  17494. abs = Math.abs,
  17495. floor = Math.floor;
  17496. module.exports = function (value) {
  17497. if (isNaN(value)) return 0;
  17498. value = Number(value);
  17499. if (value === 0 || !isFinite(value)) return value;
  17500. return sign(value) * floor(abs(value));
  17501. };
  17502. }, {
  17503. "../math/sign": 27
  17504. }],
  17505. 34: [function (require, module, exports) {
  17506. "use strict";
  17507. var toInteger = require("./to-integer"),
  17508. max = Math.max;
  17509. module.exports = function (value) {
  17510. return max(0, toInteger(value));
  17511. };
  17512. }, {
  17513. "./to-integer": 33
  17514. }],
  17515. 35: [function (require, module, exports) {
  17516. "use strict";
  17517. var callable = require("./valid-callable"),
  17518. value = require("./valid-value"),
  17519. bind = Function.prototype.bind,
  17520. call = Function.prototype.call,
  17521. keys = Object.keys,
  17522. objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;
  17523. module.exports = function (method, defVal) {
  17524. return function (obj, cb) {
  17525. var list,
  17526. thisArg = arguments[2],
  17527. compareFn = arguments[3];
  17528. obj = Object(value(obj));
  17529. callable(cb);
  17530. list = keys(obj);
  17531. if (compareFn) {
  17532. list.sort(typeof compareFn === "function" ? bind.call(compareFn, obj) : undefined);
  17533. }
  17534. if (typeof method !== "function") method = list[method];
  17535. return call.call(method, list, function (key, index) {
  17536. if (!objPropertyIsEnumerable.call(obj, key)) return defVal;
  17537. return call.call(cb, thisArg, obj[key], key, obj, index);
  17538. });
  17539. };
  17540. };
  17541. }, {
  17542. "./valid-callable": 54,
  17543. "./valid-value": 55
  17544. }],
  17545. 36: [function (require, module, exports) {
  17546. "use strict";
  17547. module.exports = require("./is-implemented")() ? Object.assign : require("./shim");
  17548. }, {
  17549. "./is-implemented": 37,
  17550. "./shim": 38
  17551. }],
  17552. 37: [function (require, module, exports) {
  17553. "use strict";
  17554. module.exports = function () {
  17555. var assign = Object.assign,
  17556. obj;
  17557. if (typeof assign !== "function") return false;
  17558. obj = {
  17559. foo: "raz"
  17560. };
  17561. assign(obj, {
  17562. bar: "dwa"
  17563. }, {
  17564. trzy: "trzy"
  17565. });
  17566. return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
  17567. };
  17568. }, {}],
  17569. 38: [function (require, module, exports) {
  17570. "use strict";
  17571. var keys = require("../keys"),
  17572. value = require("../valid-value"),
  17573. max = Math.max;
  17574. module.exports = function (dest, src) {
  17575. var error,
  17576. i,
  17577. length = max(arguments.length, 2),
  17578. assign;
  17579. dest = Object(value(dest));
  17580. assign = function assign(key) {
  17581. try {
  17582. dest[key] = src[key];
  17583. } catch (e) {
  17584. if (!error) error = e;
  17585. }
  17586. };
  17587. for (i = 1; i < length; ++i) {
  17588. src = arguments[i];
  17589. keys(src).forEach(assign);
  17590. }
  17591. if (error !== undefined) throw error;
  17592. return dest;
  17593. };
  17594. }, {
  17595. "../keys": 45,
  17596. "../valid-value": 55
  17597. }],
  17598. 39: [function (require, module, exports) {
  17599. "use strict";
  17600. var aFrom = require("../array/from"),
  17601. assign = require("./assign"),
  17602. value = require("./valid-value");
  17603. module.exports = function (obj) {
  17604. var copy = Object(value(obj)),
  17605. propertyNames = arguments[1],
  17606. options = Object(arguments[2]);
  17607. if (copy !== obj && !propertyNames) return copy;
  17608. var result = {};
  17609. if (propertyNames) {
  17610. aFrom(propertyNames, function (propertyName) {
  17611. if (options.ensure || propertyName in obj) result[propertyName] = obj[propertyName];
  17612. });
  17613. } else {
  17614. assign(result, obj);
  17615. }
  17616. return result;
  17617. };
  17618. }, {
  17619. "../array/from": 21,
  17620. "./assign": 36,
  17621. "./valid-value": 55
  17622. }],
  17623. 40: [function (require, module, exports) {
  17624. "use strict";
  17625. var create = Object.create,
  17626. shim;
  17627. if (!require("./set-prototype-of/is-implemented")()) {
  17628. shim = require("./set-prototype-of/shim");
  17629. }
  17630. module.exports = function () {
  17631. var nullObject, polyProps, desc;
  17632. if (!shim) return create;
  17633. if (shim.level !== 1) return create;
  17634. nullObject = {};
  17635. polyProps = {};
  17636. desc = {
  17637. configurable: false,
  17638. enumerable: false,
  17639. writable: true,
  17640. value: undefined
  17641. };
  17642. Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
  17643. if (name === "__proto__") {
  17644. polyProps[name] = {
  17645. configurable: true,
  17646. enumerable: false,
  17647. writable: true,
  17648. value: undefined
  17649. };
  17650. return;
  17651. }
  17652. polyProps[name] = desc;
  17653. });
  17654. Object.defineProperties(nullObject, polyProps);
  17655. Object.defineProperty(shim, "nullPolyfill", {
  17656. configurable: false,
  17657. enumerable: false,
  17658. writable: false,
  17659. value: nullObject
  17660. });
  17661. return function (prototype, props) {
  17662. return create(prototype === null ? nullObject : prototype, props);
  17663. };
  17664. }();
  17665. }, {
  17666. "./set-prototype-of/is-implemented": 52,
  17667. "./set-prototype-of/shim": 53
  17668. }],
  17669. 41: [function (require, module, exports) {
  17670. "use strict";
  17671. module.exports = require("./_iterate")("forEach");
  17672. }, {
  17673. "./_iterate": 35
  17674. }],
  17675. 42: [function (require, module, exports) {
  17676. "use strict";
  17677. module.exports = function (obj) {
  17678. return typeof obj === "function";
  17679. };
  17680. }, {}],
  17681. 43: [function (require, module, exports) {
  17682. "use strict";
  17683. var isValue = require("./is-value");
  17684. var map = {
  17685. function: true,
  17686. object: true
  17687. };
  17688. module.exports = function (value) {
  17689. return isValue(value) && map[_typeof(value)] || false;
  17690. };
  17691. }, {
  17692. "./is-value": 44
  17693. }],
  17694. 44: [function (require, module, exports) {
  17695. "use strict";
  17696. var _undefined = require("../function/noop")();
  17697. module.exports = function (val) {
  17698. return val !== _undefined && val !== null;
  17699. };
  17700. }, {
  17701. "../function/noop": 26
  17702. }],
  17703. 45: [function (require, module, exports) {
  17704. "use strict";
  17705. module.exports = require("./is-implemented")() ? Object.keys : require("./shim");
  17706. }, {
  17707. "./is-implemented": 46,
  17708. "./shim": 47
  17709. }],
  17710. 46: [function (require, module, exports) {
  17711. "use strict";
  17712. module.exports = function () {
  17713. try {
  17714. Object.keys("primitive");
  17715. return true;
  17716. } catch (e) {
  17717. return false;
  17718. }
  17719. };
  17720. }, {}],
  17721. 47: [function (require, module, exports) {
  17722. "use strict";
  17723. var isValue = require("../is-value");
  17724. var keys = Object.keys;
  17725. module.exports = function (object) {
  17726. return keys(isValue(object) ? Object(object) : object);
  17727. };
  17728. }, {
  17729. "../is-value": 44
  17730. }],
  17731. 48: [function (require, module, exports) {
  17732. "use strict";
  17733. var callable = require("./valid-callable"),
  17734. forEach = require("./for-each"),
  17735. call = Function.prototype.call;
  17736. module.exports = function (obj, cb) {
  17737. var result = {},
  17738. thisArg = arguments[2];
  17739. callable(cb);
  17740. forEach(obj, function (value, key, targetObj, index) {
  17741. result[key] = call.call(cb, thisArg, value, key, targetObj, index);
  17742. });
  17743. return result;
  17744. };
  17745. }, {
  17746. "./for-each": 41,
  17747. "./valid-callable": 54
  17748. }],
  17749. 49: [function (require, module, exports) {
  17750. "use strict";
  17751. var isValue = require("./is-value");
  17752. var forEach = Array.prototype.forEach,
  17753. create = Object.create;
  17754. var process = function process(src, obj) {
  17755. var key;
  17756. for (key in src) {
  17757. obj[key] = src[key];
  17758. }
  17759. };
  17760. module.exports = function (opts1) {
  17761. var result = create(null);
  17762. forEach.call(arguments, function (options) {
  17763. if (!isValue(options)) return;
  17764. process(Object(options), result);
  17765. });
  17766. return result;
  17767. };
  17768. }, {
  17769. "./is-value": 44
  17770. }],
  17771. 50: [function (require, module, exports) {
  17772. "use strict";
  17773. var forEach = Array.prototype.forEach,
  17774. create = Object.create;
  17775. module.exports = function (arg) {
  17776. var set = create(null);
  17777. forEach.call(arguments, function (name) {
  17778. set[name] = true;
  17779. });
  17780. return set;
  17781. };
  17782. }, {}],
  17783. 51: [function (require, module, exports) {
  17784. "use strict";
  17785. module.exports = require("./is-implemented")() ? Object.setPrototypeOf : require("./shim");
  17786. }, {
  17787. "./is-implemented": 52,
  17788. "./shim": 53
  17789. }],
  17790. 52: [function (require, module, exports) {
  17791. "use strict";
  17792. var create = Object.create,
  17793. getPrototypeOf = Object.getPrototypeOf,
  17794. plainObject = {};
  17795. module.exports = function () {
  17796. var setPrototypeOf = Object.setPrototypeOf,
  17797. customCreate = arguments[0] || create;
  17798. if (typeof setPrototypeOf !== "function") return false;
  17799. return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject;
  17800. };
  17801. }, {}],
  17802. 53: [function (require, module, exports) {
  17803. "use strict";
  17804. var isObject = require("../is-object"),
  17805. value = require("../valid-value"),
  17806. objIsPrototypeOf = Object.prototype.isPrototypeOf,
  17807. defineProperty = Object.defineProperty,
  17808. nullDesc = {
  17809. configurable: true,
  17810. enumerable: false,
  17811. writable: true,
  17812. value: undefined
  17813. },
  17814. validate;
  17815. validate = function validate(obj, prototype) {
  17816. value(obj);
  17817. if (prototype === null || isObject(prototype)) return obj;
  17818. throw new TypeError("Prototype must be null or an object");
  17819. };
  17820. module.exports = function (status) {
  17821. var fn, set;
  17822. if (!status) return null;
  17823. if (status.level === 2) {
  17824. if (status.set) {
  17825. set = status.set;
  17826. fn = function fn(obj, prototype) {
  17827. set.call(validate(obj, prototype), prototype);
  17828. return obj;
  17829. };
  17830. } else {
  17831. fn = function fn(obj, prototype) {
  17832. validate(obj, prototype).__proto__ = prototype;
  17833. return obj;
  17834. };
  17835. }
  17836. } else {
  17837. fn = function self(obj, prototype) {
  17838. var isNullBase;
  17839. validate(obj, prototype);
  17840. isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj);
  17841. if (isNullBase) delete self.nullPolyfill.__proto__;
  17842. if (prototype === null) prototype = self.nullPolyfill;
  17843. obj.__proto__ = prototype;
  17844. if (isNullBase) defineProperty(self.nullPolyfill, "__proto__", nullDesc);
  17845. return obj;
  17846. };
  17847. }
  17848. return Object.defineProperty(fn, "level", {
  17849. configurable: false,
  17850. enumerable: false,
  17851. writable: false,
  17852. value: status.level
  17853. });
  17854. }(function () {
  17855. var tmpObj1 = Object.create(null),
  17856. tmpObj2 = {},
  17857. set,
  17858. desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
  17859. if (desc) {
  17860. try {
  17861. set = desc.set;
  17862. set.call(tmpObj1, tmpObj2);
  17863. } catch (ignore) {}
  17864. if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return {
  17865. set: set,
  17866. level: 2
  17867. };
  17868. }
  17869. tmpObj1.__proto__ = tmpObj2;
  17870. if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return {
  17871. level: 2
  17872. };
  17873. tmpObj1 = {};
  17874. tmpObj1.__proto__ = tmpObj2;
  17875. if (Object.getPrototypeOf(tmpObj1) === tmpObj2) return {
  17876. level: 1
  17877. };
  17878. return false;
  17879. }());
  17880. require("../create");
  17881. }, {
  17882. "../create": 40,
  17883. "../is-object": 43,
  17884. "../valid-value": 55
  17885. }],
  17886. 54: [function (require, module, exports) {
  17887. "use strict";
  17888. module.exports = function (fn) {
  17889. if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
  17890. return fn;
  17891. };
  17892. }, {}],
  17893. 55: [function (require, module, exports) {
  17894. "use strict";
  17895. var isValue = require("./is-value");
  17896. module.exports = function (value) {
  17897. if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
  17898. return value;
  17899. };
  17900. }, {
  17901. "./is-value": 44
  17902. }],
  17903. 56: [function (require, module, exports) {
  17904. "use strict";
  17905. module.exports = require("./is-implemented")() ? String.prototype.contains : require("./shim");
  17906. }, {
  17907. "./is-implemented": 57,
  17908. "./shim": 58
  17909. }],
  17910. 57: [function (require, module, exports) {
  17911. "use strict";
  17912. var str = "razdwatrzy";
  17913. module.exports = function () {
  17914. if (typeof str.contains !== "function") return false;
  17915. return str.contains("dwa") === true && str.contains("foo") === false;
  17916. };
  17917. }, {}],
  17918. 58: [function (require, module, exports) {
  17919. "use strict";
  17920. var indexOf = String.prototype.indexOf;
  17921. module.exports = function (searchString) {
  17922. return indexOf.call(this, searchString, arguments[1]) > -1;
  17923. };
  17924. }, {}],
  17925. 59: [function (require, module, exports) {
  17926. "use strict";
  17927. var objToString = Object.prototype.toString,
  17928. id = objToString.call("");
  17929. module.exports = function (value) {
  17930. return typeof value === "string" || value && _typeof(value) === "object" && (value instanceof String || objToString.call(value) === id) || false;
  17931. };
  17932. }, {}],
  17933. 60: [function (require, module, exports) {
  17934. "use strict";
  17935. var setPrototypeOf = require("es5-ext/object/set-prototype-of"),
  17936. contains = require("es5-ext/string/#/contains"),
  17937. d = require("d"),
  17938. _Symbol = require("es6-symbol"),
  17939. Iterator = require("./");
  17940. var defineProperty = Object.defineProperty,
  17941. ArrayIterator;
  17942. ArrayIterator = module.exports = function (arr, kind) {
  17943. if (!(this instanceof ArrayIterator)) throw new TypeError("Constructor requires 'new'");
  17944. Iterator.call(this, arr);
  17945. if (!kind) kind = "value";else if (contains.call(kind, "key+value")) kind = "key+value";else if (contains.call(kind, "key")) kind = "key";else kind = "value";
  17946. defineProperty(this, "__kind__", d("", kind));
  17947. };
  17948. if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
  17949. delete ArrayIterator.prototype.constructor;
  17950. ArrayIterator.prototype = Object.create(Iterator.prototype, {
  17951. _resolve: d(function (i) {
  17952. if (this.__kind__ === "value") return this.__list__[i];
  17953. if (this.__kind__ === "key+value") return [i, this.__list__[i]];
  17954. return i;
  17955. })
  17956. });
  17957. defineProperty(ArrayIterator.prototype, _Symbol.toStringTag, d("c", "Array Iterator"));
  17958. }, {
  17959. "./": 63,
  17960. d: 16,
  17961. "es5-ext/object/set-prototype-of": 51,
  17962. "es5-ext/string/#/contains": 56,
  17963. "es6-symbol": 73
  17964. }],
  17965. 61: [function (require, module, exports) {
  17966. "use strict";
  17967. var isArguments = require("es5-ext/function/is-arguments"),
  17968. callable = require("es5-ext/object/valid-callable"),
  17969. isString = require("es5-ext/string/is-string"),
  17970. get = require("./get");
  17971. var isArray = Array.isArray,
  17972. call = Function.prototype.call,
  17973. some = Array.prototype.some;
  17974. module.exports = function (iterable, cb) {
  17975. var mode,
  17976. thisArg = arguments[2],
  17977. result,
  17978. doBreak,
  17979. broken,
  17980. i,
  17981. length,
  17982. char,
  17983. code;
  17984. if (isArray(iterable) || isArguments(iterable)) mode = "array";else if (isString(iterable)) mode = "string";else iterable = get(iterable);
  17985. callable(cb);
  17986. doBreak = function doBreak() {
  17987. broken = true;
  17988. };
  17989. if (mode === "array") {
  17990. some.call(iterable, function (value) {
  17991. call.call(cb, thisArg, value, doBreak);
  17992. return broken;
  17993. });
  17994. return;
  17995. }
  17996. if (mode === "string") {
  17997. length = iterable.length;
  17998. for (i = 0; i < length; ++i) {
  17999. char = iterable[i];
  18000. if (i + 1 < length) {
  18001. code = char.charCodeAt(0);
  18002. if (code >= 55296 && code <= 56319) char += iterable[++i];
  18003. }
  18004. call.call(cb, thisArg, char, doBreak);
  18005. if (broken) break;
  18006. }
  18007. return;
  18008. }
  18009. result = iterable.next();
  18010. while (!result.done) {
  18011. call.call(cb, thisArg, result.value, doBreak);
  18012. if (broken) return;
  18013. result = iterable.next();
  18014. }
  18015. };
  18016. }, {
  18017. "./get": 62,
  18018. "es5-ext/function/is-arguments": 24,
  18019. "es5-ext/object/valid-callable": 54,
  18020. "es5-ext/string/is-string": 59
  18021. }],
  18022. 62: [function (require, module, exports) {
  18023. "use strict";
  18024. var isArguments = require("es5-ext/function/is-arguments"),
  18025. isString = require("es5-ext/string/is-string"),
  18026. ArrayIterator = require("./array"),
  18027. StringIterator = require("./string"),
  18028. iterable = require("./valid-iterable"),
  18029. iteratorSymbol = require("es6-symbol").iterator;
  18030. module.exports = function (obj) {
  18031. if (typeof iterable(obj)[iteratorSymbol] === "function") return obj[iteratorSymbol]();
  18032. if (isArguments(obj)) return new ArrayIterator(obj);
  18033. if (isString(obj)) return new StringIterator(obj);
  18034. return new ArrayIterator(obj);
  18035. };
  18036. }, {
  18037. "./array": 60,
  18038. "./string": 65,
  18039. "./valid-iterable": 66,
  18040. "es5-ext/function/is-arguments": 24,
  18041. "es5-ext/string/is-string": 59,
  18042. "es6-symbol": 73
  18043. }],
  18044. 63: [function (require, module, exports) {
  18045. "use strict";
  18046. var clear = require("es5-ext/array/#/clear"),
  18047. assign = require("es5-ext/object/assign"),
  18048. callable = require("es5-ext/object/valid-callable"),
  18049. value = require("es5-ext/object/valid-value"),
  18050. d = require("d"),
  18051. autoBind = require("d/auto-bind"),
  18052. _Symbol2 = require("es6-symbol");
  18053. var defineProperty = Object.defineProperty,
  18054. defineProperties = Object.defineProperties,
  18055. _Iterator;
  18056. module.exports = _Iterator = function Iterator(list, context) {
  18057. if (!(this instanceof _Iterator)) throw new TypeError("Constructor requires 'new'");
  18058. defineProperties(this, {
  18059. __list__: d("w", value(list)),
  18060. __context__: d("w", context),
  18061. __nextIndex__: d("w", 0)
  18062. });
  18063. if (!context) return;
  18064. callable(context.on);
  18065. context.on("_add", this._onAdd);
  18066. context.on("_delete", this._onDelete);
  18067. context.on("_clear", this._onClear);
  18068. };
  18069. delete _Iterator.prototype.constructor;
  18070. defineProperties(_Iterator.prototype, assign({
  18071. _next: d(function () {
  18072. var i;
  18073. if (!this.__list__) return undefined;
  18074. if (this.__redo__) {
  18075. i = this.__redo__.shift();
  18076. if (i !== undefined) return i;
  18077. }
  18078. if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
  18079. this._unBind();
  18080. return undefined;
  18081. }),
  18082. next: d(function () {
  18083. return this._createResult(this._next());
  18084. }),
  18085. _createResult: d(function (i) {
  18086. if (i === undefined) return {
  18087. done: true,
  18088. value: undefined
  18089. };
  18090. return {
  18091. done: false,
  18092. value: this._resolve(i)
  18093. };
  18094. }),
  18095. _resolve: d(function (i) {
  18096. return this.__list__[i];
  18097. }),
  18098. _unBind: d(function () {
  18099. this.__list__ = null;
  18100. delete this.__redo__;
  18101. if (!this.__context__) return;
  18102. this.__context__.off("_add", this._onAdd);
  18103. this.__context__.off("_delete", this._onDelete);
  18104. this.__context__.off("_clear", this._onClear);
  18105. this.__context__ = null;
  18106. }),
  18107. toString: d(function () {
  18108. return "[object " + (this[_Symbol2.toStringTag] || "Object") + "]";
  18109. })
  18110. }, autoBind({
  18111. _onAdd: d(function (index) {
  18112. if (index >= this.__nextIndex__) return;
  18113. ++this.__nextIndex__;
  18114. if (!this.__redo__) {
  18115. defineProperty(this, "__redo__", d("c", [index]));
  18116. return;
  18117. }
  18118. this.__redo__.forEach(function (redo, i) {
  18119. if (redo >= index) this.__redo__[i] = ++redo;
  18120. }, this);
  18121. this.__redo__.push(index);
  18122. }),
  18123. _onDelete: d(function (index) {
  18124. var i;
  18125. if (index >= this.__nextIndex__) return;
  18126. --this.__nextIndex__;
  18127. if (!this.__redo__) return;
  18128. i = this.__redo__.indexOf(index);
  18129. if (i !== -1) this.__redo__.splice(i, 1);
  18130. this.__redo__.forEach(function (redo, j) {
  18131. if (redo > index) this.__redo__[j] = --redo;
  18132. }, this);
  18133. }),
  18134. _onClear: d(function () {
  18135. if (this.__redo__) clear.call(this.__redo__);
  18136. this.__nextIndex__ = 0;
  18137. })
  18138. })));
  18139. defineProperty(_Iterator.prototype, _Symbol2.iterator, d(function () {
  18140. return this;
  18141. }));
  18142. }, {
  18143. d: 16,
  18144. "d/auto-bind": 15,
  18145. "es5-ext/array/#/clear": 19,
  18146. "es5-ext/object/assign": 36,
  18147. "es5-ext/object/valid-callable": 54,
  18148. "es5-ext/object/valid-value": 55,
  18149. "es6-symbol": 73
  18150. }],
  18151. 64: [function (require, module, exports) {
  18152. "use strict";
  18153. var isArguments = require("es5-ext/function/is-arguments"),
  18154. isValue = require("es5-ext/object/is-value"),
  18155. isString = require("es5-ext/string/is-string");
  18156. var iteratorSymbol = require("es6-symbol").iterator,
  18157. isArray = Array.isArray;
  18158. module.exports = function (value) {
  18159. if (!isValue(value)) return false;
  18160. if (isArray(value)) return true;
  18161. if (isString(value)) return true;
  18162. if (isArguments(value)) return true;
  18163. return typeof value[iteratorSymbol] === "function";
  18164. };
  18165. }, {
  18166. "es5-ext/function/is-arguments": 24,
  18167. "es5-ext/object/is-value": 44,
  18168. "es5-ext/string/is-string": 59,
  18169. "es6-symbol": 73
  18170. }],
  18171. 65: [function (require, module, exports) {
  18172. "use strict";
  18173. var setPrototypeOf = require("es5-ext/object/set-prototype-of"),
  18174. d = require("d"),
  18175. _Symbol3 = require("es6-symbol"),
  18176. Iterator = require("./");
  18177. var defineProperty = Object.defineProperty,
  18178. StringIterator;
  18179. StringIterator = module.exports = function (str) {
  18180. if (!(this instanceof StringIterator)) throw new TypeError("Constructor requires 'new'");
  18181. str = String(str);
  18182. Iterator.call(this, str);
  18183. defineProperty(this, "__length__", d("", str.length));
  18184. };
  18185. if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
  18186. delete StringIterator.prototype.constructor;
  18187. StringIterator.prototype = Object.create(Iterator.prototype, {
  18188. _next: d(function () {
  18189. if (!this.__list__) return undefined;
  18190. if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
  18191. this._unBind();
  18192. return undefined;
  18193. }),
  18194. _resolve: d(function (i) {
  18195. var char = this.__list__[i],
  18196. code;
  18197. if (this.__nextIndex__ === this.__length__) return char;
  18198. code = char.charCodeAt(0);
  18199. if (code >= 55296 && code <= 56319) return char + this.__list__[this.__nextIndex__++];
  18200. return char;
  18201. })
  18202. });
  18203. defineProperty(StringIterator.prototype, _Symbol3.toStringTag, d("c", "String Iterator"));
  18204. }, {
  18205. "./": 63,
  18206. d: 16,
  18207. "es5-ext/object/set-prototype-of": 51,
  18208. "es6-symbol": 73
  18209. }],
  18210. 66: [function (require, module, exports) {
  18211. "use strict";
  18212. var isIterable = require("./is-iterable");
  18213. module.exports = function (value) {
  18214. if (!isIterable(value)) throw new TypeError(value + " is not iterable");
  18215. return value;
  18216. };
  18217. }, {
  18218. "./is-iterable": 64
  18219. }],
  18220. 67: [function (require, module, exports) {
  18221. "use strict";
  18222. module.exports = require("./is-implemented")() ? Map : require("./polyfill");
  18223. }, {
  18224. "./is-implemented": 68,
  18225. "./polyfill": 72
  18226. }],
  18227. 68: [function (require, module, exports) {
  18228. "use strict";
  18229. module.exports = function () {
  18230. var map, iterator, result;
  18231. if (typeof Map !== "function") return false;
  18232. try {
  18233. map = new Map([["raz", "one"], ["dwa", "two"], ["trzy", "three"]]);
  18234. } catch (e) {
  18235. return false;
  18236. }
  18237. if (String(map) !== "[object Map]") return false;
  18238. if (map.size !== 3) return false;
  18239. if (typeof map.clear !== "function") return false;
  18240. if (typeof map.delete !== "function") return false;
  18241. if (typeof map.entries !== "function") return false;
  18242. if (typeof map.forEach !== "function") return false;
  18243. if (typeof map.get !== "function") return false;
  18244. if (typeof map.has !== "function") return false;
  18245. if (typeof map.keys !== "function") return false;
  18246. if (typeof map.set !== "function") return false;
  18247. if (typeof map.values !== "function") return false;
  18248. iterator = map.entries();
  18249. result = iterator.next();
  18250. if (result.done !== false) return false;
  18251. if (!result.value) return false;
  18252. if (result.value[0] !== "raz") return false;
  18253. if (result.value[1] !== "one") return false;
  18254. return true;
  18255. };
  18256. }, {}],
  18257. 69: [function (require, module, exports) {
  18258. "use strict";
  18259. module.exports = function () {
  18260. if (typeof Map === "undefined") return false;
  18261. return Object.prototype.toString.call(new Map()) === "[object Map]";
  18262. }();
  18263. }, {}],
  18264. 70: [function (require, module, exports) {
  18265. "use strict";
  18266. module.exports = require("es5-ext/object/primitive-set")("key", "value", "key+value");
  18267. }, {
  18268. "es5-ext/object/primitive-set": 50
  18269. }],
  18270. 71: [function (require, module, exports) {
  18271. "use strict";
  18272. var setPrototypeOf = require("es5-ext/object/set-prototype-of"),
  18273. d = require("d"),
  18274. Iterator = require("es6-iterator"),
  18275. toStringTagSymbol = require("es6-symbol").toStringTag,
  18276. kinds = require("./iterator-kinds"),
  18277. defineProperties = Object.defineProperties,
  18278. unBind = Iterator.prototype._unBind,
  18279. MapIterator;
  18280. MapIterator = module.exports = function (map, kind) {
  18281. if (!(this instanceof MapIterator)) return new MapIterator(map, kind);
  18282. Iterator.call(this, map.__mapKeysData__, map);
  18283. if (!kind || !kinds[kind]) kind = "key+value";
  18284. defineProperties(this, {
  18285. __kind__: d("", kind),
  18286. __values__: d("w", map.__mapValuesData__)
  18287. });
  18288. };
  18289. if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator);
  18290. MapIterator.prototype = Object.create(Iterator.prototype, {
  18291. constructor: d(MapIterator),
  18292. _resolve: d(function (i) {
  18293. if (this.__kind__ === "value") return this.__values__[i];
  18294. if (this.__kind__ === "key") return this.__list__[i];
  18295. return [this.__list__[i], this.__values__[i]];
  18296. }),
  18297. _unBind: d(function () {
  18298. this.__values__ = null;
  18299. unBind.call(this);
  18300. }),
  18301. toString: d(function () {
  18302. return "[object Map Iterator]";
  18303. })
  18304. });
  18305. Object.defineProperty(MapIterator.prototype, toStringTagSymbol, d("c", "Map Iterator"));
  18306. }, {
  18307. "./iterator-kinds": 70,
  18308. d: 16,
  18309. "es5-ext/object/set-prototype-of": 51,
  18310. "es6-iterator": 63,
  18311. "es6-symbol": 73
  18312. }],
  18313. 72: [function (require, module, exports) {
  18314. "use strict";
  18315. var clear = require("es5-ext/array/#/clear"),
  18316. eIndexOf = require("es5-ext/array/#/e-index-of"),
  18317. setPrototypeOf = require("es5-ext/object/set-prototype-of"),
  18318. callable = require("es5-ext/object/valid-callable"),
  18319. validValue = require("es5-ext/object/valid-value"),
  18320. d = require("d"),
  18321. ee = require("event-emitter"),
  18322. _Symbol4 = require("es6-symbol"),
  18323. iterator = require("es6-iterator/valid-iterable"),
  18324. forOf = require("es6-iterator/for-of"),
  18325. Iterator = require("./lib/iterator"),
  18326. isNative = require("./is-native-implemented"),
  18327. call = Function.prototype.call,
  18328. defineProperties = Object.defineProperties,
  18329. getPrototypeOf = Object.getPrototypeOf,
  18330. _MapPoly;
  18331. module.exports = _MapPoly = function MapPoly() {
  18332. var iterable = arguments[0],
  18333. keys,
  18334. values,
  18335. self;
  18336. if (!(this instanceof _MapPoly)) throw new TypeError("Constructor requires 'new'");
  18337. if (isNative && setPrototypeOf && Map !== _MapPoly) {
  18338. self = setPrototypeOf(new Map(), getPrototypeOf(this));
  18339. } else {
  18340. self = this;
  18341. }
  18342. if (iterable != null) iterator(iterable);
  18343. defineProperties(self, {
  18344. __mapKeysData__: d("c", keys = []),
  18345. __mapValuesData__: d("c", values = [])
  18346. });
  18347. if (!iterable) return self;
  18348. forOf(iterable, function (value) {
  18349. var key = validValue(value)[0];
  18350. value = value[1];
  18351. if (eIndexOf.call(keys, key) !== -1) return;
  18352. keys.push(key);
  18353. values.push(value);
  18354. }, self);
  18355. return self;
  18356. };
  18357. if (isNative) {
  18358. if (setPrototypeOf) setPrototypeOf(_MapPoly, Map);
  18359. _MapPoly.prototype = Object.create(Map.prototype, {
  18360. constructor: d(_MapPoly)
  18361. });
  18362. }
  18363. ee(defineProperties(_MapPoly.prototype, {
  18364. clear: d(function () {
  18365. if (!this.__mapKeysData__.length) return;
  18366. clear.call(this.__mapKeysData__);
  18367. clear.call(this.__mapValuesData__);
  18368. this.emit("_clear");
  18369. }),
  18370. delete: d(function (key) {
  18371. var index = eIndexOf.call(this.__mapKeysData__, key);
  18372. if (index === -1) return false;
  18373. this.__mapKeysData__.splice(index, 1);
  18374. this.__mapValuesData__.splice(index, 1);
  18375. this.emit("_delete", index, key);
  18376. return true;
  18377. }),
  18378. entries: d(function () {
  18379. return new Iterator(this, "key+value");
  18380. }),
  18381. forEach: d(function (cb) {
  18382. var thisArg = arguments[1],
  18383. iterator,
  18384. result;
  18385. callable(cb);
  18386. iterator = this.entries();
  18387. result = iterator._next();
  18388. while (result !== undefined) {
  18389. call.call(cb, thisArg, this.__mapValuesData__[result], this.__mapKeysData__[result], this);
  18390. result = iterator._next();
  18391. }
  18392. }),
  18393. get: d(function (key) {
  18394. var index = eIndexOf.call(this.__mapKeysData__, key);
  18395. if (index === -1) return;
  18396. return this.__mapValuesData__[index];
  18397. }),
  18398. has: d(function (key) {
  18399. return eIndexOf.call(this.__mapKeysData__, key) !== -1;
  18400. }),
  18401. keys: d(function () {
  18402. return new Iterator(this, "key");
  18403. }),
  18404. set: d(function (key, value) {
  18405. var index = eIndexOf.call(this.__mapKeysData__, key),
  18406. emit;
  18407. if (index === -1) {
  18408. index = this.__mapKeysData__.push(key) - 1;
  18409. emit = true;
  18410. }
  18411. this.__mapValuesData__[index] = value;
  18412. if (emit) this.emit("_add", index, key);
  18413. return this;
  18414. }),
  18415. size: d.gs(function () {
  18416. return this.__mapKeysData__.length;
  18417. }),
  18418. values: d(function () {
  18419. return new Iterator(this, "value");
  18420. }),
  18421. toString: d(function () {
  18422. return "[object Map]";
  18423. })
  18424. }));
  18425. Object.defineProperty(_MapPoly.prototype, _Symbol4.iterator, d(function () {
  18426. return this.entries();
  18427. }));
  18428. Object.defineProperty(_MapPoly.prototype, _Symbol4.toStringTag, d("c", "Map"));
  18429. }, {
  18430. "./is-native-implemented": 69,
  18431. "./lib/iterator": 71,
  18432. d: 16,
  18433. "es5-ext/array/#/clear": 19,
  18434. "es5-ext/array/#/e-index-of": 20,
  18435. "es5-ext/object/set-prototype-of": 51,
  18436. "es5-ext/object/valid-callable": 54,
  18437. "es5-ext/object/valid-value": 55,
  18438. "es6-iterator/for-of": 61,
  18439. "es6-iterator/valid-iterable": 66,
  18440. "es6-symbol": 73,
  18441. "event-emitter": 78
  18442. }],
  18443. 73: [function (require, module, exports) {
  18444. "use strict";
  18445. module.exports = require("./is-implemented")() ? Symbol : require("./polyfill");
  18446. }, {
  18447. "./is-implemented": 74,
  18448. "./polyfill": 76
  18449. }],
  18450. 74: [function (require, module, exports) {
  18451. "use strict";
  18452. var validTypes = {
  18453. object: true,
  18454. symbol: true
  18455. };
  18456. module.exports = function () {
  18457. var symbol;
  18458. if (typeof Symbol !== "function") return false;
  18459. symbol = Symbol("test symbol");
  18460. try {
  18461. String(symbol);
  18462. } catch (e) {
  18463. return false;
  18464. }
  18465. if (!validTypes[_typeof(Symbol.iterator)]) return false;
  18466. if (!validTypes[_typeof(Symbol.toPrimitive)]) return false;
  18467. if (!validTypes[_typeof(Symbol.toStringTag)]) return false;
  18468. return true;
  18469. };
  18470. }, {}],
  18471. 75: [function (require, module, exports) {
  18472. "use strict";
  18473. module.exports = function (x) {
  18474. if (!x) return false;
  18475. if (_typeof(x) === "symbol") return true;
  18476. if (!x.constructor) return false;
  18477. if (x.constructor.name !== "Symbol") return false;
  18478. return x[x.constructor.toStringTag] === "Symbol";
  18479. };
  18480. }, {}],
  18481. 76: [function (require, module, exports) {
  18482. "use strict";
  18483. var d = require("d"),
  18484. validateSymbol = require("./validate-symbol"),
  18485. create = Object.create,
  18486. defineProperties = Object.defineProperties,
  18487. defineProperty = Object.defineProperty,
  18488. objPrototype = Object.prototype,
  18489. NativeSymbol,
  18490. SymbolPolyfill,
  18491. HiddenSymbol,
  18492. globalSymbols = create(null),
  18493. isNativeSafe;
  18494. if (typeof Symbol === "function") {
  18495. NativeSymbol = Symbol;
  18496. try {
  18497. String(NativeSymbol());
  18498. isNativeSafe = true;
  18499. } catch (ignore) {}
  18500. }
  18501. var generateName = function () {
  18502. var created = create(null);
  18503. return function (desc) {
  18504. var postfix = 0,
  18505. name,
  18506. ie11BugWorkaround;
  18507. while (created[desc + (postfix || "")]) {
  18508. ++postfix;
  18509. }
  18510. desc += postfix || "";
  18511. created[desc] = true;
  18512. name = "@@" + desc;
  18513. defineProperty(objPrototype, name, d.gs(null, function (value) {
  18514. if (ie11BugWorkaround) return;
  18515. ie11BugWorkaround = true;
  18516. defineProperty(this, name, d(value));
  18517. ie11BugWorkaround = false;
  18518. }));
  18519. return name;
  18520. };
  18521. }();
  18522. HiddenSymbol = function _Symbol5(description) {
  18523. if (this instanceof HiddenSymbol) throw new TypeError("Symbol is not a constructor");
  18524. return SymbolPolyfill(description);
  18525. };
  18526. module.exports = SymbolPolyfill = function _Symbol6(description) {
  18527. var symbol;
  18528. if (this instanceof _Symbol6) throw new TypeError("Symbol is not a constructor");
  18529. if (isNativeSafe) return NativeSymbol(description);
  18530. symbol = create(HiddenSymbol.prototype);
  18531. description = description === undefined ? "" : String(description);
  18532. return defineProperties(symbol, {
  18533. __description__: d("", description),
  18534. __name__: d("", generateName(description))
  18535. });
  18536. };
  18537. defineProperties(SymbolPolyfill, {
  18538. for: d(function (key) {
  18539. if (globalSymbols[key]) return globalSymbols[key];
  18540. return globalSymbols[key] = SymbolPolyfill(String(key));
  18541. }),
  18542. keyFor: d(function (s) {
  18543. var key;
  18544. validateSymbol(s);
  18545. for (key in globalSymbols) {
  18546. if (globalSymbols[key] === s) return key;
  18547. }
  18548. }),
  18549. hasInstance: d("", NativeSymbol && NativeSymbol.hasInstance || SymbolPolyfill("hasInstance")),
  18550. isConcatSpreadable: d("", NativeSymbol && NativeSymbol.isConcatSpreadable || SymbolPolyfill("isConcatSpreadable")),
  18551. iterator: d("", NativeSymbol && NativeSymbol.iterator || SymbolPolyfill("iterator")),
  18552. match: d("", NativeSymbol && NativeSymbol.match || SymbolPolyfill("match")),
  18553. replace: d("", NativeSymbol && NativeSymbol.replace || SymbolPolyfill("replace")),
  18554. search: d("", NativeSymbol && NativeSymbol.search || SymbolPolyfill("search")),
  18555. species: d("", NativeSymbol && NativeSymbol.species || SymbolPolyfill("species")),
  18556. split: d("", NativeSymbol && NativeSymbol.split || SymbolPolyfill("split")),
  18557. toPrimitive: d("", NativeSymbol && NativeSymbol.toPrimitive || SymbolPolyfill("toPrimitive")),
  18558. toStringTag: d("", NativeSymbol && NativeSymbol.toStringTag || SymbolPolyfill("toStringTag")),
  18559. unscopables: d("", NativeSymbol && NativeSymbol.unscopables || SymbolPolyfill("unscopables"))
  18560. });
  18561. defineProperties(HiddenSymbol.prototype, {
  18562. constructor: d(SymbolPolyfill),
  18563. toString: d("", function () {
  18564. return this.__name__;
  18565. })
  18566. });
  18567. defineProperties(SymbolPolyfill.prototype, {
  18568. toString: d(function () {
  18569. return "Symbol (" + validateSymbol(this).__description__ + ")";
  18570. }),
  18571. valueOf: d(function () {
  18572. return validateSymbol(this);
  18573. })
  18574. });
  18575. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d("", function () {
  18576. var symbol = validateSymbol(this);
  18577. if (_typeof(symbol) === "symbol") return symbol;
  18578. return symbol.toString();
  18579. }));
  18580. defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d("c", "Symbol"));
  18581. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, d("c", SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));
  18582. defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, d("c", SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));
  18583. }, {
  18584. "./validate-symbol": 77,
  18585. d: 16
  18586. }],
  18587. 77: [function (require, module, exports) {
  18588. "use strict";
  18589. var isSymbol = require("./is-symbol");
  18590. module.exports = function (value) {
  18591. if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
  18592. return value;
  18593. };
  18594. }, {
  18595. "./is-symbol": 75
  18596. }],
  18597. 78: [function (require, module, exports) {
  18598. "use strict";
  18599. var d = require("d"),
  18600. callable = require("es5-ext/object/valid-callable"),
  18601. apply = Function.prototype.apply,
  18602. call = Function.prototype.call,
  18603. create = Object.create,
  18604. defineProperty = Object.defineProperty,
  18605. defineProperties = Object.defineProperties,
  18606. hasOwnProperty = Object.prototype.hasOwnProperty,
  18607. descriptor = {
  18608. configurable: true,
  18609. enumerable: false,
  18610. writable: true
  18611. },
  18612. on,
  18613. _once2,
  18614. off,
  18615. emit,
  18616. methods,
  18617. descriptors,
  18618. base;
  18619. on = function on(type, listener) {
  18620. var data;
  18621. callable(listener);
  18622. if (!hasOwnProperty.call(this, "__ee__")) {
  18623. data = descriptor.value = create(null);
  18624. defineProperty(this, "__ee__", descriptor);
  18625. descriptor.value = null;
  18626. } else {
  18627. data = this.__ee__;
  18628. }
  18629. if (!data[type]) data[type] = listener;else if (_typeof(data[type]) === "object") data[type].push(listener);else data[type] = [data[type], listener];
  18630. return this;
  18631. };
  18632. _once2 = function once(type, listener) {
  18633. var _once, self;
  18634. callable(listener);
  18635. self = this;
  18636. on.call(this, type, _once = function once() {
  18637. off.call(self, type, _once);
  18638. apply.call(listener, this, arguments);
  18639. });
  18640. _once.__eeOnceListener__ = listener;
  18641. return this;
  18642. };
  18643. off = function off(type, listener) {
  18644. var data, listeners, candidate, i;
  18645. callable(listener);
  18646. if (!hasOwnProperty.call(this, "__ee__")) return this;
  18647. data = this.__ee__;
  18648. if (!data[type]) return this;
  18649. listeners = data[type];
  18650. if (_typeof(listeners) === "object") {
  18651. for (i = 0; candidate = listeners[i]; ++i) {
  18652. if (candidate === listener || candidate.__eeOnceListener__ === listener) {
  18653. if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];else listeners.splice(i, 1);
  18654. }
  18655. }
  18656. } else {
  18657. if (listeners === listener || listeners.__eeOnceListener__ === listener) {
  18658. delete data[type];
  18659. }
  18660. }
  18661. return this;
  18662. };
  18663. emit = function emit(type) {
  18664. var i, l, listener, listeners, args;
  18665. if (!hasOwnProperty.call(this, "__ee__")) return;
  18666. listeners = this.__ee__[type];
  18667. if (!listeners) return;
  18668. if (_typeof(listeners) === "object") {
  18669. l = arguments.length;
  18670. args = new Array(l - 1);
  18671. for (i = 1; i < l; ++i) {
  18672. args[i - 1] = arguments[i];
  18673. }
  18674. listeners = listeners.slice();
  18675. for (i = 0; listener = listeners[i]; ++i) {
  18676. apply.call(listener, this, args);
  18677. }
  18678. } else {
  18679. switch (arguments.length) {
  18680. case 1:
  18681. call.call(listeners, this);
  18682. break;
  18683. case 2:
  18684. call.call(listeners, this, arguments[1]);
  18685. break;
  18686. case 3:
  18687. call.call(listeners, this, arguments[1], arguments[2]);
  18688. break;
  18689. default:
  18690. l = arguments.length;
  18691. args = new Array(l - 1);
  18692. for (i = 1; i < l; ++i) {
  18693. args[i - 1] = arguments[i];
  18694. }
  18695. apply.call(listeners, this, args);
  18696. }
  18697. }
  18698. };
  18699. methods = {
  18700. on: on,
  18701. once: _once2,
  18702. off: off,
  18703. emit: emit
  18704. };
  18705. descriptors = {
  18706. on: d(on),
  18707. once: d(_once2),
  18708. off: d(off),
  18709. emit: d(emit)
  18710. };
  18711. base = defineProperties({}, descriptors);
  18712. module.exports = exports = function exports(o) {
  18713. return o == null ? create(base) : defineProperties(Object(o), descriptors);
  18714. };
  18715. exports.methods = methods;
  18716. }, {
  18717. d: 16,
  18718. "es5-ext/object/valid-callable": 54
  18719. }],
  18720. 79: [function (require, module, exports) {
  18721. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  18722. var e, m;
  18723. var eLen = nBytes * 8 - mLen - 1;
  18724. var eMax = (1 << eLen) - 1;
  18725. var eBias = eMax >> 1;
  18726. var nBits = -7;
  18727. var i = isLE ? nBytes - 1 : 0;
  18728. var d = isLE ? -1 : 1;
  18729. var s = buffer[offset + i];
  18730. i += d;
  18731. e = s & (1 << -nBits) - 1;
  18732. s >>= -nBits;
  18733. nBits += eLen;
  18734. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  18735. m = e & (1 << -nBits) - 1;
  18736. e >>= -nBits;
  18737. nBits += mLen;
  18738. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  18739. if (e === 0) {
  18740. e = 1 - eBias;
  18741. } else if (e === eMax) {
  18742. return m ? NaN : (s ? -1 : 1) * Infinity;
  18743. } else {
  18744. m = m + Math.pow(2, mLen);
  18745. e = e - eBias;
  18746. }
  18747. return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
  18748. };
  18749. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  18750. var e, m, c;
  18751. var eLen = nBytes * 8 - mLen - 1;
  18752. var eMax = (1 << eLen) - 1;
  18753. var eBias = eMax >> 1;
  18754. var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
  18755. var i = isLE ? 0 : nBytes - 1;
  18756. var d = isLE ? 1 : -1;
  18757. var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
  18758. value = Math.abs(value);
  18759. if (isNaN(value) || value === Infinity) {
  18760. m = isNaN(value) ? 1 : 0;
  18761. e = eMax;
  18762. } else {
  18763. e = Math.floor(Math.log(value) / Math.LN2);
  18764. if (value * (c = Math.pow(2, -e)) < 1) {
  18765. e--;
  18766. c *= 2;
  18767. }
  18768. if (e + eBias >= 1) {
  18769. value += rt / c;
  18770. } else {
  18771. value += rt * Math.pow(2, 1 - eBias);
  18772. }
  18773. if (value * c >= 2) {
  18774. e++;
  18775. c /= 2;
  18776. }
  18777. if (e + eBias >= eMax) {
  18778. m = 0;
  18779. e = eMax;
  18780. } else if (e + eBias >= 1) {
  18781. m = (value * c - 1) * Math.pow(2, mLen);
  18782. e = e + eBias;
  18783. } else {
  18784. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
  18785. e = 0;
  18786. }
  18787. }
  18788. for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {}
  18789. e = e << mLen | m;
  18790. eLen += mLen;
  18791. for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {}
  18792. buffer[offset + i - d] |= s * 128;
  18793. };
  18794. }, {}],
  18795. 80: [function (require, module, exports) {
  18796. if (typeof Object.create === "function") {
  18797. module.exports = function inherits(ctor, superCtor) {
  18798. ctor.super_ = superCtor;
  18799. ctor.prototype = Object.create(superCtor.prototype, {
  18800. constructor: {
  18801. value: ctor,
  18802. enumerable: false,
  18803. writable: true,
  18804. configurable: true
  18805. }
  18806. });
  18807. };
  18808. } else {
  18809. module.exports = function inherits(ctor, superCtor) {
  18810. ctor.super_ = superCtor;
  18811. var TempCtor = function TempCtor() {};
  18812. TempCtor.prototype = superCtor.prototype;
  18813. ctor.prototype = new TempCtor();
  18814. ctor.prototype.constructor = ctor;
  18815. };
  18816. }
  18817. }, {}],
  18818. 81: [function (require, module, exports) {
  18819. module.exports = function (obj) {
  18820. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
  18821. };
  18822. function isBuffer(obj) {
  18823. return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
  18824. }
  18825. function isSlowBuffer(obj) {
  18826. return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer(obj.slice(0, 0));
  18827. }
  18828. }, {}],
  18829. 82: [function (require, module, exports) {
  18830. "use strict";
  18831. var Buffer = require("safe-buffer").Buffer;
  18832. var protocol = module.exports;
  18833. protocol.types = {
  18834. 0: "reserved",
  18835. 1: "connect",
  18836. 2: "connack",
  18837. 3: "publish",
  18838. 4: "puback",
  18839. 5: "pubrec",
  18840. 6: "pubrel",
  18841. 7: "pubcomp",
  18842. 8: "subscribe",
  18843. 9: "suback",
  18844. 10: "unsubscribe",
  18845. 11: "unsuback",
  18846. 12: "pingreq",
  18847. 13: "pingresp",
  18848. 14: "disconnect",
  18849. 15: "auth"
  18850. };
  18851. protocol.codes = {};
  18852. for (var k in protocol.types) {
  18853. var v = protocol.types[k];
  18854. protocol.codes[v] = k;
  18855. }
  18856. protocol.CMD_SHIFT = 4;
  18857. protocol.CMD_MASK = 240;
  18858. protocol.DUP_MASK = 8;
  18859. protocol.QOS_MASK = 3;
  18860. protocol.QOS_SHIFT = 1;
  18861. protocol.RETAIN_MASK = 1;
  18862. protocol.LENGTH_MASK = 127;
  18863. protocol.LENGTH_FIN_MASK = 128;
  18864. protocol.SESSIONPRESENT_MASK = 1;
  18865. protocol.SESSIONPRESENT_HEADER = Buffer.from([protocol.SESSIONPRESENT_MASK]);
  18866. protocol.CONNACK_HEADER = Buffer.from([protocol.codes["connack"] << protocol.CMD_SHIFT]);
  18867. protocol.USERNAME_MASK = 128;
  18868. protocol.PASSWORD_MASK = 64;
  18869. protocol.WILL_RETAIN_MASK = 32;
  18870. protocol.WILL_QOS_MASK = 24;
  18871. protocol.WILL_QOS_SHIFT = 3;
  18872. protocol.WILL_FLAG_MASK = 4;
  18873. protocol.CLEAN_SESSION_MASK = 2;
  18874. protocol.CONNECT_HEADER = Buffer.from([protocol.codes["connect"] << protocol.CMD_SHIFT]);
  18875. protocol.properties = {
  18876. sessionExpiryInterval: 17,
  18877. willDelayInterval: 24,
  18878. receiveMaximum: 33,
  18879. maximumPacketSize: 39,
  18880. topicAliasMaximum: 34,
  18881. requestResponseInformation: 25,
  18882. requestProblemInformation: 23,
  18883. userProperties: 38,
  18884. authenticationMethod: 21,
  18885. authenticationData: 22,
  18886. payloadFormatIndicator: 1,
  18887. messageExpiryInterval: 2,
  18888. contentType: 3,
  18889. responseTopic: 8,
  18890. correlationData: 9,
  18891. maximumQoS: 36,
  18892. retainAvailable: 37,
  18893. assignedClientIdentifier: 18,
  18894. reasonString: 31,
  18895. wildcardSubscriptionAvailable: 40,
  18896. subscriptionIdentifiersAvailable: 41,
  18897. sharedSubscriptionAvailable: 42,
  18898. serverKeepAlive: 19,
  18899. responseInformation: 26,
  18900. serverReference: 28,
  18901. topicAlias: 35,
  18902. subscriptionIdentifier: 11
  18903. };
  18904. protocol.propertiesCodes = {};
  18905. for (var prop in protocol.properties) {
  18906. var id = protocol.properties[prop];
  18907. protocol.propertiesCodes[id] = prop;
  18908. }
  18909. protocol.propertiesTypes = {
  18910. sessionExpiryInterval: "int32",
  18911. willDelayInterval: "int32",
  18912. receiveMaximum: "int16",
  18913. maximumPacketSize: "int32",
  18914. topicAliasMaximum: "int16",
  18915. requestResponseInformation: "byte",
  18916. requestProblemInformation: "byte",
  18917. userProperties: "pair",
  18918. authenticationMethod: "string",
  18919. authenticationData: "binary",
  18920. payloadFormatIndicator: "byte",
  18921. messageExpiryInterval: "int32",
  18922. contentType: "string",
  18923. responseTopic: "string",
  18924. correlationData: "binary",
  18925. maximumQoS: "int8",
  18926. retainAvailable: "byte",
  18927. assignedClientIdentifier: "string",
  18928. reasonString: "string",
  18929. wildcardSubscriptionAvailable: "byte",
  18930. subscriptionIdentifiersAvailable: "byte",
  18931. sharedSubscriptionAvailable: "byte",
  18932. serverKeepAlive: "int32",
  18933. responseInformation: "string",
  18934. serverReference: "string",
  18935. topicAlias: "int16",
  18936. subscriptionIdentifier: "var"
  18937. };
  18938. function genHeader(type) {
  18939. return [0, 1, 2].map(function (qos) {
  18940. return [0, 1].map(function (dup) {
  18941. return [0, 1].map(function (retain) {
  18942. var buf = new Buffer(1);
  18943. buf.writeUInt8(protocol.codes[type] << protocol.CMD_SHIFT | (dup ? protocol.DUP_MASK : 0) | qos << protocol.QOS_SHIFT | retain, 0, true);
  18944. return buf;
  18945. });
  18946. });
  18947. });
  18948. }
  18949. protocol.PUBLISH_HEADER = genHeader("publish");
  18950. protocol.SUBSCRIBE_HEADER = genHeader("subscribe");
  18951. protocol.SUBSCRIBE_OPTIONS_QOS_MASK = 3;
  18952. protocol.SUBSCRIBE_OPTIONS_NL_MASK = 1;
  18953. protocol.SUBSCRIBE_OPTIONS_NL_SHIFT = 2;
  18954. protocol.SUBSCRIBE_OPTIONS_RAP_MASK = 1;
  18955. protocol.SUBSCRIBE_OPTIONS_RAP_SHIFT = 3;
  18956. protocol.SUBSCRIBE_OPTIONS_RH_MASK = 3;
  18957. protocol.SUBSCRIBE_OPTIONS_RH_SHIFT = 4;
  18958. protocol.SUBSCRIBE_OPTIONS_RH = [0, 16, 32];
  18959. protocol.SUBSCRIBE_OPTIONS_NL = 4;
  18960. protocol.SUBSCRIBE_OPTIONS_RAP = 8;
  18961. protocol.SUBSCRIBE_OPTIONS_QOS = [0, 1, 2];
  18962. protocol.UNSUBSCRIBE_HEADER = genHeader("unsubscribe");
  18963. protocol.ACKS = {
  18964. unsuback: genHeader("unsuback"),
  18965. puback: genHeader("puback"),
  18966. pubcomp: genHeader("pubcomp"),
  18967. pubrel: genHeader("pubrel"),
  18968. pubrec: genHeader("pubrec")
  18969. };
  18970. protocol.SUBACK_HEADER = Buffer.from([protocol.codes["suback"] << protocol.CMD_SHIFT]);
  18971. protocol.VERSION3 = Buffer.from([3]);
  18972. protocol.VERSION4 = Buffer.from([4]);
  18973. protocol.VERSION5 = Buffer.from([5]);
  18974. protocol.QOS = [0, 1, 2].map(function (qos) {
  18975. return Buffer.from([qos]);
  18976. });
  18977. protocol.EMPTY = {
  18978. pingreq: Buffer.from([protocol.codes["pingreq"] << 4, 0]),
  18979. pingresp: Buffer.from([protocol.codes["pingresp"] << 4, 0]),
  18980. disconnect: Buffer.from([protocol.codes["disconnect"] << 4, 0])
  18981. };
  18982. }, {
  18983. "safe-buffer": 110
  18984. }],
  18985. 83: [function (require, module, exports) {
  18986. "use strict";
  18987. var Buffer = require("safe-buffer").Buffer;
  18988. var writeToStream = require("./writeToStream");
  18989. var EE = require("events").EventEmitter;
  18990. var inherits = require("inherits");
  18991. function generate(packet, opts) {
  18992. var stream = new Accumulator();
  18993. writeToStream(packet, stream, opts);
  18994. return stream.concat();
  18995. }
  18996. function Accumulator() {
  18997. this._array = new Array(20);
  18998. this._i = 0;
  18999. }
  19000. inherits(Accumulator, EE);
  19001. Accumulator.prototype.write = function (chunk) {
  19002. this._array[this._i++] = chunk;
  19003. return true;
  19004. };
  19005. Accumulator.prototype.concat = function () {
  19006. var length = 0;
  19007. var lengths = new Array(this._array.length);
  19008. var list = this._array;
  19009. var pos = 0;
  19010. var i;
  19011. var result;
  19012. for (i = 0; i < list.length && list[i] !== undefined; i++) {
  19013. if (typeof list[i] !== "string") lengths[i] = list[i].length;else lengths[i] = Buffer.byteLength(list[i]);
  19014. length += lengths[i];
  19015. }
  19016. result = Buffer.allocUnsafe(length);
  19017. for (i = 0; i < list.length && list[i] !== undefined; i++) {
  19018. if (typeof list[i] !== "string") {
  19019. list[i].copy(result, pos);
  19020. pos += lengths[i];
  19021. } else {
  19022. result.write(list[i], pos);
  19023. pos += lengths[i];
  19024. }
  19025. }
  19026. return result;
  19027. };
  19028. module.exports = generate;
  19029. }, {
  19030. "./writeToStream": 89,
  19031. events: 13,
  19032. inherits: 80,
  19033. "safe-buffer": 110
  19034. }],
  19035. 84: [function (require, module, exports) {
  19036. "use strict";
  19037. exports.parser = require("./parser");
  19038. exports.generate = require("./generate");
  19039. exports.writeToStream = require("./writeToStream");
  19040. }, {
  19041. "./generate": 83,
  19042. "./parser": 88,
  19043. "./writeToStream": 89
  19044. }],
  19045. 85: [function (require, module, exports) {
  19046. var DuplexStream = require("readable-stream/duplex"),
  19047. util = require("util"),
  19048. Buffer = require("safe-buffer").Buffer;
  19049. function BufferList(callback) {
  19050. if (!(this instanceof BufferList)) return new BufferList(callback);
  19051. this._bufs = [];
  19052. this.length = 0;
  19053. if (typeof callback == "function") {
  19054. this._callback = callback;
  19055. var piper = function piper(err) {
  19056. if (this._callback) {
  19057. this._callback(err);
  19058. this._callback = null;
  19059. }
  19060. }.bind(this);
  19061. this.on("pipe", function onPipe(src) {
  19062. src.on("error", piper);
  19063. });
  19064. this.on("unpipe", function onUnpipe(src) {
  19065. src.removeListener("error", piper);
  19066. });
  19067. } else {
  19068. this.append(callback);
  19069. }
  19070. DuplexStream.call(this);
  19071. }
  19072. util.inherits(BufferList, DuplexStream);
  19073. BufferList.prototype._offset = function _offset(offset) {
  19074. var tot = 0,
  19075. i = 0,
  19076. _t;
  19077. if (offset === 0) return [0, 0];
  19078. for (; i < this._bufs.length; i++) {
  19079. _t = tot + this._bufs[i].length;
  19080. if (offset < _t || i == this._bufs.length - 1) return [i, offset - tot];
  19081. tot = _t;
  19082. }
  19083. };
  19084. BufferList.prototype.append = function append(buf) {
  19085. var i = 0;
  19086. if (Buffer.isBuffer(buf)) {
  19087. this._appendBuffer(buf);
  19088. } else if (Array.isArray(buf)) {
  19089. for (; i < buf.length; i++) {
  19090. this.append(buf[i]);
  19091. }
  19092. } else if (buf instanceof BufferList) {
  19093. for (; i < buf._bufs.length; i++) {
  19094. this.append(buf._bufs[i]);
  19095. }
  19096. } else if (buf != null) {
  19097. if (typeof buf == "number") buf = buf.toString();
  19098. this._appendBuffer(Buffer.from(buf));
  19099. }
  19100. return this;
  19101. };
  19102. BufferList.prototype._appendBuffer = function appendBuffer(buf) {
  19103. this._bufs.push(buf);
  19104. this.length += buf.length;
  19105. };
  19106. BufferList.prototype._write = function _write(buf, encoding, callback) {
  19107. this._appendBuffer(buf);
  19108. if (typeof callback == "function") callback();
  19109. };
  19110. BufferList.prototype._read = function _read(size) {
  19111. if (!this.length) return this.push(null);
  19112. size = Math.min(size, this.length);
  19113. this.push(this.slice(0, size));
  19114. this.consume(size);
  19115. };
  19116. BufferList.prototype.end = function end(chunk) {
  19117. DuplexStream.prototype.end.call(this, chunk);
  19118. if (this._callback) {
  19119. this._callback(null, this.slice());
  19120. this._callback = null;
  19121. }
  19122. };
  19123. BufferList.prototype.get = function get(index) {
  19124. return this.slice(index, index + 1)[0];
  19125. };
  19126. BufferList.prototype.slice = function slice(start, end) {
  19127. if (typeof start == "number" && start < 0) start += this.length;
  19128. if (typeof end == "number" && end < 0) end += this.length;
  19129. return this.copy(null, 0, start, end);
  19130. };
  19131. BufferList.prototype.copy = function copy(dst, dstStart, srcStart, srcEnd) {
  19132. if (typeof srcStart != "number" || srcStart < 0) srcStart = 0;
  19133. if (typeof srcEnd != "number" || srcEnd > this.length) srcEnd = this.length;
  19134. if (srcStart >= this.length) return dst || Buffer.alloc(0);
  19135. if (srcEnd <= 0) return dst || Buffer.alloc(0);
  19136. var copy = !!dst,
  19137. off = this._offset(srcStart),
  19138. len = srcEnd - srcStart,
  19139. bytes = len,
  19140. bufoff = copy && dstStart || 0,
  19141. start = off[1],
  19142. l,
  19143. i;
  19144. if (srcStart === 0 && srcEnd == this.length) {
  19145. if (!copy) {
  19146. return this._bufs.length === 1 ? this._bufs[0] : Buffer.concat(this._bufs, this.length);
  19147. }
  19148. for (i = 0; i < this._bufs.length; i++) {
  19149. this._bufs[i].copy(dst, bufoff);
  19150. bufoff += this._bufs[i].length;
  19151. }
  19152. return dst;
  19153. }
  19154. if (bytes <= this._bufs[off[0]].length - start) {
  19155. return copy ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
  19156. }
  19157. if (!copy) dst = Buffer.allocUnsafe(len);
  19158. for (i = off[0]; i < this._bufs.length; i++) {
  19159. l = this._bufs[i].length - start;
  19160. if (bytes > l) {
  19161. this._bufs[i].copy(dst, bufoff, start);
  19162. } else {
  19163. this._bufs[i].copy(dst, bufoff, start, start + bytes);
  19164. break;
  19165. }
  19166. bufoff += l;
  19167. bytes -= l;
  19168. if (start) start = 0;
  19169. }
  19170. return dst;
  19171. };
  19172. BufferList.prototype.shallowSlice = function shallowSlice(start, end) {
  19173. start = start || 0;
  19174. end = end || this.length;
  19175. if (start < 0) start += this.length;
  19176. if (end < 0) end += this.length;
  19177. var startOffset = this._offset(start),
  19178. endOffset = this._offset(end),
  19179. buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1);
  19180. if (endOffset[1] == 0) buffers.pop();else buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1]);
  19181. if (startOffset[1] != 0) buffers[0] = buffers[0].slice(startOffset[1]);
  19182. return new BufferList(buffers);
  19183. };
  19184. BufferList.prototype.toString = function toString(encoding, start, end) {
  19185. return this.slice(start, end).toString(encoding);
  19186. };
  19187. BufferList.prototype.consume = function consume(bytes) {
  19188. while (this._bufs.length) {
  19189. if (bytes >= this._bufs[0].length) {
  19190. bytes -= this._bufs[0].length;
  19191. this.length -= this._bufs[0].length;
  19192. this._bufs.shift();
  19193. } else {
  19194. this._bufs[0] = this._bufs[0].slice(bytes);
  19195. this.length -= bytes;
  19196. break;
  19197. }
  19198. }
  19199. return this;
  19200. };
  19201. BufferList.prototype.duplicate = function duplicate() {
  19202. var i = 0,
  19203. copy = new BufferList();
  19204. for (; i < this._bufs.length; i++) {
  19205. copy.append(this._bufs[i]);
  19206. }
  19207. return copy;
  19208. };
  19209. BufferList.prototype.destroy = function destroy() {
  19210. this._bufs.length = 0;
  19211. this.length = 0;
  19212. this.push(null);
  19213. };
  19214. (function () {
  19215. var methods = {
  19216. readDoubleBE: 8,
  19217. readDoubleLE: 8,
  19218. readFloatBE: 4,
  19219. readFloatLE: 4,
  19220. readInt32BE: 4,
  19221. readInt32LE: 4,
  19222. readUInt32BE: 4,
  19223. readUInt32LE: 4,
  19224. readInt16BE: 2,
  19225. readInt16LE: 2,
  19226. readUInt16BE: 2,
  19227. readUInt16LE: 2,
  19228. readInt8: 1,
  19229. readUInt8: 1
  19230. };
  19231. for (var m in methods) {
  19232. (function (m) {
  19233. BufferList.prototype[m] = function (offset) {
  19234. return this.slice(offset, offset + methods[m])[m](0);
  19235. };
  19236. })(m);
  19237. }
  19238. })();
  19239. module.exports = BufferList;
  19240. }, {
  19241. "readable-stream/duplex": 97,
  19242. "safe-buffer": 110,
  19243. util: 117
  19244. }],
  19245. 86: [function (require, module, exports) {
  19246. "use strict";
  19247. var Buffer = require("safe-buffer").Buffer;
  19248. var max = 65536;
  19249. var cache = {};
  19250. function generateBuffer(i) {
  19251. var buffer = Buffer.allocUnsafe(2);
  19252. buffer.writeUInt8(i >> 8, 0);
  19253. buffer.writeUInt8(i & 255, 0 + 1);
  19254. return buffer;
  19255. }
  19256. function generateCache() {
  19257. for (var i = 0; i < max; i++) {
  19258. cache[i] = generateBuffer(i);
  19259. }
  19260. }
  19261. function calcVariableByteIntLength(length) {
  19262. if (length >= 0 && length < 128) return 1;else if (length >= 128 && length < 16384) return 2;else if (length >= 16384 && length < 2097152) return 3;else if (length >= 2097152 && length < 268435456) return 4;else return 0;
  19263. }
  19264. function genBufVariableByteInt(num) {
  19265. var digit = 0;
  19266. var pos = 0;
  19267. var length = calcVariableByteIntLength(num);
  19268. var buffer = Buffer.allocUnsafe(length);
  19269. do {
  19270. digit = num % 128 | 0;
  19271. num = num / 128 | 0;
  19272. if (num > 0) digit = digit | 128;
  19273. buffer.writeUInt8(digit, pos++);
  19274. } while (num > 0);
  19275. return {
  19276. data: buffer,
  19277. length: length
  19278. };
  19279. }
  19280. function generate4ByteBuffer(num) {
  19281. var buffer = Buffer.allocUnsafe(4);
  19282. buffer.writeUInt32BE(num, 0);
  19283. return buffer;
  19284. }
  19285. module.exports = {
  19286. cache: cache,
  19287. generateCache: generateCache,
  19288. generateNumber: generateBuffer,
  19289. genBufVariableByteInt: genBufVariableByteInt,
  19290. generate4ByteBuffer: generate4ByteBuffer
  19291. };
  19292. }, {
  19293. "safe-buffer": 110
  19294. }],
  19295. 87: [function (require, module, exports) {
  19296. function Packet() {
  19297. this.cmd = null;
  19298. this.retain = false;
  19299. this.qos = 0;
  19300. this.dup = false;
  19301. this.length = -1;
  19302. this.topic = null;
  19303. this.payload = null;
  19304. }
  19305. module.exports = Packet;
  19306. }, {}],
  19307. 88: [function (require, module, exports) {
  19308. "use strict";
  19309. var bl = require("bl");
  19310. var inherits = require("inherits");
  19311. var EE = require("events").EventEmitter;
  19312. var Packet = require("./packet");
  19313. var constants = require("./constants");
  19314. function Parser(opt) {
  19315. if (!(this instanceof Parser)) return new Parser(opt);
  19316. this.settings = opt || {};
  19317. this._states = ["_parseHeader", "_parseLength", "_parsePayload", "_newPacket"];
  19318. this._resetState();
  19319. }
  19320. inherits(Parser, EE);
  19321. Parser.prototype._resetState = function () {
  19322. this.packet = new Packet();
  19323. this.error = null;
  19324. this._list = bl();
  19325. this._stateCounter = 0;
  19326. };
  19327. Parser.prototype.parse = function (buf) {
  19328. if (this.error) this._resetState();
  19329. this._list.append(buf);
  19330. while ((this.packet.length !== -1 || this._list.length > 0) && this[this._states[this._stateCounter]]() && !this.error) {
  19331. this._stateCounter++;
  19332. if (this._stateCounter >= this._states.length) this._stateCounter = 0;
  19333. }
  19334. return this._list.length;
  19335. };
  19336. Parser.prototype._parseHeader = function () {
  19337. var zero = this._list.readUInt8(0);
  19338. this.packet.cmd = constants.types[zero >> constants.CMD_SHIFT];
  19339. this.packet.retain = (zero & constants.RETAIN_MASK) !== 0;
  19340. this.packet.qos = zero >> constants.QOS_SHIFT & constants.QOS_MASK;
  19341. this.packet.dup = (zero & constants.DUP_MASK) !== 0;
  19342. this._list.consume(1);
  19343. return true;
  19344. };
  19345. Parser.prototype._parseLength = function () {
  19346. var result = this._parseVarByteNum(true);
  19347. if (result) {
  19348. this.packet.length = result.value;
  19349. this._list.consume(result.bytes);
  19350. }
  19351. return !!result;
  19352. };
  19353. Parser.prototype._parsePayload = function () {
  19354. var result = false;
  19355. if (this.packet.length === 0 || this._list.length >= this.packet.length) {
  19356. this._pos = 0;
  19357. switch (this.packet.cmd) {
  19358. case "connect":
  19359. this._parseConnect();
  19360. break;
  19361. case "connack":
  19362. this._parseConnack();
  19363. break;
  19364. case "publish":
  19365. this._parsePublish();
  19366. break;
  19367. case "puback":
  19368. case "pubrec":
  19369. case "pubrel":
  19370. case "pubcomp":
  19371. this._parseConfirmation();
  19372. break;
  19373. case "subscribe":
  19374. this._parseSubscribe();
  19375. break;
  19376. case "suback":
  19377. this._parseSuback();
  19378. break;
  19379. case "unsubscribe":
  19380. this._parseUnsubscribe();
  19381. break;
  19382. case "unsuback":
  19383. this._parseUnsuback();
  19384. break;
  19385. case "pingreq":
  19386. case "pingresp":
  19387. break;
  19388. case "disconnect":
  19389. this._parseDisconnect();
  19390. break;
  19391. case "auth":
  19392. this._parseAuth();
  19393. break;
  19394. default:
  19395. this._emitError(new Error("Not supported"));
  19396. }
  19397. result = true;
  19398. }
  19399. return result;
  19400. };
  19401. Parser.prototype._parseConnect = function () {
  19402. var protocolId;
  19403. var clientId;
  19404. var topic;
  19405. var payload;
  19406. var password;
  19407. var username;
  19408. var flags = {};
  19409. var packet = this.packet;
  19410. protocolId = this._parseString();
  19411. if (protocolId === null) return this._emitError(new Error("Cannot parse protocolId"));
  19412. if (protocolId !== "MQTT" && protocolId !== "MQIsdp") {
  19413. return this._emitError(new Error("Invalid protocolId"));
  19414. }
  19415. packet.protocolId = protocolId;
  19416. if (this._pos >= this._list.length) return this._emitError(new Error("Packet too short"));
  19417. packet.protocolVersion = this._list.readUInt8(this._pos);
  19418. if (packet.protocolVersion !== 3 && packet.protocolVersion !== 4 && packet.protocolVersion !== 5) {
  19419. return this._emitError(new Error("Invalid protocol version"));
  19420. }
  19421. this._pos++;
  19422. if (this._pos >= this._list.length) {
  19423. return this._emitError(new Error("Packet too short"));
  19424. }
  19425. flags.username = this._list.readUInt8(this._pos) & constants.USERNAME_MASK;
  19426. flags.password = this._list.readUInt8(this._pos) & constants.PASSWORD_MASK;
  19427. flags.will = this._list.readUInt8(this._pos) & constants.WILL_FLAG_MASK;
  19428. if (flags.will) {
  19429. packet.will = {};
  19430. packet.will.retain = (this._list.readUInt8(this._pos) & constants.WILL_RETAIN_MASK) !== 0;
  19431. packet.will.qos = (this._list.readUInt8(this._pos) & constants.WILL_QOS_MASK) >> constants.WILL_QOS_SHIFT;
  19432. }
  19433. packet.clean = (this._list.readUInt8(this._pos) & constants.CLEAN_SESSION_MASK) !== 0;
  19434. this._pos++;
  19435. packet.keepalive = this._parseNum();
  19436. if (packet.keepalive === -1) return this._emitError(new Error("Packet too short"));
  19437. if (packet.protocolVersion === 5) {
  19438. var properties = this._parseProperties();
  19439. if (Object.getOwnPropertyNames(properties).length) {
  19440. packet.properties = properties;
  19441. }
  19442. }
  19443. clientId = this._parseString();
  19444. if (clientId === null) return this._emitError(new Error("Packet too short"));
  19445. packet.clientId = clientId;
  19446. if (flags.will) {
  19447. if (packet.protocolVersion === 5) {
  19448. var willProperties = this._parseProperties();
  19449. if (Object.getOwnPropertyNames(willProperties).length) {
  19450. packet.will.properties = willProperties;
  19451. }
  19452. }
  19453. topic = this._parseString();
  19454. if (topic === null) return this._emitError(new Error("Cannot parse will topic"));
  19455. packet.will.topic = topic;
  19456. payload = this._parseBuffer();
  19457. if (payload === null) return this._emitError(new Error("Cannot parse will payload"));
  19458. packet.will.payload = payload;
  19459. }
  19460. if (flags.username) {
  19461. username = this._parseString();
  19462. if (username === null) return this._emitError(new Error("Cannot parse username"));
  19463. packet.username = username;
  19464. }
  19465. if (flags.password) {
  19466. password = this._parseBuffer();
  19467. if (password === null) return this._emitError(new Error("Cannot parse password"));
  19468. packet.password = password;
  19469. }
  19470. this.settings = packet;
  19471. return packet;
  19472. };
  19473. Parser.prototype._parseConnack = function () {
  19474. var packet = this.packet;
  19475. if (this._list.length < 2) return null;
  19476. packet.sessionPresent = !!(this._list.readUInt8(this._pos++) & constants.SESSIONPRESENT_MASK);
  19477. if (this.settings.protocolVersion === 5) {
  19478. packet.reasonCode = this._list.readUInt8(this._pos++);
  19479. } else {
  19480. packet.returnCode = this._list.readUInt8(this._pos++);
  19481. }
  19482. if (packet.returnCode === -1 || packet.reasonCode === -1) return this._emitError(new Error("Cannot parse return code"));
  19483. if (this.settings.protocolVersion === 5) {
  19484. var properties = this._parseProperties();
  19485. if (Object.getOwnPropertyNames(properties).length) {
  19486. packet.properties = properties;
  19487. }
  19488. }
  19489. };
  19490. Parser.prototype._parsePublish = function () {
  19491. var packet = this.packet;
  19492. packet.topic = this._parseString();
  19493. if (packet.topic === null) return this._emitError(new Error("Cannot parse topic"));
  19494. if (packet.qos > 0) if (!this._parseMessageId()) {
  19495. return;
  19496. }
  19497. if (this.settings.protocolVersion === 5) {
  19498. var properties = this._parseProperties();
  19499. if (Object.getOwnPropertyNames(properties).length) {
  19500. packet.properties = properties;
  19501. }
  19502. }
  19503. packet.payload = this._list.slice(this._pos, packet.length);
  19504. };
  19505. Parser.prototype._parseSubscribe = function () {
  19506. var packet = this.packet;
  19507. var topic;
  19508. var options;
  19509. var qos;
  19510. var rh;
  19511. var rap;
  19512. var nl;
  19513. var subscription;
  19514. if (packet.qos !== 1) {
  19515. return this._emitError(new Error("Wrong subscribe header"));
  19516. }
  19517. packet.subscriptions = [];
  19518. if (!this._parseMessageId()) {
  19519. return;
  19520. }
  19521. if (this.settings.protocolVersion === 5) {
  19522. var properties = this._parseProperties();
  19523. if (Object.getOwnPropertyNames(properties).length) {
  19524. packet.properties = properties;
  19525. }
  19526. }
  19527. while (this._pos < packet.length) {
  19528. topic = this._parseString();
  19529. if (topic === null) return this._emitError(new Error("Cannot parse topic"));
  19530. options = this._parseByte();
  19531. qos = options & constants.SUBSCRIBE_OPTIONS_QOS_MASK;
  19532. nl = (options >> constants.SUBSCRIBE_OPTIONS_NL_SHIFT & constants.SUBSCRIBE_OPTIONS_NL_MASK) !== 0;
  19533. rap = (options >> constants.SUBSCRIBE_OPTIONS_RAP_SHIFT & constants.SUBSCRIBE_OPTIONS_RAP_MASK) !== 0;
  19534. rh = options >> constants.SUBSCRIBE_OPTIONS_RH_SHIFT & constants.SUBSCRIBE_OPTIONS_RH_MASK;
  19535. subscription = {
  19536. topic: topic,
  19537. qos: qos
  19538. };
  19539. if (this.settings.protocolVersion === 5) {
  19540. subscription.nl = nl;
  19541. subscription.rap = rap;
  19542. subscription.rh = rh;
  19543. }
  19544. packet.subscriptions.push(subscription);
  19545. }
  19546. };
  19547. Parser.prototype._parseSuback = function () {
  19548. var packet = this.packet;
  19549. this.packet.granted = [];
  19550. if (!this._parseMessageId()) {
  19551. return;
  19552. }
  19553. if (this.settings.protocolVersion === 5) {
  19554. var properties = this._parseProperties();
  19555. if (Object.getOwnPropertyNames(properties).length) {
  19556. packet.properties = properties;
  19557. }
  19558. }
  19559. while (this._pos < this.packet.length) {
  19560. this.packet.granted.push(this._list.readUInt8(this._pos++));
  19561. }
  19562. };
  19563. Parser.prototype._parseUnsubscribe = function () {
  19564. var packet = this.packet;
  19565. packet.unsubscriptions = [];
  19566. if (!this._parseMessageId()) {
  19567. return;
  19568. }
  19569. if (this.settings.protocolVersion === 5) {
  19570. var properties = this._parseProperties();
  19571. if (Object.getOwnPropertyNames(properties).length) {
  19572. packet.properties = properties;
  19573. }
  19574. }
  19575. while (this._pos < packet.length) {
  19576. var topic;
  19577. topic = this._parseString();
  19578. if (topic === null) return this._emitError(new Error("Cannot parse topic"));
  19579. packet.unsubscriptions.push(topic);
  19580. }
  19581. };
  19582. Parser.prototype._parseUnsuback = function () {
  19583. var packet = this.packet;
  19584. if (!this._parseMessageId()) return this._emitError(new Error("Cannot parse messageId"));
  19585. if (this.settings.protocolVersion === 5) {
  19586. var properties = this._parseProperties();
  19587. if (Object.getOwnPropertyNames(properties).length) {
  19588. packet.properties = properties;
  19589. }
  19590. packet.granted = [];
  19591. while (this._pos < this.packet.length) {
  19592. this.packet.granted.push(this._list.readUInt8(this._pos++));
  19593. }
  19594. }
  19595. };
  19596. Parser.prototype._parseConfirmation = function () {
  19597. var packet = this.packet;
  19598. this._parseMessageId();
  19599. if (this.settings.protocolVersion === 5) {
  19600. if (packet.length > 2) {
  19601. packet.reasonCode = this._parseByte();
  19602. var properties = this._parseProperties();
  19603. if (Object.getOwnPropertyNames(properties).length) {
  19604. packet.properties = properties;
  19605. }
  19606. }
  19607. }
  19608. return true;
  19609. };
  19610. Parser.prototype._parseDisconnect = function () {
  19611. var packet = this.packet;
  19612. if (this.settings.protocolVersion === 5) {
  19613. packet.reasonCode = this._parseByte();
  19614. var properties = this._parseProperties();
  19615. if (Object.getOwnPropertyNames(properties).length) {
  19616. packet.properties = properties;
  19617. }
  19618. }
  19619. return true;
  19620. };
  19621. Parser.prototype._parseAuth = function () {
  19622. var packet = this.packet;
  19623. if (this.settings.protocolVersion !== 5) {
  19624. return this._emitError(new Error("Not supported auth packet for this version MQTT"));
  19625. }
  19626. packet.reasonCode = this._parseByte();
  19627. var properties = this._parseProperties();
  19628. if (Object.getOwnPropertyNames(properties).length) {
  19629. packet.properties = properties;
  19630. }
  19631. return true;
  19632. };
  19633. Parser.prototype._parseMessageId = function () {
  19634. var packet = this.packet;
  19635. packet.messageId = this._parseNum();
  19636. if (packet.messageId === null) {
  19637. this._emitError(new Error("Cannot parse messageId"));
  19638. return false;
  19639. }
  19640. return true;
  19641. };
  19642. Parser.prototype._parseString = function (maybeBuffer) {
  19643. var length = this._parseNum();
  19644. var result;
  19645. var end = length + this._pos;
  19646. if (length === -1 || end > this._list.length || end > this.packet.length) return null;
  19647. result = this._list.toString("utf8", this._pos, end);
  19648. this._pos += length;
  19649. return result;
  19650. };
  19651. Parser.prototype._parseStringPair = function () {
  19652. return {
  19653. name: this._parseString(),
  19654. value: this._parseString()
  19655. };
  19656. };
  19657. Parser.prototype._parseBuffer = function () {
  19658. var length = this._parseNum();
  19659. var result;
  19660. var end = length + this._pos;
  19661. if (length === -1 || end > this._list.length || end > this.packet.length) return null;
  19662. result = this._list.slice(this._pos, end);
  19663. this._pos += length;
  19664. return result;
  19665. };
  19666. Parser.prototype._parseNum = function () {
  19667. if (this._list.length - this._pos < 2) return -1;
  19668. var result = this._list.readUInt16BE(this._pos);
  19669. this._pos += 2;
  19670. return result;
  19671. };
  19672. Parser.prototype._parse4ByteNum = function () {
  19673. if (this._list.length - this._pos < 4) return -1;
  19674. var result = this._list.readUInt32BE(this._pos);
  19675. this._pos += 4;
  19676. return result;
  19677. };
  19678. Parser.prototype._parseVarByteNum = function (fullInfoFlag) {
  19679. var bytes = 0;
  19680. var mul = 1;
  19681. var length = 0;
  19682. var result = true;
  19683. var current;
  19684. var padding = this._pos ? this._pos : 0;
  19685. while (bytes < 5) {
  19686. current = this._list.readUInt8(padding + bytes++);
  19687. length += mul * (current & constants.LENGTH_MASK);
  19688. mul *= 128;
  19689. if ((current & constants.LENGTH_FIN_MASK) === 0) break;
  19690. if (this._list.length <= bytes) {
  19691. result = false;
  19692. break;
  19693. }
  19694. }
  19695. if (padding) {
  19696. this._pos += bytes;
  19697. }
  19698. result = result ? fullInfoFlag ? {
  19699. bytes: bytes,
  19700. value: length
  19701. } : length : false;
  19702. return result;
  19703. };
  19704. Parser.prototype._parseByte = function () {
  19705. var result = this._list.readUInt8(this._pos);
  19706. this._pos++;
  19707. return result;
  19708. };
  19709. Parser.prototype._parseByType = function (type) {
  19710. switch (type) {
  19711. case "byte":
  19712. {
  19713. return this._parseByte() !== 0;
  19714. }
  19715. case "int8":
  19716. {
  19717. return this._parseByte();
  19718. }
  19719. case "int16":
  19720. {
  19721. return this._parseNum();
  19722. }
  19723. case "int32":
  19724. {
  19725. return this._parse4ByteNum();
  19726. }
  19727. case "var":
  19728. {
  19729. return this._parseVarByteNum();
  19730. }
  19731. case "string":
  19732. {
  19733. return this._parseString();
  19734. }
  19735. case "pair":
  19736. {
  19737. return this._parseStringPair();
  19738. }
  19739. case "binary":
  19740. {
  19741. return this._parseBuffer();
  19742. }
  19743. }
  19744. };
  19745. Parser.prototype._parseProperties = function () {
  19746. var length = this._parseVarByteNum();
  19747. var start = this._pos;
  19748. var end = start + length;
  19749. var result = {};
  19750. while (this._pos < end) {
  19751. var type = this._parseByte();
  19752. var name = constants.propertiesCodes[type];
  19753. if (!name) {
  19754. this._emitError(new Error("Unknown property"));
  19755. return false;
  19756. }
  19757. if (name === "userProperties") {
  19758. if (!result[name]) {
  19759. result[name] = {};
  19760. }
  19761. var currentUserProperty = this._parseByType(constants.propertiesTypes[name]);
  19762. result[name][currentUserProperty.name] = currentUserProperty.value;
  19763. continue;
  19764. }
  19765. result[name] = this._parseByType(constants.propertiesTypes[name]);
  19766. }
  19767. return result;
  19768. };
  19769. Parser.prototype._newPacket = function () {
  19770. if (this.packet) {
  19771. this._list.consume(this.packet.length);
  19772. this.emit("packet", this.packet);
  19773. }
  19774. this.packet = new Packet();
  19775. this._pos = 0;
  19776. return true;
  19777. };
  19778. Parser.prototype._emitError = function (err) {
  19779. this.error = err;
  19780. this.emit("error", err);
  19781. };
  19782. module.exports = Parser;
  19783. }, {
  19784. "./constants": 82,
  19785. "./packet": 87,
  19786. bl: 85,
  19787. events: 13,
  19788. inherits: 80
  19789. }],
  19790. 89: [function (require, module, exports) {
  19791. "use strict";
  19792. var protocol = require("./constants");
  19793. var Buffer = require("safe-buffer").Buffer;
  19794. var empty = Buffer.allocUnsafe(0);
  19795. var zeroBuf = Buffer.from([0]);
  19796. var numbers = require("./numbers");
  19797. var nextTick = require("process-nextick-args").nextTick;
  19798. var numCache = numbers.cache;
  19799. var generateNumber = numbers.generateNumber;
  19800. var generateCache = numbers.generateCache;
  19801. var genBufVariableByteInt = numbers.genBufVariableByteInt;
  19802. var generate4ByteBuffer = numbers.generate4ByteBuffer;
  19803. var writeNumber = writeNumberCached;
  19804. var toGenerate = true;
  19805. function generate(packet, stream, opts) {
  19806. if (stream.cork) {
  19807. stream.cork();
  19808. nextTick(uncork, stream);
  19809. }
  19810. if (toGenerate) {
  19811. toGenerate = false;
  19812. generateCache();
  19813. }
  19814. switch (packet.cmd) {
  19815. case "connect":
  19816. return connect(packet, stream, opts);
  19817. case "connack":
  19818. return connack(packet, stream, opts);
  19819. case "publish":
  19820. return publish(packet, stream, opts);
  19821. case "puback":
  19822. case "pubrec":
  19823. case "pubrel":
  19824. case "pubcomp":
  19825. return confirmation(packet, stream, opts);
  19826. case "subscribe":
  19827. return subscribe(packet, stream, opts);
  19828. case "suback":
  19829. return suback(packet, stream, opts);
  19830. case "unsubscribe":
  19831. return unsubscribe(packet, stream, opts);
  19832. case "unsuback":
  19833. return unsuback(packet, stream, opts);
  19834. case "pingreq":
  19835. case "pingresp":
  19836. return emptyPacket(packet, stream, opts);
  19837. case "disconnect":
  19838. return disconnect(packet, stream, opts);
  19839. case "auth":
  19840. return auth(packet, stream, opts);
  19841. default:
  19842. stream.emit("error", new Error("Unknown command"));
  19843. return false;
  19844. }
  19845. }
  19846. Object.defineProperty(generate, "cacheNumbers", {
  19847. get: function get() {
  19848. return writeNumber === writeNumberCached;
  19849. },
  19850. set: function set(value) {
  19851. if (value) {
  19852. if (!numCache || Object.keys(numCache).length === 0) toGenerate = true;
  19853. writeNumber = writeNumberCached;
  19854. } else {
  19855. toGenerate = false;
  19856. writeNumber = writeNumberGenerated;
  19857. }
  19858. }
  19859. });
  19860. function uncork(stream) {
  19861. stream.uncork();
  19862. }
  19863. function connect(packet, stream, opts) {
  19864. var settings = packet || {};
  19865. var protocolId = settings.protocolId || "MQTT";
  19866. var protocolVersion = settings.protocolVersion || 4;
  19867. var will = settings.will;
  19868. var clean = settings.clean;
  19869. var keepalive = settings.keepalive || 0;
  19870. var clientId = settings.clientId || "";
  19871. var username = settings.username;
  19872. var password = settings.password;
  19873. var properties = settings.properties;
  19874. if (clean === undefined) clean = true;
  19875. var length = 0;
  19876. if (!protocolId || typeof protocolId !== "string" && !Buffer.isBuffer(protocolId)) {
  19877. stream.emit("error", new Error("Invalid protocolId"));
  19878. return false;
  19879. } else length += protocolId.length + 2;
  19880. if (protocolVersion !== 3 && protocolVersion !== 4 && protocolVersion !== 5) {
  19881. stream.emit("error", new Error("Invalid protocol version"));
  19882. return false;
  19883. } else length += 1;
  19884. if ((typeof clientId === "string" || Buffer.isBuffer(clientId)) && (clientId || protocolVersion === 4) && (clientId || clean)) {
  19885. length += clientId.length + 2;
  19886. } else {
  19887. if (protocolVersion < 4) {
  19888. stream.emit("error", new Error("clientId must be supplied before 3.1.1"));
  19889. return false;
  19890. }
  19891. if (clean * 1 === 0) {
  19892. stream.emit("error", new Error("clientId must be given if cleanSession set to 0"));
  19893. return false;
  19894. }
  19895. }
  19896. if (typeof keepalive !== "number" || keepalive < 0 || keepalive > 65535 || keepalive % 1 !== 0) {
  19897. stream.emit("error", new Error("Invalid keepalive"));
  19898. return false;
  19899. } else length += 2;
  19900. length += 1;
  19901. if (protocolVersion === 5) {
  19902. var propertiesData = getProperties(stream, properties);
  19903. length += propertiesData.length;
  19904. }
  19905. if (will) {
  19906. if (_typeof(will) !== "object") {
  19907. stream.emit("error", new Error("Invalid will"));
  19908. return false;
  19909. }
  19910. if (!will.topic || typeof will.topic !== "string") {
  19911. stream.emit("error", new Error("Invalid will topic"));
  19912. return false;
  19913. } else {
  19914. length += Buffer.byteLength(will.topic) + 2;
  19915. }
  19916. if (will.payload) {
  19917. if (will.payload.length >= 0) {
  19918. if (typeof will.payload === "string") {
  19919. length += Buffer.byteLength(will.payload) + 2;
  19920. } else {
  19921. length += will.payload.length + 2;
  19922. }
  19923. } else {
  19924. stream.emit("error", new Error("Invalid will payload"));
  19925. return false;
  19926. }
  19927. var willProperties = {};
  19928. if (protocolVersion === 5) {
  19929. willProperties = getProperties(stream, will.properties);
  19930. length += willProperties.length;
  19931. }
  19932. }
  19933. }
  19934. var providedUsername = false;
  19935. if (username != null) {
  19936. if (isStringOrBuffer(username)) {
  19937. providedUsername = true;
  19938. length += Buffer.byteLength(username) + 2;
  19939. } else {
  19940. stream.emit("error", new Error("Invalid username"));
  19941. return false;
  19942. }
  19943. }
  19944. if (password != null) {
  19945. if (!providedUsername) {
  19946. stream.emit("error", new Error("Username is required to use password"));
  19947. return false;
  19948. }
  19949. if (isStringOrBuffer(password)) {
  19950. length += byteLength(password) + 2;
  19951. } else {
  19952. stream.emit("error", new Error("Invalid password"));
  19953. return false;
  19954. }
  19955. }
  19956. stream.write(protocol.CONNECT_HEADER);
  19957. writeVarByteInt(stream, length);
  19958. writeStringOrBuffer(stream, protocolId);
  19959. stream.write(protocolVersion === 4 ? protocol.VERSION4 : protocolVersion === 5 ? protocol.VERSION5 : protocol.VERSION3);
  19960. var flags = 0;
  19961. flags |= username != null ? protocol.USERNAME_MASK : 0;
  19962. flags |= password != null ? protocol.PASSWORD_MASK : 0;
  19963. flags |= will && will.retain ? protocol.WILL_RETAIN_MASK : 0;
  19964. flags |= will && will.qos ? will.qos << protocol.WILL_QOS_SHIFT : 0;
  19965. flags |= will ? protocol.WILL_FLAG_MASK : 0;
  19966. flags |= clean ? protocol.CLEAN_SESSION_MASK : 0;
  19967. stream.write(Buffer.from([flags]));
  19968. writeNumber(stream, keepalive);
  19969. if (protocolVersion === 5) {
  19970. propertiesData.write();
  19971. }
  19972. writeStringOrBuffer(stream, clientId);
  19973. if (will) {
  19974. if (protocolVersion === 5) {
  19975. willProperties.write();
  19976. }
  19977. writeString(stream, will.topic);
  19978. writeStringOrBuffer(stream, will.payload);
  19979. }
  19980. if (username != null) {
  19981. writeStringOrBuffer(stream, username);
  19982. }
  19983. if (password != null) {
  19984. writeStringOrBuffer(stream, password);
  19985. }
  19986. return true;
  19987. }
  19988. function connack(packet, stream, opts) {
  19989. var version = opts ? opts.protocolVersion : 4;
  19990. var settings = packet || {};
  19991. var rc = version === 5 ? settings.reasonCode : settings.returnCode;
  19992. var properties = settings.properties;
  19993. var length = 2;
  19994. if (typeof rc !== "number") {
  19995. stream.emit("error", new Error("Invalid return code"));
  19996. return false;
  19997. }
  19998. var propertiesData = null;
  19999. if (version === 5) {
  20000. propertiesData = getProperties(stream, properties);
  20001. length += propertiesData.length;
  20002. }
  20003. stream.write(protocol.CONNACK_HEADER);
  20004. writeVarByteInt(stream, length);
  20005. stream.write(settings.sessionPresent ? protocol.SESSIONPRESENT_HEADER : zeroBuf);
  20006. stream.write(Buffer.from([rc]));
  20007. if (propertiesData != null) {
  20008. propertiesData.write();
  20009. }
  20010. return true;
  20011. }
  20012. function publish(packet, stream, opts) {
  20013. var version = opts ? opts.protocolVersion : 4;
  20014. var settings = packet || {};
  20015. var qos = settings.qos || 0;
  20016. var retain = settings.retain ? protocol.RETAIN_MASK : 0;
  20017. var topic = settings.topic;
  20018. var payload = settings.payload || empty;
  20019. var id = settings.messageId;
  20020. var properties = settings.properties;
  20021. var length = 0;
  20022. if (typeof topic === "string") length += Buffer.byteLength(topic) + 2;else if (Buffer.isBuffer(topic)) length += topic.length + 2;else {
  20023. stream.emit("error", new Error("Invalid topic"));
  20024. return false;
  20025. }
  20026. if (!Buffer.isBuffer(payload)) length += Buffer.byteLength(payload);else length += payload.length;
  20027. if (qos && typeof id !== "number") {
  20028. stream.emit("error", new Error("Invalid messageId"));
  20029. return false;
  20030. } else if (qos) length += 2;
  20031. var propertiesData = null;
  20032. if (version === 5) {
  20033. propertiesData = getProperties(stream, properties);
  20034. length += propertiesData.length;
  20035. }
  20036. stream.write(protocol.PUBLISH_HEADER[qos][settings.dup ? 1 : 0][retain ? 1 : 0]);
  20037. writeVarByteInt(stream, length);
  20038. writeNumber(stream, byteLength(topic));
  20039. stream.write(topic);
  20040. if (qos > 0) writeNumber(stream, id);
  20041. if (propertiesData != null) {
  20042. propertiesData.write();
  20043. }
  20044. return stream.write(payload);
  20045. }
  20046. function confirmation(packet, stream, opts) {
  20047. var version = opts ? opts.protocolVersion : 4;
  20048. var settings = packet || {};
  20049. var type = settings.cmd || "puback";
  20050. var id = settings.messageId;
  20051. var dup = settings.dup && type === "pubrel" ? protocol.DUP_MASK : 0;
  20052. var qos = 0;
  20053. var reasonCode = settings.reasonCode;
  20054. var properties = settings.properties;
  20055. var length = version === 5 ? 3 : 2;
  20056. if (type === "pubrel") qos = 1;
  20057. if (typeof id !== "number") {
  20058. stream.emit("error", new Error("Invalid messageId"));
  20059. return false;
  20060. }
  20061. var propertiesData = null;
  20062. if (version === 5) {
  20063. propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
  20064. if (!propertiesData) {
  20065. return false;
  20066. }
  20067. length += propertiesData.length;
  20068. }
  20069. stream.write(protocol.ACKS[type][qos][dup][0]);
  20070. writeVarByteInt(stream, length);
  20071. writeNumber(stream, id);
  20072. if (version === 5) {
  20073. stream.write(Buffer.from([reasonCode]));
  20074. }
  20075. if (propertiesData !== null) {
  20076. propertiesData.write();
  20077. }
  20078. return true;
  20079. }
  20080. function subscribe(packet, stream, opts) {
  20081. var version = opts ? opts.protocolVersion : 4;
  20082. var settings = packet || {};
  20083. var dup = settings.dup ? protocol.DUP_MASK : 0;
  20084. var id = settings.messageId;
  20085. var subs = settings.subscriptions;
  20086. var properties = settings.properties;
  20087. var length = 0;
  20088. if (typeof id !== "number") {
  20089. stream.emit("error", new Error("Invalid messageId"));
  20090. return false;
  20091. } else length += 2;
  20092. var propertiesData = null;
  20093. if (version === 5) {
  20094. propertiesData = getProperties(stream, properties);
  20095. length += propertiesData.length;
  20096. }
  20097. if (_typeof(subs) === "object" && subs.length) {
  20098. for (var i = 0; i < subs.length; i += 1) {
  20099. var itopic = subs[i].topic;
  20100. var iqos = subs[i].qos;
  20101. if (typeof itopic !== "string") {
  20102. stream.emit("error", new Error("Invalid subscriptions - invalid topic"));
  20103. return false;
  20104. }
  20105. if (typeof iqos !== "number") {
  20106. stream.emit("error", new Error("Invalid subscriptions - invalid qos"));
  20107. return false;
  20108. }
  20109. if (version === 5) {
  20110. var nl = subs[i].nl || false;
  20111. if (typeof nl !== "boolean") {
  20112. stream.emit("error", new Error("Invalid subscriptions - invalid No Local"));
  20113. return false;
  20114. }
  20115. var rap = subs[i].rap || false;
  20116. if (typeof rap !== "boolean") {
  20117. stream.emit("error", new Error("Invalid subscriptions - invalid Retain as Published"));
  20118. return false;
  20119. }
  20120. var rh = subs[i].rh || 0;
  20121. if (typeof rh !== "number" || rh > 2) {
  20122. stream.emit("error", new Error("Invalid subscriptions - invalid Retain Handling"));
  20123. return false;
  20124. }
  20125. }
  20126. length += Buffer.byteLength(itopic) + 2 + 1;
  20127. }
  20128. } else {
  20129. stream.emit("error", new Error("Invalid subscriptions"));
  20130. return false;
  20131. }
  20132. stream.write(protocol.SUBSCRIBE_HEADER[1][dup ? 1 : 0][0]);
  20133. writeVarByteInt(stream, length);
  20134. writeNumber(stream, id);
  20135. if (propertiesData !== null) {
  20136. propertiesData.write();
  20137. }
  20138. var result = true;
  20139. for (var j = 0; j < subs.length; j++) {
  20140. var sub = subs[j];
  20141. var jtopic = sub.topic;
  20142. var jqos = sub.qos;
  20143. var jnl = +sub.nl;
  20144. var jrap = +sub.rap;
  20145. var jrh = sub.rh;
  20146. var joptions;
  20147. writeString(stream, jtopic);
  20148. joptions = protocol.SUBSCRIBE_OPTIONS_QOS[jqos];
  20149. if (version === 5) {
  20150. joptions |= jnl ? protocol.SUBSCRIBE_OPTIONS_NL : 0;
  20151. joptions |= jrap ? protocol.SUBSCRIBE_OPTIONS_RAP : 0;
  20152. joptions |= jrh ? protocol.SUBSCRIBE_OPTIONS_RH[jrh] : 0;
  20153. }
  20154. result = stream.write(Buffer.from([joptions]));
  20155. }
  20156. return result;
  20157. }
  20158. function suback(packet, stream, opts) {
  20159. var version = opts ? opts.protocolVersion : 4;
  20160. var settings = packet || {};
  20161. var id = settings.messageId;
  20162. var granted = settings.granted;
  20163. var properties = settings.properties;
  20164. var length = 0;
  20165. if (typeof id !== "number") {
  20166. stream.emit("error", new Error("Invalid messageId"));
  20167. return false;
  20168. } else length += 2;
  20169. if (_typeof(granted) === "object" && granted.length) {
  20170. for (var i = 0; i < granted.length; i += 1) {
  20171. if (typeof granted[i] !== "number") {
  20172. stream.emit("error", new Error("Invalid qos vector"));
  20173. return false;
  20174. }
  20175. length += 1;
  20176. }
  20177. } else {
  20178. stream.emit("error", new Error("Invalid qos vector"));
  20179. return false;
  20180. }
  20181. var propertiesData = null;
  20182. if (version === 5) {
  20183. propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
  20184. if (!propertiesData) {
  20185. return false;
  20186. }
  20187. length += propertiesData.length;
  20188. }
  20189. stream.write(protocol.SUBACK_HEADER);
  20190. writeVarByteInt(stream, length);
  20191. writeNumber(stream, id);
  20192. if (propertiesData !== null) {
  20193. propertiesData.write();
  20194. }
  20195. return stream.write(Buffer.from(granted));
  20196. }
  20197. function unsubscribe(packet, stream, opts) {
  20198. var version = opts ? opts.protocolVersion : 4;
  20199. var settings = packet || {};
  20200. var id = settings.messageId;
  20201. var dup = settings.dup ? protocol.DUP_MASK : 0;
  20202. var unsubs = settings.unsubscriptions;
  20203. var properties = settings.properties;
  20204. var length = 0;
  20205. if (typeof id !== "number") {
  20206. stream.emit("error", new Error("Invalid messageId"));
  20207. return false;
  20208. } else {
  20209. length += 2;
  20210. }
  20211. if (_typeof(unsubs) === "object" && unsubs.length) {
  20212. for (var i = 0; i < unsubs.length; i += 1) {
  20213. if (typeof unsubs[i] !== "string") {
  20214. stream.emit("error", new Error("Invalid unsubscriptions"));
  20215. return false;
  20216. }
  20217. length += Buffer.byteLength(unsubs[i]) + 2;
  20218. }
  20219. } else {
  20220. stream.emit("error", new Error("Invalid unsubscriptions"));
  20221. return false;
  20222. }
  20223. var propertiesData = null;
  20224. if (version === 5) {
  20225. propertiesData = getProperties(stream, properties);
  20226. length += propertiesData.length;
  20227. }
  20228. stream.write(protocol.UNSUBSCRIBE_HEADER[1][dup ? 1 : 0][0]);
  20229. writeVarByteInt(stream, length);
  20230. writeNumber(stream, id);
  20231. if (propertiesData !== null) {
  20232. propertiesData.write();
  20233. }
  20234. var result = true;
  20235. for (var j = 0; j < unsubs.length; j++) {
  20236. result = writeString(stream, unsubs[j]);
  20237. }
  20238. return result;
  20239. }
  20240. function unsuback(packet, stream, opts) {
  20241. var version = opts ? opts.protocolVersion : 4;
  20242. var settings = packet || {};
  20243. var id = settings.messageId;
  20244. var dup = settings.dup ? protocol.DUP_MASK : 0;
  20245. var granted = settings.granted;
  20246. var properties = settings.properties;
  20247. var type = settings.cmd;
  20248. var qos = 0;
  20249. var length = 2;
  20250. if (typeof id !== "number") {
  20251. stream.emit("error", new Error("Invalid messageId"));
  20252. return false;
  20253. }
  20254. if (version === 5) {
  20255. if (_typeof(granted) === "object" && granted.length) {
  20256. for (var i = 0; i < granted.length; i += 1) {
  20257. if (typeof granted[i] !== "number") {
  20258. stream.emit("error", new Error("Invalid qos vector"));
  20259. return false;
  20260. }
  20261. length += 1;
  20262. }
  20263. } else {
  20264. stream.emit("error", new Error("Invalid qos vector"));
  20265. return false;
  20266. }
  20267. }
  20268. var propertiesData = null;
  20269. if (version === 5) {
  20270. propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
  20271. if (!propertiesData) {
  20272. return false;
  20273. }
  20274. length += propertiesData.length;
  20275. }
  20276. stream.write(protocol.ACKS[type][qos][dup][0]);
  20277. writeVarByteInt(stream, length);
  20278. writeNumber(stream, id);
  20279. if (propertiesData !== null) {
  20280. propertiesData.write();
  20281. }
  20282. if (version === 5) {
  20283. stream.write(Buffer.from(granted));
  20284. }
  20285. return true;
  20286. }
  20287. function emptyPacket(packet, stream, opts) {
  20288. return stream.write(protocol.EMPTY[packet.cmd]);
  20289. }
  20290. function disconnect(packet, stream, opts) {
  20291. var version = opts ? opts.protocolVersion : 4;
  20292. var settings = packet || {};
  20293. var reasonCode = settings.reasonCode;
  20294. var properties = settings.properties;
  20295. var length = version === 5 ? 1 : 0;
  20296. var propertiesData = null;
  20297. if (version === 5) {
  20298. propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
  20299. if (!propertiesData) {
  20300. return false;
  20301. }
  20302. length += propertiesData.length;
  20303. }
  20304. stream.write(Buffer.from([protocol.codes["disconnect"] << 4]));
  20305. writeVarByteInt(stream, length);
  20306. if (version === 5) {
  20307. stream.write(Buffer.from([reasonCode]));
  20308. }
  20309. if (propertiesData !== null) {
  20310. propertiesData.write();
  20311. }
  20312. return true;
  20313. }
  20314. function auth(packet, stream, opts) {
  20315. var version = opts ? opts.protocolVersion : 4;
  20316. var settings = packet || {};
  20317. var reasonCode = settings.reasonCode;
  20318. var properties = settings.properties;
  20319. var length = version === 5 ? 1 : 0;
  20320. if (version !== 5) stream.emit("error", new Error("Invalid mqtt version for auth packet"));
  20321. var propertiesData = getPropertiesByMaximumPacketSize(stream, properties, opts, length);
  20322. if (!propertiesData) {
  20323. return false;
  20324. }
  20325. length += propertiesData.length;
  20326. stream.write(Buffer.from([protocol.codes["auth"] << 4]));
  20327. writeVarByteInt(stream, length);
  20328. stream.write(Buffer.from([reasonCode]));
  20329. if (propertiesData !== null) {
  20330. propertiesData.write();
  20331. }
  20332. return true;
  20333. }
  20334. var varByteIntCache = {};
  20335. function writeVarByteInt(stream, num) {
  20336. var buffer = varByteIntCache[num];
  20337. if (!buffer) {
  20338. buffer = genBufVariableByteInt(num).data;
  20339. if (num < 16384) varByteIntCache[num] = buffer;
  20340. }
  20341. stream.write(buffer);
  20342. }
  20343. function writeString(stream, string) {
  20344. var strlen = Buffer.byteLength(string);
  20345. writeNumber(stream, strlen);
  20346. stream.write(string, "utf8");
  20347. }
  20348. function writeStringPair(stream, name, value) {
  20349. writeString(stream, name);
  20350. writeString(stream, value);
  20351. }
  20352. function writeNumberCached(stream, number) {
  20353. return stream.write(numCache[number]);
  20354. }
  20355. function writeNumberGenerated(stream, number) {
  20356. return stream.write(generateNumber(number));
  20357. }
  20358. function write4ByteNumber(stream, number) {
  20359. return stream.write(generate4ByteBuffer(number));
  20360. }
  20361. function writeStringOrBuffer(stream, toWrite) {
  20362. if (typeof toWrite === "string") {
  20363. writeString(stream, toWrite);
  20364. } else if (toWrite) {
  20365. writeNumber(stream, toWrite.length);
  20366. stream.write(toWrite);
  20367. } else writeNumber(stream, 0);
  20368. }
  20369. function getProperties(stream, properties) {
  20370. if (_typeof(properties) !== "object" || properties.length != null) {
  20371. return {
  20372. length: 1,
  20373. write: function write() {
  20374. writeProperties(stream, {}, 0);
  20375. }
  20376. };
  20377. }
  20378. var propertiesLength = 0;
  20379. function getLengthProperty(name) {
  20380. var type = protocol.propertiesTypes[name];
  20381. var value = properties[name];
  20382. var length = 0;
  20383. switch (type) {
  20384. case "byte":
  20385. {
  20386. if (typeof value !== "boolean") {
  20387. stream.emit("error", new Error("Invalid " + name));
  20388. return false;
  20389. }
  20390. length += 1 + 1;
  20391. break;
  20392. }
  20393. case "int8":
  20394. {
  20395. if (typeof value !== "number") {
  20396. stream.emit("error", new Error("Invalid " + name));
  20397. return false;
  20398. }
  20399. length += 1 + 1;
  20400. break;
  20401. }
  20402. case "binary":
  20403. {
  20404. if (value && value === null) {
  20405. stream.emit("error", new Error("Invalid " + name));
  20406. return false;
  20407. }
  20408. length += 1 + Buffer.byteLength(value) + 2;
  20409. break;
  20410. }
  20411. case "int16":
  20412. {
  20413. if (typeof value !== "number") {
  20414. stream.emit("error", new Error("Invalid " + name));
  20415. return false;
  20416. }
  20417. length += 1 + 2;
  20418. break;
  20419. }
  20420. case "int32":
  20421. {
  20422. if (typeof value !== "number") {
  20423. stream.emit("error", new Error("Invalid " + name));
  20424. return false;
  20425. }
  20426. length += 1 + 4;
  20427. break;
  20428. }
  20429. case "var":
  20430. {
  20431. if (typeof value !== "number") {
  20432. stream.emit("error", new Error("Invalid " + name));
  20433. return false;
  20434. }
  20435. length += 1 + genBufVariableByteInt(value).length;
  20436. break;
  20437. }
  20438. case "string":
  20439. {
  20440. if (typeof value !== "string") {
  20441. stream.emit("error", new Error("Invalid " + name));
  20442. return false;
  20443. }
  20444. length += 1 + 2 + Buffer.byteLength(value.toString());
  20445. break;
  20446. }
  20447. case "pair":
  20448. {
  20449. if (_typeof(value) !== "object") {
  20450. stream.emit("error", new Error("Invalid " + name));
  20451. return false;
  20452. }
  20453. length += Object.getOwnPropertyNames(value).reduce(function (result, name) {
  20454. result += 1 + 2 + Buffer.byteLength(name.toString()) + 2 + Buffer.byteLength(value[name].toString());
  20455. return result;
  20456. }, 0);
  20457. break;
  20458. }
  20459. default:
  20460. {
  20461. stream.emit("error", new Error("Invalid property " + name));
  20462. return false;
  20463. }
  20464. }
  20465. return length;
  20466. }
  20467. if (properties) {
  20468. for (var propName in properties) {
  20469. var propLength = getLengthProperty(propName);
  20470. if (!propLength) return false;
  20471. propertiesLength += propLength;
  20472. }
  20473. }
  20474. var propertiesLengthLength = genBufVariableByteInt(propertiesLength).length;
  20475. return {
  20476. length: propertiesLengthLength + propertiesLength,
  20477. write: function write() {
  20478. writeProperties(stream, properties, propertiesLength);
  20479. }
  20480. };
  20481. }
  20482. function getPropertiesByMaximumPacketSize(stream, properties, opts, length) {
  20483. var mayEmptyProps = ["reasonString", "userProperties"];
  20484. var maximumPacketSize = opts && opts.properties && opts.properties.maximumPacketSize ? opts.properties.maximumPacketSize : 0;
  20485. var propertiesData = getProperties(stream, properties);
  20486. if (maximumPacketSize) {
  20487. while (length + propertiesData.length > maximumPacketSize) {
  20488. var currentMayEmptyProp = mayEmptyProps.shift();
  20489. if (currentMayEmptyProp && properties[currentMayEmptyProp]) {
  20490. delete properties[currentMayEmptyProp];
  20491. propertiesData = getProperties(stream, properties);
  20492. } else {
  20493. return false;
  20494. }
  20495. }
  20496. }
  20497. return propertiesData;
  20498. }
  20499. function writeProperties(stream, properties, propertiesLength) {
  20500. writeVarByteInt(stream, propertiesLength);
  20501. for (var propName in properties) {
  20502. if (properties.hasOwnProperty(propName) && properties[propName] !== null) {
  20503. var value = properties[propName];
  20504. var type = protocol.propertiesTypes[propName];
  20505. switch (type) {
  20506. case "byte":
  20507. {
  20508. stream.write(Buffer.from([protocol.properties[propName]]));
  20509. stream.write(Buffer.from([+value]));
  20510. break;
  20511. }
  20512. case "int8":
  20513. {
  20514. stream.write(Buffer.from([protocol.properties[propName]]));
  20515. stream.write(Buffer.from([value]));
  20516. break;
  20517. }
  20518. case "binary":
  20519. {
  20520. stream.write(Buffer.from([protocol.properties[propName]]));
  20521. writeStringOrBuffer(stream, value);
  20522. break;
  20523. }
  20524. case "int16":
  20525. {
  20526. stream.write(Buffer.from([protocol.properties[propName]]));
  20527. writeNumber(stream, value);
  20528. break;
  20529. }
  20530. case "int32":
  20531. {
  20532. stream.write(Buffer.from([protocol.properties[propName]]));
  20533. write4ByteNumber(stream, value);
  20534. break;
  20535. }
  20536. case "var":
  20537. {
  20538. stream.write(Buffer.from([protocol.properties[propName]]));
  20539. writeVarByteInt(stream, value);
  20540. break;
  20541. }
  20542. case "string":
  20543. {
  20544. stream.write(Buffer.from([protocol.properties[propName]]));
  20545. writeString(stream, value);
  20546. break;
  20547. }
  20548. case "pair":
  20549. {
  20550. Object.getOwnPropertyNames(value).forEach(function (name) {
  20551. stream.write(Buffer.from([protocol.properties[propName]]));
  20552. writeStringPair(stream, name.toString(), value[name].toString());
  20553. });
  20554. break;
  20555. }
  20556. default:
  20557. {
  20558. stream.emit("error", new Error("Invalid property " + propName));
  20559. return false;
  20560. }
  20561. }
  20562. }
  20563. }
  20564. }
  20565. function byteLength(bufOrString) {
  20566. if (!bufOrString) return 0;else if (bufOrString instanceof Buffer) return bufOrString.length;else return Buffer.byteLength(bufOrString);
  20567. }
  20568. function isStringOrBuffer(field) {
  20569. return typeof field === "string" || field instanceof Buffer;
  20570. }
  20571. module.exports = generate;
  20572. }, {
  20573. "./constants": 82,
  20574. "./numbers": 86,
  20575. "process-nextick-args": 91,
  20576. "safe-buffer": 110
  20577. }],
  20578. 90: [function (require, module, exports) {
  20579. var wrappy = require("wrappy");
  20580. module.exports = wrappy(once);
  20581. module.exports.strict = wrappy(onceStrict);
  20582. once.proto = once(function () {
  20583. Object.defineProperty(Function.prototype, "once", {
  20584. value: function value() {
  20585. return once(this);
  20586. },
  20587. configurable: true
  20588. });
  20589. Object.defineProperty(Function.prototype, "onceStrict", {
  20590. value: function value() {
  20591. return onceStrict(this);
  20592. },
  20593. configurable: true
  20594. });
  20595. });
  20596. function once(fn) {
  20597. var f = function f() {
  20598. if (f.called) return f.value;
  20599. f.called = true;
  20600. return f.value = fn.apply(this, arguments);
  20601. };
  20602. f.called = false;
  20603. return f;
  20604. }
  20605. function onceStrict(fn) {
  20606. var f = function f() {
  20607. if (f.called) throw new Error(f.onceError);
  20608. f.called = true;
  20609. return f.value = fn.apply(this, arguments);
  20610. };
  20611. var name = fn.name || "Function wrapped with `once`";
  20612. f.onceError = name + " shouldn't be called more than once";
  20613. f.called = false;
  20614. return f;
  20615. }
  20616. }, {
  20617. wrappy: 120
  20618. }],
  20619. 91: [function (require, module, exports) {
  20620. (function (process) {
  20621. "use strict";
  20622. if (!process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
  20623. module.exports = {
  20624. nextTick: nextTick
  20625. };
  20626. } else {
  20627. module.exports = process;
  20628. }
  20629. function nextTick(fn, arg1, arg2, arg3) {
  20630. if (typeof fn !== "function") {
  20631. throw new TypeError('"callback" argument must be a function');
  20632. }
  20633. var len = arguments.length;
  20634. var args, i;
  20635. switch (len) {
  20636. case 0:
  20637. case 1:
  20638. return process.nextTick(fn);
  20639. case 2:
  20640. return process.nextTick(function afterTickOne() {
  20641. fn.call(null, arg1);
  20642. });
  20643. case 3:
  20644. return process.nextTick(function afterTickTwo() {
  20645. fn.call(null, arg1, arg2);
  20646. });
  20647. case 4:
  20648. return process.nextTick(function afterTickThree() {
  20649. fn.call(null, arg1, arg2, arg3);
  20650. });
  20651. default:
  20652. args = new Array(len - 1);
  20653. i = 0;
  20654. while (i < args.length) {
  20655. args[i++] = arguments[i];
  20656. }
  20657. return process.nextTick(function afterTick() {
  20658. fn.apply(null, args);
  20659. });
  20660. }
  20661. }
  20662. }).call(this, require("_process"));
  20663. }, {
  20664. _process: 92
  20665. }],
  20666. 92: [function (require, module, exports) {
  20667. var process = module.exports = {};
  20668. var cachedSetTimeout;
  20669. var cachedClearTimeout;
  20670. function defaultSetTimout() {
  20671. throw new Error("setTimeout has not been defined");
  20672. }
  20673. function defaultClearTimeout() {
  20674. throw new Error("clearTimeout has not been defined");
  20675. }
  20676. (function () {
  20677. try {
  20678. if (typeof setTimeout === "function") {
  20679. cachedSetTimeout = setTimeout;
  20680. } else {
  20681. cachedSetTimeout = defaultSetTimout;
  20682. }
  20683. } catch (e) {
  20684. cachedSetTimeout = defaultSetTimout;
  20685. }
  20686. try {
  20687. if (typeof clearTimeout === "function") {
  20688. cachedClearTimeout = clearTimeout;
  20689. } else {
  20690. cachedClearTimeout = defaultClearTimeout;
  20691. }
  20692. } catch (e) {
  20693. cachedClearTimeout = defaultClearTimeout;
  20694. }
  20695. })();
  20696. function runTimeout(fun) {
  20697. if (cachedSetTimeout === setTimeout) {
  20698. return setTimeout(fun, 0);
  20699. }
  20700. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  20701. cachedSetTimeout = setTimeout;
  20702. return setTimeout(fun, 0);
  20703. }
  20704. try {
  20705. return cachedSetTimeout(fun, 0);
  20706. } catch (e) {
  20707. try {
  20708. return cachedSetTimeout.call(null, fun, 0);
  20709. } catch (e) {
  20710. return cachedSetTimeout.call(this, fun, 0);
  20711. }
  20712. }
  20713. }
  20714. function runClearTimeout(marker) {
  20715. if (cachedClearTimeout === clearTimeout) {
  20716. return clearTimeout(marker);
  20717. }
  20718. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  20719. cachedClearTimeout = clearTimeout;
  20720. return clearTimeout(marker);
  20721. }
  20722. try {
  20723. return cachedClearTimeout(marker);
  20724. } catch (e) {
  20725. try {
  20726. return cachedClearTimeout.call(null, marker);
  20727. } catch (e) {
  20728. return cachedClearTimeout.call(this, marker);
  20729. }
  20730. }
  20731. }
  20732. var queue = [];
  20733. var draining = false;
  20734. var currentQueue;
  20735. var queueIndex = -1;
  20736. function cleanUpNextTick() {
  20737. if (!draining || !currentQueue) {
  20738. return;
  20739. }
  20740. draining = false;
  20741. if (currentQueue.length) {
  20742. queue = currentQueue.concat(queue);
  20743. } else {
  20744. queueIndex = -1;
  20745. }
  20746. if (queue.length) {
  20747. drainQueue();
  20748. }
  20749. }
  20750. function drainQueue() {
  20751. if (draining) {
  20752. return;
  20753. }
  20754. var timeout = runTimeout(cleanUpNextTick);
  20755. draining = true;
  20756. var len = queue.length;
  20757. while (len) {
  20758. currentQueue = queue;
  20759. queue = [];
  20760. while (++queueIndex < len) {
  20761. if (currentQueue) {
  20762. currentQueue[queueIndex].run();
  20763. }
  20764. }
  20765. queueIndex = -1;
  20766. len = queue.length;
  20767. }
  20768. currentQueue = null;
  20769. draining = false;
  20770. runClearTimeout(timeout);
  20771. }
  20772. process.nextTick = function (fun) {
  20773. var args = new Array(arguments.length - 1);
  20774. if (arguments.length > 1) {
  20775. for (var i = 1; i < arguments.length; i++) {
  20776. args[i - 1] = arguments[i];
  20777. }
  20778. }
  20779. queue.push(new Item(fun, args));
  20780. if (queue.length === 1 && !draining) {
  20781. runTimeout(drainQueue);
  20782. }
  20783. };
  20784. function Item(fun, array) {
  20785. this.fun = fun;
  20786. this.array = array;
  20787. }
  20788. Item.prototype.run = function () {
  20789. this.fun.apply(null, this.array);
  20790. };
  20791. process.title = "browser";
  20792. process.browser = true;
  20793. process.env = {};
  20794. process.argv = [];
  20795. process.version = "";
  20796. process.versions = {};
  20797. function noop() {}
  20798. process.on = noop;
  20799. process.addListener = noop;
  20800. process.once = noop;
  20801. process.off = noop;
  20802. process.removeListener = noop;
  20803. process.removeAllListeners = noop;
  20804. process.emit = noop;
  20805. process.prependListener = noop;
  20806. process.prependOnceListener = noop;
  20807. process.listeners = function (name) {
  20808. return [];
  20809. };
  20810. process.binding = function (name) {
  20811. throw new Error("process.binding is not supported");
  20812. };
  20813. process.cwd = function () {
  20814. return "/";
  20815. };
  20816. process.chdir = function (dir) {
  20817. throw new Error("process.chdir is not supported");
  20818. };
  20819. process.umask = function () {
  20820. return 0;
  20821. };
  20822. }, {}],
  20823. 93: [function (require, module, exports) {
  20824. (function (global) {
  20825. (function (root) {
  20826. var freeExports = _typeof(exports) == "object" && exports && !exports.nodeType && exports;
  20827. var freeModule = _typeof(module) == "object" && module && !module.nodeType && module;
  20828. var freeGlobal = _typeof(global) == "object" && global;
  20829. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
  20830. root = freeGlobal;
  20831. }
  20832. var punycode,
  20833. maxInt = 2147483647,
  20834. base = 36,
  20835. tMin = 1,
  20836. tMax = 26,
  20837. skew = 38,
  20838. damp = 700,
  20839. initialBias = 72,
  20840. initialN = 128,
  20841. delimiter = "-",
  20842. regexPunycode = /^xn--/,
  20843. regexNonASCII = /[^\x20-\x7E]/,
  20844. regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g,
  20845. errors = {
  20846. overflow: "Overflow: input needs wider integers to process",
  20847. "not-basic": "Illegal input >= 0x80 (not a basic code point)",
  20848. "invalid-input": "Invalid input"
  20849. },
  20850. baseMinusTMin = base - tMin,
  20851. floor = Math.floor,
  20852. stringFromCharCode = String.fromCharCode,
  20853. key;
  20854. function error(type) {
  20855. throw new RangeError(errors[type]);
  20856. }
  20857. function map(array, fn) {
  20858. var length = array.length;
  20859. var result = [];
  20860. while (length--) {
  20861. result[length] = fn(array[length]);
  20862. }
  20863. return result;
  20864. }
  20865. function mapDomain(string, fn) {
  20866. var parts = string.split("@");
  20867. var result = "";
  20868. if (parts.length > 1) {
  20869. result = parts[0] + "@";
  20870. string = parts[1];
  20871. }
  20872. string = string.replace(regexSeparators, ".");
  20873. var labels = string.split(".");
  20874. var encoded = map(labels, fn).join(".");
  20875. return result + encoded;
  20876. }
  20877. function ucs2decode(string) {
  20878. var output = [],
  20879. counter = 0,
  20880. length = string.length,
  20881. value,
  20882. extra;
  20883. while (counter < length) {
  20884. value = string.charCodeAt(counter++);
  20885. if (value >= 55296 && value <= 56319 && counter < length) {
  20886. extra = string.charCodeAt(counter++);
  20887. if ((extra & 64512) == 56320) {
  20888. output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
  20889. } else {
  20890. output.push(value);
  20891. counter--;
  20892. }
  20893. } else {
  20894. output.push(value);
  20895. }
  20896. }
  20897. return output;
  20898. }
  20899. function ucs2encode(array) {
  20900. return map(array, function (value) {
  20901. var output = "";
  20902. if (value > 65535) {
  20903. value -= 65536;
  20904. output += stringFromCharCode(value >>> 10 & 1023 | 55296);
  20905. value = 56320 | value & 1023;
  20906. }
  20907. output += stringFromCharCode(value);
  20908. return output;
  20909. }).join("");
  20910. }
  20911. function basicToDigit(codePoint) {
  20912. if (codePoint - 48 < 10) {
  20913. return codePoint - 22;
  20914. }
  20915. if (codePoint - 65 < 26) {
  20916. return codePoint - 65;
  20917. }
  20918. if (codePoint - 97 < 26) {
  20919. return codePoint - 97;
  20920. }
  20921. return base;
  20922. }
  20923. function digitToBasic(digit, flag) {
  20924. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  20925. }
  20926. function adapt(delta, numPoints, firstTime) {
  20927. var k = 0;
  20928. delta = firstTime ? floor(delta / damp) : delta >> 1;
  20929. delta += floor(delta / numPoints);
  20930. for (; delta > baseMinusTMin * tMax >> 1; k += base) {
  20931. delta = floor(delta / baseMinusTMin);
  20932. }
  20933. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  20934. }
  20935. function decode(input) {
  20936. var output = [],
  20937. inputLength = input.length,
  20938. out,
  20939. i = 0,
  20940. n = initialN,
  20941. bias = initialBias,
  20942. basic,
  20943. j,
  20944. index,
  20945. oldi,
  20946. w,
  20947. k,
  20948. digit,
  20949. t,
  20950. baseMinusT;
  20951. basic = input.lastIndexOf(delimiter);
  20952. if (basic < 0) {
  20953. basic = 0;
  20954. }
  20955. for (j = 0; j < basic; ++j) {
  20956. if (input.charCodeAt(j) >= 128) {
  20957. error("not-basic");
  20958. }
  20959. output.push(input.charCodeAt(j));
  20960. }
  20961. for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) {
  20962. for (oldi = i, w = 1, k = base;; k += base) {
  20963. if (index >= inputLength) {
  20964. error("invalid-input");
  20965. }
  20966. digit = basicToDigit(input.charCodeAt(index++));
  20967. if (digit >= base || digit > floor((maxInt - i) / w)) {
  20968. error("overflow");
  20969. }
  20970. i += digit * w;
  20971. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  20972. if (digit < t) {
  20973. break;
  20974. }
  20975. baseMinusT = base - t;
  20976. if (w > floor(maxInt / baseMinusT)) {
  20977. error("overflow");
  20978. }
  20979. w *= baseMinusT;
  20980. }
  20981. out = output.length + 1;
  20982. bias = adapt(i - oldi, out, oldi == 0);
  20983. if (floor(i / out) > maxInt - n) {
  20984. error("overflow");
  20985. }
  20986. n += floor(i / out);
  20987. i %= out;
  20988. output.splice(i++, 0, n);
  20989. }
  20990. return ucs2encode(output);
  20991. }
  20992. function encode(input) {
  20993. var n,
  20994. delta,
  20995. handledCPCount,
  20996. basicLength,
  20997. bias,
  20998. j,
  20999. m,
  21000. q,
  21001. k,
  21002. t,
  21003. currentValue,
  21004. output = [],
  21005. inputLength,
  21006. handledCPCountPlusOne,
  21007. baseMinusT,
  21008. qMinusT;
  21009. input = ucs2decode(input);
  21010. inputLength = input.length;
  21011. n = initialN;
  21012. delta = 0;
  21013. bias = initialBias;
  21014. for (j = 0; j < inputLength; ++j) {
  21015. currentValue = input[j];
  21016. if (currentValue < 128) {
  21017. output.push(stringFromCharCode(currentValue));
  21018. }
  21019. }
  21020. handledCPCount = basicLength = output.length;
  21021. if (basicLength) {
  21022. output.push(delimiter);
  21023. }
  21024. while (handledCPCount < inputLength) {
  21025. for (m = maxInt, j = 0; j < inputLength; ++j) {
  21026. currentValue = input[j];
  21027. if (currentValue >= n && currentValue < m) {
  21028. m = currentValue;
  21029. }
  21030. }
  21031. handledCPCountPlusOne = handledCPCount + 1;
  21032. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  21033. error("overflow");
  21034. }
  21035. delta += (m - n) * handledCPCountPlusOne;
  21036. n = m;
  21037. for (j = 0; j < inputLength; ++j) {
  21038. currentValue = input[j];
  21039. if (currentValue < n && ++delta > maxInt) {
  21040. error("overflow");
  21041. }
  21042. if (currentValue == n) {
  21043. for (q = delta, k = base;; k += base) {
  21044. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  21045. if (q < t) {
  21046. break;
  21047. }
  21048. qMinusT = q - t;
  21049. baseMinusT = base - t;
  21050. output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
  21051. q = floor(qMinusT / baseMinusT);
  21052. }
  21053. output.push(stringFromCharCode(digitToBasic(q, 0)));
  21054. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  21055. delta = 0;
  21056. ++handledCPCount;
  21057. }
  21058. }
  21059. ++delta;
  21060. ++n;
  21061. }
  21062. return output.join("");
  21063. }
  21064. function toUnicode(input) {
  21065. return mapDomain(input, function (string) {
  21066. return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
  21067. });
  21068. }
  21069. function toASCII(input) {
  21070. return mapDomain(input, function (string) {
  21071. return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
  21072. });
  21073. }
  21074. punycode = {
  21075. version: "1.4.1",
  21076. ucs2: {
  21077. decode: ucs2decode,
  21078. encode: ucs2encode
  21079. },
  21080. decode: decode,
  21081. encode: encode,
  21082. toASCII: toASCII,
  21083. toUnicode: toUnicode
  21084. };
  21085. if (typeof define == "function" && _typeof(define.amd) == "object" && define.amd) {
  21086. define("punycode", function () {
  21087. return punycode;
  21088. });
  21089. } else if (freeExports && freeModule) {
  21090. if (module.exports == freeExports) {
  21091. freeModule.exports = punycode;
  21092. } else {
  21093. for (key in punycode) {
  21094. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  21095. }
  21096. }
  21097. } else {
  21098. root.punycode = punycode;
  21099. }
  21100. })(this);
  21101. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  21102. }, {}],
  21103. 94: [function (require, module, exports) {
  21104. "use strict";
  21105. function hasOwnProperty(obj, prop) {
  21106. return Object.prototype.hasOwnProperty.call(obj, prop);
  21107. }
  21108. module.exports = function (qs, sep, eq, options) {
  21109. sep = sep || "&";
  21110. eq = eq || "=";
  21111. var obj = {};
  21112. if (typeof qs !== "string" || qs.length === 0) {
  21113. return obj;
  21114. }
  21115. var regexp = /\+/g;
  21116. qs = qs.split(sep);
  21117. var maxKeys = 1e3;
  21118. if (options && typeof options.maxKeys === "number") {
  21119. maxKeys = options.maxKeys;
  21120. }
  21121. var len = qs.length;
  21122. if (maxKeys > 0 && len > maxKeys) {
  21123. len = maxKeys;
  21124. }
  21125. for (var i = 0; i < len; ++i) {
  21126. var x = qs[i].replace(regexp, "%20"),
  21127. idx = x.indexOf(eq),
  21128. kstr,
  21129. vstr,
  21130. k,
  21131. v;
  21132. if (idx >= 0) {
  21133. kstr = x.substr(0, idx);
  21134. vstr = x.substr(idx + 1);
  21135. } else {
  21136. kstr = x;
  21137. vstr = "";
  21138. }
  21139. k = decodeURIComponent(kstr);
  21140. v = decodeURIComponent(vstr);
  21141. if (!hasOwnProperty(obj, k)) {
  21142. obj[k] = v;
  21143. } else if (isArray(obj[k])) {
  21144. obj[k].push(v);
  21145. } else {
  21146. obj[k] = [obj[k], v];
  21147. }
  21148. }
  21149. return obj;
  21150. };
  21151. var isArray = Array.isArray || function (xs) {
  21152. return Object.prototype.toString.call(xs) === "[object Array]";
  21153. };
  21154. }, {}],
  21155. 95: [function (require, module, exports) {
  21156. "use strict";
  21157. var stringifyPrimitive = function stringifyPrimitive(v) {
  21158. switch (_typeof(v)) {
  21159. case "string":
  21160. return v;
  21161. case "boolean":
  21162. return v ? "true" : "false";
  21163. case "number":
  21164. return isFinite(v) ? v : "";
  21165. default:
  21166. return "";
  21167. }
  21168. };
  21169. module.exports = function (obj, sep, eq, name) {
  21170. sep = sep || "&";
  21171. eq = eq || "=";
  21172. if (obj === null) {
  21173. obj = undefined;
  21174. }
  21175. if (_typeof(obj) === "object") {
  21176. return map(objectKeys(obj), function (k) {
  21177. var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
  21178. if (isArray(obj[k])) {
  21179. return map(obj[k], function (v) {
  21180. return ks + encodeURIComponent(stringifyPrimitive(v));
  21181. }).join(sep);
  21182. } else {
  21183. return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
  21184. }
  21185. }).join(sep);
  21186. }
  21187. if (!name) return "";
  21188. return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));
  21189. };
  21190. var isArray = Array.isArray || function (xs) {
  21191. return Object.prototype.toString.call(xs) === "[object Array]";
  21192. };
  21193. function map(xs, f) {
  21194. if (xs.map) return xs.map(f);
  21195. var res = [];
  21196. for (var i = 0; i < xs.length; i++) {
  21197. res.push(f(xs[i], i));
  21198. }
  21199. return res;
  21200. }
  21201. var objectKeys = Object.keys || function (obj) {
  21202. var res = [];
  21203. for (var key in obj) {
  21204. if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
  21205. }
  21206. return res;
  21207. };
  21208. }, {}],
  21209. 96: [function (require, module, exports) {
  21210. "use strict";
  21211. exports.decode = exports.parse = require("./decode");
  21212. exports.encode = exports.stringify = require("./encode");
  21213. }, {
  21214. "./decode": 94,
  21215. "./encode": 95
  21216. }],
  21217. 97: [function (require, module, exports) {
  21218. module.exports = require("./lib/_stream_duplex.js");
  21219. }, {
  21220. "./lib/_stream_duplex.js": 98
  21221. }],
  21222. 98: [function (require, module, exports) {
  21223. "use strict";
  21224. var pna = require("process-nextick-args");
  21225. var objectKeys = Object.keys || function (obj) {
  21226. var keys = [];
  21227. for (var key in obj) {
  21228. keys.push(key);
  21229. }
  21230. return keys;
  21231. };
  21232. module.exports = Duplex;
  21233. var util = require("core-util-is");
  21234. util.inherits = require("inherits");
  21235. var Readable = require("./_stream_readable");
  21236. var Writable = require("./_stream_writable");
  21237. util.inherits(Duplex, Readable);
  21238. {
  21239. var keys = objectKeys(Writable.prototype);
  21240. for (var v = 0; v < keys.length; v++) {
  21241. var method = keys[v];
  21242. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  21243. }
  21244. }
  21245. function Duplex(options) {
  21246. if (!(this instanceof Duplex)) return new Duplex(options);
  21247. Readable.call(this, options);
  21248. Writable.call(this, options);
  21249. if (options && options.readable === false) this.readable = false;
  21250. if (options && options.writable === false) this.writable = false;
  21251. this.allowHalfOpen = true;
  21252. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  21253. this.once("end", onend);
  21254. }
  21255. Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
  21256. enumerable: false,
  21257. get: function get() {
  21258. return this._writableState.highWaterMark;
  21259. }
  21260. });
  21261. function onend() {
  21262. if (this.allowHalfOpen || this._writableState.ended) return;
  21263. pna.nextTick(onEndNT, this);
  21264. }
  21265. function onEndNT(self) {
  21266. self.end();
  21267. }
  21268. Object.defineProperty(Duplex.prototype, "destroyed", {
  21269. get: function get() {
  21270. if (this._readableState === undefined || this._writableState === undefined) {
  21271. return false;
  21272. }
  21273. return this._readableState.destroyed && this._writableState.destroyed;
  21274. },
  21275. set: function set(value) {
  21276. if (this._readableState === undefined || this._writableState === undefined) {
  21277. return;
  21278. }
  21279. this._readableState.destroyed = value;
  21280. this._writableState.destroyed = value;
  21281. }
  21282. });
  21283. Duplex.prototype._destroy = function (err, cb) {
  21284. this.push(null);
  21285. this.end();
  21286. pna.nextTick(cb, err);
  21287. };
  21288. }, {
  21289. "./_stream_readable": 100,
  21290. "./_stream_writable": 102,
  21291. "core-util-is": 14,
  21292. inherits: 80,
  21293. "process-nextick-args": 91
  21294. }],
  21295. 99: [function (require, module, exports) {
  21296. "use strict";
  21297. module.exports = PassThrough;
  21298. var Transform = require("./_stream_transform");
  21299. var util = require("core-util-is");
  21300. util.inherits = require("inherits");
  21301. util.inherits(PassThrough, Transform);
  21302. function PassThrough(options) {
  21303. if (!(this instanceof PassThrough)) return new PassThrough(options);
  21304. Transform.call(this, options);
  21305. }
  21306. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  21307. cb(null, chunk);
  21308. };
  21309. }, {
  21310. "./_stream_transform": 101,
  21311. "core-util-is": 14,
  21312. inherits: 80
  21313. }],
  21314. 100: [function (require, module, exports) {
  21315. (function (process, global) {
  21316. "use strict";
  21317. var pna = require("process-nextick-args");
  21318. module.exports = Readable;
  21319. var isArray = require("isarray");
  21320. var Duplex;
  21321. Readable.ReadableState = ReadableState;
  21322. var EE = require("events").EventEmitter;
  21323. var EElistenerCount = function EElistenerCount(emitter, type) {
  21324. return emitter.listeners(type).length;
  21325. };
  21326. var Stream = require("./internal/streams/stream");
  21327. var Buffer = require("safe-buffer").Buffer;
  21328. var OurUint8Array = global.Uint8Array || function () {};
  21329. function _uint8ArrayToBuffer(chunk) {
  21330. return Buffer.from(chunk);
  21331. }
  21332. function _isUint8Array(obj) {
  21333. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  21334. }
  21335. var util = require("core-util-is");
  21336. util.inherits = require("inherits");
  21337. var debugUtil = require("util");
  21338. var debug = void 0;
  21339. if (debugUtil && debugUtil.debuglog) {
  21340. debug = debugUtil.debuglog("stream");
  21341. } else {
  21342. debug = function debug() {};
  21343. }
  21344. var BufferList = require("./internal/streams/BufferList");
  21345. var destroyImpl = require("./internal/streams/destroy");
  21346. var StringDecoder;
  21347. util.inherits(Readable, Stream);
  21348. var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
  21349. function prependListener(emitter, event, fn) {
  21350. if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
  21351. 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]];
  21352. }
  21353. function ReadableState(options, stream) {
  21354. Duplex = Duplex || require("./_stream_duplex");
  21355. options = options || {};
  21356. var isDuplex = stream instanceof Duplex;
  21357. this.objectMode = !!options.objectMode;
  21358. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  21359. var hwm = options.highWaterMark;
  21360. var readableHwm = options.readableHighWaterMark;
  21361. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  21362. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  21363. this.highWaterMark = Math.floor(this.highWaterMark);
  21364. this.buffer = new BufferList();
  21365. this.length = 0;
  21366. this.pipes = null;
  21367. this.pipesCount = 0;
  21368. this.flowing = null;
  21369. this.ended = false;
  21370. this.endEmitted = false;
  21371. this.reading = false;
  21372. this.sync = true;
  21373. this.needReadable = false;
  21374. this.emittedReadable = false;
  21375. this.readableListening = false;
  21376. this.resumeScheduled = false;
  21377. this.destroyed = false;
  21378. this.defaultEncoding = options.defaultEncoding || "utf8";
  21379. this.awaitDrain = 0;
  21380. this.readingMore = false;
  21381. this.decoder = null;
  21382. this.encoding = null;
  21383. if (options.encoding) {
  21384. if (!StringDecoder) StringDecoder = require("string_decoder/").StringDecoder;
  21385. this.decoder = new StringDecoder(options.encoding);
  21386. this.encoding = options.encoding;
  21387. }
  21388. }
  21389. function Readable(options) {
  21390. Duplex = Duplex || require("./_stream_duplex");
  21391. if (!(this instanceof Readable)) return new Readable(options);
  21392. this._readableState = new ReadableState(options, this);
  21393. this.readable = true;
  21394. if (options) {
  21395. if (typeof options.read === "function") this._read = options.read;
  21396. if (typeof options.destroy === "function") this._destroy = options.destroy;
  21397. }
  21398. Stream.call(this);
  21399. }
  21400. Object.defineProperty(Readable.prototype, "destroyed", {
  21401. get: function get() {
  21402. if (this._readableState === undefined) {
  21403. return false;
  21404. }
  21405. return this._readableState.destroyed;
  21406. },
  21407. set: function set(value) {
  21408. if (!this._readableState) {
  21409. return;
  21410. }
  21411. this._readableState.destroyed = value;
  21412. }
  21413. });
  21414. Readable.prototype.destroy = destroyImpl.destroy;
  21415. Readable.prototype._undestroy = destroyImpl.undestroy;
  21416. Readable.prototype._destroy = function (err, cb) {
  21417. this.push(null);
  21418. cb(err);
  21419. };
  21420. Readable.prototype.push = function (chunk, encoding) {
  21421. var state = this._readableState;
  21422. var skipChunkCheck;
  21423. if (!state.objectMode) {
  21424. if (typeof chunk === "string") {
  21425. encoding = encoding || state.defaultEncoding;
  21426. if (encoding !== state.encoding) {
  21427. chunk = Buffer.from(chunk, encoding);
  21428. encoding = "";
  21429. }
  21430. skipChunkCheck = true;
  21431. }
  21432. } else {
  21433. skipChunkCheck = true;
  21434. }
  21435. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  21436. };
  21437. Readable.prototype.unshift = function (chunk) {
  21438. return readableAddChunk(this, chunk, null, true, false);
  21439. };
  21440. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  21441. var state = stream._readableState;
  21442. if (chunk === null) {
  21443. state.reading = false;
  21444. onEofChunk(stream, state);
  21445. } else {
  21446. var er;
  21447. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  21448. if (er) {
  21449. stream.emit("error", er);
  21450. } else if (state.objectMode || chunk && chunk.length > 0) {
  21451. if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  21452. chunk = _uint8ArrayToBuffer(chunk);
  21453. }
  21454. if (addToFront) {
  21455. if (state.endEmitted) stream.emit("error", new Error("stream.unshift() after end event"));else addChunk(stream, state, chunk, true);
  21456. } else if (state.ended) {
  21457. stream.emit("error", new Error("stream.push() after EOF"));
  21458. } else {
  21459. state.reading = false;
  21460. if (state.decoder && !encoding) {
  21461. chunk = state.decoder.write(chunk);
  21462. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  21463. } else {
  21464. addChunk(stream, state, chunk, false);
  21465. }
  21466. }
  21467. } else if (!addToFront) {
  21468. state.reading = false;
  21469. }
  21470. }
  21471. return needMoreData(state);
  21472. }
  21473. function addChunk(stream, state, chunk, addToFront) {
  21474. if (state.flowing && state.length === 0 && !state.sync) {
  21475. stream.emit("data", chunk);
  21476. stream.read(0);
  21477. } else {
  21478. state.length += state.objectMode ? 1 : chunk.length;
  21479. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  21480. if (state.needReadable) emitReadable(stream);
  21481. }
  21482. maybeReadMore(stream, state);
  21483. }
  21484. function chunkInvalid(state, chunk) {
  21485. var er;
  21486. if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
  21487. er = new TypeError("Invalid non-string/buffer chunk");
  21488. }
  21489. return er;
  21490. }
  21491. function needMoreData(state) {
  21492. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  21493. }
  21494. Readable.prototype.isPaused = function () {
  21495. return this._readableState.flowing === false;
  21496. };
  21497. Readable.prototype.setEncoding = function (enc) {
  21498. if (!StringDecoder) StringDecoder = require("string_decoder/").StringDecoder;
  21499. this._readableState.decoder = new StringDecoder(enc);
  21500. this._readableState.encoding = enc;
  21501. return this;
  21502. };
  21503. var MAX_HWM = 8388608;
  21504. function computeNewHighWaterMark(n) {
  21505. if (n >= MAX_HWM) {
  21506. n = MAX_HWM;
  21507. } else {
  21508. n--;
  21509. n |= n >>> 1;
  21510. n |= n >>> 2;
  21511. n |= n >>> 4;
  21512. n |= n >>> 8;
  21513. n |= n >>> 16;
  21514. n++;
  21515. }
  21516. return n;
  21517. }
  21518. function howMuchToRead(n, state) {
  21519. if (n <= 0 || state.length === 0 && state.ended) return 0;
  21520. if (state.objectMode) return 1;
  21521. if (n !== n) {
  21522. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  21523. }
  21524. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  21525. if (n <= state.length) return n;
  21526. if (!state.ended) {
  21527. state.needReadable = true;
  21528. return 0;
  21529. }
  21530. return state.length;
  21531. }
  21532. Readable.prototype.read = function (n) {
  21533. debug("read", n);
  21534. n = parseInt(n, 10);
  21535. var state = this._readableState;
  21536. var nOrig = n;
  21537. if (n !== 0) state.emittedReadable = false;
  21538. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  21539. debug("read: emitReadable", state.length, state.ended);
  21540. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  21541. return null;
  21542. }
  21543. n = howMuchToRead(n, state);
  21544. if (n === 0 && state.ended) {
  21545. if (state.length === 0) endReadable(this);
  21546. return null;
  21547. }
  21548. var doRead = state.needReadable;
  21549. debug("need readable", doRead);
  21550. if (state.length === 0 || state.length - n < state.highWaterMark) {
  21551. doRead = true;
  21552. debug("length less than watermark", doRead);
  21553. }
  21554. if (state.ended || state.reading) {
  21555. doRead = false;
  21556. debug("reading or ended", doRead);
  21557. } else if (doRead) {
  21558. debug("do read");
  21559. state.reading = true;
  21560. state.sync = true;
  21561. if (state.length === 0) state.needReadable = true;
  21562. this._read(state.highWaterMark);
  21563. state.sync = false;
  21564. if (!state.reading) n = howMuchToRead(nOrig, state);
  21565. }
  21566. var ret;
  21567. if (n > 0) ret = fromList(n, state);else ret = null;
  21568. if (ret === null) {
  21569. state.needReadable = true;
  21570. n = 0;
  21571. } else {
  21572. state.length -= n;
  21573. }
  21574. if (state.length === 0) {
  21575. if (!state.ended) state.needReadable = true;
  21576. if (nOrig !== n && state.ended) endReadable(this);
  21577. }
  21578. if (ret !== null) this.emit("data", ret);
  21579. return ret;
  21580. };
  21581. function onEofChunk(stream, state) {
  21582. if (state.ended) return;
  21583. if (state.decoder) {
  21584. var chunk = state.decoder.end();
  21585. if (chunk && chunk.length) {
  21586. state.buffer.push(chunk);
  21587. state.length += state.objectMode ? 1 : chunk.length;
  21588. }
  21589. }
  21590. state.ended = true;
  21591. emitReadable(stream);
  21592. }
  21593. function emitReadable(stream) {
  21594. var state = stream._readableState;
  21595. state.needReadable = false;
  21596. if (!state.emittedReadable) {
  21597. debug("emitReadable", state.flowing);
  21598. state.emittedReadable = true;
  21599. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  21600. }
  21601. }
  21602. function emitReadable_(stream) {
  21603. debug("emit readable");
  21604. stream.emit("readable");
  21605. flow(stream);
  21606. }
  21607. function maybeReadMore(stream, state) {
  21608. if (!state.readingMore) {
  21609. state.readingMore = true;
  21610. pna.nextTick(maybeReadMore_, stream, state);
  21611. }
  21612. }
  21613. function maybeReadMore_(stream, state) {
  21614. var len = state.length;
  21615. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  21616. debug("maybeReadMore read 0");
  21617. stream.read(0);
  21618. if (len === state.length) break;else len = state.length;
  21619. }
  21620. state.readingMore = false;
  21621. }
  21622. Readable.prototype._read = function (n) {
  21623. this.emit("error", new Error("_read() is not implemented"));
  21624. };
  21625. Readable.prototype.pipe = function (dest, pipeOpts) {
  21626. var src = this;
  21627. var state = this._readableState;
  21628. switch (state.pipesCount) {
  21629. case 0:
  21630. state.pipes = dest;
  21631. break;
  21632. case 1:
  21633. state.pipes = [state.pipes, dest];
  21634. break;
  21635. default:
  21636. state.pipes.push(dest);
  21637. break;
  21638. }
  21639. state.pipesCount += 1;
  21640. debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
  21641. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  21642. var endFn = doEnd ? onend : unpipe;
  21643. if (state.endEmitted) pna.nextTick(endFn);else src.once("end", endFn);
  21644. dest.on("unpipe", onunpipe);
  21645. function onunpipe(readable, unpipeInfo) {
  21646. debug("onunpipe");
  21647. if (readable === src) {
  21648. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  21649. unpipeInfo.hasUnpiped = true;
  21650. cleanup();
  21651. }
  21652. }
  21653. }
  21654. function onend() {
  21655. debug("onend");
  21656. dest.end();
  21657. }
  21658. var ondrain = pipeOnDrain(src);
  21659. dest.on("drain", ondrain);
  21660. var cleanedUp = false;
  21661. function cleanup() {
  21662. debug("cleanup");
  21663. dest.removeListener("close", onclose);
  21664. dest.removeListener("finish", onfinish);
  21665. dest.removeListener("drain", ondrain);
  21666. dest.removeListener("error", onerror);
  21667. dest.removeListener("unpipe", onunpipe);
  21668. src.removeListener("end", onend);
  21669. src.removeListener("end", unpipe);
  21670. src.removeListener("data", ondata);
  21671. cleanedUp = true;
  21672. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  21673. }
  21674. var increasedAwaitDrain = false;
  21675. src.on("data", ondata);
  21676. function ondata(chunk) {
  21677. debug("ondata");
  21678. increasedAwaitDrain = false;
  21679. var ret = dest.write(chunk);
  21680. if (false === ret && !increasedAwaitDrain) {
  21681. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  21682. debug("false write response, pause", src._readableState.awaitDrain);
  21683. src._readableState.awaitDrain++;
  21684. increasedAwaitDrain = true;
  21685. }
  21686. src.pause();
  21687. }
  21688. }
  21689. function onerror(er) {
  21690. debug("onerror", er);
  21691. unpipe();
  21692. dest.removeListener("error", onerror);
  21693. if (EElistenerCount(dest, "error") === 0) dest.emit("error", er);
  21694. }
  21695. prependListener(dest, "error", onerror);
  21696. function onclose() {
  21697. dest.removeListener("finish", onfinish);
  21698. unpipe();
  21699. }
  21700. dest.once("close", onclose);
  21701. function onfinish() {
  21702. debug("onfinish");
  21703. dest.removeListener("close", onclose);
  21704. unpipe();
  21705. }
  21706. dest.once("finish", onfinish);
  21707. function unpipe() {
  21708. debug("unpipe");
  21709. src.unpipe(dest);
  21710. }
  21711. dest.emit("pipe", src);
  21712. if (!state.flowing) {
  21713. debug("pipe resume");
  21714. src.resume();
  21715. }
  21716. return dest;
  21717. };
  21718. function pipeOnDrain(src) {
  21719. return function () {
  21720. var state = src._readableState;
  21721. debug("pipeOnDrain", state.awaitDrain);
  21722. if (state.awaitDrain) state.awaitDrain--;
  21723. if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
  21724. state.flowing = true;
  21725. flow(src);
  21726. }
  21727. };
  21728. }
  21729. Readable.prototype.unpipe = function (dest) {
  21730. var state = this._readableState;
  21731. var unpipeInfo = {
  21732. hasUnpiped: false
  21733. };
  21734. if (state.pipesCount === 0) return this;
  21735. if (state.pipesCount === 1) {
  21736. if (dest && dest !== state.pipes) return this;
  21737. if (!dest) dest = state.pipes;
  21738. state.pipes = null;
  21739. state.pipesCount = 0;
  21740. state.flowing = false;
  21741. if (dest) dest.emit("unpipe", this, unpipeInfo);
  21742. return this;
  21743. }
  21744. if (!dest) {
  21745. var dests = state.pipes;
  21746. var len = state.pipesCount;
  21747. state.pipes = null;
  21748. state.pipesCount = 0;
  21749. state.flowing = false;
  21750. for (var i = 0; i < len; i++) {
  21751. dests[i].emit("unpipe", this, unpipeInfo);
  21752. }
  21753. return this;
  21754. }
  21755. var index = indexOf(state.pipes, dest);
  21756. if (index === -1) return this;
  21757. state.pipes.splice(index, 1);
  21758. state.pipesCount -= 1;
  21759. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  21760. dest.emit("unpipe", this, unpipeInfo);
  21761. return this;
  21762. };
  21763. Readable.prototype.on = function (ev, fn) {
  21764. var res = Stream.prototype.on.call(this, ev, fn);
  21765. if (ev === "data") {
  21766. if (this._readableState.flowing !== false) this.resume();
  21767. } else if (ev === "readable") {
  21768. var state = this._readableState;
  21769. if (!state.endEmitted && !state.readableListening) {
  21770. state.readableListening = state.needReadable = true;
  21771. state.emittedReadable = false;
  21772. if (!state.reading) {
  21773. pna.nextTick(nReadingNextTick, this);
  21774. } else if (state.length) {
  21775. emitReadable(this);
  21776. }
  21777. }
  21778. }
  21779. return res;
  21780. };
  21781. Readable.prototype.addListener = Readable.prototype.on;
  21782. function nReadingNextTick(self) {
  21783. debug("readable nexttick read 0");
  21784. self.read(0);
  21785. }
  21786. Readable.prototype.resume = function () {
  21787. var state = this._readableState;
  21788. if (!state.flowing) {
  21789. debug("resume");
  21790. state.flowing = true;
  21791. resume(this, state);
  21792. }
  21793. return this;
  21794. };
  21795. function resume(stream, state) {
  21796. if (!state.resumeScheduled) {
  21797. state.resumeScheduled = true;
  21798. pna.nextTick(resume_, stream, state);
  21799. }
  21800. }
  21801. function resume_(stream, state) {
  21802. if (!state.reading) {
  21803. debug("resume read 0");
  21804. stream.read(0);
  21805. }
  21806. state.resumeScheduled = false;
  21807. state.awaitDrain = 0;
  21808. stream.emit("resume");
  21809. flow(stream);
  21810. if (state.flowing && !state.reading) stream.read(0);
  21811. }
  21812. Readable.prototype.pause = function () {
  21813. debug("call pause flowing=%j", this._readableState.flowing);
  21814. if (false !== this._readableState.flowing) {
  21815. debug("pause");
  21816. this._readableState.flowing = false;
  21817. this.emit("pause");
  21818. }
  21819. return this;
  21820. };
  21821. function flow(stream) {
  21822. var state = stream._readableState;
  21823. debug("flow", state.flowing);
  21824. while (state.flowing && stream.read() !== null) {}
  21825. }
  21826. Readable.prototype.wrap = function (stream) {
  21827. var _this = this;
  21828. var state = this._readableState;
  21829. var paused = false;
  21830. stream.on("end", function () {
  21831. debug("wrapped end");
  21832. if (state.decoder && !state.ended) {
  21833. var chunk = state.decoder.end();
  21834. if (chunk && chunk.length) _this.push(chunk);
  21835. }
  21836. _this.push(null);
  21837. });
  21838. stream.on("data", function (chunk) {
  21839. debug("wrapped data");
  21840. if (state.decoder) chunk = state.decoder.write(chunk);
  21841. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  21842. var ret = _this.push(chunk);
  21843. if (!ret) {
  21844. paused = true;
  21845. stream.pause();
  21846. }
  21847. });
  21848. for (var i in stream) {
  21849. if (this[i] === undefined && typeof stream[i] === "function") {
  21850. this[i] = function (method) {
  21851. return function () {
  21852. return stream[method].apply(stream, arguments);
  21853. };
  21854. }(i);
  21855. }
  21856. }
  21857. for (var n = 0; n < kProxyEvents.length; n++) {
  21858. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  21859. }
  21860. this._read = function (n) {
  21861. debug("wrapped _read", n);
  21862. if (paused) {
  21863. paused = false;
  21864. stream.resume();
  21865. }
  21866. };
  21867. return this;
  21868. };
  21869. Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
  21870. enumerable: false,
  21871. get: function get() {
  21872. return this._readableState.highWaterMark;
  21873. }
  21874. });
  21875. Readable._fromList = fromList;
  21876. function fromList(n, state) {
  21877. if (state.length === 0) return null;
  21878. var ret;
  21879. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  21880. 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);
  21881. state.buffer.clear();
  21882. } else {
  21883. ret = fromListPartial(n, state.buffer, state.decoder);
  21884. }
  21885. return ret;
  21886. }
  21887. function fromListPartial(n, list, hasStrings) {
  21888. var ret;
  21889. if (n < list.head.data.length) {
  21890. ret = list.head.data.slice(0, n);
  21891. list.head.data = list.head.data.slice(n);
  21892. } else if (n === list.head.data.length) {
  21893. ret = list.shift();
  21894. } else {
  21895. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  21896. }
  21897. return ret;
  21898. }
  21899. function copyFromBufferString(n, list) {
  21900. var p = list.head;
  21901. var c = 1;
  21902. var ret = p.data;
  21903. n -= ret.length;
  21904. while (p = p.next) {
  21905. var str = p.data;
  21906. var nb = n > str.length ? str.length : n;
  21907. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  21908. n -= nb;
  21909. if (n === 0) {
  21910. if (nb === str.length) {
  21911. ++c;
  21912. if (p.next) list.head = p.next;else list.head = list.tail = null;
  21913. } else {
  21914. list.head = p;
  21915. p.data = str.slice(nb);
  21916. }
  21917. break;
  21918. }
  21919. ++c;
  21920. }
  21921. list.length -= c;
  21922. return ret;
  21923. }
  21924. function copyFromBuffer(n, list) {
  21925. var ret = Buffer.allocUnsafe(n);
  21926. var p = list.head;
  21927. var c = 1;
  21928. p.data.copy(ret);
  21929. n -= p.data.length;
  21930. while (p = p.next) {
  21931. var buf = p.data;
  21932. var nb = n > buf.length ? buf.length : n;
  21933. buf.copy(ret, ret.length - n, 0, nb);
  21934. n -= nb;
  21935. if (n === 0) {
  21936. if (nb === buf.length) {
  21937. ++c;
  21938. if (p.next) list.head = p.next;else list.head = list.tail = null;
  21939. } else {
  21940. list.head = p;
  21941. p.data = buf.slice(nb);
  21942. }
  21943. break;
  21944. }
  21945. ++c;
  21946. }
  21947. list.length -= c;
  21948. return ret;
  21949. }
  21950. function endReadable(stream) {
  21951. var state = stream._readableState;
  21952. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  21953. if (!state.endEmitted) {
  21954. state.ended = true;
  21955. pna.nextTick(endReadableNT, state, stream);
  21956. }
  21957. }
  21958. function endReadableNT(state, stream) {
  21959. if (!state.endEmitted && state.length === 0) {
  21960. state.endEmitted = true;
  21961. stream.readable = false;
  21962. stream.emit("end");
  21963. }
  21964. }
  21965. function indexOf(xs, x) {
  21966. for (var i = 0, l = xs.length; i < l; i++) {
  21967. if (xs[i] === x) return i;
  21968. }
  21969. return -1;
  21970. }
  21971. }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  21972. }, {
  21973. "./_stream_duplex": 98,
  21974. "./internal/streams/BufferList": 103,
  21975. "./internal/streams/destroy": 104,
  21976. "./internal/streams/stream": 105,
  21977. _process: 92,
  21978. "core-util-is": 14,
  21979. events: 13,
  21980. inherits: 80,
  21981. isarray: 106,
  21982. "process-nextick-args": 91,
  21983. "safe-buffer": 110,
  21984. "string_decoder/": 107,
  21985. util: 11
  21986. }],
  21987. 101: [function (require, module, exports) {
  21988. "use strict";
  21989. module.exports = Transform;
  21990. var Duplex = require("./_stream_duplex");
  21991. var util = require("core-util-is");
  21992. util.inherits = require("inherits");
  21993. util.inherits(Transform, Duplex);
  21994. function afterTransform(er, data) {
  21995. var ts = this._transformState;
  21996. ts.transforming = false;
  21997. var cb = ts.writecb;
  21998. if (!cb) {
  21999. return this.emit("error", new Error("write callback called multiple times"));
  22000. }
  22001. ts.writechunk = null;
  22002. ts.writecb = null;
  22003. if (data != null) this.push(data);
  22004. cb(er);
  22005. var rs = this._readableState;
  22006. rs.reading = false;
  22007. if (rs.needReadable || rs.length < rs.highWaterMark) {
  22008. this._read(rs.highWaterMark);
  22009. }
  22010. }
  22011. function Transform(options) {
  22012. if (!(this instanceof Transform)) return new Transform(options);
  22013. Duplex.call(this, options);
  22014. this._transformState = {
  22015. afterTransform: afterTransform.bind(this),
  22016. needTransform: false,
  22017. transforming: false,
  22018. writecb: null,
  22019. writechunk: null,
  22020. writeencoding: null
  22021. };
  22022. this._readableState.needReadable = true;
  22023. this._readableState.sync = false;
  22024. if (options) {
  22025. if (typeof options.transform === "function") this._transform = options.transform;
  22026. if (typeof options.flush === "function") this._flush = options.flush;
  22027. }
  22028. this.on("prefinish", prefinish);
  22029. }
  22030. function prefinish() {
  22031. var _this = this;
  22032. if (typeof this._flush === "function") {
  22033. this._flush(function (er, data) {
  22034. done(_this, er, data);
  22035. });
  22036. } else {
  22037. done(this, null, null);
  22038. }
  22039. }
  22040. Transform.prototype.push = function (chunk, encoding) {
  22041. this._transformState.needTransform = false;
  22042. return Duplex.prototype.push.call(this, chunk, encoding);
  22043. };
  22044. Transform.prototype._transform = function (chunk, encoding, cb) {
  22045. throw new Error("_transform() is not implemented");
  22046. };
  22047. Transform.prototype._write = function (chunk, encoding, cb) {
  22048. var ts = this._transformState;
  22049. ts.writecb = cb;
  22050. ts.writechunk = chunk;
  22051. ts.writeencoding = encoding;
  22052. if (!ts.transforming) {
  22053. var rs = this._readableState;
  22054. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  22055. }
  22056. };
  22057. Transform.prototype._read = function (n) {
  22058. var ts = this._transformState;
  22059. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  22060. ts.transforming = true;
  22061. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  22062. } else {
  22063. ts.needTransform = true;
  22064. }
  22065. };
  22066. Transform.prototype._destroy = function (err, cb) {
  22067. var _this2 = this;
  22068. Duplex.prototype._destroy.call(this, err, function (err2) {
  22069. cb(err2);
  22070. _this2.emit("close");
  22071. });
  22072. };
  22073. function done(stream, er, data) {
  22074. if (er) return stream.emit("error", er);
  22075. if (data != null) stream.push(data);
  22076. if (stream._writableState.length) throw new Error("Calling transform done when ws.length != 0");
  22077. if (stream._transformState.transforming) throw new Error("Calling transform done when still transforming");
  22078. return stream.push(null);
  22079. }
  22080. }, {
  22081. "./_stream_duplex": 98,
  22082. "core-util-is": 14,
  22083. inherits: 80
  22084. }],
  22085. 102: [function (require, module, exports) {
  22086. (function (process, global, setImmediate) {
  22087. "use strict";
  22088. var pna = require("process-nextick-args");
  22089. module.exports = Writable;
  22090. function WriteReq(chunk, encoding, cb) {
  22091. this.chunk = chunk;
  22092. this.encoding = encoding;
  22093. this.callback = cb;
  22094. this.next = null;
  22095. }
  22096. function CorkedRequest(state) {
  22097. var _this = this;
  22098. this.next = null;
  22099. this.entry = null;
  22100. this.finish = function () {
  22101. onCorkedFinish(_this, state);
  22102. };
  22103. }
  22104. var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  22105. var Duplex;
  22106. Writable.WritableState = WritableState;
  22107. var util = require("core-util-is");
  22108. util.inherits = require("inherits");
  22109. var internalUtil = {
  22110. deprecate: require("util-deprecate")
  22111. };
  22112. var Stream = require("./internal/streams/stream");
  22113. var Buffer = require("safe-buffer").Buffer;
  22114. var OurUint8Array = global.Uint8Array || function () {};
  22115. function _uint8ArrayToBuffer(chunk) {
  22116. return Buffer.from(chunk);
  22117. }
  22118. function _isUint8Array(obj) {
  22119. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  22120. }
  22121. var destroyImpl = require("./internal/streams/destroy");
  22122. util.inherits(Writable, Stream);
  22123. function nop() {}
  22124. function WritableState(options, stream) {
  22125. Duplex = Duplex || require("./_stream_duplex");
  22126. options = options || {};
  22127. var isDuplex = stream instanceof Duplex;
  22128. this.objectMode = !!options.objectMode;
  22129. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  22130. var hwm = options.highWaterMark;
  22131. var writableHwm = options.writableHighWaterMark;
  22132. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  22133. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  22134. this.highWaterMark = Math.floor(this.highWaterMark);
  22135. this.finalCalled = false;
  22136. this.needDrain = false;
  22137. this.ending = false;
  22138. this.ended = false;
  22139. this.finished = false;
  22140. this.destroyed = false;
  22141. var noDecode = options.decodeStrings === false;
  22142. this.decodeStrings = !noDecode;
  22143. this.defaultEncoding = options.defaultEncoding || "utf8";
  22144. this.length = 0;
  22145. this.writing = false;
  22146. this.corked = 0;
  22147. this.sync = true;
  22148. this.bufferProcessing = false;
  22149. this.onwrite = function (er) {
  22150. onwrite(stream, er);
  22151. };
  22152. this.writecb = null;
  22153. this.writelen = 0;
  22154. this.bufferedRequest = null;
  22155. this.lastBufferedRequest = null;
  22156. this.pendingcb = 0;
  22157. this.prefinished = false;
  22158. this.errorEmitted = false;
  22159. this.bufferedRequestCount = 0;
  22160. this.corkedRequestsFree = new CorkedRequest(this);
  22161. }
  22162. WritableState.prototype.getBuffer = function getBuffer() {
  22163. var current = this.bufferedRequest;
  22164. var out = [];
  22165. while (current) {
  22166. out.push(current);
  22167. current = current.next;
  22168. }
  22169. return out;
  22170. };
  22171. (function () {
  22172. try {
  22173. Object.defineProperty(WritableState.prototype, "buffer", {
  22174. get: internalUtil.deprecate(function () {
  22175. return this.getBuffer();
  22176. }, "_writableState.buffer is deprecated. Use _writableState.getBuffer " + "instead.", "DEP0003")
  22177. });
  22178. } catch (_) {}
  22179. })();
  22180. var realHasInstance;
  22181. if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
  22182. realHasInstance = Function.prototype[Symbol.hasInstance];
  22183. Object.defineProperty(Writable, Symbol.hasInstance, {
  22184. value: function value(object) {
  22185. if (realHasInstance.call(this, object)) return true;
  22186. if (this !== Writable) return false;
  22187. return object && object._writableState instanceof WritableState;
  22188. }
  22189. });
  22190. } else {
  22191. realHasInstance = function realHasInstance(object) {
  22192. return object instanceof this;
  22193. };
  22194. }
  22195. function Writable(options) {
  22196. Duplex = Duplex || require("./_stream_duplex");
  22197. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  22198. return new Writable(options);
  22199. }
  22200. this._writableState = new WritableState(options, this);
  22201. this.writable = true;
  22202. if (options) {
  22203. if (typeof options.write === "function") this._write = options.write;
  22204. if (typeof options.writev === "function") this._writev = options.writev;
  22205. if (typeof options.destroy === "function") this._destroy = options.destroy;
  22206. if (typeof options.final === "function") this._final = options.final;
  22207. }
  22208. Stream.call(this);
  22209. }
  22210. Writable.prototype.pipe = function () {
  22211. this.emit("error", new Error("Cannot pipe, not readable"));
  22212. };
  22213. function writeAfterEnd(stream, cb) {
  22214. var er = new Error("write after end");
  22215. stream.emit("error", er);
  22216. pna.nextTick(cb, er);
  22217. }
  22218. function validChunk(stream, state, chunk, cb) {
  22219. var valid = true;
  22220. var er = false;
  22221. if (chunk === null) {
  22222. er = new TypeError("May not write null values to stream");
  22223. } else if (typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
  22224. er = new TypeError("Invalid non-string/buffer chunk");
  22225. }
  22226. if (er) {
  22227. stream.emit("error", er);
  22228. pna.nextTick(cb, er);
  22229. valid = false;
  22230. }
  22231. return valid;
  22232. }
  22233. Writable.prototype.write = function (chunk, encoding, cb) {
  22234. var state = this._writableState;
  22235. var ret = false;
  22236. var isBuf = !state.objectMode && _isUint8Array(chunk);
  22237. if (isBuf && !Buffer.isBuffer(chunk)) {
  22238. chunk = _uint8ArrayToBuffer(chunk);
  22239. }
  22240. if (typeof encoding === "function") {
  22241. cb = encoding;
  22242. encoding = null;
  22243. }
  22244. if (isBuf) encoding = "buffer";else if (!encoding) encoding = state.defaultEncoding;
  22245. if (typeof cb !== "function") cb = nop;
  22246. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  22247. state.pendingcb++;
  22248. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  22249. }
  22250. return ret;
  22251. };
  22252. Writable.prototype.cork = function () {
  22253. var state = this._writableState;
  22254. state.corked++;
  22255. };
  22256. Writable.prototype.uncork = function () {
  22257. var state = this._writableState;
  22258. if (state.corked) {
  22259. state.corked--;
  22260. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  22261. }
  22262. };
  22263. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  22264. if (typeof encoding === "string") encoding = encoding.toLowerCase();
  22265. 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);
  22266. this._writableState.defaultEncoding = encoding;
  22267. return this;
  22268. };
  22269. function decodeChunk(state, chunk, encoding) {
  22270. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
  22271. chunk = Buffer.from(chunk, encoding);
  22272. }
  22273. return chunk;
  22274. }
  22275. Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
  22276. enumerable: false,
  22277. get: function get() {
  22278. return this._writableState.highWaterMark;
  22279. }
  22280. });
  22281. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  22282. if (!isBuf) {
  22283. var newChunk = decodeChunk(state, chunk, encoding);
  22284. if (chunk !== newChunk) {
  22285. isBuf = true;
  22286. encoding = "buffer";
  22287. chunk = newChunk;
  22288. }
  22289. }
  22290. var len = state.objectMode ? 1 : chunk.length;
  22291. state.length += len;
  22292. var ret = state.length < state.highWaterMark;
  22293. if (!ret) state.needDrain = true;
  22294. if (state.writing || state.corked) {
  22295. var last = state.lastBufferedRequest;
  22296. state.lastBufferedRequest = {
  22297. chunk: chunk,
  22298. encoding: encoding,
  22299. isBuf: isBuf,
  22300. callback: cb,
  22301. next: null
  22302. };
  22303. if (last) {
  22304. last.next = state.lastBufferedRequest;
  22305. } else {
  22306. state.bufferedRequest = state.lastBufferedRequest;
  22307. }
  22308. state.bufferedRequestCount += 1;
  22309. } else {
  22310. doWrite(stream, state, false, len, chunk, encoding, cb);
  22311. }
  22312. return ret;
  22313. }
  22314. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  22315. state.writelen = len;
  22316. state.writecb = cb;
  22317. state.writing = true;
  22318. state.sync = true;
  22319. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  22320. state.sync = false;
  22321. }
  22322. function onwriteError(stream, state, sync, er, cb) {
  22323. --state.pendingcb;
  22324. if (sync) {
  22325. pna.nextTick(cb, er);
  22326. pna.nextTick(finishMaybe, stream, state);
  22327. stream._writableState.errorEmitted = true;
  22328. stream.emit("error", er);
  22329. } else {
  22330. cb(er);
  22331. stream._writableState.errorEmitted = true;
  22332. stream.emit("error", er);
  22333. finishMaybe(stream, state);
  22334. }
  22335. }
  22336. function onwriteStateUpdate(state) {
  22337. state.writing = false;
  22338. state.writecb = null;
  22339. state.length -= state.writelen;
  22340. state.writelen = 0;
  22341. }
  22342. function onwrite(stream, er) {
  22343. var state = stream._writableState;
  22344. var sync = state.sync;
  22345. var cb = state.writecb;
  22346. onwriteStateUpdate(state);
  22347. if (er) onwriteError(stream, state, sync, er, cb);else {
  22348. var finished = needFinish(state);
  22349. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  22350. clearBuffer(stream, state);
  22351. }
  22352. if (sync) {
  22353. asyncWrite(afterWrite, stream, state, finished, cb);
  22354. } else {
  22355. afterWrite(stream, state, finished, cb);
  22356. }
  22357. }
  22358. }
  22359. function afterWrite(stream, state, finished, cb) {
  22360. if (!finished) onwriteDrain(stream, state);
  22361. state.pendingcb--;
  22362. cb();
  22363. finishMaybe(stream, state);
  22364. }
  22365. function onwriteDrain(stream, state) {
  22366. if (state.length === 0 && state.needDrain) {
  22367. state.needDrain = false;
  22368. stream.emit("drain");
  22369. }
  22370. }
  22371. function clearBuffer(stream, state) {
  22372. state.bufferProcessing = true;
  22373. var entry = state.bufferedRequest;
  22374. if (stream._writev && entry && entry.next) {
  22375. var l = state.bufferedRequestCount;
  22376. var buffer = new Array(l);
  22377. var holder = state.corkedRequestsFree;
  22378. holder.entry = entry;
  22379. var count = 0;
  22380. var allBuffers = true;
  22381. while (entry) {
  22382. buffer[count] = entry;
  22383. if (!entry.isBuf) allBuffers = false;
  22384. entry = entry.next;
  22385. count += 1;
  22386. }
  22387. buffer.allBuffers = allBuffers;
  22388. doWrite(stream, state, true, state.length, buffer, "", holder.finish);
  22389. state.pendingcb++;
  22390. state.lastBufferedRequest = null;
  22391. if (holder.next) {
  22392. state.corkedRequestsFree = holder.next;
  22393. holder.next = null;
  22394. } else {
  22395. state.corkedRequestsFree = new CorkedRequest(state);
  22396. }
  22397. state.bufferedRequestCount = 0;
  22398. } else {
  22399. while (entry) {
  22400. var chunk = entry.chunk;
  22401. var encoding = entry.encoding;
  22402. var cb = entry.callback;
  22403. var len = state.objectMode ? 1 : chunk.length;
  22404. doWrite(stream, state, false, len, chunk, encoding, cb);
  22405. entry = entry.next;
  22406. state.bufferedRequestCount--;
  22407. if (state.writing) {
  22408. break;
  22409. }
  22410. }
  22411. if (entry === null) state.lastBufferedRequest = null;
  22412. }
  22413. state.bufferedRequest = entry;
  22414. state.bufferProcessing = false;
  22415. }
  22416. Writable.prototype._write = function (chunk, encoding, cb) {
  22417. cb(new Error("_write() is not implemented"));
  22418. };
  22419. Writable.prototype._writev = null;
  22420. Writable.prototype.end = function (chunk, encoding, cb) {
  22421. var state = this._writableState;
  22422. if (typeof chunk === "function") {
  22423. cb = chunk;
  22424. chunk = null;
  22425. encoding = null;
  22426. } else if (typeof encoding === "function") {
  22427. cb = encoding;
  22428. encoding = null;
  22429. }
  22430. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  22431. if (state.corked) {
  22432. state.corked = 1;
  22433. this.uncork();
  22434. }
  22435. if (!state.ending && !state.finished) endWritable(this, state, cb);
  22436. };
  22437. function needFinish(state) {
  22438. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  22439. }
  22440. function callFinal(stream, state) {
  22441. stream._final(function (err) {
  22442. state.pendingcb--;
  22443. if (err) {
  22444. stream.emit("error", err);
  22445. }
  22446. state.prefinished = true;
  22447. stream.emit("prefinish");
  22448. finishMaybe(stream, state);
  22449. });
  22450. }
  22451. function prefinish(stream, state) {
  22452. if (!state.prefinished && !state.finalCalled) {
  22453. if (typeof stream._final === "function") {
  22454. state.pendingcb++;
  22455. state.finalCalled = true;
  22456. pna.nextTick(callFinal, stream, state);
  22457. } else {
  22458. state.prefinished = true;
  22459. stream.emit("prefinish");
  22460. }
  22461. }
  22462. }
  22463. function finishMaybe(stream, state) {
  22464. var need = needFinish(state);
  22465. if (need) {
  22466. prefinish(stream, state);
  22467. if (state.pendingcb === 0) {
  22468. state.finished = true;
  22469. stream.emit("finish");
  22470. }
  22471. }
  22472. return need;
  22473. }
  22474. function endWritable(stream, state, cb) {
  22475. state.ending = true;
  22476. finishMaybe(stream, state);
  22477. if (cb) {
  22478. if (state.finished) pna.nextTick(cb);else stream.once("finish", cb);
  22479. }
  22480. state.ended = true;
  22481. stream.writable = false;
  22482. }
  22483. function onCorkedFinish(corkReq, state, err) {
  22484. var entry = corkReq.entry;
  22485. corkReq.entry = null;
  22486. while (entry) {
  22487. var cb = entry.callback;
  22488. state.pendingcb--;
  22489. cb(err);
  22490. entry = entry.next;
  22491. }
  22492. if (state.corkedRequestsFree) {
  22493. state.corkedRequestsFree.next = corkReq;
  22494. } else {
  22495. state.corkedRequestsFree = corkReq;
  22496. }
  22497. }
  22498. Object.defineProperty(Writable.prototype, "destroyed", {
  22499. get: function get() {
  22500. if (this._writableState === undefined) {
  22501. return false;
  22502. }
  22503. return this._writableState.destroyed;
  22504. },
  22505. set: function set(value) {
  22506. if (!this._writableState) {
  22507. return;
  22508. }
  22509. this._writableState.destroyed = value;
  22510. }
  22511. });
  22512. Writable.prototype.destroy = destroyImpl.destroy;
  22513. Writable.prototype._undestroy = destroyImpl.undestroy;
  22514. Writable.prototype._destroy = function (err, cb) {
  22515. this.end();
  22516. cb(err);
  22517. };
  22518. }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("timers").setImmediate);
  22519. }, {
  22520. "./_stream_duplex": 98,
  22521. "./internal/streams/destroy": 104,
  22522. "./internal/streams/stream": 105,
  22523. _process: 92,
  22524. "core-util-is": 14,
  22525. inherits: 80,
  22526. "process-nextick-args": 91,
  22527. "safe-buffer": 110,
  22528. timers: 112,
  22529. "util-deprecate": 115
  22530. }],
  22531. 103: [function (require, module, exports) {
  22532. "use strict";
  22533. function _classCallCheck(instance, Constructor) {
  22534. if (!(instance instanceof Constructor)) {
  22535. throw new TypeError("Cannot call a class as a function");
  22536. }
  22537. }
  22538. var Buffer = require("safe-buffer").Buffer;
  22539. var util = require("util");
  22540. function copyBuffer(src, target, offset) {
  22541. src.copy(target, offset);
  22542. }
  22543. module.exports = function () {
  22544. function BufferList() {
  22545. _classCallCheck(this, BufferList);
  22546. this.head = null;
  22547. this.tail = null;
  22548. this.length = 0;
  22549. }
  22550. BufferList.prototype.push = function push(v) {
  22551. var entry = {
  22552. data: v,
  22553. next: null
  22554. };
  22555. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  22556. this.tail = entry;
  22557. ++this.length;
  22558. };
  22559. BufferList.prototype.unshift = function unshift(v) {
  22560. var entry = {
  22561. data: v,
  22562. next: this.head
  22563. };
  22564. if (this.length === 0) this.tail = entry;
  22565. this.head = entry;
  22566. ++this.length;
  22567. };
  22568. BufferList.prototype.shift = function shift() {
  22569. if (this.length === 0) return;
  22570. var ret = this.head.data;
  22571. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  22572. --this.length;
  22573. return ret;
  22574. };
  22575. BufferList.prototype.clear = function clear() {
  22576. this.head = this.tail = null;
  22577. this.length = 0;
  22578. };
  22579. BufferList.prototype.join = function join(s) {
  22580. if (this.length === 0) return "";
  22581. var p = this.head;
  22582. var ret = "" + p.data;
  22583. while (p = p.next) {
  22584. ret += s + p.data;
  22585. }
  22586. return ret;
  22587. };
  22588. BufferList.prototype.concat = function concat(n) {
  22589. if (this.length === 0) return Buffer.alloc(0);
  22590. if (this.length === 1) return this.head.data;
  22591. var ret = Buffer.allocUnsafe(n >>> 0);
  22592. var p = this.head;
  22593. var i = 0;
  22594. while (p) {
  22595. copyBuffer(p.data, ret, i);
  22596. i += p.data.length;
  22597. p = p.next;
  22598. }
  22599. return ret;
  22600. };
  22601. return BufferList;
  22602. }();
  22603. if (util && util.inspect && util.inspect.custom) {
  22604. module.exports.prototype[util.inspect.custom] = function () {
  22605. var obj = util.inspect({
  22606. length: this.length
  22607. });
  22608. return this.constructor.name + " " + obj;
  22609. };
  22610. }
  22611. }, {
  22612. "safe-buffer": 110,
  22613. util: 11
  22614. }],
  22615. 104: [function (require, module, exports) {
  22616. "use strict";
  22617. var pna = require("process-nextick-args");
  22618. function destroy(err, cb) {
  22619. var _this = this;
  22620. var readableDestroyed = this._readableState && this._readableState.destroyed;
  22621. var writableDestroyed = this._writableState && this._writableState.destroyed;
  22622. if (readableDestroyed || writableDestroyed) {
  22623. if (cb) {
  22624. cb(err);
  22625. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  22626. pna.nextTick(emitErrorNT, this, err);
  22627. }
  22628. return this;
  22629. }
  22630. if (this._readableState) {
  22631. this._readableState.destroyed = true;
  22632. }
  22633. if (this._writableState) {
  22634. this._writableState.destroyed = true;
  22635. }
  22636. this._destroy(err || null, function (err) {
  22637. if (!cb && err) {
  22638. pna.nextTick(emitErrorNT, _this, err);
  22639. if (_this._writableState) {
  22640. _this._writableState.errorEmitted = true;
  22641. }
  22642. } else if (cb) {
  22643. cb(err);
  22644. }
  22645. });
  22646. return this;
  22647. }
  22648. function undestroy() {
  22649. if (this._readableState) {
  22650. this._readableState.destroyed = false;
  22651. this._readableState.reading = false;
  22652. this._readableState.ended = false;
  22653. this._readableState.endEmitted = false;
  22654. }
  22655. if (this._writableState) {
  22656. this._writableState.destroyed = false;
  22657. this._writableState.ended = false;
  22658. this._writableState.ending = false;
  22659. this._writableState.finished = false;
  22660. this._writableState.errorEmitted = false;
  22661. }
  22662. }
  22663. function emitErrorNT(self, err) {
  22664. self.emit("error", err);
  22665. }
  22666. module.exports = {
  22667. destroy: destroy,
  22668. undestroy: undestroy
  22669. };
  22670. }, {
  22671. "process-nextick-args": 91
  22672. }],
  22673. 105: [function (require, module, exports) {
  22674. module.exports = require("events").EventEmitter;
  22675. }, {
  22676. events: 13
  22677. }],
  22678. 106: [function (require, module, exports) {
  22679. var toString = {}.toString;
  22680. module.exports = Array.isArray || function (arr) {
  22681. return toString.call(arr) == "[object Array]";
  22682. };
  22683. }, {}],
  22684. 107: [function (require, module, exports) {
  22685. "use strict";
  22686. var Buffer = require("safe-buffer").Buffer;
  22687. var isEncoding = Buffer.isEncoding || function (encoding) {
  22688. encoding = "" + encoding;
  22689. switch (encoding && encoding.toLowerCase()) {
  22690. case "hex":
  22691. case "utf8":
  22692. case "utf-8":
  22693. case "ascii":
  22694. case "binary":
  22695. case "base64":
  22696. case "ucs2":
  22697. case "ucs-2":
  22698. case "utf16le":
  22699. case "utf-16le":
  22700. case "raw":
  22701. return true;
  22702. default:
  22703. return false;
  22704. }
  22705. };
  22706. function _normalizeEncoding(enc) {
  22707. if (!enc) return "utf8";
  22708. var retried;
  22709. while (true) {
  22710. switch (enc) {
  22711. case "utf8":
  22712. case "utf-8":
  22713. return "utf8";
  22714. case "ucs2":
  22715. case "ucs-2":
  22716. case "utf16le":
  22717. case "utf-16le":
  22718. return "utf16le";
  22719. case "latin1":
  22720. case "binary":
  22721. return "latin1";
  22722. case "base64":
  22723. case "ascii":
  22724. case "hex":
  22725. return enc;
  22726. default:
  22727. if (retried) return;
  22728. enc = ("" + enc).toLowerCase();
  22729. retried = true;
  22730. }
  22731. }
  22732. }
  22733. function normalizeEncoding(enc) {
  22734. var nenc = _normalizeEncoding(enc);
  22735. if (typeof nenc !== "string" && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
  22736. return nenc || enc;
  22737. }
  22738. exports.StringDecoder = StringDecoder;
  22739. function StringDecoder(encoding) {
  22740. this.encoding = normalizeEncoding(encoding);
  22741. var nb;
  22742. switch (this.encoding) {
  22743. case "utf16le":
  22744. this.text = utf16Text;
  22745. this.end = utf16End;
  22746. nb = 4;
  22747. break;
  22748. case "utf8":
  22749. this.fillLast = utf8FillLast;
  22750. nb = 4;
  22751. break;
  22752. case "base64":
  22753. this.text = base64Text;
  22754. this.end = base64End;
  22755. nb = 3;
  22756. break;
  22757. default:
  22758. this.write = simpleWrite;
  22759. this.end = simpleEnd;
  22760. return;
  22761. }
  22762. this.lastNeed = 0;
  22763. this.lastTotal = 0;
  22764. this.lastChar = Buffer.allocUnsafe(nb);
  22765. }
  22766. StringDecoder.prototype.write = function (buf) {
  22767. if (buf.length === 0) return "";
  22768. var r;
  22769. var i;
  22770. if (this.lastNeed) {
  22771. r = this.fillLast(buf);
  22772. if (r === undefined) return "";
  22773. i = this.lastNeed;
  22774. this.lastNeed = 0;
  22775. } else {
  22776. i = 0;
  22777. }
  22778. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  22779. return r || "";
  22780. };
  22781. StringDecoder.prototype.end = utf8End;
  22782. StringDecoder.prototype.text = utf8Text;
  22783. StringDecoder.prototype.fillLast = function (buf) {
  22784. if (this.lastNeed <= buf.length) {
  22785. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  22786. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  22787. }
  22788. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  22789. this.lastNeed -= buf.length;
  22790. };
  22791. function utf8CheckByte(byte) {
  22792. if (byte <= 127) return 0;else if (byte >> 5 === 6) return 2;else if (byte >> 4 === 14) return 3;else if (byte >> 3 === 30) return 4;
  22793. return byte >> 6 === 2 ? -1 : -2;
  22794. }
  22795. function utf8CheckIncomplete(self, buf, i) {
  22796. var j = buf.length - 1;
  22797. if (j < i) return 0;
  22798. var nb = utf8CheckByte(buf[j]);
  22799. if (nb >= 0) {
  22800. if (nb > 0) self.lastNeed = nb - 1;
  22801. return nb;
  22802. }
  22803. if (--j < i || nb === -2) return 0;
  22804. nb = utf8CheckByte(buf[j]);
  22805. if (nb >= 0) {
  22806. if (nb > 0) self.lastNeed = nb - 2;
  22807. return nb;
  22808. }
  22809. if (--j < i || nb === -2) return 0;
  22810. nb = utf8CheckByte(buf[j]);
  22811. if (nb >= 0) {
  22812. if (nb > 0) {
  22813. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  22814. }
  22815. return nb;
  22816. }
  22817. return 0;
  22818. }
  22819. function utf8CheckExtraBytes(self, buf, p) {
  22820. if ((buf[0] & 192) !== 128) {
  22821. self.lastNeed = 0;
  22822. return "�";
  22823. }
  22824. if (self.lastNeed > 1 && buf.length > 1) {
  22825. if ((buf[1] & 192) !== 128) {
  22826. self.lastNeed = 1;
  22827. return "�";
  22828. }
  22829. if (self.lastNeed > 2 && buf.length > 2) {
  22830. if ((buf[2] & 192) !== 128) {
  22831. self.lastNeed = 2;
  22832. return "�";
  22833. }
  22834. }
  22835. }
  22836. }
  22837. function utf8FillLast(buf) {
  22838. var p = this.lastTotal - this.lastNeed;
  22839. var r = utf8CheckExtraBytes(this, buf, p);
  22840. if (r !== undefined) return r;
  22841. if (this.lastNeed <= buf.length) {
  22842. buf.copy(this.lastChar, p, 0, this.lastNeed);
  22843. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  22844. }
  22845. buf.copy(this.lastChar, p, 0, buf.length);
  22846. this.lastNeed -= buf.length;
  22847. }
  22848. function utf8Text(buf, i) {
  22849. var total = utf8CheckIncomplete(this, buf, i);
  22850. if (!this.lastNeed) return buf.toString("utf8", i);
  22851. this.lastTotal = total;
  22852. var end = buf.length - (total - this.lastNeed);
  22853. buf.copy(this.lastChar, 0, end);
  22854. return buf.toString("utf8", i, end);
  22855. }
  22856. function utf8End(buf) {
  22857. var r = buf && buf.length ? this.write(buf) : "";
  22858. if (this.lastNeed) return r + "�";
  22859. return r;
  22860. }
  22861. function utf16Text(buf, i) {
  22862. if ((buf.length - i) % 2 === 0) {
  22863. var r = buf.toString("utf16le", i);
  22864. if (r) {
  22865. var c = r.charCodeAt(r.length - 1);
  22866. if (c >= 55296 && c <= 56319) {
  22867. this.lastNeed = 2;
  22868. this.lastTotal = 4;
  22869. this.lastChar[0] = buf[buf.length - 2];
  22870. this.lastChar[1] = buf[buf.length - 1];
  22871. return r.slice(0, -1);
  22872. }
  22873. }
  22874. return r;
  22875. }
  22876. this.lastNeed = 1;
  22877. this.lastTotal = 2;
  22878. this.lastChar[0] = buf[buf.length - 1];
  22879. return buf.toString("utf16le", i, buf.length - 1);
  22880. }
  22881. function utf16End(buf) {
  22882. var r = buf && buf.length ? this.write(buf) : "";
  22883. if (this.lastNeed) {
  22884. var end = this.lastTotal - this.lastNeed;
  22885. return r + this.lastChar.toString("utf16le", 0, end);
  22886. }
  22887. return r;
  22888. }
  22889. function base64Text(buf, i) {
  22890. var n = (buf.length - i) % 3;
  22891. if (n === 0) return buf.toString("base64", i);
  22892. this.lastNeed = 3 - n;
  22893. this.lastTotal = 3;
  22894. if (n === 1) {
  22895. this.lastChar[0] = buf[buf.length - 1];
  22896. } else {
  22897. this.lastChar[0] = buf[buf.length - 2];
  22898. this.lastChar[1] = buf[buf.length - 1];
  22899. }
  22900. return buf.toString("base64", i, buf.length - n);
  22901. }
  22902. function base64End(buf) {
  22903. var r = buf && buf.length ? this.write(buf) : "";
  22904. if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
  22905. return r;
  22906. }
  22907. function simpleWrite(buf) {
  22908. return buf.toString(this.encoding);
  22909. }
  22910. function simpleEnd(buf) {
  22911. return buf && buf.length ? this.write(buf) : "";
  22912. }
  22913. }, {
  22914. "safe-buffer": 110
  22915. }],
  22916. 108: [function (require, module, exports) {
  22917. exports = module.exports = require("./lib/_stream_readable.js");
  22918. exports.Stream = exports;
  22919. exports.Readable = exports;
  22920. exports.Writable = require("./lib/_stream_writable.js");
  22921. exports.Duplex = require("./lib/_stream_duplex.js");
  22922. exports.Transform = require("./lib/_stream_transform.js");
  22923. exports.PassThrough = require("./lib/_stream_passthrough.js");
  22924. }, {
  22925. "./lib/_stream_duplex.js": 98,
  22926. "./lib/_stream_passthrough.js": 99,
  22927. "./lib/_stream_readable.js": 100,
  22928. "./lib/_stream_transform.js": 101,
  22929. "./lib/_stream_writable.js": 102
  22930. }],
  22931. 109: [function (require, module, exports) {
  22932. "use strict";
  22933. function ReInterval(callback, interval, args) {
  22934. var self = this;
  22935. this._callback = callback;
  22936. this._args = args;
  22937. this._interval = setInterval(callback, interval, this._args);
  22938. this.reschedule = function (interval) {
  22939. if (!interval) interval = self._interval;
  22940. if (self._interval) clearInterval(self._interval);
  22941. self._interval = setInterval(self._callback, interval, self._args);
  22942. };
  22943. this.clear = function () {
  22944. if (self._interval) {
  22945. clearInterval(self._interval);
  22946. self._interval = undefined;
  22947. }
  22948. };
  22949. this.destroy = function () {
  22950. if (self._interval) {
  22951. clearInterval(self._interval);
  22952. }
  22953. self._callback = undefined;
  22954. self._interval = undefined;
  22955. self._args = undefined;
  22956. };
  22957. }
  22958. function reInterval() {
  22959. if (typeof arguments[0] !== "function") throw new Error("callback needed");
  22960. if (typeof arguments[1] !== "number") throw new Error("interval needed");
  22961. var args;
  22962. if (arguments.length > 0) {
  22963. args = new Array(arguments.length - 2);
  22964. for (var i = 0; i < args.length; i++) {
  22965. args[i] = arguments[i + 2];
  22966. }
  22967. }
  22968. return new ReInterval(arguments[0], arguments[1], args);
  22969. }
  22970. module.exports = reInterval;
  22971. }, {}],
  22972. 110: [function (require, module, exports) {
  22973. var buffer = require("buffer");
  22974. var Buffer = buffer.Buffer;
  22975. function copyProps(src, dst) {
  22976. for (var key in src) {
  22977. dst[key] = src[key];
  22978. }
  22979. }
  22980. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  22981. module.exports = buffer;
  22982. } else {
  22983. copyProps(buffer, exports);
  22984. exports.Buffer = SafeBuffer;
  22985. }
  22986. function SafeBuffer(arg, encodingOrOffset, length) {
  22987. return Buffer(arg, encodingOrOffset, length);
  22988. }
  22989. copyProps(Buffer, SafeBuffer);
  22990. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  22991. if (typeof arg === "number") {
  22992. throw new TypeError("Argument must not be a number");
  22993. }
  22994. return Buffer(arg, encodingOrOffset, length);
  22995. };
  22996. SafeBuffer.alloc = function (size, fill, encoding) {
  22997. if (typeof size !== "number") {
  22998. throw new TypeError("Argument must be a number");
  22999. }
  23000. var buf = Buffer(size);
  23001. if (fill !== undefined) {
  23002. if (typeof encoding === "string") {
  23003. buf.fill(fill, encoding);
  23004. } else {
  23005. buf.fill(fill);
  23006. }
  23007. } else {
  23008. buf.fill(0);
  23009. }
  23010. return buf;
  23011. };
  23012. SafeBuffer.allocUnsafe = function (size) {
  23013. if (typeof size !== "number") {
  23014. throw new TypeError("Argument must be a number");
  23015. }
  23016. return Buffer(size);
  23017. };
  23018. SafeBuffer.allocUnsafeSlow = function (size) {
  23019. if (typeof size !== "number") {
  23020. throw new TypeError("Argument must be a number");
  23021. }
  23022. return buffer.SlowBuffer(size);
  23023. };
  23024. }, {
  23025. buffer: 12
  23026. }],
  23027. 111: [function (require, module, exports) {
  23028. module.exports = shift;
  23029. function shift(stream) {
  23030. var rs = stream._readableState;
  23031. if (!rs) return null;
  23032. return rs.objectMode ? stream.read() : stream.read(getStateLength(rs));
  23033. }
  23034. function getStateLength(state) {
  23035. if (state.buffer.length) {
  23036. if (state.buffer.head) {
  23037. return state.buffer.head.data.length;
  23038. }
  23039. return state.buffer[0].length;
  23040. }
  23041. return state.length;
  23042. }
  23043. }, {}],
  23044. 112: [function (require, module, exports) {
  23045. (function (setImmediate, clearImmediate) {
  23046. var nextTick = require("process/browser.js").nextTick;
  23047. var apply = Function.prototype.apply;
  23048. var slice = Array.prototype.slice;
  23049. var immediateIds = {};
  23050. var nextImmediateId = 0;
  23051. exports.setTimeout = function () {
  23052. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  23053. };
  23054. exports.setInterval = function () {
  23055. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  23056. };
  23057. exports.clearTimeout = exports.clearInterval = function (timeout) {
  23058. timeout.close();
  23059. };
  23060. function Timeout(id, clearFn) {
  23061. this._id = id;
  23062. this._clearFn = clearFn;
  23063. }
  23064. Timeout.prototype.unref = Timeout.prototype.ref = function () {};
  23065. Timeout.prototype.close = function () {
  23066. this._clearFn.call(window, this._id);
  23067. };
  23068. exports.enroll = function (item, msecs) {
  23069. clearTimeout(item._idleTimeoutId);
  23070. item._idleTimeout = msecs;
  23071. };
  23072. exports.unenroll = function (item) {
  23073. clearTimeout(item._idleTimeoutId);
  23074. item._idleTimeout = -1;
  23075. };
  23076. exports._unrefActive = exports.active = function (item) {
  23077. clearTimeout(item._idleTimeoutId);
  23078. var msecs = item._idleTimeout;
  23079. if (msecs >= 0) {
  23080. item._idleTimeoutId = setTimeout(function onTimeout() {
  23081. if (item._onTimeout) item._onTimeout();
  23082. }, msecs);
  23083. }
  23084. };
  23085. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function (fn) {
  23086. var id = nextImmediateId++;
  23087. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  23088. immediateIds[id] = true;
  23089. nextTick(function onNextTick() {
  23090. if (immediateIds[id]) {
  23091. if (args) {
  23092. fn.apply(null, args);
  23093. } else {
  23094. fn.call(null);
  23095. }
  23096. exports.clearImmediate(id);
  23097. }
  23098. });
  23099. return id;
  23100. };
  23101. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function (id) {
  23102. delete immediateIds[id];
  23103. };
  23104. }).call(this, require("timers").setImmediate, require("timers").clearImmediate);
  23105. }, {
  23106. "process/browser.js": 92,
  23107. timers: 112
  23108. }],
  23109. 113: [function (require, module, exports) {
  23110. "use strict";
  23111. var punycode = require("punycode");
  23112. var util = require("./util");
  23113. exports.parse = urlParse;
  23114. exports.resolve = urlResolve;
  23115. exports.resolveObject = urlResolveObject;
  23116. exports.format = urlFormat;
  23117. exports.Url = Url;
  23118. function Url() {
  23119. this.protocol = null;
  23120. this.slashes = null;
  23121. this.auth = null;
  23122. this.host = null;
  23123. this.port = null;
  23124. this.hostname = null;
  23125. this.hash = null;
  23126. this.search = null;
  23127. this.query = null;
  23128. this.pathname = null;
  23129. this.path = null;
  23130. this.href = null;
  23131. }
  23132. var protocolPattern = /^([a-z0-9.+-]+:)/i,
  23133. portPattern = /:[0-9]*$/,
  23134. simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
  23135. delims = ["<", ">", '"', "`", " ", "\r", "\n", "\t"],
  23136. unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims),
  23137. autoEscape = ["'"].concat(unwise),
  23138. nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape),
  23139. hostEndingChars = ["/", "?", "#"],
  23140. hostnameMaxLen = 255,
  23141. hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
  23142. hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
  23143. unsafeProtocol = {
  23144. javascript: true,
  23145. "javascript:": true
  23146. },
  23147. hostlessProtocol = {
  23148. javascript: true,
  23149. "javascript:": true
  23150. },
  23151. slashedProtocol = {
  23152. http: true,
  23153. https: true,
  23154. ftp: true,
  23155. gopher: true,
  23156. file: true,
  23157. "http:": true,
  23158. "https:": true,
  23159. "ftp:": true,
  23160. "gopher:": true,
  23161. "file:": true
  23162. },
  23163. querystring = require("querystring");
  23164. function urlParse(url, parseQueryString, slashesDenoteHost) {
  23165. if (url && util.isObject(url) && url instanceof Url) return url;
  23166. var u = new Url();
  23167. u.parse(url, parseQueryString, slashesDenoteHost);
  23168. return u;
  23169. }
  23170. Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
  23171. if (!util.isString(url)) {
  23172. throw new TypeError("Parameter 'url' must be a string, not " + _typeof(url));
  23173. }
  23174. var queryIndex = url.indexOf("?"),
  23175. splitter = queryIndex !== -1 && queryIndex < url.indexOf("#") ? "?" : "#",
  23176. uSplit = url.split(splitter),
  23177. slashRegex = /\\/g;
  23178. uSplit[0] = uSplit[0].replace(slashRegex, "/");
  23179. url = uSplit.join(splitter);
  23180. var rest = url;
  23181. rest = rest.trim();
  23182. if (!slashesDenoteHost && url.split("#").length === 1) {
  23183. var simplePath = simplePathPattern.exec(rest);
  23184. if (simplePath) {
  23185. this.path = rest;
  23186. this.href = rest;
  23187. this.pathname = simplePath[1];
  23188. if (simplePath[2]) {
  23189. this.search = simplePath[2];
  23190. if (parseQueryString) {
  23191. this.query = querystring.parse(this.search.substr(1));
  23192. } else {
  23193. this.query = this.search.substr(1);
  23194. }
  23195. } else if (parseQueryString) {
  23196. this.search = "";
  23197. this.query = {};
  23198. }
  23199. return this;
  23200. }
  23201. }
  23202. var proto = protocolPattern.exec(rest);
  23203. if (proto) {
  23204. proto = proto[0];
  23205. var lowerProto = proto.toLowerCase();
  23206. this.protocol = lowerProto;
  23207. rest = rest.substr(proto.length);
  23208. }
  23209. if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  23210. var slashes = rest.substr(0, 2) === "//";
  23211. if (slashes && !(proto && hostlessProtocol[proto])) {
  23212. rest = rest.substr(2);
  23213. this.slashes = true;
  23214. }
  23215. }
  23216. if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
  23217. var hostEnd = -1;
  23218. for (var i = 0; i < hostEndingChars.length; i++) {
  23219. var hec = rest.indexOf(hostEndingChars[i]);
  23220. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
  23221. }
  23222. var auth, atSign;
  23223. if (hostEnd === -1) {
  23224. atSign = rest.lastIndexOf("@");
  23225. } else {
  23226. atSign = rest.lastIndexOf("@", hostEnd);
  23227. }
  23228. if (atSign !== -1) {
  23229. auth = rest.slice(0, atSign);
  23230. rest = rest.slice(atSign + 1);
  23231. this.auth = decodeURIComponent(auth);
  23232. }
  23233. hostEnd = -1;
  23234. for (var i = 0; i < nonHostChars.length; i++) {
  23235. var hec = rest.indexOf(nonHostChars[i]);
  23236. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
  23237. }
  23238. if (hostEnd === -1) hostEnd = rest.length;
  23239. this.host = rest.slice(0, hostEnd);
  23240. rest = rest.slice(hostEnd);
  23241. this.parseHost();
  23242. this.hostname = this.hostname || "";
  23243. var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
  23244. if (!ipv6Hostname) {
  23245. var hostparts = this.hostname.split(/\./);
  23246. for (var i = 0, l = hostparts.length; i < l; i++) {
  23247. var part = hostparts[i];
  23248. if (!part) continue;
  23249. if (!part.match(hostnamePartPattern)) {
  23250. var newpart = "";
  23251. for (var j = 0, k = part.length; j < k; j++) {
  23252. if (part.charCodeAt(j) > 127) {
  23253. newpart += "x";
  23254. } else {
  23255. newpart += part[j];
  23256. }
  23257. }
  23258. if (!newpart.match(hostnamePartPattern)) {
  23259. var validParts = hostparts.slice(0, i);
  23260. var notHost = hostparts.slice(i + 1);
  23261. var bit = part.match(hostnamePartStart);
  23262. if (bit) {
  23263. validParts.push(bit[1]);
  23264. notHost.unshift(bit[2]);
  23265. }
  23266. if (notHost.length) {
  23267. rest = "/" + notHost.join(".") + rest;
  23268. }
  23269. this.hostname = validParts.join(".");
  23270. break;
  23271. }
  23272. }
  23273. }
  23274. }
  23275. if (this.hostname.length > hostnameMaxLen) {
  23276. this.hostname = "";
  23277. } else {
  23278. this.hostname = this.hostname.toLowerCase();
  23279. }
  23280. if (!ipv6Hostname) {
  23281. this.hostname = punycode.toASCII(this.hostname);
  23282. }
  23283. var p = this.port ? ":" + this.port : "";
  23284. var h = this.hostname || "";
  23285. this.host = h + p;
  23286. this.href += this.host;
  23287. if (ipv6Hostname) {
  23288. this.hostname = this.hostname.substr(1, this.hostname.length - 2);
  23289. if (rest[0] !== "/") {
  23290. rest = "/" + rest;
  23291. }
  23292. }
  23293. }
  23294. if (!unsafeProtocol[lowerProto]) {
  23295. for (var i = 0, l = autoEscape.length; i < l; i++) {
  23296. var ae = autoEscape[i];
  23297. if (rest.indexOf(ae) === -1) continue;
  23298. var esc = encodeURIComponent(ae);
  23299. if (esc === ae) {
  23300. esc = escape(ae);
  23301. }
  23302. rest = rest.split(ae).join(esc);
  23303. }
  23304. }
  23305. var hash = rest.indexOf("#");
  23306. if (hash !== -1) {
  23307. this.hash = rest.substr(hash);
  23308. rest = rest.slice(0, hash);
  23309. }
  23310. var qm = rest.indexOf("?");
  23311. if (qm !== -1) {
  23312. this.search = rest.substr(qm);
  23313. this.query = rest.substr(qm + 1);
  23314. if (parseQueryString) {
  23315. this.query = querystring.parse(this.query);
  23316. }
  23317. rest = rest.slice(0, qm);
  23318. } else if (parseQueryString) {
  23319. this.search = "";
  23320. this.query = {};
  23321. }
  23322. if (rest) this.pathname = rest;
  23323. if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
  23324. this.pathname = "/";
  23325. }
  23326. if (this.pathname || this.search) {
  23327. var p = this.pathname || "";
  23328. var s = this.search || "";
  23329. this.path = p + s;
  23330. }
  23331. this.href = this.format();
  23332. return this;
  23333. };
  23334. function urlFormat(obj) {
  23335. if (util.isString(obj)) obj = urlParse(obj);
  23336. if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
  23337. return obj.format();
  23338. }
  23339. Url.prototype.format = function () {
  23340. var auth = this.auth || "";
  23341. if (auth) {
  23342. auth = encodeURIComponent(auth);
  23343. auth = auth.replace(/%3A/i, ":");
  23344. auth += "@";
  23345. }
  23346. var protocol = this.protocol || "",
  23347. pathname = this.pathname || "",
  23348. hash = this.hash || "",
  23349. host = false,
  23350. query = "";
  23351. if (this.host) {
  23352. host = auth + this.host;
  23353. } else if (this.hostname) {
  23354. host = auth + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]");
  23355. if (this.port) {
  23356. host += ":" + this.port;
  23357. }
  23358. }
  23359. if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
  23360. query = querystring.stringify(this.query);
  23361. }
  23362. var search = this.search || query && "?" + query || "";
  23363. if (protocol && protocol.substr(-1) !== ":") protocol += ":";
  23364. if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
  23365. host = "//" + (host || "");
  23366. if (pathname && pathname.charAt(0) !== "/") pathname = "/" + pathname;
  23367. } else if (!host) {
  23368. host = "";
  23369. }
  23370. if (hash && hash.charAt(0) !== "#") hash = "#" + hash;
  23371. if (search && search.charAt(0) !== "?") search = "?" + search;
  23372. pathname = pathname.replace(/[?#]/g, function (match) {
  23373. return encodeURIComponent(match);
  23374. });
  23375. search = search.replace("#", "%23");
  23376. return protocol + host + pathname + search + hash;
  23377. };
  23378. function urlResolve(source, relative) {
  23379. return urlParse(source, false, true).resolve(relative);
  23380. }
  23381. Url.prototype.resolve = function (relative) {
  23382. return this.resolveObject(urlParse(relative, false, true)).format();
  23383. };
  23384. function urlResolveObject(source, relative) {
  23385. if (!source) return relative;
  23386. return urlParse(source, false, true).resolveObject(relative);
  23387. }
  23388. Url.prototype.resolveObject = function (relative) {
  23389. if (util.isString(relative)) {
  23390. var rel = new Url();
  23391. rel.parse(relative, false, true);
  23392. relative = rel;
  23393. }
  23394. var result = new Url();
  23395. var tkeys = Object.keys(this);
  23396. for (var tk = 0; tk < tkeys.length; tk++) {
  23397. var tkey = tkeys[tk];
  23398. result[tkey] = this[tkey];
  23399. }
  23400. result.hash = relative.hash;
  23401. if (relative.href === "") {
  23402. result.href = result.format();
  23403. return result;
  23404. }
  23405. if (relative.slashes && !relative.protocol) {
  23406. var rkeys = Object.keys(relative);
  23407. for (var rk = 0; rk < rkeys.length; rk++) {
  23408. var rkey = rkeys[rk];
  23409. if (rkey !== "protocol") result[rkey] = relative[rkey];
  23410. }
  23411. if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
  23412. result.path = result.pathname = "/";
  23413. }
  23414. result.href = result.format();
  23415. return result;
  23416. }
  23417. if (relative.protocol && relative.protocol !== result.protocol) {
  23418. if (!slashedProtocol[relative.protocol]) {
  23419. var keys = Object.keys(relative);
  23420. for (var v = 0; v < keys.length; v++) {
  23421. var k = keys[v];
  23422. result[k] = relative[k];
  23423. }
  23424. result.href = result.format();
  23425. return result;
  23426. }
  23427. result.protocol = relative.protocol;
  23428. if (!relative.host && !hostlessProtocol[relative.protocol]) {
  23429. var relPath = (relative.pathname || "").split("/");
  23430. while (relPath.length && !(relative.host = relPath.shift())) {
  23431. ;
  23432. }
  23433. if (!relative.host) relative.host = "";
  23434. if (!relative.hostname) relative.hostname = "";
  23435. if (relPath[0] !== "") relPath.unshift("");
  23436. if (relPath.length < 2) relPath.unshift("");
  23437. result.pathname = relPath.join("/");
  23438. } else {
  23439. result.pathname = relative.pathname;
  23440. }
  23441. result.search = relative.search;
  23442. result.query = relative.query;
  23443. result.host = relative.host || "";
  23444. result.auth = relative.auth;
  23445. result.hostname = relative.hostname || relative.host;
  23446. result.port = relative.port;
  23447. if (result.pathname || result.search) {
  23448. var p = result.pathname || "";
  23449. var s = result.search || "";
  23450. result.path = p + s;
  23451. }
  23452. result.slashes = result.slashes || relative.slashes;
  23453. result.href = result.format();
  23454. return result;
  23455. }
  23456. var isSourceAbs = result.pathname && result.pathname.charAt(0) === "/",
  23457. isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === "/",
  23458. mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
  23459. removeAllDots = mustEndAbs,
  23460. srcPath = result.pathname && result.pathname.split("/") || [],
  23461. relPath = relative.pathname && relative.pathname.split("/") || [],
  23462. psychotic = result.protocol && !slashedProtocol[result.protocol];
  23463. if (psychotic) {
  23464. result.hostname = "";
  23465. result.port = null;
  23466. if (result.host) {
  23467. if (srcPath[0] === "") srcPath[0] = result.host;else srcPath.unshift(result.host);
  23468. }
  23469. result.host = "";
  23470. if (relative.protocol) {
  23471. relative.hostname = null;
  23472. relative.port = null;
  23473. if (relative.host) {
  23474. if (relPath[0] === "") relPath[0] = relative.host;else relPath.unshift(relative.host);
  23475. }
  23476. relative.host = null;
  23477. }
  23478. mustEndAbs = mustEndAbs && (relPath[0] === "" || srcPath[0] === "");
  23479. }
  23480. if (isRelAbs) {
  23481. result.host = relative.host || relative.host === "" ? relative.host : result.host;
  23482. result.hostname = relative.hostname || relative.hostname === "" ? relative.hostname : result.hostname;
  23483. result.search = relative.search;
  23484. result.query = relative.query;
  23485. srcPath = relPath;
  23486. } else if (relPath.length) {
  23487. if (!srcPath) srcPath = [];
  23488. srcPath.pop();
  23489. srcPath = srcPath.concat(relPath);
  23490. result.search = relative.search;
  23491. result.query = relative.query;
  23492. } else if (!util.isNullOrUndefined(relative.search)) {
  23493. if (psychotic) {
  23494. result.hostname = result.host = srcPath.shift();
  23495. var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
  23496. if (authInHost) {
  23497. result.auth = authInHost.shift();
  23498. result.host = result.hostname = authInHost.shift();
  23499. }
  23500. }
  23501. result.search = relative.search;
  23502. result.query = relative.query;
  23503. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  23504. result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
  23505. }
  23506. result.href = result.format();
  23507. return result;
  23508. }
  23509. if (!srcPath.length) {
  23510. result.pathname = null;
  23511. if (result.search) {
  23512. result.path = "/" + result.search;
  23513. } else {
  23514. result.path = null;
  23515. }
  23516. result.href = result.format();
  23517. return result;
  23518. }
  23519. var last = srcPath.slice(-1)[0];
  23520. var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..") || last === "";
  23521. var up = 0;
  23522. for (var i = srcPath.length; i >= 0; i--) {
  23523. last = srcPath[i];
  23524. if (last === ".") {
  23525. srcPath.splice(i, 1);
  23526. } else if (last === "..") {
  23527. srcPath.splice(i, 1);
  23528. up++;
  23529. } else if (up) {
  23530. srcPath.splice(i, 1);
  23531. up--;
  23532. }
  23533. }
  23534. if (!mustEndAbs && !removeAllDots) {
  23535. for (; up--; up) {
  23536. srcPath.unshift("..");
  23537. }
  23538. }
  23539. if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) {
  23540. srcPath.unshift("");
  23541. }
  23542. if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") {
  23543. srcPath.push("");
  23544. }
  23545. var isAbsolute = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
  23546. if (psychotic) {
  23547. result.hostname = result.host = isAbsolute ? "" : srcPath.length ? srcPath.shift() : "";
  23548. var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
  23549. if (authInHost) {
  23550. result.auth = authInHost.shift();
  23551. result.host = result.hostname = authInHost.shift();
  23552. }
  23553. }
  23554. mustEndAbs = mustEndAbs || result.host && srcPath.length;
  23555. if (mustEndAbs && !isAbsolute) {
  23556. srcPath.unshift("");
  23557. }
  23558. if (!srcPath.length) {
  23559. result.pathname = null;
  23560. result.path = null;
  23561. } else {
  23562. result.pathname = srcPath.join("/");
  23563. }
  23564. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  23565. result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
  23566. }
  23567. result.auth = relative.auth || result.auth;
  23568. result.slashes = result.slashes || relative.slashes;
  23569. result.href = result.format();
  23570. return result;
  23571. };
  23572. Url.prototype.parseHost = function () {
  23573. var host = this.host;
  23574. var port = portPattern.exec(host);
  23575. if (port) {
  23576. port = port[0];
  23577. if (port !== ":") {
  23578. this.port = port.substr(1);
  23579. }
  23580. host = host.substr(0, host.length - port.length);
  23581. }
  23582. if (host) this.hostname = host;
  23583. };
  23584. }, {
  23585. "./util": 114,
  23586. punycode: 93,
  23587. querystring: 96
  23588. }],
  23589. 114: [function (require, module, exports) {
  23590. "use strict";
  23591. module.exports = {
  23592. isString: function isString(arg) {
  23593. return typeof arg === "string";
  23594. },
  23595. isObject: function isObject(arg) {
  23596. return _typeof(arg) === "object" && arg !== null;
  23597. },
  23598. isNull: function isNull(arg) {
  23599. return arg === null;
  23600. },
  23601. isNullOrUndefined: function isNullOrUndefined(arg) {
  23602. return arg == null;
  23603. }
  23604. };
  23605. }, {}],
  23606. 115: [function (require, module, exports) {
  23607. (function (global) {
  23608. module.exports = deprecate;
  23609. function deprecate(fn, msg) {
  23610. if (config("noDeprecation")) {
  23611. return fn;
  23612. }
  23613. var warned = false;
  23614. function deprecated() {
  23615. if (!warned) {
  23616. if (config("throwDeprecation")) {
  23617. throw new Error(msg);
  23618. } else if (config("traceDeprecation")) {
  23619. console.trace(msg);
  23620. } else {
  23621. console.warn(msg);
  23622. }
  23623. warned = true;
  23624. }
  23625. return fn.apply(this, arguments);
  23626. }
  23627. return deprecated;
  23628. }
  23629. function config(name) {
  23630. try {
  23631. if (!global.localStorage) return false;
  23632. } catch (_) {
  23633. return false;
  23634. }
  23635. var val = global.localStorage[name];
  23636. if (null == val) return false;
  23637. return String(val).toLowerCase() === "true";
  23638. }
  23639. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  23640. }, {}],
  23641. 116: [function (require, module, exports) {
  23642. module.exports = function isBuffer(arg) {
  23643. return arg && _typeof(arg) === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
  23644. };
  23645. }, {}],
  23646. 117: [function (require, module, exports) {
  23647. (function (process, global) {
  23648. var formatRegExp = /%[sdj%]/g;
  23649. exports.format = function (f) {
  23650. if (!isString(f)) {
  23651. var objects = [];
  23652. for (var i = 0; i < arguments.length; i++) {
  23653. objects.push(inspect(arguments[i]));
  23654. }
  23655. return objects.join(" ");
  23656. }
  23657. var i = 1;
  23658. var args = arguments;
  23659. var len = args.length;
  23660. var str = String(f).replace(formatRegExp, function (x) {
  23661. if (x === "%%") return "%";
  23662. if (i >= len) return x;
  23663. switch (x) {
  23664. case "%s":
  23665. return String(args[i++]);
  23666. case "%d":
  23667. return Number(args[i++]);
  23668. case "%j":
  23669. try {
  23670. return JSON.stringify(args[i++]);
  23671. } catch (_) {
  23672. return "[Circular]";
  23673. }
  23674. default:
  23675. return x;
  23676. }
  23677. });
  23678. for (var x = args[i]; i < len; x = args[++i]) {
  23679. if (isNull(x) || !isObject(x)) {
  23680. str += " " + x;
  23681. } else {
  23682. str += " " + inspect(x);
  23683. }
  23684. }
  23685. return str;
  23686. };
  23687. exports.deprecate = function (fn, msg) {
  23688. if (isUndefined(global.process)) {
  23689. return function () {
  23690. return exports.deprecate(fn, msg).apply(this, arguments);
  23691. };
  23692. }
  23693. if (process.noDeprecation === true) {
  23694. return fn;
  23695. }
  23696. var warned = false;
  23697. function deprecated() {
  23698. if (!warned) {
  23699. if (process.throwDeprecation) {
  23700. throw new Error(msg);
  23701. } else if (process.traceDeprecation) {
  23702. console.trace(msg);
  23703. } else {
  23704. console.error(msg);
  23705. }
  23706. warned = true;
  23707. }
  23708. return fn.apply(this, arguments);
  23709. }
  23710. return deprecated;
  23711. };
  23712. var debugs = {};
  23713. var debugEnviron;
  23714. exports.debuglog = function (set) {
  23715. if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || "";
  23716. set = set.toUpperCase();
  23717. if (!debugs[set]) {
  23718. if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
  23719. var pid = process.pid;
  23720. debugs[set] = function () {
  23721. var msg = exports.format.apply(exports, arguments);
  23722. console.error("%s %d: %s", set, pid, msg);
  23723. };
  23724. } else {
  23725. debugs[set] = function () {};
  23726. }
  23727. }
  23728. return debugs[set];
  23729. };
  23730. function inspect(obj, opts) {
  23731. var ctx = {
  23732. seen: [],
  23733. stylize: stylizeNoColor
  23734. };
  23735. if (arguments.length >= 3) ctx.depth = arguments[2];
  23736. if (arguments.length >= 4) ctx.colors = arguments[3];
  23737. if (isBoolean(opts)) {
  23738. ctx.showHidden = opts;
  23739. } else if (opts) {
  23740. exports._extend(ctx, opts);
  23741. }
  23742. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  23743. if (isUndefined(ctx.depth)) ctx.depth = 2;
  23744. if (isUndefined(ctx.colors)) ctx.colors = false;
  23745. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  23746. if (ctx.colors) ctx.stylize = stylizeWithColor;
  23747. return formatValue(ctx, obj, ctx.depth);
  23748. }
  23749. exports.inspect = inspect;
  23750. inspect.colors = {
  23751. bold: [1, 22],
  23752. italic: [3, 23],
  23753. underline: [4, 24],
  23754. inverse: [7, 27],
  23755. white: [37, 39],
  23756. grey: [90, 39],
  23757. black: [30, 39],
  23758. blue: [34, 39],
  23759. cyan: [36, 39],
  23760. green: [32, 39],
  23761. magenta: [35, 39],
  23762. red: [31, 39],
  23763. yellow: [33, 39]
  23764. };
  23765. inspect.styles = {
  23766. special: "cyan",
  23767. number: "yellow",
  23768. boolean: "yellow",
  23769. undefined: "grey",
  23770. null: "bold",
  23771. string: "green",
  23772. date: "magenta",
  23773. regexp: "red"
  23774. };
  23775. function stylizeWithColor(str, styleType) {
  23776. var style = inspect.styles[styleType];
  23777. if (style) {
  23778. return "[" + inspect.colors[style][0] + "m" + str + "[" + inspect.colors[style][1] + "m";
  23779. } else {
  23780. return str;
  23781. }
  23782. }
  23783. function stylizeNoColor(str, styleType) {
  23784. return str;
  23785. }
  23786. function arrayToHash(array) {
  23787. var hash = {};
  23788. array.forEach(function (val, idx) {
  23789. hash[val] = true;
  23790. });
  23791. return hash;
  23792. }
  23793. function formatValue(ctx, value, recurseTimes) {
  23794. if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) {
  23795. var ret = value.inspect(recurseTimes, ctx);
  23796. if (!isString(ret)) {
  23797. ret = formatValue(ctx, ret, recurseTimes);
  23798. }
  23799. return ret;
  23800. }
  23801. var primitive = formatPrimitive(ctx, value);
  23802. if (primitive) {
  23803. return primitive;
  23804. }
  23805. var keys = Object.keys(value);
  23806. var visibleKeys = arrayToHash(keys);
  23807. if (ctx.showHidden) {
  23808. keys = Object.getOwnPropertyNames(value);
  23809. }
  23810. if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
  23811. return formatError(value);
  23812. }
  23813. if (keys.length === 0) {
  23814. if (isFunction(value)) {
  23815. var name = value.name ? ": " + value.name : "";
  23816. return ctx.stylize("[Function" + name + "]", "special");
  23817. }
  23818. if (isRegExp(value)) {
  23819. return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
  23820. }
  23821. if (isDate(value)) {
  23822. return ctx.stylize(Date.prototype.toString.call(value), "date");
  23823. }
  23824. if (isError(value)) {
  23825. return formatError(value);
  23826. }
  23827. }
  23828. var base = "",
  23829. array = false,
  23830. braces = ["{", "}"];
  23831. if (isArray(value)) {
  23832. array = true;
  23833. braces = ["[", "]"];
  23834. }
  23835. if (isFunction(value)) {
  23836. var n = value.name ? ": " + value.name : "";
  23837. base = " [Function" + n + "]";
  23838. }
  23839. if (isRegExp(value)) {
  23840. base = " " + RegExp.prototype.toString.call(value);
  23841. }
  23842. if (isDate(value)) {
  23843. base = " " + Date.prototype.toUTCString.call(value);
  23844. }
  23845. if (isError(value)) {
  23846. base = " " + formatError(value);
  23847. }
  23848. if (keys.length === 0 && (!array || value.length == 0)) {
  23849. return braces[0] + base + braces[1];
  23850. }
  23851. if (recurseTimes < 0) {
  23852. if (isRegExp(value)) {
  23853. return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
  23854. } else {
  23855. return ctx.stylize("[Object]", "special");
  23856. }
  23857. }
  23858. ctx.seen.push(value);
  23859. var output;
  23860. if (array) {
  23861. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  23862. } else {
  23863. output = keys.map(function (key) {
  23864. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  23865. });
  23866. }
  23867. ctx.seen.pop();
  23868. return reduceToSingleString(output, base, braces);
  23869. }
  23870. function formatPrimitive(ctx, value) {
  23871. if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
  23872. if (isString(value)) {
  23873. var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
  23874. return ctx.stylize(simple, "string");
  23875. }
  23876. if (isNumber(value)) return ctx.stylize("" + value, "number");
  23877. if (isBoolean(value)) return ctx.stylize("" + value, "boolean");
  23878. if (isNull(value)) return ctx.stylize("null", "null");
  23879. }
  23880. function formatError(value) {
  23881. return "[" + Error.prototype.toString.call(value) + "]";
  23882. }
  23883. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  23884. var output = [];
  23885. for (var i = 0, l = value.length; i < l; ++i) {
  23886. if (hasOwnProperty(value, String(i))) {
  23887. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
  23888. } else {
  23889. output.push("");
  23890. }
  23891. }
  23892. keys.forEach(function (key) {
  23893. if (!key.match(/^\d+$/)) {
  23894. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
  23895. }
  23896. });
  23897. return output;
  23898. }
  23899. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  23900. var name, str, desc;
  23901. desc = Object.getOwnPropertyDescriptor(value, key) || {
  23902. value: value[key]
  23903. };
  23904. if (desc.get) {
  23905. if (desc.set) {
  23906. str = ctx.stylize("[Getter/Setter]", "special");
  23907. } else {
  23908. str = ctx.stylize("[Getter]", "special");
  23909. }
  23910. } else {
  23911. if (desc.set) {
  23912. str = ctx.stylize("[Setter]", "special");
  23913. }
  23914. }
  23915. if (!hasOwnProperty(visibleKeys, key)) {
  23916. name = "[" + key + "]";
  23917. }
  23918. if (!str) {
  23919. if (ctx.seen.indexOf(desc.value) < 0) {
  23920. if (isNull(recurseTimes)) {
  23921. str = formatValue(ctx, desc.value, null);
  23922. } else {
  23923. str = formatValue(ctx, desc.value, recurseTimes - 1);
  23924. }
  23925. if (str.indexOf("\n") > -1) {
  23926. if (array) {
  23927. str = str.split("\n").map(function (line) {
  23928. return " " + line;
  23929. }).join("\n").substr(2);
  23930. } else {
  23931. str = "\n" + str.split("\n").map(function (line) {
  23932. return " " + line;
  23933. }).join("\n");
  23934. }
  23935. }
  23936. } else {
  23937. str = ctx.stylize("[Circular]", "special");
  23938. }
  23939. }
  23940. if (isUndefined(name)) {
  23941. if (array && key.match(/^\d+$/)) {
  23942. return str;
  23943. }
  23944. name = JSON.stringify("" + key);
  23945. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  23946. name = name.substr(1, name.length - 2);
  23947. name = ctx.stylize(name, "name");
  23948. } else {
  23949. name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
  23950. name = ctx.stylize(name, "string");
  23951. }
  23952. }
  23953. return name + ": " + str;
  23954. }
  23955. function reduceToSingleString(output, base, braces) {
  23956. var numLinesEst = 0;
  23957. var length = output.reduce(function (prev, cur) {
  23958. numLinesEst++;
  23959. if (cur.indexOf("\n") >= 0) numLinesEst++;
  23960. return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
  23961. }, 0);
  23962. if (length > 60) {
  23963. return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
  23964. }
  23965. return braces[0] + base + " " + output.join(", ") + " " + braces[1];
  23966. }
  23967. function isArray(ar) {
  23968. return Array.isArray(ar);
  23969. }
  23970. exports.isArray = isArray;
  23971. function isBoolean(arg) {
  23972. return typeof arg === "boolean";
  23973. }
  23974. exports.isBoolean = isBoolean;
  23975. function isNull(arg) {
  23976. return arg === null;
  23977. }
  23978. exports.isNull = isNull;
  23979. function isNullOrUndefined(arg) {
  23980. return arg == null;
  23981. }
  23982. exports.isNullOrUndefined = isNullOrUndefined;
  23983. function isNumber(arg) {
  23984. return typeof arg === "number";
  23985. }
  23986. exports.isNumber = isNumber;
  23987. function isString(arg) {
  23988. return typeof arg === "string";
  23989. }
  23990. exports.isString = isString;
  23991. function isSymbol(arg) {
  23992. return _typeof(arg) === "symbol";
  23993. }
  23994. exports.isSymbol = isSymbol;
  23995. function isUndefined(arg) {
  23996. return arg === void 0;
  23997. }
  23998. exports.isUndefined = isUndefined;
  23999. function isRegExp(re) {
  24000. return isObject(re) && objectToString(re) === "[object RegExp]";
  24001. }
  24002. exports.isRegExp = isRegExp;
  24003. function isObject(arg) {
  24004. return _typeof(arg) === "object" && arg !== null;
  24005. }
  24006. exports.isObject = isObject;
  24007. function isDate(d) {
  24008. return isObject(d) && objectToString(d) === "[object Date]";
  24009. }
  24010. exports.isDate = isDate;
  24011. function isError(e) {
  24012. return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
  24013. }
  24014. exports.isError = isError;
  24015. function isFunction(arg) {
  24016. return typeof arg === "function";
  24017. }
  24018. exports.isFunction = isFunction;
  24019. function isPrimitive(arg) {
  24020. return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || _typeof(arg) === "symbol" || typeof arg === "undefined";
  24021. }
  24022. exports.isPrimitive = isPrimitive;
  24023. exports.isBuffer = require("./support/isBuffer");
  24024. function objectToString(o) {
  24025. return Object.prototype.toString.call(o);
  24026. }
  24027. function pad(n) {
  24028. return n < 10 ? "0" + n.toString(10) : n.toString(10);
  24029. }
  24030. var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  24031. function timestamp() {
  24032. var d = new Date();
  24033. var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
  24034. return [d.getDate(), months[d.getMonth()], time].join(" ");
  24035. }
  24036. exports.log = function () {
  24037. console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
  24038. };
  24039. exports.inherits = require("inherits");
  24040. exports._extend = function (origin, add) {
  24041. if (!add || !isObject(add)) return origin;
  24042. var keys = Object.keys(add);
  24043. var i = keys.length;
  24044. while (i--) {
  24045. origin[keys[i]] = add[keys[i]];
  24046. }
  24047. return origin;
  24048. };
  24049. function hasOwnProperty(obj, prop) {
  24050. return Object.prototype.hasOwnProperty.call(obj, prop);
  24051. }
  24052. }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  24053. }, {
  24054. "./support/isBuffer": 116,
  24055. _process: 92,
  24056. inherits: 80
  24057. }],
  24058. 118: [function (require, module, exports) {
  24059. (function (process, global) {
  24060. "use strict";
  24061. var Transform = require("readable-stream").Transform;
  24062. var duplexify = require("duplexify");
  24063. var WS = require("ws");
  24064. var Buffer = require("safe-buffer").Buffer;
  24065. module.exports = WebSocketStream;
  24066. function buildProxy(options, socketWrite, socketEnd) {
  24067. var proxy = new Transform({
  24068. objectMode: options.objectMode
  24069. });
  24070. proxy._write = socketWrite;
  24071. proxy._flush = socketEnd;
  24072. return proxy;
  24073. }
  24074. function WebSocketStream(target, protocols, options) {
  24075. var stream, socket;
  24076. var isBrowser = process.title === "browser";
  24077. var isNative = !!global.WebSocket;
  24078. var socketWrite = isBrowser ? socketWriteBrowser : socketWriteNode;
  24079. if (protocols && !Array.isArray(protocols) && "object" === _typeof(protocols)) {
  24080. options = protocols;
  24081. protocols = null;
  24082. if (typeof options.protocol === "string" || Array.isArray(options.protocol)) {
  24083. protocols = options.protocol;
  24084. }
  24085. }
  24086. if (!options) options = {};
  24087. if (options.objectMode === undefined) {
  24088. options.objectMode = !(options.binary === true || options.binary === undefined);
  24089. }
  24090. var proxy = buildProxy(options, socketWrite, socketEnd);
  24091. if (!options.objectMode) {
  24092. proxy._writev = writev;
  24093. }
  24094. var bufferSize = options.browserBufferSize || 1024 * 512;
  24095. var bufferTimeout = options.browserBufferTimeout || 1e3;
  24096. if (_typeof(target) === "object") {
  24097. socket = target;
  24098. } else {
  24099. if (isNative && isBrowser) {
  24100. socket = new WS(target, protocols);
  24101. } else {
  24102. socket = new WS(target, protocols, options);
  24103. }
  24104. socket.binaryType = "arraybuffer";
  24105. }
  24106. if (socket.readyState === socket.OPEN) {
  24107. stream = proxy;
  24108. } else {
  24109. stream = duplexify.obj();
  24110. socket.onopen = onopen;
  24111. }
  24112. stream.socket = socket;
  24113. socket.onclose = onclose;
  24114. socket.onerror = onerror;
  24115. socket.onmessage = onmessage;
  24116. proxy.on("close", destroy);
  24117. var coerceToBuffer = !options.objectMode;
  24118. function socketWriteNode(chunk, enc, next) {
  24119. if (socket.readyState !== socket.OPEN) {
  24120. next();
  24121. return;
  24122. }
  24123. if (coerceToBuffer && typeof chunk === "string") {
  24124. chunk = Buffer.from(chunk, "utf8");
  24125. }
  24126. socket.send(chunk, next);
  24127. }
  24128. function socketWriteBrowser(chunk, enc, next) {
  24129. if (socket.bufferedAmount > bufferSize) {
  24130. setTimeout(socketWriteBrowser, bufferTimeout, chunk, enc, next);
  24131. return;
  24132. }
  24133. if (coerceToBuffer && typeof chunk === "string") {
  24134. chunk = Buffer.from(chunk, "utf8");
  24135. }
  24136. try {
  24137. socket.send(chunk);
  24138. } catch (err) {
  24139. return next(err);
  24140. }
  24141. next();
  24142. }
  24143. function socketEnd(done) {
  24144. socket.close();
  24145. done();
  24146. }
  24147. function onopen() {
  24148. stream.setReadable(proxy);
  24149. stream.setWritable(proxy);
  24150. stream.emit("connect");
  24151. }
  24152. function onclose() {
  24153. stream.end();
  24154. stream.destroy();
  24155. }
  24156. function onerror(err) {
  24157. stream.destroy(err);
  24158. }
  24159. function onmessage(event) {
  24160. var data = event.data;
  24161. if (data instanceof ArrayBuffer) data = Buffer.from(data);else data = Buffer.from(data, "utf8");
  24162. proxy.push(data);
  24163. }
  24164. function destroy() {
  24165. socket.close();
  24166. }
  24167. function writev(chunks, cb) {
  24168. var buffers = new Array(chunks.length);
  24169. for (var i = 0; i < chunks.length; i++) {
  24170. if (typeof chunks[i].chunk === "string") {
  24171. buffers[i] = Buffer.from(chunks[i], "utf8");
  24172. } else {
  24173. buffers[i] = chunks[i].chunk;
  24174. }
  24175. }
  24176. this._write(Buffer.concat(buffers), "binary", cb);
  24177. }
  24178. return stream;
  24179. }
  24180. }).call(this, require("_process"), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  24181. }, {
  24182. _process: 92,
  24183. duplexify: 17,
  24184. "readable-stream": 108,
  24185. "safe-buffer": 110,
  24186. ws: 119
  24187. }],
  24188. 119: [function (require, module, exports) {
  24189. var ws = null;
  24190. if (typeof WebSocket !== "undefined") {
  24191. ws = WebSocket;
  24192. } else if (typeof MozWebSocket !== "undefined") {
  24193. ws = MozWebSocket;
  24194. } else if (typeof window !== "undefined") {
  24195. ws = window.WebSocket || window.MozWebSocket;
  24196. }
  24197. module.exports = ws;
  24198. }, {}],
  24199. 120: [function (require, module, exports) {
  24200. module.exports = wrappy;
  24201. function wrappy(fn, cb) {
  24202. if (fn && cb) return wrappy(fn)(cb);
  24203. if (typeof fn !== "function") throw new TypeError("need wrapper function");
  24204. Object.keys(fn).forEach(function (k) {
  24205. wrapper[k] = fn[k];
  24206. });
  24207. return wrapper;
  24208. function wrapper() {
  24209. var args = new Array(arguments.length);
  24210. for (var i = 0; i < args.length; i++) {
  24211. args[i] = arguments[i];
  24212. }
  24213. var ret = fn.apply(this, args);
  24214. var cb = args[args.length - 1];
  24215. if (typeof ret === "function" && ret !== cb) {
  24216. Object.keys(cb).forEach(function (k) {
  24217. ret[k] = cb[k];
  24218. });
  24219. }
  24220. return ret;
  24221. }
  24222. }
  24223. }, {}],
  24224. 121: [function (require, module, exports) {
  24225. module.exports = extend;
  24226. var hasOwnProperty = Object.prototype.hasOwnProperty;
  24227. function extend() {
  24228. var target = {};
  24229. for (var i = 0; i < arguments.length; i++) {
  24230. var source = arguments[i];
  24231. for (var key in source) {
  24232. if (hasOwnProperty.call(source, key)) {
  24233. target[key] = source[key];
  24234. }
  24235. }
  24236. }
  24237. return target;
  24238. }
  24239. }, {}]
  24240. }, {}, [9])(9);
  24241. });
  24242. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! (webpack)/buildin/global.js */ 3), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  24243. /***/ }),
  24244. /* 75 */,
  24245. /* 76 */,
  24246. /* 77 */,
  24247. /* 78 */,
  24248. /* 79 */,
  24249. /* 80 */,
  24250. /* 81 */,
  24251. /* 82 */,
  24252. /* 83 */
  24253. /*!***********************************************!*\
  24254. !*** E:/git/2021项目/v3-H5/component/public.js ***!
  24255. \***********************************************/
  24256. /*! no static exports found */
  24257. /***/ (function(module, exports, __webpack_require__) {
  24258. "use strict";
  24259. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  24260. Object.defineProperty(exports, "__esModule", {
  24261. value: true
  24262. });
  24263. exports.parseTime = parseTime;
  24264. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  24265. // 日期格式化
  24266. function parseTime(time, pattern) {
  24267. if (arguments.length === 0 || !time) {
  24268. return null;
  24269. }
  24270. if (time.indexOf('T') !== -1) {
  24271. var newTime = time.split('T');
  24272. time = newTime[0] + ' ' + newTime[1];
  24273. }
  24274. var format = pattern || '{y}-{m}-{d} {h}:{i}:{s}';
  24275. var date;
  24276. if ((0, _typeof2.default)(time) === 'object') {
  24277. date = time;
  24278. } else {
  24279. if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
  24280. time = parseInt(time);
  24281. } else if (typeof time === 'string') {
  24282. time = time.replace(new RegExp(/-/gm), '/');
  24283. }
  24284. if (typeof time === 'number' && time.toString().length === 10) {
  24285. time = time * 1000;
  24286. }
  24287. date = new Date(time);
  24288. }
  24289. var formatObj = {
  24290. y: date.getFullYear(),
  24291. m: date.getMonth() + 1,
  24292. d: date.getDate(),
  24293. h: date.getHours(),
  24294. i: date.getMinutes(),
  24295. s: date.getSeconds(),
  24296. a: date.getDay()
  24297. };
  24298. var time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
  24299. var value = formatObj[key];
  24300. // Note: getDay() returns 0 on Sunday
  24301. if (key === 'a') {
  24302. return ['日', '一', '二', '三', '四', '五', '六'][value];
  24303. }
  24304. if (result.length > 0 && value < 10) {
  24305. value = '0' + value;
  24306. }
  24307. return value || 0;
  24308. });
  24309. return time_str;
  24310. }
  24311. /***/ }),
  24312. /* 84 */,
  24313. /* 85 */,
  24314. /* 86 */,
  24315. /* 87 */,
  24316. /* 88 */,
  24317. /* 89 */,
  24318. /* 90 */,
  24319. /* 91 */,
  24320. /* 92 */,
  24321. /* 93 */,
  24322. /* 94 */,
  24323. /* 95 */,
  24324. /* 96 */,
  24325. /* 97 */,
  24326. /* 98 */,
  24327. /* 99 */,
  24328. /* 100 */,
  24329. /* 101 */,
  24330. /* 102 */,
  24331. /* 103 */,
  24332. /* 104 */,
  24333. /* 105 */,
  24334. /* 106 */,
  24335. /* 107 */,
  24336. /* 108 */
  24337. /*!****************************************!*\
  24338. !*** E:/git/2021项目/v3-H5/utils/md5.js ***!
  24339. \****************************************/
  24340. /*! no static exports found */
  24341. /***/ (function(module, exports) {
  24342. /**
  24343. * Namespace for hashing and other cryptographic functions
  24344. * Copyright (c) Andrew Valums
  24345. * Licensed under the MIT license, http://valums.com/mit-license/
  24346. */
  24347. var V = V || {};
  24348. V.Security = V.Security || {};
  24349. (function () {
  24350. // for faster access
  24351. var S = V.Security;
  24352. /**
  24353. * The highest integer value a number can go to without losing precision.
  24354. */
  24355. S.maxExactInt = Math.pow(2, 53);
  24356. /**
  24357. * Converts string from internal UTF-16 to UTF-8
  24358. * and saves it using array of numbers (bytes), 0-255 per cell
  24359. * @param {String} str
  24360. * @return {Array}
  24361. */
  24362. S.toUtf8ByteArr = function (str) {
  24363. var arr = [],
  24364. code;
  24365. for (var i = 0; i < str.length; i++) {
  24366. code = str.charCodeAt(i);
  24367. /*
  24368. Note that charCodeAt will always return a value that is less than 65,536.
  24369. This is because the higher code points are represented by a pair of (lower valued)
  24370. "surrogate" pseudo-characters which are used to comprise the real character.
  24371. Because of this, in order to examine or reproduce the full character for
  24372. individual characters of value 65,536 and above, for such characters,
  24373. it is necessary to retrieve not only charCodeAt(0), but also charCodeAt(1).
  24374. */
  24375. if (0xD800 <= code && code <= 0xDBFF) {
  24376. // UTF-16 high surrogate
  24377. var hi = code,
  24378. low = str.charCodeAt(i + 1);
  24379. code = (hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000;
  24380. i++;
  24381. }
  24382. if (code <= 127) {
  24383. arr[arr.length] = code;
  24384. } else if (code <= 2047) {
  24385. arr[arr.length] = (code >>> 6) + 0xC0;
  24386. arr[arr.length] = code & 0x3F | 0x80;
  24387. } else if (code <= 65535) {
  24388. arr[arr.length] = (code >>> 12) + 0xE0;
  24389. arr[arr.length] = code >>> 6 & 0x3F | 0x80;
  24390. arr[arr.length] = code & 0x3F | 0x80;
  24391. } else if (code <= 1114111) {
  24392. arr[arr.length] = (code >>> 18) + 0xF0;
  24393. arr[arr.length] = code >>> 12 & 0x3F | 0x80;
  24394. arr[arr.length] = code >>> 6 & 0x3F | 0x80;
  24395. arr[arr.length] = code & 0x3F | 0x80;
  24396. } else {
  24397. throw 'Unicode standart supports code points up-to U+10FFFF';
  24398. }
  24399. }
  24400. return arr;
  24401. };
  24402. /**
  24403. * Outputs 32 integer bits of a number in hex format.
  24404. * Preserves leading zeros.
  24405. * @param {Number} num
  24406. */
  24407. S.toHex32 = function (num) {
  24408. // if negative
  24409. if (num & 0x80000000) {
  24410. // convert to positive number
  24411. num = num & ~0x80000000;
  24412. num += Math.pow(2, 31);
  24413. }
  24414. var str = num.toString(16);
  24415. while (str.length < 8) {
  24416. str = '0' + str;
  24417. }
  24418. return str;
  24419. };
  24420. /**
  24421. * Changes the order of 4 bytes in integer representation of number.
  24422. * From 1234 to 4321.
  24423. * @param {Number} num Only 32 int bits are used.
  24424. */
  24425. S.reverseBytes = function (num) {
  24426. var res = 0;
  24427. res += num >>> 24 & 0xff;
  24428. res += (num >>> 16 & 0xff) << 8;
  24429. res += (num >>> 8 & 0xff) << 16;
  24430. res += (num & 0xff) << 24;
  24431. return res;
  24432. };
  24433. S.leftRotate = function (x, c) {
  24434. return x << c | x >>> 32 - c;
  24435. };
  24436. /**
  24437. * RSA Data Security, Inc. MD5 Message-Digest Algorithm
  24438. * http://tools.ietf.org/html/rfc1321
  24439. * http://en.wikipedia.org/wiki/MD5
  24440. * @param {String} message
  24441. */
  24442. S.md5 = function (message) {
  24443. // r specifies the per-round shift amounts
  24444. var r = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21];
  24445. // Use binary integer part of the sines of integers (Radians) as constants:
  24446. var k = [];
  24447. for (var i = 0; i <= 63; i++) {
  24448. k[i] = Math.abs(Math.sin(i + 1)) * Math.pow(2, 32) << 0;
  24449. }
  24450. var h0 = 0x67452301,
  24451. h1 = 0xEFCDAB89,
  24452. h2 = 0x98BADCFE,
  24453. h3 = 0x10325476,
  24454. bytes,
  24455. unpadded;
  24456. //Pre-processing:
  24457. bytes = S.toUtf8ByteArr(message);
  24458. message = null;
  24459. unpadded = bytes.length;
  24460. //append "1" bit to message
  24461. //append "0" bits until message length in bits ≡ 448 (mod 512)
  24462. bytes.push(0x80);
  24463. var zeroBytes = Math.abs(448 - bytes.length * 8 % 512) / 8;
  24464. while (zeroBytes--) {
  24465. bytes.push(0);
  24466. }
  24467. //append bit length of unpadded message as 64-bit little-endian integer to message
  24468. bytes.push(unpadded * 8 & 0xff, unpadded * 8 >> 8 & 0xff, unpadded * 8 >> 16 & 0xff, unpadded * 8 >> 24 & 0xff);
  24469. var i = 4;
  24470. while (i--) {
  24471. bytes.push(0);
  24472. }
  24473. var leftRotate = S.leftRotate;
  24474. //Process the message in successive 512-bit chunks:
  24475. var i = 0,
  24476. w = [];
  24477. while (i < bytes.length) {
  24478. //break chunk into sixteen 32-bit words w[i], 0 ≤ i ≤ 15
  24479. for (var j = 0; j <= 15; j++) {
  24480. w[j] = (bytes[i + 4 * j] << 0) + (bytes[i + 4 * j + 1] << 8) + (bytes[i + 4 * j + 2] << 16) + (bytes[i + 4 * j + 3] << 24);
  24481. }
  24482. //Initialize hash value for this chunk:
  24483. var a = h0,
  24484. b = h1,
  24485. c = h2,
  24486. d = h3,
  24487. f,
  24488. g;
  24489. //Main loop:
  24490. for (var j = 0; j <= 63; j++) {
  24491. if (j <= 15) {
  24492. f = b & c | ~b & d;
  24493. g = j;
  24494. } else if (j <= 31) {
  24495. f = d & b | ~d & c;
  24496. g = (5 * j + 1) % 16;
  24497. } else if (j <= 47) {
  24498. f = b ^ c ^ d;
  24499. g = (3 * j + 5) % 16;
  24500. } else {
  24501. f = c ^ (b | ~d);
  24502. g = 7 * j % 16;
  24503. }
  24504. var temp = d;
  24505. d = c;
  24506. c = b;
  24507. b = b + leftRotate(a + f + k[j] + w[g], r[j]);
  24508. a = temp;
  24509. }
  24510. //Add this chunk's hash to result so far:
  24511. h0 = h0 + a << 0;
  24512. h1 = h1 + b << 0;
  24513. h2 = h2 + c << 0;
  24514. h3 = h3 + d << 0;
  24515. i += 512 / 8;
  24516. }
  24517. // fix when starting with 0
  24518. var res = out(h0) + out(h1) + out(h2) + out(h3);
  24519. function out(h) {
  24520. return S.toHex32(S.reverseBytes(h));
  24521. }
  24522. return res;
  24523. };
  24524. })();
  24525. /*
  24526. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  24527. * Digest Algorithm, as defined in RFC 1321.
  24528. * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
  24529. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  24530. * Distributed under the BSD License
  24531. * See http://pajhome.org.uk/crypt/md5 for more info.
  24532. */
  24533. /*
  24534. * Configurable variables. You may need to tweak these to be compatible with
  24535. * the server-side, but the defaults work in most cases.
  24536. */
  24537. var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
  24538. var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
  24539. /*
  24540. * These are the functions you'll usually want to call
  24541. * They take string arguments and return either hex or base-64 encoded strings
  24542. */
  24543. function hex_md5(s) {
  24544. return rstr2hex(rstr_md5(str2rstr_utf8(s)));
  24545. }
  24546. function b64_md5(s) {
  24547. return rstr2b64(rstr_md5(str2rstr_utf8(s)));
  24548. }
  24549. function any_md5(s, e) {
  24550. return rstr2any(rstr_md5(str2rstr_utf8(s)), e);
  24551. }
  24552. function hex_hmac_md5(k, d) {
  24553. return rstr2hex(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)));
  24554. }
  24555. function b64_hmac_md5(k, d) {
  24556. return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)));
  24557. }
  24558. function any_hmac_md5(k, d, e) {
  24559. return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e);
  24560. }
  24561. /*
  24562. * Perform a simple self-test to see if the VM is working
  24563. */
  24564. function md5_vm_test() {
  24565. return hex_md5("abc").toLowerCase() == "900150983cd24fb0d6963f7d28e17f72";
  24566. }
  24567. /*
  24568. * Calculate the MD5 of a raw string
  24569. */
  24570. function rstr_md5(s) {
  24571. return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
  24572. }
  24573. /*
  24574. * Calculate the HMAC-MD5, of a key and some data (raw strings)
  24575. */
  24576. function rstr_hmac_md5(key, data) {
  24577. var bkey = rstr2binl(key);
  24578. if (bkey.length > 16) bkey = binl_md5(bkey, key.length * 8);
  24579. var ipad = Array(16),
  24580. opad = Array(16);
  24581. for (var i = 0; i < 16; i++) {
  24582. ipad[i] = bkey[i] ^ 0x36363636;
  24583. opad[i] = bkey[i] ^ 0x5C5C5C5C;
  24584. }
  24585. var hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
  24586. return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
  24587. }
  24588. /*
  24589. * Convert a raw string to a hex string
  24590. */
  24591. function rstr2hex(input) {
  24592. try {
  24593. hexcase;
  24594. } catch (e) {
  24595. hexcase = 0;
  24596. }
  24597. var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  24598. var output = "";
  24599. var x;
  24600. for (var i = 0; i < input.length; i++) {
  24601. x = input.charCodeAt(i);
  24602. output += hex_tab.charAt(x >>> 4 & 0x0F) + hex_tab.charAt(x & 0x0F);
  24603. }
  24604. return output;
  24605. }
  24606. /*
  24607. * Convert a raw string to a base-64 string
  24608. */
  24609. function rstr2b64(input) {
  24610. try {
  24611. b64pad;
  24612. } catch (e) {
  24613. b64pad = '';
  24614. }
  24615. var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  24616. var output = "";
  24617. var len = input.length;
  24618. for (var i = 0; i < len; i += 3) {
  24619. var triplet = input.charCodeAt(i) << 16 | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0);
  24620. for (var j = 0; j < 4; j++) {
  24621. if (i * 8 + j * 6 > input.length * 8) output += b64pad;else output += tab.charAt(triplet >>> 6 * (3 - j) & 0x3F);
  24622. }
  24623. }
  24624. return output;
  24625. }
  24626. /*
  24627. * Convert a raw string to an arbitrary string encoding
  24628. */
  24629. function rstr2any(input, encoding) {
  24630. var divisor = encoding.length;
  24631. var i, j, q, x, quotient;
  24632. /* Convert to an array of 16-bit big-endian values, forming the dividend */
  24633. var dividend = Array(Math.ceil(input.length / 2));
  24634. for (i = 0; i < dividend.length; i++) {
  24635. dividend[i] = input.charCodeAt(i * 2) << 8 | input.charCodeAt(i * 2 + 1);
  24636. }
  24637. /*
  24638. * Repeatedly perform a long division. The binary array forms the dividend,
  24639. * the length of the encoding is the divisor. Once computed, the quotient
  24640. * forms the dividend for the next step. All remainders are stored for later
  24641. * use.
  24642. */
  24643. var full_length = Math.ceil(input.length * 8 / (Math.log(encoding.length) / Math.log(2)));
  24644. var remainders = Array(full_length);
  24645. for (j = 0; j < full_length; j++) {
  24646. quotient = Array();
  24647. x = 0;
  24648. for (i = 0; i < dividend.length; i++) {
  24649. x = (x << 16) + dividend[i];
  24650. q = Math.floor(x / divisor);
  24651. x -= q * divisor;
  24652. if (quotient.length > 0 || q > 0) quotient[quotient.length] = q;
  24653. }
  24654. remainders[j] = x;
  24655. dividend = quotient;
  24656. }
  24657. /* Convert the remainders to the output string */
  24658. var output = "";
  24659. for (i = remainders.length - 1; i >= 0; i--) {
  24660. output += encoding.charAt(remainders[i]);
  24661. }
  24662. return output;
  24663. }
  24664. /*
  24665. * Encode a string as utf-8.
  24666. * For efficiency, this assumes the input is valid utf-16.
  24667. */
  24668. function str2rstr_utf8(input) {
  24669. return unescape(encodeURI(input));
  24670. }
  24671. /*
  24672. * Encode a string as utf-16
  24673. */
  24674. function str2rstr_utf16le(input) {
  24675. var output = "";
  24676. for (var i = 0; i < input.length; i++) {
  24677. output += String.fromCharCode(input.charCodeAt(i) & 0xFF, input.charCodeAt(i) >>> 8 & 0xFF);
  24678. }
  24679. return output;
  24680. }
  24681. function str2rstr_utf16be(input) {
  24682. var output = "";
  24683. for (var i = 0; i < input.length; i++) {
  24684. output += String.fromCharCode(input.charCodeAt(i) >>> 8 & 0xFF, input.charCodeAt(i) & 0xFF);
  24685. }
  24686. return output;
  24687. }
  24688. /*
  24689. * Convert a raw string to an array of little-endian words
  24690. * Characters >255 have their high-byte silently ignored.
  24691. */
  24692. function rstr2binl(input) {
  24693. var output = Array(input.length >> 2);
  24694. for (var i = 0; i < output.length; i++) {
  24695. output[i] = 0;
  24696. }
  24697. for (var i = 0; i < input.length * 8; i += 8) {
  24698. output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << i % 32;
  24699. }
  24700. return output;
  24701. }
  24702. /*
  24703. * Convert an array of little-endian words to a string
  24704. */
  24705. function binl2rstr(input) {
  24706. var output = "";
  24707. for (var i = 0; i < input.length * 32; i += 8) {
  24708. output += String.fromCharCode(input[i >> 5] >>> i % 32 & 0xFF);
  24709. }
  24710. return output;
  24711. }
  24712. /*
  24713. * Calculate the MD5 of an array of little-endian words, and a bit length.
  24714. */
  24715. function binl_md5(x, len) {
  24716. /* append padding */
  24717. x[len >> 5] |= 0x80 << len % 32;
  24718. x[(len + 64 >>> 9 << 4) + 14] = len;
  24719. var a = 1732584193;
  24720. var b = -271733879;
  24721. var c = -1732584194;
  24722. var d = 271733878;
  24723. for (var i = 0; i < x.length; i += 16) {
  24724. var olda = a;
  24725. var oldb = b;
  24726. var oldc = c;
  24727. var oldd = d;
  24728. a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
  24729. d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
  24730. c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
  24731. b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
  24732. a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
  24733. d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
  24734. c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
  24735. b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
  24736. a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
  24737. d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
  24738. c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
  24739. b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
  24740. a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
  24741. d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
  24742. c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
  24743. b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
  24744. a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
  24745. d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
  24746. c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
  24747. b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
  24748. a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
  24749. d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
  24750. c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
  24751. b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
  24752. a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
  24753. d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
  24754. c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
  24755. b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
  24756. a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
  24757. d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
  24758. c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
  24759. b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
  24760. a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
  24761. d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
  24762. c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
  24763. b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
  24764. a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
  24765. d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
  24766. c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
  24767. b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
  24768. a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
  24769. d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
  24770. c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
  24771. b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
  24772. a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
  24773. d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
  24774. c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
  24775. b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
  24776. a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
  24777. d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
  24778. c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
  24779. b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
  24780. a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
  24781. d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
  24782. c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
  24783. b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
  24784. a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
  24785. d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
  24786. c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
  24787. b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
  24788. a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
  24789. d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
  24790. c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
  24791. b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
  24792. a = safe_add(a, olda);
  24793. b = safe_add(b, oldb);
  24794. c = safe_add(c, oldc);
  24795. d = safe_add(d, oldd);
  24796. }
  24797. return Array(a, b, c, d);
  24798. }
  24799. /*
  24800. * These functions implement the four basic operations the algorithm uses.
  24801. */
  24802. function md5_cmn(q, a, b, x, s, t) {
  24803. return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
  24804. }
  24805. function md5_ff(a, b, c, d, x, s, t) {
  24806. return md5_cmn(b & c | ~b & d, a, b, x, s, t);
  24807. }
  24808. function md5_gg(a, b, c, d, x, s, t) {
  24809. return md5_cmn(b & d | c & ~d, a, b, x, s, t);
  24810. }
  24811. function md5_hh(a, b, c, d, x, s, t) {
  24812. return md5_cmn(b ^ c ^ d, a, b, x, s, t);
  24813. }
  24814. function md5_ii(a, b, c, d, x, s, t) {
  24815. return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
  24816. }
  24817. /*
  24818. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  24819. * to work around bugs in some JS interpreters.
  24820. */
  24821. function safe_add(x, y) {
  24822. var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  24823. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  24824. return msw << 16 | lsw & 0xFFFF;
  24825. }
  24826. /*
  24827. * Bitwise rotate a 32-bit number to the left.
  24828. */
  24829. function bit_rol(num, cnt) {
  24830. return num << cnt | num >>> 32 - cnt;
  24831. }
  24832. function md5cycle(x, k) {
  24833. var a = x[0],
  24834. b = x[1],
  24835. c = x[2],
  24836. d = x[3];
  24837. a = ff(a, b, c, d, k[0], 7, -680876936);
  24838. d = ff(d, a, b, c, k[1], 12, -389564586);
  24839. c = ff(c, d, a, b, k[2], 17, 606105819);
  24840. b = ff(b, c, d, a, k[3], 22, -1044525330);
  24841. a = ff(a, b, c, d, k[4], 7, -176418897);
  24842. d = ff(d, a, b, c, k[5], 12, 1200080426);
  24843. c = ff(c, d, a, b, k[6], 17, -1473231341);
  24844. b = ff(b, c, d, a, k[7], 22, -45705983);
  24845. a = ff(a, b, c, d, k[8], 7, 1770035416);
  24846. d = ff(d, a, b, c, k[9], 12, -1958414417);
  24847. c = ff(c, d, a, b, k[10], 17, -42063);
  24848. b = ff(b, c, d, a, k[11], 22, -1990404162);
  24849. a = ff(a, b, c, d, k[12], 7, 1804603682);
  24850. d = ff(d, a, b, c, k[13], 12, -40341101);
  24851. c = ff(c, d, a, b, k[14], 17, -1502002290);
  24852. b = ff(b, c, d, a, k[15], 22, 1236535329);
  24853. a = gg(a, b, c, d, k[1], 5, -165796510);
  24854. d = gg(d, a, b, c, k[6], 9, -1069501632);
  24855. c = gg(c, d, a, b, k[11], 14, 643717713);
  24856. b = gg(b, c, d, a, k[0], 20, -373897302);
  24857. a = gg(a, b, c, d, k[5], 5, -701558691);
  24858. d = gg(d, a, b, c, k[10], 9, 38016083);
  24859. c = gg(c, d, a, b, k[15], 14, -660478335);
  24860. b = gg(b, c, d, a, k[4], 20, -405537848);
  24861. a = gg(a, b, c, d, k[9], 5, 568446438);
  24862. d = gg(d, a, b, c, k[14], 9, -1019803690);
  24863. c = gg(c, d, a, b, k[3], 14, -187363961);
  24864. b = gg(b, c, d, a, k[8], 20, 1163531501);
  24865. a = gg(a, b, c, d, k[13], 5, -1444681467);
  24866. d = gg(d, a, b, c, k[2], 9, -51403784);
  24867. c = gg(c, d, a, b, k[7], 14, 1735328473);
  24868. b = gg(b, c, d, a, k[12], 20, -1926607734);
  24869. a = hh(a, b, c, d, k[5], 4, -378558);
  24870. d = hh(d, a, b, c, k[8], 11, -2022574463);
  24871. c = hh(c, d, a, b, k[11], 16, 1839030562);
  24872. b = hh(b, c, d, a, k[14], 23, -35309556);
  24873. a = hh(a, b, c, d, k[1], 4, -1530992060);
  24874. d = hh(d, a, b, c, k[4], 11, 1272893353);
  24875. c = hh(c, d, a, b, k[7], 16, -155497632);
  24876. b = hh(b, c, d, a, k[10], 23, -1094730640);
  24877. a = hh(a, b, c, d, k[13], 4, 681279174);
  24878. d = hh(d, a, b, c, k[0], 11, -358537222);
  24879. c = hh(c, d, a, b, k[3], 16, -722521979);
  24880. b = hh(b, c, d, a, k[6], 23, 76029189);
  24881. a = hh(a, b, c, d, k[9], 4, -640364487);
  24882. d = hh(d, a, b, c, k[12], 11, -421815835);
  24883. c = hh(c, d, a, b, k[15], 16, 530742520);
  24884. b = hh(b, c, d, a, k[2], 23, -995338651);
  24885. a = ii(a, b, c, d, k[0], 6, -198630844);
  24886. d = ii(d, a, b, c, k[7], 10, 1126891415);
  24887. c = ii(c, d, a, b, k[14], 15, -1416354905);
  24888. b = ii(b, c, d, a, k[5], 21, -57434055);
  24889. a = ii(a, b, c, d, k[12], 6, 1700485571);
  24890. d = ii(d, a, b, c, k[3], 10, -1894986606);
  24891. c = ii(c, d, a, b, k[10], 15, -1051523);
  24892. b = ii(b, c, d, a, k[1], 21, -2054922799);
  24893. a = ii(a, b, c, d, k[8], 6, 1873313359);
  24894. d = ii(d, a, b, c, k[15], 10, -30611744);
  24895. c = ii(c, d, a, b, k[6], 15, -1560198380);
  24896. b = ii(b, c, d, a, k[13], 21, 1309151649);
  24897. a = ii(a, b, c, d, k[4], 6, -145523070);
  24898. d = ii(d, a, b, c, k[11], 10, -1120210379);
  24899. c = ii(c, d, a, b, k[2], 15, 718787259);
  24900. b = ii(b, c, d, a, k[9], 21, -343485551);
  24901. x[0] = add32(a, x[0]);
  24902. x[1] = add32(b, x[1]);
  24903. x[2] = add32(c, x[2]);
  24904. x[3] = add32(d, x[3]);
  24905. }
  24906. function cmn(q, a, b, x, s, t) {
  24907. a = add32(add32(a, q), add32(x, t));
  24908. return add32(a << s | a >>> 32 - s, b);
  24909. }
  24910. function ff(a, b, c, d, x, s, t) {
  24911. return cmn(b & c | ~b & d, a, b, x, s, t);
  24912. }
  24913. function gg(a, b, c, d, x, s, t) {
  24914. return cmn(b & d | c & ~d, a, b, x, s, t);
  24915. }
  24916. function hh(a, b, c, d, x, s, t) {
  24917. return cmn(b ^ c ^ d, a, b, x, s, t);
  24918. }
  24919. function ii(a, b, c, d, x, s, t) {
  24920. return cmn(c ^ (b | ~d), a, b, x, s, t);
  24921. }
  24922. function md51(s) {
  24923. var txt = '';
  24924. var n = s.length,
  24925. state = [1732584193, -271733879, -1732584194, 271733878],
  24926. i;
  24927. for (i = 64; i <= s.length; i += 64) {
  24928. md5cycle(state, md5blk(s.substring(i - 64, i)));
  24929. }
  24930. s = s.substring(i - 64);
  24931. var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  24932. for (i = 0; i < s.length; i++) {
  24933. tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
  24934. }
  24935. tail[i >> 2] |= 0x80 << (i % 4 << 3);
  24936. if (i > 55) {
  24937. md5cycle(state, tail);
  24938. for (i = 0; i < 16; i++) {
  24939. tail[i] = 0;
  24940. }
  24941. }
  24942. tail[14] = n * 8;
  24943. md5cycle(state, tail);
  24944. return state;
  24945. }
  24946. /* there needs to be support for Unicode here,
  24947. * unless we pretend that we can redefine the MD-5
  24948. * algorithm for multi-byte characters (perhaps
  24949. * by adding every four 16-bit characters and
  24950. * shortening the sum to 32 bits). Otherwise
  24951. * I suggest performing MD-5 as if every character
  24952. * was two bytes--e.g., 0040 0025 = @%--but then
  24953. * how will an ordinary MD-5 sum be matched?
  24954. * There is no way to standardize text to something
  24955. * like UTF-8 before transformation; speed cost is
  24956. * utterly prohibitive. The JavaScript standard
  24957. * itself needs to look at this: it should start
  24958. * providing access to strings as preformed UTF-8
  24959. * 8-bit unsigned value arrays.
  24960. */
  24961. function md5blk(s) {
  24962. /* I figured global was faster. */
  24963. var md5blks = [],
  24964. i; /* Andy King said do it this way. */
  24965. for (i = 0; i < 64; i += 4) {
  24966. md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
  24967. }
  24968. return md5blks;
  24969. }
  24970. var hex_chr = '0123456789abcdef'.split('');
  24971. function rhex(n) {
  24972. var s = '',
  24973. j = 0;
  24974. for (; j < 4; j++) {
  24975. s += hex_chr[n >> j * 8 + 4 & 0x0F] + hex_chr[n >> j * 8 & 0x0F];
  24976. }
  24977. return s;
  24978. }
  24979. function hex(x) {
  24980. for (var i = 0; i < x.length; i++) {
  24981. x[i] = rhex(x[i]);
  24982. }
  24983. return x.join('');
  24984. }
  24985. function md5(s) {
  24986. return hex(md51(s));
  24987. }
  24988. /* this function is much faster,
  24989. so if possible we use it. Some IEs
  24990. are the only ones I know of that
  24991. need the idiotic second function,
  24992. generated by an if clause. */
  24993. function add32(a, b) {
  24994. return a + b & 0xFFFFFFFF;
  24995. }
  24996. if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
  24997. var _add = function _add(x, y) {
  24998. var lsw = (x & 0xFFFF) + (y & 0xFFFF),
  24999. msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  25000. return msw << 16 | lsw & 0xFFFF;
  25001. };
  25002. }
  25003. (function () {
  25004. function md5cycle(x, k) {
  25005. var a = x[0],
  25006. b = x[1],
  25007. c = x[2],
  25008. d = x[3];
  25009. a = ff(a, b, c, d, k[0], 7, -680876936);
  25010. d = ff(d, a, b, c, k[1], 12, -389564586);
  25011. c = ff(c, d, a, b, k[2], 17, 606105819);
  25012. b = ff(b, c, d, a, k[3], 22, -1044525330);
  25013. a = ff(a, b, c, d, k[4], 7, -176418897);
  25014. d = ff(d, a, b, c, k[5], 12, 1200080426);
  25015. c = ff(c, d, a, b, k[6], 17, -1473231341);
  25016. b = ff(b, c, d, a, k[7], 22, -45705983);
  25017. a = ff(a, b, c, d, k[8], 7, 1770035416);
  25018. d = ff(d, a, b, c, k[9], 12, -1958414417);
  25019. c = ff(c, d, a, b, k[10], 17, -42063);
  25020. b = ff(b, c, d, a, k[11], 22, -1990404162);
  25021. a = ff(a, b, c, d, k[12], 7, 1804603682);
  25022. d = ff(d, a, b, c, k[13], 12, -40341101);
  25023. c = ff(c, d, a, b, k[14], 17, -1502002290);
  25024. b = ff(b, c, d, a, k[15], 22, 1236535329);
  25025. a = gg(a, b, c, d, k[1], 5, -165796510);
  25026. d = gg(d, a, b, c, k[6], 9, -1069501632);
  25027. c = gg(c, d, a, b, k[11], 14, 643717713);
  25028. b = gg(b, c, d, a, k[0], 20, -373897302);
  25029. a = gg(a, b, c, d, k[5], 5, -701558691);
  25030. d = gg(d, a, b, c, k[10], 9, 38016083);
  25031. c = gg(c, d, a, b, k[15], 14, -660478335);
  25032. b = gg(b, c, d, a, k[4], 20, -405537848);
  25033. a = gg(a, b, c, d, k[9], 5, 568446438);
  25034. d = gg(d, a, b, c, k[14], 9, -1019803690);
  25035. c = gg(c, d, a, b, k[3], 14, -187363961);
  25036. b = gg(b, c, d, a, k[8], 20, 1163531501);
  25037. a = gg(a, b, c, d, k[13], 5, -1444681467);
  25038. d = gg(d, a, b, c, k[2], 9, -51403784);
  25039. c = gg(c, d, a, b, k[7], 14, 1735328473);
  25040. b = gg(b, c, d, a, k[12], 20, -1926607734);
  25041. a = hh(a, b, c, d, k[5], 4, -378558);
  25042. d = hh(d, a, b, c, k[8], 11, -2022574463);
  25043. c = hh(c, d, a, b, k[11], 16, 1839030562);
  25044. b = hh(b, c, d, a, k[14], 23, -35309556);
  25045. a = hh(a, b, c, d, k[1], 4, -1530992060);
  25046. d = hh(d, a, b, c, k[4], 11, 1272893353);
  25047. c = hh(c, d, a, b, k[7], 16, -155497632);
  25048. b = hh(b, c, d, a, k[10], 23, -1094730640);
  25049. a = hh(a, b, c, d, k[13], 4, 681279174);
  25050. d = hh(d, a, b, c, k[0], 11, -358537222);
  25051. c = hh(c, d, a, b, k[3], 16, -722521979);
  25052. b = hh(b, c, d, a, k[6], 23, 76029189);
  25053. a = hh(a, b, c, d, k[9], 4, -640364487);
  25054. d = hh(d, a, b, c, k[12], 11, -421815835);
  25055. c = hh(c, d, a, b, k[15], 16, 530742520);
  25056. b = hh(b, c, d, a, k[2], 23, -995338651);
  25057. a = ii(a, b, c, d, k[0], 6, -198630844);
  25058. d = ii(d, a, b, c, k[7], 10, 1126891415);
  25059. c = ii(c, d, a, b, k[14], 15, -1416354905);
  25060. b = ii(b, c, d, a, k[5], 21, -57434055);
  25061. a = ii(a, b, c, d, k[12], 6, 1700485571);
  25062. d = ii(d, a, b, c, k[3], 10, -1894986606);
  25063. c = ii(c, d, a, b, k[10], 15, -1051523);
  25064. b = ii(b, c, d, a, k[1], 21, -2054922799);
  25065. a = ii(a, b, c, d, k[8], 6, 1873313359);
  25066. d = ii(d, a, b, c, k[15], 10, -30611744);
  25067. c = ii(c, d, a, b, k[6], 15, -1560198380);
  25068. b = ii(b, c, d, a, k[13], 21, 1309151649);
  25069. a = ii(a, b, c, d, k[4], 6, -145523070);
  25070. d = ii(d, a, b, c, k[11], 10, -1120210379);
  25071. c = ii(c, d, a, b, k[2], 15, 718787259);
  25072. b = ii(b, c, d, a, k[9], 21, -343485551);
  25073. x[0] = add32(a, x[0]);
  25074. x[1] = add32(b, x[1]);
  25075. x[2] = add32(c, x[2]);
  25076. x[3] = add32(d, x[3]);
  25077. }
  25078. function cmn(q, a, b, x, s, t) {
  25079. a = add32(add32(a, q), add32(x, t));
  25080. return add32(a << s | a >>> 32 - s, b);
  25081. }
  25082. function ff(a, b, c, d, x, s, t) {
  25083. return cmn(b & c | ~b & d, a, b, x, s, t);
  25084. }
  25085. function gg(a, b, c, d, x, s, t) {
  25086. return cmn(b & d | c & ~d, a, b, x, s, t);
  25087. }
  25088. function hh(a, b, c, d, x, s, t) {
  25089. return cmn(b ^ c ^ d, a, b, x, s, t);
  25090. }
  25091. function ii(a, b, c, d, x, s, t) {
  25092. return cmn(c ^ (b | ~d), a, b, x, s, t);
  25093. }
  25094. function md51(s) {
  25095. // Converts the string to UTF-8 "bytes" when necessary
  25096. if (s.match(/[\x80-\xFF]/)) {
  25097. s = unescape(encodeURI(s));
  25098. }
  25099. var txt = '';
  25100. var n = s.length,
  25101. state = [1732584193, -271733879, -1732584194, 271733878],
  25102. i;
  25103. for (i = 64; i <= s.length; i += 64) {
  25104. md5cycle(state, md5blk(s.substring(i - 64, i)));
  25105. }
  25106. s = s.substring(i - 64);
  25107. var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  25108. for (i = 0; i < s.length; i++) {
  25109. tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
  25110. }
  25111. tail[i >> 2] |= 0x80 << (i % 4 << 3);
  25112. if (i > 55) {
  25113. md5cycle(state, tail);
  25114. for (i = 0; i < 16; i++) {
  25115. tail[i] = 0;
  25116. }
  25117. }
  25118. tail[14] = n * 8;
  25119. md5cycle(state, tail);
  25120. return state;
  25121. }
  25122. /* there needs to be support for Unicode here,
  25123. * unless we pretend that we can redefine the MD-5
  25124. * algorithm for multi-byte characters (perhaps
  25125. * by adding every four 16-bit characters and
  25126. * shortening the sum to 32 bits). Otherwise
  25127. * I suggest performing MD-5 as if every character
  25128. * was two bytes--e.g., 0040 0025 = @%--but then
  25129. * how will an ordinary MD-5 sum be matched?
  25130. * There is no way to standardize text to something
  25131. * like UTF-8 before transformation; speed cost is
  25132. * utterly prohibitive. The JavaScript standard
  25133. * itself needs to look at this: it should start
  25134. * providing access to strings as preformed UTF-8
  25135. * 8-bit unsigned value arrays.
  25136. */
  25137. function md5blk(s) {
  25138. /* I figured global was faster. */
  25139. var md5blks = [],
  25140. i; /* Andy King said do it this way. */
  25141. for (i = 0; i < 64; i += 4) {
  25142. md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
  25143. }
  25144. return md5blks;
  25145. }
  25146. var hex_chr = '0123456789abcdef'.split('');
  25147. function rhex(n) {
  25148. var s = '',
  25149. j = 0;
  25150. for (; j < 4; j++) {
  25151. s += hex_chr[n >> j * 8 + 4 & 0x0F] + hex_chr[n >> j * 8 & 0x0F];
  25152. }
  25153. return s;
  25154. }
  25155. function hex(x) {
  25156. for (var i = 0; i < x.length; i++) {
  25157. x[i] = rhex(x[i]);
  25158. }
  25159. return x.join('');
  25160. }
  25161. var md5_utf8 = function md5_utf8(s) {
  25162. return hex(md51(s));
  25163. };
  25164. /* this function is much faster,
  25165. so if possible we use it. Some IEs
  25166. are the only ones I know of that
  25167. need the idiotic second function,
  25168. generated by an if clause. */
  25169. function add32(a, b) {
  25170. return a + b & 0xFFFFFFFF;
  25171. }
  25172. if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
  25173. var _add2 = function _add2(x, y) {
  25174. var lsw = (x & 0xFFFF) + (y & 0xFFFF),
  25175. msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  25176. return msw << 16 | lsw & 0xFFFF;
  25177. };
  25178. }
  25179. })();
  25180. /* md5.js - MD5 Message-Digest
  25181. * Copyright (C) 1999,2002 Masanao Izumo <iz@onicos.co.jp>
  25182. * Version: 2.0.0
  25183. * LastModified: May 13 2002
  25184. *
  25185. * This program is free software. You can redistribute it and/or modify
  25186. * it without any warranty. This library calculates the MD5 based on RFC1321.
  25187. * See RFC1321 for more information and algorism.
  25188. */
  25189. /* Interface:
  25190. * md5_128bits = MD5_hash(data);
  25191. * md5_hexstr = MD5_hexhash(data);
  25192. */
  25193. /* ChangeLog
  25194. * 2002/05/13: Version 2.0.0 released
  25195. * NOTICE: API is changed.
  25196. * 2002/04/15: Bug fix about MD5 length.
  25197. */
  25198. // md5_T[i] = parseInt(Math.abs(Math.sin(i)) * 4294967296.0);
  25199. var MD5_T = new Array(0x00000000, 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391);
  25200. var MD5_round1 = new Array(new Array(0, 7, 1), new Array(1, 12, 2), new Array(2, 17, 3), new Array(3, 22, 4), new Array(4, 7, 5), new Array(5, 12, 6), new Array(6, 17, 7), new Array(7, 22, 8), new Array(8, 7, 9), new Array(9, 12, 10), new Array(10, 17, 11), new Array(11, 22, 12), new Array(12, 7, 13), new Array(13, 12, 14), new Array(14, 17, 15), new Array(15, 22, 16));
  25201. var MD5_round2 = new Array(new Array(1, 5, 17), new Array(6, 9, 18), new Array(11, 14, 19), new Array(0, 20, 20), new Array(5, 5, 21), new Array(10, 9, 22), new Array(15, 14, 23), new Array(4, 20, 24), new Array(9, 5, 25), new Array(14, 9, 26), new Array(3, 14, 27), new Array(8, 20, 28), new Array(13, 5, 29), new Array(2, 9, 30), new Array(7, 14, 31), new Array(12, 20, 32));
  25202. var MD5_round3 = new Array(new Array(5, 4, 33), new Array(8, 11, 34), new Array(11, 16, 35), new Array(14, 23, 36), new Array(1, 4, 37), new Array(4, 11, 38), new Array(7, 16, 39), new Array(10, 23, 40), new Array(13, 4, 41), new Array(0, 11, 42), new Array(3, 16, 43), new Array(6, 23, 44), new Array(9, 4, 45), new Array(12, 11, 46), new Array(15, 16, 47), new Array(2, 23, 48));
  25203. var MD5_round4 = new Array(new Array(0, 6, 49), new Array(7, 10, 50), new Array(14, 15, 51), new Array(5, 21, 52), new Array(12, 6, 53), new Array(3, 10, 54), new Array(10, 15, 55), new Array(1, 21, 56), new Array(8, 6, 57), new Array(15, 10, 58), new Array(6, 15, 59), new Array(13, 21, 60), new Array(4, 6, 61), new Array(11, 10, 62), new Array(2, 15, 63), new Array(9, 21, 64));
  25204. function MD5_F(x, y, z) {
  25205. return x & y | ~x & z;
  25206. }
  25207. function MD5_G(x, y, z) {
  25208. return x & z | y & ~z;
  25209. }
  25210. function MD5_H(x, y, z) {
  25211. return x ^ y ^ z;
  25212. }
  25213. function MD5_I(x, y, z) {
  25214. return y ^ (x | ~z);
  25215. }
  25216. var MD5_round = new Array(new Array(MD5_F, MD5_round1), new Array(MD5_G, MD5_round2), new Array(MD5_H, MD5_round3), new Array(MD5_I, MD5_round4));
  25217. function MD5_pack(n32) {
  25218. return String.fromCharCode(n32 & 0xff) + String.fromCharCode(n32 >>> 8 & 0xff) + String.fromCharCode(n32 >>> 16 & 0xff) + String.fromCharCode(n32 >>> 24 & 0xff);
  25219. }
  25220. function MD5_unpack(s4) {
  25221. return s4.charCodeAt(0) | s4.charCodeAt(1) << 8 | s4.charCodeAt(2) << 16 | s4.charCodeAt(3) << 24;
  25222. }
  25223. function MD5_number(n) {
  25224. while (n < 0) {
  25225. n += 4294967296;
  25226. }
  25227. while (n > 4294967295) {
  25228. n -= 4294967296;
  25229. }
  25230. return n;
  25231. }
  25232. function MD5_apply_round(x, s, f, abcd, r) {
  25233. var a, b, c, d;
  25234. var kk, ss, ii;
  25235. var t, u;
  25236. a = abcd[0];
  25237. b = abcd[1];
  25238. c = abcd[2];
  25239. d = abcd[3];
  25240. kk = r[0];
  25241. ss = r[1];
  25242. ii = r[2];
  25243. u = f(s[b], s[c], s[d]);
  25244. t = s[a] + u + x[kk] + MD5_T[ii];
  25245. t = MD5_number(t);
  25246. t = t << ss | t >>> 32 - ss;
  25247. t += s[b];
  25248. s[a] = MD5_number(t);
  25249. }
  25250. function MD5_hash(data) {
  25251. var abcd, x, state, s;
  25252. var len, index, padLen, f, r;
  25253. var i, j, k;
  25254. var tmp;
  25255. state = new Array(0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476);
  25256. len = data.length;
  25257. index = len & 0x3f;
  25258. padLen = index < 56 ? 56 - index : 120 - index;
  25259. if (padLen > 0) {
  25260. data += "\x80";
  25261. for (i = 0; i < padLen - 1; i++) {
  25262. data += "\x00";
  25263. }
  25264. }
  25265. data += MD5_pack(len * 8);
  25266. data += MD5_pack(0);
  25267. len += padLen + 8;
  25268. abcd = new Array(0, 1, 2, 3);
  25269. x = new Array(16);
  25270. s = new Array(4);
  25271. for (k = 0; k < len; k += 64) {
  25272. for (i = 0, j = k; i < 16; i++, j += 4) {
  25273. x[i] = data.charCodeAt(j) | data.charCodeAt(j + 1) << 8 | data.charCodeAt(j + 2) << 16 | data.charCodeAt(j + 3) << 24;
  25274. }
  25275. for (i = 0; i < 4; i++) {
  25276. s[i] = state[i];
  25277. }
  25278. for (i = 0; i < 4; i++) {
  25279. f = MD5_round[i][0];
  25280. r = MD5_round[i][1];
  25281. for (j = 0; j < 16; j++) {
  25282. MD5_apply_round(x, s, f, abcd, r[j]);
  25283. tmp = abcd[0];
  25284. abcd[0] = abcd[3];
  25285. abcd[3] = abcd[2];
  25286. abcd[2] = abcd[1];
  25287. abcd[1] = tmp;
  25288. }
  25289. }
  25290. for (i = 0; i < 4; i++) {
  25291. state[i] += s[i];
  25292. state[i] = MD5_number(state[i]);
  25293. }
  25294. }
  25295. return MD5_pack(state[0]) + MD5_pack(state[1]) + MD5_pack(state[2]) + MD5_pack(state[3]);
  25296. }
  25297. function MD5_hexhash(data) {
  25298. var i, out, c;
  25299. var bit128;
  25300. bit128 = MD5_hash(data);
  25301. out = "";
  25302. for (i = 0; i < 16; i++) {
  25303. c = bit128.charCodeAt(i);
  25304. out += "0123456789abcdef".charAt(c >> 4 & 0xf);
  25305. out += "0123456789abcdef".charAt(c & 0xf);
  25306. }
  25307. return out;
  25308. }
  25309. module.exports = {
  25310. hex_md5: hex_md5
  25311. };
  25312. /***/ }),
  25313. /* 109 */
  25314. /*!*******************************************!*\
  25315. !*** E:/git/2021项目/v3-H5/utils/secret.js ***!
  25316. \*******************************************/
  25317. /*! no static exports found */
  25318. /***/ (function(module, exports, __webpack_require__) {
  25319. "use strict";
  25320. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  25321. Object.defineProperty(exports, "__esModule", {
  25322. value: true
  25323. });
  25324. exports.Decrypt = Decrypt;
  25325. exports.Encrypt = Encrypt;
  25326. var _cryptoJs = _interopRequireDefault(__webpack_require__(/*! @/utils/crypto-js.js */ 110));
  25327. //引入crypto-js
  25328. //const CryptoJS = require('crypto-js');
  25329. // //十六位十六进制数作为密钥(秘钥为随机生成,必须与后端保持一致!)
  25330. // const key = 'J4ny0Ja678Y7P2so';
  25331. // //十六位十六进制数作为密钥偏移量(秘钥为随机生成,必须与后端保持一致!)
  25332. // const iv = 'pTNorfvZW2UZJbd0';
  25333. var key = _cryptoJs.default.enc.Utf8.parse("J4ny0Ja678Y7P2so"); //十六位十六进制数作为密钥
  25334. var iv = _cryptoJs.default.enc.Utf8.parse('pTNorfvZW2UZJbd0'); //十六位十六进制数作为密钥偏移量
  25335. //解密方法
  25336. function Decrypt(word) {
  25337. var encryptedHexStr = _cryptoJs.default.enc.Hex.parse(word);
  25338. var srcs = _cryptoJs.default.enc.Base64.stringify(encryptedHexStr);
  25339. var decrypt = _cryptoJs.default.AES.decrypt(srcs, key, {
  25340. iv: iv,
  25341. mode: _cryptoJs.default.mode.CBC,
  25342. padding: _cryptoJs.default.pad.Pkcs7
  25343. });
  25344. var decryptedStr = decrypt.toString(_cryptoJs.default.enc.Utf8);
  25345. return decryptedStr.toString();
  25346. }
  25347. //加密方法
  25348. function Encrypt(word) {
  25349. var srcs = _cryptoJs.default.enc.Utf8.parse(word);
  25350. var encrypted = _cryptoJs.default.AES.encrypt(srcs, key, {
  25351. iv: iv,
  25352. mode: _cryptoJs.default.mode.CBC,
  25353. padding: _cryptoJs.default.pad.Pkcs7
  25354. });
  25355. return encrypted.ciphertext.toString().toUpperCase();
  25356. }
  25357. /***/ }),
  25358. /* 110 */
  25359. /*!**********************************************!*\
  25360. !*** E:/git/2021项目/v3-H5/utils/crypto-js.js ***!
  25361. \**********************************************/
  25362. /*! no static exports found */
  25363. /***/ (function(module, exports, __webpack_require__) {
  25364. /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  25365. ;
  25366. (function (root, factory) {
  25367. if (( false ? undefined : _typeof(exports)) === "object") {
  25368. // CommonJS
  25369. module.exports = exports = factory();
  25370. } else if (true) {
  25371. // AMD
  25372. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  25373. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  25374. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  25375. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  25376. } else {}
  25377. })(this, function () {
  25378. /*globals window, global, require*/
  25379. /**
  25380. * CryptoJS core components.
  25381. */
  25382. var CryptoJS = CryptoJS || function (Math, undefined) {
  25383. var crypto;
  25384. // Native crypto from window (Browser)
  25385. if (typeof window !== 'undefined' && window.crypto) {
  25386. crypto = window.crypto;
  25387. }
  25388. // Native crypto in web worker (Browser)
  25389. if (typeof self !== 'undefined' && self.crypto) {
  25390. crypto = self.crypto;
  25391. }
  25392. // Native crypto from worker
  25393. if (typeof globalThis !== 'undefined' && globalThis.crypto) {
  25394. crypto = globalThis.crypto;
  25395. }
  25396. // Native (experimental IE 11) crypto from window (Browser)
  25397. if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
  25398. crypto = window.msCrypto;
  25399. }
  25400. // Native crypto from global (NodeJS)
  25401. if (!crypto && typeof global !== 'undefined' && global.crypto) {
  25402. crypto = global.crypto;
  25403. }
  25404. // Native crypto import via require (NodeJS)
  25405. if (!crypto && "function" === 'function') {
  25406. try {
  25407. crypto = __webpack_require__(/*! crypto */ 111);
  25408. } catch (err) {}
  25409. }
  25410. /*
  25411. * Cryptographically secure pseudorandom number generator
  25412. *
  25413. * As Math.random() is cryptographically not safe to use
  25414. */
  25415. var cryptoSecureRandomInt = function cryptoSecureRandomInt() {
  25416. if (crypto) {
  25417. // Use getRandomValues method (Browser)
  25418. if (typeof crypto.getRandomValues === 'function') {
  25419. try {
  25420. return crypto.getRandomValues(new Uint32Array(1))[0];
  25421. } catch (err) {}
  25422. }
  25423. // Use randomBytes method (NodeJS)
  25424. if (typeof crypto.randomBytes === 'function') {
  25425. try {
  25426. return crypto.randomBytes(4).readInt32LE();
  25427. } catch (err) {}
  25428. }
  25429. }
  25430. throw new Error('Native crypto module could not be used to get secure random number.');
  25431. };
  25432. /*
  25433. * Local polyfill of Object.create
  25434. */
  25435. var create = Object.create || function () {
  25436. function F() {}
  25437. return function (obj) {
  25438. var subtype;
  25439. F.prototype = obj;
  25440. subtype = new F();
  25441. F.prototype = null;
  25442. return subtype;
  25443. };
  25444. }();
  25445. /**
  25446. * CryptoJS namespace.
  25447. */
  25448. var C = {};
  25449. /**
  25450. * Library namespace.
  25451. */
  25452. var C_lib = C.lib = {};
  25453. /**
  25454. * Base object for prototypal inheritance.
  25455. */
  25456. var Base = C_lib.Base = function () {
  25457. return {
  25458. /**
  25459. * Creates a new object that inherits from this object.
  25460. *
  25461. * @param {Object} overrides Properties to copy into the new object.
  25462. *
  25463. * @return {Object} The new object.
  25464. *
  25465. * @static
  25466. *
  25467. * @example
  25468. *
  25469. * var MyType = CryptoJS.lib.Base.extend({
  25470. * field: 'value',
  25471. *
  25472. * method: function () {
  25473. * }
  25474. * });
  25475. */
  25476. extend: function extend(overrides) {
  25477. // Spawn
  25478. var subtype = create(this);
  25479. // Augment
  25480. if (overrides) {
  25481. subtype.mixIn(overrides);
  25482. }
  25483. // Create default initializer
  25484. if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
  25485. subtype.init = function () {
  25486. subtype.$super.init.apply(this, arguments);
  25487. };
  25488. }
  25489. // Initializer's prototype is the subtype object
  25490. subtype.init.prototype = subtype;
  25491. // Reference supertype
  25492. subtype.$super = this;
  25493. return subtype;
  25494. },
  25495. /**
  25496. * Extends this object and runs the init method.
  25497. * Arguments to create() will be passed to init().
  25498. *
  25499. * @return {Object} The new object.
  25500. *
  25501. * @static
  25502. *
  25503. * @example
  25504. *
  25505. * var instance = MyType.create();
  25506. */
  25507. create: function create() {
  25508. var instance = this.extend();
  25509. instance.init.apply(instance, arguments);
  25510. return instance;
  25511. },
  25512. /**
  25513. * Initializes a newly created object.
  25514. * Override this method to add some logic when your objects are created.
  25515. *
  25516. * @example
  25517. *
  25518. * var MyType = CryptoJS.lib.Base.extend({
  25519. * init: function () {
  25520. * // ...
  25521. * }
  25522. * });
  25523. */
  25524. init: function init() {},
  25525. /**
  25526. * Copies properties into this object.
  25527. *
  25528. * @param {Object} properties The properties to mix in.
  25529. *
  25530. * @example
  25531. *
  25532. * MyType.mixIn({
  25533. * field: 'value'
  25534. * });
  25535. */
  25536. mixIn: function mixIn(properties) {
  25537. for (var propertyName in properties) {
  25538. if (properties.hasOwnProperty(propertyName)) {
  25539. this[propertyName] = properties[propertyName];
  25540. }
  25541. }
  25542. // IE won't copy toString using the loop above
  25543. if (properties.hasOwnProperty('toString')) {
  25544. this.toString = properties.toString;
  25545. }
  25546. },
  25547. /**
  25548. * Creates a copy of this object.
  25549. *
  25550. * @return {Object} The clone.
  25551. *
  25552. * @example
  25553. *
  25554. * var clone = instance.clone();
  25555. */
  25556. clone: function clone() {
  25557. return this.init.prototype.extend(this);
  25558. }
  25559. };
  25560. }();
  25561. /**
  25562. * An array of 32-bit words.
  25563. *
  25564. * @property {Array} words The array of 32-bit words.
  25565. * @property {number} sigBytes The number of significant bytes in this word array.
  25566. */
  25567. var WordArray = C_lib.WordArray = Base.extend({
  25568. /**
  25569. * Initializes a newly created word array.
  25570. *
  25571. * @param {Array} words (Optional) An array of 32-bit words.
  25572. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  25573. *
  25574. * @example
  25575. *
  25576. * var wordArray = CryptoJS.lib.WordArray.create();
  25577. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
  25578. * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
  25579. */
  25580. init: function init(words, sigBytes) {
  25581. words = this.words = words || [];
  25582. if (sigBytes != undefined) {
  25583. this.sigBytes = sigBytes;
  25584. } else {
  25585. this.sigBytes = words.length * 4;
  25586. }
  25587. },
  25588. /**
  25589. * Converts this word array to a string.
  25590. *
  25591. * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
  25592. *
  25593. * @return {string} The stringified word array.
  25594. *
  25595. * @example
  25596. *
  25597. * var string = wordArray + '';
  25598. * var string = wordArray.toString();
  25599. * var string = wordArray.toString(CryptoJS.enc.Utf8);
  25600. */
  25601. toString: function toString(encoder) {
  25602. return (encoder || Hex).stringify(this);
  25603. },
  25604. /**
  25605. * Concatenates a word array to this word array.
  25606. *
  25607. * @param {WordArray} wordArray The word array to append.
  25608. *
  25609. * @return {WordArray} This word array.
  25610. *
  25611. * @example
  25612. *
  25613. * wordArray1.concat(wordArray2);
  25614. */
  25615. concat: function concat(wordArray) {
  25616. // Shortcuts
  25617. var thisWords = this.words;
  25618. var thatWords = wordArray.words;
  25619. var thisSigBytes = this.sigBytes;
  25620. var thatSigBytes = wordArray.sigBytes;
  25621. // Clamp excess bits
  25622. this.clamp();
  25623. // Concat
  25624. if (thisSigBytes % 4) {
  25625. // Copy one byte at a time
  25626. for (var i = 0; i < thatSigBytes; i++) {
  25627. var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  25628. thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8;
  25629. }
  25630. } else {
  25631. // Copy one word at a time
  25632. for (var j = 0; j < thatSigBytes; j += 4) {
  25633. thisWords[thisSigBytes + j >>> 2] = thatWords[j >>> 2];
  25634. }
  25635. }
  25636. this.sigBytes += thatSigBytes;
  25637. // Chainable
  25638. return this;
  25639. },
  25640. /**
  25641. * Removes insignificant bits.
  25642. *
  25643. * @example
  25644. *
  25645. * wordArray.clamp();
  25646. */
  25647. clamp: function clamp() {
  25648. // Shortcuts
  25649. var words = this.words;
  25650. var sigBytes = this.sigBytes;
  25651. // Clamp
  25652. words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8;
  25653. words.length = Math.ceil(sigBytes / 4);
  25654. },
  25655. /**
  25656. * Creates a copy of this word array.
  25657. *
  25658. * @return {WordArray} The clone.
  25659. *
  25660. * @example
  25661. *
  25662. * var clone = wordArray.clone();
  25663. */
  25664. clone: function clone() {
  25665. var clone = Base.clone.call(this);
  25666. clone.words = this.words.slice(0);
  25667. return clone;
  25668. },
  25669. /**
  25670. * Creates a word array filled with random bytes.
  25671. *
  25672. * @param {number} nBytes The number of random bytes to generate.
  25673. *
  25674. * @return {WordArray} The random word array.
  25675. *
  25676. * @static
  25677. *
  25678. * @example
  25679. *
  25680. * var wordArray = CryptoJS.lib.WordArray.random(16);
  25681. */
  25682. random: function random(nBytes) {
  25683. var words = [];
  25684. for (var i = 0; i < nBytes; i += 4) {
  25685. words.push(cryptoSecureRandomInt());
  25686. }
  25687. return new WordArray.init(words, nBytes);
  25688. }
  25689. });
  25690. /**
  25691. * Encoder namespace.
  25692. */
  25693. var C_enc = C.enc = {};
  25694. /**
  25695. * Hex encoding strategy.
  25696. */
  25697. var Hex = C_enc.Hex = {
  25698. /**
  25699. * Converts a word array to a hex string.
  25700. *
  25701. * @param {WordArray} wordArray The word array.
  25702. *
  25703. * @return {string} The hex string.
  25704. *
  25705. * @static
  25706. *
  25707. * @example
  25708. *
  25709. * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
  25710. */
  25711. stringify: function stringify(wordArray) {
  25712. // Shortcuts
  25713. var words = wordArray.words;
  25714. var sigBytes = wordArray.sigBytes;
  25715. // Convert
  25716. var hexChars = [];
  25717. for (var i = 0; i < sigBytes; i++) {
  25718. var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  25719. hexChars.push((bite >>> 4).toString(16));
  25720. hexChars.push((bite & 0x0f).toString(16));
  25721. }
  25722. return hexChars.join('');
  25723. },
  25724. /**
  25725. * Converts a hex string to a word array.
  25726. *
  25727. * @param {string} hexStr The hex string.
  25728. *
  25729. * @return {WordArray} The word array.
  25730. *
  25731. * @static
  25732. *
  25733. * @example
  25734. *
  25735. * var wordArray = CryptoJS.enc.Hex.parse(hexString);
  25736. */
  25737. parse: function parse(hexStr) {
  25738. // Shortcut
  25739. var hexStrLength = hexStr.length;
  25740. // Convert
  25741. var words = [];
  25742. for (var i = 0; i < hexStrLength; i += 2) {
  25743. words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4;
  25744. }
  25745. return new WordArray.init(words, hexStrLength / 2);
  25746. }
  25747. };
  25748. /**
  25749. * Latin1 encoding strategy.
  25750. */
  25751. var Latin1 = C_enc.Latin1 = {
  25752. /**
  25753. * Converts a word array to a Latin1 string.
  25754. *
  25755. * @param {WordArray} wordArray The word array.
  25756. *
  25757. * @return {string} The Latin1 string.
  25758. *
  25759. * @static
  25760. *
  25761. * @example
  25762. *
  25763. * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
  25764. */
  25765. stringify: function stringify(wordArray) {
  25766. // Shortcuts
  25767. var words = wordArray.words;
  25768. var sigBytes = wordArray.sigBytes;
  25769. // Convert
  25770. var latin1Chars = [];
  25771. for (var i = 0; i < sigBytes; i++) {
  25772. var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  25773. latin1Chars.push(String.fromCharCode(bite));
  25774. }
  25775. return latin1Chars.join('');
  25776. },
  25777. /**
  25778. * Converts a Latin1 string to a word array.
  25779. *
  25780. * @param {string} latin1Str The Latin1 string.
  25781. *
  25782. * @return {WordArray} The word array.
  25783. *
  25784. * @static
  25785. *
  25786. * @example
  25787. *
  25788. * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
  25789. */
  25790. parse: function parse(latin1Str) {
  25791. // Shortcut
  25792. var latin1StrLength = latin1Str.length;
  25793. // Convert
  25794. var words = [];
  25795. for (var i = 0; i < latin1StrLength; i++) {
  25796. words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8;
  25797. }
  25798. return new WordArray.init(words, latin1StrLength);
  25799. }
  25800. };
  25801. /**
  25802. * UTF-8 encoding strategy.
  25803. */
  25804. var Utf8 = C_enc.Utf8 = {
  25805. /**
  25806. * Converts a word array to a UTF-8 string.
  25807. *
  25808. * @param {WordArray} wordArray The word array.
  25809. *
  25810. * @return {string} The UTF-8 string.
  25811. *
  25812. * @static
  25813. *
  25814. * @example
  25815. *
  25816. * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
  25817. */
  25818. stringify: function stringify(wordArray) {
  25819. try {
  25820. return decodeURIComponent(escape(Latin1.stringify(wordArray)));
  25821. } catch (e) {
  25822. throw new Error('Malformed UTF-8 data');
  25823. }
  25824. },
  25825. /**
  25826. * Converts a UTF-8 string to a word array.
  25827. *
  25828. * @param {string} utf8Str The UTF-8 string.
  25829. *
  25830. * @return {WordArray} The word array.
  25831. *
  25832. * @static
  25833. *
  25834. * @example
  25835. *
  25836. * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
  25837. */
  25838. parse: function parse(utf8Str) {
  25839. return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
  25840. }
  25841. };
  25842. /**
  25843. * Abstract buffered block algorithm template.
  25844. *
  25845. * The property blockSize must be implemented in a concrete subtype.
  25846. *
  25847. * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
  25848. */
  25849. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
  25850. /**
  25851. * Resets this block algorithm's data buffer to its initial state.
  25852. *
  25853. * @example
  25854. *
  25855. * bufferedBlockAlgorithm.reset();
  25856. */
  25857. reset: function reset() {
  25858. // Initial values
  25859. this._data = new WordArray.init();
  25860. this._nDataBytes = 0;
  25861. },
  25862. /**
  25863. * Adds new data to this block algorithm's buffer.
  25864. *
  25865. * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
  25866. *
  25867. * @example
  25868. *
  25869. * bufferedBlockAlgorithm._append('data');
  25870. * bufferedBlockAlgorithm._append(wordArray);
  25871. */
  25872. _append: function _append(data) {
  25873. // Convert string to WordArray, else assume WordArray already
  25874. if (typeof data == 'string') {
  25875. data = Utf8.parse(data);
  25876. }
  25877. // Append
  25878. this._data.concat(data);
  25879. this._nDataBytes += data.sigBytes;
  25880. },
  25881. /**
  25882. * Processes available data blocks.
  25883. *
  25884. * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
  25885. *
  25886. * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
  25887. *
  25888. * @return {WordArray} The processed data.
  25889. *
  25890. * @example
  25891. *
  25892. * var processedData = bufferedBlockAlgorithm._process();
  25893. * var processedData = bufferedBlockAlgorithm._process(!!'flush');
  25894. */
  25895. _process: function _process(doFlush) {
  25896. var processedWords;
  25897. // Shortcuts
  25898. var data = this._data;
  25899. var dataWords = data.words;
  25900. var dataSigBytes = data.sigBytes;
  25901. var blockSize = this.blockSize;
  25902. var blockSizeBytes = blockSize * 4;
  25903. // Count blocks ready
  25904. var nBlocksReady = dataSigBytes / blockSizeBytes;
  25905. if (doFlush) {
  25906. // Round up to include partial blocks
  25907. nBlocksReady = Math.ceil(nBlocksReady);
  25908. } else {
  25909. // Round down to include only full blocks,
  25910. // less the number of blocks that must remain in the buffer
  25911. nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
  25912. }
  25913. // Count words ready
  25914. var nWordsReady = nBlocksReady * blockSize;
  25915. // Count bytes ready
  25916. var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
  25917. // Process blocks
  25918. if (nWordsReady) {
  25919. for (var offset = 0; offset < nWordsReady; offset += blockSize) {
  25920. // Perform concrete-algorithm logic
  25921. this._doProcessBlock(dataWords, offset);
  25922. }
  25923. // Remove processed words
  25924. processedWords = dataWords.splice(0, nWordsReady);
  25925. data.sigBytes -= nBytesReady;
  25926. }
  25927. // Return processed words
  25928. return new WordArray.init(processedWords, nBytesReady);
  25929. },
  25930. /**
  25931. * Creates a copy of this object.
  25932. *
  25933. * @return {Object} The clone.
  25934. *
  25935. * @example
  25936. *
  25937. * var clone = bufferedBlockAlgorithm.clone();
  25938. */
  25939. clone: function clone() {
  25940. var clone = Base.clone.call(this);
  25941. clone._data = this._data.clone();
  25942. return clone;
  25943. },
  25944. _minBufferSize: 0
  25945. });
  25946. /**
  25947. * Abstract hasher template.
  25948. *
  25949. * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
  25950. */
  25951. var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
  25952. /**
  25953. * Configuration options.
  25954. */
  25955. cfg: Base.extend(),
  25956. /**
  25957. * Initializes a newly created hasher.
  25958. *
  25959. * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
  25960. *
  25961. * @example
  25962. *
  25963. * var hasher = CryptoJS.algo.SHA256.create();
  25964. */
  25965. init: function init(cfg) {
  25966. // Apply config defaults
  25967. this.cfg = this.cfg.extend(cfg);
  25968. // Set initial values
  25969. this.reset();
  25970. },
  25971. /**
  25972. * Resets this hasher to its initial state.
  25973. *
  25974. * @example
  25975. *
  25976. * hasher.reset();
  25977. */
  25978. reset: function reset() {
  25979. // Reset data buffer
  25980. BufferedBlockAlgorithm.reset.call(this);
  25981. // Perform concrete-hasher logic
  25982. this._doReset();
  25983. },
  25984. /**
  25985. * Updates this hasher with a message.
  25986. *
  25987. * @param {WordArray|string} messageUpdate The message to append.
  25988. *
  25989. * @return {Hasher} This hasher.
  25990. *
  25991. * @example
  25992. *
  25993. * hasher.update('message');
  25994. * hasher.update(wordArray);
  25995. */
  25996. update: function update(messageUpdate) {
  25997. // Append
  25998. this._append(messageUpdate);
  25999. // Update the hash
  26000. this._process();
  26001. // Chainable
  26002. return this;
  26003. },
  26004. /**
  26005. * Finalizes the hash computation.
  26006. * Note that the finalize operation is effectively a destructive, read-once operation.
  26007. *
  26008. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  26009. *
  26010. * @return {WordArray} The hash.
  26011. *
  26012. * @example
  26013. *
  26014. * var hash = hasher.finalize();
  26015. * var hash = hasher.finalize('message');
  26016. * var hash = hasher.finalize(wordArray);
  26017. */
  26018. finalize: function finalize(messageUpdate) {
  26019. // Final message update
  26020. if (messageUpdate) {
  26021. this._append(messageUpdate);
  26022. }
  26023. // Perform concrete-hasher logic
  26024. var hash = this._doFinalize();
  26025. return hash;
  26026. },
  26027. blockSize: 512 / 32,
  26028. /**
  26029. * Creates a shortcut function to a hasher's object interface.
  26030. *
  26031. * @param {Hasher} hasher The hasher to create a helper for.
  26032. *
  26033. * @return {Function} The shortcut function.
  26034. *
  26035. * @static
  26036. *
  26037. * @example
  26038. *
  26039. * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
  26040. */
  26041. _createHelper: function _createHelper(hasher) {
  26042. return function (message, cfg) {
  26043. return new hasher.init(cfg).finalize(message);
  26044. };
  26045. },
  26046. /**
  26047. * Creates a shortcut function to the HMAC's object interface.
  26048. *
  26049. * @param {Hasher} hasher The hasher to use in this HMAC helper.
  26050. *
  26051. * @return {Function} The shortcut function.
  26052. *
  26053. * @static
  26054. *
  26055. * @example
  26056. *
  26057. * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
  26058. */
  26059. _createHmacHelper: function _createHmacHelper(hasher) {
  26060. return function (message, key) {
  26061. return new C_algo.HMAC.init(hasher, key).finalize(message);
  26062. };
  26063. }
  26064. });
  26065. /**
  26066. * Algorithm namespace.
  26067. */
  26068. var C_algo = C.algo = {};
  26069. return C;
  26070. }(Math);
  26071. (function (undefined) {
  26072. // Shortcuts
  26073. var C = CryptoJS;
  26074. var C_lib = C.lib;
  26075. var Base = C_lib.Base;
  26076. var X32WordArray = C_lib.WordArray;
  26077. /**
  26078. * x64 namespace.
  26079. */
  26080. var C_x64 = C.x64 = {};
  26081. /**
  26082. * A 64-bit word.
  26083. */
  26084. var X64Word = C_x64.Word = Base.extend({
  26085. /**
  26086. * Initializes a newly created 64-bit word.
  26087. *
  26088. * @param {number} high The high 32 bits.
  26089. * @param {number} low The low 32 bits.
  26090. *
  26091. * @example
  26092. *
  26093. * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
  26094. */
  26095. init: function init(high, low) {
  26096. this.high = high;
  26097. this.low = low;
  26098. }
  26099. /**
  26100. * Bitwise NOTs this word.
  26101. *
  26102. * @return {X64Word} A new x64-Word object after negating.
  26103. *
  26104. * @example
  26105. *
  26106. * var negated = x64Word.not();
  26107. */
  26108. // not: function () {
  26109. // var high = ~this.high;
  26110. // var low = ~this.low;
  26111. // return X64Word.create(high, low);
  26112. // },
  26113. /**
  26114. * Bitwise ANDs this word with the passed word.
  26115. *
  26116. * @param {X64Word} word The x64-Word to AND with this word.
  26117. *
  26118. * @return {X64Word} A new x64-Word object after ANDing.
  26119. *
  26120. * @example
  26121. *
  26122. * var anded = x64Word.and(anotherX64Word);
  26123. */
  26124. // and: function (word) {
  26125. // var high = this.high & word.high;
  26126. // var low = this.low & word.low;
  26127. // return X64Word.create(high, low);
  26128. // },
  26129. /**
  26130. * Bitwise ORs this word with the passed word.
  26131. *
  26132. * @param {X64Word} word The x64-Word to OR with this word.
  26133. *
  26134. * @return {X64Word} A new x64-Word object after ORing.
  26135. *
  26136. * @example
  26137. *
  26138. * var ored = x64Word.or(anotherX64Word);
  26139. */
  26140. // or: function (word) {
  26141. // var high = this.high | word.high;
  26142. // var low = this.low | word.low;
  26143. // return X64Word.create(high, low);
  26144. // },
  26145. /**
  26146. * Bitwise XORs this word with the passed word.
  26147. *
  26148. * @param {X64Word} word The x64-Word to XOR with this word.
  26149. *
  26150. * @return {X64Word} A new x64-Word object after XORing.
  26151. *
  26152. * @example
  26153. *
  26154. * var xored = x64Word.xor(anotherX64Word);
  26155. */
  26156. // xor: function (word) {
  26157. // var high = this.high ^ word.high;
  26158. // var low = this.low ^ word.low;
  26159. // return X64Word.create(high, low);
  26160. // },
  26161. /**
  26162. * Shifts this word n bits to the left.
  26163. *
  26164. * @param {number} n The number of bits to shift.
  26165. *
  26166. * @return {X64Word} A new x64-Word object after shifting.
  26167. *
  26168. * @example
  26169. *
  26170. * var shifted = x64Word.shiftL(25);
  26171. */
  26172. // shiftL: function (n) {
  26173. // if (n < 32) {
  26174. // var high = (this.high << n) | (this.low >>> (32 - n));
  26175. // var low = this.low << n;
  26176. // } else {
  26177. // var high = this.low << (n - 32);
  26178. // var low = 0;
  26179. // }
  26180. // return X64Word.create(high, low);
  26181. // },
  26182. /**
  26183. * Shifts this word n bits to the right.
  26184. *
  26185. * @param {number} n The number of bits to shift.
  26186. *
  26187. * @return {X64Word} A new x64-Word object after shifting.
  26188. *
  26189. * @example
  26190. *
  26191. * var shifted = x64Word.shiftR(7);
  26192. */
  26193. // shiftR: function (n) {
  26194. // if (n < 32) {
  26195. // var low = (this.low >>> n) | (this.high << (32 - n));
  26196. // var high = this.high >>> n;
  26197. // } else {
  26198. // var low = this.high >>> (n - 32);
  26199. // var high = 0;
  26200. // }
  26201. // return X64Word.create(high, low);
  26202. // },
  26203. /**
  26204. * Rotates this word n bits to the left.
  26205. *
  26206. * @param {number} n The number of bits to rotate.
  26207. *
  26208. * @return {X64Word} A new x64-Word object after rotating.
  26209. *
  26210. * @example
  26211. *
  26212. * var rotated = x64Word.rotL(25);
  26213. */
  26214. // rotL: function (n) {
  26215. // return this.shiftL(n).or(this.shiftR(64 - n));
  26216. // },
  26217. /**
  26218. * Rotates this word n bits to the right.
  26219. *
  26220. * @param {number} n The number of bits to rotate.
  26221. *
  26222. * @return {X64Word} A new x64-Word object after rotating.
  26223. *
  26224. * @example
  26225. *
  26226. * var rotated = x64Word.rotR(7);
  26227. */
  26228. // rotR: function (n) {
  26229. // return this.shiftR(n).or(this.shiftL(64 - n));
  26230. // },
  26231. /**
  26232. * Adds this word with the passed word.
  26233. *
  26234. * @param {X64Word} word The x64-Word to add with this word.
  26235. *
  26236. * @return {X64Word} A new x64-Word object after adding.
  26237. *
  26238. * @example
  26239. *
  26240. * var added = x64Word.add(anotherX64Word);
  26241. */
  26242. // add: function (word) {
  26243. // var low = (this.low + word.low) | 0;
  26244. // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
  26245. // var high = (this.high + word.high + carry) | 0;
  26246. // return X64Word.create(high, low);
  26247. // }
  26248. });
  26249. /**
  26250. * An array of 64-bit words.
  26251. *
  26252. * @property {Array} words The array of CryptoJS.x64.Word objects.
  26253. * @property {number} sigBytes The number of significant bytes in this word array.
  26254. */
  26255. var X64WordArray = C_x64.WordArray = Base.extend({
  26256. /**
  26257. * Initializes a newly created word array.
  26258. *
  26259. * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
  26260. * @param {number} sigBytes (Optional) The number of significant bytes in the words.
  26261. *
  26262. * @example
  26263. *
  26264. * var wordArray = CryptoJS.x64.WordArray.create();
  26265. *
  26266. * var wordArray = CryptoJS.x64.WordArray.create([
  26267. * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
  26268. * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
  26269. * ]);
  26270. *
  26271. * var wordArray = CryptoJS.x64.WordArray.create([
  26272. * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
  26273. * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
  26274. * ], 10);
  26275. */
  26276. init: function init(words, sigBytes) {
  26277. words = this.words = words || [];
  26278. if (sigBytes != undefined) {
  26279. this.sigBytes = sigBytes;
  26280. } else {
  26281. this.sigBytes = words.length * 8;
  26282. }
  26283. },
  26284. /**
  26285. * Converts this 64-bit word array to a 32-bit word array.
  26286. *
  26287. * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
  26288. *
  26289. * @example
  26290. *
  26291. * var x32WordArray = x64WordArray.toX32();
  26292. */
  26293. toX32: function toX32() {
  26294. // Shortcuts
  26295. var x64Words = this.words;
  26296. var x64WordsLength = x64Words.length;
  26297. // Convert
  26298. var x32Words = [];
  26299. for (var i = 0; i < x64WordsLength; i++) {
  26300. var x64Word = x64Words[i];
  26301. x32Words.push(x64Word.high);
  26302. x32Words.push(x64Word.low);
  26303. }
  26304. return X32WordArray.create(x32Words, this.sigBytes);
  26305. },
  26306. /**
  26307. * Creates a copy of this word array.
  26308. *
  26309. * @return {X64WordArray} The clone.
  26310. *
  26311. * @example
  26312. *
  26313. * var clone = x64WordArray.clone();
  26314. */
  26315. clone: function clone() {
  26316. var clone = Base.clone.call(this);
  26317. // Clone "words" array
  26318. var words = clone.words = this.words.slice(0);
  26319. // Clone each X64Word object
  26320. var wordsLength = words.length;
  26321. for (var i = 0; i < wordsLength; i++) {
  26322. words[i] = words[i].clone();
  26323. }
  26324. return clone;
  26325. }
  26326. });
  26327. })();
  26328. (function () {
  26329. // Check if typed arrays are supported
  26330. if (typeof ArrayBuffer != 'function') {
  26331. return;
  26332. }
  26333. // Shortcuts
  26334. var C = CryptoJS;
  26335. var C_lib = C.lib;
  26336. var WordArray = C_lib.WordArray;
  26337. // Reference original init
  26338. var superInit = WordArray.init;
  26339. // Augment WordArray.init to handle typed arrays
  26340. var subInit = WordArray.init = function (typedArray) {
  26341. // Convert buffers to uint8
  26342. if (typedArray instanceof ArrayBuffer) {
  26343. typedArray = new Uint8Array(typedArray);
  26344. }
  26345. // Convert other array views to uint8
  26346. if (typedArray instanceof Int8Array || typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array) {
  26347. typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
  26348. }
  26349. // Handle Uint8Array
  26350. if (typedArray instanceof Uint8Array) {
  26351. // Shortcut
  26352. var typedArrayByteLength = typedArray.byteLength;
  26353. // Extract bytes
  26354. var words = [];
  26355. for (var i = 0; i < typedArrayByteLength; i++) {
  26356. words[i >>> 2] |= typedArray[i] << 24 - i % 4 * 8;
  26357. }
  26358. // Initialize this word array
  26359. superInit.call(this, words, typedArrayByteLength);
  26360. } else {
  26361. // Else call normal init
  26362. superInit.apply(this, arguments);
  26363. }
  26364. };
  26365. subInit.prototype = WordArray;
  26366. })();
  26367. (function () {
  26368. // Shortcuts
  26369. var C = CryptoJS;
  26370. var C_lib = C.lib;
  26371. var WordArray = C_lib.WordArray;
  26372. var C_enc = C.enc;
  26373. /**
  26374. * UTF-16 BE encoding strategy.
  26375. */
  26376. var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
  26377. /**
  26378. * Converts a word array to a UTF-16 BE string.
  26379. *
  26380. * @param {WordArray} wordArray The word array.
  26381. *
  26382. * @return {string} The UTF-16 BE string.
  26383. *
  26384. * @static
  26385. *
  26386. * @example
  26387. *
  26388. * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
  26389. */
  26390. stringify: function stringify(wordArray) {
  26391. // Shortcuts
  26392. var words = wordArray.words;
  26393. var sigBytes = wordArray.sigBytes;
  26394. // Convert
  26395. var utf16Chars = [];
  26396. for (var i = 0; i < sigBytes; i += 2) {
  26397. var codePoint = words[i >>> 2] >>> 16 - i % 4 * 8 & 0xffff;
  26398. utf16Chars.push(String.fromCharCode(codePoint));
  26399. }
  26400. return utf16Chars.join('');
  26401. },
  26402. /**
  26403. * Converts a UTF-16 BE string to a word array.
  26404. *
  26405. * @param {string} utf16Str The UTF-16 BE string.
  26406. *
  26407. * @return {WordArray} The word array.
  26408. *
  26409. * @static
  26410. *
  26411. * @example
  26412. *
  26413. * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
  26414. */
  26415. parse: function parse(utf16Str) {
  26416. // Shortcut
  26417. var utf16StrLength = utf16Str.length;
  26418. // Convert
  26419. var words = [];
  26420. for (var i = 0; i < utf16StrLength; i++) {
  26421. words[i >>> 1] |= utf16Str.charCodeAt(i) << 16 - i % 2 * 16;
  26422. }
  26423. return WordArray.create(words, utf16StrLength * 2);
  26424. }
  26425. };
  26426. /**
  26427. * UTF-16 LE encoding strategy.
  26428. */
  26429. C_enc.Utf16LE = {
  26430. /**
  26431. * Converts a word array to a UTF-16 LE string.
  26432. *
  26433. * @param {WordArray} wordArray The word array.
  26434. *
  26435. * @return {string} The UTF-16 LE string.
  26436. *
  26437. * @static
  26438. *
  26439. * @example
  26440. *
  26441. * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
  26442. */
  26443. stringify: function stringify(wordArray) {
  26444. // Shortcuts
  26445. var words = wordArray.words;
  26446. var sigBytes = wordArray.sigBytes;
  26447. // Convert
  26448. var utf16Chars = [];
  26449. for (var i = 0; i < sigBytes; i += 2) {
  26450. var codePoint = swapEndian(words[i >>> 2] >>> 16 - i % 4 * 8 & 0xffff);
  26451. utf16Chars.push(String.fromCharCode(codePoint));
  26452. }
  26453. return utf16Chars.join('');
  26454. },
  26455. /**
  26456. * Converts a UTF-16 LE string to a word array.
  26457. *
  26458. * @param {string} utf16Str The UTF-16 LE string.
  26459. *
  26460. * @return {WordArray} The word array.
  26461. *
  26462. * @static
  26463. *
  26464. * @example
  26465. *
  26466. * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
  26467. */
  26468. parse: function parse(utf16Str) {
  26469. // Shortcut
  26470. var utf16StrLength = utf16Str.length;
  26471. // Convert
  26472. var words = [];
  26473. for (var i = 0; i < utf16StrLength; i++) {
  26474. words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << 16 - i % 2 * 16);
  26475. }
  26476. return WordArray.create(words, utf16StrLength * 2);
  26477. }
  26478. };
  26479. function swapEndian(word) {
  26480. return word << 8 & 0xff00ff00 | word >>> 8 & 0x00ff00ff;
  26481. }
  26482. })();
  26483. (function () {
  26484. // Shortcuts
  26485. var C = CryptoJS;
  26486. var C_lib = C.lib;
  26487. var WordArray = C_lib.WordArray;
  26488. var C_enc = C.enc;
  26489. /**
  26490. * Base64 encoding strategy.
  26491. */
  26492. var Base64 = C_enc.Base64 = {
  26493. /**
  26494. * Converts a word array to a Base64 string.
  26495. *
  26496. * @param {WordArray} wordArray The word array.
  26497. *
  26498. * @return {string} The Base64 string.
  26499. *
  26500. * @static
  26501. *
  26502. * @example
  26503. *
  26504. * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
  26505. */
  26506. stringify: function stringify(wordArray) {
  26507. // Shortcuts
  26508. var words = wordArray.words;
  26509. var sigBytes = wordArray.sigBytes;
  26510. var map = this._map;
  26511. // Clamp excess bits
  26512. wordArray.clamp();
  26513. // Convert
  26514. var base64Chars = [];
  26515. for (var i = 0; i < sigBytes; i += 3) {
  26516. var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  26517. var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;
  26518. var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;
  26519. var triplet = byte1 << 16 | byte2 << 8 | byte3;
  26520. for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
  26521. base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));
  26522. }
  26523. }
  26524. // Add padding
  26525. var paddingChar = map.charAt(64);
  26526. if (paddingChar) {
  26527. while (base64Chars.length % 4) {
  26528. base64Chars.push(paddingChar);
  26529. }
  26530. }
  26531. return base64Chars.join('');
  26532. },
  26533. /**
  26534. * Converts a Base64 string to a word array.
  26535. *
  26536. * @param {string} base64Str The Base64 string.
  26537. *
  26538. * @return {WordArray} The word array.
  26539. *
  26540. * @static
  26541. *
  26542. * @example
  26543. *
  26544. * var wordArray = CryptoJS.enc.Base64.parse(base64String);
  26545. */
  26546. parse: function parse(base64Str) {
  26547. // Shortcuts
  26548. var base64StrLength = base64Str.length;
  26549. var map = this._map;
  26550. var reverseMap = this._reverseMap;
  26551. if (!reverseMap) {
  26552. reverseMap = this._reverseMap = [];
  26553. for (var j = 0; j < map.length; j++) {
  26554. reverseMap[map.charCodeAt(j)] = j;
  26555. }
  26556. }
  26557. // Ignore padding
  26558. var paddingChar = map.charAt(64);
  26559. if (paddingChar) {
  26560. var paddingIndex = base64Str.indexOf(paddingChar);
  26561. if (paddingIndex !== -1) {
  26562. base64StrLength = paddingIndex;
  26563. }
  26564. }
  26565. // Convert
  26566. return parseLoop(base64Str, base64StrLength, reverseMap);
  26567. },
  26568. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
  26569. };
  26570. function parseLoop(base64Str, base64StrLength, reverseMap) {
  26571. var words = [];
  26572. var nBytes = 0;
  26573. for (var i = 0; i < base64StrLength; i++) {
  26574. if (i % 4) {
  26575. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;
  26576. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;
  26577. var bitsCombined = bits1 | bits2;
  26578. words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
  26579. nBytes++;
  26580. }
  26581. }
  26582. return WordArray.create(words, nBytes);
  26583. }
  26584. })();
  26585. (function () {
  26586. // Shortcuts
  26587. var C = CryptoJS;
  26588. var C_lib = C.lib;
  26589. var WordArray = C_lib.WordArray;
  26590. var C_enc = C.enc;
  26591. /**
  26592. * Base64url encoding strategy.
  26593. */
  26594. var Base64url = C_enc.Base64url = {
  26595. /**
  26596. * Converts a word array to a Base64url string.
  26597. *
  26598. * @param {WordArray} wordArray The word array.
  26599. *
  26600. * @param {boolean} urlSafe Whether to use url safe
  26601. *
  26602. * @return {string} The Base64url string.
  26603. *
  26604. * @static
  26605. *
  26606. * @example
  26607. *
  26608. * var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
  26609. */
  26610. stringify: function stringify(wordArray) {
  26611. var urlSafe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  26612. // Shortcuts
  26613. var words = wordArray.words;
  26614. var sigBytes = wordArray.sigBytes;
  26615. var map = urlSafe ? this._safe_map : this._map;
  26616. // Clamp excess bits
  26617. wordArray.clamp();
  26618. // Convert
  26619. var base64Chars = [];
  26620. for (var i = 0; i < sigBytes; i += 3) {
  26621. var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
  26622. var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff;
  26623. var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff;
  26624. var triplet = byte1 << 16 | byte2 << 8 | byte3;
  26625. for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
  26626. base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f));
  26627. }
  26628. }
  26629. // Add padding
  26630. var paddingChar = map.charAt(64);
  26631. if (paddingChar) {
  26632. while (base64Chars.length % 4) {
  26633. base64Chars.push(paddingChar);
  26634. }
  26635. }
  26636. return base64Chars.join('');
  26637. },
  26638. /**
  26639. * Converts a Base64url string to a word array.
  26640. *
  26641. * @param {string} base64Str The Base64url string.
  26642. *
  26643. * @param {boolean} urlSafe Whether to use url safe
  26644. *
  26645. * @return {WordArray} The word array.
  26646. *
  26647. * @static
  26648. *
  26649. * @example
  26650. *
  26651. * var wordArray = CryptoJS.enc.Base64url.parse(base64String);
  26652. */
  26653. parse: function parse(base64Str) {
  26654. var urlSafe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  26655. // Shortcuts
  26656. var base64StrLength = base64Str.length;
  26657. var map = urlSafe ? this._safe_map : this._map;
  26658. var reverseMap = this._reverseMap;
  26659. if (!reverseMap) {
  26660. reverseMap = this._reverseMap = [];
  26661. for (var j = 0; j < map.length; j++) {
  26662. reverseMap[map.charCodeAt(j)] = j;
  26663. }
  26664. }
  26665. // Ignore padding
  26666. var paddingChar = map.charAt(64);
  26667. if (paddingChar) {
  26668. var paddingIndex = base64Str.indexOf(paddingChar);
  26669. if (paddingIndex !== -1) {
  26670. base64StrLength = paddingIndex;
  26671. }
  26672. }
  26673. // Convert
  26674. return parseLoop(base64Str, base64StrLength, reverseMap);
  26675. },
  26676. _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
  26677. _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
  26678. };
  26679. function parseLoop(base64Str, base64StrLength, reverseMap) {
  26680. var words = [];
  26681. var nBytes = 0;
  26682. for (var i = 0; i < base64StrLength; i++) {
  26683. if (i % 4) {
  26684. var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2;
  26685. var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2;
  26686. var bitsCombined = bits1 | bits2;
  26687. words[nBytes >>> 2] |= bitsCombined << 24 - nBytes % 4 * 8;
  26688. nBytes++;
  26689. }
  26690. }
  26691. return WordArray.create(words, nBytes);
  26692. }
  26693. })();
  26694. (function (Math) {
  26695. // Shortcuts
  26696. var C = CryptoJS;
  26697. var C_lib = C.lib;
  26698. var WordArray = C_lib.WordArray;
  26699. var Hasher = C_lib.Hasher;
  26700. var C_algo = C.algo;
  26701. // Constants table
  26702. var T = [];
  26703. // Compute constants
  26704. (function () {
  26705. for (var i = 0; i < 64; i++) {
  26706. T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0;
  26707. }
  26708. })();
  26709. /**
  26710. * MD5 hash algorithm.
  26711. */
  26712. var MD5 = C_algo.MD5 = Hasher.extend({
  26713. _doReset: function _doReset() {
  26714. this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
  26715. },
  26716. _doProcessBlock: function _doProcessBlock(M, offset) {
  26717. // Swap endian
  26718. for (var i = 0; i < 16; i++) {
  26719. // Shortcuts
  26720. var offset_i = offset + i;
  26721. var M_offset_i = M[offset_i];
  26722. M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
  26723. }
  26724. // Shortcuts
  26725. var H = this._hash.words;
  26726. var M_offset_0 = M[offset + 0];
  26727. var M_offset_1 = M[offset + 1];
  26728. var M_offset_2 = M[offset + 2];
  26729. var M_offset_3 = M[offset + 3];
  26730. var M_offset_4 = M[offset + 4];
  26731. var M_offset_5 = M[offset + 5];
  26732. var M_offset_6 = M[offset + 6];
  26733. var M_offset_7 = M[offset + 7];
  26734. var M_offset_8 = M[offset + 8];
  26735. var M_offset_9 = M[offset + 9];
  26736. var M_offset_10 = M[offset + 10];
  26737. var M_offset_11 = M[offset + 11];
  26738. var M_offset_12 = M[offset + 12];
  26739. var M_offset_13 = M[offset + 13];
  26740. var M_offset_14 = M[offset + 14];
  26741. var M_offset_15 = M[offset + 15];
  26742. // Working varialbes
  26743. var a = H[0];
  26744. var b = H[1];
  26745. var c = H[2];
  26746. var d = H[3];
  26747. // Computation
  26748. a = FF(a, b, c, d, M_offset_0, 7, T[0]);
  26749. d = FF(d, a, b, c, M_offset_1, 12, T[1]);
  26750. c = FF(c, d, a, b, M_offset_2, 17, T[2]);
  26751. b = FF(b, c, d, a, M_offset_3, 22, T[3]);
  26752. a = FF(a, b, c, d, M_offset_4, 7, T[4]);
  26753. d = FF(d, a, b, c, M_offset_5, 12, T[5]);
  26754. c = FF(c, d, a, b, M_offset_6, 17, T[6]);
  26755. b = FF(b, c, d, a, M_offset_7, 22, T[7]);
  26756. a = FF(a, b, c, d, M_offset_8, 7, T[8]);
  26757. d = FF(d, a, b, c, M_offset_9, 12, T[9]);
  26758. c = FF(c, d, a, b, M_offset_10, 17, T[10]);
  26759. b = FF(b, c, d, a, M_offset_11, 22, T[11]);
  26760. a = FF(a, b, c, d, M_offset_12, 7, T[12]);
  26761. d = FF(d, a, b, c, M_offset_13, 12, T[13]);
  26762. c = FF(c, d, a, b, M_offset_14, 17, T[14]);
  26763. b = FF(b, c, d, a, M_offset_15, 22, T[15]);
  26764. a = GG(a, b, c, d, M_offset_1, 5, T[16]);
  26765. d = GG(d, a, b, c, M_offset_6, 9, T[17]);
  26766. c = GG(c, d, a, b, M_offset_11, 14, T[18]);
  26767. b = GG(b, c, d, a, M_offset_0, 20, T[19]);
  26768. a = GG(a, b, c, d, M_offset_5, 5, T[20]);
  26769. d = GG(d, a, b, c, M_offset_10, 9, T[21]);
  26770. c = GG(c, d, a, b, M_offset_15, 14, T[22]);
  26771. b = GG(b, c, d, a, M_offset_4, 20, T[23]);
  26772. a = GG(a, b, c, d, M_offset_9, 5, T[24]);
  26773. d = GG(d, a, b, c, M_offset_14, 9, T[25]);
  26774. c = GG(c, d, a, b, M_offset_3, 14, T[26]);
  26775. b = GG(b, c, d, a, M_offset_8, 20, T[27]);
  26776. a = GG(a, b, c, d, M_offset_13, 5, T[28]);
  26777. d = GG(d, a, b, c, M_offset_2, 9, T[29]);
  26778. c = GG(c, d, a, b, M_offset_7, 14, T[30]);
  26779. b = GG(b, c, d, a, M_offset_12, 20, T[31]);
  26780. a = HH(a, b, c, d, M_offset_5, 4, T[32]);
  26781. d = HH(d, a, b, c, M_offset_8, 11, T[33]);
  26782. c = HH(c, d, a, b, M_offset_11, 16, T[34]);
  26783. b = HH(b, c, d, a, M_offset_14, 23, T[35]);
  26784. a = HH(a, b, c, d, M_offset_1, 4, T[36]);
  26785. d = HH(d, a, b, c, M_offset_4, 11, T[37]);
  26786. c = HH(c, d, a, b, M_offset_7, 16, T[38]);
  26787. b = HH(b, c, d, a, M_offset_10, 23, T[39]);
  26788. a = HH(a, b, c, d, M_offset_13, 4, T[40]);
  26789. d = HH(d, a, b, c, M_offset_0, 11, T[41]);
  26790. c = HH(c, d, a, b, M_offset_3, 16, T[42]);
  26791. b = HH(b, c, d, a, M_offset_6, 23, T[43]);
  26792. a = HH(a, b, c, d, M_offset_9, 4, T[44]);
  26793. d = HH(d, a, b, c, M_offset_12, 11, T[45]);
  26794. c = HH(c, d, a, b, M_offset_15, 16, T[46]);
  26795. b = HH(b, c, d, a, M_offset_2, 23, T[47]);
  26796. a = II(a, b, c, d, M_offset_0, 6, T[48]);
  26797. d = II(d, a, b, c, M_offset_7, 10, T[49]);
  26798. c = II(c, d, a, b, M_offset_14, 15, T[50]);
  26799. b = II(b, c, d, a, M_offset_5, 21, T[51]);
  26800. a = II(a, b, c, d, M_offset_12, 6, T[52]);
  26801. d = II(d, a, b, c, M_offset_3, 10, T[53]);
  26802. c = II(c, d, a, b, M_offset_10, 15, T[54]);
  26803. b = II(b, c, d, a, M_offset_1, 21, T[55]);
  26804. a = II(a, b, c, d, M_offset_8, 6, T[56]);
  26805. d = II(d, a, b, c, M_offset_15, 10, T[57]);
  26806. c = II(c, d, a, b, M_offset_6, 15, T[58]);
  26807. b = II(b, c, d, a, M_offset_13, 21, T[59]);
  26808. a = II(a, b, c, d, M_offset_4, 6, T[60]);
  26809. d = II(d, a, b, c, M_offset_11, 10, T[61]);
  26810. c = II(c, d, a, b, M_offset_2, 15, T[62]);
  26811. b = II(b, c, d, a, M_offset_9, 21, T[63]);
  26812. // Intermediate hash value
  26813. H[0] = H[0] + a | 0;
  26814. H[1] = H[1] + b | 0;
  26815. H[2] = H[2] + c | 0;
  26816. H[3] = H[3] + d | 0;
  26817. },
  26818. _doFinalize: function _doFinalize() {
  26819. // Shortcuts
  26820. var data = this._data;
  26821. var dataWords = data.words;
  26822. var nBitsTotal = this._nDataBytes * 8;
  26823. var nBitsLeft = data.sigBytes * 8;
  26824. // Add padding
  26825. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  26826. var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
  26827. var nBitsTotalL = nBitsTotal;
  26828. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00;
  26829. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00;
  26830. data.sigBytes = (dataWords.length + 1) * 4;
  26831. // Hash final blocks
  26832. this._process();
  26833. // Shortcuts
  26834. var hash = this._hash;
  26835. var H = hash.words;
  26836. // Swap endian
  26837. for (var i = 0; i < 4; i++) {
  26838. // Shortcut
  26839. var H_i = H[i];
  26840. H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;
  26841. }
  26842. // Return final computed hash
  26843. return hash;
  26844. },
  26845. clone: function clone() {
  26846. var clone = Hasher.clone.call(this);
  26847. clone._hash = this._hash.clone();
  26848. return clone;
  26849. }
  26850. });
  26851. function FF(a, b, c, d, x, s, t) {
  26852. var n = a + (b & c | ~b & d) + x + t;
  26853. return (n << s | n >>> 32 - s) + b;
  26854. }
  26855. function GG(a, b, c, d, x, s, t) {
  26856. var n = a + (b & d | c & ~d) + x + t;
  26857. return (n << s | n >>> 32 - s) + b;
  26858. }
  26859. function HH(a, b, c, d, x, s, t) {
  26860. var n = a + (b ^ c ^ d) + x + t;
  26861. return (n << s | n >>> 32 - s) + b;
  26862. }
  26863. function II(a, b, c, d, x, s, t) {
  26864. var n = a + (c ^ (b | ~d)) + x + t;
  26865. return (n << s | n >>> 32 - s) + b;
  26866. }
  26867. /**
  26868. * Shortcut function to the hasher's object interface.
  26869. *
  26870. * @param {WordArray|string} message The message to hash.
  26871. *
  26872. * @return {WordArray} The hash.
  26873. *
  26874. * @static
  26875. *
  26876. * @example
  26877. *
  26878. * var hash = CryptoJS.MD5('message');
  26879. * var hash = CryptoJS.MD5(wordArray);
  26880. */
  26881. C.MD5 = Hasher._createHelper(MD5);
  26882. /**
  26883. * Shortcut function to the HMAC's object interface.
  26884. *
  26885. * @param {WordArray|string} message The message to hash.
  26886. * @param {WordArray|string} key The secret key.
  26887. *
  26888. * @return {WordArray} The HMAC.
  26889. *
  26890. * @static
  26891. *
  26892. * @example
  26893. *
  26894. * var hmac = CryptoJS.HmacMD5(message, key);
  26895. */
  26896. C.HmacMD5 = Hasher._createHmacHelper(MD5);
  26897. })(Math);
  26898. (function () {
  26899. // Shortcuts
  26900. var C = CryptoJS;
  26901. var C_lib = C.lib;
  26902. var WordArray = C_lib.WordArray;
  26903. var Hasher = C_lib.Hasher;
  26904. var C_algo = C.algo;
  26905. // Reusable object
  26906. var W = [];
  26907. /**
  26908. * SHA-1 hash algorithm.
  26909. */
  26910. var SHA1 = C_algo.SHA1 = Hasher.extend({
  26911. _doReset: function _doReset() {
  26912. this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]);
  26913. },
  26914. _doProcessBlock: function _doProcessBlock(M, offset) {
  26915. // Shortcut
  26916. var H = this._hash.words;
  26917. // Working variables
  26918. var a = H[0];
  26919. var b = H[1];
  26920. var c = H[2];
  26921. var d = H[3];
  26922. var e = H[4];
  26923. // Computation
  26924. for (var i = 0; i < 80; i++) {
  26925. if (i < 16) {
  26926. W[i] = M[offset + i] | 0;
  26927. } else {
  26928. var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
  26929. W[i] = n << 1 | n >>> 31;
  26930. }
  26931. var t = (a << 5 | a >>> 27) + e + W[i];
  26932. if (i < 20) {
  26933. t += (b & c | ~b & d) + 0x5a827999;
  26934. } else if (i < 40) {
  26935. t += (b ^ c ^ d) + 0x6ed9eba1;
  26936. } else if (i < 60) {
  26937. t += (b & c | b & d | c & d) - 0x70e44324;
  26938. } else /* if (i < 80) */{
  26939. t += (b ^ c ^ d) - 0x359d3e2a;
  26940. }
  26941. e = d;
  26942. d = c;
  26943. c = b << 30 | b >>> 2;
  26944. b = a;
  26945. a = t;
  26946. }
  26947. // Intermediate hash value
  26948. H[0] = H[0] + a | 0;
  26949. H[1] = H[1] + b | 0;
  26950. H[2] = H[2] + c | 0;
  26951. H[3] = H[3] + d | 0;
  26952. H[4] = H[4] + e | 0;
  26953. },
  26954. _doFinalize: function _doFinalize() {
  26955. // Shortcuts
  26956. var data = this._data;
  26957. var dataWords = data.words;
  26958. var nBitsTotal = this._nDataBytes * 8;
  26959. var nBitsLeft = data.sigBytes * 8;
  26960. // Add padding
  26961. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  26962. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  26963. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
  26964. data.sigBytes = dataWords.length * 4;
  26965. // Hash final blocks
  26966. this._process();
  26967. // Return final computed hash
  26968. return this._hash;
  26969. },
  26970. clone: function clone() {
  26971. var clone = Hasher.clone.call(this);
  26972. clone._hash = this._hash.clone();
  26973. return clone;
  26974. }
  26975. });
  26976. /**
  26977. * Shortcut function to the hasher's object interface.
  26978. *
  26979. * @param {WordArray|string} message The message to hash.
  26980. *
  26981. * @return {WordArray} The hash.
  26982. *
  26983. * @static
  26984. *
  26985. * @example
  26986. *
  26987. * var hash = CryptoJS.SHA1('message');
  26988. * var hash = CryptoJS.SHA1(wordArray);
  26989. */
  26990. C.SHA1 = Hasher._createHelper(SHA1);
  26991. /**
  26992. * Shortcut function to the HMAC's object interface.
  26993. *
  26994. * @param {WordArray|string} message The message to hash.
  26995. * @param {WordArray|string} key The secret key.
  26996. *
  26997. * @return {WordArray} The HMAC.
  26998. *
  26999. * @static
  27000. *
  27001. * @example
  27002. *
  27003. * var hmac = CryptoJS.HmacSHA1(message, key);
  27004. */
  27005. C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
  27006. })();
  27007. (function (Math) {
  27008. // Shortcuts
  27009. var C = CryptoJS;
  27010. var C_lib = C.lib;
  27011. var WordArray = C_lib.WordArray;
  27012. var Hasher = C_lib.Hasher;
  27013. var C_algo = C.algo;
  27014. // Initialization and round constants tables
  27015. var H = [];
  27016. var K = [];
  27017. // Compute constants
  27018. (function () {
  27019. function isPrime(n) {
  27020. var sqrtN = Math.sqrt(n);
  27021. for (var factor = 2; factor <= sqrtN; factor++) {
  27022. if (!(n % factor)) {
  27023. return false;
  27024. }
  27025. }
  27026. return true;
  27027. }
  27028. function getFractionalBits(n) {
  27029. return (n - (n | 0)) * 0x100000000 | 0;
  27030. }
  27031. var n = 2;
  27032. var nPrime = 0;
  27033. while (nPrime < 64) {
  27034. if (isPrime(n)) {
  27035. if (nPrime < 8) {
  27036. H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
  27037. }
  27038. K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
  27039. nPrime++;
  27040. }
  27041. n++;
  27042. }
  27043. })();
  27044. // Reusable object
  27045. var W = [];
  27046. /**
  27047. * SHA-256 hash algorithm.
  27048. */
  27049. var SHA256 = C_algo.SHA256 = Hasher.extend({
  27050. _doReset: function _doReset() {
  27051. this._hash = new WordArray.init(H.slice(0));
  27052. },
  27053. _doProcessBlock: function _doProcessBlock(M, offset) {
  27054. // Shortcut
  27055. var H = this._hash.words;
  27056. // Working variables
  27057. var a = H[0];
  27058. var b = H[1];
  27059. var c = H[2];
  27060. var d = H[3];
  27061. var e = H[4];
  27062. var f = H[5];
  27063. var g = H[6];
  27064. var h = H[7];
  27065. // Computation
  27066. for (var i = 0; i < 64; i++) {
  27067. if (i < 16) {
  27068. W[i] = M[offset + i] | 0;
  27069. } else {
  27070. var gamma0x = W[i - 15];
  27071. var gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3;
  27072. var gamma1x = W[i - 2];
  27073. var gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10;
  27074. W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
  27075. }
  27076. var ch = e & f ^ ~e & g;
  27077. var maj = a & b ^ a & c ^ b & c;
  27078. var sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22);
  27079. var sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25);
  27080. var t1 = h + sigma1 + ch + K[i] + W[i];
  27081. var t2 = sigma0 + maj;
  27082. h = g;
  27083. g = f;
  27084. f = e;
  27085. e = d + t1 | 0;
  27086. d = c;
  27087. c = b;
  27088. b = a;
  27089. a = t1 + t2 | 0;
  27090. }
  27091. // Intermediate hash value
  27092. H[0] = H[0] + a | 0;
  27093. H[1] = H[1] + b | 0;
  27094. H[2] = H[2] + c | 0;
  27095. H[3] = H[3] + d | 0;
  27096. H[4] = H[4] + e | 0;
  27097. H[5] = H[5] + f | 0;
  27098. H[6] = H[6] + g | 0;
  27099. H[7] = H[7] + h | 0;
  27100. },
  27101. _doFinalize: function _doFinalize() {
  27102. // Shortcuts
  27103. var data = this._data;
  27104. var dataWords = data.words;
  27105. var nBitsTotal = this._nDataBytes * 8;
  27106. var nBitsLeft = data.sigBytes * 8;
  27107. // Add padding
  27108. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  27109. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
  27110. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;
  27111. data.sigBytes = dataWords.length * 4;
  27112. // Hash final blocks
  27113. this._process();
  27114. // Return final computed hash
  27115. return this._hash;
  27116. },
  27117. clone: function clone() {
  27118. var clone = Hasher.clone.call(this);
  27119. clone._hash = this._hash.clone();
  27120. return clone;
  27121. }
  27122. });
  27123. /**
  27124. * Shortcut function to the hasher's object interface.
  27125. *
  27126. * @param {WordArray|string} message The message to hash.
  27127. *
  27128. * @return {WordArray} The hash.
  27129. *
  27130. * @static
  27131. *
  27132. * @example
  27133. *
  27134. * var hash = CryptoJS.SHA256('message');
  27135. * var hash = CryptoJS.SHA256(wordArray);
  27136. */
  27137. C.SHA256 = Hasher._createHelper(SHA256);
  27138. /**
  27139. * Shortcut function to the HMAC's object interface.
  27140. *
  27141. * @param {WordArray|string} message The message to hash.
  27142. * @param {WordArray|string} key The secret key.
  27143. *
  27144. * @return {WordArray} The HMAC.
  27145. *
  27146. * @static
  27147. *
  27148. * @example
  27149. *
  27150. * var hmac = CryptoJS.HmacSHA256(message, key);
  27151. */
  27152. C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
  27153. })(Math);
  27154. (function () {
  27155. // Shortcuts
  27156. var C = CryptoJS;
  27157. var C_lib = C.lib;
  27158. var WordArray = C_lib.WordArray;
  27159. var C_algo = C.algo;
  27160. var SHA256 = C_algo.SHA256;
  27161. /**
  27162. * SHA-224 hash algorithm.
  27163. */
  27164. var SHA224 = C_algo.SHA224 = SHA256.extend({
  27165. _doReset: function _doReset() {
  27166. this._hash = new WordArray.init([0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]);
  27167. },
  27168. _doFinalize: function _doFinalize() {
  27169. var hash = SHA256._doFinalize.call(this);
  27170. hash.sigBytes -= 4;
  27171. return hash;
  27172. }
  27173. });
  27174. /**
  27175. * Shortcut function to the hasher's object interface.
  27176. *
  27177. * @param {WordArray|string} message The message to hash.
  27178. *
  27179. * @return {WordArray} The hash.
  27180. *
  27181. * @static
  27182. *
  27183. * @example
  27184. *
  27185. * var hash = CryptoJS.SHA224('message');
  27186. * var hash = CryptoJS.SHA224(wordArray);
  27187. */
  27188. C.SHA224 = SHA256._createHelper(SHA224);
  27189. /**
  27190. * Shortcut function to the HMAC's object interface.
  27191. *
  27192. * @param {WordArray|string} message The message to hash.
  27193. * @param {WordArray|string} key The secret key.
  27194. *
  27195. * @return {WordArray} The HMAC.
  27196. *
  27197. * @static
  27198. *
  27199. * @example
  27200. *
  27201. * var hmac = CryptoJS.HmacSHA224(message, key);
  27202. */
  27203. C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
  27204. })();
  27205. (function () {
  27206. // Shortcuts
  27207. var C = CryptoJS;
  27208. var C_lib = C.lib;
  27209. var Hasher = C_lib.Hasher;
  27210. var C_x64 = C.x64;
  27211. var X64Word = C_x64.Word;
  27212. var X64WordArray = C_x64.WordArray;
  27213. var C_algo = C.algo;
  27214. function X64Word_create() {
  27215. return X64Word.create.apply(X64Word, arguments);
  27216. }
  27217. // Constants
  27218. var K = [X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)];
  27219. // Reusable objects
  27220. var W = [];
  27221. (function () {
  27222. for (var i = 0; i < 80; i++) {
  27223. W[i] = X64Word_create();
  27224. }
  27225. })();
  27226. /**
  27227. * SHA-512 hash algorithm.
  27228. */
  27229. var SHA512 = C_algo.SHA512 = Hasher.extend({
  27230. _doReset: function _doReset() {
  27231. this._hash = new X64WordArray.init([new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)]);
  27232. },
  27233. _doProcessBlock: function _doProcessBlock(M, offset) {
  27234. // Shortcuts
  27235. var H = this._hash.words;
  27236. var H0 = H[0];
  27237. var H1 = H[1];
  27238. var H2 = H[2];
  27239. var H3 = H[3];
  27240. var H4 = H[4];
  27241. var H5 = H[5];
  27242. var H6 = H[6];
  27243. var H7 = H[7];
  27244. var H0h = H0.high;
  27245. var H0l = H0.low;
  27246. var H1h = H1.high;
  27247. var H1l = H1.low;
  27248. var H2h = H2.high;
  27249. var H2l = H2.low;
  27250. var H3h = H3.high;
  27251. var H3l = H3.low;
  27252. var H4h = H4.high;
  27253. var H4l = H4.low;
  27254. var H5h = H5.high;
  27255. var H5l = H5.low;
  27256. var H6h = H6.high;
  27257. var H6l = H6.low;
  27258. var H7h = H7.high;
  27259. var H7l = H7.low;
  27260. // Working variables
  27261. var ah = H0h;
  27262. var al = H0l;
  27263. var bh = H1h;
  27264. var bl = H1l;
  27265. var ch = H2h;
  27266. var cl = H2l;
  27267. var dh = H3h;
  27268. var dl = H3l;
  27269. var eh = H4h;
  27270. var el = H4l;
  27271. var fh = H5h;
  27272. var fl = H5l;
  27273. var gh = H6h;
  27274. var gl = H6l;
  27275. var hh = H7h;
  27276. var hl = H7l;
  27277. // Rounds
  27278. for (var i = 0; i < 80; i++) {
  27279. var Wil;
  27280. var Wih;
  27281. // Shortcut
  27282. var Wi = W[i];
  27283. // Extend message
  27284. if (i < 16) {
  27285. Wih = Wi.high = M[offset + i * 2] | 0;
  27286. Wil = Wi.low = M[offset + i * 2 + 1] | 0;
  27287. } else {
  27288. // Gamma0
  27289. var gamma0x = W[i - 15];
  27290. var gamma0xh = gamma0x.high;
  27291. var gamma0xl = gamma0x.low;
  27292. var gamma0h = (gamma0xh >>> 1 | gamma0xl << 31) ^ (gamma0xh >>> 8 | gamma0xl << 24) ^ gamma0xh >>> 7;
  27293. var gamma0l = (gamma0xl >>> 1 | gamma0xh << 31) ^ (gamma0xl >>> 8 | gamma0xh << 24) ^ (gamma0xl >>> 7 | gamma0xh << 25);
  27294. // Gamma1
  27295. var gamma1x = W[i - 2];
  27296. var gamma1xh = gamma1x.high;
  27297. var gamma1xl = gamma1x.low;
  27298. var gamma1h = (gamma1xh >>> 19 | gamma1xl << 13) ^ (gamma1xh << 3 | gamma1xl >>> 29) ^ gamma1xh >>> 6;
  27299. var gamma1l = (gamma1xl >>> 19 | gamma1xh << 13) ^ (gamma1xl << 3 | gamma1xh >>> 29) ^ (gamma1xl >>> 6 | gamma1xh << 26);
  27300. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  27301. var Wi7 = W[i - 7];
  27302. var Wi7h = Wi7.high;
  27303. var Wi7l = Wi7.low;
  27304. var Wi16 = W[i - 16];
  27305. var Wi16h = Wi16.high;
  27306. var Wi16l = Wi16.low;
  27307. Wil = gamma0l + Wi7l;
  27308. Wih = gamma0h + Wi7h + (Wil >>> 0 < gamma0l >>> 0 ? 1 : 0);
  27309. Wil = Wil + gamma1l;
  27310. Wih = Wih + gamma1h + (Wil >>> 0 < gamma1l >>> 0 ? 1 : 0);
  27311. Wil = Wil + Wi16l;
  27312. Wih = Wih + Wi16h + (Wil >>> 0 < Wi16l >>> 0 ? 1 : 0);
  27313. Wi.high = Wih;
  27314. Wi.low = Wil;
  27315. }
  27316. var chh = eh & fh ^ ~eh & gh;
  27317. var chl = el & fl ^ ~el & gl;
  27318. var majh = ah & bh ^ ah & ch ^ bh & ch;
  27319. var majl = al & bl ^ al & cl ^ bl & cl;
  27320. var sigma0h = (ah >>> 28 | al << 4) ^ (ah << 30 | al >>> 2) ^ (ah << 25 | al >>> 7);
  27321. var sigma0l = (al >>> 28 | ah << 4) ^ (al << 30 | ah >>> 2) ^ (al << 25 | ah >>> 7);
  27322. var sigma1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (eh << 23 | el >>> 9);
  27323. var sigma1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (el << 23 | eh >>> 9);
  27324. // t1 = h + sigma1 + ch + K[i] + W[i]
  27325. var Ki = K[i];
  27326. var Kih = Ki.high;
  27327. var Kil = Ki.low;
  27328. var t1l = hl + sigma1l;
  27329. var t1h = hh + sigma1h + (t1l >>> 0 < hl >>> 0 ? 1 : 0);
  27330. var t1l = t1l + chl;
  27331. var t1h = t1h + chh + (t1l >>> 0 < chl >>> 0 ? 1 : 0);
  27332. var t1l = t1l + Kil;
  27333. var t1h = t1h + Kih + (t1l >>> 0 < Kil >>> 0 ? 1 : 0);
  27334. var t1l = t1l + Wil;
  27335. var t1h = t1h + Wih + (t1l >>> 0 < Wil >>> 0 ? 1 : 0);
  27336. // t2 = sigma0 + maj
  27337. var t2l = sigma0l + majl;
  27338. var t2h = sigma0h + majh + (t2l >>> 0 < sigma0l >>> 0 ? 1 : 0);
  27339. // Update working variables
  27340. hh = gh;
  27341. hl = gl;
  27342. gh = fh;
  27343. gl = fl;
  27344. fh = eh;
  27345. fl = el;
  27346. el = dl + t1l | 0;
  27347. eh = dh + t1h + (el >>> 0 < dl >>> 0 ? 1 : 0) | 0;
  27348. dh = ch;
  27349. dl = cl;
  27350. ch = bh;
  27351. cl = bl;
  27352. bh = ah;
  27353. bl = al;
  27354. al = t1l + t2l | 0;
  27355. ah = t1h + t2h + (al >>> 0 < t1l >>> 0 ? 1 : 0) | 0;
  27356. }
  27357. // Intermediate hash value
  27358. H0l = H0.low = H0l + al;
  27359. H0.high = H0h + ah + (H0l >>> 0 < al >>> 0 ? 1 : 0);
  27360. H1l = H1.low = H1l + bl;
  27361. H1.high = H1h + bh + (H1l >>> 0 < bl >>> 0 ? 1 : 0);
  27362. H2l = H2.low = H2l + cl;
  27363. H2.high = H2h + ch + (H2l >>> 0 < cl >>> 0 ? 1 : 0);
  27364. H3l = H3.low = H3l + dl;
  27365. H3.high = H3h + dh + (H3l >>> 0 < dl >>> 0 ? 1 : 0);
  27366. H4l = H4.low = H4l + el;
  27367. H4.high = H4h + eh + (H4l >>> 0 < el >>> 0 ? 1 : 0);
  27368. H5l = H5.low = H5l + fl;
  27369. H5.high = H5h + fh + (H5l >>> 0 < fl >>> 0 ? 1 : 0);
  27370. H6l = H6.low = H6l + gl;
  27371. H6.high = H6h + gh + (H6l >>> 0 < gl >>> 0 ? 1 : 0);
  27372. H7l = H7.low = H7l + hl;
  27373. H7.high = H7h + hh + (H7l >>> 0 < hl >>> 0 ? 1 : 0);
  27374. },
  27375. _doFinalize: function _doFinalize() {
  27376. // Shortcuts
  27377. var data = this._data;
  27378. var dataWords = data.words;
  27379. var nBitsTotal = this._nDataBytes * 8;
  27380. var nBitsLeft = data.sigBytes * 8;
  27381. // Add padding
  27382. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  27383. dataWords[(nBitsLeft + 128 >>> 10 << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
  27384. dataWords[(nBitsLeft + 128 >>> 10 << 5) + 31] = nBitsTotal;
  27385. data.sigBytes = dataWords.length * 4;
  27386. // Hash final blocks
  27387. this._process();
  27388. // Convert hash to 32-bit word array before returning
  27389. var hash = this._hash.toX32();
  27390. // Return final computed hash
  27391. return hash;
  27392. },
  27393. clone: function clone() {
  27394. var clone = Hasher.clone.call(this);
  27395. clone._hash = this._hash.clone();
  27396. return clone;
  27397. },
  27398. blockSize: 1024 / 32
  27399. });
  27400. /**
  27401. * Shortcut function to the hasher's object interface.
  27402. *
  27403. * @param {WordArray|string} message The message to hash.
  27404. *
  27405. * @return {WordArray} The hash.
  27406. *
  27407. * @static
  27408. *
  27409. * @example
  27410. *
  27411. * var hash = CryptoJS.SHA512('message');
  27412. * var hash = CryptoJS.SHA512(wordArray);
  27413. */
  27414. C.SHA512 = Hasher._createHelper(SHA512);
  27415. /**
  27416. * Shortcut function to the HMAC's object interface.
  27417. *
  27418. * @param {WordArray|string} message The message to hash.
  27419. * @param {WordArray|string} key The secret key.
  27420. *
  27421. * @return {WordArray} The HMAC.
  27422. *
  27423. * @static
  27424. *
  27425. * @example
  27426. *
  27427. * var hmac = CryptoJS.HmacSHA512(message, key);
  27428. */
  27429. C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
  27430. })();
  27431. (function () {
  27432. // Shortcuts
  27433. var C = CryptoJS;
  27434. var C_x64 = C.x64;
  27435. var X64Word = C_x64.Word;
  27436. var X64WordArray = C_x64.WordArray;
  27437. var C_algo = C.algo;
  27438. var SHA512 = C_algo.SHA512;
  27439. /**
  27440. * SHA-384 hash algorithm.
  27441. */
  27442. var SHA384 = C_algo.SHA384 = SHA512.extend({
  27443. _doReset: function _doReset() {
  27444. this._hash = new X64WordArray.init([new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)]);
  27445. },
  27446. _doFinalize: function _doFinalize() {
  27447. var hash = SHA512._doFinalize.call(this);
  27448. hash.sigBytes -= 16;
  27449. return hash;
  27450. }
  27451. });
  27452. /**
  27453. * Shortcut function to the hasher's object interface.
  27454. *
  27455. * @param {WordArray|string} message The message to hash.
  27456. *
  27457. * @return {WordArray} The hash.
  27458. *
  27459. * @static
  27460. *
  27461. * @example
  27462. *
  27463. * var hash = CryptoJS.SHA384('message');
  27464. * var hash = CryptoJS.SHA384(wordArray);
  27465. */
  27466. C.SHA384 = SHA512._createHelper(SHA384);
  27467. /**
  27468. * Shortcut function to the HMAC's object interface.
  27469. *
  27470. * @param {WordArray|string} message The message to hash.
  27471. * @param {WordArray|string} key The secret key.
  27472. *
  27473. * @return {WordArray} The HMAC.
  27474. *
  27475. * @static
  27476. *
  27477. * @example
  27478. *
  27479. * var hmac = CryptoJS.HmacSHA384(message, key);
  27480. */
  27481. C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
  27482. })();
  27483. (function (Math) {
  27484. // Shortcuts
  27485. var C = CryptoJS;
  27486. var C_lib = C.lib;
  27487. var WordArray = C_lib.WordArray;
  27488. var Hasher = C_lib.Hasher;
  27489. var C_x64 = C.x64;
  27490. var X64Word = C_x64.Word;
  27491. var C_algo = C.algo;
  27492. // Constants tables
  27493. var RHO_OFFSETS = [];
  27494. var PI_INDEXES = [];
  27495. var ROUND_CONSTANTS = [];
  27496. // Compute Constants
  27497. (function () {
  27498. // Compute rho offset constants
  27499. var x = 1,
  27500. y = 0;
  27501. for (var t = 0; t < 24; t++) {
  27502. RHO_OFFSETS[x + 5 * y] = (t + 1) * (t + 2) / 2 % 64;
  27503. var newX = y % 5;
  27504. var newY = (2 * x + 3 * y) % 5;
  27505. x = newX;
  27506. y = newY;
  27507. }
  27508. // Compute pi index constants
  27509. for (var x = 0; x < 5; x++) {
  27510. for (var y = 0; y < 5; y++) {
  27511. PI_INDEXES[x + 5 * y] = y + (2 * x + 3 * y) % 5 * 5;
  27512. }
  27513. }
  27514. // Compute round constants
  27515. var LFSR = 0x01;
  27516. for (var i = 0; i < 24; i++) {
  27517. var roundConstantMsw = 0;
  27518. var roundConstantLsw = 0;
  27519. for (var j = 0; j < 7; j++) {
  27520. if (LFSR & 0x01) {
  27521. var bitPosition = (1 << j) - 1;
  27522. if (bitPosition < 32) {
  27523. roundConstantLsw ^= 1 << bitPosition;
  27524. } else /* if (bitPosition >= 32) */{
  27525. roundConstantMsw ^= 1 << bitPosition - 32;
  27526. }
  27527. }
  27528. // Compute next LFSR
  27529. if (LFSR & 0x80) {
  27530. // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
  27531. LFSR = LFSR << 1 ^ 0x71;
  27532. } else {
  27533. LFSR <<= 1;
  27534. }
  27535. }
  27536. ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
  27537. }
  27538. })();
  27539. // Reusable objects for temporary values
  27540. var T = [];
  27541. (function () {
  27542. for (var i = 0; i < 25; i++) {
  27543. T[i] = X64Word.create();
  27544. }
  27545. })();
  27546. /**
  27547. * SHA-3 hash algorithm.
  27548. */
  27549. var SHA3 = C_algo.SHA3 = Hasher.extend({
  27550. /**
  27551. * Configuration options.
  27552. *
  27553. * @property {number} outputLength
  27554. * The desired number of bits in the output hash.
  27555. * Only values permitted are: 224, 256, 384, 512.
  27556. * Default: 512
  27557. */
  27558. cfg: Hasher.cfg.extend({
  27559. outputLength: 512
  27560. }),
  27561. _doReset: function _doReset() {
  27562. var state = this._state = [];
  27563. for (var i = 0; i < 25; i++) {
  27564. state[i] = new X64Word.init();
  27565. }
  27566. this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
  27567. },
  27568. _doProcessBlock: function _doProcessBlock(M, offset) {
  27569. // Shortcuts
  27570. var state = this._state;
  27571. var nBlockSizeLanes = this.blockSize / 2;
  27572. // Absorb
  27573. for (var i = 0; i < nBlockSizeLanes; i++) {
  27574. // Shortcuts
  27575. var M2i = M[offset + 2 * i];
  27576. var M2i1 = M[offset + 2 * i + 1];
  27577. // Swap endian
  27578. M2i = (M2i << 8 | M2i >>> 24) & 0x00ff00ff | (M2i << 24 | M2i >>> 8) & 0xff00ff00;
  27579. M2i1 = (M2i1 << 8 | M2i1 >>> 24) & 0x00ff00ff | (M2i1 << 24 | M2i1 >>> 8) & 0xff00ff00;
  27580. // Absorb message into state
  27581. var lane = state[i];
  27582. lane.high ^= M2i1;
  27583. lane.low ^= M2i;
  27584. }
  27585. // Rounds
  27586. for (var round = 0; round < 24; round++) {
  27587. // Theta
  27588. for (var x = 0; x < 5; x++) {
  27589. // Mix column lanes
  27590. var tMsw = 0,
  27591. tLsw = 0;
  27592. for (var y = 0; y < 5; y++) {
  27593. var lane = state[x + 5 * y];
  27594. tMsw ^= lane.high;
  27595. tLsw ^= lane.low;
  27596. }
  27597. // Temporary values
  27598. var Tx = T[x];
  27599. Tx.high = tMsw;
  27600. Tx.low = tLsw;
  27601. }
  27602. for (var x = 0; x < 5; x++) {
  27603. // Shortcuts
  27604. var Tx4 = T[(x + 4) % 5];
  27605. var Tx1 = T[(x + 1) % 5];
  27606. var Tx1Msw = Tx1.high;
  27607. var Tx1Lsw = Tx1.low;
  27608. // Mix surrounding columns
  27609. var tMsw = Tx4.high ^ (Tx1Msw << 1 | Tx1Lsw >>> 31);
  27610. var tLsw = Tx4.low ^ (Tx1Lsw << 1 | Tx1Msw >>> 31);
  27611. for (var y = 0; y < 5; y++) {
  27612. var lane = state[x + 5 * y];
  27613. lane.high ^= tMsw;
  27614. lane.low ^= tLsw;
  27615. }
  27616. }
  27617. // Rho Pi
  27618. for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
  27619. var tMsw;
  27620. var tLsw;
  27621. // Shortcuts
  27622. var lane = state[laneIndex];
  27623. var laneMsw = lane.high;
  27624. var laneLsw = lane.low;
  27625. var rhoOffset = RHO_OFFSETS[laneIndex];
  27626. // Rotate lanes
  27627. if (rhoOffset < 32) {
  27628. tMsw = laneMsw << rhoOffset | laneLsw >>> 32 - rhoOffset;
  27629. tLsw = laneLsw << rhoOffset | laneMsw >>> 32 - rhoOffset;
  27630. } else /* if (rhoOffset >= 32) */{
  27631. tMsw = laneLsw << rhoOffset - 32 | laneMsw >>> 64 - rhoOffset;
  27632. tLsw = laneMsw << rhoOffset - 32 | laneLsw >>> 64 - rhoOffset;
  27633. }
  27634. // Transpose lanes
  27635. var TPiLane = T[PI_INDEXES[laneIndex]];
  27636. TPiLane.high = tMsw;
  27637. TPiLane.low = tLsw;
  27638. }
  27639. // Rho pi at x = y = 0
  27640. var T0 = T[0];
  27641. var state0 = state[0];
  27642. T0.high = state0.high;
  27643. T0.low = state0.low;
  27644. // Chi
  27645. for (var x = 0; x < 5; x++) {
  27646. for (var y = 0; y < 5; y++) {
  27647. // Shortcuts
  27648. var laneIndex = x + 5 * y;
  27649. var lane = state[laneIndex];
  27650. var TLane = T[laneIndex];
  27651. var Tx1Lane = T[(x + 1) % 5 + 5 * y];
  27652. var Tx2Lane = T[(x + 2) % 5 + 5 * y];
  27653. // Mix rows
  27654. lane.high = TLane.high ^ ~Tx1Lane.high & Tx2Lane.high;
  27655. lane.low = TLane.low ^ ~Tx1Lane.low & Tx2Lane.low;
  27656. }
  27657. }
  27658. // Iota
  27659. var lane = state[0];
  27660. var roundConstant = ROUND_CONSTANTS[round];
  27661. lane.high ^= roundConstant.high;
  27662. lane.low ^= roundConstant.low;
  27663. }
  27664. },
  27665. _doFinalize: function _doFinalize() {
  27666. // Shortcuts
  27667. var data = this._data;
  27668. var dataWords = data.words;
  27669. var nBitsTotal = this._nDataBytes * 8;
  27670. var nBitsLeft = data.sigBytes * 8;
  27671. var blockSizeBits = this.blockSize * 32;
  27672. // Add padding
  27673. dataWords[nBitsLeft >>> 5] |= 0x1 << 24 - nBitsLeft % 32;
  27674. dataWords[(Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits >>> 5) - 1] |= 0x80;
  27675. data.sigBytes = dataWords.length * 4;
  27676. // Hash final blocks
  27677. this._process();
  27678. // Shortcuts
  27679. var state = this._state;
  27680. var outputLengthBytes = this.cfg.outputLength / 8;
  27681. var outputLengthLanes = outputLengthBytes / 8;
  27682. // Squeeze
  27683. var hashWords = [];
  27684. for (var i = 0; i < outputLengthLanes; i++) {
  27685. // Shortcuts
  27686. var lane = state[i];
  27687. var laneMsw = lane.high;
  27688. var laneLsw = lane.low;
  27689. // Swap endian
  27690. laneMsw = (laneMsw << 8 | laneMsw >>> 24) & 0x00ff00ff | (laneMsw << 24 | laneMsw >>> 8) & 0xff00ff00;
  27691. laneLsw = (laneLsw << 8 | laneLsw >>> 24) & 0x00ff00ff | (laneLsw << 24 | laneLsw >>> 8) & 0xff00ff00;
  27692. // Squeeze state to retrieve hash
  27693. hashWords.push(laneLsw);
  27694. hashWords.push(laneMsw);
  27695. }
  27696. // Return final computed hash
  27697. return new WordArray.init(hashWords, outputLengthBytes);
  27698. },
  27699. clone: function clone() {
  27700. var clone = Hasher.clone.call(this);
  27701. var state = clone._state = this._state.slice(0);
  27702. for (var i = 0; i < 25; i++) {
  27703. state[i] = state[i].clone();
  27704. }
  27705. return clone;
  27706. }
  27707. });
  27708. /**
  27709. * Shortcut function to the hasher's object interface.
  27710. *
  27711. * @param {WordArray|string} message The message to hash.
  27712. *
  27713. * @return {WordArray} The hash.
  27714. *
  27715. * @static
  27716. *
  27717. * @example
  27718. *
  27719. * var hash = CryptoJS.SHA3('message');
  27720. * var hash = CryptoJS.SHA3(wordArray);
  27721. */
  27722. C.SHA3 = Hasher._createHelper(SHA3);
  27723. /**
  27724. * Shortcut function to the HMAC's object interface.
  27725. *
  27726. * @param {WordArray|string} message The message to hash.
  27727. * @param {WordArray|string} key The secret key.
  27728. *
  27729. * @return {WordArray} The HMAC.
  27730. *
  27731. * @static
  27732. *
  27733. * @example
  27734. *
  27735. * var hmac = CryptoJS.HmacSHA3(message, key);
  27736. */
  27737. C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
  27738. })(Math);
  27739. /** @preserve
  27740. (c) 2012 by Cédric Mesnil. All rights reserved.
  27741. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  27742. - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  27743. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  27744. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27745. */
  27746. (function (Math) {
  27747. // Shortcuts
  27748. var C = CryptoJS;
  27749. var C_lib = C.lib;
  27750. var WordArray = C_lib.WordArray;
  27751. var Hasher = C_lib.Hasher;
  27752. var C_algo = C.algo;
  27753. // Constants table
  27754. var _zl = WordArray.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
  27755. var _zr = WordArray.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
  27756. var _sl = WordArray.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]);
  27757. var _sr = WordArray.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]);
  27758. var _hl = WordArray.create([0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
  27759. var _hr = WordArray.create([0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
  27760. /**
  27761. * RIPEMD160 hash algorithm.
  27762. */
  27763. var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
  27764. _doReset: function _doReset() {
  27765. this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
  27766. },
  27767. _doProcessBlock: function _doProcessBlock(M, offset) {
  27768. // Swap endian
  27769. for (var i = 0; i < 16; i++) {
  27770. // Shortcuts
  27771. var offset_i = offset + i;
  27772. var M_offset_i = M[offset_i];
  27773. // Swap
  27774. M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;
  27775. }
  27776. // Shortcut
  27777. var H = this._hash.words;
  27778. var hl = _hl.words;
  27779. var hr = _hr.words;
  27780. var zl = _zl.words;
  27781. var zr = _zr.words;
  27782. var sl = _sl.words;
  27783. var sr = _sr.words;
  27784. // Working variables
  27785. var al, bl, cl, dl, el;
  27786. var ar, br, cr, dr, er;
  27787. ar = al = H[0];
  27788. br = bl = H[1];
  27789. cr = cl = H[2];
  27790. dr = dl = H[3];
  27791. er = el = H[4];
  27792. // Computation
  27793. var t;
  27794. for (var i = 0; i < 80; i += 1) {
  27795. t = al + M[offset + zl[i]] | 0;
  27796. if (i < 16) {
  27797. t += f1(bl, cl, dl) + hl[0];
  27798. } else if (i < 32) {
  27799. t += f2(bl, cl, dl) + hl[1];
  27800. } else if (i < 48) {
  27801. t += f3(bl, cl, dl) + hl[2];
  27802. } else if (i < 64) {
  27803. t += f4(bl, cl, dl) + hl[3];
  27804. } else {
  27805. // if (i<80) {
  27806. t += f5(bl, cl, dl) + hl[4];
  27807. }
  27808. t = t | 0;
  27809. t = rotl(t, sl[i]);
  27810. t = t + el | 0;
  27811. al = el;
  27812. el = dl;
  27813. dl = rotl(cl, 10);
  27814. cl = bl;
  27815. bl = t;
  27816. t = ar + M[offset + zr[i]] | 0;
  27817. if (i < 16) {
  27818. t += f5(br, cr, dr) + hr[0];
  27819. } else if (i < 32) {
  27820. t += f4(br, cr, dr) + hr[1];
  27821. } else if (i < 48) {
  27822. t += f3(br, cr, dr) + hr[2];
  27823. } else if (i < 64) {
  27824. t += f2(br, cr, dr) + hr[3];
  27825. } else {
  27826. // if (i<80) {
  27827. t += f1(br, cr, dr) + hr[4];
  27828. }
  27829. t = t | 0;
  27830. t = rotl(t, sr[i]);
  27831. t = t + er | 0;
  27832. ar = er;
  27833. er = dr;
  27834. dr = rotl(cr, 10);
  27835. cr = br;
  27836. br = t;
  27837. }
  27838. // Intermediate hash value
  27839. t = H[1] + cl + dr | 0;
  27840. H[1] = H[2] + dl + er | 0;
  27841. H[2] = H[3] + el + ar | 0;
  27842. H[3] = H[4] + al + br | 0;
  27843. H[4] = H[0] + bl + cr | 0;
  27844. H[0] = t;
  27845. },
  27846. _doFinalize: function _doFinalize() {
  27847. // Shortcuts
  27848. var data = this._data;
  27849. var dataWords = data.words;
  27850. var nBitsTotal = this._nDataBytes * 8;
  27851. var nBitsLeft = data.sigBytes * 8;
  27852. // Add padding
  27853. dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;
  27854. dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotal << 8 | nBitsTotal >>> 24) & 0x00ff00ff | (nBitsTotal << 24 | nBitsTotal >>> 8) & 0xff00ff00;
  27855. data.sigBytes = (dataWords.length + 1) * 4;
  27856. // Hash final blocks
  27857. this._process();
  27858. // Shortcuts
  27859. var hash = this._hash;
  27860. var H = hash.words;
  27861. // Swap endian
  27862. for (var i = 0; i < 5; i++) {
  27863. // Shortcut
  27864. var H_i = H[i];
  27865. // Swap
  27866. H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;
  27867. }
  27868. // Return final computed hash
  27869. return hash;
  27870. },
  27871. clone: function clone() {
  27872. var clone = Hasher.clone.call(this);
  27873. clone._hash = this._hash.clone();
  27874. return clone;
  27875. }
  27876. });
  27877. function f1(x, y, z) {
  27878. return x ^ y ^ z;
  27879. }
  27880. function f2(x, y, z) {
  27881. return x & y | ~x & z;
  27882. }
  27883. function f3(x, y, z) {
  27884. return (x | ~y) ^ z;
  27885. }
  27886. function f4(x, y, z) {
  27887. return x & z | y & ~z;
  27888. }
  27889. function f5(x, y, z) {
  27890. return x ^ (y | ~z);
  27891. }
  27892. function rotl(x, n) {
  27893. return x << n | x >>> 32 - n;
  27894. }
  27895. /**
  27896. * Shortcut function to the hasher's object interface.
  27897. *
  27898. * @param {WordArray|string} message The message to hash.
  27899. *
  27900. * @return {WordArray} The hash.
  27901. *
  27902. * @static
  27903. *
  27904. * @example
  27905. *
  27906. * var hash = CryptoJS.RIPEMD160('message');
  27907. * var hash = CryptoJS.RIPEMD160(wordArray);
  27908. */
  27909. C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
  27910. /**
  27911. * Shortcut function to the HMAC's object interface.
  27912. *
  27913. * @param {WordArray|string} message The message to hash.
  27914. * @param {WordArray|string} key The secret key.
  27915. *
  27916. * @return {WordArray} The HMAC.
  27917. *
  27918. * @static
  27919. *
  27920. * @example
  27921. *
  27922. * var hmac = CryptoJS.HmacRIPEMD160(message, key);
  27923. */
  27924. C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
  27925. })(Math);
  27926. (function () {
  27927. // Shortcuts
  27928. var C = CryptoJS;
  27929. var C_lib = C.lib;
  27930. var Base = C_lib.Base;
  27931. var C_enc = C.enc;
  27932. var Utf8 = C_enc.Utf8;
  27933. var C_algo = C.algo;
  27934. /**
  27935. * HMAC algorithm.
  27936. */
  27937. var HMAC = C_algo.HMAC = Base.extend({
  27938. /**
  27939. * Initializes a newly created HMAC.
  27940. *
  27941. * @param {Hasher} hasher The hash algorithm to use.
  27942. * @param {WordArray|string} key The secret key.
  27943. *
  27944. * @example
  27945. *
  27946. * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
  27947. */
  27948. init: function init(hasher, key) {
  27949. // Init hasher
  27950. hasher = this._hasher = new hasher.init();
  27951. // Convert string to WordArray, else assume WordArray already
  27952. if (typeof key == 'string') {
  27953. key = Utf8.parse(key);
  27954. }
  27955. // Shortcuts
  27956. var hasherBlockSize = hasher.blockSize;
  27957. var hasherBlockSizeBytes = hasherBlockSize * 4;
  27958. // Allow arbitrary length keys
  27959. if (key.sigBytes > hasherBlockSizeBytes) {
  27960. key = hasher.finalize(key);
  27961. }
  27962. // Clamp excess bits
  27963. key.clamp();
  27964. // Clone key for inner and outer pads
  27965. var oKey = this._oKey = key.clone();
  27966. var iKey = this._iKey = key.clone();
  27967. // Shortcuts
  27968. var oKeyWords = oKey.words;
  27969. var iKeyWords = iKey.words;
  27970. // XOR keys with pad constants
  27971. for (var i = 0; i < hasherBlockSize; i++) {
  27972. oKeyWords[i] ^= 0x5c5c5c5c;
  27973. iKeyWords[i] ^= 0x36363636;
  27974. }
  27975. oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
  27976. // Set initial values
  27977. this.reset();
  27978. },
  27979. /**
  27980. * Resets this HMAC to its initial state.
  27981. *
  27982. * @example
  27983. *
  27984. * hmacHasher.reset();
  27985. */
  27986. reset: function reset() {
  27987. // Shortcut
  27988. var hasher = this._hasher;
  27989. // Reset
  27990. hasher.reset();
  27991. hasher.update(this._iKey);
  27992. },
  27993. /**
  27994. * Updates this HMAC with a message.
  27995. *
  27996. * @param {WordArray|string} messageUpdate The message to append.
  27997. *
  27998. * @return {HMAC} This HMAC instance.
  27999. *
  28000. * @example
  28001. *
  28002. * hmacHasher.update('message');
  28003. * hmacHasher.update(wordArray);
  28004. */
  28005. update: function update(messageUpdate) {
  28006. this._hasher.update(messageUpdate);
  28007. // Chainable
  28008. return this;
  28009. },
  28010. /**
  28011. * Finalizes the HMAC computation.
  28012. * Note that the finalize operation is effectively a destructive, read-once operation.
  28013. *
  28014. * @param {WordArray|string} messageUpdate (Optional) A final message update.
  28015. *
  28016. * @return {WordArray} The HMAC.
  28017. *
  28018. * @example
  28019. *
  28020. * var hmac = hmacHasher.finalize();
  28021. * var hmac = hmacHasher.finalize('message');
  28022. * var hmac = hmacHasher.finalize(wordArray);
  28023. */
  28024. finalize: function finalize(messageUpdate) {
  28025. // Shortcut
  28026. var hasher = this._hasher;
  28027. // Compute HMAC
  28028. var innerHash = hasher.finalize(messageUpdate);
  28029. hasher.reset();
  28030. var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
  28031. return hmac;
  28032. }
  28033. });
  28034. })();
  28035. (function () {
  28036. // Shortcuts
  28037. var C = CryptoJS;
  28038. var C_lib = C.lib;
  28039. var Base = C_lib.Base;
  28040. var WordArray = C_lib.WordArray;
  28041. var C_algo = C.algo;
  28042. var SHA1 = C_algo.SHA1;
  28043. var HMAC = C_algo.HMAC;
  28044. /**
  28045. * Password-Based Key Derivation Function 2 algorithm.
  28046. */
  28047. var PBKDF2 = C_algo.PBKDF2 = Base.extend({
  28048. /**
  28049. * Configuration options.
  28050. *
  28051. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  28052. * @property {Hasher} hasher The hasher to use. Default: SHA1
  28053. * @property {number} iterations The number of iterations to perform. Default: 1
  28054. */
  28055. cfg: Base.extend({
  28056. keySize: 128 / 32,
  28057. hasher: SHA1,
  28058. iterations: 1
  28059. }),
  28060. /**
  28061. * Initializes a newly created key derivation function.
  28062. *
  28063. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  28064. *
  28065. * @example
  28066. *
  28067. * var kdf = CryptoJS.algo.PBKDF2.create();
  28068. * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
  28069. * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
  28070. */
  28071. init: function init(cfg) {
  28072. this.cfg = this.cfg.extend(cfg);
  28073. },
  28074. /**
  28075. * Computes the Password-Based Key Derivation Function 2.
  28076. *
  28077. * @param {WordArray|string} password The password.
  28078. * @param {WordArray|string} salt A salt.
  28079. *
  28080. * @return {WordArray} The derived key.
  28081. *
  28082. * @example
  28083. *
  28084. * var key = kdf.compute(password, salt);
  28085. */
  28086. compute: function compute(password, salt) {
  28087. // Shortcut
  28088. var cfg = this.cfg;
  28089. // Init HMAC
  28090. var hmac = HMAC.create(cfg.hasher, password);
  28091. // Initial values
  28092. var derivedKey = WordArray.create();
  28093. var blockIndex = WordArray.create([0x00000001]);
  28094. // Shortcuts
  28095. var derivedKeyWords = derivedKey.words;
  28096. var blockIndexWords = blockIndex.words;
  28097. var keySize = cfg.keySize;
  28098. var iterations = cfg.iterations;
  28099. // Generate key
  28100. while (derivedKeyWords.length < keySize) {
  28101. var block = hmac.update(salt).finalize(blockIndex);
  28102. hmac.reset();
  28103. // Shortcuts
  28104. var blockWords = block.words;
  28105. var blockWordsLength = blockWords.length;
  28106. // Iterations
  28107. var intermediate = block;
  28108. for (var i = 1; i < iterations; i++) {
  28109. intermediate = hmac.finalize(intermediate);
  28110. hmac.reset();
  28111. // Shortcut
  28112. var intermediateWords = intermediate.words;
  28113. // XOR intermediate with block
  28114. for (var j = 0; j < blockWordsLength; j++) {
  28115. blockWords[j] ^= intermediateWords[j];
  28116. }
  28117. }
  28118. derivedKey.concat(block);
  28119. blockIndexWords[0]++;
  28120. }
  28121. derivedKey.sigBytes = keySize * 4;
  28122. return derivedKey;
  28123. }
  28124. });
  28125. /**
  28126. * Computes the Password-Based Key Derivation Function 2.
  28127. *
  28128. * @param {WordArray|string} password The password.
  28129. * @param {WordArray|string} salt A salt.
  28130. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  28131. *
  28132. * @return {WordArray} The derived key.
  28133. *
  28134. * @static
  28135. *
  28136. * @example
  28137. *
  28138. * var key = CryptoJS.PBKDF2(password, salt);
  28139. * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
  28140. * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
  28141. */
  28142. C.PBKDF2 = function (password, salt, cfg) {
  28143. return PBKDF2.create(cfg).compute(password, salt);
  28144. };
  28145. })();
  28146. (function () {
  28147. // Shortcuts
  28148. var C = CryptoJS;
  28149. var C_lib = C.lib;
  28150. var Base = C_lib.Base;
  28151. var WordArray = C_lib.WordArray;
  28152. var C_algo = C.algo;
  28153. var MD5 = C_algo.MD5;
  28154. /**
  28155. * This key derivation function is meant to conform with EVP_BytesToKey.
  28156. * www.openssl.org/docs/crypto/EVP_BytesToKey.html
  28157. */
  28158. var EvpKDF = C_algo.EvpKDF = Base.extend({
  28159. /**
  28160. * Configuration options.
  28161. *
  28162. * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
  28163. * @property {Hasher} hasher The hash algorithm to use. Default: MD5
  28164. * @property {number} iterations The number of iterations to perform. Default: 1
  28165. */
  28166. cfg: Base.extend({
  28167. keySize: 128 / 32,
  28168. hasher: MD5,
  28169. iterations: 1
  28170. }),
  28171. /**
  28172. * Initializes a newly created key derivation function.
  28173. *
  28174. * @param {Object} cfg (Optional) The configuration options to use for the derivation.
  28175. *
  28176. * @example
  28177. *
  28178. * var kdf = CryptoJS.algo.EvpKDF.create();
  28179. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
  28180. * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
  28181. */
  28182. init: function init(cfg) {
  28183. this.cfg = this.cfg.extend(cfg);
  28184. },
  28185. /**
  28186. * Derives a key from a password.
  28187. *
  28188. * @param {WordArray|string} password The password.
  28189. * @param {WordArray|string} salt A salt.
  28190. *
  28191. * @return {WordArray} The derived key.
  28192. *
  28193. * @example
  28194. *
  28195. * var key = kdf.compute(password, salt);
  28196. */
  28197. compute: function compute(password, salt) {
  28198. var block;
  28199. // Shortcut
  28200. var cfg = this.cfg;
  28201. // Init hasher
  28202. var hasher = cfg.hasher.create();
  28203. // Initial values
  28204. var derivedKey = WordArray.create();
  28205. // Shortcuts
  28206. var derivedKeyWords = derivedKey.words;
  28207. var keySize = cfg.keySize;
  28208. var iterations = cfg.iterations;
  28209. // Generate key
  28210. while (derivedKeyWords.length < keySize) {
  28211. if (block) {
  28212. hasher.update(block);
  28213. }
  28214. block = hasher.update(password).finalize(salt);
  28215. hasher.reset();
  28216. // Iterations
  28217. for (var i = 1; i < iterations; i++) {
  28218. block = hasher.finalize(block);
  28219. hasher.reset();
  28220. }
  28221. derivedKey.concat(block);
  28222. }
  28223. derivedKey.sigBytes = keySize * 4;
  28224. return derivedKey;
  28225. }
  28226. });
  28227. /**
  28228. * Derives a key from a password.
  28229. *
  28230. * @param {WordArray|string} password The password.
  28231. * @param {WordArray|string} salt A salt.
  28232. * @param {Object} cfg (Optional) The configuration options to use for this computation.
  28233. *
  28234. * @return {WordArray} The derived key.
  28235. *
  28236. * @static
  28237. *
  28238. * @example
  28239. *
  28240. * var key = CryptoJS.EvpKDF(password, salt);
  28241. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
  28242. * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
  28243. */
  28244. C.EvpKDF = function (password, salt, cfg) {
  28245. return EvpKDF.create(cfg).compute(password, salt);
  28246. };
  28247. })();
  28248. /**
  28249. * Cipher core components.
  28250. */
  28251. CryptoJS.lib.Cipher || function (undefined) {
  28252. // Shortcuts
  28253. var C = CryptoJS;
  28254. var C_lib = C.lib;
  28255. var Base = C_lib.Base;
  28256. var WordArray = C_lib.WordArray;
  28257. var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
  28258. var C_enc = C.enc;
  28259. var Utf8 = C_enc.Utf8;
  28260. var Base64 = C_enc.Base64;
  28261. var C_algo = C.algo;
  28262. var EvpKDF = C_algo.EvpKDF;
  28263. /**
  28264. * Abstract base cipher template.
  28265. *
  28266. * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
  28267. * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
  28268. * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
  28269. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
  28270. */
  28271. var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
  28272. /**
  28273. * Configuration options.
  28274. *
  28275. * @property {WordArray} iv The IV to use for this operation.
  28276. */
  28277. cfg: Base.extend(),
  28278. /**
  28279. * Creates this cipher in encryption mode.
  28280. *
  28281. * @param {WordArray} key The key.
  28282. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  28283. *
  28284. * @return {Cipher} A cipher instance.
  28285. *
  28286. * @static
  28287. *
  28288. * @example
  28289. *
  28290. * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  28291. */
  28292. createEncryptor: function createEncryptor(key, cfg) {
  28293. return this.create(this._ENC_XFORM_MODE, key, cfg);
  28294. },
  28295. /**
  28296. * Creates this cipher in decryption mode.
  28297. *
  28298. * @param {WordArray} key The key.
  28299. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  28300. *
  28301. * @return {Cipher} A cipher instance.
  28302. *
  28303. * @static
  28304. *
  28305. * @example
  28306. *
  28307. * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  28308. */
  28309. createDecryptor: function createDecryptor(key, cfg) {
  28310. return this.create(this._DEC_XFORM_MODE, key, cfg);
  28311. },
  28312. /**
  28313. * Initializes a newly created cipher.
  28314. *
  28315. * @param {number} xformMode Either the encryption or decryption transormation mode constant.
  28316. * @param {WordArray} key The key.
  28317. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  28318. *
  28319. * @example
  28320. *
  28321. * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
  28322. */
  28323. init: function init(xformMode, key, cfg) {
  28324. // Apply config defaults
  28325. this.cfg = this.cfg.extend(cfg);
  28326. // Store transform mode and key
  28327. this._xformMode = xformMode;
  28328. this._key = key;
  28329. // Set initial values
  28330. this.reset();
  28331. },
  28332. /**
  28333. * Resets this cipher to its initial state.
  28334. *
  28335. * @example
  28336. *
  28337. * cipher.reset();
  28338. */
  28339. reset: function reset() {
  28340. // Reset data buffer
  28341. BufferedBlockAlgorithm.reset.call(this);
  28342. // Perform concrete-cipher logic
  28343. this._doReset();
  28344. },
  28345. /**
  28346. * Adds data to be encrypted or decrypted.
  28347. *
  28348. * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
  28349. *
  28350. * @return {WordArray} The data after processing.
  28351. *
  28352. * @example
  28353. *
  28354. * var encrypted = cipher.process('data');
  28355. * var encrypted = cipher.process(wordArray);
  28356. */
  28357. process: function process(dataUpdate) {
  28358. // Append
  28359. this._append(dataUpdate);
  28360. // Process available blocks
  28361. return this._process();
  28362. },
  28363. /**
  28364. * Finalizes the encryption or decryption process.
  28365. * Note that the finalize operation is effectively a destructive, read-once operation.
  28366. *
  28367. * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
  28368. *
  28369. * @return {WordArray} The data after final processing.
  28370. *
  28371. * @example
  28372. *
  28373. * var encrypted = cipher.finalize();
  28374. * var encrypted = cipher.finalize('data');
  28375. * var encrypted = cipher.finalize(wordArray);
  28376. */
  28377. finalize: function finalize(dataUpdate) {
  28378. // Final data update
  28379. if (dataUpdate) {
  28380. this._append(dataUpdate);
  28381. }
  28382. // Perform concrete-cipher logic
  28383. var finalProcessedData = this._doFinalize();
  28384. return finalProcessedData;
  28385. },
  28386. keySize: 128 / 32,
  28387. ivSize: 128 / 32,
  28388. _ENC_XFORM_MODE: 1,
  28389. _DEC_XFORM_MODE: 2,
  28390. /**
  28391. * Creates shortcut functions to a cipher's object interface.
  28392. *
  28393. * @param {Cipher} cipher The cipher to create a helper for.
  28394. *
  28395. * @return {Object} An object with encrypt and decrypt shortcut functions.
  28396. *
  28397. * @static
  28398. *
  28399. * @example
  28400. *
  28401. * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
  28402. */
  28403. _createHelper: function () {
  28404. function selectCipherStrategy(key) {
  28405. if (typeof key == 'string') {
  28406. return PasswordBasedCipher;
  28407. } else {
  28408. return SerializableCipher;
  28409. }
  28410. }
  28411. return function (cipher) {
  28412. return {
  28413. encrypt: function encrypt(message, key, cfg) {
  28414. return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
  28415. },
  28416. decrypt: function decrypt(ciphertext, key, cfg) {
  28417. return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
  28418. }
  28419. };
  28420. };
  28421. }()
  28422. });
  28423. /**
  28424. * Abstract base stream cipher template.
  28425. *
  28426. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
  28427. */
  28428. var StreamCipher = C_lib.StreamCipher = Cipher.extend({
  28429. _doFinalize: function _doFinalize() {
  28430. // Process partial blocks
  28431. var finalProcessedBlocks = this._process(!!'flush');
  28432. return finalProcessedBlocks;
  28433. },
  28434. blockSize: 1
  28435. });
  28436. /**
  28437. * Mode namespace.
  28438. */
  28439. var C_mode = C.mode = {};
  28440. /**
  28441. * Abstract base block cipher mode template.
  28442. */
  28443. var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
  28444. /**
  28445. * Creates this mode for encryption.
  28446. *
  28447. * @param {Cipher} cipher A block cipher instance.
  28448. * @param {Array} iv The IV words.
  28449. *
  28450. * @static
  28451. *
  28452. * @example
  28453. *
  28454. * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
  28455. */
  28456. createEncryptor: function createEncryptor(cipher, iv) {
  28457. return this.Encryptor.create(cipher, iv);
  28458. },
  28459. /**
  28460. * Creates this mode for decryption.
  28461. *
  28462. * @param {Cipher} cipher A block cipher instance.
  28463. * @param {Array} iv The IV words.
  28464. *
  28465. * @static
  28466. *
  28467. * @example
  28468. *
  28469. * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
  28470. */
  28471. createDecryptor: function createDecryptor(cipher, iv) {
  28472. return this.Decryptor.create(cipher, iv);
  28473. },
  28474. /**
  28475. * Initializes a newly created mode.
  28476. *
  28477. * @param {Cipher} cipher A block cipher instance.
  28478. * @param {Array} iv The IV words.
  28479. *
  28480. * @example
  28481. *
  28482. * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
  28483. */
  28484. init: function init(cipher, iv) {
  28485. this._cipher = cipher;
  28486. this._iv = iv;
  28487. }
  28488. });
  28489. /**
  28490. * Cipher Block Chaining mode.
  28491. */
  28492. var CBC = C_mode.CBC = function () {
  28493. /**
  28494. * Abstract base CBC mode.
  28495. */
  28496. var CBC = BlockCipherMode.extend();
  28497. /**
  28498. * CBC encryptor.
  28499. */
  28500. CBC.Encryptor = CBC.extend({
  28501. /**
  28502. * Processes the data block at offset.
  28503. *
  28504. * @param {Array} words The data words to operate on.
  28505. * @param {number} offset The offset where the block starts.
  28506. *
  28507. * @example
  28508. *
  28509. * mode.processBlock(data.words, offset);
  28510. */
  28511. processBlock: function processBlock(words, offset) {
  28512. // Shortcuts
  28513. var cipher = this._cipher;
  28514. var blockSize = cipher.blockSize;
  28515. // XOR and encrypt
  28516. xorBlock.call(this, words, offset, blockSize);
  28517. cipher.encryptBlock(words, offset);
  28518. // Remember this block to use with next block
  28519. this._prevBlock = words.slice(offset, offset + blockSize);
  28520. }
  28521. });
  28522. /**
  28523. * CBC decryptor.
  28524. */
  28525. CBC.Decryptor = CBC.extend({
  28526. /**
  28527. * Processes the data block at offset.
  28528. *
  28529. * @param {Array} words The data words to operate on.
  28530. * @param {number} offset The offset where the block starts.
  28531. *
  28532. * @example
  28533. *
  28534. * mode.processBlock(data.words, offset);
  28535. */
  28536. processBlock: function processBlock(words, offset) {
  28537. // Shortcuts
  28538. var cipher = this._cipher;
  28539. var blockSize = cipher.blockSize;
  28540. // Remember this block to use with next block
  28541. var thisBlock = words.slice(offset, offset + blockSize);
  28542. // Decrypt and XOR
  28543. cipher.decryptBlock(words, offset);
  28544. xorBlock.call(this, words, offset, blockSize);
  28545. // This block becomes the previous block
  28546. this._prevBlock = thisBlock;
  28547. }
  28548. });
  28549. function xorBlock(words, offset, blockSize) {
  28550. var block;
  28551. // Shortcut
  28552. var iv = this._iv;
  28553. // Choose mixing block
  28554. if (iv) {
  28555. block = iv;
  28556. // Remove IV for subsequent blocks
  28557. this._iv = undefined;
  28558. } else {
  28559. block = this._prevBlock;
  28560. }
  28561. // XOR blocks
  28562. for (var i = 0; i < blockSize; i++) {
  28563. words[offset + i] ^= block[i];
  28564. }
  28565. }
  28566. return CBC;
  28567. }();
  28568. /**
  28569. * Padding namespace.
  28570. */
  28571. var C_pad = C.pad = {};
  28572. /**
  28573. * PKCS #5/7 padding strategy.
  28574. */
  28575. var Pkcs7 = C_pad.Pkcs7 = {
  28576. /**
  28577. * Pads data using the algorithm defined in PKCS #5/7.
  28578. *
  28579. * @param {WordArray} data The data to pad.
  28580. * @param {number} blockSize The multiple that the data should be padded to.
  28581. *
  28582. * @static
  28583. *
  28584. * @example
  28585. *
  28586. * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
  28587. */
  28588. pad: function pad(data, blockSize) {
  28589. // Shortcut
  28590. var blockSizeBytes = blockSize * 4;
  28591. // Count padding bytes
  28592. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  28593. // Create padding word
  28594. var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes;
  28595. // Create padding
  28596. var paddingWords = [];
  28597. for (var i = 0; i < nPaddingBytes; i += 4) {
  28598. paddingWords.push(paddingWord);
  28599. }
  28600. var padding = WordArray.create(paddingWords, nPaddingBytes);
  28601. // Add padding
  28602. data.concat(padding);
  28603. },
  28604. /**
  28605. * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
  28606. *
  28607. * @param {WordArray} data The data to unpad.
  28608. *
  28609. * @static
  28610. *
  28611. * @example
  28612. *
  28613. * CryptoJS.pad.Pkcs7.unpad(wordArray);
  28614. */
  28615. unpad: function unpad(data) {
  28616. // Get number of padding bytes from last byte
  28617. var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;
  28618. // Remove padding
  28619. data.sigBytes -= nPaddingBytes;
  28620. }
  28621. };
  28622. /**
  28623. * Abstract base block cipher template.
  28624. *
  28625. * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
  28626. */
  28627. var BlockCipher = C_lib.BlockCipher = Cipher.extend({
  28628. /**
  28629. * Configuration options.
  28630. *
  28631. * @property {Mode} mode The block mode to use. Default: CBC
  28632. * @property {Padding} padding The padding strategy to use. Default: Pkcs7
  28633. */
  28634. cfg: Cipher.cfg.extend({
  28635. mode: CBC,
  28636. padding: Pkcs7
  28637. }),
  28638. reset: function reset() {
  28639. var modeCreator;
  28640. // Reset cipher
  28641. Cipher.reset.call(this);
  28642. // Shortcuts
  28643. var cfg = this.cfg;
  28644. var iv = cfg.iv;
  28645. var mode = cfg.mode;
  28646. // Reset block mode
  28647. if (this._xformMode == this._ENC_XFORM_MODE) {
  28648. modeCreator = mode.createEncryptor;
  28649. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */{
  28650. modeCreator = mode.createDecryptor;
  28651. // Keep at least one block in the buffer for unpadding
  28652. this._minBufferSize = 1;
  28653. }
  28654. if (this._mode && this._mode.__creator == modeCreator) {
  28655. this._mode.init(this, iv && iv.words);
  28656. } else {
  28657. this._mode = modeCreator.call(mode, this, iv && iv.words);
  28658. this._mode.__creator = modeCreator;
  28659. }
  28660. },
  28661. _doProcessBlock: function _doProcessBlock(words, offset) {
  28662. this._mode.processBlock(words, offset);
  28663. },
  28664. _doFinalize: function _doFinalize() {
  28665. var finalProcessedBlocks;
  28666. // Shortcut
  28667. var padding = this.cfg.padding;
  28668. // Finalize
  28669. if (this._xformMode == this._ENC_XFORM_MODE) {
  28670. // Pad data
  28671. padding.pad(this._data, this.blockSize);
  28672. // Process final blocks
  28673. finalProcessedBlocks = this._process(!!'flush');
  28674. } else /* if (this._xformMode == this._DEC_XFORM_MODE) */{
  28675. // Process final blocks
  28676. finalProcessedBlocks = this._process(!!'flush');
  28677. // Unpad data
  28678. padding.unpad(finalProcessedBlocks);
  28679. }
  28680. return finalProcessedBlocks;
  28681. },
  28682. blockSize: 128 / 32
  28683. });
  28684. /**
  28685. * A collection of cipher parameters.
  28686. *
  28687. * @property {WordArray} ciphertext The raw ciphertext.
  28688. * @property {WordArray} key The key to this ciphertext.
  28689. * @property {WordArray} iv The IV used in the ciphering operation.
  28690. * @property {WordArray} salt The salt used with a key derivation function.
  28691. * @property {Cipher} algorithm The cipher algorithm.
  28692. * @property {Mode} mode The block mode used in the ciphering operation.
  28693. * @property {Padding} padding The padding scheme used in the ciphering operation.
  28694. * @property {number} blockSize The block size of the cipher.
  28695. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
  28696. */
  28697. var CipherParams = C_lib.CipherParams = Base.extend({
  28698. /**
  28699. * Initializes a newly created cipher params object.
  28700. *
  28701. * @param {Object} cipherParams An object with any of the possible cipher parameters.
  28702. *
  28703. * @example
  28704. *
  28705. * var cipherParams = CryptoJS.lib.CipherParams.create({
  28706. * ciphertext: ciphertextWordArray,
  28707. * key: keyWordArray,
  28708. * iv: ivWordArray,
  28709. * salt: saltWordArray,
  28710. * algorithm: CryptoJS.algo.AES,
  28711. * mode: CryptoJS.mode.CBC,
  28712. * padding: CryptoJS.pad.PKCS7,
  28713. * blockSize: 4,
  28714. * formatter: CryptoJS.format.OpenSSL
  28715. * });
  28716. */
  28717. init: function init(cipherParams) {
  28718. this.mixIn(cipherParams);
  28719. },
  28720. /**
  28721. * Converts this cipher params object to a string.
  28722. *
  28723. * @param {Format} formatter (Optional) The formatting strategy to use.
  28724. *
  28725. * @return {string} The stringified cipher params.
  28726. *
  28727. * @throws Error If neither the formatter nor the default formatter is set.
  28728. *
  28729. * @example
  28730. *
  28731. * var string = cipherParams + '';
  28732. * var string = cipherParams.toString();
  28733. * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
  28734. */
  28735. toString: function toString(formatter) {
  28736. return (formatter || this.formatter).stringify(this);
  28737. }
  28738. });
  28739. /**
  28740. * Format namespace.
  28741. */
  28742. var C_format = C.format = {};
  28743. /**
  28744. * OpenSSL formatting strategy.
  28745. */
  28746. var OpenSSLFormatter = C_format.OpenSSL = {
  28747. /**
  28748. * Converts a cipher params object to an OpenSSL-compatible string.
  28749. *
  28750. * @param {CipherParams} cipherParams The cipher params object.
  28751. *
  28752. * @return {string} The OpenSSL-compatible string.
  28753. *
  28754. * @static
  28755. *
  28756. * @example
  28757. *
  28758. * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
  28759. */
  28760. stringify: function stringify(cipherParams) {
  28761. var wordArray;
  28762. // Shortcuts
  28763. var ciphertext = cipherParams.ciphertext;
  28764. var salt = cipherParams.salt;
  28765. // Format
  28766. if (salt) {
  28767. wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
  28768. } else {
  28769. wordArray = ciphertext;
  28770. }
  28771. return wordArray.toString(Base64);
  28772. },
  28773. /**
  28774. * Converts an OpenSSL-compatible string to a cipher params object.
  28775. *
  28776. * @param {string} openSSLStr The OpenSSL-compatible string.
  28777. *
  28778. * @return {CipherParams} The cipher params object.
  28779. *
  28780. * @static
  28781. *
  28782. * @example
  28783. *
  28784. * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
  28785. */
  28786. parse: function parse(openSSLStr) {
  28787. var salt;
  28788. // Parse base64
  28789. var ciphertext = Base64.parse(openSSLStr);
  28790. // Shortcut
  28791. var ciphertextWords = ciphertext.words;
  28792. // Test for salt
  28793. if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
  28794. // Extract salt
  28795. salt = WordArray.create(ciphertextWords.slice(2, 4));
  28796. // Remove salt from ciphertext
  28797. ciphertextWords.splice(0, 4);
  28798. ciphertext.sigBytes -= 16;
  28799. }
  28800. return CipherParams.create({
  28801. ciphertext: ciphertext,
  28802. salt: salt
  28803. });
  28804. }
  28805. };
  28806. /**
  28807. * A cipher wrapper that returns ciphertext as a serializable cipher params object.
  28808. */
  28809. var SerializableCipher = C_lib.SerializableCipher = Base.extend({
  28810. /**
  28811. * Configuration options.
  28812. *
  28813. * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
  28814. */
  28815. cfg: Base.extend({
  28816. format: OpenSSLFormatter
  28817. }),
  28818. /**
  28819. * Encrypts a message.
  28820. *
  28821. * @param {Cipher} cipher The cipher algorithm to use.
  28822. * @param {WordArray|string} message The message to encrypt.
  28823. * @param {WordArray} key The key.
  28824. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  28825. *
  28826. * @return {CipherParams} A cipher params object.
  28827. *
  28828. * @static
  28829. *
  28830. * @example
  28831. *
  28832. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
  28833. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
  28834. * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  28835. */
  28836. encrypt: function encrypt(cipher, message, key, cfg) {
  28837. // Apply config defaults
  28838. cfg = this.cfg.extend(cfg);
  28839. // Encrypt
  28840. var encryptor = cipher.createEncryptor(key, cfg);
  28841. var ciphertext = encryptor.finalize(message);
  28842. // Shortcut
  28843. var cipherCfg = encryptor.cfg;
  28844. // Create and return serializable cipher params
  28845. return CipherParams.create({
  28846. ciphertext: ciphertext,
  28847. key: key,
  28848. iv: cipherCfg.iv,
  28849. algorithm: cipher,
  28850. mode: cipherCfg.mode,
  28851. padding: cipherCfg.padding,
  28852. blockSize: cipher.blockSize,
  28853. formatter: cfg.format
  28854. });
  28855. },
  28856. /**
  28857. * Decrypts serialized ciphertext.
  28858. *
  28859. * @param {Cipher} cipher The cipher algorithm to use.
  28860. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  28861. * @param {WordArray} key The key.
  28862. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  28863. *
  28864. * @return {WordArray} The plaintext.
  28865. *
  28866. * @static
  28867. *
  28868. * @example
  28869. *
  28870. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  28871. * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
  28872. */
  28873. decrypt: function decrypt(cipher, ciphertext, key, cfg) {
  28874. // Apply config defaults
  28875. cfg = this.cfg.extend(cfg);
  28876. // Convert string to CipherParams
  28877. ciphertext = this._parse(ciphertext, cfg.format);
  28878. // Decrypt
  28879. var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
  28880. return plaintext;
  28881. },
  28882. /**
  28883. * Converts serialized ciphertext to CipherParams,
  28884. * else assumed CipherParams already and returns ciphertext unchanged.
  28885. *
  28886. * @param {CipherParams|string} ciphertext The ciphertext.
  28887. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
  28888. *
  28889. * @return {CipherParams} The unserialized ciphertext.
  28890. *
  28891. * @static
  28892. *
  28893. * @example
  28894. *
  28895. * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
  28896. */
  28897. _parse: function _parse(ciphertext, format) {
  28898. if (typeof ciphertext == 'string') {
  28899. return format.parse(ciphertext, this);
  28900. } else {
  28901. return ciphertext;
  28902. }
  28903. }
  28904. });
  28905. /**
  28906. * Key derivation function namespace.
  28907. */
  28908. var C_kdf = C.kdf = {};
  28909. /**
  28910. * OpenSSL key derivation function.
  28911. */
  28912. var OpenSSLKdf = C_kdf.OpenSSL = {
  28913. /**
  28914. * Derives a key and IV from a password.
  28915. *
  28916. * @param {string} password The password to derive from.
  28917. * @param {number} keySize The size in words of the key to generate.
  28918. * @param {number} ivSize The size in words of the IV to generate.
  28919. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
  28920. *
  28921. * @return {CipherParams} A cipher params object with the key, IV, and salt.
  28922. *
  28923. * @static
  28924. *
  28925. * @example
  28926. *
  28927. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
  28928. * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
  28929. */
  28930. execute: function execute(password, keySize, ivSize, salt) {
  28931. // Generate random salt
  28932. if (!salt) {
  28933. salt = WordArray.random(64 / 8);
  28934. }
  28935. // Derive key and IV
  28936. var key = EvpKDF.create({
  28937. keySize: keySize + ivSize
  28938. }).compute(password, salt);
  28939. // Separate key and IV
  28940. var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
  28941. key.sigBytes = keySize * 4;
  28942. // Return params
  28943. return CipherParams.create({
  28944. key: key,
  28945. iv: iv,
  28946. salt: salt
  28947. });
  28948. }
  28949. };
  28950. /**
  28951. * A serializable cipher wrapper that derives the key from a password,
  28952. * and returns ciphertext as a serializable cipher params object.
  28953. */
  28954. var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
  28955. /**
  28956. * Configuration options.
  28957. *
  28958. * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
  28959. */
  28960. cfg: SerializableCipher.cfg.extend({
  28961. kdf: OpenSSLKdf
  28962. }),
  28963. /**
  28964. * Encrypts a message using a password.
  28965. *
  28966. * @param {Cipher} cipher The cipher algorithm to use.
  28967. * @param {WordArray|string} message The message to encrypt.
  28968. * @param {string} password The password.
  28969. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  28970. *
  28971. * @return {CipherParams} A cipher params object.
  28972. *
  28973. * @static
  28974. *
  28975. * @example
  28976. *
  28977. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
  28978. * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
  28979. */
  28980. encrypt: function encrypt(cipher, message, password, cfg) {
  28981. // Apply config defaults
  28982. cfg = this.cfg.extend(cfg);
  28983. // Derive key and other params
  28984. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
  28985. // Add IV to config
  28986. cfg.iv = derivedParams.iv;
  28987. // Encrypt
  28988. var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
  28989. // Mix in derived params
  28990. ciphertext.mixIn(derivedParams);
  28991. return ciphertext;
  28992. },
  28993. /**
  28994. * Decrypts serialized ciphertext using a password.
  28995. *
  28996. * @param {Cipher} cipher The cipher algorithm to use.
  28997. * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
  28998. * @param {string} password The password.
  28999. * @param {Object} cfg (Optional) The configuration options to use for this operation.
  29000. *
  29001. * @return {WordArray} The plaintext.
  29002. *
  29003. * @static
  29004. *
  29005. * @example
  29006. *
  29007. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
  29008. * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
  29009. */
  29010. decrypt: function decrypt(cipher, ciphertext, password, cfg) {
  29011. // Apply config defaults
  29012. cfg = this.cfg.extend(cfg);
  29013. // Convert string to CipherParams
  29014. ciphertext = this._parse(ciphertext, cfg.format);
  29015. // Derive key and other params
  29016. var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
  29017. // Add IV to config
  29018. cfg.iv = derivedParams.iv;
  29019. // Decrypt
  29020. var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
  29021. return plaintext;
  29022. }
  29023. });
  29024. }();
  29025. /**
  29026. * Cipher Feedback block mode.
  29027. */
  29028. CryptoJS.mode.CFB = function () {
  29029. var CFB = CryptoJS.lib.BlockCipherMode.extend();
  29030. CFB.Encryptor = CFB.extend({
  29031. processBlock: function processBlock(words, offset) {
  29032. // Shortcuts
  29033. var cipher = this._cipher;
  29034. var blockSize = cipher.blockSize;
  29035. generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  29036. // Remember this block to use with next block
  29037. this._prevBlock = words.slice(offset, offset + blockSize);
  29038. }
  29039. });
  29040. CFB.Decryptor = CFB.extend({
  29041. processBlock: function processBlock(words, offset) {
  29042. // Shortcuts
  29043. var cipher = this._cipher;
  29044. var blockSize = cipher.blockSize;
  29045. // Remember this block to use with next block
  29046. var thisBlock = words.slice(offset, offset + blockSize);
  29047. generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
  29048. // This block becomes the previous block
  29049. this._prevBlock = thisBlock;
  29050. }
  29051. });
  29052. function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
  29053. var keystream;
  29054. // Shortcut
  29055. var iv = this._iv;
  29056. // Generate keystream
  29057. if (iv) {
  29058. keystream = iv.slice(0);
  29059. // Remove IV for subsequent blocks
  29060. this._iv = undefined;
  29061. } else {
  29062. keystream = this._prevBlock;
  29063. }
  29064. cipher.encryptBlock(keystream, 0);
  29065. // Encrypt
  29066. for (var i = 0; i < blockSize; i++) {
  29067. words[offset + i] ^= keystream[i];
  29068. }
  29069. }
  29070. return CFB;
  29071. }();
  29072. /**
  29073. * Counter block mode.
  29074. */
  29075. CryptoJS.mode.CTR = function () {
  29076. var CTR = CryptoJS.lib.BlockCipherMode.extend();
  29077. var Encryptor = CTR.Encryptor = CTR.extend({
  29078. processBlock: function processBlock(words, offset) {
  29079. // Shortcuts
  29080. var cipher = this._cipher;
  29081. var blockSize = cipher.blockSize;
  29082. var iv = this._iv;
  29083. var counter = this._counter;
  29084. // Generate keystream
  29085. if (iv) {
  29086. counter = this._counter = iv.slice(0);
  29087. // Remove IV for subsequent blocks
  29088. this._iv = undefined;
  29089. }
  29090. var keystream = counter.slice(0);
  29091. cipher.encryptBlock(keystream, 0);
  29092. // Increment counter
  29093. counter[blockSize - 1] = counter[blockSize - 1] + 1 | 0;
  29094. // Encrypt
  29095. for (var i = 0; i < blockSize; i++) {
  29096. words[offset + i] ^= keystream[i];
  29097. }
  29098. }
  29099. });
  29100. CTR.Decryptor = Encryptor;
  29101. return CTR;
  29102. }();
  29103. /** @preserve
  29104. * Counter block mode compatible with Dr Brian Gladman fileenc.c
  29105. * derived from CryptoJS.mode.CTR
  29106. * Jan Hruby jhruby.web@gmail.com
  29107. */
  29108. CryptoJS.mode.CTRGladman = function () {
  29109. var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
  29110. function incWord(word) {
  29111. if ((word >> 24 & 0xff) === 0xff) {
  29112. //overflow
  29113. var b1 = word >> 16 & 0xff;
  29114. var b2 = word >> 8 & 0xff;
  29115. var b3 = word & 0xff;
  29116. if (b1 === 0xff)
  29117. // overflow b1
  29118. {
  29119. b1 = 0;
  29120. if (b2 === 0xff) {
  29121. b2 = 0;
  29122. if (b3 === 0xff) {
  29123. b3 = 0;
  29124. } else {
  29125. ++b3;
  29126. }
  29127. } else {
  29128. ++b2;
  29129. }
  29130. } else {
  29131. ++b1;
  29132. }
  29133. word = 0;
  29134. word += b1 << 16;
  29135. word += b2 << 8;
  29136. word += b3;
  29137. } else {
  29138. word += 0x01 << 24;
  29139. }
  29140. return word;
  29141. }
  29142. function incCounter(counter) {
  29143. if ((counter[0] = incWord(counter[0])) === 0) {
  29144. // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
  29145. counter[1] = incWord(counter[1]);
  29146. }
  29147. return counter;
  29148. }
  29149. var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
  29150. processBlock: function processBlock(words, offset) {
  29151. // Shortcuts
  29152. var cipher = this._cipher;
  29153. var blockSize = cipher.blockSize;
  29154. var iv = this._iv;
  29155. var counter = this._counter;
  29156. // Generate keystream
  29157. if (iv) {
  29158. counter = this._counter = iv.slice(0);
  29159. // Remove IV for subsequent blocks
  29160. this._iv = undefined;
  29161. }
  29162. incCounter(counter);
  29163. var keystream = counter.slice(0);
  29164. cipher.encryptBlock(keystream, 0);
  29165. // Encrypt
  29166. for (var i = 0; i < blockSize; i++) {
  29167. words[offset + i] ^= keystream[i];
  29168. }
  29169. }
  29170. });
  29171. CTRGladman.Decryptor = Encryptor;
  29172. return CTRGladman;
  29173. }();
  29174. /**
  29175. * Output Feedback block mode.
  29176. */
  29177. CryptoJS.mode.OFB = function () {
  29178. var OFB = CryptoJS.lib.BlockCipherMode.extend();
  29179. var Encryptor = OFB.Encryptor = OFB.extend({
  29180. processBlock: function processBlock(words, offset) {
  29181. // Shortcuts
  29182. var cipher = this._cipher;
  29183. var blockSize = cipher.blockSize;
  29184. var iv = this._iv;
  29185. var keystream = this._keystream;
  29186. // Generate keystream
  29187. if (iv) {
  29188. keystream = this._keystream = iv.slice(0);
  29189. // Remove IV for subsequent blocks
  29190. this._iv = undefined;
  29191. }
  29192. cipher.encryptBlock(keystream, 0);
  29193. // Encrypt
  29194. for (var i = 0; i < blockSize; i++) {
  29195. words[offset + i] ^= keystream[i];
  29196. }
  29197. }
  29198. });
  29199. OFB.Decryptor = Encryptor;
  29200. return OFB;
  29201. }();
  29202. /**
  29203. * Electronic Codebook block mode.
  29204. */
  29205. CryptoJS.mode.ECB = function () {
  29206. var ECB = CryptoJS.lib.BlockCipherMode.extend();
  29207. ECB.Encryptor = ECB.extend({
  29208. processBlock: function processBlock(words, offset) {
  29209. this._cipher.encryptBlock(words, offset);
  29210. }
  29211. });
  29212. ECB.Decryptor = ECB.extend({
  29213. processBlock: function processBlock(words, offset) {
  29214. this._cipher.decryptBlock(words, offset);
  29215. }
  29216. });
  29217. return ECB;
  29218. }();
  29219. /**
  29220. * ANSI X.923 padding strategy.
  29221. */
  29222. CryptoJS.pad.AnsiX923 = {
  29223. pad: function pad(data, blockSize) {
  29224. // Shortcuts
  29225. var dataSigBytes = data.sigBytes;
  29226. var blockSizeBytes = blockSize * 4;
  29227. // Count padding bytes
  29228. var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
  29229. // Compute last byte position
  29230. var lastBytePos = dataSigBytes + nPaddingBytes - 1;
  29231. // Pad
  29232. data.clamp();
  29233. data.words[lastBytePos >>> 2] |= nPaddingBytes << 24 - lastBytePos % 4 * 8;
  29234. data.sigBytes += nPaddingBytes;
  29235. },
  29236. unpad: function unpad(data) {
  29237. // Get number of padding bytes from last byte
  29238. var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;
  29239. // Remove padding
  29240. data.sigBytes -= nPaddingBytes;
  29241. }
  29242. };
  29243. /**
  29244. * ISO 10126 padding strategy.
  29245. */
  29246. CryptoJS.pad.Iso10126 = {
  29247. pad: function pad(data, blockSize) {
  29248. // Shortcut
  29249. var blockSizeBytes = blockSize * 4;
  29250. // Count padding bytes
  29251. var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
  29252. // Pad
  29253. data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
  29254. },
  29255. unpad: function unpad(data) {
  29256. // Get number of padding bytes from last byte
  29257. var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff;
  29258. // Remove padding
  29259. data.sigBytes -= nPaddingBytes;
  29260. }
  29261. };
  29262. /**
  29263. * ISO/IEC 9797-1 Padding Method 2.
  29264. */
  29265. CryptoJS.pad.Iso97971 = {
  29266. pad: function pad(data, blockSize) {
  29267. // Add 0x80 byte
  29268. data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
  29269. // Zero pad the rest
  29270. CryptoJS.pad.ZeroPadding.pad(data, blockSize);
  29271. },
  29272. unpad: function unpad(data) {
  29273. // Remove zero padding
  29274. CryptoJS.pad.ZeroPadding.unpad(data);
  29275. // Remove one more byte -- the 0x80 byte
  29276. data.sigBytes--;
  29277. }
  29278. };
  29279. /**
  29280. * Zero padding strategy.
  29281. */
  29282. CryptoJS.pad.ZeroPadding = {
  29283. pad: function pad(data, blockSize) {
  29284. // Shortcut
  29285. var blockSizeBytes = blockSize * 4;
  29286. // Pad
  29287. data.clamp();
  29288. data.sigBytes += blockSizeBytes - (data.sigBytes % blockSizeBytes || blockSizeBytes);
  29289. },
  29290. unpad: function unpad(data) {
  29291. // Shortcut
  29292. var dataWords = data.words;
  29293. // Unpad
  29294. var i = data.sigBytes - 1;
  29295. for (var i = data.sigBytes - 1; i >= 0; i--) {
  29296. if (dataWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff) {
  29297. data.sigBytes = i + 1;
  29298. break;
  29299. }
  29300. }
  29301. }
  29302. };
  29303. /**
  29304. * A noop padding strategy.
  29305. */
  29306. CryptoJS.pad.NoPadding = {
  29307. pad: function pad() {},
  29308. unpad: function unpad() {}
  29309. };
  29310. (function (undefined) {
  29311. // Shortcuts
  29312. var C = CryptoJS;
  29313. var C_lib = C.lib;
  29314. var CipherParams = C_lib.CipherParams;
  29315. var C_enc = C.enc;
  29316. var Hex = C_enc.Hex;
  29317. var C_format = C.format;
  29318. var HexFormatter = C_format.Hex = {
  29319. /**
  29320. * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
  29321. *
  29322. * @param {CipherParams} cipherParams The cipher params object.
  29323. *
  29324. * @return {string} The hexadecimally encoded string.
  29325. *
  29326. * @static
  29327. *
  29328. * @example
  29329. *
  29330. * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
  29331. */
  29332. stringify: function stringify(cipherParams) {
  29333. return cipherParams.ciphertext.toString(Hex);
  29334. },
  29335. /**
  29336. * Converts a hexadecimally encoded ciphertext string to a cipher params object.
  29337. *
  29338. * @param {string} input The hexadecimally encoded string.
  29339. *
  29340. * @return {CipherParams} The cipher params object.
  29341. *
  29342. * @static
  29343. *
  29344. * @example
  29345. *
  29346. * var cipherParams = CryptoJS.format.Hex.parse(hexString);
  29347. */
  29348. parse: function parse(input) {
  29349. var ciphertext = Hex.parse(input);
  29350. return CipherParams.create({
  29351. ciphertext: ciphertext
  29352. });
  29353. }
  29354. };
  29355. })();
  29356. (function () {
  29357. // Shortcuts
  29358. var C = CryptoJS;
  29359. var C_lib = C.lib;
  29360. var BlockCipher = C_lib.BlockCipher;
  29361. var C_algo = C.algo;
  29362. // Lookup tables
  29363. var SBOX = [];
  29364. var INV_SBOX = [];
  29365. var SUB_MIX_0 = [];
  29366. var SUB_MIX_1 = [];
  29367. var SUB_MIX_2 = [];
  29368. var SUB_MIX_3 = [];
  29369. var INV_SUB_MIX_0 = [];
  29370. var INV_SUB_MIX_1 = [];
  29371. var INV_SUB_MIX_2 = [];
  29372. var INV_SUB_MIX_3 = [];
  29373. // Compute lookup tables
  29374. (function () {
  29375. // Compute double table
  29376. var d = [];
  29377. for (var i = 0; i < 256; i++) {
  29378. if (i < 128) {
  29379. d[i] = i << 1;
  29380. } else {
  29381. d[i] = i << 1 ^ 0x11b;
  29382. }
  29383. }
  29384. // Walk GF(2^8)
  29385. var x = 0;
  29386. var xi = 0;
  29387. for (var i = 0; i < 256; i++) {
  29388. // Compute sbox
  29389. var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
  29390. sx = sx >>> 8 ^ sx & 0xff ^ 0x63;
  29391. SBOX[x] = sx;
  29392. INV_SBOX[sx] = x;
  29393. // Compute multiplication
  29394. var x2 = d[x];
  29395. var x4 = d[x2];
  29396. var x8 = d[x4];
  29397. // Compute sub bytes, mix columns tables
  29398. var t = d[sx] * 0x101 ^ sx * 0x1010100;
  29399. SUB_MIX_0[x] = t << 24 | t >>> 8;
  29400. SUB_MIX_1[x] = t << 16 | t >>> 16;
  29401. SUB_MIX_2[x] = t << 8 | t >>> 24;
  29402. SUB_MIX_3[x] = t;
  29403. // Compute inv sub bytes, inv mix columns tables
  29404. var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
  29405. INV_SUB_MIX_0[sx] = t << 24 | t >>> 8;
  29406. INV_SUB_MIX_1[sx] = t << 16 | t >>> 16;
  29407. INV_SUB_MIX_2[sx] = t << 8 | t >>> 24;
  29408. INV_SUB_MIX_3[sx] = t;
  29409. // Compute next counter
  29410. if (!x) {
  29411. x = xi = 1;
  29412. } else {
  29413. x = x2 ^ d[d[d[x8 ^ x2]]];
  29414. xi ^= d[d[xi]];
  29415. }
  29416. }
  29417. })();
  29418. // Precomputed Rcon lookup
  29419. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  29420. /**
  29421. * AES block cipher algorithm.
  29422. */
  29423. var AES = C_algo.AES = BlockCipher.extend({
  29424. _doReset: function _doReset() {
  29425. var t;
  29426. // Skip reset of nRounds has been set before and key did not change
  29427. if (this._nRounds && this._keyPriorReset === this._key) {
  29428. return;
  29429. }
  29430. // Shortcuts
  29431. var key = this._keyPriorReset = this._key;
  29432. var keyWords = key.words;
  29433. var keySize = key.sigBytes / 4;
  29434. // Compute number of rounds
  29435. var nRounds = this._nRounds = keySize + 6;
  29436. // Compute number of key schedule rows
  29437. var ksRows = (nRounds + 1) * 4;
  29438. // Compute key schedule
  29439. var keySchedule = this._keySchedule = [];
  29440. for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  29441. if (ksRow < keySize) {
  29442. keySchedule[ksRow] = keyWords[ksRow];
  29443. } else {
  29444. t = keySchedule[ksRow - 1];
  29445. if (!(ksRow % keySize)) {
  29446. // Rot word
  29447. t = t << 8 | t >>> 24;
  29448. // Sub word
  29449. t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];
  29450. // Mix Rcon
  29451. t ^= RCON[ksRow / keySize | 0] << 24;
  29452. } else if (keySize > 6 && ksRow % keySize == 4) {
  29453. // Sub word
  29454. t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];
  29455. }
  29456. keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  29457. }
  29458. }
  29459. // Compute inv key schedule
  29460. var invKeySchedule = this._invKeySchedule = [];
  29461. for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  29462. var ksRow = ksRows - invKsRow;
  29463. if (invKsRow % 4) {
  29464. var t = keySchedule[ksRow];
  29465. } else {
  29466. var t = keySchedule[ksRow - 4];
  29467. }
  29468. if (invKsRow < 4 || ksRow <= 4) {
  29469. invKeySchedule[invKsRow] = t;
  29470. } else {
  29471. invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  29472. }
  29473. }
  29474. },
  29475. encryptBlock: function encryptBlock(M, offset) {
  29476. this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  29477. },
  29478. decryptBlock: function decryptBlock(M, offset) {
  29479. // Swap 2nd and 4th rows
  29480. var t = M[offset + 1];
  29481. M[offset + 1] = M[offset + 3];
  29482. M[offset + 3] = t;
  29483. this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  29484. // Inv swap 2nd and 4th rows
  29485. var t = M[offset + 1];
  29486. M[offset + 1] = M[offset + 3];
  29487. M[offset + 3] = t;
  29488. },
  29489. _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  29490. // Shortcut
  29491. var nRounds = this._nRounds;
  29492. // Get input, add round key
  29493. var s0 = M[offset] ^ keySchedule[0];
  29494. var s1 = M[offset + 1] ^ keySchedule[1];
  29495. var s2 = M[offset + 2] ^ keySchedule[2];
  29496. var s3 = M[offset + 3] ^ keySchedule[3];
  29497. // Key schedule row counter
  29498. var ksRow = 4;
  29499. // Rounds
  29500. for (var round = 1; round < nRounds; round++) {
  29501. // Shift rows, sub bytes, mix columns, add round key
  29502. var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
  29503. var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
  29504. var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
  29505. var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
  29506. // Update state
  29507. s0 = t0;
  29508. s1 = t1;
  29509. s2 = t2;
  29510. s3 = t3;
  29511. }
  29512. // Shift rows, sub bytes, add round key
  29513. var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  29514. var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  29515. var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  29516. var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  29517. // Set output
  29518. M[offset] = t0;
  29519. M[offset + 1] = t1;
  29520. M[offset + 2] = t2;
  29521. M[offset + 3] = t3;
  29522. },
  29523. keySize: 256 / 32
  29524. });
  29525. /**
  29526. * Shortcut functions to the cipher's object interface.
  29527. *
  29528. * @example
  29529. *
  29530. * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  29531. * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  29532. */
  29533. C.AES = BlockCipher._createHelper(AES);
  29534. })();
  29535. (function () {
  29536. // Shortcuts
  29537. var C = CryptoJS;
  29538. var C_lib = C.lib;
  29539. var WordArray = C_lib.WordArray;
  29540. var BlockCipher = C_lib.BlockCipher;
  29541. var C_algo = C.algo;
  29542. // Permuted Choice 1 constants
  29543. var PC1 = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4];
  29544. // Permuted Choice 2 constants
  29545. var PC2 = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32];
  29546. // Cumulative bit shift constants
  29547. var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
  29548. // SBOXes and round permutation constants
  29549. var SBOX_P = [{
  29550. 0x0: 0x808200,
  29551. 0x10000000: 0x8000,
  29552. 0x20000000: 0x808002,
  29553. 0x30000000: 0x2,
  29554. 0x40000000: 0x200,
  29555. 0x50000000: 0x808202,
  29556. 0x60000000: 0x800202,
  29557. 0x70000000: 0x800000,
  29558. 0x80000000: 0x202,
  29559. 0x90000000: 0x800200,
  29560. 0xa0000000: 0x8200,
  29561. 0xb0000000: 0x808000,
  29562. 0xc0000000: 0x8002,
  29563. 0xd0000000: 0x800002,
  29564. 0xe0000000: 0x0,
  29565. 0xf0000000: 0x8202,
  29566. 0x8000000: 0x0,
  29567. 0x18000000: 0x808202,
  29568. 0x28000000: 0x8202,
  29569. 0x38000000: 0x8000,
  29570. 0x48000000: 0x808200,
  29571. 0x58000000: 0x200,
  29572. 0x68000000: 0x808002,
  29573. 0x78000000: 0x2,
  29574. 0x88000000: 0x800200,
  29575. 0x98000000: 0x8200,
  29576. 0xa8000000: 0x808000,
  29577. 0xb8000000: 0x800202,
  29578. 0xc8000000: 0x800002,
  29579. 0xd8000000: 0x8002,
  29580. 0xe8000000: 0x202,
  29581. 0xf8000000: 0x800000,
  29582. 0x1: 0x8000,
  29583. 0x10000001: 0x2,
  29584. 0x20000001: 0x808200,
  29585. 0x30000001: 0x800000,
  29586. 0x40000001: 0x808002,
  29587. 0x50000001: 0x8200,
  29588. 0x60000001: 0x200,
  29589. 0x70000001: 0x800202,
  29590. 0x80000001: 0x808202,
  29591. 0x90000001: 0x808000,
  29592. 0xa0000001: 0x800002,
  29593. 0xb0000001: 0x8202,
  29594. 0xc0000001: 0x202,
  29595. 0xd0000001: 0x800200,
  29596. 0xe0000001: 0x8002,
  29597. 0xf0000001: 0x0,
  29598. 0x8000001: 0x808202,
  29599. 0x18000001: 0x808000,
  29600. 0x28000001: 0x800000,
  29601. 0x38000001: 0x200,
  29602. 0x48000001: 0x8000,
  29603. 0x58000001: 0x800002,
  29604. 0x68000001: 0x2,
  29605. 0x78000001: 0x8202,
  29606. 0x88000001: 0x8002,
  29607. 0x98000001: 0x800202,
  29608. 0xa8000001: 0x202,
  29609. 0xb8000001: 0x808200,
  29610. 0xc8000001: 0x800200,
  29611. 0xd8000001: 0x0,
  29612. 0xe8000001: 0x8200,
  29613. 0xf8000001: 0x808002
  29614. }, {
  29615. 0x0: 0x40084010,
  29616. 0x1000000: 0x4000,
  29617. 0x2000000: 0x80000,
  29618. 0x3000000: 0x40080010,
  29619. 0x4000000: 0x40000010,
  29620. 0x5000000: 0x40084000,
  29621. 0x6000000: 0x40004000,
  29622. 0x7000000: 0x10,
  29623. 0x8000000: 0x84000,
  29624. 0x9000000: 0x40004010,
  29625. 0xa000000: 0x40000000,
  29626. 0xb000000: 0x84010,
  29627. 0xc000000: 0x80010,
  29628. 0xd000000: 0x0,
  29629. 0xe000000: 0x4010,
  29630. 0xf000000: 0x40080000,
  29631. 0x800000: 0x40004000,
  29632. 0x1800000: 0x84010,
  29633. 0x2800000: 0x10,
  29634. 0x3800000: 0x40004010,
  29635. 0x4800000: 0x40084010,
  29636. 0x5800000: 0x40000000,
  29637. 0x6800000: 0x80000,
  29638. 0x7800000: 0x40080010,
  29639. 0x8800000: 0x80010,
  29640. 0x9800000: 0x0,
  29641. 0xa800000: 0x4000,
  29642. 0xb800000: 0x40080000,
  29643. 0xc800000: 0x40000010,
  29644. 0xd800000: 0x84000,
  29645. 0xe800000: 0x40084000,
  29646. 0xf800000: 0x4010,
  29647. 0x10000000: 0x0,
  29648. 0x11000000: 0x40080010,
  29649. 0x12000000: 0x40004010,
  29650. 0x13000000: 0x40084000,
  29651. 0x14000000: 0x40080000,
  29652. 0x15000000: 0x10,
  29653. 0x16000000: 0x84010,
  29654. 0x17000000: 0x4000,
  29655. 0x18000000: 0x4010,
  29656. 0x19000000: 0x80000,
  29657. 0x1a000000: 0x80010,
  29658. 0x1b000000: 0x40000010,
  29659. 0x1c000000: 0x84000,
  29660. 0x1d000000: 0x40004000,
  29661. 0x1e000000: 0x40000000,
  29662. 0x1f000000: 0x40084010,
  29663. 0x10800000: 0x84010,
  29664. 0x11800000: 0x80000,
  29665. 0x12800000: 0x40080000,
  29666. 0x13800000: 0x4000,
  29667. 0x14800000: 0x40004000,
  29668. 0x15800000: 0x40084010,
  29669. 0x16800000: 0x10,
  29670. 0x17800000: 0x40000000,
  29671. 0x18800000: 0x40084000,
  29672. 0x19800000: 0x40000010,
  29673. 0x1a800000: 0x40004010,
  29674. 0x1b800000: 0x80010,
  29675. 0x1c800000: 0x0,
  29676. 0x1d800000: 0x4010,
  29677. 0x1e800000: 0x40080010,
  29678. 0x1f800000: 0x84000
  29679. }, {
  29680. 0x0: 0x104,
  29681. 0x100000: 0x0,
  29682. 0x200000: 0x4000100,
  29683. 0x300000: 0x10104,
  29684. 0x400000: 0x10004,
  29685. 0x500000: 0x4000004,
  29686. 0x600000: 0x4010104,
  29687. 0x700000: 0x4010000,
  29688. 0x800000: 0x4000000,
  29689. 0x900000: 0x4010100,
  29690. 0xa00000: 0x10100,
  29691. 0xb00000: 0x4010004,
  29692. 0xc00000: 0x4000104,
  29693. 0xd00000: 0x10000,
  29694. 0xe00000: 0x4,
  29695. 0xf00000: 0x100,
  29696. 0x80000: 0x4010100,
  29697. 0x180000: 0x4010004,
  29698. 0x280000: 0x0,
  29699. 0x380000: 0x4000100,
  29700. 0x480000: 0x4000004,
  29701. 0x580000: 0x10000,
  29702. 0x680000: 0x10004,
  29703. 0x780000: 0x104,
  29704. 0x880000: 0x4,
  29705. 0x980000: 0x100,
  29706. 0xa80000: 0x4010000,
  29707. 0xb80000: 0x10104,
  29708. 0xc80000: 0x10100,
  29709. 0xd80000: 0x4000104,
  29710. 0xe80000: 0x4010104,
  29711. 0xf80000: 0x4000000,
  29712. 0x1000000: 0x4010100,
  29713. 0x1100000: 0x10004,
  29714. 0x1200000: 0x10000,
  29715. 0x1300000: 0x4000100,
  29716. 0x1400000: 0x100,
  29717. 0x1500000: 0x4010104,
  29718. 0x1600000: 0x4000004,
  29719. 0x1700000: 0x0,
  29720. 0x1800000: 0x4000104,
  29721. 0x1900000: 0x4000000,
  29722. 0x1a00000: 0x4,
  29723. 0x1b00000: 0x10100,
  29724. 0x1c00000: 0x4010000,
  29725. 0x1d00000: 0x104,
  29726. 0x1e00000: 0x10104,
  29727. 0x1f00000: 0x4010004,
  29728. 0x1080000: 0x4000000,
  29729. 0x1180000: 0x104,
  29730. 0x1280000: 0x4010100,
  29731. 0x1380000: 0x0,
  29732. 0x1480000: 0x10004,
  29733. 0x1580000: 0x4000100,
  29734. 0x1680000: 0x100,
  29735. 0x1780000: 0x4010004,
  29736. 0x1880000: 0x10000,
  29737. 0x1980000: 0x4010104,
  29738. 0x1a80000: 0x10104,
  29739. 0x1b80000: 0x4000004,
  29740. 0x1c80000: 0x4000104,
  29741. 0x1d80000: 0x4010000,
  29742. 0x1e80000: 0x4,
  29743. 0x1f80000: 0x10100
  29744. }, {
  29745. 0x0: 0x80401000,
  29746. 0x10000: 0x80001040,
  29747. 0x20000: 0x401040,
  29748. 0x30000: 0x80400000,
  29749. 0x40000: 0x0,
  29750. 0x50000: 0x401000,
  29751. 0x60000: 0x80000040,
  29752. 0x70000: 0x400040,
  29753. 0x80000: 0x80000000,
  29754. 0x90000: 0x400000,
  29755. 0xa0000: 0x40,
  29756. 0xb0000: 0x80001000,
  29757. 0xc0000: 0x80400040,
  29758. 0xd0000: 0x1040,
  29759. 0xe0000: 0x1000,
  29760. 0xf0000: 0x80401040,
  29761. 0x8000: 0x80001040,
  29762. 0x18000: 0x40,
  29763. 0x28000: 0x80400040,
  29764. 0x38000: 0x80001000,
  29765. 0x48000: 0x401000,
  29766. 0x58000: 0x80401040,
  29767. 0x68000: 0x0,
  29768. 0x78000: 0x80400000,
  29769. 0x88000: 0x1000,
  29770. 0x98000: 0x80401000,
  29771. 0xa8000: 0x400000,
  29772. 0xb8000: 0x1040,
  29773. 0xc8000: 0x80000000,
  29774. 0xd8000: 0x400040,
  29775. 0xe8000: 0x401040,
  29776. 0xf8000: 0x80000040,
  29777. 0x100000: 0x400040,
  29778. 0x110000: 0x401000,
  29779. 0x120000: 0x80000040,
  29780. 0x130000: 0x0,
  29781. 0x140000: 0x1040,
  29782. 0x150000: 0x80400040,
  29783. 0x160000: 0x80401000,
  29784. 0x170000: 0x80001040,
  29785. 0x180000: 0x80401040,
  29786. 0x190000: 0x80000000,
  29787. 0x1a0000: 0x80400000,
  29788. 0x1b0000: 0x401040,
  29789. 0x1c0000: 0x80001000,
  29790. 0x1d0000: 0x400000,
  29791. 0x1e0000: 0x40,
  29792. 0x1f0000: 0x1000,
  29793. 0x108000: 0x80400000,
  29794. 0x118000: 0x80401040,
  29795. 0x128000: 0x0,
  29796. 0x138000: 0x401000,
  29797. 0x148000: 0x400040,
  29798. 0x158000: 0x80000000,
  29799. 0x168000: 0x80001040,
  29800. 0x178000: 0x40,
  29801. 0x188000: 0x80000040,
  29802. 0x198000: 0x1000,
  29803. 0x1a8000: 0x80001000,
  29804. 0x1b8000: 0x80400040,
  29805. 0x1c8000: 0x1040,
  29806. 0x1d8000: 0x80401000,
  29807. 0x1e8000: 0x400000,
  29808. 0x1f8000: 0x401040
  29809. }, {
  29810. 0x0: 0x80,
  29811. 0x1000: 0x1040000,
  29812. 0x2000: 0x40000,
  29813. 0x3000: 0x20000000,
  29814. 0x4000: 0x20040080,
  29815. 0x5000: 0x1000080,
  29816. 0x6000: 0x21000080,
  29817. 0x7000: 0x40080,
  29818. 0x8000: 0x1000000,
  29819. 0x9000: 0x20040000,
  29820. 0xa000: 0x20000080,
  29821. 0xb000: 0x21040080,
  29822. 0xc000: 0x21040000,
  29823. 0xd000: 0x0,
  29824. 0xe000: 0x1040080,
  29825. 0xf000: 0x21000000,
  29826. 0x800: 0x1040080,
  29827. 0x1800: 0x21000080,
  29828. 0x2800: 0x80,
  29829. 0x3800: 0x1040000,
  29830. 0x4800: 0x40000,
  29831. 0x5800: 0x20040080,
  29832. 0x6800: 0x21040000,
  29833. 0x7800: 0x20000000,
  29834. 0x8800: 0x20040000,
  29835. 0x9800: 0x0,
  29836. 0xa800: 0x21040080,
  29837. 0xb800: 0x1000080,
  29838. 0xc800: 0x20000080,
  29839. 0xd800: 0x21000000,
  29840. 0xe800: 0x1000000,
  29841. 0xf800: 0x40080,
  29842. 0x10000: 0x40000,
  29843. 0x11000: 0x80,
  29844. 0x12000: 0x20000000,
  29845. 0x13000: 0x21000080,
  29846. 0x14000: 0x1000080,
  29847. 0x15000: 0x21040000,
  29848. 0x16000: 0x20040080,
  29849. 0x17000: 0x1000000,
  29850. 0x18000: 0x21040080,
  29851. 0x19000: 0x21000000,
  29852. 0x1a000: 0x1040000,
  29853. 0x1b000: 0x20040000,
  29854. 0x1c000: 0x40080,
  29855. 0x1d000: 0x20000080,
  29856. 0x1e000: 0x0,
  29857. 0x1f000: 0x1040080,
  29858. 0x10800: 0x21000080,
  29859. 0x11800: 0x1000000,
  29860. 0x12800: 0x1040000,
  29861. 0x13800: 0x20040080,
  29862. 0x14800: 0x20000000,
  29863. 0x15800: 0x1040080,
  29864. 0x16800: 0x80,
  29865. 0x17800: 0x21040000,
  29866. 0x18800: 0x40080,
  29867. 0x19800: 0x21040080,
  29868. 0x1a800: 0x0,
  29869. 0x1b800: 0x21000000,
  29870. 0x1c800: 0x1000080,
  29871. 0x1d800: 0x40000,
  29872. 0x1e800: 0x20040000,
  29873. 0x1f800: 0x20000080
  29874. }, {
  29875. 0x0: 0x10000008,
  29876. 0x100: 0x2000,
  29877. 0x200: 0x10200000,
  29878. 0x300: 0x10202008,
  29879. 0x400: 0x10002000,
  29880. 0x500: 0x200000,
  29881. 0x600: 0x200008,
  29882. 0x700: 0x10000000,
  29883. 0x800: 0x0,
  29884. 0x900: 0x10002008,
  29885. 0xa00: 0x202000,
  29886. 0xb00: 0x8,
  29887. 0xc00: 0x10200008,
  29888. 0xd00: 0x202008,
  29889. 0xe00: 0x2008,
  29890. 0xf00: 0x10202000,
  29891. 0x80: 0x10200000,
  29892. 0x180: 0x10202008,
  29893. 0x280: 0x8,
  29894. 0x380: 0x200000,
  29895. 0x480: 0x202008,
  29896. 0x580: 0x10000008,
  29897. 0x680: 0x10002000,
  29898. 0x780: 0x2008,
  29899. 0x880: 0x200008,
  29900. 0x980: 0x2000,
  29901. 0xa80: 0x10002008,
  29902. 0xb80: 0x10200008,
  29903. 0xc80: 0x0,
  29904. 0xd80: 0x10202000,
  29905. 0xe80: 0x202000,
  29906. 0xf80: 0x10000000,
  29907. 0x1000: 0x10002000,
  29908. 0x1100: 0x10200008,
  29909. 0x1200: 0x10202008,
  29910. 0x1300: 0x2008,
  29911. 0x1400: 0x200000,
  29912. 0x1500: 0x10000000,
  29913. 0x1600: 0x10000008,
  29914. 0x1700: 0x202000,
  29915. 0x1800: 0x202008,
  29916. 0x1900: 0x0,
  29917. 0x1a00: 0x8,
  29918. 0x1b00: 0x10200000,
  29919. 0x1c00: 0x2000,
  29920. 0x1d00: 0x10002008,
  29921. 0x1e00: 0x10202000,
  29922. 0x1f00: 0x200008,
  29923. 0x1080: 0x8,
  29924. 0x1180: 0x202000,
  29925. 0x1280: 0x200000,
  29926. 0x1380: 0x10000008,
  29927. 0x1480: 0x10002000,
  29928. 0x1580: 0x2008,
  29929. 0x1680: 0x10202008,
  29930. 0x1780: 0x10200000,
  29931. 0x1880: 0x10202000,
  29932. 0x1980: 0x10200008,
  29933. 0x1a80: 0x2000,
  29934. 0x1b80: 0x202008,
  29935. 0x1c80: 0x200008,
  29936. 0x1d80: 0x0,
  29937. 0x1e80: 0x10000000,
  29938. 0x1f80: 0x10002008
  29939. }, {
  29940. 0x0: 0x100000,
  29941. 0x10: 0x2000401,
  29942. 0x20: 0x400,
  29943. 0x30: 0x100401,
  29944. 0x40: 0x2100401,
  29945. 0x50: 0x0,
  29946. 0x60: 0x1,
  29947. 0x70: 0x2100001,
  29948. 0x80: 0x2000400,
  29949. 0x90: 0x100001,
  29950. 0xa0: 0x2000001,
  29951. 0xb0: 0x2100400,
  29952. 0xc0: 0x2100000,
  29953. 0xd0: 0x401,
  29954. 0xe0: 0x100400,
  29955. 0xf0: 0x2000000,
  29956. 0x8: 0x2100001,
  29957. 0x18: 0x0,
  29958. 0x28: 0x2000401,
  29959. 0x38: 0x2100400,
  29960. 0x48: 0x100000,
  29961. 0x58: 0x2000001,
  29962. 0x68: 0x2000000,
  29963. 0x78: 0x401,
  29964. 0x88: 0x100401,
  29965. 0x98: 0x2000400,
  29966. 0xa8: 0x2100000,
  29967. 0xb8: 0x100001,
  29968. 0xc8: 0x400,
  29969. 0xd8: 0x2100401,
  29970. 0xe8: 0x1,
  29971. 0xf8: 0x100400,
  29972. 0x100: 0x2000000,
  29973. 0x110: 0x100000,
  29974. 0x120: 0x2000401,
  29975. 0x130: 0x2100001,
  29976. 0x140: 0x100001,
  29977. 0x150: 0x2000400,
  29978. 0x160: 0x2100400,
  29979. 0x170: 0x100401,
  29980. 0x180: 0x401,
  29981. 0x190: 0x2100401,
  29982. 0x1a0: 0x100400,
  29983. 0x1b0: 0x1,
  29984. 0x1c0: 0x0,
  29985. 0x1d0: 0x2100000,
  29986. 0x1e0: 0x2000001,
  29987. 0x1f0: 0x400,
  29988. 0x108: 0x100400,
  29989. 0x118: 0x2000401,
  29990. 0x128: 0x2100001,
  29991. 0x138: 0x1,
  29992. 0x148: 0x2000000,
  29993. 0x158: 0x100000,
  29994. 0x168: 0x401,
  29995. 0x178: 0x2100400,
  29996. 0x188: 0x2000001,
  29997. 0x198: 0x2100000,
  29998. 0x1a8: 0x0,
  29999. 0x1b8: 0x2100401,
  30000. 0x1c8: 0x100401,
  30001. 0x1d8: 0x400,
  30002. 0x1e8: 0x2000400,
  30003. 0x1f8: 0x100001
  30004. }, {
  30005. 0x0: 0x8000820,
  30006. 0x1: 0x20000,
  30007. 0x2: 0x8000000,
  30008. 0x3: 0x20,
  30009. 0x4: 0x20020,
  30010. 0x5: 0x8020820,
  30011. 0x6: 0x8020800,
  30012. 0x7: 0x800,
  30013. 0x8: 0x8020000,
  30014. 0x9: 0x8000800,
  30015. 0xa: 0x20800,
  30016. 0xb: 0x8020020,
  30017. 0xc: 0x820,
  30018. 0xd: 0x0,
  30019. 0xe: 0x8000020,
  30020. 0xf: 0x20820,
  30021. 0x80000000: 0x800,
  30022. 0x80000001: 0x8020820,
  30023. 0x80000002: 0x8000820,
  30024. 0x80000003: 0x8000000,
  30025. 0x80000004: 0x8020000,
  30026. 0x80000005: 0x20800,
  30027. 0x80000006: 0x20820,
  30028. 0x80000007: 0x20,
  30029. 0x80000008: 0x8000020,
  30030. 0x80000009: 0x820,
  30031. 0x8000000a: 0x20020,
  30032. 0x8000000b: 0x8020800,
  30033. 0x8000000c: 0x0,
  30034. 0x8000000d: 0x8020020,
  30035. 0x8000000e: 0x8000800,
  30036. 0x8000000f: 0x20000,
  30037. 0x10: 0x20820,
  30038. 0x11: 0x8020800,
  30039. 0x12: 0x20,
  30040. 0x13: 0x800,
  30041. 0x14: 0x8000800,
  30042. 0x15: 0x8000020,
  30043. 0x16: 0x8020020,
  30044. 0x17: 0x20000,
  30045. 0x18: 0x0,
  30046. 0x19: 0x20020,
  30047. 0x1a: 0x8020000,
  30048. 0x1b: 0x8000820,
  30049. 0x1c: 0x8020820,
  30050. 0x1d: 0x20800,
  30051. 0x1e: 0x820,
  30052. 0x1f: 0x8000000,
  30053. 0x80000010: 0x20000,
  30054. 0x80000011: 0x800,
  30055. 0x80000012: 0x8020020,
  30056. 0x80000013: 0x20820,
  30057. 0x80000014: 0x20,
  30058. 0x80000015: 0x8020000,
  30059. 0x80000016: 0x8000000,
  30060. 0x80000017: 0x8000820,
  30061. 0x80000018: 0x8020820,
  30062. 0x80000019: 0x8000020,
  30063. 0x8000001a: 0x8000800,
  30064. 0x8000001b: 0x0,
  30065. 0x8000001c: 0x20800,
  30066. 0x8000001d: 0x820,
  30067. 0x8000001e: 0x20020,
  30068. 0x8000001f: 0x8020800
  30069. }];
  30070. // Masks that select the SBOX input
  30071. var SBOX_MASK = [0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f];
  30072. /**
  30073. * DES block cipher algorithm.
  30074. */
  30075. var DES = C_algo.DES = BlockCipher.extend({
  30076. _doReset: function _doReset() {
  30077. // Shortcuts
  30078. var key = this._key;
  30079. var keyWords = key.words;
  30080. // Select 56 bits according to PC1
  30081. var keyBits = [];
  30082. for (var i = 0; i < 56; i++) {
  30083. var keyBitPos = PC1[i] - 1;
  30084. keyBits[i] = keyWords[keyBitPos >>> 5] >>> 31 - keyBitPos % 32 & 1;
  30085. }
  30086. // Assemble 16 subkeys
  30087. var subKeys = this._subKeys = [];
  30088. for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
  30089. // Create subkey
  30090. var subKey = subKeys[nSubKey] = [];
  30091. // Shortcut
  30092. var bitShift = BIT_SHIFTS[nSubKey];
  30093. // Select 48 bits according to PC2
  30094. for (var i = 0; i < 24; i++) {
  30095. // Select from the left 28 key bits
  30096. subKey[i / 6 | 0] |= keyBits[(PC2[i] - 1 + bitShift) % 28] << 31 - i % 6;
  30097. // Select from the right 28 key bits
  30098. subKey[4 + (i / 6 | 0)] |= keyBits[28 + (PC2[i + 24] - 1 + bitShift) % 28] << 31 - i % 6;
  30099. }
  30100. // Since each subkey is applied to an expanded 32-bit input,
  30101. // the subkey can be broken into 8 values scaled to 32-bits,
  30102. // which allows the key to be used without expansion
  30103. subKey[0] = subKey[0] << 1 | subKey[0] >>> 31;
  30104. for (var i = 1; i < 7; i++) {
  30105. subKey[i] = subKey[i] >>> (i - 1) * 4 + 3;
  30106. }
  30107. subKey[7] = subKey[7] << 5 | subKey[7] >>> 27;
  30108. }
  30109. // Compute inverse subkeys
  30110. var invSubKeys = this._invSubKeys = [];
  30111. for (var i = 0; i < 16; i++) {
  30112. invSubKeys[i] = subKeys[15 - i];
  30113. }
  30114. },
  30115. encryptBlock: function encryptBlock(M, offset) {
  30116. this._doCryptBlock(M, offset, this._subKeys);
  30117. },
  30118. decryptBlock: function decryptBlock(M, offset) {
  30119. this._doCryptBlock(M, offset, this._invSubKeys);
  30120. },
  30121. _doCryptBlock: function _doCryptBlock(M, offset, subKeys) {
  30122. // Get input
  30123. this._lBlock = M[offset];
  30124. this._rBlock = M[offset + 1];
  30125. // Initial permutation
  30126. exchangeLR.call(this, 4, 0x0f0f0f0f);
  30127. exchangeLR.call(this, 16, 0x0000ffff);
  30128. exchangeRL.call(this, 2, 0x33333333);
  30129. exchangeRL.call(this, 8, 0x00ff00ff);
  30130. exchangeLR.call(this, 1, 0x55555555);
  30131. // Rounds
  30132. for (var round = 0; round < 16; round++) {
  30133. // Shortcuts
  30134. var subKey = subKeys[round];
  30135. var lBlock = this._lBlock;
  30136. var rBlock = this._rBlock;
  30137. // Feistel function
  30138. var f = 0;
  30139. for (var i = 0; i < 8; i++) {
  30140. f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
  30141. }
  30142. this._lBlock = rBlock;
  30143. this._rBlock = lBlock ^ f;
  30144. }
  30145. // Undo swap from last round
  30146. var t = this._lBlock;
  30147. this._lBlock = this._rBlock;
  30148. this._rBlock = t;
  30149. // Final permutation
  30150. exchangeLR.call(this, 1, 0x55555555);
  30151. exchangeRL.call(this, 8, 0x00ff00ff);
  30152. exchangeRL.call(this, 2, 0x33333333);
  30153. exchangeLR.call(this, 16, 0x0000ffff);
  30154. exchangeLR.call(this, 4, 0x0f0f0f0f);
  30155. // Set output
  30156. M[offset] = this._lBlock;
  30157. M[offset + 1] = this._rBlock;
  30158. },
  30159. keySize: 64 / 32,
  30160. ivSize: 64 / 32,
  30161. blockSize: 64 / 32
  30162. });
  30163. // Swap bits across the left and right words
  30164. function exchangeLR(offset, mask) {
  30165. var t = (this._lBlock >>> offset ^ this._rBlock) & mask;
  30166. this._rBlock ^= t;
  30167. this._lBlock ^= t << offset;
  30168. }
  30169. function exchangeRL(offset, mask) {
  30170. var t = (this._rBlock >>> offset ^ this._lBlock) & mask;
  30171. this._lBlock ^= t;
  30172. this._rBlock ^= t << offset;
  30173. }
  30174. /**
  30175. * Shortcut functions to the cipher's object interface.
  30176. *
  30177. * @example
  30178. *
  30179. * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
  30180. * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
  30181. */
  30182. C.DES = BlockCipher._createHelper(DES);
  30183. /**
  30184. * Triple-DES block cipher algorithm.
  30185. */
  30186. var TripleDES = C_algo.TripleDES = BlockCipher.extend({
  30187. _doReset: function _doReset() {
  30188. // Shortcuts
  30189. var key = this._key;
  30190. var keyWords = key.words;
  30191. // Make sure the key length is valid (64, 128 or >= 192 bit)
  30192. if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
  30193. throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
  30194. }
  30195. // Extend the key according to the keying options defined in 3DES standard
  30196. var key1 = keyWords.slice(0, 2);
  30197. var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
  30198. var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
  30199. // Create DES instances
  30200. this._des1 = DES.createEncryptor(WordArray.create(key1));
  30201. this._des2 = DES.createEncryptor(WordArray.create(key2));
  30202. this._des3 = DES.createEncryptor(WordArray.create(key3));
  30203. },
  30204. encryptBlock: function encryptBlock(M, offset) {
  30205. this._des1.encryptBlock(M, offset);
  30206. this._des2.decryptBlock(M, offset);
  30207. this._des3.encryptBlock(M, offset);
  30208. },
  30209. decryptBlock: function decryptBlock(M, offset) {
  30210. this._des3.decryptBlock(M, offset);
  30211. this._des2.encryptBlock(M, offset);
  30212. this._des1.decryptBlock(M, offset);
  30213. },
  30214. keySize: 192 / 32,
  30215. ivSize: 64 / 32,
  30216. blockSize: 64 / 32
  30217. });
  30218. /**
  30219. * Shortcut functions to the cipher's object interface.
  30220. *
  30221. * @example
  30222. *
  30223. * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
  30224. * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
  30225. */
  30226. C.TripleDES = BlockCipher._createHelper(TripleDES);
  30227. })();
  30228. (function () {
  30229. // Shortcuts
  30230. var C = CryptoJS;
  30231. var C_lib = C.lib;
  30232. var StreamCipher = C_lib.StreamCipher;
  30233. var C_algo = C.algo;
  30234. /**
  30235. * RC4 stream cipher algorithm.
  30236. */
  30237. var RC4 = C_algo.RC4 = StreamCipher.extend({
  30238. _doReset: function _doReset() {
  30239. // Shortcuts
  30240. var key = this._key;
  30241. var keyWords = key.words;
  30242. var keySigBytes = key.sigBytes;
  30243. // Init sbox
  30244. var S = this._S = [];
  30245. for (var i = 0; i < 256; i++) {
  30246. S[i] = i;
  30247. }
  30248. // Key setup
  30249. for (var i = 0, j = 0; i < 256; i++) {
  30250. var keyByteIndex = i % keySigBytes;
  30251. var keyByte = keyWords[keyByteIndex >>> 2] >>> 24 - keyByteIndex % 4 * 8 & 0xff;
  30252. j = (j + S[i] + keyByte) % 256;
  30253. // Swap
  30254. var t = S[i];
  30255. S[i] = S[j];
  30256. S[j] = t;
  30257. }
  30258. // Counters
  30259. this._i = this._j = 0;
  30260. },
  30261. _doProcessBlock: function _doProcessBlock(M, offset) {
  30262. M[offset] ^= generateKeystreamWord.call(this);
  30263. },
  30264. keySize: 256 / 32,
  30265. ivSize: 0
  30266. });
  30267. function generateKeystreamWord() {
  30268. // Shortcuts
  30269. var S = this._S;
  30270. var i = this._i;
  30271. var j = this._j;
  30272. // Generate keystream word
  30273. var keystreamWord = 0;
  30274. for (var n = 0; n < 4; n++) {
  30275. i = (i + 1) % 256;
  30276. j = (j + S[i]) % 256;
  30277. // Swap
  30278. var t = S[i];
  30279. S[i] = S[j];
  30280. S[j] = t;
  30281. keystreamWord |= S[(S[i] + S[j]) % 256] << 24 - n * 8;
  30282. }
  30283. // Update counters
  30284. this._i = i;
  30285. this._j = j;
  30286. return keystreamWord;
  30287. }
  30288. /**
  30289. * Shortcut functions to the cipher's object interface.
  30290. *
  30291. * @example
  30292. *
  30293. * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
  30294. * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
  30295. */
  30296. C.RC4 = StreamCipher._createHelper(RC4);
  30297. /**
  30298. * Modified RC4 stream cipher algorithm.
  30299. */
  30300. var RC4Drop = C_algo.RC4Drop = RC4.extend({
  30301. /**
  30302. * Configuration options.
  30303. *
  30304. * @property {number} drop The number of keystream words to drop. Default 192
  30305. */
  30306. cfg: RC4.cfg.extend({
  30307. drop: 192
  30308. }),
  30309. _doReset: function _doReset() {
  30310. RC4._doReset.call(this);
  30311. // Drop
  30312. for (var i = this.cfg.drop; i > 0; i--) {
  30313. generateKeystreamWord.call(this);
  30314. }
  30315. }
  30316. });
  30317. /**
  30318. * Shortcut functions to the cipher's object interface.
  30319. *
  30320. * @example
  30321. *
  30322. * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
  30323. * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
  30324. */
  30325. C.RC4Drop = StreamCipher._createHelper(RC4Drop);
  30326. })();
  30327. (function () {
  30328. // Shortcuts
  30329. var C = CryptoJS;
  30330. var C_lib = C.lib;
  30331. var StreamCipher = C_lib.StreamCipher;
  30332. var C_algo = C.algo;
  30333. // Reusable objects
  30334. var S = [];
  30335. var C_ = [];
  30336. var G = [];
  30337. /**
  30338. * Rabbit stream cipher algorithm
  30339. */
  30340. var Rabbit = C_algo.Rabbit = StreamCipher.extend({
  30341. _doReset: function _doReset() {
  30342. // Shortcuts
  30343. var K = this._key.words;
  30344. var iv = this.cfg.iv;
  30345. // Swap endian
  30346. for (var i = 0; i < 4; i++) {
  30347. K[i] = (K[i] << 8 | K[i] >>> 24) & 0x00ff00ff | (K[i] << 24 | K[i] >>> 8) & 0xff00ff00;
  30348. }
  30349. // Generate initial state values
  30350. var X = this._X = [K[0], K[3] << 16 | K[2] >>> 16, K[1], K[0] << 16 | K[3] >>> 16, K[2], K[1] << 16 | K[0] >>> 16, K[3], K[2] << 16 | K[1] >>> 16];
  30351. // Generate initial counter values
  30352. var C = this._C = [K[2] << 16 | K[2] >>> 16, K[0] & 0xffff0000 | K[1] & 0x0000ffff, K[3] << 16 | K[3] >>> 16, K[1] & 0xffff0000 | K[2] & 0x0000ffff, K[0] << 16 | K[0] >>> 16, K[2] & 0xffff0000 | K[3] & 0x0000ffff, K[1] << 16 | K[1] >>> 16, K[3] & 0xffff0000 | K[0] & 0x0000ffff];
  30353. // Carry bit
  30354. this._b = 0;
  30355. // Iterate the system four times
  30356. for (var i = 0; i < 4; i++) {
  30357. nextState.call(this);
  30358. }
  30359. // Modify the counters
  30360. for (var i = 0; i < 8; i++) {
  30361. C[i] ^= X[i + 4 & 7];
  30362. }
  30363. // IV setup
  30364. if (iv) {
  30365. // Shortcuts
  30366. var IV = iv.words;
  30367. var IV_0 = IV[0];
  30368. var IV_1 = IV[1];
  30369. // Generate four subvectors
  30370. var i0 = (IV_0 << 8 | IV_0 >>> 24) & 0x00ff00ff | (IV_0 << 24 | IV_0 >>> 8) & 0xff00ff00;
  30371. var i2 = (IV_1 << 8 | IV_1 >>> 24) & 0x00ff00ff | (IV_1 << 24 | IV_1 >>> 8) & 0xff00ff00;
  30372. var i1 = i0 >>> 16 | i2 & 0xffff0000;
  30373. var i3 = i2 << 16 | i0 & 0x0000ffff;
  30374. // Modify counter values
  30375. C[0] ^= i0;
  30376. C[1] ^= i1;
  30377. C[2] ^= i2;
  30378. C[3] ^= i3;
  30379. C[4] ^= i0;
  30380. C[5] ^= i1;
  30381. C[6] ^= i2;
  30382. C[7] ^= i3;
  30383. // Iterate the system four times
  30384. for (var i = 0; i < 4; i++) {
  30385. nextState.call(this);
  30386. }
  30387. }
  30388. },
  30389. _doProcessBlock: function _doProcessBlock(M, offset) {
  30390. // Shortcut
  30391. var X = this._X;
  30392. // Iterate the system
  30393. nextState.call(this);
  30394. // Generate four keystream words
  30395. S[0] = X[0] ^ X[5] >>> 16 ^ X[3] << 16;
  30396. S[1] = X[2] ^ X[7] >>> 16 ^ X[5] << 16;
  30397. S[2] = X[4] ^ X[1] >>> 16 ^ X[7] << 16;
  30398. S[3] = X[6] ^ X[3] >>> 16 ^ X[1] << 16;
  30399. for (var i = 0; i < 4; i++) {
  30400. // Swap endian
  30401. S[i] = (S[i] << 8 | S[i] >>> 24) & 0x00ff00ff | (S[i] << 24 | S[i] >>> 8) & 0xff00ff00;
  30402. // Encrypt
  30403. M[offset + i] ^= S[i];
  30404. }
  30405. },
  30406. blockSize: 128 / 32,
  30407. ivSize: 64 / 32
  30408. });
  30409. function nextState() {
  30410. // Shortcuts
  30411. var X = this._X;
  30412. var C = this._C;
  30413. // Save old counter values
  30414. for (var i = 0; i < 8; i++) {
  30415. C_[i] = C[i];
  30416. }
  30417. // Calculate new counter values
  30418. C[0] = C[0] + 0x4d34d34d + this._b | 0;
  30419. C[1] = C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0) | 0;
  30420. C[2] = C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0) | 0;
  30421. C[3] = C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0) | 0;
  30422. C[4] = C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0) | 0;
  30423. C[5] = C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0) | 0;
  30424. C[6] = C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0) | 0;
  30425. C[7] = C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0) | 0;
  30426. this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;
  30427. // Calculate the g-values
  30428. for (var i = 0; i < 8; i++) {
  30429. var gx = X[i] + C[i];
  30430. // Construct high and low argument for squaring
  30431. var ga = gx & 0xffff;
  30432. var gb = gx >>> 16;
  30433. // Calculate high and low result of squaring
  30434. var gh = ((ga * ga >>> 17) + ga * gb >>> 15) + gb * gb;
  30435. var gl = ((gx & 0xffff0000) * gx | 0) + ((gx & 0x0000ffff) * gx | 0);
  30436. // High XOR low
  30437. G[i] = gh ^ gl;
  30438. }
  30439. // Calculate new state values
  30440. X[0] = G[0] + (G[7] << 16 | G[7] >>> 16) + (G[6] << 16 | G[6] >>> 16) | 0;
  30441. X[1] = G[1] + (G[0] << 8 | G[0] >>> 24) + G[7] | 0;
  30442. X[2] = G[2] + (G[1] << 16 | G[1] >>> 16) + (G[0] << 16 | G[0] >>> 16) | 0;
  30443. X[3] = G[3] + (G[2] << 8 | G[2] >>> 24) + G[1] | 0;
  30444. X[4] = G[4] + (G[3] << 16 | G[3] >>> 16) + (G[2] << 16 | G[2] >>> 16) | 0;
  30445. X[5] = G[5] + (G[4] << 8 | G[4] >>> 24) + G[3] | 0;
  30446. X[6] = G[6] + (G[5] << 16 | G[5] >>> 16) + (G[4] << 16 | G[4] >>> 16) | 0;
  30447. X[7] = G[7] + (G[6] << 8 | G[6] >>> 24) + G[5] | 0;
  30448. }
  30449. /**
  30450. * Shortcut functions to the cipher's object interface.
  30451. *
  30452. * @example
  30453. *
  30454. * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
  30455. * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
  30456. */
  30457. C.Rabbit = StreamCipher._createHelper(Rabbit);
  30458. })();
  30459. (function () {
  30460. // Shortcuts
  30461. var C = CryptoJS;
  30462. var C_lib = C.lib;
  30463. var StreamCipher = C_lib.StreamCipher;
  30464. var C_algo = C.algo;
  30465. // Reusable objects
  30466. var S = [];
  30467. var C_ = [];
  30468. var G = [];
  30469. /**
  30470. * Rabbit stream cipher algorithm.
  30471. *
  30472. * This is a legacy version that neglected to convert the key to little-endian.
  30473. * This error doesn't affect the cipher's security,
  30474. * but it does affect its compatibility with other implementations.
  30475. */
  30476. var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
  30477. _doReset: function _doReset() {
  30478. // Shortcuts
  30479. var K = this._key.words;
  30480. var iv = this.cfg.iv;
  30481. // Generate initial state values
  30482. var X = this._X = [K[0], K[3] << 16 | K[2] >>> 16, K[1], K[0] << 16 | K[3] >>> 16, K[2], K[1] << 16 | K[0] >>> 16, K[3], K[2] << 16 | K[1] >>> 16];
  30483. // Generate initial counter values
  30484. var C = this._C = [K[2] << 16 | K[2] >>> 16, K[0] & 0xffff0000 | K[1] & 0x0000ffff, K[3] << 16 | K[3] >>> 16, K[1] & 0xffff0000 | K[2] & 0x0000ffff, K[0] << 16 | K[0] >>> 16, K[2] & 0xffff0000 | K[3] & 0x0000ffff, K[1] << 16 | K[1] >>> 16, K[3] & 0xffff0000 | K[0] & 0x0000ffff];
  30485. // Carry bit
  30486. this._b = 0;
  30487. // Iterate the system four times
  30488. for (var i = 0; i < 4; i++) {
  30489. nextState.call(this);
  30490. }
  30491. // Modify the counters
  30492. for (var i = 0; i < 8; i++) {
  30493. C[i] ^= X[i + 4 & 7];
  30494. }
  30495. // IV setup
  30496. if (iv) {
  30497. // Shortcuts
  30498. var IV = iv.words;
  30499. var IV_0 = IV[0];
  30500. var IV_1 = IV[1];
  30501. // Generate four subvectors
  30502. var i0 = (IV_0 << 8 | IV_0 >>> 24) & 0x00ff00ff | (IV_0 << 24 | IV_0 >>> 8) & 0xff00ff00;
  30503. var i2 = (IV_1 << 8 | IV_1 >>> 24) & 0x00ff00ff | (IV_1 << 24 | IV_1 >>> 8) & 0xff00ff00;
  30504. var i1 = i0 >>> 16 | i2 & 0xffff0000;
  30505. var i3 = i2 << 16 | i0 & 0x0000ffff;
  30506. // Modify counter values
  30507. C[0] ^= i0;
  30508. C[1] ^= i1;
  30509. C[2] ^= i2;
  30510. C[3] ^= i3;
  30511. C[4] ^= i0;
  30512. C[5] ^= i1;
  30513. C[6] ^= i2;
  30514. C[7] ^= i3;
  30515. // Iterate the system four times
  30516. for (var i = 0; i < 4; i++) {
  30517. nextState.call(this);
  30518. }
  30519. }
  30520. },
  30521. _doProcessBlock: function _doProcessBlock(M, offset) {
  30522. // Shortcut
  30523. var X = this._X;
  30524. // Iterate the system
  30525. nextState.call(this);
  30526. // Generate four keystream words
  30527. S[0] = X[0] ^ X[5] >>> 16 ^ X[3] << 16;
  30528. S[1] = X[2] ^ X[7] >>> 16 ^ X[5] << 16;
  30529. S[2] = X[4] ^ X[1] >>> 16 ^ X[7] << 16;
  30530. S[3] = X[6] ^ X[3] >>> 16 ^ X[1] << 16;
  30531. for (var i = 0; i < 4; i++) {
  30532. // Swap endian
  30533. S[i] = (S[i] << 8 | S[i] >>> 24) & 0x00ff00ff | (S[i] << 24 | S[i] >>> 8) & 0xff00ff00;
  30534. // Encrypt
  30535. M[offset + i] ^= S[i];
  30536. }
  30537. },
  30538. blockSize: 128 / 32,
  30539. ivSize: 64 / 32
  30540. });
  30541. function nextState() {
  30542. // Shortcuts
  30543. var X = this._X;
  30544. var C = this._C;
  30545. // Save old counter values
  30546. for (var i = 0; i < 8; i++) {
  30547. C_[i] = C[i];
  30548. }
  30549. // Calculate new counter values
  30550. C[0] = C[0] + 0x4d34d34d + this._b | 0;
  30551. C[1] = C[1] + 0xd34d34d3 + (C[0] >>> 0 < C_[0] >>> 0 ? 1 : 0) | 0;
  30552. C[2] = C[2] + 0x34d34d34 + (C[1] >>> 0 < C_[1] >>> 0 ? 1 : 0) | 0;
  30553. C[3] = C[3] + 0x4d34d34d + (C[2] >>> 0 < C_[2] >>> 0 ? 1 : 0) | 0;
  30554. C[4] = C[4] + 0xd34d34d3 + (C[3] >>> 0 < C_[3] >>> 0 ? 1 : 0) | 0;
  30555. C[5] = C[5] + 0x34d34d34 + (C[4] >>> 0 < C_[4] >>> 0 ? 1 : 0) | 0;
  30556. C[6] = C[6] + 0x4d34d34d + (C[5] >>> 0 < C_[5] >>> 0 ? 1 : 0) | 0;
  30557. C[7] = C[7] + 0xd34d34d3 + (C[6] >>> 0 < C_[6] >>> 0 ? 1 : 0) | 0;
  30558. this._b = C[7] >>> 0 < C_[7] >>> 0 ? 1 : 0;
  30559. // Calculate the g-values
  30560. for (var i = 0; i < 8; i++) {
  30561. var gx = X[i] + C[i];
  30562. // Construct high and low argument for squaring
  30563. var ga = gx & 0xffff;
  30564. var gb = gx >>> 16;
  30565. // Calculate high and low result of squaring
  30566. var gh = ((ga * ga >>> 17) + ga * gb >>> 15) + gb * gb;
  30567. var gl = ((gx & 0xffff0000) * gx | 0) + ((gx & 0x0000ffff) * gx | 0);
  30568. // High XOR low
  30569. G[i] = gh ^ gl;
  30570. }
  30571. // Calculate new state values
  30572. X[0] = G[0] + (G[7] << 16 | G[7] >>> 16) + (G[6] << 16 | G[6] >>> 16) | 0;
  30573. X[1] = G[1] + (G[0] << 8 | G[0] >>> 24) + G[7] | 0;
  30574. X[2] = G[2] + (G[1] << 16 | G[1] >>> 16) + (G[0] << 16 | G[0] >>> 16) | 0;
  30575. X[3] = G[3] + (G[2] << 8 | G[2] >>> 24) + G[1] | 0;
  30576. X[4] = G[4] + (G[3] << 16 | G[3] >>> 16) + (G[2] << 16 | G[2] >>> 16) | 0;
  30577. X[5] = G[5] + (G[4] << 8 | G[4] >>> 24) + G[3] | 0;
  30578. X[6] = G[6] + (G[5] << 16 | G[5] >>> 16) + (G[4] << 16 | G[4] >>> 16) | 0;
  30579. X[7] = G[7] + (G[6] << 8 | G[6] >>> 24) + G[5] | 0;
  30580. }
  30581. /**
  30582. * Shortcut functions to the cipher's object interface.
  30583. *
  30584. * @example
  30585. *
  30586. * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
  30587. * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
  30588. */
  30589. C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
  30590. })();
  30591. return CryptoJS;
  30592. });
  30593. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! (webpack)/buildin/global.js */ 3)))
  30594. /***/ }),
  30595. /* 111 */
  30596. /*!*************************************************!*\
  30597. !*** ./node_modules/crypto-browserify/index.js ***!
  30598. \*************************************************/
  30599. /*! no static exports found */
  30600. /***/ (function(module, exports, __webpack_require__) {
  30601. "use strict";
  30602. exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ 112)
  30603. exports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ 120)
  30604. exports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ 155)
  30605. var algos = __webpack_require__(/*! browserify-sign/algos */ 158)
  30606. var algoKeys = Object.keys(algos)
  30607. var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys)
  30608. exports.getHashes = function () {
  30609. return hashes
  30610. }
  30611. var p = __webpack_require__(/*! pbkdf2 */ 160)
  30612. exports.pbkdf2 = p.pbkdf2
  30613. exports.pbkdf2Sync = p.pbkdf2Sync
  30614. var aes = __webpack_require__(/*! browserify-cipher */ 166)
  30615. exports.Cipher = aes.Cipher
  30616. exports.createCipher = aes.createCipher
  30617. exports.Cipheriv = aes.Cipheriv
  30618. exports.createCipheriv = aes.createCipheriv
  30619. exports.Decipher = aes.Decipher
  30620. exports.createDecipher = aes.createDecipher
  30621. exports.Decipheriv = aes.Decipheriv
  30622. exports.createDecipheriv = aes.createDecipheriv
  30623. exports.getCiphers = aes.getCiphers
  30624. exports.listCiphers = aes.listCiphers
  30625. var dh = __webpack_require__(/*! diffie-hellman */ 195)
  30626. exports.DiffieHellmanGroup = dh.DiffieHellmanGroup
  30627. exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup
  30628. exports.getDiffieHellman = dh.getDiffieHellman
  30629. exports.createDiffieHellman = dh.createDiffieHellman
  30630. exports.DiffieHellman = dh.DiffieHellman
  30631. var sign = __webpack_require__(/*! browserify-sign */ 205)
  30632. exports.createSign = sign.createSign
  30633. exports.Sign = sign.Sign
  30634. exports.createVerify = sign.createVerify
  30635. exports.Verify = sign.Verify
  30636. exports.createECDH = __webpack_require__(/*! create-ecdh */ 260)
  30637. var publicEncrypt = __webpack_require__(/*! public-encrypt */ 261)
  30638. exports.publicEncrypt = publicEncrypt.publicEncrypt
  30639. exports.privateEncrypt = publicEncrypt.privateEncrypt
  30640. exports.publicDecrypt = publicEncrypt.publicDecrypt
  30641. exports.privateDecrypt = publicEncrypt.privateDecrypt
  30642. // the least I can do is make error messages for the rest of the node.js/crypto api.
  30643. // ;[
  30644. // 'createCredentials'
  30645. // ].forEach(function (name) {
  30646. // exports[name] = function () {
  30647. // throw new Error([
  30648. // 'sorry, ' + name + ' is not implemented yet',
  30649. // 'we accept pull requests',
  30650. // 'https://github.com/crypto-browserify/crypto-browserify'
  30651. // ].join('\n'))
  30652. // }
  30653. // })
  30654. var rf = __webpack_require__(/*! randomfill */ 267)
  30655. exports.randomFill = rf.randomFill
  30656. exports.randomFillSync = rf.randomFillSync
  30657. exports.createCredentials = function () {
  30658. throw new Error([
  30659. 'sorry, createCredentials is not implemented yet',
  30660. 'we accept pull requests',
  30661. 'https://github.com/crypto-browserify/crypto-browserify'
  30662. ].join('\n'))
  30663. }
  30664. exports.constants = {
  30665. 'DH_CHECK_P_NOT_SAFE_PRIME': 2,
  30666. 'DH_CHECK_P_NOT_PRIME': 1,
  30667. 'DH_UNABLE_TO_CHECK_GENERATOR': 4,
  30668. 'DH_NOT_SUITABLE_GENERATOR': 8,
  30669. 'NPN_ENABLED': 1,
  30670. 'ALPN_ENABLED': 1,
  30671. 'RSA_PKCS1_PADDING': 1,
  30672. 'RSA_SSLV23_PADDING': 2,
  30673. 'RSA_NO_PADDING': 3,
  30674. 'RSA_PKCS1_OAEP_PADDING': 4,
  30675. 'RSA_X931_PADDING': 5,
  30676. 'RSA_PKCS1_PSS_PADDING': 6,
  30677. 'POINT_CONVERSION_COMPRESSED': 2,
  30678. 'POINT_CONVERSION_UNCOMPRESSED': 4,
  30679. 'POINT_CONVERSION_HYBRID': 6
  30680. }
  30681. /***/ }),
  30682. /* 112 */
  30683. /*!*********************************************!*\
  30684. !*** ./node_modules/randombytes/browser.js ***!
  30685. \*********************************************/
  30686. /*! no static exports found */
  30687. /***/ (function(module, exports, __webpack_require__) {
  30688. "use strict";
  30689. /* WEBPACK VAR INJECTION */(function(global, process) {
  30690. // limit of Crypto.getRandomValues()
  30691. // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
  30692. var MAX_BYTES = 65536
  30693. // Node supports requesting up to this number of bytes
  30694. // https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
  30695. var MAX_UINT32 = 4294967295
  30696. function oldBrowser () {
  30697. throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
  30698. }
  30699. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  30700. var crypto = global.crypto || global.msCrypto
  30701. if (crypto && crypto.getRandomValues) {
  30702. module.exports = randomBytes
  30703. } else {
  30704. module.exports = oldBrowser
  30705. }
  30706. function randomBytes (size, cb) {
  30707. // phantomjs needs to throw
  30708. if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
  30709. var bytes = Buffer.allocUnsafe(size)
  30710. if (size > 0) { // getRandomValues fails on IE if size == 0
  30711. if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
  30712. // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
  30713. for (var generated = 0; generated < size; generated += MAX_BYTES) {
  30714. // buffer.slice automatically checks if the end is past the end of
  30715. // the buffer so we don't have to here
  30716. crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
  30717. }
  30718. } else {
  30719. crypto.getRandomValues(bytes)
  30720. }
  30721. }
  30722. if (typeof cb === 'function') {
  30723. return process.nextTick(function () {
  30724. cb(null, bytes)
  30725. })
  30726. }
  30727. return bytes
  30728. }
  30729. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
  30730. /***/ }),
  30731. /* 113 */
  30732. /*!********************************************************!*\
  30733. !*** ./node_modules/node-libs-browser/mock/process.js ***!
  30734. \********************************************************/
  30735. /*! no static exports found */
  30736. /***/ (function(module, exports, __webpack_require__) {
  30737. exports.nextTick = function nextTick(fn) {
  30738. var args = Array.prototype.slice.call(arguments);
  30739. args.shift();
  30740. setTimeout(function () {
  30741. fn.apply(null, args);
  30742. }, 0);
  30743. };
  30744. exports.platform = exports.arch =
  30745. exports.execPath = exports.title = 'browser';
  30746. exports.pid = 1;
  30747. exports.browser = true;
  30748. exports.env = {};
  30749. exports.argv = [];
  30750. exports.binding = function (name) {
  30751. throw new Error('No such module. (Possibly not yet loaded)')
  30752. };
  30753. (function () {
  30754. var cwd = '/';
  30755. var path;
  30756. exports.cwd = function () { return cwd };
  30757. exports.chdir = function (dir) {
  30758. if (!path) path = __webpack_require__(/*! path */ 114);
  30759. cwd = path.resolve(dir, cwd);
  30760. };
  30761. })();
  30762. exports.exit = exports.kill =
  30763. exports.umask = exports.dlopen =
  30764. exports.uptime = exports.memoryUsage =
  30765. exports.uvCounters = function() {};
  30766. exports.features = {};
  30767. /***/ }),
  30768. /* 114 */
  30769. /*!***********************************************!*\
  30770. !*** ./node_modules/path-browserify/index.js ***!
  30771. \***********************************************/
  30772. /*! no static exports found */
  30773. /***/ (function(module, exports, __webpack_require__) {
  30774. /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
  30775. // backported and transplited with Babel, with backwards-compat fixes
  30776. // Copyright Joyent, Inc. and other Node contributors.
  30777. //
  30778. // Permission is hereby granted, free of charge, to any person obtaining a
  30779. // copy of this software and associated documentation files (the
  30780. // "Software"), to deal in the Software without restriction, including
  30781. // without limitation the rights to use, copy, modify, merge, publish,
  30782. // distribute, sublicense, and/or sell copies of the Software, and to permit
  30783. // persons to whom the Software is furnished to do so, subject to the
  30784. // following conditions:
  30785. //
  30786. // The above copyright notice and this permission notice shall be included
  30787. // in all copies or substantial portions of the Software.
  30788. //
  30789. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  30790. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  30791. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  30792. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  30793. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  30794. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  30795. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  30796. // resolves . and .. elements in a path array with directory names there
  30797. // must be no slashes, empty elements, or device names (c:\) in the array
  30798. // (so also no leading and trailing slashes - it does not distinguish
  30799. // relative and absolute paths)
  30800. function normalizeArray(parts, allowAboveRoot) {
  30801. // if the path tries to go above the root, `up` ends up > 0
  30802. var up = 0;
  30803. for (var i = parts.length - 1; i >= 0; i--) {
  30804. var last = parts[i];
  30805. if (last === '.') {
  30806. parts.splice(i, 1);
  30807. } else if (last === '..') {
  30808. parts.splice(i, 1);
  30809. up++;
  30810. } else if (up) {
  30811. parts.splice(i, 1);
  30812. up--;
  30813. }
  30814. }
  30815. // if the path is allowed to go above the root, restore leading ..s
  30816. if (allowAboveRoot) {
  30817. for (; up--; up) {
  30818. parts.unshift('..');
  30819. }
  30820. }
  30821. return parts;
  30822. }
  30823. // path.resolve([from ...], to)
  30824. // posix version
  30825. exports.resolve = function() {
  30826. var resolvedPath = '',
  30827. resolvedAbsolute = false;
  30828. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  30829. var path = (i >= 0) ? arguments[i] : process.cwd();
  30830. // Skip empty and invalid entries
  30831. if (typeof path !== 'string') {
  30832. throw new TypeError('Arguments to path.resolve must be strings');
  30833. } else if (!path) {
  30834. continue;
  30835. }
  30836. resolvedPath = path + '/' + resolvedPath;
  30837. resolvedAbsolute = path.charAt(0) === '/';
  30838. }
  30839. // At this point the path should be resolved to a full absolute path, but
  30840. // handle relative paths to be safe (might happen when process.cwd() fails)
  30841. // Normalize the path
  30842. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  30843. return !!p;
  30844. }), !resolvedAbsolute).join('/');
  30845. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  30846. };
  30847. // path.normalize(path)
  30848. // posix version
  30849. exports.normalize = function(path) {
  30850. var isAbsolute = exports.isAbsolute(path),
  30851. trailingSlash = substr(path, -1) === '/';
  30852. // Normalize the path
  30853. path = normalizeArray(filter(path.split('/'), function(p) {
  30854. return !!p;
  30855. }), !isAbsolute).join('/');
  30856. if (!path && !isAbsolute) {
  30857. path = '.';
  30858. }
  30859. if (path && trailingSlash) {
  30860. path += '/';
  30861. }
  30862. return (isAbsolute ? '/' : '') + path;
  30863. };
  30864. // posix version
  30865. exports.isAbsolute = function(path) {
  30866. return path.charAt(0) === '/';
  30867. };
  30868. // posix version
  30869. exports.join = function() {
  30870. var paths = Array.prototype.slice.call(arguments, 0);
  30871. return exports.normalize(filter(paths, function(p, index) {
  30872. if (typeof p !== 'string') {
  30873. throw new TypeError('Arguments to path.join must be strings');
  30874. }
  30875. return p;
  30876. }).join('/'));
  30877. };
  30878. // path.relative(from, to)
  30879. // posix version
  30880. exports.relative = function(from, to) {
  30881. from = exports.resolve(from).substr(1);
  30882. to = exports.resolve(to).substr(1);
  30883. function trim(arr) {
  30884. var start = 0;
  30885. for (; start < arr.length; start++) {
  30886. if (arr[start] !== '') break;
  30887. }
  30888. var end = arr.length - 1;
  30889. for (; end >= 0; end--) {
  30890. if (arr[end] !== '') break;
  30891. }
  30892. if (start > end) return [];
  30893. return arr.slice(start, end - start + 1);
  30894. }
  30895. var fromParts = trim(from.split('/'));
  30896. var toParts = trim(to.split('/'));
  30897. var length = Math.min(fromParts.length, toParts.length);
  30898. var samePartsLength = length;
  30899. for (var i = 0; i < length; i++) {
  30900. if (fromParts[i] !== toParts[i]) {
  30901. samePartsLength = i;
  30902. break;
  30903. }
  30904. }
  30905. var outputParts = [];
  30906. for (var i = samePartsLength; i < fromParts.length; i++) {
  30907. outputParts.push('..');
  30908. }
  30909. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  30910. return outputParts.join('/');
  30911. };
  30912. exports.sep = '/';
  30913. exports.delimiter = ':';
  30914. exports.dirname = function (path) {
  30915. if (typeof path !== 'string') path = path + '';
  30916. if (path.length === 0) return '.';
  30917. var code = path.charCodeAt(0);
  30918. var hasRoot = code === 47 /*/*/;
  30919. var end = -1;
  30920. var matchedSlash = true;
  30921. for (var i = path.length - 1; i >= 1; --i) {
  30922. code = path.charCodeAt(i);
  30923. if (code === 47 /*/*/) {
  30924. if (!matchedSlash) {
  30925. end = i;
  30926. break;
  30927. }
  30928. } else {
  30929. // We saw the first non-path separator
  30930. matchedSlash = false;
  30931. }
  30932. }
  30933. if (end === -1) return hasRoot ? '/' : '.';
  30934. if (hasRoot && end === 1) {
  30935. // return '//';
  30936. // Backwards-compat fix:
  30937. return '/';
  30938. }
  30939. return path.slice(0, end);
  30940. };
  30941. function basename(path) {
  30942. if (typeof path !== 'string') path = path + '';
  30943. var start = 0;
  30944. var end = -1;
  30945. var matchedSlash = true;
  30946. var i;
  30947. for (i = path.length - 1; i >= 0; --i) {
  30948. if (path.charCodeAt(i) === 47 /*/*/) {
  30949. // If we reached a path separator that was not part of a set of path
  30950. // separators at the end of the string, stop now
  30951. if (!matchedSlash) {
  30952. start = i + 1;
  30953. break;
  30954. }
  30955. } else if (end === -1) {
  30956. // We saw the first non-path separator, mark this as the end of our
  30957. // path component
  30958. matchedSlash = false;
  30959. end = i + 1;
  30960. }
  30961. }
  30962. if (end === -1) return '';
  30963. return path.slice(start, end);
  30964. }
  30965. // Uses a mixed approach for backwards-compatibility, as ext behavior changed
  30966. // in new Node.js versions, so only basename() above is backported here
  30967. exports.basename = function (path, ext) {
  30968. var f = basename(path);
  30969. if (ext && f.substr(-1 * ext.length) === ext) {
  30970. f = f.substr(0, f.length - ext.length);
  30971. }
  30972. return f;
  30973. };
  30974. exports.extname = function (path) {
  30975. if (typeof path !== 'string') path = path + '';
  30976. var startDot = -1;
  30977. var startPart = 0;
  30978. var end = -1;
  30979. var matchedSlash = true;
  30980. // Track the state of characters (if any) we see before our first dot and
  30981. // after any path separator we find
  30982. var preDotState = 0;
  30983. for (var i = path.length - 1; i >= 0; --i) {
  30984. var code = path.charCodeAt(i);
  30985. if (code === 47 /*/*/) {
  30986. // If we reached a path separator that was not part of a set of path
  30987. // separators at the end of the string, stop now
  30988. if (!matchedSlash) {
  30989. startPart = i + 1;
  30990. break;
  30991. }
  30992. continue;
  30993. }
  30994. if (end === -1) {
  30995. // We saw the first non-path separator, mark this as the end of our
  30996. // extension
  30997. matchedSlash = false;
  30998. end = i + 1;
  30999. }
  31000. if (code === 46 /*.*/) {
  31001. // If this is our first dot, mark it as the start of our extension
  31002. if (startDot === -1)
  31003. startDot = i;
  31004. else if (preDotState !== 1)
  31005. preDotState = 1;
  31006. } else if (startDot !== -1) {
  31007. // We saw a non-dot and non-path separator before our dot, so we should
  31008. // have a good chance at having a non-empty extension
  31009. preDotState = -1;
  31010. }
  31011. }
  31012. if (startDot === -1 || end === -1 ||
  31013. // We saw a non-dot character immediately before the dot
  31014. preDotState === 0 ||
  31015. // The (right-most) trimmed path component is exactly '..'
  31016. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  31017. return '';
  31018. }
  31019. return path.slice(startDot, end);
  31020. };
  31021. function filter (xs, f) {
  31022. if (xs.filter) return xs.filter(f);
  31023. var res = [];
  31024. for (var i = 0; i < xs.length; i++) {
  31025. if (f(xs[i], i, xs)) res.push(xs[i]);
  31026. }
  31027. return res;
  31028. }
  31029. // String.prototype.substr - negative index don't work in IE8
  31030. var substr = 'ab'.substr(-1) === 'b'
  31031. ? function (str, start, len) { return str.substr(start, len) }
  31032. : function (str, start, len) {
  31033. if (start < 0) start = str.length + start;
  31034. return str.substr(start, len);
  31035. }
  31036. ;
  31037. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
  31038. /***/ }),
  31039. /* 115 */
  31040. /*!*******************************************!*\
  31041. !*** ./node_modules/safe-buffer/index.js ***!
  31042. \*******************************************/
  31043. /*! no static exports found */
  31044. /***/ (function(module, exports, __webpack_require__) {
  31045. /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
  31046. /* eslint-disable node/no-deprecated-api */
  31047. var buffer = __webpack_require__(/*! buffer */ 116)
  31048. var Buffer = buffer.Buffer
  31049. // alternative to using Object.keys for old browsers
  31050. function copyProps (src, dst) {
  31051. for (var key in src) {
  31052. dst[key] = src[key]
  31053. }
  31054. }
  31055. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  31056. module.exports = buffer
  31057. } else {
  31058. // Copy properties from require('buffer')
  31059. copyProps(buffer, exports)
  31060. exports.Buffer = SafeBuffer
  31061. }
  31062. function SafeBuffer (arg, encodingOrOffset, length) {
  31063. return Buffer(arg, encodingOrOffset, length)
  31064. }
  31065. SafeBuffer.prototype = Object.create(Buffer.prototype)
  31066. // Copy static methods from Buffer
  31067. copyProps(Buffer, SafeBuffer)
  31068. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  31069. if (typeof arg === 'number') {
  31070. throw new TypeError('Argument must not be a number')
  31071. }
  31072. return Buffer(arg, encodingOrOffset, length)
  31073. }
  31074. SafeBuffer.alloc = function (size, fill, encoding) {
  31075. if (typeof size !== 'number') {
  31076. throw new TypeError('Argument must be a number')
  31077. }
  31078. var buf = Buffer(size)
  31079. if (fill !== undefined) {
  31080. if (typeof encoding === 'string') {
  31081. buf.fill(fill, encoding)
  31082. } else {
  31083. buf.fill(fill)
  31084. }
  31085. } else {
  31086. buf.fill(0)
  31087. }
  31088. return buf
  31089. }
  31090. SafeBuffer.allocUnsafe = function (size) {
  31091. if (typeof size !== 'number') {
  31092. throw new TypeError('Argument must be a number')
  31093. }
  31094. return Buffer(size)
  31095. }
  31096. SafeBuffer.allocUnsafeSlow = function (size) {
  31097. if (typeof size !== 'number') {
  31098. throw new TypeError('Argument must be a number')
  31099. }
  31100. return buffer.SlowBuffer(size)
  31101. }
  31102. /***/ }),
  31103. /* 116 */
  31104. /*!**************************************!*\
  31105. !*** ./node_modules/buffer/index.js ***!
  31106. \**************************************/
  31107. /*! no static exports found */
  31108. /***/ (function(module, exports, __webpack_require__) {
  31109. "use strict";
  31110. /* WEBPACK VAR INJECTION */(function(global) {/*!
  31111. * The buffer module from node.js, for the browser.
  31112. *
  31113. * @author Feross Aboukhadijeh <http://feross.org>
  31114. * @license MIT
  31115. */
  31116. /* eslint-disable no-proto */
  31117. var base64 = __webpack_require__(/*! base64-js */ 117)
  31118. var ieee754 = __webpack_require__(/*! ieee754 */ 118)
  31119. var isArray = __webpack_require__(/*! isarray */ 119)
  31120. exports.Buffer = Buffer
  31121. exports.SlowBuffer = SlowBuffer
  31122. exports.INSPECT_MAX_BYTES = 50
  31123. /**
  31124. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  31125. * === true Use Uint8Array implementation (fastest)
  31126. * === false Use Object implementation (most compatible, even IE6)
  31127. *
  31128. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  31129. * Opera 11.6+, iOS 4.2+.
  31130. *
  31131. * Due to various browser bugs, sometimes the Object implementation will be used even
  31132. * when the browser supports typed arrays.
  31133. *
  31134. * Note:
  31135. *
  31136. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  31137. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  31138. *
  31139. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  31140. *
  31141. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  31142. * incorrect length in some situations.
  31143. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  31144. * get the Object implementation, which is slower but behaves correctly.
  31145. */
  31146. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  31147. ? global.TYPED_ARRAY_SUPPORT
  31148. : typedArraySupport()
  31149. /*
  31150. * Export kMaxLength after typed array support is determined.
  31151. */
  31152. exports.kMaxLength = kMaxLength()
  31153. function typedArraySupport () {
  31154. try {
  31155. var arr = new Uint8Array(1)
  31156. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  31157. return arr.foo() === 42 && // typed array instances can be augmented
  31158. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  31159. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  31160. } catch (e) {
  31161. return false
  31162. }
  31163. }
  31164. function kMaxLength () {
  31165. return Buffer.TYPED_ARRAY_SUPPORT
  31166. ? 0x7fffffff
  31167. : 0x3fffffff
  31168. }
  31169. function createBuffer (that, length) {
  31170. if (kMaxLength() < length) {
  31171. throw new RangeError('Invalid typed array length')
  31172. }
  31173. if (Buffer.TYPED_ARRAY_SUPPORT) {
  31174. // Return an augmented `Uint8Array` instance, for best performance
  31175. that = new Uint8Array(length)
  31176. that.__proto__ = Buffer.prototype
  31177. } else {
  31178. // Fallback: Return an object instance of the Buffer class
  31179. if (that === null) {
  31180. that = new Buffer(length)
  31181. }
  31182. that.length = length
  31183. }
  31184. return that
  31185. }
  31186. /**
  31187. * The Buffer constructor returns instances of `Uint8Array` that have their
  31188. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  31189. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  31190. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  31191. * returns a single octet.
  31192. *
  31193. * The `Uint8Array` prototype remains unmodified.
  31194. */
  31195. function Buffer (arg, encodingOrOffset, length) {
  31196. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  31197. return new Buffer(arg, encodingOrOffset, length)
  31198. }
  31199. // Common case.
  31200. if (typeof arg === 'number') {
  31201. if (typeof encodingOrOffset === 'string') {
  31202. throw new Error(
  31203. 'If encoding is specified then the first argument must be a string'
  31204. )
  31205. }
  31206. return allocUnsafe(this, arg)
  31207. }
  31208. return from(this, arg, encodingOrOffset, length)
  31209. }
  31210. Buffer.poolSize = 8192 // not used by this implementation
  31211. // TODO: Legacy, not needed anymore. Remove in next major version.
  31212. Buffer._augment = function (arr) {
  31213. arr.__proto__ = Buffer.prototype
  31214. return arr
  31215. }
  31216. function from (that, value, encodingOrOffset, length) {
  31217. if (typeof value === 'number') {
  31218. throw new TypeError('"value" argument must not be a number')
  31219. }
  31220. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  31221. return fromArrayBuffer(that, value, encodingOrOffset, length)
  31222. }
  31223. if (typeof value === 'string') {
  31224. return fromString(that, value, encodingOrOffset)
  31225. }
  31226. return fromObject(that, value)
  31227. }
  31228. /**
  31229. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  31230. * if value is a number.
  31231. * Buffer.from(str[, encoding])
  31232. * Buffer.from(array)
  31233. * Buffer.from(buffer)
  31234. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  31235. **/
  31236. Buffer.from = function (value, encodingOrOffset, length) {
  31237. return from(null, value, encodingOrOffset, length)
  31238. }
  31239. if (Buffer.TYPED_ARRAY_SUPPORT) {
  31240. Buffer.prototype.__proto__ = Uint8Array.prototype
  31241. Buffer.__proto__ = Uint8Array
  31242. if (typeof Symbol !== 'undefined' && Symbol.species &&
  31243. Buffer[Symbol.species] === Buffer) {
  31244. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  31245. Object.defineProperty(Buffer, Symbol.species, {
  31246. value: null,
  31247. configurable: true
  31248. })
  31249. }
  31250. }
  31251. function assertSize (size) {
  31252. if (typeof size !== 'number') {
  31253. throw new TypeError('"size" argument must be a number')
  31254. } else if (size < 0) {
  31255. throw new RangeError('"size" argument must not be negative')
  31256. }
  31257. }
  31258. function alloc (that, size, fill, encoding) {
  31259. assertSize(size)
  31260. if (size <= 0) {
  31261. return createBuffer(that, size)
  31262. }
  31263. if (fill !== undefined) {
  31264. // Only pay attention to encoding if it's a string. This
  31265. // prevents accidentally sending in a number that would
  31266. // be interpretted as a start offset.
  31267. return typeof encoding === 'string'
  31268. ? createBuffer(that, size).fill(fill, encoding)
  31269. : createBuffer(that, size).fill(fill)
  31270. }
  31271. return createBuffer(that, size)
  31272. }
  31273. /**
  31274. * Creates a new filled Buffer instance.
  31275. * alloc(size[, fill[, encoding]])
  31276. **/
  31277. Buffer.alloc = function (size, fill, encoding) {
  31278. return alloc(null, size, fill, encoding)
  31279. }
  31280. function allocUnsafe (that, size) {
  31281. assertSize(size)
  31282. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  31283. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  31284. for (var i = 0; i < size; ++i) {
  31285. that[i] = 0
  31286. }
  31287. }
  31288. return that
  31289. }
  31290. /**
  31291. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  31292. * */
  31293. Buffer.allocUnsafe = function (size) {
  31294. return allocUnsafe(null, size)
  31295. }
  31296. /**
  31297. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  31298. */
  31299. Buffer.allocUnsafeSlow = function (size) {
  31300. return allocUnsafe(null, size)
  31301. }
  31302. function fromString (that, string, encoding) {
  31303. if (typeof encoding !== 'string' || encoding === '') {
  31304. encoding = 'utf8'
  31305. }
  31306. if (!Buffer.isEncoding(encoding)) {
  31307. throw new TypeError('"encoding" must be a valid string encoding')
  31308. }
  31309. var length = byteLength(string, encoding) | 0
  31310. that = createBuffer(that, length)
  31311. var actual = that.write(string, encoding)
  31312. if (actual !== length) {
  31313. // Writing a hex string, for example, that contains invalid characters will
  31314. // cause everything after the first invalid character to be ignored. (e.g.
  31315. // 'abxxcd' will be treated as 'ab')
  31316. that = that.slice(0, actual)
  31317. }
  31318. return that
  31319. }
  31320. function fromArrayLike (that, array) {
  31321. var length = array.length < 0 ? 0 : checked(array.length) | 0
  31322. that = createBuffer(that, length)
  31323. for (var i = 0; i < length; i += 1) {
  31324. that[i] = array[i] & 255
  31325. }
  31326. return that
  31327. }
  31328. function fromArrayBuffer (that, array, byteOffset, length) {
  31329. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  31330. if (byteOffset < 0 || array.byteLength < byteOffset) {
  31331. throw new RangeError('\'offset\' is out of bounds')
  31332. }
  31333. if (array.byteLength < byteOffset + (length || 0)) {
  31334. throw new RangeError('\'length\' is out of bounds')
  31335. }
  31336. if (byteOffset === undefined && length === undefined) {
  31337. array = new Uint8Array(array)
  31338. } else if (length === undefined) {
  31339. array = new Uint8Array(array, byteOffset)
  31340. } else {
  31341. array = new Uint8Array(array, byteOffset, length)
  31342. }
  31343. if (Buffer.TYPED_ARRAY_SUPPORT) {
  31344. // Return an augmented `Uint8Array` instance, for best performance
  31345. that = array
  31346. that.__proto__ = Buffer.prototype
  31347. } else {
  31348. // Fallback: Return an object instance of the Buffer class
  31349. that = fromArrayLike(that, array)
  31350. }
  31351. return that
  31352. }
  31353. function fromObject (that, obj) {
  31354. if (Buffer.isBuffer(obj)) {
  31355. var len = checked(obj.length) | 0
  31356. that = createBuffer(that, len)
  31357. if (that.length === 0) {
  31358. return that
  31359. }
  31360. obj.copy(that, 0, 0, len)
  31361. return that
  31362. }
  31363. if (obj) {
  31364. if ((typeof ArrayBuffer !== 'undefined' &&
  31365. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  31366. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  31367. return createBuffer(that, 0)
  31368. }
  31369. return fromArrayLike(that, obj)
  31370. }
  31371. if (obj.type === 'Buffer' && isArray(obj.data)) {
  31372. return fromArrayLike(that, obj.data)
  31373. }
  31374. }
  31375. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  31376. }
  31377. function checked (length) {
  31378. // Note: cannot use `length < kMaxLength()` here because that fails when
  31379. // length is NaN (which is otherwise coerced to zero.)
  31380. if (length >= kMaxLength()) {
  31381. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  31382. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  31383. }
  31384. return length | 0
  31385. }
  31386. function SlowBuffer (length) {
  31387. if (+length != length) { // eslint-disable-line eqeqeq
  31388. length = 0
  31389. }
  31390. return Buffer.alloc(+length)
  31391. }
  31392. Buffer.isBuffer = function isBuffer (b) {
  31393. return !!(b != null && b._isBuffer)
  31394. }
  31395. Buffer.compare = function compare (a, b) {
  31396. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  31397. throw new TypeError('Arguments must be Buffers')
  31398. }
  31399. if (a === b) return 0
  31400. var x = a.length
  31401. var y = b.length
  31402. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  31403. if (a[i] !== b[i]) {
  31404. x = a[i]
  31405. y = b[i]
  31406. break
  31407. }
  31408. }
  31409. if (x < y) return -1
  31410. if (y < x) return 1
  31411. return 0
  31412. }
  31413. Buffer.isEncoding = function isEncoding (encoding) {
  31414. switch (String(encoding).toLowerCase()) {
  31415. case 'hex':
  31416. case 'utf8':
  31417. case 'utf-8':
  31418. case 'ascii':
  31419. case 'latin1':
  31420. case 'binary':
  31421. case 'base64':
  31422. case 'ucs2':
  31423. case 'ucs-2':
  31424. case 'utf16le':
  31425. case 'utf-16le':
  31426. return true
  31427. default:
  31428. return false
  31429. }
  31430. }
  31431. Buffer.concat = function concat (list, length) {
  31432. if (!isArray(list)) {
  31433. throw new TypeError('"list" argument must be an Array of Buffers')
  31434. }
  31435. if (list.length === 0) {
  31436. return Buffer.alloc(0)
  31437. }
  31438. var i
  31439. if (length === undefined) {
  31440. length = 0
  31441. for (i = 0; i < list.length; ++i) {
  31442. length += list[i].length
  31443. }
  31444. }
  31445. var buffer = Buffer.allocUnsafe(length)
  31446. var pos = 0
  31447. for (i = 0; i < list.length; ++i) {
  31448. var buf = list[i]
  31449. if (!Buffer.isBuffer(buf)) {
  31450. throw new TypeError('"list" argument must be an Array of Buffers')
  31451. }
  31452. buf.copy(buffer, pos)
  31453. pos += buf.length
  31454. }
  31455. return buffer
  31456. }
  31457. function byteLength (string, encoding) {
  31458. if (Buffer.isBuffer(string)) {
  31459. return string.length
  31460. }
  31461. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  31462. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  31463. return string.byteLength
  31464. }
  31465. if (typeof string !== 'string') {
  31466. string = '' + string
  31467. }
  31468. var len = string.length
  31469. if (len === 0) return 0
  31470. // Use a for loop to avoid recursion
  31471. var loweredCase = false
  31472. for (;;) {
  31473. switch (encoding) {
  31474. case 'ascii':
  31475. case 'latin1':
  31476. case 'binary':
  31477. return len
  31478. case 'utf8':
  31479. case 'utf-8':
  31480. case undefined:
  31481. return utf8ToBytes(string).length
  31482. case 'ucs2':
  31483. case 'ucs-2':
  31484. case 'utf16le':
  31485. case 'utf-16le':
  31486. return len * 2
  31487. case 'hex':
  31488. return len >>> 1
  31489. case 'base64':
  31490. return base64ToBytes(string).length
  31491. default:
  31492. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  31493. encoding = ('' + encoding).toLowerCase()
  31494. loweredCase = true
  31495. }
  31496. }
  31497. }
  31498. Buffer.byteLength = byteLength
  31499. function slowToString (encoding, start, end) {
  31500. var loweredCase = false
  31501. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  31502. // property of a typed array.
  31503. // This behaves neither like String nor Uint8Array in that we set start/end
  31504. // to their upper/lower bounds if the value passed is out of range.
  31505. // undefined is handled specially as per ECMA-262 6th Edition,
  31506. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  31507. if (start === undefined || start < 0) {
  31508. start = 0
  31509. }
  31510. // Return early if start > this.length. Done here to prevent potential uint32
  31511. // coercion fail below.
  31512. if (start > this.length) {
  31513. return ''
  31514. }
  31515. if (end === undefined || end > this.length) {
  31516. end = this.length
  31517. }
  31518. if (end <= 0) {
  31519. return ''
  31520. }
  31521. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  31522. end >>>= 0
  31523. start >>>= 0
  31524. if (end <= start) {
  31525. return ''
  31526. }
  31527. if (!encoding) encoding = 'utf8'
  31528. while (true) {
  31529. switch (encoding) {
  31530. case 'hex':
  31531. return hexSlice(this, start, end)
  31532. case 'utf8':
  31533. case 'utf-8':
  31534. return utf8Slice(this, start, end)
  31535. case 'ascii':
  31536. return asciiSlice(this, start, end)
  31537. case 'latin1':
  31538. case 'binary':
  31539. return latin1Slice(this, start, end)
  31540. case 'base64':
  31541. return base64Slice(this, start, end)
  31542. case 'ucs2':
  31543. case 'ucs-2':
  31544. case 'utf16le':
  31545. case 'utf-16le':
  31546. return utf16leSlice(this, start, end)
  31547. default:
  31548. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  31549. encoding = (encoding + '').toLowerCase()
  31550. loweredCase = true
  31551. }
  31552. }
  31553. }
  31554. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  31555. // Buffer instances.
  31556. Buffer.prototype._isBuffer = true
  31557. function swap (b, n, m) {
  31558. var i = b[n]
  31559. b[n] = b[m]
  31560. b[m] = i
  31561. }
  31562. Buffer.prototype.swap16 = function swap16 () {
  31563. var len = this.length
  31564. if (len % 2 !== 0) {
  31565. throw new RangeError('Buffer size must be a multiple of 16-bits')
  31566. }
  31567. for (var i = 0; i < len; i += 2) {
  31568. swap(this, i, i + 1)
  31569. }
  31570. return this
  31571. }
  31572. Buffer.prototype.swap32 = function swap32 () {
  31573. var len = this.length
  31574. if (len % 4 !== 0) {
  31575. throw new RangeError('Buffer size must be a multiple of 32-bits')
  31576. }
  31577. for (var i = 0; i < len; i += 4) {
  31578. swap(this, i, i + 3)
  31579. swap(this, i + 1, i + 2)
  31580. }
  31581. return this
  31582. }
  31583. Buffer.prototype.swap64 = function swap64 () {
  31584. var len = this.length
  31585. if (len % 8 !== 0) {
  31586. throw new RangeError('Buffer size must be a multiple of 64-bits')
  31587. }
  31588. for (var i = 0; i < len; i += 8) {
  31589. swap(this, i, i + 7)
  31590. swap(this, i + 1, i + 6)
  31591. swap(this, i + 2, i + 5)
  31592. swap(this, i + 3, i + 4)
  31593. }
  31594. return this
  31595. }
  31596. Buffer.prototype.toString = function toString () {
  31597. var length = this.length | 0
  31598. if (length === 0) return ''
  31599. if (arguments.length === 0) return utf8Slice(this, 0, length)
  31600. return slowToString.apply(this, arguments)
  31601. }
  31602. Buffer.prototype.equals = function equals (b) {
  31603. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  31604. if (this === b) return true
  31605. return Buffer.compare(this, b) === 0
  31606. }
  31607. Buffer.prototype.inspect = function inspect () {
  31608. var str = ''
  31609. var max = exports.INSPECT_MAX_BYTES
  31610. if (this.length > 0) {
  31611. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  31612. if (this.length > max) str += ' ... '
  31613. }
  31614. return '<Buffer ' + str + '>'
  31615. }
  31616. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  31617. if (!Buffer.isBuffer(target)) {
  31618. throw new TypeError('Argument must be a Buffer')
  31619. }
  31620. if (start === undefined) {
  31621. start = 0
  31622. }
  31623. if (end === undefined) {
  31624. end = target ? target.length : 0
  31625. }
  31626. if (thisStart === undefined) {
  31627. thisStart = 0
  31628. }
  31629. if (thisEnd === undefined) {
  31630. thisEnd = this.length
  31631. }
  31632. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  31633. throw new RangeError('out of range index')
  31634. }
  31635. if (thisStart >= thisEnd && start >= end) {
  31636. return 0
  31637. }
  31638. if (thisStart >= thisEnd) {
  31639. return -1
  31640. }
  31641. if (start >= end) {
  31642. return 1
  31643. }
  31644. start >>>= 0
  31645. end >>>= 0
  31646. thisStart >>>= 0
  31647. thisEnd >>>= 0
  31648. if (this === target) return 0
  31649. var x = thisEnd - thisStart
  31650. var y = end - start
  31651. var len = Math.min(x, y)
  31652. var thisCopy = this.slice(thisStart, thisEnd)
  31653. var targetCopy = target.slice(start, end)
  31654. for (var i = 0; i < len; ++i) {
  31655. if (thisCopy[i] !== targetCopy[i]) {
  31656. x = thisCopy[i]
  31657. y = targetCopy[i]
  31658. break
  31659. }
  31660. }
  31661. if (x < y) return -1
  31662. if (y < x) return 1
  31663. return 0
  31664. }
  31665. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  31666. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  31667. //
  31668. // Arguments:
  31669. // - buffer - a Buffer to search
  31670. // - val - a string, Buffer, or number
  31671. // - byteOffset - an index into `buffer`; will be clamped to an int32
  31672. // - encoding - an optional encoding, relevant is val is a string
  31673. // - dir - true for indexOf, false for lastIndexOf
  31674. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  31675. // Empty buffer means no match
  31676. if (buffer.length === 0) return -1
  31677. // Normalize byteOffset
  31678. if (typeof byteOffset === 'string') {
  31679. encoding = byteOffset
  31680. byteOffset = 0
  31681. } else if (byteOffset > 0x7fffffff) {
  31682. byteOffset = 0x7fffffff
  31683. } else if (byteOffset < -0x80000000) {
  31684. byteOffset = -0x80000000
  31685. }
  31686. byteOffset = +byteOffset // Coerce to Number.
  31687. if (isNaN(byteOffset)) {
  31688. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  31689. byteOffset = dir ? 0 : (buffer.length - 1)
  31690. }
  31691. // Normalize byteOffset: negative offsets start from the end of the buffer
  31692. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  31693. if (byteOffset >= buffer.length) {
  31694. if (dir) return -1
  31695. else byteOffset = buffer.length - 1
  31696. } else if (byteOffset < 0) {
  31697. if (dir) byteOffset = 0
  31698. else return -1
  31699. }
  31700. // Normalize val
  31701. if (typeof val === 'string') {
  31702. val = Buffer.from(val, encoding)
  31703. }
  31704. // Finally, search either indexOf (if dir is true) or lastIndexOf
  31705. if (Buffer.isBuffer(val)) {
  31706. // Special case: looking for empty string/buffer always fails
  31707. if (val.length === 0) {
  31708. return -1
  31709. }
  31710. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  31711. } else if (typeof val === 'number') {
  31712. val = val & 0xFF // Search for a byte value [0-255]
  31713. if (Buffer.TYPED_ARRAY_SUPPORT &&
  31714. typeof Uint8Array.prototype.indexOf === 'function') {
  31715. if (dir) {
  31716. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  31717. } else {
  31718. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  31719. }
  31720. }
  31721. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  31722. }
  31723. throw new TypeError('val must be string, number or Buffer')
  31724. }
  31725. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  31726. var indexSize = 1
  31727. var arrLength = arr.length
  31728. var valLength = val.length
  31729. if (encoding !== undefined) {
  31730. encoding = String(encoding).toLowerCase()
  31731. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  31732. encoding === 'utf16le' || encoding === 'utf-16le') {
  31733. if (arr.length < 2 || val.length < 2) {
  31734. return -1
  31735. }
  31736. indexSize = 2
  31737. arrLength /= 2
  31738. valLength /= 2
  31739. byteOffset /= 2
  31740. }
  31741. }
  31742. function read (buf, i) {
  31743. if (indexSize === 1) {
  31744. return buf[i]
  31745. } else {
  31746. return buf.readUInt16BE(i * indexSize)
  31747. }
  31748. }
  31749. var i
  31750. if (dir) {
  31751. var foundIndex = -1
  31752. for (i = byteOffset; i < arrLength; i++) {
  31753. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  31754. if (foundIndex === -1) foundIndex = i
  31755. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  31756. } else {
  31757. if (foundIndex !== -1) i -= i - foundIndex
  31758. foundIndex = -1
  31759. }
  31760. }
  31761. } else {
  31762. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  31763. for (i = byteOffset; i >= 0; i--) {
  31764. var found = true
  31765. for (var j = 0; j < valLength; j++) {
  31766. if (read(arr, i + j) !== read(val, j)) {
  31767. found = false
  31768. break
  31769. }
  31770. }
  31771. if (found) return i
  31772. }
  31773. }
  31774. return -1
  31775. }
  31776. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  31777. return this.indexOf(val, byteOffset, encoding) !== -1
  31778. }
  31779. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  31780. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  31781. }
  31782. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  31783. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  31784. }
  31785. function hexWrite (buf, string, offset, length) {
  31786. offset = Number(offset) || 0
  31787. var remaining = buf.length - offset
  31788. if (!length) {
  31789. length = remaining
  31790. } else {
  31791. length = Number(length)
  31792. if (length > remaining) {
  31793. length = remaining
  31794. }
  31795. }
  31796. // must be an even number of digits
  31797. var strLen = string.length
  31798. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  31799. if (length > strLen / 2) {
  31800. length = strLen / 2
  31801. }
  31802. for (var i = 0; i < length; ++i) {
  31803. var parsed = parseInt(string.substr(i * 2, 2), 16)
  31804. if (isNaN(parsed)) return i
  31805. buf[offset + i] = parsed
  31806. }
  31807. return i
  31808. }
  31809. function utf8Write (buf, string, offset, length) {
  31810. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  31811. }
  31812. function asciiWrite (buf, string, offset, length) {
  31813. return blitBuffer(asciiToBytes(string), buf, offset, length)
  31814. }
  31815. function latin1Write (buf, string, offset, length) {
  31816. return asciiWrite(buf, string, offset, length)
  31817. }
  31818. function base64Write (buf, string, offset, length) {
  31819. return blitBuffer(base64ToBytes(string), buf, offset, length)
  31820. }
  31821. function ucs2Write (buf, string, offset, length) {
  31822. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  31823. }
  31824. Buffer.prototype.write = function write (string, offset, length, encoding) {
  31825. // Buffer#write(string)
  31826. if (offset === undefined) {
  31827. encoding = 'utf8'
  31828. length = this.length
  31829. offset = 0
  31830. // Buffer#write(string, encoding)
  31831. } else if (length === undefined && typeof offset === 'string') {
  31832. encoding = offset
  31833. length = this.length
  31834. offset = 0
  31835. // Buffer#write(string, offset[, length][, encoding])
  31836. } else if (isFinite(offset)) {
  31837. offset = offset | 0
  31838. if (isFinite(length)) {
  31839. length = length | 0
  31840. if (encoding === undefined) encoding = 'utf8'
  31841. } else {
  31842. encoding = length
  31843. length = undefined
  31844. }
  31845. // legacy write(string, encoding, offset, length) - remove in v0.13
  31846. } else {
  31847. throw new Error(
  31848. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  31849. )
  31850. }
  31851. var remaining = this.length - offset
  31852. if (length === undefined || length > remaining) length = remaining
  31853. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  31854. throw new RangeError('Attempt to write outside buffer bounds')
  31855. }
  31856. if (!encoding) encoding = 'utf8'
  31857. var loweredCase = false
  31858. for (;;) {
  31859. switch (encoding) {
  31860. case 'hex':
  31861. return hexWrite(this, string, offset, length)
  31862. case 'utf8':
  31863. case 'utf-8':
  31864. return utf8Write(this, string, offset, length)
  31865. case 'ascii':
  31866. return asciiWrite(this, string, offset, length)
  31867. case 'latin1':
  31868. case 'binary':
  31869. return latin1Write(this, string, offset, length)
  31870. case 'base64':
  31871. // Warning: maxLength not taken into account in base64Write
  31872. return base64Write(this, string, offset, length)
  31873. case 'ucs2':
  31874. case 'ucs-2':
  31875. case 'utf16le':
  31876. case 'utf-16le':
  31877. return ucs2Write(this, string, offset, length)
  31878. default:
  31879. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  31880. encoding = ('' + encoding).toLowerCase()
  31881. loweredCase = true
  31882. }
  31883. }
  31884. }
  31885. Buffer.prototype.toJSON = function toJSON () {
  31886. return {
  31887. type: 'Buffer',
  31888. data: Array.prototype.slice.call(this._arr || this, 0)
  31889. }
  31890. }
  31891. function base64Slice (buf, start, end) {
  31892. if (start === 0 && end === buf.length) {
  31893. return base64.fromByteArray(buf)
  31894. } else {
  31895. return base64.fromByteArray(buf.slice(start, end))
  31896. }
  31897. }
  31898. function utf8Slice (buf, start, end) {
  31899. end = Math.min(buf.length, end)
  31900. var res = []
  31901. var i = start
  31902. while (i < end) {
  31903. var firstByte = buf[i]
  31904. var codePoint = null
  31905. var bytesPerSequence = (firstByte > 0xEF) ? 4
  31906. : (firstByte > 0xDF) ? 3
  31907. : (firstByte > 0xBF) ? 2
  31908. : 1
  31909. if (i + bytesPerSequence <= end) {
  31910. var secondByte, thirdByte, fourthByte, tempCodePoint
  31911. switch (bytesPerSequence) {
  31912. case 1:
  31913. if (firstByte < 0x80) {
  31914. codePoint = firstByte
  31915. }
  31916. break
  31917. case 2:
  31918. secondByte = buf[i + 1]
  31919. if ((secondByte & 0xC0) === 0x80) {
  31920. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  31921. if (tempCodePoint > 0x7F) {
  31922. codePoint = tempCodePoint
  31923. }
  31924. }
  31925. break
  31926. case 3:
  31927. secondByte = buf[i + 1]
  31928. thirdByte = buf[i + 2]
  31929. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  31930. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  31931. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  31932. codePoint = tempCodePoint
  31933. }
  31934. }
  31935. break
  31936. case 4:
  31937. secondByte = buf[i + 1]
  31938. thirdByte = buf[i + 2]
  31939. fourthByte = buf[i + 3]
  31940. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  31941. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  31942. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  31943. codePoint = tempCodePoint
  31944. }
  31945. }
  31946. }
  31947. }
  31948. if (codePoint === null) {
  31949. // we did not generate a valid codePoint so insert a
  31950. // replacement char (U+FFFD) and advance only 1 byte
  31951. codePoint = 0xFFFD
  31952. bytesPerSequence = 1
  31953. } else if (codePoint > 0xFFFF) {
  31954. // encode to utf16 (surrogate pair dance)
  31955. codePoint -= 0x10000
  31956. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  31957. codePoint = 0xDC00 | codePoint & 0x3FF
  31958. }
  31959. res.push(codePoint)
  31960. i += bytesPerSequence
  31961. }
  31962. return decodeCodePointsArray(res)
  31963. }
  31964. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  31965. // the lowest limit is Chrome, with 0x10000 args.
  31966. // We go 1 magnitude less, for safety
  31967. var MAX_ARGUMENTS_LENGTH = 0x1000
  31968. function decodeCodePointsArray (codePoints) {
  31969. var len = codePoints.length
  31970. if (len <= MAX_ARGUMENTS_LENGTH) {
  31971. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  31972. }
  31973. // Decode in chunks to avoid "call stack size exceeded".
  31974. var res = ''
  31975. var i = 0
  31976. while (i < len) {
  31977. res += String.fromCharCode.apply(
  31978. String,
  31979. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  31980. )
  31981. }
  31982. return res
  31983. }
  31984. function asciiSlice (buf, start, end) {
  31985. var ret = ''
  31986. end = Math.min(buf.length, end)
  31987. for (var i = start; i < end; ++i) {
  31988. ret += String.fromCharCode(buf[i] & 0x7F)
  31989. }
  31990. return ret
  31991. }
  31992. function latin1Slice (buf, start, end) {
  31993. var ret = ''
  31994. end = Math.min(buf.length, end)
  31995. for (var i = start; i < end; ++i) {
  31996. ret += String.fromCharCode(buf[i])
  31997. }
  31998. return ret
  31999. }
  32000. function hexSlice (buf, start, end) {
  32001. var len = buf.length
  32002. if (!start || start < 0) start = 0
  32003. if (!end || end < 0 || end > len) end = len
  32004. var out = ''
  32005. for (var i = start; i < end; ++i) {
  32006. out += toHex(buf[i])
  32007. }
  32008. return out
  32009. }
  32010. function utf16leSlice (buf, start, end) {
  32011. var bytes = buf.slice(start, end)
  32012. var res = ''
  32013. for (var i = 0; i < bytes.length; i += 2) {
  32014. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  32015. }
  32016. return res
  32017. }
  32018. Buffer.prototype.slice = function slice (start, end) {
  32019. var len = this.length
  32020. start = ~~start
  32021. end = end === undefined ? len : ~~end
  32022. if (start < 0) {
  32023. start += len
  32024. if (start < 0) start = 0
  32025. } else if (start > len) {
  32026. start = len
  32027. }
  32028. if (end < 0) {
  32029. end += len
  32030. if (end < 0) end = 0
  32031. } else if (end > len) {
  32032. end = len
  32033. }
  32034. if (end < start) end = start
  32035. var newBuf
  32036. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32037. newBuf = this.subarray(start, end)
  32038. newBuf.__proto__ = Buffer.prototype
  32039. } else {
  32040. var sliceLen = end - start
  32041. newBuf = new Buffer(sliceLen, undefined)
  32042. for (var i = 0; i < sliceLen; ++i) {
  32043. newBuf[i] = this[i + start]
  32044. }
  32045. }
  32046. return newBuf
  32047. }
  32048. /*
  32049. * Need to make sure that buffer isn't trying to write out of bounds.
  32050. */
  32051. function checkOffset (offset, ext, length) {
  32052. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  32053. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  32054. }
  32055. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  32056. offset = offset | 0
  32057. byteLength = byteLength | 0
  32058. if (!noAssert) checkOffset(offset, byteLength, this.length)
  32059. var val = this[offset]
  32060. var mul = 1
  32061. var i = 0
  32062. while (++i < byteLength && (mul *= 0x100)) {
  32063. val += this[offset + i] * mul
  32064. }
  32065. return val
  32066. }
  32067. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  32068. offset = offset | 0
  32069. byteLength = byteLength | 0
  32070. if (!noAssert) {
  32071. checkOffset(offset, byteLength, this.length)
  32072. }
  32073. var val = this[offset + --byteLength]
  32074. var mul = 1
  32075. while (byteLength > 0 && (mul *= 0x100)) {
  32076. val += this[offset + --byteLength] * mul
  32077. }
  32078. return val
  32079. }
  32080. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  32081. if (!noAssert) checkOffset(offset, 1, this.length)
  32082. return this[offset]
  32083. }
  32084. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  32085. if (!noAssert) checkOffset(offset, 2, this.length)
  32086. return this[offset] | (this[offset + 1] << 8)
  32087. }
  32088. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  32089. if (!noAssert) checkOffset(offset, 2, this.length)
  32090. return (this[offset] << 8) | this[offset + 1]
  32091. }
  32092. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  32093. if (!noAssert) checkOffset(offset, 4, this.length)
  32094. return ((this[offset]) |
  32095. (this[offset + 1] << 8) |
  32096. (this[offset + 2] << 16)) +
  32097. (this[offset + 3] * 0x1000000)
  32098. }
  32099. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  32100. if (!noAssert) checkOffset(offset, 4, this.length)
  32101. return (this[offset] * 0x1000000) +
  32102. ((this[offset + 1] << 16) |
  32103. (this[offset + 2] << 8) |
  32104. this[offset + 3])
  32105. }
  32106. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  32107. offset = offset | 0
  32108. byteLength = byteLength | 0
  32109. if (!noAssert) checkOffset(offset, byteLength, this.length)
  32110. var val = this[offset]
  32111. var mul = 1
  32112. var i = 0
  32113. while (++i < byteLength && (mul *= 0x100)) {
  32114. val += this[offset + i] * mul
  32115. }
  32116. mul *= 0x80
  32117. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  32118. return val
  32119. }
  32120. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  32121. offset = offset | 0
  32122. byteLength = byteLength | 0
  32123. if (!noAssert) checkOffset(offset, byteLength, this.length)
  32124. var i = byteLength
  32125. var mul = 1
  32126. var val = this[offset + --i]
  32127. while (i > 0 && (mul *= 0x100)) {
  32128. val += this[offset + --i] * mul
  32129. }
  32130. mul *= 0x80
  32131. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  32132. return val
  32133. }
  32134. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  32135. if (!noAssert) checkOffset(offset, 1, this.length)
  32136. if (!(this[offset] & 0x80)) return (this[offset])
  32137. return ((0xff - this[offset] + 1) * -1)
  32138. }
  32139. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  32140. if (!noAssert) checkOffset(offset, 2, this.length)
  32141. var val = this[offset] | (this[offset + 1] << 8)
  32142. return (val & 0x8000) ? val | 0xFFFF0000 : val
  32143. }
  32144. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  32145. if (!noAssert) checkOffset(offset, 2, this.length)
  32146. var val = this[offset + 1] | (this[offset] << 8)
  32147. return (val & 0x8000) ? val | 0xFFFF0000 : val
  32148. }
  32149. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  32150. if (!noAssert) checkOffset(offset, 4, this.length)
  32151. return (this[offset]) |
  32152. (this[offset + 1] << 8) |
  32153. (this[offset + 2] << 16) |
  32154. (this[offset + 3] << 24)
  32155. }
  32156. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  32157. if (!noAssert) checkOffset(offset, 4, this.length)
  32158. return (this[offset] << 24) |
  32159. (this[offset + 1] << 16) |
  32160. (this[offset + 2] << 8) |
  32161. (this[offset + 3])
  32162. }
  32163. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  32164. if (!noAssert) checkOffset(offset, 4, this.length)
  32165. return ieee754.read(this, offset, true, 23, 4)
  32166. }
  32167. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  32168. if (!noAssert) checkOffset(offset, 4, this.length)
  32169. return ieee754.read(this, offset, false, 23, 4)
  32170. }
  32171. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  32172. if (!noAssert) checkOffset(offset, 8, this.length)
  32173. return ieee754.read(this, offset, true, 52, 8)
  32174. }
  32175. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  32176. if (!noAssert) checkOffset(offset, 8, this.length)
  32177. return ieee754.read(this, offset, false, 52, 8)
  32178. }
  32179. function checkInt (buf, value, offset, ext, max, min) {
  32180. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  32181. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  32182. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  32183. }
  32184. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  32185. value = +value
  32186. offset = offset | 0
  32187. byteLength = byteLength | 0
  32188. if (!noAssert) {
  32189. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  32190. checkInt(this, value, offset, byteLength, maxBytes, 0)
  32191. }
  32192. var mul = 1
  32193. var i = 0
  32194. this[offset] = value & 0xFF
  32195. while (++i < byteLength && (mul *= 0x100)) {
  32196. this[offset + i] = (value / mul) & 0xFF
  32197. }
  32198. return offset + byteLength
  32199. }
  32200. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  32201. value = +value
  32202. offset = offset | 0
  32203. byteLength = byteLength | 0
  32204. if (!noAssert) {
  32205. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  32206. checkInt(this, value, offset, byteLength, maxBytes, 0)
  32207. }
  32208. var i = byteLength - 1
  32209. var mul = 1
  32210. this[offset + i] = value & 0xFF
  32211. while (--i >= 0 && (mul *= 0x100)) {
  32212. this[offset + i] = (value / mul) & 0xFF
  32213. }
  32214. return offset + byteLength
  32215. }
  32216. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  32217. value = +value
  32218. offset = offset | 0
  32219. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  32220. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  32221. this[offset] = (value & 0xff)
  32222. return offset + 1
  32223. }
  32224. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  32225. if (value < 0) value = 0xffff + value + 1
  32226. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  32227. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  32228. (littleEndian ? i : 1 - i) * 8
  32229. }
  32230. }
  32231. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  32232. value = +value
  32233. offset = offset | 0
  32234. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  32235. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32236. this[offset] = (value & 0xff)
  32237. this[offset + 1] = (value >>> 8)
  32238. } else {
  32239. objectWriteUInt16(this, value, offset, true)
  32240. }
  32241. return offset + 2
  32242. }
  32243. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  32244. value = +value
  32245. offset = offset | 0
  32246. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  32247. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32248. this[offset] = (value >>> 8)
  32249. this[offset + 1] = (value & 0xff)
  32250. } else {
  32251. objectWriteUInt16(this, value, offset, false)
  32252. }
  32253. return offset + 2
  32254. }
  32255. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  32256. if (value < 0) value = 0xffffffff + value + 1
  32257. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  32258. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  32259. }
  32260. }
  32261. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  32262. value = +value
  32263. offset = offset | 0
  32264. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  32265. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32266. this[offset + 3] = (value >>> 24)
  32267. this[offset + 2] = (value >>> 16)
  32268. this[offset + 1] = (value >>> 8)
  32269. this[offset] = (value & 0xff)
  32270. } else {
  32271. objectWriteUInt32(this, value, offset, true)
  32272. }
  32273. return offset + 4
  32274. }
  32275. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  32276. value = +value
  32277. offset = offset | 0
  32278. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  32279. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32280. this[offset] = (value >>> 24)
  32281. this[offset + 1] = (value >>> 16)
  32282. this[offset + 2] = (value >>> 8)
  32283. this[offset + 3] = (value & 0xff)
  32284. } else {
  32285. objectWriteUInt32(this, value, offset, false)
  32286. }
  32287. return offset + 4
  32288. }
  32289. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  32290. value = +value
  32291. offset = offset | 0
  32292. if (!noAssert) {
  32293. var limit = Math.pow(2, 8 * byteLength - 1)
  32294. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  32295. }
  32296. var i = 0
  32297. var mul = 1
  32298. var sub = 0
  32299. this[offset] = value & 0xFF
  32300. while (++i < byteLength && (mul *= 0x100)) {
  32301. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  32302. sub = 1
  32303. }
  32304. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  32305. }
  32306. return offset + byteLength
  32307. }
  32308. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  32309. value = +value
  32310. offset = offset | 0
  32311. if (!noAssert) {
  32312. var limit = Math.pow(2, 8 * byteLength - 1)
  32313. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  32314. }
  32315. var i = byteLength - 1
  32316. var mul = 1
  32317. var sub = 0
  32318. this[offset + i] = value & 0xFF
  32319. while (--i >= 0 && (mul *= 0x100)) {
  32320. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  32321. sub = 1
  32322. }
  32323. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  32324. }
  32325. return offset + byteLength
  32326. }
  32327. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  32328. value = +value
  32329. offset = offset | 0
  32330. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  32331. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  32332. if (value < 0) value = 0xff + value + 1
  32333. this[offset] = (value & 0xff)
  32334. return offset + 1
  32335. }
  32336. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  32337. value = +value
  32338. offset = offset | 0
  32339. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  32340. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32341. this[offset] = (value & 0xff)
  32342. this[offset + 1] = (value >>> 8)
  32343. } else {
  32344. objectWriteUInt16(this, value, offset, true)
  32345. }
  32346. return offset + 2
  32347. }
  32348. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  32349. value = +value
  32350. offset = offset | 0
  32351. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  32352. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32353. this[offset] = (value >>> 8)
  32354. this[offset + 1] = (value & 0xff)
  32355. } else {
  32356. objectWriteUInt16(this, value, offset, false)
  32357. }
  32358. return offset + 2
  32359. }
  32360. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  32361. value = +value
  32362. offset = offset | 0
  32363. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  32364. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32365. this[offset] = (value & 0xff)
  32366. this[offset + 1] = (value >>> 8)
  32367. this[offset + 2] = (value >>> 16)
  32368. this[offset + 3] = (value >>> 24)
  32369. } else {
  32370. objectWriteUInt32(this, value, offset, true)
  32371. }
  32372. return offset + 4
  32373. }
  32374. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  32375. value = +value
  32376. offset = offset | 0
  32377. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  32378. if (value < 0) value = 0xffffffff + value + 1
  32379. if (Buffer.TYPED_ARRAY_SUPPORT) {
  32380. this[offset] = (value >>> 24)
  32381. this[offset + 1] = (value >>> 16)
  32382. this[offset + 2] = (value >>> 8)
  32383. this[offset + 3] = (value & 0xff)
  32384. } else {
  32385. objectWriteUInt32(this, value, offset, false)
  32386. }
  32387. return offset + 4
  32388. }
  32389. function checkIEEE754 (buf, value, offset, ext, max, min) {
  32390. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  32391. if (offset < 0) throw new RangeError('Index out of range')
  32392. }
  32393. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  32394. if (!noAssert) {
  32395. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  32396. }
  32397. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  32398. return offset + 4
  32399. }
  32400. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  32401. return writeFloat(this, value, offset, true, noAssert)
  32402. }
  32403. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  32404. return writeFloat(this, value, offset, false, noAssert)
  32405. }
  32406. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  32407. if (!noAssert) {
  32408. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  32409. }
  32410. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  32411. return offset + 8
  32412. }
  32413. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  32414. return writeDouble(this, value, offset, true, noAssert)
  32415. }
  32416. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  32417. return writeDouble(this, value, offset, false, noAssert)
  32418. }
  32419. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  32420. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  32421. if (!start) start = 0
  32422. if (!end && end !== 0) end = this.length
  32423. if (targetStart >= target.length) targetStart = target.length
  32424. if (!targetStart) targetStart = 0
  32425. if (end > 0 && end < start) end = start
  32426. // Copy 0 bytes; we're done
  32427. if (end === start) return 0
  32428. if (target.length === 0 || this.length === 0) return 0
  32429. // Fatal error conditions
  32430. if (targetStart < 0) {
  32431. throw new RangeError('targetStart out of bounds')
  32432. }
  32433. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  32434. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  32435. // Are we oob?
  32436. if (end > this.length) end = this.length
  32437. if (target.length - targetStart < end - start) {
  32438. end = target.length - targetStart + start
  32439. }
  32440. var len = end - start
  32441. var i
  32442. if (this === target && start < targetStart && targetStart < end) {
  32443. // descending copy from end
  32444. for (i = len - 1; i >= 0; --i) {
  32445. target[i + targetStart] = this[i + start]
  32446. }
  32447. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  32448. // ascending copy from start
  32449. for (i = 0; i < len; ++i) {
  32450. target[i + targetStart] = this[i + start]
  32451. }
  32452. } else {
  32453. Uint8Array.prototype.set.call(
  32454. target,
  32455. this.subarray(start, start + len),
  32456. targetStart
  32457. )
  32458. }
  32459. return len
  32460. }
  32461. // Usage:
  32462. // buffer.fill(number[, offset[, end]])
  32463. // buffer.fill(buffer[, offset[, end]])
  32464. // buffer.fill(string[, offset[, end]][, encoding])
  32465. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  32466. // Handle string cases:
  32467. if (typeof val === 'string') {
  32468. if (typeof start === 'string') {
  32469. encoding = start
  32470. start = 0
  32471. end = this.length
  32472. } else if (typeof end === 'string') {
  32473. encoding = end
  32474. end = this.length
  32475. }
  32476. if (val.length === 1) {
  32477. var code = val.charCodeAt(0)
  32478. if (code < 256) {
  32479. val = code
  32480. }
  32481. }
  32482. if (encoding !== undefined && typeof encoding !== 'string') {
  32483. throw new TypeError('encoding must be a string')
  32484. }
  32485. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  32486. throw new TypeError('Unknown encoding: ' + encoding)
  32487. }
  32488. } else if (typeof val === 'number') {
  32489. val = val & 255
  32490. }
  32491. // Invalid ranges are not set to a default, so can range check early.
  32492. if (start < 0 || this.length < start || this.length < end) {
  32493. throw new RangeError('Out of range index')
  32494. }
  32495. if (end <= start) {
  32496. return this
  32497. }
  32498. start = start >>> 0
  32499. end = end === undefined ? this.length : end >>> 0
  32500. if (!val) val = 0
  32501. var i
  32502. if (typeof val === 'number') {
  32503. for (i = start; i < end; ++i) {
  32504. this[i] = val
  32505. }
  32506. } else {
  32507. var bytes = Buffer.isBuffer(val)
  32508. ? val
  32509. : utf8ToBytes(new Buffer(val, encoding).toString())
  32510. var len = bytes.length
  32511. for (i = 0; i < end - start; ++i) {
  32512. this[i + start] = bytes[i % len]
  32513. }
  32514. }
  32515. return this
  32516. }
  32517. // HELPER FUNCTIONS
  32518. // ================
  32519. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  32520. function base64clean (str) {
  32521. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  32522. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  32523. // Node converts strings with length < 2 to ''
  32524. if (str.length < 2) return ''
  32525. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  32526. while (str.length % 4 !== 0) {
  32527. str = str + '='
  32528. }
  32529. return str
  32530. }
  32531. function stringtrim (str) {
  32532. if (str.trim) return str.trim()
  32533. return str.replace(/^\s+|\s+$/g, '')
  32534. }
  32535. function toHex (n) {
  32536. if (n < 16) return '0' + n.toString(16)
  32537. return n.toString(16)
  32538. }
  32539. function utf8ToBytes (string, units) {
  32540. units = units || Infinity
  32541. var codePoint
  32542. var length = string.length
  32543. var leadSurrogate = null
  32544. var bytes = []
  32545. for (var i = 0; i < length; ++i) {
  32546. codePoint = string.charCodeAt(i)
  32547. // is surrogate component
  32548. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  32549. // last char was a lead
  32550. if (!leadSurrogate) {
  32551. // no lead yet
  32552. if (codePoint > 0xDBFF) {
  32553. // unexpected trail
  32554. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  32555. continue
  32556. } else if (i + 1 === length) {
  32557. // unpaired lead
  32558. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  32559. continue
  32560. }
  32561. // valid lead
  32562. leadSurrogate = codePoint
  32563. continue
  32564. }
  32565. // 2 leads in a row
  32566. if (codePoint < 0xDC00) {
  32567. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  32568. leadSurrogate = codePoint
  32569. continue
  32570. }
  32571. // valid surrogate pair
  32572. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  32573. } else if (leadSurrogate) {
  32574. // valid bmp char, but last char was a lead
  32575. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  32576. }
  32577. leadSurrogate = null
  32578. // encode utf8
  32579. if (codePoint < 0x80) {
  32580. if ((units -= 1) < 0) break
  32581. bytes.push(codePoint)
  32582. } else if (codePoint < 0x800) {
  32583. if ((units -= 2) < 0) break
  32584. bytes.push(
  32585. codePoint >> 0x6 | 0xC0,
  32586. codePoint & 0x3F | 0x80
  32587. )
  32588. } else if (codePoint < 0x10000) {
  32589. if ((units -= 3) < 0) break
  32590. bytes.push(
  32591. codePoint >> 0xC | 0xE0,
  32592. codePoint >> 0x6 & 0x3F | 0x80,
  32593. codePoint & 0x3F | 0x80
  32594. )
  32595. } else if (codePoint < 0x110000) {
  32596. if ((units -= 4) < 0) break
  32597. bytes.push(
  32598. codePoint >> 0x12 | 0xF0,
  32599. codePoint >> 0xC & 0x3F | 0x80,
  32600. codePoint >> 0x6 & 0x3F | 0x80,
  32601. codePoint & 0x3F | 0x80
  32602. )
  32603. } else {
  32604. throw new Error('Invalid code point')
  32605. }
  32606. }
  32607. return bytes
  32608. }
  32609. function asciiToBytes (str) {
  32610. var byteArray = []
  32611. for (var i = 0; i < str.length; ++i) {
  32612. // Node's code seems to be doing this and not & 0x7F..
  32613. byteArray.push(str.charCodeAt(i) & 0xFF)
  32614. }
  32615. return byteArray
  32616. }
  32617. function utf16leToBytes (str, units) {
  32618. var c, hi, lo
  32619. var byteArray = []
  32620. for (var i = 0; i < str.length; ++i) {
  32621. if ((units -= 2) < 0) break
  32622. c = str.charCodeAt(i)
  32623. hi = c >> 8
  32624. lo = c % 256
  32625. byteArray.push(lo)
  32626. byteArray.push(hi)
  32627. }
  32628. return byteArray
  32629. }
  32630. function base64ToBytes (str) {
  32631. return base64.toByteArray(base64clean(str))
  32632. }
  32633. function blitBuffer (src, dst, offset, length) {
  32634. for (var i = 0; i < length; ++i) {
  32635. if ((i + offset >= dst.length) || (i >= src.length)) break
  32636. dst[i + offset] = src[i]
  32637. }
  32638. return i
  32639. }
  32640. function isnan (val) {
  32641. return val !== val // eslint-disable-line no-self-compare
  32642. }
  32643. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
  32644. /***/ }),
  32645. /* 117 */
  32646. /*!*****************************************!*\
  32647. !*** ./node_modules/base64-js/index.js ***!
  32648. \*****************************************/
  32649. /*! no static exports found */
  32650. /***/ (function(module, exports, __webpack_require__) {
  32651. "use strict";
  32652. exports.byteLength = byteLength
  32653. exports.toByteArray = toByteArray
  32654. exports.fromByteArray = fromByteArray
  32655. var lookup = []
  32656. var revLookup = []
  32657. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  32658. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  32659. for (var i = 0, len = code.length; i < len; ++i) {
  32660. lookup[i] = code[i]
  32661. revLookup[code.charCodeAt(i)] = i
  32662. }
  32663. // Support decoding URL-safe base64 strings, as Node.js does.
  32664. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  32665. revLookup['-'.charCodeAt(0)] = 62
  32666. revLookup['_'.charCodeAt(0)] = 63
  32667. function getLens (b64) {
  32668. var len = b64.length
  32669. if (len % 4 > 0) {
  32670. throw new Error('Invalid string. Length must be a multiple of 4')
  32671. }
  32672. // Trim off extra bytes after placeholder bytes are found
  32673. // See: https://github.com/beatgammit/base64-js/issues/42
  32674. var validLen = b64.indexOf('=')
  32675. if (validLen === -1) validLen = len
  32676. var placeHoldersLen = validLen === len
  32677. ? 0
  32678. : 4 - (validLen % 4)
  32679. return [validLen, placeHoldersLen]
  32680. }
  32681. // base64 is 4/3 + up to two characters of the original data
  32682. function byteLength (b64) {
  32683. var lens = getLens(b64)
  32684. var validLen = lens[0]
  32685. var placeHoldersLen = lens[1]
  32686. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  32687. }
  32688. function _byteLength (b64, validLen, placeHoldersLen) {
  32689. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  32690. }
  32691. function toByteArray (b64) {
  32692. var tmp
  32693. var lens = getLens(b64)
  32694. var validLen = lens[0]
  32695. var placeHoldersLen = lens[1]
  32696. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  32697. var curByte = 0
  32698. // if there are placeholders, only get up to the last complete 4 chars
  32699. var len = placeHoldersLen > 0
  32700. ? validLen - 4
  32701. : validLen
  32702. var i
  32703. for (i = 0; i < len; i += 4) {
  32704. tmp =
  32705. (revLookup[b64.charCodeAt(i)] << 18) |
  32706. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  32707. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  32708. revLookup[b64.charCodeAt(i + 3)]
  32709. arr[curByte++] = (tmp >> 16) & 0xFF
  32710. arr[curByte++] = (tmp >> 8) & 0xFF
  32711. arr[curByte++] = tmp & 0xFF
  32712. }
  32713. if (placeHoldersLen === 2) {
  32714. tmp =
  32715. (revLookup[b64.charCodeAt(i)] << 2) |
  32716. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  32717. arr[curByte++] = tmp & 0xFF
  32718. }
  32719. if (placeHoldersLen === 1) {
  32720. tmp =
  32721. (revLookup[b64.charCodeAt(i)] << 10) |
  32722. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  32723. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  32724. arr[curByte++] = (tmp >> 8) & 0xFF
  32725. arr[curByte++] = tmp & 0xFF
  32726. }
  32727. return arr
  32728. }
  32729. function tripletToBase64 (num) {
  32730. return lookup[num >> 18 & 0x3F] +
  32731. lookup[num >> 12 & 0x3F] +
  32732. lookup[num >> 6 & 0x3F] +
  32733. lookup[num & 0x3F]
  32734. }
  32735. function encodeChunk (uint8, start, end) {
  32736. var tmp
  32737. var output = []
  32738. for (var i = start; i < end; i += 3) {
  32739. tmp =
  32740. ((uint8[i] << 16) & 0xFF0000) +
  32741. ((uint8[i + 1] << 8) & 0xFF00) +
  32742. (uint8[i + 2] & 0xFF)
  32743. output.push(tripletToBase64(tmp))
  32744. }
  32745. return output.join('')
  32746. }
  32747. function fromByteArray (uint8) {
  32748. var tmp
  32749. var len = uint8.length
  32750. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  32751. var parts = []
  32752. var maxChunkLength = 16383 // must be multiple of 3
  32753. // go through the array every three bytes, we'll deal with trailing stuff later
  32754. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  32755. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  32756. }
  32757. // pad the end with zeros, but make sure to not forget the extra bytes
  32758. if (extraBytes === 1) {
  32759. tmp = uint8[len - 1]
  32760. parts.push(
  32761. lookup[tmp >> 2] +
  32762. lookup[(tmp << 4) & 0x3F] +
  32763. '=='
  32764. )
  32765. } else if (extraBytes === 2) {
  32766. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  32767. parts.push(
  32768. lookup[tmp >> 10] +
  32769. lookup[(tmp >> 4) & 0x3F] +
  32770. lookup[(tmp << 2) & 0x3F] +
  32771. '='
  32772. )
  32773. }
  32774. return parts.join('')
  32775. }
  32776. /***/ }),
  32777. /* 118 */
  32778. /*!***************************************!*\
  32779. !*** ./node_modules/ieee754/index.js ***!
  32780. \***************************************/
  32781. /*! no static exports found */
  32782. /***/ (function(module, exports) {
  32783. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  32784. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  32785. var e, m
  32786. var eLen = (nBytes * 8) - mLen - 1
  32787. var eMax = (1 << eLen) - 1
  32788. var eBias = eMax >> 1
  32789. var nBits = -7
  32790. var i = isLE ? (nBytes - 1) : 0
  32791. var d = isLE ? -1 : 1
  32792. var s = buffer[offset + i]
  32793. i += d
  32794. e = s & ((1 << (-nBits)) - 1)
  32795. s >>= (-nBits)
  32796. nBits += eLen
  32797. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  32798. m = e & ((1 << (-nBits)) - 1)
  32799. e >>= (-nBits)
  32800. nBits += mLen
  32801. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  32802. if (e === 0) {
  32803. e = 1 - eBias
  32804. } else if (e === eMax) {
  32805. return m ? NaN : ((s ? -1 : 1) * Infinity)
  32806. } else {
  32807. m = m + Math.pow(2, mLen)
  32808. e = e - eBias
  32809. }
  32810. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  32811. }
  32812. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  32813. var e, m, c
  32814. var eLen = (nBytes * 8) - mLen - 1
  32815. var eMax = (1 << eLen) - 1
  32816. var eBias = eMax >> 1
  32817. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  32818. var i = isLE ? 0 : (nBytes - 1)
  32819. var d = isLE ? 1 : -1
  32820. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  32821. value = Math.abs(value)
  32822. if (isNaN(value) || value === Infinity) {
  32823. m = isNaN(value) ? 1 : 0
  32824. e = eMax
  32825. } else {
  32826. e = Math.floor(Math.log(value) / Math.LN2)
  32827. if (value * (c = Math.pow(2, -e)) < 1) {
  32828. e--
  32829. c *= 2
  32830. }
  32831. if (e + eBias >= 1) {
  32832. value += rt / c
  32833. } else {
  32834. value += rt * Math.pow(2, 1 - eBias)
  32835. }
  32836. if (value * c >= 2) {
  32837. e++
  32838. c /= 2
  32839. }
  32840. if (e + eBias >= eMax) {
  32841. m = 0
  32842. e = eMax
  32843. } else if (e + eBias >= 1) {
  32844. m = ((value * c) - 1) * Math.pow(2, mLen)
  32845. e = e + eBias
  32846. } else {
  32847. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  32848. e = 0
  32849. }
  32850. }
  32851. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  32852. e = (e << mLen) | m
  32853. eLen += mLen
  32854. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  32855. buffer[offset + i - d] |= s * 128
  32856. }
  32857. /***/ }),
  32858. /* 119 */
  32859. /*!***************************************!*\
  32860. !*** ./node_modules/isarray/index.js ***!
  32861. \***************************************/
  32862. /*! no static exports found */
  32863. /***/ (function(module, exports) {
  32864. var toString = {}.toString;
  32865. module.exports = Array.isArray || function (arr) {
  32866. return toString.call(arr) == '[object Array]';
  32867. };
  32868. /***/ }),
  32869. /* 120 */
  32870. /*!*********************************************!*\
  32871. !*** ./node_modules/create-hash/browser.js ***!
  32872. \*********************************************/
  32873. /*! no static exports found */
  32874. /***/ (function(module, exports, __webpack_require__) {
  32875. "use strict";
  32876. var inherits = __webpack_require__(/*! inherits */ 121)
  32877. var MD5 = __webpack_require__(/*! md5.js */ 122)
  32878. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 140)
  32879. var sha = __webpack_require__(/*! sha.js */ 141)
  32880. var Base = __webpack_require__(/*! cipher-base */ 149)
  32881. function Hash (hash) {
  32882. Base.call(this, 'digest')
  32883. this._hash = hash
  32884. }
  32885. inherits(Hash, Base)
  32886. Hash.prototype._update = function (data) {
  32887. this._hash.update(data)
  32888. }
  32889. Hash.prototype._final = function () {
  32890. return this._hash.digest()
  32891. }
  32892. module.exports = function createHash (alg) {
  32893. alg = alg.toLowerCase()
  32894. if (alg === 'md5') return new MD5()
  32895. if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
  32896. return new Hash(sha(alg))
  32897. }
  32898. /***/ }),
  32899. /* 121 */
  32900. /*!***************************************************!*\
  32901. !*** ./node_modules/inherits/inherits_browser.js ***!
  32902. \***************************************************/
  32903. /*! no static exports found */
  32904. /***/ (function(module, exports) {
  32905. if (typeof Object.create === 'function') {
  32906. // implementation from standard node.js 'util' module
  32907. module.exports = function inherits(ctor, superCtor) {
  32908. if (superCtor) {
  32909. ctor.super_ = superCtor
  32910. ctor.prototype = Object.create(superCtor.prototype, {
  32911. constructor: {
  32912. value: ctor,
  32913. enumerable: false,
  32914. writable: true,
  32915. configurable: true
  32916. }
  32917. })
  32918. }
  32919. };
  32920. } else {
  32921. // old school shim for old browsers
  32922. module.exports = function inherits(ctor, superCtor) {
  32923. if (superCtor) {
  32924. ctor.super_ = superCtor
  32925. var TempCtor = function () {}
  32926. TempCtor.prototype = superCtor.prototype
  32927. ctor.prototype = new TempCtor()
  32928. ctor.prototype.constructor = ctor
  32929. }
  32930. }
  32931. }
  32932. /***/ }),
  32933. /* 122 */
  32934. /*!**************************************!*\
  32935. !*** ./node_modules/md5.js/index.js ***!
  32936. \**************************************/
  32937. /*! no static exports found */
  32938. /***/ (function(module, exports, __webpack_require__) {
  32939. "use strict";
  32940. var inherits = __webpack_require__(/*! inherits */ 121)
  32941. var HashBase = __webpack_require__(/*! hash-base */ 123)
  32942. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  32943. var ARRAY16 = new Array(16)
  32944. function MD5 () {
  32945. HashBase.call(this, 64)
  32946. // state
  32947. this._a = 0x67452301
  32948. this._b = 0xefcdab89
  32949. this._c = 0x98badcfe
  32950. this._d = 0x10325476
  32951. }
  32952. inherits(MD5, HashBase)
  32953. MD5.prototype._update = function () {
  32954. var M = ARRAY16
  32955. for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)
  32956. var a = this._a
  32957. var b = this._b
  32958. var c = this._c
  32959. var d = this._d
  32960. a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)
  32961. d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)
  32962. c = fnF(c, d, a, b, M[2], 0x242070db, 17)
  32963. b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)
  32964. a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)
  32965. d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)
  32966. c = fnF(c, d, a, b, M[6], 0xa8304613, 17)
  32967. b = fnF(b, c, d, a, M[7], 0xfd469501, 22)
  32968. a = fnF(a, b, c, d, M[8], 0x698098d8, 7)
  32969. d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)
  32970. c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)
  32971. b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)
  32972. a = fnF(a, b, c, d, M[12], 0x6b901122, 7)
  32973. d = fnF(d, a, b, c, M[13], 0xfd987193, 12)
  32974. c = fnF(c, d, a, b, M[14], 0xa679438e, 17)
  32975. b = fnF(b, c, d, a, M[15], 0x49b40821, 22)
  32976. a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)
  32977. d = fnG(d, a, b, c, M[6], 0xc040b340, 9)
  32978. c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)
  32979. b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)
  32980. a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)
  32981. d = fnG(d, a, b, c, M[10], 0x02441453, 9)
  32982. c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)
  32983. b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)
  32984. a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)
  32985. d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)
  32986. c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)
  32987. b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)
  32988. a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)
  32989. d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)
  32990. c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)
  32991. b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)
  32992. a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)
  32993. d = fnH(d, a, b, c, M[8], 0x8771f681, 11)
  32994. c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)
  32995. b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)
  32996. a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)
  32997. d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)
  32998. c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)
  32999. b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)
  33000. a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)
  33001. d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)
  33002. c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)
  33003. b = fnH(b, c, d, a, M[6], 0x04881d05, 23)
  33004. a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)
  33005. d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)
  33006. c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)
  33007. b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)
  33008. a = fnI(a, b, c, d, M[0], 0xf4292244, 6)
  33009. d = fnI(d, a, b, c, M[7], 0x432aff97, 10)
  33010. c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)
  33011. b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)
  33012. a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)
  33013. d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)
  33014. c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)
  33015. b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)
  33016. a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)
  33017. d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)
  33018. c = fnI(c, d, a, b, M[6], 0xa3014314, 15)
  33019. b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)
  33020. a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)
  33021. d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)
  33022. c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)
  33023. b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)
  33024. this._a = (this._a + a) | 0
  33025. this._b = (this._b + b) | 0
  33026. this._c = (this._c + c) | 0
  33027. this._d = (this._d + d) | 0
  33028. }
  33029. MD5.prototype._digest = function () {
  33030. // create padding and handle blocks
  33031. this._block[this._blockOffset++] = 0x80
  33032. if (this._blockOffset > 56) {
  33033. this._block.fill(0, this._blockOffset, 64)
  33034. this._update()
  33035. this._blockOffset = 0
  33036. }
  33037. this._block.fill(0, this._blockOffset, 56)
  33038. this._block.writeUInt32LE(this._length[0], 56)
  33039. this._block.writeUInt32LE(this._length[1], 60)
  33040. this._update()
  33041. // produce result
  33042. var buffer = Buffer.allocUnsafe(16)
  33043. buffer.writeInt32LE(this._a, 0)
  33044. buffer.writeInt32LE(this._b, 4)
  33045. buffer.writeInt32LE(this._c, 8)
  33046. buffer.writeInt32LE(this._d, 12)
  33047. return buffer
  33048. }
  33049. function rotl (x, n) {
  33050. return (x << n) | (x >>> (32 - n))
  33051. }
  33052. function fnF (a, b, c, d, m, k, s) {
  33053. return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0
  33054. }
  33055. function fnG (a, b, c, d, m, k, s) {
  33056. return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0
  33057. }
  33058. function fnH (a, b, c, d, m, k, s) {
  33059. return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0
  33060. }
  33061. function fnI (a, b, c, d, m, k, s) {
  33062. return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0
  33063. }
  33064. module.exports = MD5
  33065. /***/ }),
  33066. /* 123 */
  33067. /*!*****************************************!*\
  33068. !*** ./node_modules/hash-base/index.js ***!
  33069. \*****************************************/
  33070. /*! no static exports found */
  33071. /***/ (function(module, exports, __webpack_require__) {
  33072. "use strict";
  33073. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  33074. var Transform = __webpack_require__(/*! readable-stream */ 124).Transform
  33075. var inherits = __webpack_require__(/*! inherits */ 121)
  33076. function throwIfNotStringOrBuffer (val, prefix) {
  33077. if (!Buffer.isBuffer(val) && typeof val !== 'string') {
  33078. throw new TypeError(prefix + ' must be a string or a buffer')
  33079. }
  33080. }
  33081. function HashBase (blockSize) {
  33082. Transform.call(this)
  33083. this._block = Buffer.allocUnsafe(blockSize)
  33084. this._blockSize = blockSize
  33085. this._blockOffset = 0
  33086. this._length = [0, 0, 0, 0]
  33087. this._finalized = false
  33088. }
  33089. inherits(HashBase, Transform)
  33090. HashBase.prototype._transform = function (chunk, encoding, callback) {
  33091. var error = null
  33092. try {
  33093. this.update(chunk, encoding)
  33094. } catch (err) {
  33095. error = err
  33096. }
  33097. callback(error)
  33098. }
  33099. HashBase.prototype._flush = function (callback) {
  33100. var error = null
  33101. try {
  33102. this.push(this.digest())
  33103. } catch (err) {
  33104. error = err
  33105. }
  33106. callback(error)
  33107. }
  33108. HashBase.prototype.update = function (data, encoding) {
  33109. throwIfNotStringOrBuffer(data, 'Data')
  33110. if (this._finalized) throw new Error('Digest already called')
  33111. if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
  33112. // consume data
  33113. var block = this._block
  33114. var offset = 0
  33115. while (this._blockOffset + data.length - offset >= this._blockSize) {
  33116. for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
  33117. this._update()
  33118. this._blockOffset = 0
  33119. }
  33120. while (offset < data.length) block[this._blockOffset++] = data[offset++]
  33121. // update length
  33122. for (var j = 0, carry = data.length * 8; carry > 0; ++j) {
  33123. this._length[j] += carry
  33124. carry = (this._length[j] / 0x0100000000) | 0
  33125. if (carry > 0) this._length[j] -= 0x0100000000 * carry
  33126. }
  33127. return this
  33128. }
  33129. HashBase.prototype._update = function () {
  33130. throw new Error('_update is not implemented')
  33131. }
  33132. HashBase.prototype.digest = function (encoding) {
  33133. if (this._finalized) throw new Error('Digest already called')
  33134. this._finalized = true
  33135. var digest = this._digest()
  33136. if (encoding !== undefined) digest = digest.toString(encoding)
  33137. // reset state
  33138. this._block.fill(0)
  33139. this._blockOffset = 0
  33140. for (var i = 0; i < 4; ++i) this._length[i] = 0
  33141. return digest
  33142. }
  33143. HashBase.prototype._digest = function () {
  33144. throw new Error('_digest is not implemented')
  33145. }
  33146. module.exports = HashBase
  33147. /***/ }),
  33148. /* 124 */
  33149. /*!**********************************************************!*\
  33150. !*** ./node_modules/readable-stream/readable-browser.js ***!
  33151. \**********************************************************/
  33152. /*! no static exports found */
  33153. /***/ (function(module, exports, __webpack_require__) {
  33154. exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ 125);
  33155. exports.Stream = exports;
  33156. exports.Readable = exports;
  33157. exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 135);
  33158. exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ 134);
  33159. exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ 138);
  33160. exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ 139);
  33161. /***/ }),
  33162. /* 125 */
  33163. /*!**************************************************************!*\
  33164. !*** ./node_modules/readable-stream/lib/_stream_readable.js ***!
  33165. \**************************************************************/
  33166. /*! no static exports found */
  33167. /***/ (function(module, exports, __webpack_require__) {
  33168. "use strict";
  33169. /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
  33170. //
  33171. // Permission is hereby granted, free of charge, to any person obtaining a
  33172. // copy of this software and associated documentation files (the
  33173. // "Software"), to deal in the Software without restriction, including
  33174. // without limitation the rights to use, copy, modify, merge, publish,
  33175. // distribute, sublicense, and/or sell copies of the Software, and to permit
  33176. // persons to whom the Software is furnished to do so, subject to the
  33177. // following conditions:
  33178. //
  33179. // The above copyright notice and this permission notice shall be included
  33180. // in all copies or substantial portions of the Software.
  33181. //
  33182. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  33183. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  33184. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  33185. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  33186. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  33187. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  33188. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  33189. /*<replacement>*/
  33190. var pna = __webpack_require__(/*! process-nextick-args */ 126);
  33191. /*</replacement>*/
  33192. module.exports = Readable;
  33193. /*<replacement>*/
  33194. var isArray = __webpack_require__(/*! isarray */ 119);
  33195. /*</replacement>*/
  33196. /*<replacement>*/
  33197. var Duplex;
  33198. /*</replacement>*/
  33199. Readable.ReadableState = ReadableState;
  33200. /*<replacement>*/
  33201. var EE = __webpack_require__(/*! events */ 127).EventEmitter;
  33202. var EElistenerCount = function (emitter, type) {
  33203. return emitter.listeners(type).length;
  33204. };
  33205. /*</replacement>*/
  33206. /*<replacement>*/
  33207. var Stream = __webpack_require__(/*! ./internal/streams/stream */ 128);
  33208. /*</replacement>*/
  33209. /*<replacement>*/
  33210. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
  33211. var OurUint8Array = global.Uint8Array || function () {};
  33212. function _uint8ArrayToBuffer(chunk) {
  33213. return Buffer.from(chunk);
  33214. }
  33215. function _isUint8Array(obj) {
  33216. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  33217. }
  33218. /*</replacement>*/
  33219. /*<replacement>*/
  33220. var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
  33221. util.inherits = __webpack_require__(/*! inherits */ 121);
  33222. /*</replacement>*/
  33223. /*<replacement>*/
  33224. var debugUtil = __webpack_require__(/*! util */ 130);
  33225. var debug = void 0;
  33226. if (debugUtil && debugUtil.debuglog) {
  33227. debug = debugUtil.debuglog('stream');
  33228. } else {
  33229. debug = function () {};
  33230. }
  33231. /*</replacement>*/
  33232. var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ 131);
  33233. var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 133);
  33234. var StringDecoder;
  33235. util.inherits(Readable, Stream);
  33236. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  33237. function prependListener(emitter, event, fn) {
  33238. // Sadly this is not cacheable as some libraries bundle their own
  33239. // event emitter implementation with them.
  33240. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  33241. // This is a hack to make sure that our error handler is attached before any
  33242. // userland ones. NEVER DO THIS. This is here only because this code needs
  33243. // to continue to work with older versions of Node.js that do not include
  33244. // the prependListener() method. The goal is to eventually remove this hack.
  33245. 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]];
  33246. }
  33247. function ReadableState(options, stream) {
  33248. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
  33249. options = options || {};
  33250. // Duplex streams are both readable and writable, but share
  33251. // the same options object.
  33252. // However, some cases require setting options to different
  33253. // values for the readable and the writable sides of the duplex stream.
  33254. // These options can be provided separately as readableXXX and writableXXX.
  33255. var isDuplex = stream instanceof Duplex;
  33256. // object stream flag. Used to make read(n) ignore n and to
  33257. // make all the buffer merging and length checks go away
  33258. this.objectMode = !!options.objectMode;
  33259. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  33260. // the point at which it stops calling _read() to fill the buffer
  33261. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  33262. var hwm = options.highWaterMark;
  33263. var readableHwm = options.readableHighWaterMark;
  33264. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  33265. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  33266. // cast to ints.
  33267. this.highWaterMark = Math.floor(this.highWaterMark);
  33268. // A linked list is used to store data chunks instead of an array because the
  33269. // linked list can remove elements from the beginning faster than
  33270. // array.shift()
  33271. this.buffer = new BufferList();
  33272. this.length = 0;
  33273. this.pipes = null;
  33274. this.pipesCount = 0;
  33275. this.flowing = null;
  33276. this.ended = false;
  33277. this.endEmitted = false;
  33278. this.reading = false;
  33279. // a flag to be able to tell if the event 'readable'/'data' is emitted
  33280. // immediately, or on a later tick. We set this to true at first, because
  33281. // any actions that shouldn't happen until "later" should generally also
  33282. // not happen before the first read call.
  33283. this.sync = true;
  33284. // whenever we return null, then we set a flag to say
  33285. // that we're awaiting a 'readable' event emission.
  33286. this.needReadable = false;
  33287. this.emittedReadable = false;
  33288. this.readableListening = false;
  33289. this.resumeScheduled = false;
  33290. // has it been destroyed
  33291. this.destroyed = false;
  33292. // Crypto is kind of old and crusty. Historically, its default string
  33293. // encoding is 'binary' so we have to make this configurable.
  33294. // Everything else in the universe uses 'utf8', though.
  33295. this.defaultEncoding = options.defaultEncoding || 'utf8';
  33296. // the number of writers that are awaiting a drain event in .pipe()s
  33297. this.awaitDrain = 0;
  33298. // if true, a maybeReadMore has been scheduled
  33299. this.readingMore = false;
  33300. this.decoder = null;
  33301. this.encoding = null;
  33302. if (options.encoding) {
  33303. if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 137).StringDecoder;
  33304. this.decoder = new StringDecoder(options.encoding);
  33305. this.encoding = options.encoding;
  33306. }
  33307. }
  33308. function Readable(options) {
  33309. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
  33310. if (!(this instanceof Readable)) return new Readable(options);
  33311. this._readableState = new ReadableState(options, this);
  33312. // legacy
  33313. this.readable = true;
  33314. if (options) {
  33315. if (typeof options.read === 'function') this._read = options.read;
  33316. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  33317. }
  33318. Stream.call(this);
  33319. }
  33320. Object.defineProperty(Readable.prototype, 'destroyed', {
  33321. get: function () {
  33322. if (this._readableState === undefined) {
  33323. return false;
  33324. }
  33325. return this._readableState.destroyed;
  33326. },
  33327. set: function (value) {
  33328. // we ignore the value if the stream
  33329. // has not been initialized yet
  33330. if (!this._readableState) {
  33331. return;
  33332. }
  33333. // backward compatibility, the user is explicitly
  33334. // managing destroyed
  33335. this._readableState.destroyed = value;
  33336. }
  33337. });
  33338. Readable.prototype.destroy = destroyImpl.destroy;
  33339. Readable.prototype._undestroy = destroyImpl.undestroy;
  33340. Readable.prototype._destroy = function (err, cb) {
  33341. this.push(null);
  33342. cb(err);
  33343. };
  33344. // Manually shove something into the read() buffer.
  33345. // This returns true if the highWaterMark has not been hit yet,
  33346. // similar to how Writable.write() returns true if you should
  33347. // write() some more.
  33348. Readable.prototype.push = function (chunk, encoding) {
  33349. var state = this._readableState;
  33350. var skipChunkCheck;
  33351. if (!state.objectMode) {
  33352. if (typeof chunk === 'string') {
  33353. encoding = encoding || state.defaultEncoding;
  33354. if (encoding !== state.encoding) {
  33355. chunk = Buffer.from(chunk, encoding);
  33356. encoding = '';
  33357. }
  33358. skipChunkCheck = true;
  33359. }
  33360. } else {
  33361. skipChunkCheck = true;
  33362. }
  33363. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  33364. };
  33365. // Unshift should *always* be something directly out of read()
  33366. Readable.prototype.unshift = function (chunk) {
  33367. return readableAddChunk(this, chunk, null, true, false);
  33368. };
  33369. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  33370. var state = stream._readableState;
  33371. if (chunk === null) {
  33372. state.reading = false;
  33373. onEofChunk(stream, state);
  33374. } else {
  33375. var er;
  33376. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  33377. if (er) {
  33378. stream.emit('error', er);
  33379. } else if (state.objectMode || chunk && chunk.length > 0) {
  33380. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  33381. chunk = _uint8ArrayToBuffer(chunk);
  33382. }
  33383. if (addToFront) {
  33384. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  33385. } else if (state.ended) {
  33386. stream.emit('error', new Error('stream.push() after EOF'));
  33387. } else {
  33388. state.reading = false;
  33389. if (state.decoder && !encoding) {
  33390. chunk = state.decoder.write(chunk);
  33391. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  33392. } else {
  33393. addChunk(stream, state, chunk, false);
  33394. }
  33395. }
  33396. } else if (!addToFront) {
  33397. state.reading = false;
  33398. }
  33399. }
  33400. return needMoreData(state);
  33401. }
  33402. function addChunk(stream, state, chunk, addToFront) {
  33403. if (state.flowing && state.length === 0 && !state.sync) {
  33404. stream.emit('data', chunk);
  33405. stream.read(0);
  33406. } else {
  33407. // update the buffer info.
  33408. state.length += state.objectMode ? 1 : chunk.length;
  33409. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  33410. if (state.needReadable) emitReadable(stream);
  33411. }
  33412. maybeReadMore(stream, state);
  33413. }
  33414. function chunkInvalid(state, chunk) {
  33415. var er;
  33416. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  33417. er = new TypeError('Invalid non-string/buffer chunk');
  33418. }
  33419. return er;
  33420. }
  33421. // if it's past the high water mark, we can push in some more.
  33422. // Also, if we have no data yet, we can stand some
  33423. // more bytes. This is to work around cases where hwm=0,
  33424. // such as the repl. Also, if the push() triggered a
  33425. // readable event, and the user called read(largeNumber) such that
  33426. // needReadable was set, then we ought to push more, so that another
  33427. // 'readable' event will be triggered.
  33428. function needMoreData(state) {
  33429. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  33430. }
  33431. Readable.prototype.isPaused = function () {
  33432. return this._readableState.flowing === false;
  33433. };
  33434. // backwards compatibility.
  33435. Readable.prototype.setEncoding = function (enc) {
  33436. if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ 137).StringDecoder;
  33437. this._readableState.decoder = new StringDecoder(enc);
  33438. this._readableState.encoding = enc;
  33439. return this;
  33440. };
  33441. // Don't raise the hwm > 8MB
  33442. var MAX_HWM = 0x800000;
  33443. function computeNewHighWaterMark(n) {
  33444. if (n >= MAX_HWM) {
  33445. n = MAX_HWM;
  33446. } else {
  33447. // Get the next highest power of 2 to prevent increasing hwm excessively in
  33448. // tiny amounts
  33449. n--;
  33450. n |= n >>> 1;
  33451. n |= n >>> 2;
  33452. n |= n >>> 4;
  33453. n |= n >>> 8;
  33454. n |= n >>> 16;
  33455. n++;
  33456. }
  33457. return n;
  33458. }
  33459. // This function is designed to be inlinable, so please take care when making
  33460. // changes to the function body.
  33461. function howMuchToRead(n, state) {
  33462. if (n <= 0 || state.length === 0 && state.ended) return 0;
  33463. if (state.objectMode) return 1;
  33464. if (n !== n) {
  33465. // Only flow one buffer at a time
  33466. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  33467. }
  33468. // If we're asking for more than the current hwm, then raise the hwm.
  33469. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  33470. if (n <= state.length) return n;
  33471. // Don't have enough
  33472. if (!state.ended) {
  33473. state.needReadable = true;
  33474. return 0;
  33475. }
  33476. return state.length;
  33477. }
  33478. // you can override either this method, or the async _read(n) below.
  33479. Readable.prototype.read = function (n) {
  33480. debug('read', n);
  33481. n = parseInt(n, 10);
  33482. var state = this._readableState;
  33483. var nOrig = n;
  33484. if (n !== 0) state.emittedReadable = false;
  33485. // if we're doing read(0) to trigger a readable event, but we
  33486. // already have a bunch of data in the buffer, then just trigger
  33487. // the 'readable' event and move on.
  33488. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  33489. debug('read: emitReadable', state.length, state.ended);
  33490. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  33491. return null;
  33492. }
  33493. n = howMuchToRead(n, state);
  33494. // if we've ended, and we're now clear, then finish it up.
  33495. if (n === 0 && state.ended) {
  33496. if (state.length === 0) endReadable(this);
  33497. return null;
  33498. }
  33499. // All the actual chunk generation logic needs to be
  33500. // *below* the call to _read. The reason is that in certain
  33501. // synthetic stream cases, such as passthrough streams, _read
  33502. // may be a completely synchronous operation which may change
  33503. // the state of the read buffer, providing enough data when
  33504. // before there was *not* enough.
  33505. //
  33506. // So, the steps are:
  33507. // 1. Figure out what the state of things will be after we do
  33508. // a read from the buffer.
  33509. //
  33510. // 2. If that resulting state will trigger a _read, then call _read.
  33511. // Note that this may be asynchronous, or synchronous. Yes, it is
  33512. // deeply ugly to write APIs this way, but that still doesn't mean
  33513. // that the Readable class should behave improperly, as streams are
  33514. // designed to be sync/async agnostic.
  33515. // Take note if the _read call is sync or async (ie, if the read call
  33516. // has returned yet), so that we know whether or not it's safe to emit
  33517. // 'readable' etc.
  33518. //
  33519. // 3. Actually pull the requested chunks out of the buffer and return.
  33520. // if we need a readable event, then we need to do some reading.
  33521. var doRead = state.needReadable;
  33522. debug('need readable', doRead);
  33523. // if we currently have less than the highWaterMark, then also read some
  33524. if (state.length === 0 || state.length - n < state.highWaterMark) {
  33525. doRead = true;
  33526. debug('length less than watermark', doRead);
  33527. }
  33528. // however, if we've ended, then there's no point, and if we're already
  33529. // reading, then it's unnecessary.
  33530. if (state.ended || state.reading) {
  33531. doRead = false;
  33532. debug('reading or ended', doRead);
  33533. } else if (doRead) {
  33534. debug('do read');
  33535. state.reading = true;
  33536. state.sync = true;
  33537. // if the length is currently zero, then we *need* a readable event.
  33538. if (state.length === 0) state.needReadable = true;
  33539. // call internal read method
  33540. this._read(state.highWaterMark);
  33541. state.sync = false;
  33542. // If _read pushed data synchronously, then `reading` will be false,
  33543. // and we need to re-evaluate how much data we can return to the user.
  33544. if (!state.reading) n = howMuchToRead(nOrig, state);
  33545. }
  33546. var ret;
  33547. if (n > 0) ret = fromList(n, state);else ret = null;
  33548. if (ret === null) {
  33549. state.needReadable = true;
  33550. n = 0;
  33551. } else {
  33552. state.length -= n;
  33553. }
  33554. if (state.length === 0) {
  33555. // If we have nothing in the buffer, then we want to know
  33556. // as soon as we *do* get something into the buffer.
  33557. if (!state.ended) state.needReadable = true;
  33558. // If we tried to read() past the EOF, then emit end on the next tick.
  33559. if (nOrig !== n && state.ended) endReadable(this);
  33560. }
  33561. if (ret !== null) this.emit('data', ret);
  33562. return ret;
  33563. };
  33564. function onEofChunk(stream, state) {
  33565. if (state.ended) return;
  33566. if (state.decoder) {
  33567. var chunk = state.decoder.end();
  33568. if (chunk && chunk.length) {
  33569. state.buffer.push(chunk);
  33570. state.length += state.objectMode ? 1 : chunk.length;
  33571. }
  33572. }
  33573. state.ended = true;
  33574. // emit 'readable' now to make sure it gets picked up.
  33575. emitReadable(stream);
  33576. }
  33577. // Don't emit readable right away in sync mode, because this can trigger
  33578. // another read() call => stack overflow. This way, it might trigger
  33579. // a nextTick recursion warning, but that's not so bad.
  33580. function emitReadable(stream) {
  33581. var state = stream._readableState;
  33582. state.needReadable = false;
  33583. if (!state.emittedReadable) {
  33584. debug('emitReadable', state.flowing);
  33585. state.emittedReadable = true;
  33586. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  33587. }
  33588. }
  33589. function emitReadable_(stream) {
  33590. debug('emit readable');
  33591. stream.emit('readable');
  33592. flow(stream);
  33593. }
  33594. // at this point, the user has presumably seen the 'readable' event,
  33595. // and called read() to consume some data. that may have triggered
  33596. // in turn another _read(n) call, in which case reading = true if
  33597. // it's in progress.
  33598. // However, if we're not ended, or reading, and the length < hwm,
  33599. // then go ahead and try to read some more preemptively.
  33600. function maybeReadMore(stream, state) {
  33601. if (!state.readingMore) {
  33602. state.readingMore = true;
  33603. pna.nextTick(maybeReadMore_, stream, state);
  33604. }
  33605. }
  33606. function maybeReadMore_(stream, state) {
  33607. var len = state.length;
  33608. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  33609. debug('maybeReadMore read 0');
  33610. stream.read(0);
  33611. if (len === state.length)
  33612. // didn't get any data, stop spinning.
  33613. break;else len = state.length;
  33614. }
  33615. state.readingMore = false;
  33616. }
  33617. // abstract method. to be overridden in specific implementation classes.
  33618. // call cb(er, data) where data is <= n in length.
  33619. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  33620. // arbitrary, and perhaps not very meaningful.
  33621. Readable.prototype._read = function (n) {
  33622. this.emit('error', new Error('_read() is not implemented'));
  33623. };
  33624. Readable.prototype.pipe = function (dest, pipeOpts) {
  33625. var src = this;
  33626. var state = this._readableState;
  33627. switch (state.pipesCount) {
  33628. case 0:
  33629. state.pipes = dest;
  33630. break;
  33631. case 1:
  33632. state.pipes = [state.pipes, dest];
  33633. break;
  33634. default:
  33635. state.pipes.push(dest);
  33636. break;
  33637. }
  33638. state.pipesCount += 1;
  33639. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  33640. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  33641. var endFn = doEnd ? onend : unpipe;
  33642. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  33643. dest.on('unpipe', onunpipe);
  33644. function onunpipe(readable, unpipeInfo) {
  33645. debug('onunpipe');
  33646. if (readable === src) {
  33647. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  33648. unpipeInfo.hasUnpiped = true;
  33649. cleanup();
  33650. }
  33651. }
  33652. }
  33653. function onend() {
  33654. debug('onend');
  33655. dest.end();
  33656. }
  33657. // when the dest drains, it reduces the awaitDrain counter
  33658. // on the source. This would be more elegant with a .once()
  33659. // handler in flow(), but adding and removing repeatedly is
  33660. // too slow.
  33661. var ondrain = pipeOnDrain(src);
  33662. dest.on('drain', ondrain);
  33663. var cleanedUp = false;
  33664. function cleanup() {
  33665. debug('cleanup');
  33666. // cleanup event handlers once the pipe is broken
  33667. dest.removeListener('close', onclose);
  33668. dest.removeListener('finish', onfinish);
  33669. dest.removeListener('drain', ondrain);
  33670. dest.removeListener('error', onerror);
  33671. dest.removeListener('unpipe', onunpipe);
  33672. src.removeListener('end', onend);
  33673. src.removeListener('end', unpipe);
  33674. src.removeListener('data', ondata);
  33675. cleanedUp = true;
  33676. // if the reader is waiting for a drain event from this
  33677. // specific writer, then it would cause it to never start
  33678. // flowing again.
  33679. // So, if this is awaiting a drain, then we just call it now.
  33680. // If we don't know, then assume that we are waiting for one.
  33681. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  33682. }
  33683. // If the user pushes more data while we're writing to dest then we'll end up
  33684. // in ondata again. However, we only want to increase awaitDrain once because
  33685. // dest will only emit one 'drain' event for the multiple writes.
  33686. // => Introduce a guard on increasing awaitDrain.
  33687. var increasedAwaitDrain = false;
  33688. src.on('data', ondata);
  33689. function ondata(chunk) {
  33690. debug('ondata');
  33691. increasedAwaitDrain = false;
  33692. var ret = dest.write(chunk);
  33693. if (false === ret && !increasedAwaitDrain) {
  33694. // If the user unpiped during `dest.write()`, it is possible
  33695. // to get stuck in a permanently paused state if that write
  33696. // also returned false.
  33697. // => Check whether `dest` is still a piping destination.
  33698. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  33699. debug('false write response, pause', src._readableState.awaitDrain);
  33700. src._readableState.awaitDrain++;
  33701. increasedAwaitDrain = true;
  33702. }
  33703. src.pause();
  33704. }
  33705. }
  33706. // if the dest has an error, then stop piping into it.
  33707. // however, don't suppress the throwing behavior for this.
  33708. function onerror(er) {
  33709. debug('onerror', er);
  33710. unpipe();
  33711. dest.removeListener('error', onerror);
  33712. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  33713. }
  33714. // Make sure our error handler is attached before userland ones.
  33715. prependListener(dest, 'error', onerror);
  33716. // Both close and finish should trigger unpipe, but only once.
  33717. function onclose() {
  33718. dest.removeListener('finish', onfinish);
  33719. unpipe();
  33720. }
  33721. dest.once('close', onclose);
  33722. function onfinish() {
  33723. debug('onfinish');
  33724. dest.removeListener('close', onclose);
  33725. unpipe();
  33726. }
  33727. dest.once('finish', onfinish);
  33728. function unpipe() {
  33729. debug('unpipe');
  33730. src.unpipe(dest);
  33731. }
  33732. // tell the dest that it's being piped to
  33733. dest.emit('pipe', src);
  33734. // start the flow if it hasn't been started already.
  33735. if (!state.flowing) {
  33736. debug('pipe resume');
  33737. src.resume();
  33738. }
  33739. return dest;
  33740. };
  33741. function pipeOnDrain(src) {
  33742. return function () {
  33743. var state = src._readableState;
  33744. debug('pipeOnDrain', state.awaitDrain);
  33745. if (state.awaitDrain) state.awaitDrain--;
  33746. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  33747. state.flowing = true;
  33748. flow(src);
  33749. }
  33750. };
  33751. }
  33752. Readable.prototype.unpipe = function (dest) {
  33753. var state = this._readableState;
  33754. var unpipeInfo = { hasUnpiped: false };
  33755. // if we're not piping anywhere, then do nothing.
  33756. if (state.pipesCount === 0) return this;
  33757. // just one destination. most common case.
  33758. if (state.pipesCount === 1) {
  33759. // passed in one, but it's not the right one.
  33760. if (dest && dest !== state.pipes) return this;
  33761. if (!dest) dest = state.pipes;
  33762. // got a match.
  33763. state.pipes = null;
  33764. state.pipesCount = 0;
  33765. state.flowing = false;
  33766. if (dest) dest.emit('unpipe', this, unpipeInfo);
  33767. return this;
  33768. }
  33769. // slow case. multiple pipe destinations.
  33770. if (!dest) {
  33771. // remove all.
  33772. var dests = state.pipes;
  33773. var len = state.pipesCount;
  33774. state.pipes = null;
  33775. state.pipesCount = 0;
  33776. state.flowing = false;
  33777. for (var i = 0; i < len; i++) {
  33778. dests[i].emit('unpipe', this, unpipeInfo);
  33779. }return this;
  33780. }
  33781. // try to find the right one.
  33782. var index = indexOf(state.pipes, dest);
  33783. if (index === -1) return this;
  33784. state.pipes.splice(index, 1);
  33785. state.pipesCount -= 1;
  33786. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  33787. dest.emit('unpipe', this, unpipeInfo);
  33788. return this;
  33789. };
  33790. // set up data events if they are asked for
  33791. // Ensure readable listeners eventually get something
  33792. Readable.prototype.on = function (ev, fn) {
  33793. var res = Stream.prototype.on.call(this, ev, fn);
  33794. if (ev === 'data') {
  33795. // Start flowing on next tick if stream isn't explicitly paused
  33796. if (this._readableState.flowing !== false) this.resume();
  33797. } else if (ev === 'readable') {
  33798. var state = this._readableState;
  33799. if (!state.endEmitted && !state.readableListening) {
  33800. state.readableListening = state.needReadable = true;
  33801. state.emittedReadable = false;
  33802. if (!state.reading) {
  33803. pna.nextTick(nReadingNextTick, this);
  33804. } else if (state.length) {
  33805. emitReadable(this);
  33806. }
  33807. }
  33808. }
  33809. return res;
  33810. };
  33811. Readable.prototype.addListener = Readable.prototype.on;
  33812. function nReadingNextTick(self) {
  33813. debug('readable nexttick read 0');
  33814. self.read(0);
  33815. }
  33816. // pause() and resume() are remnants of the legacy readable stream API
  33817. // If the user uses them, then switch into old mode.
  33818. Readable.prototype.resume = function () {
  33819. var state = this._readableState;
  33820. if (!state.flowing) {
  33821. debug('resume');
  33822. state.flowing = true;
  33823. resume(this, state);
  33824. }
  33825. return this;
  33826. };
  33827. function resume(stream, state) {
  33828. if (!state.resumeScheduled) {
  33829. state.resumeScheduled = true;
  33830. pna.nextTick(resume_, stream, state);
  33831. }
  33832. }
  33833. function resume_(stream, state) {
  33834. if (!state.reading) {
  33835. debug('resume read 0');
  33836. stream.read(0);
  33837. }
  33838. state.resumeScheduled = false;
  33839. state.awaitDrain = 0;
  33840. stream.emit('resume');
  33841. flow(stream);
  33842. if (state.flowing && !state.reading) stream.read(0);
  33843. }
  33844. Readable.prototype.pause = function () {
  33845. debug('call pause flowing=%j', this._readableState.flowing);
  33846. if (false !== this._readableState.flowing) {
  33847. debug('pause');
  33848. this._readableState.flowing = false;
  33849. this.emit('pause');
  33850. }
  33851. return this;
  33852. };
  33853. function flow(stream) {
  33854. var state = stream._readableState;
  33855. debug('flow', state.flowing);
  33856. while (state.flowing && stream.read() !== null) {}
  33857. }
  33858. // wrap an old-style stream as the async data source.
  33859. // This is *not* part of the readable stream interface.
  33860. // It is an ugly unfortunate mess of history.
  33861. Readable.prototype.wrap = function (stream) {
  33862. var _this = this;
  33863. var state = this._readableState;
  33864. var paused = false;
  33865. stream.on('end', function () {
  33866. debug('wrapped end');
  33867. if (state.decoder && !state.ended) {
  33868. var chunk = state.decoder.end();
  33869. if (chunk && chunk.length) _this.push(chunk);
  33870. }
  33871. _this.push(null);
  33872. });
  33873. stream.on('data', function (chunk) {
  33874. debug('wrapped data');
  33875. if (state.decoder) chunk = state.decoder.write(chunk);
  33876. // don't skip over falsy values in objectMode
  33877. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  33878. var ret = _this.push(chunk);
  33879. if (!ret) {
  33880. paused = true;
  33881. stream.pause();
  33882. }
  33883. });
  33884. // proxy all the other methods.
  33885. // important when wrapping filters and duplexes.
  33886. for (var i in stream) {
  33887. if (this[i] === undefined && typeof stream[i] === 'function') {
  33888. this[i] = function (method) {
  33889. return function () {
  33890. return stream[method].apply(stream, arguments);
  33891. };
  33892. }(i);
  33893. }
  33894. }
  33895. // proxy certain important events.
  33896. for (var n = 0; n < kProxyEvents.length; n++) {
  33897. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  33898. }
  33899. // when we try to consume some more bytes, simply unpause the
  33900. // underlying stream.
  33901. this._read = function (n) {
  33902. debug('wrapped _read', n);
  33903. if (paused) {
  33904. paused = false;
  33905. stream.resume();
  33906. }
  33907. };
  33908. return this;
  33909. };
  33910. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  33911. // making it explicit this property is not enumerable
  33912. // because otherwise some prototype manipulation in
  33913. // userland will fail
  33914. enumerable: false,
  33915. get: function () {
  33916. return this._readableState.highWaterMark;
  33917. }
  33918. });
  33919. // exposed for testing purposes only.
  33920. Readable._fromList = fromList;
  33921. // Pluck off n bytes from an array of buffers.
  33922. // Length is the combined lengths of all the buffers in the list.
  33923. // This function is designed to be inlinable, so please take care when making
  33924. // changes to the function body.
  33925. function fromList(n, state) {
  33926. // nothing buffered
  33927. if (state.length === 0) return null;
  33928. var ret;
  33929. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  33930. // read it all, truncate the list
  33931. 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);
  33932. state.buffer.clear();
  33933. } else {
  33934. // read part of list
  33935. ret = fromListPartial(n, state.buffer, state.decoder);
  33936. }
  33937. return ret;
  33938. }
  33939. // Extracts only enough buffered data to satisfy the amount requested.
  33940. // This function is designed to be inlinable, so please take care when making
  33941. // changes to the function body.
  33942. function fromListPartial(n, list, hasStrings) {
  33943. var ret;
  33944. if (n < list.head.data.length) {
  33945. // slice is the same for buffers and strings
  33946. ret = list.head.data.slice(0, n);
  33947. list.head.data = list.head.data.slice(n);
  33948. } else if (n === list.head.data.length) {
  33949. // first chunk is a perfect match
  33950. ret = list.shift();
  33951. } else {
  33952. // result spans more than one buffer
  33953. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  33954. }
  33955. return ret;
  33956. }
  33957. // Copies a specified amount of characters from the list of buffered data
  33958. // chunks.
  33959. // This function is designed to be inlinable, so please take care when making
  33960. // changes to the function body.
  33961. function copyFromBufferString(n, list) {
  33962. var p = list.head;
  33963. var c = 1;
  33964. var ret = p.data;
  33965. n -= ret.length;
  33966. while (p = p.next) {
  33967. var str = p.data;
  33968. var nb = n > str.length ? str.length : n;
  33969. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  33970. n -= nb;
  33971. if (n === 0) {
  33972. if (nb === str.length) {
  33973. ++c;
  33974. if (p.next) list.head = p.next;else list.head = list.tail = null;
  33975. } else {
  33976. list.head = p;
  33977. p.data = str.slice(nb);
  33978. }
  33979. break;
  33980. }
  33981. ++c;
  33982. }
  33983. list.length -= c;
  33984. return ret;
  33985. }
  33986. // Copies a specified amount of bytes from the list of buffered data chunks.
  33987. // This function is designed to be inlinable, so please take care when making
  33988. // changes to the function body.
  33989. function copyFromBuffer(n, list) {
  33990. var ret = Buffer.allocUnsafe(n);
  33991. var p = list.head;
  33992. var c = 1;
  33993. p.data.copy(ret);
  33994. n -= p.data.length;
  33995. while (p = p.next) {
  33996. var buf = p.data;
  33997. var nb = n > buf.length ? buf.length : n;
  33998. buf.copy(ret, ret.length - n, 0, nb);
  33999. n -= nb;
  34000. if (n === 0) {
  34001. if (nb === buf.length) {
  34002. ++c;
  34003. if (p.next) list.head = p.next;else list.head = list.tail = null;
  34004. } else {
  34005. list.head = p;
  34006. p.data = buf.slice(nb);
  34007. }
  34008. break;
  34009. }
  34010. ++c;
  34011. }
  34012. list.length -= c;
  34013. return ret;
  34014. }
  34015. function endReadable(stream) {
  34016. var state = stream._readableState;
  34017. // If we get here before consuming all the bytes, then that is a
  34018. // bug in node. Should never happen.
  34019. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  34020. if (!state.endEmitted) {
  34021. state.ended = true;
  34022. pna.nextTick(endReadableNT, state, stream);
  34023. }
  34024. }
  34025. function endReadableNT(state, stream) {
  34026. // Check that we didn't get one last unshift.
  34027. if (!state.endEmitted && state.length === 0) {
  34028. state.endEmitted = true;
  34029. stream.readable = false;
  34030. stream.emit('end');
  34031. }
  34032. }
  34033. function indexOf(xs, x) {
  34034. for (var i = 0, l = xs.length; i < l; i++) {
  34035. if (xs[i] === x) return i;
  34036. }
  34037. return -1;
  34038. }
  34039. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 113)))
  34040. /***/ }),
  34041. /* 126 */
  34042. /*!****************************************************!*\
  34043. !*** ./node_modules/process-nextick-args/index.js ***!
  34044. \****************************************************/
  34045. /*! no static exports found */
  34046. /***/ (function(module, exports, __webpack_require__) {
  34047. "use strict";
  34048. /* WEBPACK VAR INJECTION */(function(process) {
  34049. if (typeof process === 'undefined' ||
  34050. !process.version ||
  34051. process.version.indexOf('v0.') === 0 ||
  34052. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  34053. module.exports = { nextTick: nextTick };
  34054. } else {
  34055. module.exports = process
  34056. }
  34057. function nextTick(fn, arg1, arg2, arg3) {
  34058. if (typeof fn !== 'function') {
  34059. throw new TypeError('"callback" argument must be a function');
  34060. }
  34061. var len = arguments.length;
  34062. var args, i;
  34063. switch (len) {
  34064. case 0:
  34065. case 1:
  34066. return process.nextTick(fn);
  34067. case 2:
  34068. return process.nextTick(function afterTickOne() {
  34069. fn.call(null, arg1);
  34070. });
  34071. case 3:
  34072. return process.nextTick(function afterTickTwo() {
  34073. fn.call(null, arg1, arg2);
  34074. });
  34075. case 4:
  34076. return process.nextTick(function afterTickThree() {
  34077. fn.call(null, arg1, arg2, arg3);
  34078. });
  34079. default:
  34080. args = new Array(len - 1);
  34081. i = 0;
  34082. while (i < args.length) {
  34083. args[i++] = arguments[i];
  34084. }
  34085. return process.nextTick(function afterTick() {
  34086. fn.apply(null, args);
  34087. });
  34088. }
  34089. }
  34090. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
  34091. /***/ }),
  34092. /* 127 */
  34093. /*!***************************************!*\
  34094. !*** ./node_modules/events/events.js ***!
  34095. \***************************************/
  34096. /*! no static exports found */
  34097. /***/ (function(module, exports, __webpack_require__) {
  34098. "use strict";
  34099. // Copyright Joyent, Inc. and other Node contributors.
  34100. //
  34101. // Permission is hereby granted, free of charge, to any person obtaining a
  34102. // copy of this software and associated documentation files (the
  34103. // "Software"), to deal in the Software without restriction, including
  34104. // without limitation the rights to use, copy, modify, merge, publish,
  34105. // distribute, sublicense, and/or sell copies of the Software, and to permit
  34106. // persons to whom the Software is furnished to do so, subject to the
  34107. // following conditions:
  34108. //
  34109. // The above copyright notice and this permission notice shall be included
  34110. // in all copies or substantial portions of the Software.
  34111. //
  34112. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  34113. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  34114. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  34115. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  34116. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  34117. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  34118. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  34119. var R = typeof Reflect === 'object' ? Reflect : null
  34120. var ReflectApply = R && typeof R.apply === 'function'
  34121. ? R.apply
  34122. : function ReflectApply(target, receiver, args) {
  34123. return Function.prototype.apply.call(target, receiver, args);
  34124. }
  34125. var ReflectOwnKeys
  34126. if (R && typeof R.ownKeys === 'function') {
  34127. ReflectOwnKeys = R.ownKeys
  34128. } else if (Object.getOwnPropertySymbols) {
  34129. ReflectOwnKeys = function ReflectOwnKeys(target) {
  34130. return Object.getOwnPropertyNames(target)
  34131. .concat(Object.getOwnPropertySymbols(target));
  34132. };
  34133. } else {
  34134. ReflectOwnKeys = function ReflectOwnKeys(target) {
  34135. return Object.getOwnPropertyNames(target);
  34136. };
  34137. }
  34138. function ProcessEmitWarning(warning) {
  34139. if (console && console.warn) console.warn(warning);
  34140. }
  34141. var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
  34142. return value !== value;
  34143. }
  34144. function EventEmitter() {
  34145. EventEmitter.init.call(this);
  34146. }
  34147. module.exports = EventEmitter;
  34148. module.exports.once = once;
  34149. // Backwards-compat with node 0.10.x
  34150. EventEmitter.EventEmitter = EventEmitter;
  34151. EventEmitter.prototype._events = undefined;
  34152. EventEmitter.prototype._eventsCount = 0;
  34153. EventEmitter.prototype._maxListeners = undefined;
  34154. // By default EventEmitters will print a warning if more than 10 listeners are
  34155. // added to it. This is a useful default which helps finding memory leaks.
  34156. var defaultMaxListeners = 10;
  34157. function checkListener(listener) {
  34158. if (typeof listener !== 'function') {
  34159. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  34160. }
  34161. }
  34162. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  34163. enumerable: true,
  34164. get: function() {
  34165. return defaultMaxListeners;
  34166. },
  34167. set: function(arg) {
  34168. if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
  34169. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
  34170. }
  34171. defaultMaxListeners = arg;
  34172. }
  34173. });
  34174. EventEmitter.init = function() {
  34175. if (this._events === undefined ||
  34176. this._events === Object.getPrototypeOf(this)._events) {
  34177. this._events = Object.create(null);
  34178. this._eventsCount = 0;
  34179. }
  34180. this._maxListeners = this._maxListeners || undefined;
  34181. };
  34182. // Obviously not all Emitters should be limited to 10. This function allows
  34183. // that to be increased. Set to zero for unlimited.
  34184. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  34185. if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
  34186. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
  34187. }
  34188. this._maxListeners = n;
  34189. return this;
  34190. };
  34191. function _getMaxListeners(that) {
  34192. if (that._maxListeners === undefined)
  34193. return EventEmitter.defaultMaxListeners;
  34194. return that._maxListeners;
  34195. }
  34196. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  34197. return _getMaxListeners(this);
  34198. };
  34199. EventEmitter.prototype.emit = function emit(type) {
  34200. var args = [];
  34201. for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
  34202. var doError = (type === 'error');
  34203. var events = this._events;
  34204. if (events !== undefined)
  34205. doError = (doError && events.error === undefined);
  34206. else if (!doError)
  34207. return false;
  34208. // If there is no 'error' event listener then throw.
  34209. if (doError) {
  34210. var er;
  34211. if (args.length > 0)
  34212. er = args[0];
  34213. if (er instanceof Error) {
  34214. // Note: The comments on the `throw` lines are intentional, they show
  34215. // up in Node's output if this results in an unhandled exception.
  34216. throw er; // Unhandled 'error' event
  34217. }
  34218. // At least give some kind of context to the user
  34219. var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
  34220. err.context = er;
  34221. throw err; // Unhandled 'error' event
  34222. }
  34223. var handler = events[type];
  34224. if (handler === undefined)
  34225. return false;
  34226. if (typeof handler === 'function') {
  34227. ReflectApply(handler, this, args);
  34228. } else {
  34229. var len = handler.length;
  34230. var listeners = arrayClone(handler, len);
  34231. for (var i = 0; i < len; ++i)
  34232. ReflectApply(listeners[i], this, args);
  34233. }
  34234. return true;
  34235. };
  34236. function _addListener(target, type, listener, prepend) {
  34237. var m;
  34238. var events;
  34239. var existing;
  34240. checkListener(listener);
  34241. events = target._events;
  34242. if (events === undefined) {
  34243. events = target._events = Object.create(null);
  34244. target._eventsCount = 0;
  34245. } else {
  34246. // To avoid recursion in the case that type === "newListener"! Before
  34247. // adding it to the listeners, first emit "newListener".
  34248. if (events.newListener !== undefined) {
  34249. target.emit('newListener', type,
  34250. listener.listener ? listener.listener : listener);
  34251. // Re-assign `events` because a newListener handler could have caused the
  34252. // this._events to be assigned to a new object
  34253. events = target._events;
  34254. }
  34255. existing = events[type];
  34256. }
  34257. if (existing === undefined) {
  34258. // Optimize the case of one listener. Don't need the extra array object.
  34259. existing = events[type] = listener;
  34260. ++target._eventsCount;
  34261. } else {
  34262. if (typeof existing === 'function') {
  34263. // Adding the second element, need to change to array.
  34264. existing = events[type] =
  34265. prepend ? [listener, existing] : [existing, listener];
  34266. // If we've already got an array, just append.
  34267. } else if (prepend) {
  34268. existing.unshift(listener);
  34269. } else {
  34270. existing.push(listener);
  34271. }
  34272. // Check for listener leak
  34273. m = _getMaxListeners(target);
  34274. if (m > 0 && existing.length > m && !existing.warned) {
  34275. existing.warned = true;
  34276. // No error code for this since it is a Warning
  34277. // eslint-disable-next-line no-restricted-syntax
  34278. var w = new Error('Possible EventEmitter memory leak detected. ' +
  34279. existing.length + ' ' + String(type) + ' listeners ' +
  34280. 'added. Use emitter.setMaxListeners() to ' +
  34281. 'increase limit');
  34282. w.name = 'MaxListenersExceededWarning';
  34283. w.emitter = target;
  34284. w.type = type;
  34285. w.count = existing.length;
  34286. ProcessEmitWarning(w);
  34287. }
  34288. }
  34289. return target;
  34290. }
  34291. EventEmitter.prototype.addListener = function addListener(type, listener) {
  34292. return _addListener(this, type, listener, false);
  34293. };
  34294. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  34295. EventEmitter.prototype.prependListener =
  34296. function prependListener(type, listener) {
  34297. return _addListener(this, type, listener, true);
  34298. };
  34299. function onceWrapper() {
  34300. if (!this.fired) {
  34301. this.target.removeListener(this.type, this.wrapFn);
  34302. this.fired = true;
  34303. if (arguments.length === 0)
  34304. return this.listener.call(this.target);
  34305. return this.listener.apply(this.target, arguments);
  34306. }
  34307. }
  34308. function _onceWrap(target, type, listener) {
  34309. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  34310. var wrapped = onceWrapper.bind(state);
  34311. wrapped.listener = listener;
  34312. state.wrapFn = wrapped;
  34313. return wrapped;
  34314. }
  34315. EventEmitter.prototype.once = function once(type, listener) {
  34316. checkListener(listener);
  34317. this.on(type, _onceWrap(this, type, listener));
  34318. return this;
  34319. };
  34320. EventEmitter.prototype.prependOnceListener =
  34321. function prependOnceListener(type, listener) {
  34322. checkListener(listener);
  34323. this.prependListener(type, _onceWrap(this, type, listener));
  34324. return this;
  34325. };
  34326. // Emits a 'removeListener' event if and only if the listener was removed.
  34327. EventEmitter.prototype.removeListener =
  34328. function removeListener(type, listener) {
  34329. var list, events, position, i, originalListener;
  34330. checkListener(listener);
  34331. events = this._events;
  34332. if (events === undefined)
  34333. return this;
  34334. list = events[type];
  34335. if (list === undefined)
  34336. return this;
  34337. if (list === listener || list.listener === listener) {
  34338. if (--this._eventsCount === 0)
  34339. this._events = Object.create(null);
  34340. else {
  34341. delete events[type];
  34342. if (events.removeListener)
  34343. this.emit('removeListener', type, list.listener || listener);
  34344. }
  34345. } else if (typeof list !== 'function') {
  34346. position = -1;
  34347. for (i = list.length - 1; i >= 0; i--) {
  34348. if (list[i] === listener || list[i].listener === listener) {
  34349. originalListener = list[i].listener;
  34350. position = i;
  34351. break;
  34352. }
  34353. }
  34354. if (position < 0)
  34355. return this;
  34356. if (position === 0)
  34357. list.shift();
  34358. else {
  34359. spliceOne(list, position);
  34360. }
  34361. if (list.length === 1)
  34362. events[type] = list[0];
  34363. if (events.removeListener !== undefined)
  34364. this.emit('removeListener', type, originalListener || listener);
  34365. }
  34366. return this;
  34367. };
  34368. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  34369. EventEmitter.prototype.removeAllListeners =
  34370. function removeAllListeners(type) {
  34371. var listeners, events, i;
  34372. events = this._events;
  34373. if (events === undefined)
  34374. return this;
  34375. // not listening for removeListener, no need to emit
  34376. if (events.removeListener === undefined) {
  34377. if (arguments.length === 0) {
  34378. this._events = Object.create(null);
  34379. this._eventsCount = 0;
  34380. } else if (events[type] !== undefined) {
  34381. if (--this._eventsCount === 0)
  34382. this._events = Object.create(null);
  34383. else
  34384. delete events[type];
  34385. }
  34386. return this;
  34387. }
  34388. // emit removeListener for all listeners on all events
  34389. if (arguments.length === 0) {
  34390. var keys = Object.keys(events);
  34391. var key;
  34392. for (i = 0; i < keys.length; ++i) {
  34393. key = keys[i];
  34394. if (key === 'removeListener') continue;
  34395. this.removeAllListeners(key);
  34396. }
  34397. this.removeAllListeners('removeListener');
  34398. this._events = Object.create(null);
  34399. this._eventsCount = 0;
  34400. return this;
  34401. }
  34402. listeners = events[type];
  34403. if (typeof listeners === 'function') {
  34404. this.removeListener(type, listeners);
  34405. } else if (listeners !== undefined) {
  34406. // LIFO order
  34407. for (i = listeners.length - 1; i >= 0; i--) {
  34408. this.removeListener(type, listeners[i]);
  34409. }
  34410. }
  34411. return this;
  34412. };
  34413. function _listeners(target, type, unwrap) {
  34414. var events = target._events;
  34415. if (events === undefined)
  34416. return [];
  34417. var evlistener = events[type];
  34418. if (evlistener === undefined)
  34419. return [];
  34420. if (typeof evlistener === 'function')
  34421. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  34422. return unwrap ?
  34423. unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  34424. }
  34425. EventEmitter.prototype.listeners = function listeners(type) {
  34426. return _listeners(this, type, true);
  34427. };
  34428. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  34429. return _listeners(this, type, false);
  34430. };
  34431. EventEmitter.listenerCount = function(emitter, type) {
  34432. if (typeof emitter.listenerCount === 'function') {
  34433. return emitter.listenerCount(type);
  34434. } else {
  34435. return listenerCount.call(emitter, type);
  34436. }
  34437. };
  34438. EventEmitter.prototype.listenerCount = listenerCount;
  34439. function listenerCount(type) {
  34440. var events = this._events;
  34441. if (events !== undefined) {
  34442. var evlistener = events[type];
  34443. if (typeof evlistener === 'function') {
  34444. return 1;
  34445. } else if (evlistener !== undefined) {
  34446. return evlistener.length;
  34447. }
  34448. }
  34449. return 0;
  34450. }
  34451. EventEmitter.prototype.eventNames = function eventNames() {
  34452. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  34453. };
  34454. function arrayClone(arr, n) {
  34455. var copy = new Array(n);
  34456. for (var i = 0; i < n; ++i)
  34457. copy[i] = arr[i];
  34458. return copy;
  34459. }
  34460. function spliceOne(list, index) {
  34461. for (; index + 1 < list.length; index++)
  34462. list[index] = list[index + 1];
  34463. list.pop();
  34464. }
  34465. function unwrapListeners(arr) {
  34466. var ret = new Array(arr.length);
  34467. for (var i = 0; i < ret.length; ++i) {
  34468. ret[i] = arr[i].listener || arr[i];
  34469. }
  34470. return ret;
  34471. }
  34472. function once(emitter, name) {
  34473. return new Promise(function (resolve, reject) {
  34474. function errorListener(err) {
  34475. emitter.removeListener(name, resolver);
  34476. reject(err);
  34477. }
  34478. function resolver() {
  34479. if (typeof emitter.removeListener === 'function') {
  34480. emitter.removeListener('error', errorListener);
  34481. }
  34482. resolve([].slice.call(arguments));
  34483. };
  34484. eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
  34485. if (name !== 'error') {
  34486. addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
  34487. }
  34488. });
  34489. }
  34490. function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
  34491. if (typeof emitter.on === 'function') {
  34492. eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
  34493. }
  34494. }
  34495. function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
  34496. if (typeof emitter.on === 'function') {
  34497. if (flags.once) {
  34498. emitter.once(name, listener);
  34499. } else {
  34500. emitter.on(name, listener);
  34501. }
  34502. } else if (typeof emitter.addEventListener === 'function') {
  34503. // EventTarget does not have `error` event semantics like Node
  34504. // EventEmitters, we do not listen for `error` events here.
  34505. emitter.addEventListener(name, function wrapListener(arg) {
  34506. // IE does not have builtin `{ once: true }` support so we
  34507. // have to do it manually.
  34508. if (flags.once) {
  34509. emitter.removeEventListener(name, wrapListener);
  34510. }
  34511. listener(arg);
  34512. });
  34513. } else {
  34514. throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
  34515. }
  34516. }
  34517. /***/ }),
  34518. /* 128 */
  34519. /*!*****************************************************************************!*\
  34520. !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!
  34521. \*****************************************************************************/
  34522. /*! no static exports found */
  34523. /***/ (function(module, exports, __webpack_require__) {
  34524. module.exports = __webpack_require__(/*! events */ 127).EventEmitter;
  34525. /***/ }),
  34526. /* 129 */
  34527. /*!***********************************************!*\
  34528. !*** ./node_modules/core-util-is/lib/util.js ***!
  34529. \***********************************************/
  34530. /*! no static exports found */
  34531. /***/ (function(module, exports, __webpack_require__) {
  34532. // Copyright Joyent, Inc. and other Node contributors.
  34533. //
  34534. // Permission is hereby granted, free of charge, to any person obtaining a
  34535. // copy of this software and associated documentation files (the
  34536. // "Software"), to deal in the Software without restriction, including
  34537. // without limitation the rights to use, copy, modify, merge, publish,
  34538. // distribute, sublicense, and/or sell copies of the Software, and to permit
  34539. // persons to whom the Software is furnished to do so, subject to the
  34540. // following conditions:
  34541. //
  34542. // The above copyright notice and this permission notice shall be included
  34543. // in all copies or substantial portions of the Software.
  34544. //
  34545. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  34546. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  34547. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  34548. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  34549. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  34550. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  34551. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  34552. // NOTE: These type checking functions intentionally don't use `instanceof`
  34553. // because it is fragile and can be easily faked with `Object.create()`.
  34554. function isArray(arg) {
  34555. if (Array.isArray) {
  34556. return Array.isArray(arg);
  34557. }
  34558. return objectToString(arg) === '[object Array]';
  34559. }
  34560. exports.isArray = isArray;
  34561. function isBoolean(arg) {
  34562. return typeof arg === 'boolean';
  34563. }
  34564. exports.isBoolean = isBoolean;
  34565. function isNull(arg) {
  34566. return arg === null;
  34567. }
  34568. exports.isNull = isNull;
  34569. function isNullOrUndefined(arg) {
  34570. return arg == null;
  34571. }
  34572. exports.isNullOrUndefined = isNullOrUndefined;
  34573. function isNumber(arg) {
  34574. return typeof arg === 'number';
  34575. }
  34576. exports.isNumber = isNumber;
  34577. function isString(arg) {
  34578. return typeof arg === 'string';
  34579. }
  34580. exports.isString = isString;
  34581. function isSymbol(arg) {
  34582. return typeof arg === 'symbol';
  34583. }
  34584. exports.isSymbol = isSymbol;
  34585. function isUndefined(arg) {
  34586. return arg === void 0;
  34587. }
  34588. exports.isUndefined = isUndefined;
  34589. function isRegExp(re) {
  34590. return objectToString(re) === '[object RegExp]';
  34591. }
  34592. exports.isRegExp = isRegExp;
  34593. function isObject(arg) {
  34594. return typeof arg === 'object' && arg !== null;
  34595. }
  34596. exports.isObject = isObject;
  34597. function isDate(d) {
  34598. return objectToString(d) === '[object Date]';
  34599. }
  34600. exports.isDate = isDate;
  34601. function isError(e) {
  34602. return (objectToString(e) === '[object Error]' || e instanceof Error);
  34603. }
  34604. exports.isError = isError;
  34605. function isFunction(arg) {
  34606. return typeof arg === 'function';
  34607. }
  34608. exports.isFunction = isFunction;
  34609. function isPrimitive(arg) {
  34610. return arg === null ||
  34611. typeof arg === 'boolean' ||
  34612. typeof arg === 'number' ||
  34613. typeof arg === 'string' ||
  34614. typeof arg === 'symbol' || // ES6 symbol
  34615. typeof arg === 'undefined';
  34616. }
  34617. exports.isPrimitive = isPrimitive;
  34618. exports.isBuffer = __webpack_require__(/*! buffer */ 116).Buffer.isBuffer;
  34619. function objectToString(o) {
  34620. return Object.prototype.toString.call(o);
  34621. }
  34622. /***/ }),
  34623. /* 130 */
  34624. /*!**********************!*\
  34625. !*** util (ignored) ***!
  34626. \**********************/
  34627. /*! no static exports found */
  34628. /***/ (function(module, exports) {
  34629. /* (ignored) */
  34630. /***/ }),
  34631. /* 131 */
  34632. /*!*************************************************************************!*\
  34633. !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***!
  34634. \*************************************************************************/
  34635. /*! no static exports found */
  34636. /***/ (function(module, exports, __webpack_require__) {
  34637. "use strict";
  34638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  34639. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
  34640. var util = __webpack_require__(/*! util */ 132);
  34641. function copyBuffer(src, target, offset) {
  34642. src.copy(target, offset);
  34643. }
  34644. module.exports = function () {
  34645. function BufferList() {
  34646. _classCallCheck(this, BufferList);
  34647. this.head = null;
  34648. this.tail = null;
  34649. this.length = 0;
  34650. }
  34651. BufferList.prototype.push = function push(v) {
  34652. var entry = { data: v, next: null };
  34653. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  34654. this.tail = entry;
  34655. ++this.length;
  34656. };
  34657. BufferList.prototype.unshift = function unshift(v) {
  34658. var entry = { data: v, next: this.head };
  34659. if (this.length === 0) this.tail = entry;
  34660. this.head = entry;
  34661. ++this.length;
  34662. };
  34663. BufferList.prototype.shift = function shift() {
  34664. if (this.length === 0) return;
  34665. var ret = this.head.data;
  34666. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  34667. --this.length;
  34668. return ret;
  34669. };
  34670. BufferList.prototype.clear = function clear() {
  34671. this.head = this.tail = null;
  34672. this.length = 0;
  34673. };
  34674. BufferList.prototype.join = function join(s) {
  34675. if (this.length === 0) return '';
  34676. var p = this.head;
  34677. var ret = '' + p.data;
  34678. while (p = p.next) {
  34679. ret += s + p.data;
  34680. }return ret;
  34681. };
  34682. BufferList.prototype.concat = function concat(n) {
  34683. if (this.length === 0) return Buffer.alloc(0);
  34684. if (this.length === 1) return this.head.data;
  34685. var ret = Buffer.allocUnsafe(n >>> 0);
  34686. var p = this.head;
  34687. var i = 0;
  34688. while (p) {
  34689. copyBuffer(p.data, ret, i);
  34690. i += p.data.length;
  34691. p = p.next;
  34692. }
  34693. return ret;
  34694. };
  34695. return BufferList;
  34696. }();
  34697. if (util && util.inspect && util.inspect.custom) {
  34698. module.exports.prototype[util.inspect.custom] = function () {
  34699. var obj = util.inspect({ length: this.length });
  34700. return this.constructor.name + ' ' + obj;
  34701. };
  34702. }
  34703. /***/ }),
  34704. /* 132 */
  34705. /*!**********************!*\
  34706. !*** util (ignored) ***!
  34707. \**********************/
  34708. /*! no static exports found */
  34709. /***/ (function(module, exports) {
  34710. /* (ignored) */
  34711. /***/ }),
  34712. /* 133 */
  34713. /*!**********************************************************************!*\
  34714. !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!
  34715. \**********************************************************************/
  34716. /*! no static exports found */
  34717. /***/ (function(module, exports, __webpack_require__) {
  34718. "use strict";
  34719. /*<replacement>*/
  34720. var pna = __webpack_require__(/*! process-nextick-args */ 126);
  34721. /*</replacement>*/
  34722. // undocumented cb() API, needed for core, not for public API
  34723. function destroy(err, cb) {
  34724. var _this = this;
  34725. var readableDestroyed = this._readableState && this._readableState.destroyed;
  34726. var writableDestroyed = this._writableState && this._writableState.destroyed;
  34727. if (readableDestroyed || writableDestroyed) {
  34728. if (cb) {
  34729. cb(err);
  34730. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  34731. pna.nextTick(emitErrorNT, this, err);
  34732. }
  34733. return this;
  34734. }
  34735. // we set destroyed to true before firing error callbacks in order
  34736. // to make it re-entrance safe in case destroy() is called within callbacks
  34737. if (this._readableState) {
  34738. this._readableState.destroyed = true;
  34739. }
  34740. // if this is a duplex stream mark the writable part as destroyed as well
  34741. if (this._writableState) {
  34742. this._writableState.destroyed = true;
  34743. }
  34744. this._destroy(err || null, function (err) {
  34745. if (!cb && err) {
  34746. pna.nextTick(emitErrorNT, _this, err);
  34747. if (_this._writableState) {
  34748. _this._writableState.errorEmitted = true;
  34749. }
  34750. } else if (cb) {
  34751. cb(err);
  34752. }
  34753. });
  34754. return this;
  34755. }
  34756. function undestroy() {
  34757. if (this._readableState) {
  34758. this._readableState.destroyed = false;
  34759. this._readableState.reading = false;
  34760. this._readableState.ended = false;
  34761. this._readableState.endEmitted = false;
  34762. }
  34763. if (this._writableState) {
  34764. this._writableState.destroyed = false;
  34765. this._writableState.ended = false;
  34766. this._writableState.ending = false;
  34767. this._writableState.finished = false;
  34768. this._writableState.errorEmitted = false;
  34769. }
  34770. }
  34771. function emitErrorNT(self, err) {
  34772. self.emit('error', err);
  34773. }
  34774. module.exports = {
  34775. destroy: destroy,
  34776. undestroy: undestroy
  34777. };
  34778. /***/ }),
  34779. /* 134 */
  34780. /*!************************************************************!*\
  34781. !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!
  34782. \************************************************************/
  34783. /*! no static exports found */
  34784. /***/ (function(module, exports, __webpack_require__) {
  34785. "use strict";
  34786. // Copyright Joyent, Inc. and other Node contributors.
  34787. //
  34788. // Permission is hereby granted, free of charge, to any person obtaining a
  34789. // copy of this software and associated documentation files (the
  34790. // "Software"), to deal in the Software without restriction, including
  34791. // without limitation the rights to use, copy, modify, merge, publish,
  34792. // distribute, sublicense, and/or sell copies of the Software, and to permit
  34793. // persons to whom the Software is furnished to do so, subject to the
  34794. // following conditions:
  34795. //
  34796. // The above copyright notice and this permission notice shall be included
  34797. // in all copies or substantial portions of the Software.
  34798. //
  34799. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  34800. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  34801. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  34802. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  34803. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  34804. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  34805. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  34806. // a duplex stream is just a stream that is both readable and writable.
  34807. // Since JS doesn't have multiple prototypal inheritance, this class
  34808. // prototypally inherits from Readable, and then parasitically from
  34809. // Writable.
  34810. /*<replacement>*/
  34811. var pna = __webpack_require__(/*! process-nextick-args */ 126);
  34812. /*</replacement>*/
  34813. /*<replacement>*/
  34814. var objectKeys = Object.keys || function (obj) {
  34815. var keys = [];
  34816. for (var key in obj) {
  34817. keys.push(key);
  34818. }return keys;
  34819. };
  34820. /*</replacement>*/
  34821. module.exports = Duplex;
  34822. /*<replacement>*/
  34823. var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
  34824. util.inherits = __webpack_require__(/*! inherits */ 121);
  34825. /*</replacement>*/
  34826. var Readable = __webpack_require__(/*! ./_stream_readable */ 125);
  34827. var Writable = __webpack_require__(/*! ./_stream_writable */ 135);
  34828. util.inherits(Duplex, Readable);
  34829. {
  34830. // avoid scope creep, the keys array can then be collected
  34831. var keys = objectKeys(Writable.prototype);
  34832. for (var v = 0; v < keys.length; v++) {
  34833. var method = keys[v];
  34834. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  34835. }
  34836. }
  34837. function Duplex(options) {
  34838. if (!(this instanceof Duplex)) return new Duplex(options);
  34839. Readable.call(this, options);
  34840. Writable.call(this, options);
  34841. if (options && options.readable === false) this.readable = false;
  34842. if (options && options.writable === false) this.writable = false;
  34843. this.allowHalfOpen = true;
  34844. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  34845. this.once('end', onend);
  34846. }
  34847. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  34848. // making it explicit this property is not enumerable
  34849. // because otherwise some prototype manipulation in
  34850. // userland will fail
  34851. enumerable: false,
  34852. get: function () {
  34853. return this._writableState.highWaterMark;
  34854. }
  34855. });
  34856. // the no-half-open enforcer
  34857. function onend() {
  34858. // if we allow half-open state, or if the writable side ended,
  34859. // then we're ok.
  34860. if (this.allowHalfOpen || this._writableState.ended) return;
  34861. // no more data can be written.
  34862. // But allow more writes to happen in this tick.
  34863. pna.nextTick(onEndNT, this);
  34864. }
  34865. function onEndNT(self) {
  34866. self.end();
  34867. }
  34868. Object.defineProperty(Duplex.prototype, 'destroyed', {
  34869. get: function () {
  34870. if (this._readableState === undefined || this._writableState === undefined) {
  34871. return false;
  34872. }
  34873. return this._readableState.destroyed && this._writableState.destroyed;
  34874. },
  34875. set: function (value) {
  34876. // we ignore the value if the stream
  34877. // has not been initialized yet
  34878. if (this._readableState === undefined || this._writableState === undefined) {
  34879. return;
  34880. }
  34881. // backward compatibility, the user is explicitly
  34882. // managing destroyed
  34883. this._readableState.destroyed = value;
  34884. this._writableState.destroyed = value;
  34885. }
  34886. });
  34887. Duplex.prototype._destroy = function (err, cb) {
  34888. this.push(null);
  34889. this.end();
  34890. pna.nextTick(cb, err);
  34891. };
  34892. /***/ }),
  34893. /* 135 */
  34894. /*!**************************************************************!*\
  34895. !*** ./node_modules/readable-stream/lib/_stream_writable.js ***!
  34896. \**************************************************************/
  34897. /*! no static exports found */
  34898. /***/ (function(module, exports, __webpack_require__) {
  34899. "use strict";
  34900. /* WEBPACK VAR INJECTION */(function(process, global) {// Copyright Joyent, Inc. and other Node contributors.
  34901. //
  34902. // Permission is hereby granted, free of charge, to any person obtaining a
  34903. // copy of this software and associated documentation files (the
  34904. // "Software"), to deal in the Software without restriction, including
  34905. // without limitation the rights to use, copy, modify, merge, publish,
  34906. // distribute, sublicense, and/or sell copies of the Software, and to permit
  34907. // persons to whom the Software is furnished to do so, subject to the
  34908. // following conditions:
  34909. //
  34910. // The above copyright notice and this permission notice shall be included
  34911. // in all copies or substantial portions of the Software.
  34912. //
  34913. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  34914. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  34915. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  34916. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  34917. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  34918. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  34919. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  34920. // A bit simpler than readable streams.
  34921. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  34922. // the drain event emission and buffering.
  34923. /*<replacement>*/
  34924. var pna = __webpack_require__(/*! process-nextick-args */ 126);
  34925. /*</replacement>*/
  34926. module.exports = Writable;
  34927. /* <replacement> */
  34928. function WriteReq(chunk, encoding, cb) {
  34929. this.chunk = chunk;
  34930. this.encoding = encoding;
  34931. this.callback = cb;
  34932. this.next = null;
  34933. }
  34934. // It seems a linked list but it is not
  34935. // there will be only 2 of these for each stream
  34936. function CorkedRequest(state) {
  34937. var _this = this;
  34938. this.next = null;
  34939. this.entry = null;
  34940. this.finish = function () {
  34941. onCorkedFinish(_this, state);
  34942. };
  34943. }
  34944. /* </replacement> */
  34945. /*<replacement>*/
  34946. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  34947. /*</replacement>*/
  34948. /*<replacement>*/
  34949. var Duplex;
  34950. /*</replacement>*/
  34951. Writable.WritableState = WritableState;
  34952. /*<replacement>*/
  34953. var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
  34954. util.inherits = __webpack_require__(/*! inherits */ 121);
  34955. /*</replacement>*/
  34956. /*<replacement>*/
  34957. var internalUtil = {
  34958. deprecate: __webpack_require__(/*! util-deprecate */ 136)
  34959. };
  34960. /*</replacement>*/
  34961. /*<replacement>*/
  34962. var Stream = __webpack_require__(/*! ./internal/streams/stream */ 128);
  34963. /*</replacement>*/
  34964. /*<replacement>*/
  34965. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
  34966. var OurUint8Array = global.Uint8Array || function () {};
  34967. function _uint8ArrayToBuffer(chunk) {
  34968. return Buffer.from(chunk);
  34969. }
  34970. function _isUint8Array(obj) {
  34971. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  34972. }
  34973. /*</replacement>*/
  34974. var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 133);
  34975. util.inherits(Writable, Stream);
  34976. function nop() {}
  34977. function WritableState(options, stream) {
  34978. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
  34979. options = options || {};
  34980. // Duplex streams are both readable and writable, but share
  34981. // the same options object.
  34982. // However, some cases require setting options to different
  34983. // values for the readable and the writable sides of the duplex stream.
  34984. // These options can be provided separately as readableXXX and writableXXX.
  34985. var isDuplex = stream instanceof Duplex;
  34986. // object stream flag to indicate whether or not this stream
  34987. // contains buffers or objects.
  34988. this.objectMode = !!options.objectMode;
  34989. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  34990. // the point at which write() starts returning false
  34991. // Note: 0 is a valid value, means that we always return false if
  34992. // the entire buffer is not flushed immediately on write()
  34993. var hwm = options.highWaterMark;
  34994. var writableHwm = options.writableHighWaterMark;
  34995. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  34996. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  34997. // cast to ints.
  34998. this.highWaterMark = Math.floor(this.highWaterMark);
  34999. // if _final has been called
  35000. this.finalCalled = false;
  35001. // drain event flag.
  35002. this.needDrain = false;
  35003. // at the start of calling end()
  35004. this.ending = false;
  35005. // when end() has been called, and returned
  35006. this.ended = false;
  35007. // when 'finish' is emitted
  35008. this.finished = false;
  35009. // has it been destroyed
  35010. this.destroyed = false;
  35011. // should we decode strings into buffers before passing to _write?
  35012. // this is here so that some node-core streams can optimize string
  35013. // handling at a lower level.
  35014. var noDecode = options.decodeStrings === false;
  35015. this.decodeStrings = !noDecode;
  35016. // Crypto is kind of old and crusty. Historically, its default string
  35017. // encoding is 'binary' so we have to make this configurable.
  35018. // Everything else in the universe uses 'utf8', though.
  35019. this.defaultEncoding = options.defaultEncoding || 'utf8';
  35020. // not an actual buffer we keep track of, but a measurement
  35021. // of how much we're waiting to get pushed to some underlying
  35022. // socket or file.
  35023. this.length = 0;
  35024. // a flag to see when we're in the middle of a write.
  35025. this.writing = false;
  35026. // when true all writes will be buffered until .uncork() call
  35027. this.corked = 0;
  35028. // a flag to be able to tell if the onwrite cb is called immediately,
  35029. // or on a later tick. We set this to true at first, because any
  35030. // actions that shouldn't happen until "later" should generally also
  35031. // not happen before the first write call.
  35032. this.sync = true;
  35033. // a flag to know if we're processing previously buffered items, which
  35034. // may call the _write() callback in the same tick, so that we don't
  35035. // end up in an overlapped onwrite situation.
  35036. this.bufferProcessing = false;
  35037. // the callback that's passed to _write(chunk,cb)
  35038. this.onwrite = function (er) {
  35039. onwrite(stream, er);
  35040. };
  35041. // the callback that the user supplies to write(chunk,encoding,cb)
  35042. this.writecb = null;
  35043. // the amount that is being written when _write is called.
  35044. this.writelen = 0;
  35045. this.bufferedRequest = null;
  35046. this.lastBufferedRequest = null;
  35047. // number of pending user-supplied write callbacks
  35048. // this must be 0 before 'finish' can be emitted
  35049. this.pendingcb = 0;
  35050. // emit prefinish if the only thing we're waiting for is _write cbs
  35051. // This is relevant for synchronous Transform streams
  35052. this.prefinished = false;
  35053. // True if the error was already emitted and should not be thrown again
  35054. this.errorEmitted = false;
  35055. // count buffered requests
  35056. this.bufferedRequestCount = 0;
  35057. // allocate the first CorkedRequest, there is always
  35058. // one allocated and free to use, and we maintain at most two
  35059. this.corkedRequestsFree = new CorkedRequest(this);
  35060. }
  35061. WritableState.prototype.getBuffer = function getBuffer() {
  35062. var current = this.bufferedRequest;
  35063. var out = [];
  35064. while (current) {
  35065. out.push(current);
  35066. current = current.next;
  35067. }
  35068. return out;
  35069. };
  35070. (function () {
  35071. try {
  35072. Object.defineProperty(WritableState.prototype, 'buffer', {
  35073. get: internalUtil.deprecate(function () {
  35074. return this.getBuffer();
  35075. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  35076. });
  35077. } catch (_) {}
  35078. })();
  35079. // Test _writableState for inheritance to account for Duplex streams,
  35080. // whose prototype chain only points to Readable.
  35081. var realHasInstance;
  35082. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  35083. realHasInstance = Function.prototype[Symbol.hasInstance];
  35084. Object.defineProperty(Writable, Symbol.hasInstance, {
  35085. value: function (object) {
  35086. if (realHasInstance.call(this, object)) return true;
  35087. if (this !== Writable) return false;
  35088. return object && object._writableState instanceof WritableState;
  35089. }
  35090. });
  35091. } else {
  35092. realHasInstance = function (object) {
  35093. return object instanceof this;
  35094. };
  35095. }
  35096. function Writable(options) {
  35097. Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 134);
  35098. // Writable ctor is applied to Duplexes, too.
  35099. // `realHasInstance` is necessary because using plain `instanceof`
  35100. // would return false, as no `_writableState` property is attached.
  35101. // Trying to use the custom `instanceof` for Writable here will also break the
  35102. // Node.js LazyTransform implementation, which has a non-trivial getter for
  35103. // `_writableState` that would lead to infinite recursion.
  35104. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  35105. return new Writable(options);
  35106. }
  35107. this._writableState = new WritableState(options, this);
  35108. // legacy.
  35109. this.writable = true;
  35110. if (options) {
  35111. if (typeof options.write === 'function') this._write = options.write;
  35112. if (typeof options.writev === 'function') this._writev = options.writev;
  35113. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  35114. if (typeof options.final === 'function') this._final = options.final;
  35115. }
  35116. Stream.call(this);
  35117. }
  35118. // Otherwise people can pipe Writable streams, which is just wrong.
  35119. Writable.prototype.pipe = function () {
  35120. this.emit('error', new Error('Cannot pipe, not readable'));
  35121. };
  35122. function writeAfterEnd(stream, cb) {
  35123. var er = new Error('write after end');
  35124. // TODO: defer error events consistently everywhere, not just the cb
  35125. stream.emit('error', er);
  35126. pna.nextTick(cb, er);
  35127. }
  35128. // Checks that a user-supplied chunk is valid, especially for the particular
  35129. // mode the stream is in. Currently this means that `null` is never accepted
  35130. // and undefined/non-string values are only allowed in object mode.
  35131. function validChunk(stream, state, chunk, cb) {
  35132. var valid = true;
  35133. var er = false;
  35134. if (chunk === null) {
  35135. er = new TypeError('May not write null values to stream');
  35136. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  35137. er = new TypeError('Invalid non-string/buffer chunk');
  35138. }
  35139. if (er) {
  35140. stream.emit('error', er);
  35141. pna.nextTick(cb, er);
  35142. valid = false;
  35143. }
  35144. return valid;
  35145. }
  35146. Writable.prototype.write = function (chunk, encoding, cb) {
  35147. var state = this._writableState;
  35148. var ret = false;
  35149. var isBuf = !state.objectMode && _isUint8Array(chunk);
  35150. if (isBuf && !Buffer.isBuffer(chunk)) {
  35151. chunk = _uint8ArrayToBuffer(chunk);
  35152. }
  35153. if (typeof encoding === 'function') {
  35154. cb = encoding;
  35155. encoding = null;
  35156. }
  35157. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  35158. if (typeof cb !== 'function') cb = nop;
  35159. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  35160. state.pendingcb++;
  35161. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  35162. }
  35163. return ret;
  35164. };
  35165. Writable.prototype.cork = function () {
  35166. var state = this._writableState;
  35167. state.corked++;
  35168. };
  35169. Writable.prototype.uncork = function () {
  35170. var state = this._writableState;
  35171. if (state.corked) {
  35172. state.corked--;
  35173. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  35174. }
  35175. };
  35176. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  35177. // node::ParseEncoding() requires lower case.
  35178. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  35179. 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);
  35180. this._writableState.defaultEncoding = encoding;
  35181. return this;
  35182. };
  35183. function decodeChunk(state, chunk, encoding) {
  35184. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  35185. chunk = Buffer.from(chunk, encoding);
  35186. }
  35187. return chunk;
  35188. }
  35189. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  35190. // making it explicit this property is not enumerable
  35191. // because otherwise some prototype manipulation in
  35192. // userland will fail
  35193. enumerable: false,
  35194. get: function () {
  35195. return this._writableState.highWaterMark;
  35196. }
  35197. });
  35198. // if we're already writing something, then just put this
  35199. // in the queue, and wait our turn. Otherwise, call _write
  35200. // If we return false, then we need a drain event, so set that flag.
  35201. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  35202. if (!isBuf) {
  35203. var newChunk = decodeChunk(state, chunk, encoding);
  35204. if (chunk !== newChunk) {
  35205. isBuf = true;
  35206. encoding = 'buffer';
  35207. chunk = newChunk;
  35208. }
  35209. }
  35210. var len = state.objectMode ? 1 : chunk.length;
  35211. state.length += len;
  35212. var ret = state.length < state.highWaterMark;
  35213. // we must ensure that previous needDrain will not be reset to false.
  35214. if (!ret) state.needDrain = true;
  35215. if (state.writing || state.corked) {
  35216. var last = state.lastBufferedRequest;
  35217. state.lastBufferedRequest = {
  35218. chunk: chunk,
  35219. encoding: encoding,
  35220. isBuf: isBuf,
  35221. callback: cb,
  35222. next: null
  35223. };
  35224. if (last) {
  35225. last.next = state.lastBufferedRequest;
  35226. } else {
  35227. state.bufferedRequest = state.lastBufferedRequest;
  35228. }
  35229. state.bufferedRequestCount += 1;
  35230. } else {
  35231. doWrite(stream, state, false, len, chunk, encoding, cb);
  35232. }
  35233. return ret;
  35234. }
  35235. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  35236. state.writelen = len;
  35237. state.writecb = cb;
  35238. state.writing = true;
  35239. state.sync = true;
  35240. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  35241. state.sync = false;
  35242. }
  35243. function onwriteError(stream, state, sync, er, cb) {
  35244. --state.pendingcb;
  35245. if (sync) {
  35246. // defer the callback if we are being called synchronously
  35247. // to avoid piling up things on the stack
  35248. pna.nextTick(cb, er);
  35249. // this can emit finish, and it will always happen
  35250. // after error
  35251. pna.nextTick(finishMaybe, stream, state);
  35252. stream._writableState.errorEmitted = true;
  35253. stream.emit('error', er);
  35254. } else {
  35255. // the caller expect this to happen before if
  35256. // it is async
  35257. cb(er);
  35258. stream._writableState.errorEmitted = true;
  35259. stream.emit('error', er);
  35260. // this can emit finish, but finish must
  35261. // always follow error
  35262. finishMaybe(stream, state);
  35263. }
  35264. }
  35265. function onwriteStateUpdate(state) {
  35266. state.writing = false;
  35267. state.writecb = null;
  35268. state.length -= state.writelen;
  35269. state.writelen = 0;
  35270. }
  35271. function onwrite(stream, er) {
  35272. var state = stream._writableState;
  35273. var sync = state.sync;
  35274. var cb = state.writecb;
  35275. onwriteStateUpdate(state);
  35276. if (er) onwriteError(stream, state, sync, er, cb);else {
  35277. // Check if we're actually ready to finish, but don't emit yet
  35278. var finished = needFinish(state);
  35279. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  35280. clearBuffer(stream, state);
  35281. }
  35282. if (sync) {
  35283. /*<replacement>*/
  35284. asyncWrite(afterWrite, stream, state, finished, cb);
  35285. /*</replacement>*/
  35286. } else {
  35287. afterWrite(stream, state, finished, cb);
  35288. }
  35289. }
  35290. }
  35291. function afterWrite(stream, state, finished, cb) {
  35292. if (!finished) onwriteDrain(stream, state);
  35293. state.pendingcb--;
  35294. cb();
  35295. finishMaybe(stream, state);
  35296. }
  35297. // Must force callback to be called on nextTick, so that we don't
  35298. // emit 'drain' before the write() consumer gets the 'false' return
  35299. // value, and has a chance to attach a 'drain' listener.
  35300. function onwriteDrain(stream, state) {
  35301. if (state.length === 0 && state.needDrain) {
  35302. state.needDrain = false;
  35303. stream.emit('drain');
  35304. }
  35305. }
  35306. // if there's something in the buffer waiting, then process it
  35307. function clearBuffer(stream, state) {
  35308. state.bufferProcessing = true;
  35309. var entry = state.bufferedRequest;
  35310. if (stream._writev && entry && entry.next) {
  35311. // Fast case, write everything using _writev()
  35312. var l = state.bufferedRequestCount;
  35313. var buffer = new Array(l);
  35314. var holder = state.corkedRequestsFree;
  35315. holder.entry = entry;
  35316. var count = 0;
  35317. var allBuffers = true;
  35318. while (entry) {
  35319. buffer[count] = entry;
  35320. if (!entry.isBuf) allBuffers = false;
  35321. entry = entry.next;
  35322. count += 1;
  35323. }
  35324. buffer.allBuffers = allBuffers;
  35325. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  35326. // doWrite is almost always async, defer these to save a bit of time
  35327. // as the hot path ends with doWrite
  35328. state.pendingcb++;
  35329. state.lastBufferedRequest = null;
  35330. if (holder.next) {
  35331. state.corkedRequestsFree = holder.next;
  35332. holder.next = null;
  35333. } else {
  35334. state.corkedRequestsFree = new CorkedRequest(state);
  35335. }
  35336. state.bufferedRequestCount = 0;
  35337. } else {
  35338. // Slow case, write chunks one-by-one
  35339. while (entry) {
  35340. var chunk = entry.chunk;
  35341. var encoding = entry.encoding;
  35342. var cb = entry.callback;
  35343. var len = state.objectMode ? 1 : chunk.length;
  35344. doWrite(stream, state, false, len, chunk, encoding, cb);
  35345. entry = entry.next;
  35346. state.bufferedRequestCount--;
  35347. // if we didn't call the onwrite immediately, then
  35348. // it means that we need to wait until it does.
  35349. // also, that means that the chunk and cb are currently
  35350. // being processed, so move the buffer counter past them.
  35351. if (state.writing) {
  35352. break;
  35353. }
  35354. }
  35355. if (entry === null) state.lastBufferedRequest = null;
  35356. }
  35357. state.bufferedRequest = entry;
  35358. state.bufferProcessing = false;
  35359. }
  35360. Writable.prototype._write = function (chunk, encoding, cb) {
  35361. cb(new Error('_write() is not implemented'));
  35362. };
  35363. Writable.prototype._writev = null;
  35364. Writable.prototype.end = function (chunk, encoding, cb) {
  35365. var state = this._writableState;
  35366. if (typeof chunk === 'function') {
  35367. cb = chunk;
  35368. chunk = null;
  35369. encoding = null;
  35370. } else if (typeof encoding === 'function') {
  35371. cb = encoding;
  35372. encoding = null;
  35373. }
  35374. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  35375. // .end() fully uncorks
  35376. if (state.corked) {
  35377. state.corked = 1;
  35378. this.uncork();
  35379. }
  35380. // ignore unnecessary end() calls.
  35381. if (!state.ending && !state.finished) endWritable(this, state, cb);
  35382. };
  35383. function needFinish(state) {
  35384. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  35385. }
  35386. function callFinal(stream, state) {
  35387. stream._final(function (err) {
  35388. state.pendingcb--;
  35389. if (err) {
  35390. stream.emit('error', err);
  35391. }
  35392. state.prefinished = true;
  35393. stream.emit('prefinish');
  35394. finishMaybe(stream, state);
  35395. });
  35396. }
  35397. function prefinish(stream, state) {
  35398. if (!state.prefinished && !state.finalCalled) {
  35399. if (typeof stream._final === 'function') {
  35400. state.pendingcb++;
  35401. state.finalCalled = true;
  35402. pna.nextTick(callFinal, stream, state);
  35403. } else {
  35404. state.prefinished = true;
  35405. stream.emit('prefinish');
  35406. }
  35407. }
  35408. }
  35409. function finishMaybe(stream, state) {
  35410. var need = needFinish(state);
  35411. if (need) {
  35412. prefinish(stream, state);
  35413. if (state.pendingcb === 0) {
  35414. state.finished = true;
  35415. stream.emit('finish');
  35416. }
  35417. }
  35418. return need;
  35419. }
  35420. function endWritable(stream, state, cb) {
  35421. state.ending = true;
  35422. finishMaybe(stream, state);
  35423. if (cb) {
  35424. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  35425. }
  35426. state.ended = true;
  35427. stream.writable = false;
  35428. }
  35429. function onCorkedFinish(corkReq, state, err) {
  35430. var entry = corkReq.entry;
  35431. corkReq.entry = null;
  35432. while (entry) {
  35433. var cb = entry.callback;
  35434. state.pendingcb--;
  35435. cb(err);
  35436. entry = entry.next;
  35437. }
  35438. if (state.corkedRequestsFree) {
  35439. state.corkedRequestsFree.next = corkReq;
  35440. } else {
  35441. state.corkedRequestsFree = corkReq;
  35442. }
  35443. }
  35444. Object.defineProperty(Writable.prototype, 'destroyed', {
  35445. get: function () {
  35446. if (this._writableState === undefined) {
  35447. return false;
  35448. }
  35449. return this._writableState.destroyed;
  35450. },
  35451. set: function (value) {
  35452. // we ignore the value if the stream
  35453. // has not been initialized yet
  35454. if (!this._writableState) {
  35455. return;
  35456. }
  35457. // backward compatibility, the user is explicitly
  35458. // managing destroyed
  35459. this._writableState.destroyed = value;
  35460. }
  35461. });
  35462. Writable.prototype.destroy = destroyImpl.destroy;
  35463. Writable.prototype._undestroy = destroyImpl.undestroy;
  35464. Writable.prototype._destroy = function (err, cb) {
  35465. this.end();
  35466. cb(err);
  35467. };
  35468. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 113), __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3)))
  35469. /***/ }),
  35470. /* 136 */
  35471. /*!************************************************!*\
  35472. !*** ./node_modules/util-deprecate/browser.js ***!
  35473. \************************************************/
  35474. /*! no static exports found */
  35475. /***/ (function(module, exports, __webpack_require__) {
  35476. /* WEBPACK VAR INJECTION */(function(global) {
  35477. /**
  35478. * Module exports.
  35479. */
  35480. module.exports = deprecate;
  35481. /**
  35482. * Mark that a method should not be used.
  35483. * Returns a modified function which warns once by default.
  35484. *
  35485. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  35486. *
  35487. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  35488. * will throw an Error when invoked.
  35489. *
  35490. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  35491. * will invoke `console.trace()` instead of `console.error()`.
  35492. *
  35493. * @param {Function} fn - the function to deprecate
  35494. * @param {String} msg - the string to print to the console when `fn` is invoked
  35495. * @returns {Function} a new "deprecated" version of `fn`
  35496. * @api public
  35497. */
  35498. function deprecate (fn, msg) {
  35499. if (config('noDeprecation')) {
  35500. return fn;
  35501. }
  35502. var warned = false;
  35503. function deprecated() {
  35504. if (!warned) {
  35505. if (config('throwDeprecation')) {
  35506. throw new Error(msg);
  35507. } else if (config('traceDeprecation')) {
  35508. console.trace(msg);
  35509. } else {
  35510. console.warn(msg);
  35511. }
  35512. warned = true;
  35513. }
  35514. return fn.apply(this, arguments);
  35515. }
  35516. return deprecated;
  35517. }
  35518. /**
  35519. * Checks `localStorage` for boolean values for the given `name`.
  35520. *
  35521. * @param {String} name
  35522. * @returns {Boolean}
  35523. * @api private
  35524. */
  35525. function config (name) {
  35526. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  35527. try {
  35528. if (!global.localStorage) return false;
  35529. } catch (_) {
  35530. return false;
  35531. }
  35532. var val = global.localStorage[name];
  35533. if (null == val) return false;
  35534. return String(val).toLowerCase() === 'true';
  35535. }
  35536. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3)))
  35537. /***/ }),
  35538. /* 137 */
  35539. /*!***********************************************************!*\
  35540. !*** ./node_modules/string_decoder/lib/string_decoder.js ***!
  35541. \***********************************************************/
  35542. /*! no static exports found */
  35543. /***/ (function(module, exports, __webpack_require__) {
  35544. "use strict";
  35545. // Copyright Joyent, Inc. and other Node contributors.
  35546. //
  35547. // Permission is hereby granted, free of charge, to any person obtaining a
  35548. // copy of this software and associated documentation files (the
  35549. // "Software"), to deal in the Software without restriction, including
  35550. // without limitation the rights to use, copy, modify, merge, publish,
  35551. // distribute, sublicense, and/or sell copies of the Software, and to permit
  35552. // persons to whom the Software is furnished to do so, subject to the
  35553. // following conditions:
  35554. //
  35555. // The above copyright notice and this permission notice shall be included
  35556. // in all copies or substantial portions of the Software.
  35557. //
  35558. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  35559. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  35560. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  35561. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  35562. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  35563. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  35564. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  35565. /*<replacement>*/
  35566. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer;
  35567. /*</replacement>*/
  35568. var isEncoding = Buffer.isEncoding || function (encoding) {
  35569. encoding = '' + encoding;
  35570. switch (encoding && encoding.toLowerCase()) {
  35571. 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':
  35572. return true;
  35573. default:
  35574. return false;
  35575. }
  35576. };
  35577. function _normalizeEncoding(enc) {
  35578. if (!enc) return 'utf8';
  35579. var retried;
  35580. while (true) {
  35581. switch (enc) {
  35582. case 'utf8':
  35583. case 'utf-8':
  35584. return 'utf8';
  35585. case 'ucs2':
  35586. case 'ucs-2':
  35587. case 'utf16le':
  35588. case 'utf-16le':
  35589. return 'utf16le';
  35590. case 'latin1':
  35591. case 'binary':
  35592. return 'latin1';
  35593. case 'base64':
  35594. case 'ascii':
  35595. case 'hex':
  35596. return enc;
  35597. default:
  35598. if (retried) return; // undefined
  35599. enc = ('' + enc).toLowerCase();
  35600. retried = true;
  35601. }
  35602. }
  35603. };
  35604. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  35605. // modules monkey-patch it to support additional encodings
  35606. function normalizeEncoding(enc) {
  35607. var nenc = _normalizeEncoding(enc);
  35608. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  35609. return nenc || enc;
  35610. }
  35611. // StringDecoder provides an interface for efficiently splitting a series of
  35612. // buffers into a series of JS strings without breaking apart multi-byte
  35613. // characters.
  35614. exports.StringDecoder = StringDecoder;
  35615. function StringDecoder(encoding) {
  35616. this.encoding = normalizeEncoding(encoding);
  35617. var nb;
  35618. switch (this.encoding) {
  35619. case 'utf16le':
  35620. this.text = utf16Text;
  35621. this.end = utf16End;
  35622. nb = 4;
  35623. break;
  35624. case 'utf8':
  35625. this.fillLast = utf8FillLast;
  35626. nb = 4;
  35627. break;
  35628. case 'base64':
  35629. this.text = base64Text;
  35630. this.end = base64End;
  35631. nb = 3;
  35632. break;
  35633. default:
  35634. this.write = simpleWrite;
  35635. this.end = simpleEnd;
  35636. return;
  35637. }
  35638. this.lastNeed = 0;
  35639. this.lastTotal = 0;
  35640. this.lastChar = Buffer.allocUnsafe(nb);
  35641. }
  35642. StringDecoder.prototype.write = function (buf) {
  35643. if (buf.length === 0) return '';
  35644. var r;
  35645. var i;
  35646. if (this.lastNeed) {
  35647. r = this.fillLast(buf);
  35648. if (r === undefined) return '';
  35649. i = this.lastNeed;
  35650. this.lastNeed = 0;
  35651. } else {
  35652. i = 0;
  35653. }
  35654. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  35655. return r || '';
  35656. };
  35657. StringDecoder.prototype.end = utf8End;
  35658. // Returns only complete characters in a Buffer
  35659. StringDecoder.prototype.text = utf8Text;
  35660. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  35661. StringDecoder.prototype.fillLast = function (buf) {
  35662. if (this.lastNeed <= buf.length) {
  35663. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  35664. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  35665. }
  35666. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  35667. this.lastNeed -= buf.length;
  35668. };
  35669. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  35670. // continuation byte. If an invalid byte is detected, -2 is returned.
  35671. function utf8CheckByte(byte) {
  35672. 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;
  35673. return byte >> 6 === 0x02 ? -1 : -2;
  35674. }
  35675. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  35676. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  35677. // needed to complete the UTF-8 character (if applicable) are returned.
  35678. function utf8CheckIncomplete(self, buf, i) {
  35679. var j = buf.length - 1;
  35680. if (j < i) return 0;
  35681. var nb = utf8CheckByte(buf[j]);
  35682. if (nb >= 0) {
  35683. if (nb > 0) self.lastNeed = nb - 1;
  35684. return nb;
  35685. }
  35686. if (--j < i || nb === -2) return 0;
  35687. nb = utf8CheckByte(buf[j]);
  35688. if (nb >= 0) {
  35689. if (nb > 0) self.lastNeed = nb - 2;
  35690. return nb;
  35691. }
  35692. if (--j < i || nb === -2) return 0;
  35693. nb = utf8CheckByte(buf[j]);
  35694. if (nb >= 0) {
  35695. if (nb > 0) {
  35696. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  35697. }
  35698. return nb;
  35699. }
  35700. return 0;
  35701. }
  35702. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  35703. // needed or are available. If we see a non-continuation byte where we expect
  35704. // one, we "replace" the validated continuation bytes we've seen so far with
  35705. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  35706. // behavior. The continuation byte check is included three times in the case
  35707. // where all of the continuation bytes for a character exist in the same buffer.
  35708. // It is also done this way as a slight performance increase instead of using a
  35709. // loop.
  35710. function utf8CheckExtraBytes(self, buf, p) {
  35711. if ((buf[0] & 0xC0) !== 0x80) {
  35712. self.lastNeed = 0;
  35713. return '\ufffd';
  35714. }
  35715. if (self.lastNeed > 1 && buf.length > 1) {
  35716. if ((buf[1] & 0xC0) !== 0x80) {
  35717. self.lastNeed = 1;
  35718. return '\ufffd';
  35719. }
  35720. if (self.lastNeed > 2 && buf.length > 2) {
  35721. if ((buf[2] & 0xC0) !== 0x80) {
  35722. self.lastNeed = 2;
  35723. return '\ufffd';
  35724. }
  35725. }
  35726. }
  35727. }
  35728. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  35729. function utf8FillLast(buf) {
  35730. var p = this.lastTotal - this.lastNeed;
  35731. var r = utf8CheckExtraBytes(this, buf, p);
  35732. if (r !== undefined) return r;
  35733. if (this.lastNeed <= buf.length) {
  35734. buf.copy(this.lastChar, p, 0, this.lastNeed);
  35735. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  35736. }
  35737. buf.copy(this.lastChar, p, 0, buf.length);
  35738. this.lastNeed -= buf.length;
  35739. }
  35740. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  35741. // partial character, the character's bytes are buffered until the required
  35742. // number of bytes are available.
  35743. function utf8Text(buf, i) {
  35744. var total = utf8CheckIncomplete(this, buf, i);
  35745. if (!this.lastNeed) return buf.toString('utf8', i);
  35746. this.lastTotal = total;
  35747. var end = buf.length - (total - this.lastNeed);
  35748. buf.copy(this.lastChar, 0, end);
  35749. return buf.toString('utf8', i, end);
  35750. }
  35751. // For UTF-8, a replacement character is added when ending on a partial
  35752. // character.
  35753. function utf8End(buf) {
  35754. var r = buf && buf.length ? this.write(buf) : '';
  35755. if (this.lastNeed) return r + '\ufffd';
  35756. return r;
  35757. }
  35758. // UTF-16LE typically needs two bytes per character, but even if we have an even
  35759. // number of bytes available, we need to check if we end on a leading/high
  35760. // surrogate. In that case, we need to wait for the next two bytes in order to
  35761. // decode the last character properly.
  35762. function utf16Text(buf, i) {
  35763. if ((buf.length - i) % 2 === 0) {
  35764. var r = buf.toString('utf16le', i);
  35765. if (r) {
  35766. var c = r.charCodeAt(r.length - 1);
  35767. if (c >= 0xD800 && c <= 0xDBFF) {
  35768. this.lastNeed = 2;
  35769. this.lastTotal = 4;
  35770. this.lastChar[0] = buf[buf.length - 2];
  35771. this.lastChar[1] = buf[buf.length - 1];
  35772. return r.slice(0, -1);
  35773. }
  35774. }
  35775. return r;
  35776. }
  35777. this.lastNeed = 1;
  35778. this.lastTotal = 2;
  35779. this.lastChar[0] = buf[buf.length - 1];
  35780. return buf.toString('utf16le', i, buf.length - 1);
  35781. }
  35782. // For UTF-16LE we do not explicitly append special replacement characters if we
  35783. // end on a partial character, we simply let v8 handle that.
  35784. function utf16End(buf) {
  35785. var r = buf && buf.length ? this.write(buf) : '';
  35786. if (this.lastNeed) {
  35787. var end = this.lastTotal - this.lastNeed;
  35788. return r + this.lastChar.toString('utf16le', 0, end);
  35789. }
  35790. return r;
  35791. }
  35792. function base64Text(buf, i) {
  35793. var n = (buf.length - i) % 3;
  35794. if (n === 0) return buf.toString('base64', i);
  35795. this.lastNeed = 3 - n;
  35796. this.lastTotal = 3;
  35797. if (n === 1) {
  35798. this.lastChar[0] = buf[buf.length - 1];
  35799. } else {
  35800. this.lastChar[0] = buf[buf.length - 2];
  35801. this.lastChar[1] = buf[buf.length - 1];
  35802. }
  35803. return buf.toString('base64', i, buf.length - n);
  35804. }
  35805. function base64End(buf) {
  35806. var r = buf && buf.length ? this.write(buf) : '';
  35807. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  35808. return r;
  35809. }
  35810. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  35811. function simpleWrite(buf) {
  35812. return buf.toString(this.encoding);
  35813. }
  35814. function simpleEnd(buf) {
  35815. return buf && buf.length ? this.write(buf) : '';
  35816. }
  35817. /***/ }),
  35818. /* 138 */
  35819. /*!***************************************************************!*\
  35820. !*** ./node_modules/readable-stream/lib/_stream_transform.js ***!
  35821. \***************************************************************/
  35822. /*! no static exports found */
  35823. /***/ (function(module, exports, __webpack_require__) {
  35824. "use strict";
  35825. // Copyright Joyent, Inc. and other Node contributors.
  35826. //
  35827. // Permission is hereby granted, free of charge, to any person obtaining a
  35828. // copy of this software and associated documentation files (the
  35829. // "Software"), to deal in the Software without restriction, including
  35830. // without limitation the rights to use, copy, modify, merge, publish,
  35831. // distribute, sublicense, and/or sell copies of the Software, and to permit
  35832. // persons to whom the Software is furnished to do so, subject to the
  35833. // following conditions:
  35834. //
  35835. // The above copyright notice and this permission notice shall be included
  35836. // in all copies or substantial portions of the Software.
  35837. //
  35838. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  35839. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  35840. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  35841. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  35842. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  35843. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  35844. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  35845. // a transform stream is a readable/writable stream where you do
  35846. // something with the data. Sometimes it's called a "filter",
  35847. // but that's not a great name for it, since that implies a thing where
  35848. // some bits pass through, and others are simply ignored. (That would
  35849. // be a valid example of a transform, of course.)
  35850. //
  35851. // While the output is causally related to the input, it's not a
  35852. // necessarily symmetric or synchronous transformation. For example,
  35853. // a zlib stream might take multiple plain-text writes(), and then
  35854. // emit a single compressed chunk some time in the future.
  35855. //
  35856. // Here's how this works:
  35857. //
  35858. // The Transform stream has all the aspects of the readable and writable
  35859. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  35860. // internally, and returns false if there's a lot of pending writes
  35861. // buffered up. When you call read(), that calls _read(n) until
  35862. // there's enough pending readable data buffered up.
  35863. //
  35864. // In a transform stream, the written data is placed in a buffer. When
  35865. // _read(n) is called, it transforms the queued up data, calling the
  35866. // buffered _write cb's as it consumes chunks. If consuming a single
  35867. // written chunk would result in multiple output chunks, then the first
  35868. // outputted bit calls the readcb, and subsequent chunks just go into
  35869. // the read buffer, and will cause it to emit 'readable' if necessary.
  35870. //
  35871. // This way, back-pressure is actually determined by the reading side,
  35872. // since _read has to be called to start processing a new chunk. However,
  35873. // a pathological inflate type of transform can cause excessive buffering
  35874. // here. For example, imagine a stream where every byte of input is
  35875. // interpreted as an integer from 0-255, and then results in that many
  35876. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  35877. // 1kb of data being output. In this case, you could write a very small
  35878. // amount of input, and end up with a very large amount of output. In
  35879. // such a pathological inflating mechanism, there'd be no way to tell
  35880. // the system to stop doing the transform. A single 4MB write could
  35881. // cause the system to run out of memory.
  35882. //
  35883. // However, even in such a pathological case, only a single written chunk
  35884. // would be consumed, and then the rest would wait (un-transformed) until
  35885. // the results of the previous transformed chunk were consumed.
  35886. module.exports = Transform;
  35887. var Duplex = __webpack_require__(/*! ./_stream_duplex */ 134);
  35888. /*<replacement>*/
  35889. var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
  35890. util.inherits = __webpack_require__(/*! inherits */ 121);
  35891. /*</replacement>*/
  35892. util.inherits(Transform, Duplex);
  35893. function afterTransform(er, data) {
  35894. var ts = this._transformState;
  35895. ts.transforming = false;
  35896. var cb = ts.writecb;
  35897. if (!cb) {
  35898. return this.emit('error', new Error('write callback called multiple times'));
  35899. }
  35900. ts.writechunk = null;
  35901. ts.writecb = null;
  35902. if (data != null) // single equals check for both `null` and `undefined`
  35903. this.push(data);
  35904. cb(er);
  35905. var rs = this._readableState;
  35906. rs.reading = false;
  35907. if (rs.needReadable || rs.length < rs.highWaterMark) {
  35908. this._read(rs.highWaterMark);
  35909. }
  35910. }
  35911. function Transform(options) {
  35912. if (!(this instanceof Transform)) return new Transform(options);
  35913. Duplex.call(this, options);
  35914. this._transformState = {
  35915. afterTransform: afterTransform.bind(this),
  35916. needTransform: false,
  35917. transforming: false,
  35918. writecb: null,
  35919. writechunk: null,
  35920. writeencoding: null
  35921. };
  35922. // start out asking for a readable event once data is transformed.
  35923. this._readableState.needReadable = true;
  35924. // we have implemented the _read method, and done the other things
  35925. // that Readable wants before the first _read call, so unset the
  35926. // sync guard flag.
  35927. this._readableState.sync = false;
  35928. if (options) {
  35929. if (typeof options.transform === 'function') this._transform = options.transform;
  35930. if (typeof options.flush === 'function') this._flush = options.flush;
  35931. }
  35932. // When the writable side finishes, then flush out anything remaining.
  35933. this.on('prefinish', prefinish);
  35934. }
  35935. function prefinish() {
  35936. var _this = this;
  35937. if (typeof this._flush === 'function') {
  35938. this._flush(function (er, data) {
  35939. done(_this, er, data);
  35940. });
  35941. } else {
  35942. done(this, null, null);
  35943. }
  35944. }
  35945. Transform.prototype.push = function (chunk, encoding) {
  35946. this._transformState.needTransform = false;
  35947. return Duplex.prototype.push.call(this, chunk, encoding);
  35948. };
  35949. // This is the part where you do stuff!
  35950. // override this function in implementation classes.
  35951. // 'chunk' is an input chunk.
  35952. //
  35953. // Call `push(newChunk)` to pass along transformed output
  35954. // to the readable side. You may call 'push' zero or more times.
  35955. //
  35956. // Call `cb(err)` when you are done with this chunk. If you pass
  35957. // an error, then that'll put the hurt on the whole operation. If you
  35958. // never call cb(), then you'll never get another chunk.
  35959. Transform.prototype._transform = function (chunk, encoding, cb) {
  35960. throw new Error('_transform() is not implemented');
  35961. };
  35962. Transform.prototype._write = function (chunk, encoding, cb) {
  35963. var ts = this._transformState;
  35964. ts.writecb = cb;
  35965. ts.writechunk = chunk;
  35966. ts.writeencoding = encoding;
  35967. if (!ts.transforming) {
  35968. var rs = this._readableState;
  35969. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  35970. }
  35971. };
  35972. // Doesn't matter what the args are here.
  35973. // _transform does all the work.
  35974. // That we got here means that the readable side wants more data.
  35975. Transform.prototype._read = function (n) {
  35976. var ts = this._transformState;
  35977. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  35978. ts.transforming = true;
  35979. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  35980. } else {
  35981. // mark that we need a transform, so that any data that comes in
  35982. // will get processed, now that we've asked for it.
  35983. ts.needTransform = true;
  35984. }
  35985. };
  35986. Transform.prototype._destroy = function (err, cb) {
  35987. var _this2 = this;
  35988. Duplex.prototype._destroy.call(this, err, function (err2) {
  35989. cb(err2);
  35990. _this2.emit('close');
  35991. });
  35992. };
  35993. function done(stream, er, data) {
  35994. if (er) return stream.emit('error', er);
  35995. if (data != null) // single equals check for both `null` and `undefined`
  35996. stream.push(data);
  35997. // if there's nothing in the write buffer, then that means
  35998. // that nothing more will ever be provided
  35999. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  36000. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  36001. return stream.push(null);
  36002. }
  36003. /***/ }),
  36004. /* 139 */
  36005. /*!*****************************************************************!*\
  36006. !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!
  36007. \*****************************************************************/
  36008. /*! no static exports found */
  36009. /***/ (function(module, exports, __webpack_require__) {
  36010. "use strict";
  36011. // Copyright Joyent, Inc. and other Node contributors.
  36012. //
  36013. // Permission is hereby granted, free of charge, to any person obtaining a
  36014. // copy of this software and associated documentation files (the
  36015. // "Software"), to deal in the Software without restriction, including
  36016. // without limitation the rights to use, copy, modify, merge, publish,
  36017. // distribute, sublicense, and/or sell copies of the Software, and to permit
  36018. // persons to whom the Software is furnished to do so, subject to the
  36019. // following conditions:
  36020. //
  36021. // The above copyright notice and this permission notice shall be included
  36022. // in all copies or substantial portions of the Software.
  36023. //
  36024. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  36025. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  36026. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  36027. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  36028. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  36029. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  36030. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  36031. // a passthrough stream.
  36032. // basically just the most minimal sort of Transform stream.
  36033. // Every written chunk gets output as-is.
  36034. module.exports = PassThrough;
  36035. var Transform = __webpack_require__(/*! ./_stream_transform */ 138);
  36036. /*<replacement>*/
  36037. var util = Object.create(__webpack_require__(/*! core-util-is */ 129));
  36038. util.inherits = __webpack_require__(/*! inherits */ 121);
  36039. /*</replacement>*/
  36040. util.inherits(PassThrough, Transform);
  36041. function PassThrough(options) {
  36042. if (!(this instanceof PassThrough)) return new PassThrough(options);
  36043. Transform.call(this, options);
  36044. }
  36045. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  36046. cb(null, chunk);
  36047. };
  36048. /***/ }),
  36049. /* 140 */
  36050. /*!*****************************************!*\
  36051. !*** ./node_modules/ripemd160/index.js ***!
  36052. \*****************************************/
  36053. /*! no static exports found */
  36054. /***/ (function(module, exports, __webpack_require__) {
  36055. "use strict";
  36056. var Buffer = __webpack_require__(/*! buffer */ 116).Buffer
  36057. var inherits = __webpack_require__(/*! inherits */ 121)
  36058. var HashBase = __webpack_require__(/*! hash-base */ 123)
  36059. var ARRAY16 = new Array(16)
  36060. var zl = [
  36061. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  36062. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  36063. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  36064. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  36065. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  36066. ]
  36067. var zr = [
  36068. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  36069. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  36070. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  36071. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  36072. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  36073. ]
  36074. var sl = [
  36075. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  36076. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  36077. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  36078. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  36079. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  36080. ]
  36081. var sr = [
  36082. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  36083. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  36084. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  36085. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  36086. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  36087. ]
  36088. var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]
  36089. var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]
  36090. function RIPEMD160 () {
  36091. HashBase.call(this, 64)
  36092. // state
  36093. this._a = 0x67452301
  36094. this._b = 0xefcdab89
  36095. this._c = 0x98badcfe
  36096. this._d = 0x10325476
  36097. this._e = 0xc3d2e1f0
  36098. }
  36099. inherits(RIPEMD160, HashBase)
  36100. RIPEMD160.prototype._update = function () {
  36101. var words = ARRAY16
  36102. for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)
  36103. var al = this._a | 0
  36104. var bl = this._b | 0
  36105. var cl = this._c | 0
  36106. var dl = this._d | 0
  36107. var el = this._e | 0
  36108. var ar = this._a | 0
  36109. var br = this._b | 0
  36110. var cr = this._c | 0
  36111. var dr = this._d | 0
  36112. var er = this._e | 0
  36113. // computation
  36114. for (var i = 0; i < 80; i += 1) {
  36115. var tl
  36116. var tr
  36117. if (i < 16) {
  36118. tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])
  36119. tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])
  36120. } else if (i < 32) {
  36121. tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])
  36122. tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])
  36123. } else if (i < 48) {
  36124. tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])
  36125. tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])
  36126. } else if (i < 64) {
  36127. tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])
  36128. tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])
  36129. } else { // if (i<80) {
  36130. tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])
  36131. tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])
  36132. }
  36133. al = el
  36134. el = dl
  36135. dl = rotl(cl, 10)
  36136. cl = bl
  36137. bl = tl
  36138. ar = er
  36139. er = dr
  36140. dr = rotl(cr, 10)
  36141. cr = br
  36142. br = tr
  36143. }
  36144. // update state
  36145. var t = (this._b + cl + dr) | 0
  36146. this._b = (this._c + dl + er) | 0
  36147. this._c = (this._d + el + ar) | 0
  36148. this._d = (this._e + al + br) | 0
  36149. this._e = (this._a + bl + cr) | 0
  36150. this._a = t
  36151. }
  36152. RIPEMD160.prototype._digest = function () {
  36153. // create padding and handle blocks
  36154. this._block[this._blockOffset++] = 0x80
  36155. if (this._blockOffset > 56) {
  36156. this._block.fill(0, this._blockOffset, 64)
  36157. this._update()
  36158. this._blockOffset = 0
  36159. }
  36160. this._block.fill(0, this._blockOffset, 56)
  36161. this._block.writeUInt32LE(this._length[0], 56)
  36162. this._block.writeUInt32LE(this._length[1], 60)
  36163. this._update()
  36164. // produce result
  36165. var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)
  36166. buffer.writeInt32LE(this._a, 0)
  36167. buffer.writeInt32LE(this._b, 4)
  36168. buffer.writeInt32LE(this._c, 8)
  36169. buffer.writeInt32LE(this._d, 12)
  36170. buffer.writeInt32LE(this._e, 16)
  36171. return buffer
  36172. }
  36173. function rotl (x, n) {
  36174. return (x << n) | (x >>> (32 - n))
  36175. }
  36176. function fn1 (a, b, c, d, e, m, k, s) {
  36177. return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0
  36178. }
  36179. function fn2 (a, b, c, d, e, m, k, s) {
  36180. return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0
  36181. }
  36182. function fn3 (a, b, c, d, e, m, k, s) {
  36183. return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0
  36184. }
  36185. function fn4 (a, b, c, d, e, m, k, s) {
  36186. return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0
  36187. }
  36188. function fn5 (a, b, c, d, e, m, k, s) {
  36189. return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0
  36190. }
  36191. module.exports = RIPEMD160
  36192. /***/ }),
  36193. /* 141 */
  36194. /*!**************************************!*\
  36195. !*** ./node_modules/sha.js/index.js ***!
  36196. \**************************************/
  36197. /*! no static exports found */
  36198. /***/ (function(module, exports, __webpack_require__) {
  36199. var exports = module.exports = function SHA (algorithm) {
  36200. algorithm = algorithm.toLowerCase()
  36201. var Algorithm = exports[algorithm]
  36202. if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
  36203. return new Algorithm()
  36204. }
  36205. exports.sha = __webpack_require__(/*! ./sha */ 142)
  36206. exports.sha1 = __webpack_require__(/*! ./sha1 */ 144)
  36207. exports.sha224 = __webpack_require__(/*! ./sha224 */ 145)
  36208. exports.sha256 = __webpack_require__(/*! ./sha256 */ 146)
  36209. exports.sha384 = __webpack_require__(/*! ./sha384 */ 147)
  36210. exports.sha512 = __webpack_require__(/*! ./sha512 */ 148)
  36211. /***/ }),
  36212. /* 142 */
  36213. /*!************************************!*\
  36214. !*** ./node_modules/sha.js/sha.js ***!
  36215. \************************************/
  36216. /*! no static exports found */
  36217. /***/ (function(module, exports, __webpack_require__) {
  36218. /*
  36219. * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
  36220. * in FIPS PUB 180-1
  36221. * This source code is derived from sha1.js of the same repository.
  36222. * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
  36223. * operation was added.
  36224. */
  36225. var inherits = __webpack_require__(/*! inherits */ 121)
  36226. var Hash = __webpack_require__(/*! ./hash */ 143)
  36227. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36228. var K = [
  36229. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  36230. ]
  36231. var W = new Array(80)
  36232. function Sha () {
  36233. this.init()
  36234. this._w = W
  36235. Hash.call(this, 64, 56)
  36236. }
  36237. inherits(Sha, Hash)
  36238. Sha.prototype.init = function () {
  36239. this._a = 0x67452301
  36240. this._b = 0xefcdab89
  36241. this._c = 0x98badcfe
  36242. this._d = 0x10325476
  36243. this._e = 0xc3d2e1f0
  36244. return this
  36245. }
  36246. function rotl5 (num) {
  36247. return (num << 5) | (num >>> 27)
  36248. }
  36249. function rotl30 (num) {
  36250. return (num << 30) | (num >>> 2)
  36251. }
  36252. function ft (s, b, c, d) {
  36253. if (s === 0) return (b & c) | ((~b) & d)
  36254. if (s === 2) return (b & c) | (b & d) | (c & d)
  36255. return b ^ c ^ d
  36256. }
  36257. Sha.prototype._update = function (M) {
  36258. var W = this._w
  36259. var a = this._a | 0
  36260. var b = this._b | 0
  36261. var c = this._c | 0
  36262. var d = this._d | 0
  36263. var e = this._e | 0
  36264. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  36265. for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
  36266. for (var j = 0; j < 80; ++j) {
  36267. var s = ~~(j / 20)
  36268. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  36269. e = d
  36270. d = c
  36271. c = rotl30(b)
  36272. b = a
  36273. a = t
  36274. }
  36275. this._a = (a + this._a) | 0
  36276. this._b = (b + this._b) | 0
  36277. this._c = (c + this._c) | 0
  36278. this._d = (d + this._d) | 0
  36279. this._e = (e + this._e) | 0
  36280. }
  36281. Sha.prototype._hash = function () {
  36282. var H = Buffer.allocUnsafe(20)
  36283. H.writeInt32BE(this._a | 0, 0)
  36284. H.writeInt32BE(this._b | 0, 4)
  36285. H.writeInt32BE(this._c | 0, 8)
  36286. H.writeInt32BE(this._d | 0, 12)
  36287. H.writeInt32BE(this._e | 0, 16)
  36288. return H
  36289. }
  36290. module.exports = Sha
  36291. /***/ }),
  36292. /* 143 */
  36293. /*!*************************************!*\
  36294. !*** ./node_modules/sha.js/hash.js ***!
  36295. \*************************************/
  36296. /*! no static exports found */
  36297. /***/ (function(module, exports, __webpack_require__) {
  36298. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36299. // prototype class for hash functions
  36300. function Hash (blockSize, finalSize) {
  36301. this._block = Buffer.alloc(blockSize)
  36302. this._finalSize = finalSize
  36303. this._blockSize = blockSize
  36304. this._len = 0
  36305. }
  36306. Hash.prototype.update = function (data, enc) {
  36307. if (typeof data === 'string') {
  36308. enc = enc || 'utf8'
  36309. data = Buffer.from(data, enc)
  36310. }
  36311. var block = this._block
  36312. var blockSize = this._blockSize
  36313. var length = data.length
  36314. var accum = this._len
  36315. for (var offset = 0; offset < length;) {
  36316. var assigned = accum % blockSize
  36317. var remainder = Math.min(length - offset, blockSize - assigned)
  36318. for (var i = 0; i < remainder; i++) {
  36319. block[assigned + i] = data[offset + i]
  36320. }
  36321. accum += remainder
  36322. offset += remainder
  36323. if ((accum % blockSize) === 0) {
  36324. this._update(block)
  36325. }
  36326. }
  36327. this._len += length
  36328. return this
  36329. }
  36330. Hash.prototype.digest = function (enc) {
  36331. var rem = this._len % this._blockSize
  36332. this._block[rem] = 0x80
  36333. // zero (rem + 1) trailing bits, where (rem + 1) is the smallest
  36334. // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
  36335. this._block.fill(0, rem + 1)
  36336. if (rem >= this._finalSize) {
  36337. this._update(this._block)
  36338. this._block.fill(0)
  36339. }
  36340. var bits = this._len * 8
  36341. // uint32
  36342. if (bits <= 0xffffffff) {
  36343. this._block.writeUInt32BE(bits, this._blockSize - 4)
  36344. // uint64
  36345. } else {
  36346. var lowBits = (bits & 0xffffffff) >>> 0
  36347. var highBits = (bits - lowBits) / 0x100000000
  36348. this._block.writeUInt32BE(highBits, this._blockSize - 8)
  36349. this._block.writeUInt32BE(lowBits, this._blockSize - 4)
  36350. }
  36351. this._update(this._block)
  36352. var hash = this._hash()
  36353. return enc ? hash.toString(enc) : hash
  36354. }
  36355. Hash.prototype._update = function () {
  36356. throw new Error('_update must be implemented by subclass')
  36357. }
  36358. module.exports = Hash
  36359. /***/ }),
  36360. /* 144 */
  36361. /*!*************************************!*\
  36362. !*** ./node_modules/sha.js/sha1.js ***!
  36363. \*************************************/
  36364. /*! no static exports found */
  36365. /***/ (function(module, exports, __webpack_require__) {
  36366. /*
  36367. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  36368. * in FIPS PUB 180-1
  36369. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  36370. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  36371. * Distributed under the BSD License
  36372. * See http://pajhome.org.uk/crypt/md5 for details.
  36373. */
  36374. var inherits = __webpack_require__(/*! inherits */ 121)
  36375. var Hash = __webpack_require__(/*! ./hash */ 143)
  36376. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36377. var K = [
  36378. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  36379. ]
  36380. var W = new Array(80)
  36381. function Sha1 () {
  36382. this.init()
  36383. this._w = W
  36384. Hash.call(this, 64, 56)
  36385. }
  36386. inherits(Sha1, Hash)
  36387. Sha1.prototype.init = function () {
  36388. this._a = 0x67452301
  36389. this._b = 0xefcdab89
  36390. this._c = 0x98badcfe
  36391. this._d = 0x10325476
  36392. this._e = 0xc3d2e1f0
  36393. return this
  36394. }
  36395. function rotl1 (num) {
  36396. return (num << 1) | (num >>> 31)
  36397. }
  36398. function rotl5 (num) {
  36399. return (num << 5) | (num >>> 27)
  36400. }
  36401. function rotl30 (num) {
  36402. return (num << 30) | (num >>> 2)
  36403. }
  36404. function ft (s, b, c, d) {
  36405. if (s === 0) return (b & c) | ((~b) & d)
  36406. if (s === 2) return (b & c) | (b & d) | (c & d)
  36407. return b ^ c ^ d
  36408. }
  36409. Sha1.prototype._update = function (M) {
  36410. var W = this._w
  36411. var a = this._a | 0
  36412. var b = this._b | 0
  36413. var c = this._c | 0
  36414. var d = this._d | 0
  36415. var e = this._e | 0
  36416. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  36417. for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
  36418. for (var j = 0; j < 80; ++j) {
  36419. var s = ~~(j / 20)
  36420. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  36421. e = d
  36422. d = c
  36423. c = rotl30(b)
  36424. b = a
  36425. a = t
  36426. }
  36427. this._a = (a + this._a) | 0
  36428. this._b = (b + this._b) | 0
  36429. this._c = (c + this._c) | 0
  36430. this._d = (d + this._d) | 0
  36431. this._e = (e + this._e) | 0
  36432. }
  36433. Sha1.prototype._hash = function () {
  36434. var H = Buffer.allocUnsafe(20)
  36435. H.writeInt32BE(this._a | 0, 0)
  36436. H.writeInt32BE(this._b | 0, 4)
  36437. H.writeInt32BE(this._c | 0, 8)
  36438. H.writeInt32BE(this._d | 0, 12)
  36439. H.writeInt32BE(this._e | 0, 16)
  36440. return H
  36441. }
  36442. module.exports = Sha1
  36443. /***/ }),
  36444. /* 145 */
  36445. /*!***************************************!*\
  36446. !*** ./node_modules/sha.js/sha224.js ***!
  36447. \***************************************/
  36448. /*! no static exports found */
  36449. /***/ (function(module, exports, __webpack_require__) {
  36450. /**
  36451. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  36452. * in FIPS 180-2
  36453. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  36454. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  36455. *
  36456. */
  36457. var inherits = __webpack_require__(/*! inherits */ 121)
  36458. var Sha256 = __webpack_require__(/*! ./sha256 */ 146)
  36459. var Hash = __webpack_require__(/*! ./hash */ 143)
  36460. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36461. var W = new Array(64)
  36462. function Sha224 () {
  36463. this.init()
  36464. this._w = W // new Array(64)
  36465. Hash.call(this, 64, 56)
  36466. }
  36467. inherits(Sha224, Sha256)
  36468. Sha224.prototype.init = function () {
  36469. this._a = 0xc1059ed8
  36470. this._b = 0x367cd507
  36471. this._c = 0x3070dd17
  36472. this._d = 0xf70e5939
  36473. this._e = 0xffc00b31
  36474. this._f = 0x68581511
  36475. this._g = 0x64f98fa7
  36476. this._h = 0xbefa4fa4
  36477. return this
  36478. }
  36479. Sha224.prototype._hash = function () {
  36480. var H = Buffer.allocUnsafe(28)
  36481. H.writeInt32BE(this._a, 0)
  36482. H.writeInt32BE(this._b, 4)
  36483. H.writeInt32BE(this._c, 8)
  36484. H.writeInt32BE(this._d, 12)
  36485. H.writeInt32BE(this._e, 16)
  36486. H.writeInt32BE(this._f, 20)
  36487. H.writeInt32BE(this._g, 24)
  36488. return H
  36489. }
  36490. module.exports = Sha224
  36491. /***/ }),
  36492. /* 146 */
  36493. /*!***************************************!*\
  36494. !*** ./node_modules/sha.js/sha256.js ***!
  36495. \***************************************/
  36496. /*! no static exports found */
  36497. /***/ (function(module, exports, __webpack_require__) {
  36498. /**
  36499. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  36500. * in FIPS 180-2
  36501. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  36502. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  36503. *
  36504. */
  36505. var inherits = __webpack_require__(/*! inherits */ 121)
  36506. var Hash = __webpack_require__(/*! ./hash */ 143)
  36507. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36508. var K = [
  36509. 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
  36510. 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
  36511. 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
  36512. 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
  36513. 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
  36514. 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
  36515. 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
  36516. 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
  36517. 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
  36518. 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
  36519. 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
  36520. 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
  36521. 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
  36522. 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
  36523. 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
  36524. 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
  36525. ]
  36526. var W = new Array(64)
  36527. function Sha256 () {
  36528. this.init()
  36529. this._w = W // new Array(64)
  36530. Hash.call(this, 64, 56)
  36531. }
  36532. inherits(Sha256, Hash)
  36533. Sha256.prototype.init = function () {
  36534. this._a = 0x6a09e667
  36535. this._b = 0xbb67ae85
  36536. this._c = 0x3c6ef372
  36537. this._d = 0xa54ff53a
  36538. this._e = 0x510e527f
  36539. this._f = 0x9b05688c
  36540. this._g = 0x1f83d9ab
  36541. this._h = 0x5be0cd19
  36542. return this
  36543. }
  36544. function ch (x, y, z) {
  36545. return z ^ (x & (y ^ z))
  36546. }
  36547. function maj (x, y, z) {
  36548. return (x & y) | (z & (x | y))
  36549. }
  36550. function sigma0 (x) {
  36551. return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
  36552. }
  36553. function sigma1 (x) {
  36554. return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
  36555. }
  36556. function gamma0 (x) {
  36557. return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
  36558. }
  36559. function gamma1 (x) {
  36560. return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
  36561. }
  36562. Sha256.prototype._update = function (M) {
  36563. var W = this._w
  36564. var a = this._a | 0
  36565. var b = this._b | 0
  36566. var c = this._c | 0
  36567. var d = this._d | 0
  36568. var e = this._e | 0
  36569. var f = this._f | 0
  36570. var g = this._g | 0
  36571. var h = this._h | 0
  36572. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  36573. for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
  36574. for (var j = 0; j < 64; ++j) {
  36575. var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
  36576. var T2 = (sigma0(a) + maj(a, b, c)) | 0
  36577. h = g
  36578. g = f
  36579. f = e
  36580. e = (d + T1) | 0
  36581. d = c
  36582. c = b
  36583. b = a
  36584. a = (T1 + T2) | 0
  36585. }
  36586. this._a = (a + this._a) | 0
  36587. this._b = (b + this._b) | 0
  36588. this._c = (c + this._c) | 0
  36589. this._d = (d + this._d) | 0
  36590. this._e = (e + this._e) | 0
  36591. this._f = (f + this._f) | 0
  36592. this._g = (g + this._g) | 0
  36593. this._h = (h + this._h) | 0
  36594. }
  36595. Sha256.prototype._hash = function () {
  36596. var H = Buffer.allocUnsafe(32)
  36597. H.writeInt32BE(this._a, 0)
  36598. H.writeInt32BE(this._b, 4)
  36599. H.writeInt32BE(this._c, 8)
  36600. H.writeInt32BE(this._d, 12)
  36601. H.writeInt32BE(this._e, 16)
  36602. H.writeInt32BE(this._f, 20)
  36603. H.writeInt32BE(this._g, 24)
  36604. H.writeInt32BE(this._h, 28)
  36605. return H
  36606. }
  36607. module.exports = Sha256
  36608. /***/ }),
  36609. /* 147 */
  36610. /*!***************************************!*\
  36611. !*** ./node_modules/sha.js/sha384.js ***!
  36612. \***************************************/
  36613. /*! no static exports found */
  36614. /***/ (function(module, exports, __webpack_require__) {
  36615. var inherits = __webpack_require__(/*! inherits */ 121)
  36616. var SHA512 = __webpack_require__(/*! ./sha512 */ 148)
  36617. var Hash = __webpack_require__(/*! ./hash */ 143)
  36618. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36619. var W = new Array(160)
  36620. function Sha384 () {
  36621. this.init()
  36622. this._w = W
  36623. Hash.call(this, 128, 112)
  36624. }
  36625. inherits(Sha384, SHA512)
  36626. Sha384.prototype.init = function () {
  36627. this._ah = 0xcbbb9d5d
  36628. this._bh = 0x629a292a
  36629. this._ch = 0x9159015a
  36630. this._dh = 0x152fecd8
  36631. this._eh = 0x67332667
  36632. this._fh = 0x8eb44a87
  36633. this._gh = 0xdb0c2e0d
  36634. this._hh = 0x47b5481d
  36635. this._al = 0xc1059ed8
  36636. this._bl = 0x367cd507
  36637. this._cl = 0x3070dd17
  36638. this._dl = 0xf70e5939
  36639. this._el = 0xffc00b31
  36640. this._fl = 0x68581511
  36641. this._gl = 0x64f98fa7
  36642. this._hl = 0xbefa4fa4
  36643. return this
  36644. }
  36645. Sha384.prototype._hash = function () {
  36646. var H = Buffer.allocUnsafe(48)
  36647. function writeInt64BE (h, l, offset) {
  36648. H.writeInt32BE(h, offset)
  36649. H.writeInt32BE(l, offset + 4)
  36650. }
  36651. writeInt64BE(this._ah, this._al, 0)
  36652. writeInt64BE(this._bh, this._bl, 8)
  36653. writeInt64BE(this._ch, this._cl, 16)
  36654. writeInt64BE(this._dh, this._dl, 24)
  36655. writeInt64BE(this._eh, this._el, 32)
  36656. writeInt64BE(this._fh, this._fl, 40)
  36657. return H
  36658. }
  36659. module.exports = Sha384
  36660. /***/ }),
  36661. /* 148 */
  36662. /*!***************************************!*\
  36663. !*** ./node_modules/sha.js/sha512.js ***!
  36664. \***************************************/
  36665. /*! no static exports found */
  36666. /***/ (function(module, exports, __webpack_require__) {
  36667. var inherits = __webpack_require__(/*! inherits */ 121)
  36668. var Hash = __webpack_require__(/*! ./hash */ 143)
  36669. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36670. var K = [
  36671. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  36672. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  36673. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  36674. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  36675. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  36676. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  36677. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  36678. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  36679. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  36680. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  36681. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  36682. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  36683. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  36684. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  36685. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  36686. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  36687. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  36688. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  36689. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  36690. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  36691. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  36692. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  36693. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  36694. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  36695. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  36696. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  36697. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  36698. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  36699. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  36700. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  36701. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  36702. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  36703. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  36704. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  36705. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  36706. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  36707. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  36708. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  36709. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  36710. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  36711. ]
  36712. var W = new Array(160)
  36713. function Sha512 () {
  36714. this.init()
  36715. this._w = W
  36716. Hash.call(this, 128, 112)
  36717. }
  36718. inherits(Sha512, Hash)
  36719. Sha512.prototype.init = function () {
  36720. this._ah = 0x6a09e667
  36721. this._bh = 0xbb67ae85
  36722. this._ch = 0x3c6ef372
  36723. this._dh = 0xa54ff53a
  36724. this._eh = 0x510e527f
  36725. this._fh = 0x9b05688c
  36726. this._gh = 0x1f83d9ab
  36727. this._hh = 0x5be0cd19
  36728. this._al = 0xf3bcc908
  36729. this._bl = 0x84caa73b
  36730. this._cl = 0xfe94f82b
  36731. this._dl = 0x5f1d36f1
  36732. this._el = 0xade682d1
  36733. this._fl = 0x2b3e6c1f
  36734. this._gl = 0xfb41bd6b
  36735. this._hl = 0x137e2179
  36736. return this
  36737. }
  36738. function Ch (x, y, z) {
  36739. return z ^ (x & (y ^ z))
  36740. }
  36741. function maj (x, y, z) {
  36742. return (x & y) | (z & (x | y))
  36743. }
  36744. function sigma0 (x, xl) {
  36745. return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
  36746. }
  36747. function sigma1 (x, xl) {
  36748. return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
  36749. }
  36750. function Gamma0 (x, xl) {
  36751. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
  36752. }
  36753. function Gamma0l (x, xl) {
  36754. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
  36755. }
  36756. function Gamma1 (x, xl) {
  36757. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
  36758. }
  36759. function Gamma1l (x, xl) {
  36760. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
  36761. }
  36762. function getCarry (a, b) {
  36763. return (a >>> 0) < (b >>> 0) ? 1 : 0
  36764. }
  36765. Sha512.prototype._update = function (M) {
  36766. var W = this._w
  36767. var ah = this._ah | 0
  36768. var bh = this._bh | 0
  36769. var ch = this._ch | 0
  36770. var dh = this._dh | 0
  36771. var eh = this._eh | 0
  36772. var fh = this._fh | 0
  36773. var gh = this._gh | 0
  36774. var hh = this._hh | 0
  36775. var al = this._al | 0
  36776. var bl = this._bl | 0
  36777. var cl = this._cl | 0
  36778. var dl = this._dl | 0
  36779. var el = this._el | 0
  36780. var fl = this._fl | 0
  36781. var gl = this._gl | 0
  36782. var hl = this._hl | 0
  36783. for (var i = 0; i < 32; i += 2) {
  36784. W[i] = M.readInt32BE(i * 4)
  36785. W[i + 1] = M.readInt32BE(i * 4 + 4)
  36786. }
  36787. for (; i < 160; i += 2) {
  36788. var xh = W[i - 15 * 2]
  36789. var xl = W[i - 15 * 2 + 1]
  36790. var gamma0 = Gamma0(xh, xl)
  36791. var gamma0l = Gamma0l(xl, xh)
  36792. xh = W[i - 2 * 2]
  36793. xl = W[i - 2 * 2 + 1]
  36794. var gamma1 = Gamma1(xh, xl)
  36795. var gamma1l = Gamma1l(xl, xh)
  36796. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  36797. var Wi7h = W[i - 7 * 2]
  36798. var Wi7l = W[i - 7 * 2 + 1]
  36799. var Wi16h = W[i - 16 * 2]
  36800. var Wi16l = W[i - 16 * 2 + 1]
  36801. var Wil = (gamma0l + Wi7l) | 0
  36802. var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
  36803. Wil = (Wil + gamma1l) | 0
  36804. Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
  36805. Wil = (Wil + Wi16l) | 0
  36806. Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
  36807. W[i] = Wih
  36808. W[i + 1] = Wil
  36809. }
  36810. for (var j = 0; j < 160; j += 2) {
  36811. Wih = W[j]
  36812. Wil = W[j + 1]
  36813. var majh = maj(ah, bh, ch)
  36814. var majl = maj(al, bl, cl)
  36815. var sigma0h = sigma0(ah, al)
  36816. var sigma0l = sigma0(al, ah)
  36817. var sigma1h = sigma1(eh, el)
  36818. var sigma1l = sigma1(el, eh)
  36819. // t1 = h + sigma1 + ch + K[j] + W[j]
  36820. var Kih = K[j]
  36821. var Kil = K[j + 1]
  36822. var chh = Ch(eh, fh, gh)
  36823. var chl = Ch(el, fl, gl)
  36824. var t1l = (hl + sigma1l) | 0
  36825. var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
  36826. t1l = (t1l + chl) | 0
  36827. t1h = (t1h + chh + getCarry(t1l, chl)) | 0
  36828. t1l = (t1l + Kil) | 0
  36829. t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
  36830. t1l = (t1l + Wil) | 0
  36831. t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
  36832. // t2 = sigma0 + maj
  36833. var t2l = (sigma0l + majl) | 0
  36834. var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
  36835. hh = gh
  36836. hl = gl
  36837. gh = fh
  36838. gl = fl
  36839. fh = eh
  36840. fl = el
  36841. el = (dl + t1l) | 0
  36842. eh = (dh + t1h + getCarry(el, dl)) | 0
  36843. dh = ch
  36844. dl = cl
  36845. ch = bh
  36846. cl = bl
  36847. bh = ah
  36848. bl = al
  36849. al = (t1l + t2l) | 0
  36850. ah = (t1h + t2h + getCarry(al, t1l)) | 0
  36851. }
  36852. this._al = (this._al + al) | 0
  36853. this._bl = (this._bl + bl) | 0
  36854. this._cl = (this._cl + cl) | 0
  36855. this._dl = (this._dl + dl) | 0
  36856. this._el = (this._el + el) | 0
  36857. this._fl = (this._fl + fl) | 0
  36858. this._gl = (this._gl + gl) | 0
  36859. this._hl = (this._hl + hl) | 0
  36860. this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
  36861. this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
  36862. this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
  36863. this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
  36864. this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
  36865. this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
  36866. this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
  36867. this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
  36868. }
  36869. Sha512.prototype._hash = function () {
  36870. var H = Buffer.allocUnsafe(64)
  36871. function writeInt64BE (h, l, offset) {
  36872. H.writeInt32BE(h, offset)
  36873. H.writeInt32BE(l, offset + 4)
  36874. }
  36875. writeInt64BE(this._ah, this._al, 0)
  36876. writeInt64BE(this._bh, this._bl, 8)
  36877. writeInt64BE(this._ch, this._cl, 16)
  36878. writeInt64BE(this._dh, this._dl, 24)
  36879. writeInt64BE(this._eh, this._el, 32)
  36880. writeInt64BE(this._fh, this._fl, 40)
  36881. writeInt64BE(this._gh, this._gl, 48)
  36882. writeInt64BE(this._hh, this._hl, 56)
  36883. return H
  36884. }
  36885. module.exports = Sha512
  36886. /***/ }),
  36887. /* 149 */
  36888. /*!*******************************************!*\
  36889. !*** ./node_modules/cipher-base/index.js ***!
  36890. \*******************************************/
  36891. /*! no static exports found */
  36892. /***/ (function(module, exports, __webpack_require__) {
  36893. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  36894. var Transform = __webpack_require__(/*! stream */ 150).Transform
  36895. var StringDecoder = __webpack_require__(/*! string_decoder */ 137).StringDecoder
  36896. var inherits = __webpack_require__(/*! inherits */ 121)
  36897. function CipherBase (hashMode) {
  36898. Transform.call(this)
  36899. this.hashMode = typeof hashMode === 'string'
  36900. if (this.hashMode) {
  36901. this[hashMode] = this._finalOrDigest
  36902. } else {
  36903. this.final = this._finalOrDigest
  36904. }
  36905. if (this._final) {
  36906. this.__final = this._final
  36907. this._final = null
  36908. }
  36909. this._decoder = null
  36910. this._encoding = null
  36911. }
  36912. inherits(CipherBase, Transform)
  36913. CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
  36914. if (typeof data === 'string') {
  36915. data = Buffer.from(data, inputEnc)
  36916. }
  36917. var outData = this._update(data)
  36918. if (this.hashMode) return this
  36919. if (outputEnc) {
  36920. outData = this._toString(outData, outputEnc)
  36921. }
  36922. return outData
  36923. }
  36924. CipherBase.prototype.setAutoPadding = function () {}
  36925. CipherBase.prototype.getAuthTag = function () {
  36926. throw new Error('trying to get auth tag in unsupported state')
  36927. }
  36928. CipherBase.prototype.setAuthTag = function () {
  36929. throw new Error('trying to set auth tag in unsupported state')
  36930. }
  36931. CipherBase.prototype.setAAD = function () {
  36932. throw new Error('trying to set aad in unsupported state')
  36933. }
  36934. CipherBase.prototype._transform = function (data, _, next) {
  36935. var err
  36936. try {
  36937. if (this.hashMode) {
  36938. this._update(data)
  36939. } else {
  36940. this.push(this._update(data))
  36941. }
  36942. } catch (e) {
  36943. err = e
  36944. } finally {
  36945. next(err)
  36946. }
  36947. }
  36948. CipherBase.prototype._flush = function (done) {
  36949. var err
  36950. try {
  36951. this.push(this.__final())
  36952. } catch (e) {
  36953. err = e
  36954. }
  36955. done(err)
  36956. }
  36957. CipherBase.prototype._finalOrDigest = function (outputEnc) {
  36958. var outData = this.__final() || Buffer.alloc(0)
  36959. if (outputEnc) {
  36960. outData = this._toString(outData, outputEnc, true)
  36961. }
  36962. return outData
  36963. }
  36964. CipherBase.prototype._toString = function (value, enc, fin) {
  36965. if (!this._decoder) {
  36966. this._decoder = new StringDecoder(enc)
  36967. this._encoding = enc
  36968. }
  36969. if (this._encoding !== enc) throw new Error('can\'t switch encodings')
  36970. var out = this._decoder.write(value)
  36971. if (fin) {
  36972. out += this._decoder.end()
  36973. }
  36974. return out
  36975. }
  36976. module.exports = CipherBase
  36977. /***/ }),
  36978. /* 150 */
  36979. /*!*************************************************!*\
  36980. !*** ./node_modules/stream-browserify/index.js ***!
  36981. \*************************************************/
  36982. /*! no static exports found */
  36983. /***/ (function(module, exports, __webpack_require__) {
  36984. // Copyright Joyent, Inc. and other Node contributors.
  36985. //
  36986. // Permission is hereby granted, free of charge, to any person obtaining a
  36987. // copy of this software and associated documentation files (the
  36988. // "Software"), to deal in the Software without restriction, including
  36989. // without limitation the rights to use, copy, modify, merge, publish,
  36990. // distribute, sublicense, and/or sell copies of the Software, and to permit
  36991. // persons to whom the Software is furnished to do so, subject to the
  36992. // following conditions:
  36993. //
  36994. // The above copyright notice and this permission notice shall be included
  36995. // in all copies or substantial portions of the Software.
  36996. //
  36997. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  36998. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  36999. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  37000. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  37001. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  37002. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  37003. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  37004. module.exports = Stream;
  37005. var EE = __webpack_require__(/*! events */ 127).EventEmitter;
  37006. var inherits = __webpack_require__(/*! inherits */ 121);
  37007. inherits(Stream, EE);
  37008. Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ 124);
  37009. Stream.Writable = __webpack_require__(/*! readable-stream/writable.js */ 151);
  37010. Stream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ 152);
  37011. Stream.Transform = __webpack_require__(/*! readable-stream/transform.js */ 153);
  37012. Stream.PassThrough = __webpack_require__(/*! readable-stream/passthrough.js */ 154);
  37013. // Backwards-compat with node 0.4.x
  37014. Stream.Stream = Stream;
  37015. // old-style streams. Note that the pipe method (the only relevant
  37016. // part of this class) is overridden in the Readable class.
  37017. function Stream() {
  37018. EE.call(this);
  37019. }
  37020. Stream.prototype.pipe = function(dest, options) {
  37021. var source = this;
  37022. function ondata(chunk) {
  37023. if (dest.writable) {
  37024. if (false === dest.write(chunk) && source.pause) {
  37025. source.pause();
  37026. }
  37027. }
  37028. }
  37029. source.on('data', ondata);
  37030. function ondrain() {
  37031. if (source.readable && source.resume) {
  37032. source.resume();
  37033. }
  37034. }
  37035. dest.on('drain', ondrain);
  37036. // If the 'end' option is not supplied, dest.end() will be called when
  37037. // source gets the 'end' or 'close' events. Only dest.end() once.
  37038. if (!dest._isStdio && (!options || options.end !== false)) {
  37039. source.on('end', onend);
  37040. source.on('close', onclose);
  37041. }
  37042. var didOnEnd = false;
  37043. function onend() {
  37044. if (didOnEnd) return;
  37045. didOnEnd = true;
  37046. dest.end();
  37047. }
  37048. function onclose() {
  37049. if (didOnEnd) return;
  37050. didOnEnd = true;
  37051. if (typeof dest.destroy === 'function') dest.destroy();
  37052. }
  37053. // don't leave dangling pipes when there are errors.
  37054. function onerror(er) {
  37055. cleanup();
  37056. if (EE.listenerCount(this, 'error') === 0) {
  37057. throw er; // Unhandled stream error in pipe.
  37058. }
  37059. }
  37060. source.on('error', onerror);
  37061. dest.on('error', onerror);
  37062. // remove all the event listeners that were added.
  37063. function cleanup() {
  37064. source.removeListener('data', ondata);
  37065. dest.removeListener('drain', ondrain);
  37066. source.removeListener('end', onend);
  37067. source.removeListener('close', onclose);
  37068. source.removeListener('error', onerror);
  37069. dest.removeListener('error', onerror);
  37070. source.removeListener('end', cleanup);
  37071. source.removeListener('close', cleanup);
  37072. dest.removeListener('close', cleanup);
  37073. }
  37074. source.on('end', cleanup);
  37075. source.on('close', cleanup);
  37076. dest.on('close', cleanup);
  37077. dest.emit('pipe', source);
  37078. // Allow for unix-like usage: A.pipe(B).pipe(C)
  37079. return dest;
  37080. };
  37081. /***/ }),
  37082. /* 151 */
  37083. /*!**********************************************************!*\
  37084. !*** ./node_modules/readable-stream/writable-browser.js ***!
  37085. \**********************************************************/
  37086. /*! no static exports found */
  37087. /***/ (function(module, exports, __webpack_require__) {
  37088. module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ 135);
  37089. /***/ }),
  37090. /* 152 */
  37091. /*!********************************************************!*\
  37092. !*** ./node_modules/readable-stream/duplex-browser.js ***!
  37093. \********************************************************/
  37094. /*! no static exports found */
  37095. /***/ (function(module, exports, __webpack_require__) {
  37096. module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ 134);
  37097. /***/ }),
  37098. /* 153 */
  37099. /*!***************************************************!*\
  37100. !*** ./node_modules/readable-stream/transform.js ***!
  37101. \***************************************************/
  37102. /*! no static exports found */
  37103. /***/ (function(module, exports, __webpack_require__) {
  37104. module.exports = __webpack_require__(/*! ./readable */ 124).Transform
  37105. /***/ }),
  37106. /* 154 */
  37107. /*!*****************************************************!*\
  37108. !*** ./node_modules/readable-stream/passthrough.js ***!
  37109. \*****************************************************/
  37110. /*! no static exports found */
  37111. /***/ (function(module, exports, __webpack_require__) {
  37112. module.exports = __webpack_require__(/*! ./readable */ 124).PassThrough
  37113. /***/ }),
  37114. /* 155 */
  37115. /*!*********************************************!*\
  37116. !*** ./node_modules/create-hmac/browser.js ***!
  37117. \*********************************************/
  37118. /*! no static exports found */
  37119. /***/ (function(module, exports, __webpack_require__) {
  37120. "use strict";
  37121. var inherits = __webpack_require__(/*! inherits */ 121)
  37122. var Legacy = __webpack_require__(/*! ./legacy */ 156)
  37123. var Base = __webpack_require__(/*! cipher-base */ 149)
  37124. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  37125. var md5 = __webpack_require__(/*! create-hash/md5 */ 157)
  37126. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 140)
  37127. var sha = __webpack_require__(/*! sha.js */ 141)
  37128. var ZEROS = Buffer.alloc(128)
  37129. function Hmac (alg, key) {
  37130. Base.call(this, 'digest')
  37131. if (typeof key === 'string') {
  37132. key = Buffer.from(key)
  37133. }
  37134. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  37135. this._alg = alg
  37136. this._key = key
  37137. if (key.length > blocksize) {
  37138. var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
  37139. key = hash.update(key).digest()
  37140. } else if (key.length < blocksize) {
  37141. key = Buffer.concat([key, ZEROS], blocksize)
  37142. }
  37143. var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
  37144. var opad = this._opad = Buffer.allocUnsafe(blocksize)
  37145. for (var i = 0; i < blocksize; i++) {
  37146. ipad[i] = key[i] ^ 0x36
  37147. opad[i] = key[i] ^ 0x5C
  37148. }
  37149. this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
  37150. this._hash.update(ipad)
  37151. }
  37152. inherits(Hmac, Base)
  37153. Hmac.prototype._update = function (data) {
  37154. this._hash.update(data)
  37155. }
  37156. Hmac.prototype._final = function () {
  37157. var h = this._hash.digest()
  37158. var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
  37159. return hash.update(this._opad).update(h).digest()
  37160. }
  37161. module.exports = function createHmac (alg, key) {
  37162. alg = alg.toLowerCase()
  37163. if (alg === 'rmd160' || alg === 'ripemd160') {
  37164. return new Hmac('rmd160', key)
  37165. }
  37166. if (alg === 'md5') {
  37167. return new Legacy(md5, key)
  37168. }
  37169. return new Hmac(alg, key)
  37170. }
  37171. /***/ }),
  37172. /* 156 */
  37173. /*!********************************************!*\
  37174. !*** ./node_modules/create-hmac/legacy.js ***!
  37175. \********************************************/
  37176. /*! no static exports found */
  37177. /***/ (function(module, exports, __webpack_require__) {
  37178. "use strict";
  37179. var inherits = __webpack_require__(/*! inherits */ 121)
  37180. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  37181. var Base = __webpack_require__(/*! cipher-base */ 149)
  37182. var ZEROS = Buffer.alloc(128)
  37183. var blocksize = 64
  37184. function Hmac (alg, key) {
  37185. Base.call(this, 'digest')
  37186. if (typeof key === 'string') {
  37187. key = Buffer.from(key)
  37188. }
  37189. this._alg = alg
  37190. this._key = key
  37191. if (key.length > blocksize) {
  37192. key = alg(key)
  37193. } else if (key.length < blocksize) {
  37194. key = Buffer.concat([key, ZEROS], blocksize)
  37195. }
  37196. var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
  37197. var opad = this._opad = Buffer.allocUnsafe(blocksize)
  37198. for (var i = 0; i < blocksize; i++) {
  37199. ipad[i] = key[i] ^ 0x36
  37200. opad[i] = key[i] ^ 0x5C
  37201. }
  37202. this._hash = [ipad]
  37203. }
  37204. inherits(Hmac, Base)
  37205. Hmac.prototype._update = function (data) {
  37206. this._hash.push(data)
  37207. }
  37208. Hmac.prototype._final = function () {
  37209. var h = this._alg(Buffer.concat(this._hash))
  37210. return this._alg(Buffer.concat([this._opad, h]))
  37211. }
  37212. module.exports = Hmac
  37213. /***/ }),
  37214. /* 157 */
  37215. /*!*****************************************!*\
  37216. !*** ./node_modules/create-hash/md5.js ***!
  37217. \*****************************************/
  37218. /*! no static exports found */
  37219. /***/ (function(module, exports, __webpack_require__) {
  37220. var MD5 = __webpack_require__(/*! md5.js */ 122)
  37221. module.exports = function (buffer) {
  37222. return new MD5().update(buffer).digest()
  37223. }
  37224. /***/ }),
  37225. /* 158 */
  37226. /*!***********************************************!*\
  37227. !*** ./node_modules/browserify-sign/algos.js ***!
  37228. \***********************************************/
  37229. /*! no static exports found */
  37230. /***/ (function(module, exports, __webpack_require__) {
  37231. module.exports = __webpack_require__(/*! ./browser/algorithms.json */ 159)
  37232. /***/ }),
  37233. /* 159 */
  37234. /*!**************************************************************!*\
  37235. !*** ./node_modules/browserify-sign/browser/algorithms.json ***!
  37236. \**************************************************************/
  37237. /*! 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 */
  37238. /***/ (function(module) {
  37239. 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\"}}");
  37240. /***/ }),
  37241. /* 160 */
  37242. /*!****************************************!*\
  37243. !*** ./node_modules/pbkdf2/browser.js ***!
  37244. \****************************************/
  37245. /*! no static exports found */
  37246. /***/ (function(module, exports, __webpack_require__) {
  37247. exports.pbkdf2 = __webpack_require__(/*! ./lib/async */ 161)
  37248. exports.pbkdf2Sync = __webpack_require__(/*! ./lib/sync */ 164)
  37249. /***/ }),
  37250. /* 161 */
  37251. /*!******************************************!*\
  37252. !*** ./node_modules/pbkdf2/lib/async.js ***!
  37253. \******************************************/
  37254. /*! no static exports found */
  37255. /***/ (function(module, exports, __webpack_require__) {
  37256. /* WEBPACK VAR INJECTION */(function(global) {var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  37257. var checkParameters = __webpack_require__(/*! ./precondition */ 162)
  37258. var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 163)
  37259. var sync = __webpack_require__(/*! ./sync */ 164)
  37260. var toBuffer = __webpack_require__(/*! ./to-buffer */ 165)
  37261. var ZERO_BUF
  37262. var subtle = global.crypto && global.crypto.subtle
  37263. var toBrowser = {
  37264. sha: 'SHA-1',
  37265. 'sha-1': 'SHA-1',
  37266. sha1: 'SHA-1',
  37267. sha256: 'SHA-256',
  37268. 'sha-256': 'SHA-256',
  37269. sha384: 'SHA-384',
  37270. 'sha-384': 'SHA-384',
  37271. 'sha-512': 'SHA-512',
  37272. sha512: 'SHA-512'
  37273. }
  37274. var checks = []
  37275. function checkNative (algo) {
  37276. if (global.process && !global.process.browser) {
  37277. return Promise.resolve(false)
  37278. }
  37279. if (!subtle || !subtle.importKey || !subtle.deriveBits) {
  37280. return Promise.resolve(false)
  37281. }
  37282. if (checks[algo] !== undefined) {
  37283. return checks[algo]
  37284. }
  37285. ZERO_BUF = ZERO_BUF || Buffer.alloc(8)
  37286. var prom = browserPbkdf2(ZERO_BUF, ZERO_BUF, 10, 128, algo)
  37287. .then(function () {
  37288. return true
  37289. }).catch(function () {
  37290. return false
  37291. })
  37292. checks[algo] = prom
  37293. return prom
  37294. }
  37295. var nextTick
  37296. function getNextTick () {
  37297. if (nextTick) {
  37298. return nextTick
  37299. }
  37300. if (global.process && global.process.nextTick) {
  37301. nextTick = global.process.nextTick
  37302. } else if (global.queueMicrotask) {
  37303. nextTick = global.queueMicrotask
  37304. } else if (global.setImmediate) {
  37305. nextTick = global.setImmediate
  37306. } else {
  37307. nextTick = global.setTimeout
  37308. }
  37309. return nextTick
  37310. }
  37311. function browserPbkdf2 (password, salt, iterations, length, algo) {
  37312. return subtle.importKey(
  37313. 'raw', password, { name: 'PBKDF2' }, false, ['deriveBits']
  37314. ).then(function (key) {
  37315. return subtle.deriveBits({
  37316. name: 'PBKDF2',
  37317. salt: salt,
  37318. iterations: iterations,
  37319. hash: {
  37320. name: algo
  37321. }
  37322. }, key, length << 3)
  37323. }).then(function (res) {
  37324. return Buffer.from(res)
  37325. })
  37326. }
  37327. function resolvePromise (promise, callback) {
  37328. promise.then(function (out) {
  37329. getNextTick()(function () {
  37330. callback(null, out)
  37331. })
  37332. }, function (e) {
  37333. getNextTick()(function () {
  37334. callback(e)
  37335. })
  37336. })
  37337. }
  37338. module.exports = function (password, salt, iterations, keylen, digest, callback) {
  37339. if (typeof digest === 'function') {
  37340. callback = digest
  37341. digest = undefined
  37342. }
  37343. digest = digest || 'sha1'
  37344. var algo = toBrowser[digest.toLowerCase()]
  37345. if (!algo || typeof global.Promise !== 'function') {
  37346. getNextTick()(function () {
  37347. var out
  37348. try {
  37349. out = sync(password, salt, iterations, keylen, digest)
  37350. } catch (e) {
  37351. return callback(e)
  37352. }
  37353. callback(null, out)
  37354. })
  37355. return
  37356. }
  37357. checkParameters(iterations, keylen)
  37358. password = toBuffer(password, defaultEncoding, 'Password')
  37359. salt = toBuffer(salt, defaultEncoding, 'Salt')
  37360. if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
  37361. resolvePromise(checkNative(algo).then(function (resp) {
  37362. if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo)
  37363. return sync(password, salt, iterations, keylen, digest)
  37364. }), callback)
  37365. }
  37366. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3)))
  37367. /***/ }),
  37368. /* 162 */
  37369. /*!*************************************************!*\
  37370. !*** ./node_modules/pbkdf2/lib/precondition.js ***!
  37371. \*************************************************/
  37372. /*! no static exports found */
  37373. /***/ (function(module, exports) {
  37374. var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
  37375. module.exports = function (iterations, keylen) {
  37376. if (typeof iterations !== 'number') {
  37377. throw new TypeError('Iterations not a number')
  37378. }
  37379. if (iterations < 0) {
  37380. throw new TypeError('Bad iterations')
  37381. }
  37382. if (typeof keylen !== 'number') {
  37383. throw new TypeError('Key length not a number')
  37384. }
  37385. if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
  37386. throw new TypeError('Bad key length')
  37387. }
  37388. }
  37389. /***/ }),
  37390. /* 163 */
  37391. /*!*****************************************************!*\
  37392. !*** ./node_modules/pbkdf2/lib/default-encoding.js ***!
  37393. \*****************************************************/
  37394. /*! no static exports found */
  37395. /***/ (function(module, exports, __webpack_require__) {
  37396. /* WEBPACK VAR INJECTION */(function(global, process) {var defaultEncoding
  37397. /* istanbul ignore next */
  37398. if (global.process && global.process.browser) {
  37399. defaultEncoding = 'utf-8'
  37400. } else if (global.process && global.process.version) {
  37401. var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
  37402. defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
  37403. } else {
  37404. defaultEncoding = 'utf-8'
  37405. }
  37406. module.exports = defaultEncoding
  37407. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../../node-libs-browser/mock/process.js */ 113)))
  37408. /***/ }),
  37409. /* 164 */
  37410. /*!*************************************************!*\
  37411. !*** ./node_modules/pbkdf2/lib/sync-browser.js ***!
  37412. \*************************************************/
  37413. /*! no static exports found */
  37414. /***/ (function(module, exports, __webpack_require__) {
  37415. var md5 = __webpack_require__(/*! create-hash/md5 */ 157)
  37416. var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 140)
  37417. var sha = __webpack_require__(/*! sha.js */ 141)
  37418. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  37419. var checkParameters = __webpack_require__(/*! ./precondition */ 162)
  37420. var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 163)
  37421. var toBuffer = __webpack_require__(/*! ./to-buffer */ 165)
  37422. var ZEROS = Buffer.alloc(128)
  37423. var sizes = {
  37424. md5: 16,
  37425. sha1: 20,
  37426. sha224: 28,
  37427. sha256: 32,
  37428. sha384: 48,
  37429. sha512: 64,
  37430. rmd160: 20,
  37431. ripemd160: 20
  37432. }
  37433. function Hmac (alg, key, saltLen) {
  37434. var hash = getDigest(alg)
  37435. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  37436. if (key.length > blocksize) {
  37437. key = hash(key)
  37438. } else if (key.length < blocksize) {
  37439. key = Buffer.concat([key, ZEROS], blocksize)
  37440. }
  37441. var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])
  37442. var opad = Buffer.allocUnsafe(blocksize + sizes[alg])
  37443. for (var i = 0; i < blocksize; i++) {
  37444. ipad[i] = key[i] ^ 0x36
  37445. opad[i] = key[i] ^ 0x5C
  37446. }
  37447. var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)
  37448. ipad.copy(ipad1, 0, 0, blocksize)
  37449. this.ipad1 = ipad1
  37450. this.ipad2 = ipad
  37451. this.opad = opad
  37452. this.alg = alg
  37453. this.blocksize = blocksize
  37454. this.hash = hash
  37455. this.size = sizes[alg]
  37456. }
  37457. Hmac.prototype.run = function (data, ipad) {
  37458. data.copy(ipad, this.blocksize)
  37459. var h = this.hash(ipad)
  37460. h.copy(this.opad, this.blocksize)
  37461. return this.hash(this.opad)
  37462. }
  37463. function getDigest (alg) {
  37464. function shaFunc (data) {
  37465. return sha(alg).update(data).digest()
  37466. }
  37467. function rmd160Func (data) {
  37468. return new RIPEMD160().update(data).digest()
  37469. }
  37470. if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func
  37471. if (alg === 'md5') return md5
  37472. return shaFunc
  37473. }
  37474. function pbkdf2 (password, salt, iterations, keylen, digest) {
  37475. checkParameters(iterations, keylen)
  37476. password = toBuffer(password, defaultEncoding, 'Password')
  37477. salt = toBuffer(salt, defaultEncoding, 'Salt')
  37478. digest = digest || 'sha1'
  37479. var hmac = new Hmac(digest, password, salt.length)
  37480. var DK = Buffer.allocUnsafe(keylen)
  37481. var block1 = Buffer.allocUnsafe(salt.length + 4)
  37482. salt.copy(block1, 0, 0, salt.length)
  37483. var destPos = 0
  37484. var hLen = sizes[digest]
  37485. var l = Math.ceil(keylen / hLen)
  37486. for (var i = 1; i <= l; i++) {
  37487. block1.writeUInt32BE(i, salt.length)
  37488. var T = hmac.run(block1, hmac.ipad1)
  37489. var U = T
  37490. for (var j = 1; j < iterations; j++) {
  37491. U = hmac.run(U, hmac.ipad2)
  37492. for (var k = 0; k < hLen; k++) T[k] ^= U[k]
  37493. }
  37494. T.copy(DK, destPos)
  37495. destPos += hLen
  37496. }
  37497. return DK
  37498. }
  37499. module.exports = pbkdf2
  37500. /***/ }),
  37501. /* 165 */
  37502. /*!**********************************************!*\
  37503. !*** ./node_modules/pbkdf2/lib/to-buffer.js ***!
  37504. \**********************************************/
  37505. /*! no static exports found */
  37506. /***/ (function(module, exports, __webpack_require__) {
  37507. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  37508. module.exports = function (thing, encoding, name) {
  37509. if (Buffer.isBuffer(thing)) {
  37510. return thing
  37511. } else if (typeof thing === 'string') {
  37512. return Buffer.from(thing, encoding)
  37513. } else if (ArrayBuffer.isView(thing)) {
  37514. return Buffer.from(thing.buffer)
  37515. } else {
  37516. throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')
  37517. }
  37518. }
  37519. /***/ }),
  37520. /* 166 */
  37521. /*!***************************************************!*\
  37522. !*** ./node_modules/browserify-cipher/browser.js ***!
  37523. \***************************************************/
  37524. /*! no static exports found */
  37525. /***/ (function(module, exports, __webpack_require__) {
  37526. var DES = __webpack_require__(/*! browserify-des */ 167)
  37527. var aes = __webpack_require__(/*! browserify-aes/browser */ 175)
  37528. var aesModes = __webpack_require__(/*! browserify-aes/modes */ 177)
  37529. var desModes = __webpack_require__(/*! browserify-des/modes */ 194)
  37530. var ebtk = __webpack_require__(/*! evp_bytestokey */ 192)
  37531. function createCipher (suite, password) {
  37532. suite = suite.toLowerCase()
  37533. var keyLen, ivLen
  37534. if (aesModes[suite]) {
  37535. keyLen = aesModes[suite].key
  37536. ivLen = aesModes[suite].iv
  37537. } else if (desModes[suite]) {
  37538. keyLen = desModes[suite].key * 8
  37539. ivLen = desModes[suite].iv
  37540. } else {
  37541. throw new TypeError('invalid suite type')
  37542. }
  37543. var keys = ebtk(password, false, keyLen, ivLen)
  37544. return createCipheriv(suite, keys.key, keys.iv)
  37545. }
  37546. function createDecipher (suite, password) {
  37547. suite = suite.toLowerCase()
  37548. var keyLen, ivLen
  37549. if (aesModes[suite]) {
  37550. keyLen = aesModes[suite].key
  37551. ivLen = aesModes[suite].iv
  37552. } else if (desModes[suite]) {
  37553. keyLen = desModes[suite].key * 8
  37554. ivLen = desModes[suite].iv
  37555. } else {
  37556. throw new TypeError('invalid suite type')
  37557. }
  37558. var keys = ebtk(password, false, keyLen, ivLen)
  37559. return createDecipheriv(suite, keys.key, keys.iv)
  37560. }
  37561. function createCipheriv (suite, key, iv) {
  37562. suite = suite.toLowerCase()
  37563. if (aesModes[suite]) return aes.createCipheriv(suite, key, iv)
  37564. if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite })
  37565. throw new TypeError('invalid suite type')
  37566. }
  37567. function createDecipheriv (suite, key, iv) {
  37568. suite = suite.toLowerCase()
  37569. if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv)
  37570. if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true })
  37571. throw new TypeError('invalid suite type')
  37572. }
  37573. function getCiphers () {
  37574. return Object.keys(desModes).concat(aes.getCiphers())
  37575. }
  37576. exports.createCipher = exports.Cipher = createCipher
  37577. exports.createCipheriv = exports.Cipheriv = createCipheriv
  37578. exports.createDecipher = exports.Decipher = createDecipher
  37579. exports.createDecipheriv = exports.Decipheriv = createDecipheriv
  37580. exports.listCiphers = exports.getCiphers = getCiphers
  37581. /***/ }),
  37582. /* 167 */
  37583. /*!**********************************************!*\
  37584. !*** ./node_modules/browserify-des/index.js ***!
  37585. \**********************************************/
  37586. /*! no static exports found */
  37587. /***/ (function(module, exports, __webpack_require__) {
  37588. var CipherBase = __webpack_require__(/*! cipher-base */ 149)
  37589. var des = __webpack_require__(/*! des.js */ 168)
  37590. var inherits = __webpack_require__(/*! inherits */ 121)
  37591. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  37592. var modes = {
  37593. 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
  37594. 'des-ede3': des.EDE,
  37595. 'des-ede-cbc': des.CBC.instantiate(des.EDE),
  37596. 'des-ede': des.EDE,
  37597. 'des-cbc': des.CBC.instantiate(des.DES),
  37598. 'des-ecb': des.DES
  37599. }
  37600. modes.des = modes['des-cbc']
  37601. modes.des3 = modes['des-ede3-cbc']
  37602. module.exports = DES
  37603. inherits(DES, CipherBase)
  37604. function DES (opts) {
  37605. CipherBase.call(this)
  37606. var modeName = opts.mode.toLowerCase()
  37607. var mode = modes[modeName]
  37608. var type
  37609. if (opts.decrypt) {
  37610. type = 'decrypt'
  37611. } else {
  37612. type = 'encrypt'
  37613. }
  37614. var key = opts.key
  37615. if (!Buffer.isBuffer(key)) {
  37616. key = Buffer.from(key)
  37617. }
  37618. if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
  37619. key = Buffer.concat([key, key.slice(0, 8)])
  37620. }
  37621. var iv = opts.iv
  37622. if (!Buffer.isBuffer(iv)) {
  37623. iv = Buffer.from(iv)
  37624. }
  37625. this._des = mode.create({
  37626. key: key,
  37627. iv: iv,
  37628. type: type
  37629. })
  37630. }
  37631. DES.prototype._update = function (data) {
  37632. return Buffer.from(this._des.update(data))
  37633. }
  37634. DES.prototype._final = function () {
  37635. return Buffer.from(this._des.final())
  37636. }
  37637. /***/ }),
  37638. /* 168 */
  37639. /*!****************************************!*\
  37640. !*** ./node_modules/des.js/lib/des.js ***!
  37641. \****************************************/
  37642. /*! no static exports found */
  37643. /***/ (function(module, exports, __webpack_require__) {
  37644. "use strict";
  37645. exports.utils = __webpack_require__(/*! ./des/utils */ 169);
  37646. exports.Cipher = __webpack_require__(/*! ./des/cipher */ 170);
  37647. exports.DES = __webpack_require__(/*! ./des/des */ 172);
  37648. exports.CBC = __webpack_require__(/*! ./des/cbc */ 173);
  37649. exports.EDE = __webpack_require__(/*! ./des/ede */ 174);
  37650. /***/ }),
  37651. /* 169 */
  37652. /*!**********************************************!*\
  37653. !*** ./node_modules/des.js/lib/des/utils.js ***!
  37654. \**********************************************/
  37655. /*! no static exports found */
  37656. /***/ (function(module, exports, __webpack_require__) {
  37657. "use strict";
  37658. exports.readUInt32BE = function readUInt32BE(bytes, off) {
  37659. var res = (bytes[0 + off] << 24) |
  37660. (bytes[1 + off] << 16) |
  37661. (bytes[2 + off] << 8) |
  37662. bytes[3 + off];
  37663. return res >>> 0;
  37664. };
  37665. exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
  37666. bytes[0 + off] = value >>> 24;
  37667. bytes[1 + off] = (value >>> 16) & 0xff;
  37668. bytes[2 + off] = (value >>> 8) & 0xff;
  37669. bytes[3 + off] = value & 0xff;
  37670. };
  37671. exports.ip = function ip(inL, inR, out, off) {
  37672. var outL = 0;
  37673. var outR = 0;
  37674. for (var i = 6; i >= 0; i -= 2) {
  37675. for (var j = 0; j <= 24; j += 8) {
  37676. outL <<= 1;
  37677. outL |= (inR >>> (j + i)) & 1;
  37678. }
  37679. for (var j = 0; j <= 24; j += 8) {
  37680. outL <<= 1;
  37681. outL |= (inL >>> (j + i)) & 1;
  37682. }
  37683. }
  37684. for (var i = 6; i >= 0; i -= 2) {
  37685. for (var j = 1; j <= 25; j += 8) {
  37686. outR <<= 1;
  37687. outR |= (inR >>> (j + i)) & 1;
  37688. }
  37689. for (var j = 1; j <= 25; j += 8) {
  37690. outR <<= 1;
  37691. outR |= (inL >>> (j + i)) & 1;
  37692. }
  37693. }
  37694. out[off + 0] = outL >>> 0;
  37695. out[off + 1] = outR >>> 0;
  37696. };
  37697. exports.rip = function rip(inL, inR, out, off) {
  37698. var outL = 0;
  37699. var outR = 0;
  37700. for (var i = 0; i < 4; i++) {
  37701. for (var j = 24; j >= 0; j -= 8) {
  37702. outL <<= 1;
  37703. outL |= (inR >>> (j + i)) & 1;
  37704. outL <<= 1;
  37705. outL |= (inL >>> (j + i)) & 1;
  37706. }
  37707. }
  37708. for (var i = 4; i < 8; i++) {
  37709. for (var j = 24; j >= 0; j -= 8) {
  37710. outR <<= 1;
  37711. outR |= (inR >>> (j + i)) & 1;
  37712. outR <<= 1;
  37713. outR |= (inL >>> (j + i)) & 1;
  37714. }
  37715. }
  37716. out[off + 0] = outL >>> 0;
  37717. out[off + 1] = outR >>> 0;
  37718. };
  37719. exports.pc1 = function pc1(inL, inR, out, off) {
  37720. var outL = 0;
  37721. var outR = 0;
  37722. // 7, 15, 23, 31, 39, 47, 55, 63
  37723. // 6, 14, 22, 30, 39, 47, 55, 63
  37724. // 5, 13, 21, 29, 39, 47, 55, 63
  37725. // 4, 12, 20, 28
  37726. for (var i = 7; i >= 5; i--) {
  37727. for (var j = 0; j <= 24; j += 8) {
  37728. outL <<= 1;
  37729. outL |= (inR >> (j + i)) & 1;
  37730. }
  37731. for (var j = 0; j <= 24; j += 8) {
  37732. outL <<= 1;
  37733. outL |= (inL >> (j + i)) & 1;
  37734. }
  37735. }
  37736. for (var j = 0; j <= 24; j += 8) {
  37737. outL <<= 1;
  37738. outL |= (inR >> (j + i)) & 1;
  37739. }
  37740. // 1, 9, 17, 25, 33, 41, 49, 57
  37741. // 2, 10, 18, 26, 34, 42, 50, 58
  37742. // 3, 11, 19, 27, 35, 43, 51, 59
  37743. // 36, 44, 52, 60
  37744. for (var i = 1; i <= 3; i++) {
  37745. for (var j = 0; j <= 24; j += 8) {
  37746. outR <<= 1;
  37747. outR |= (inR >> (j + i)) & 1;
  37748. }
  37749. for (var j = 0; j <= 24; j += 8) {
  37750. outR <<= 1;
  37751. outR |= (inL >> (j + i)) & 1;
  37752. }
  37753. }
  37754. for (var j = 0; j <= 24; j += 8) {
  37755. outR <<= 1;
  37756. outR |= (inL >> (j + i)) & 1;
  37757. }
  37758. out[off + 0] = outL >>> 0;
  37759. out[off + 1] = outR >>> 0;
  37760. };
  37761. exports.r28shl = function r28shl(num, shift) {
  37762. return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
  37763. };
  37764. var pc2table = [
  37765. // inL => outL
  37766. 14, 11, 17, 4, 27, 23, 25, 0,
  37767. 13, 22, 7, 18, 5, 9, 16, 24,
  37768. 2, 20, 12, 21, 1, 8, 15, 26,
  37769. // inR => outR
  37770. 15, 4, 25, 19, 9, 1, 26, 16,
  37771. 5, 11, 23, 8, 12, 7, 17, 0,
  37772. 22, 3, 10, 14, 6, 20, 27, 24
  37773. ];
  37774. exports.pc2 = function pc2(inL, inR, out, off) {
  37775. var outL = 0;
  37776. var outR = 0;
  37777. var len = pc2table.length >>> 1;
  37778. for (var i = 0; i < len; i++) {
  37779. outL <<= 1;
  37780. outL |= (inL >>> pc2table[i]) & 0x1;
  37781. }
  37782. for (var i = len; i < pc2table.length; i++) {
  37783. outR <<= 1;
  37784. outR |= (inR >>> pc2table[i]) & 0x1;
  37785. }
  37786. out[off + 0] = outL >>> 0;
  37787. out[off + 1] = outR >>> 0;
  37788. };
  37789. exports.expand = function expand(r, out, off) {
  37790. var outL = 0;
  37791. var outR = 0;
  37792. outL = ((r & 1) << 5) | (r >>> 27);
  37793. for (var i = 23; i >= 15; i -= 4) {
  37794. outL <<= 6;
  37795. outL |= (r >>> i) & 0x3f;
  37796. }
  37797. for (var i = 11; i >= 3; i -= 4) {
  37798. outR |= (r >>> i) & 0x3f;
  37799. outR <<= 6;
  37800. }
  37801. outR |= ((r & 0x1f) << 1) | (r >>> 31);
  37802. out[off + 0] = outL >>> 0;
  37803. out[off + 1] = outR >>> 0;
  37804. };
  37805. var sTable = [
  37806. 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
  37807. 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
  37808. 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
  37809. 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
  37810. 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
  37811. 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
  37812. 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
  37813. 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
  37814. 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
  37815. 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
  37816. 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
  37817. 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
  37818. 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
  37819. 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
  37820. 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
  37821. 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
  37822. 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
  37823. 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
  37824. 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
  37825. 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
  37826. 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
  37827. 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
  37828. 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
  37829. 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
  37830. 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
  37831. 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
  37832. 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
  37833. 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
  37834. 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
  37835. 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
  37836. 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
  37837. 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
  37838. ];
  37839. exports.substitute = function substitute(inL, inR) {
  37840. var out = 0;
  37841. for (var i = 0; i < 4; i++) {
  37842. var b = (inL >>> (18 - i * 6)) & 0x3f;
  37843. var sb = sTable[i * 0x40 + b];
  37844. out <<= 4;
  37845. out |= sb;
  37846. }
  37847. for (var i = 0; i < 4; i++) {
  37848. var b = (inR >>> (18 - i * 6)) & 0x3f;
  37849. var sb = sTable[4 * 0x40 + i * 0x40 + b];
  37850. out <<= 4;
  37851. out |= sb;
  37852. }
  37853. return out >>> 0;
  37854. };
  37855. var permuteTable = [
  37856. 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
  37857. 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
  37858. ];
  37859. exports.permute = function permute(num) {
  37860. var out = 0;
  37861. for (var i = 0; i < permuteTable.length; i++) {
  37862. out <<= 1;
  37863. out |= (num >>> permuteTable[i]) & 0x1;
  37864. }
  37865. return out >>> 0;
  37866. };
  37867. exports.padSplit = function padSplit(num, size, group) {
  37868. var str = num.toString(2);
  37869. while (str.length < size)
  37870. str = '0' + str;
  37871. var out = [];
  37872. for (var i = 0; i < size; i += group)
  37873. out.push(str.slice(i, i + group));
  37874. return out.join(' ');
  37875. };
  37876. /***/ }),
  37877. /* 170 */
  37878. /*!***********************************************!*\
  37879. !*** ./node_modules/des.js/lib/des/cipher.js ***!
  37880. \***********************************************/
  37881. /*! no static exports found */
  37882. /***/ (function(module, exports, __webpack_require__) {
  37883. "use strict";
  37884. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  37885. function Cipher(options) {
  37886. this.options = options;
  37887. this.type = this.options.type;
  37888. this.blockSize = 8;
  37889. this._init();
  37890. this.buffer = new Array(this.blockSize);
  37891. this.bufferOff = 0;
  37892. }
  37893. module.exports = Cipher;
  37894. Cipher.prototype._init = function _init() {
  37895. // Might be overrided
  37896. };
  37897. Cipher.prototype.update = function update(data) {
  37898. if (data.length === 0)
  37899. return [];
  37900. if (this.type === 'decrypt')
  37901. return this._updateDecrypt(data);
  37902. else
  37903. return this._updateEncrypt(data);
  37904. };
  37905. Cipher.prototype._buffer = function _buffer(data, off) {
  37906. // Append data to buffer
  37907. var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
  37908. for (var i = 0; i < min; i++)
  37909. this.buffer[this.bufferOff + i] = data[off + i];
  37910. this.bufferOff += min;
  37911. // Shift next
  37912. return min;
  37913. };
  37914. Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
  37915. this._update(this.buffer, 0, out, off);
  37916. this.bufferOff = 0;
  37917. return this.blockSize;
  37918. };
  37919. Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
  37920. var inputOff = 0;
  37921. var outputOff = 0;
  37922. var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
  37923. var out = new Array(count * this.blockSize);
  37924. if (this.bufferOff !== 0) {
  37925. inputOff += this._buffer(data, inputOff);
  37926. if (this.bufferOff === this.buffer.length)
  37927. outputOff += this._flushBuffer(out, outputOff);
  37928. }
  37929. // Write blocks
  37930. var max = data.length - ((data.length - inputOff) % this.blockSize);
  37931. for (; inputOff < max; inputOff += this.blockSize) {
  37932. this._update(data, inputOff, out, outputOff);
  37933. outputOff += this.blockSize;
  37934. }
  37935. // Queue rest
  37936. for (; inputOff < data.length; inputOff++, this.bufferOff++)
  37937. this.buffer[this.bufferOff] = data[inputOff];
  37938. return out;
  37939. };
  37940. Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
  37941. var inputOff = 0;
  37942. var outputOff = 0;
  37943. var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
  37944. var out = new Array(count * this.blockSize);
  37945. // TODO(indutny): optimize it, this is far from optimal
  37946. for (; count > 0; count--) {
  37947. inputOff += this._buffer(data, inputOff);
  37948. outputOff += this._flushBuffer(out, outputOff);
  37949. }
  37950. // Buffer rest of the input
  37951. inputOff += this._buffer(data, inputOff);
  37952. return out;
  37953. };
  37954. Cipher.prototype.final = function final(buffer) {
  37955. var first;
  37956. if (buffer)
  37957. first = this.update(buffer);
  37958. var last;
  37959. if (this.type === 'encrypt')
  37960. last = this._finalEncrypt();
  37961. else
  37962. last = this._finalDecrypt();
  37963. if (first)
  37964. return first.concat(last);
  37965. else
  37966. return last;
  37967. };
  37968. Cipher.prototype._pad = function _pad(buffer, off) {
  37969. if (off === 0)
  37970. return false;
  37971. while (off < buffer.length)
  37972. buffer[off++] = 0;
  37973. return true;
  37974. };
  37975. Cipher.prototype._finalEncrypt = function _finalEncrypt() {
  37976. if (!this._pad(this.buffer, this.bufferOff))
  37977. return [];
  37978. var out = new Array(this.blockSize);
  37979. this._update(this.buffer, 0, out, 0);
  37980. return out;
  37981. };
  37982. Cipher.prototype._unpad = function _unpad(buffer) {
  37983. return buffer;
  37984. };
  37985. Cipher.prototype._finalDecrypt = function _finalDecrypt() {
  37986. assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
  37987. var out = new Array(this.blockSize);
  37988. this._flushBuffer(out, 0);
  37989. return this._unpad(out);
  37990. };
  37991. /***/ }),
  37992. /* 171 */
  37993. /*!***************************************************!*\
  37994. !*** ./node_modules/minimalistic-assert/index.js ***!
  37995. \***************************************************/
  37996. /*! no static exports found */
  37997. /***/ (function(module, exports) {
  37998. module.exports = assert;
  37999. function assert(val, msg) {
  38000. if (!val)
  38001. throw new Error(msg || 'Assertion failed');
  38002. }
  38003. assert.equal = function assertEqual(l, r, msg) {
  38004. if (l != r)
  38005. throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
  38006. };
  38007. /***/ }),
  38008. /* 172 */
  38009. /*!********************************************!*\
  38010. !*** ./node_modules/des.js/lib/des/des.js ***!
  38011. \********************************************/
  38012. /*! no static exports found */
  38013. /***/ (function(module, exports, __webpack_require__) {
  38014. "use strict";
  38015. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  38016. var inherits = __webpack_require__(/*! inherits */ 121);
  38017. var utils = __webpack_require__(/*! ./utils */ 169);
  38018. var Cipher = __webpack_require__(/*! ./cipher */ 170);
  38019. function DESState() {
  38020. this.tmp = new Array(2);
  38021. this.keys = null;
  38022. }
  38023. function DES(options) {
  38024. Cipher.call(this, options);
  38025. var state = new DESState();
  38026. this._desState = state;
  38027. this.deriveKeys(state, options.key);
  38028. }
  38029. inherits(DES, Cipher);
  38030. module.exports = DES;
  38031. DES.create = function create(options) {
  38032. return new DES(options);
  38033. };
  38034. var shiftTable = [
  38035. 1, 1, 2, 2, 2, 2, 2, 2,
  38036. 1, 2, 2, 2, 2, 2, 2, 1
  38037. ];
  38038. DES.prototype.deriveKeys = function deriveKeys(state, key) {
  38039. state.keys = new Array(16 * 2);
  38040. assert.equal(key.length, this.blockSize, 'Invalid key length');
  38041. var kL = utils.readUInt32BE(key, 0);
  38042. var kR = utils.readUInt32BE(key, 4);
  38043. utils.pc1(kL, kR, state.tmp, 0);
  38044. kL = state.tmp[0];
  38045. kR = state.tmp[1];
  38046. for (var i = 0; i < state.keys.length; i += 2) {
  38047. var shift = shiftTable[i >>> 1];
  38048. kL = utils.r28shl(kL, shift);
  38049. kR = utils.r28shl(kR, shift);
  38050. utils.pc2(kL, kR, state.keys, i);
  38051. }
  38052. };
  38053. DES.prototype._update = function _update(inp, inOff, out, outOff) {
  38054. var state = this._desState;
  38055. var l = utils.readUInt32BE(inp, inOff);
  38056. var r = utils.readUInt32BE(inp, inOff + 4);
  38057. // Initial Permutation
  38058. utils.ip(l, r, state.tmp, 0);
  38059. l = state.tmp[0];
  38060. r = state.tmp[1];
  38061. if (this.type === 'encrypt')
  38062. this._encrypt(state, l, r, state.tmp, 0);
  38063. else
  38064. this._decrypt(state, l, r, state.tmp, 0);
  38065. l = state.tmp[0];
  38066. r = state.tmp[1];
  38067. utils.writeUInt32BE(out, l, outOff);
  38068. utils.writeUInt32BE(out, r, outOff + 4);
  38069. };
  38070. DES.prototype._pad = function _pad(buffer, off) {
  38071. var value = buffer.length - off;
  38072. for (var i = off; i < buffer.length; i++)
  38073. buffer[i] = value;
  38074. return true;
  38075. };
  38076. DES.prototype._unpad = function _unpad(buffer) {
  38077. var pad = buffer[buffer.length - 1];
  38078. for (var i = buffer.length - pad; i < buffer.length; i++)
  38079. assert.equal(buffer[i], pad);
  38080. return buffer.slice(0, buffer.length - pad);
  38081. };
  38082. DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
  38083. var l = lStart;
  38084. var r = rStart;
  38085. // Apply f() x16 times
  38086. for (var i = 0; i < state.keys.length; i += 2) {
  38087. var keyL = state.keys[i];
  38088. var keyR = state.keys[i + 1];
  38089. // f(r, k)
  38090. utils.expand(r, state.tmp, 0);
  38091. keyL ^= state.tmp[0];
  38092. keyR ^= state.tmp[1];
  38093. var s = utils.substitute(keyL, keyR);
  38094. var f = utils.permute(s);
  38095. var t = r;
  38096. r = (l ^ f) >>> 0;
  38097. l = t;
  38098. }
  38099. // Reverse Initial Permutation
  38100. utils.rip(r, l, out, off);
  38101. };
  38102. DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
  38103. var l = rStart;
  38104. var r = lStart;
  38105. // Apply f() x16 times
  38106. for (var i = state.keys.length - 2; i >= 0; i -= 2) {
  38107. var keyL = state.keys[i];
  38108. var keyR = state.keys[i + 1];
  38109. // f(r, k)
  38110. utils.expand(l, state.tmp, 0);
  38111. keyL ^= state.tmp[0];
  38112. keyR ^= state.tmp[1];
  38113. var s = utils.substitute(keyL, keyR);
  38114. var f = utils.permute(s);
  38115. var t = l;
  38116. l = (r ^ f) >>> 0;
  38117. r = t;
  38118. }
  38119. // Reverse Initial Permutation
  38120. utils.rip(l, r, out, off);
  38121. };
  38122. /***/ }),
  38123. /* 173 */
  38124. /*!********************************************!*\
  38125. !*** ./node_modules/des.js/lib/des/cbc.js ***!
  38126. \********************************************/
  38127. /*! no static exports found */
  38128. /***/ (function(module, exports, __webpack_require__) {
  38129. "use strict";
  38130. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  38131. var inherits = __webpack_require__(/*! inherits */ 121);
  38132. var proto = {};
  38133. function CBCState(iv) {
  38134. assert.equal(iv.length, 8, 'Invalid IV length');
  38135. this.iv = new Array(8);
  38136. for (var i = 0; i < this.iv.length; i++)
  38137. this.iv[i] = iv[i];
  38138. }
  38139. function instantiate(Base) {
  38140. function CBC(options) {
  38141. Base.call(this, options);
  38142. this._cbcInit();
  38143. }
  38144. inherits(CBC, Base);
  38145. var keys = Object.keys(proto);
  38146. for (var i = 0; i < keys.length; i++) {
  38147. var key = keys[i];
  38148. CBC.prototype[key] = proto[key];
  38149. }
  38150. CBC.create = function create(options) {
  38151. return new CBC(options);
  38152. };
  38153. return CBC;
  38154. }
  38155. exports.instantiate = instantiate;
  38156. proto._cbcInit = function _cbcInit() {
  38157. var state = new CBCState(this.options.iv);
  38158. this._cbcState = state;
  38159. };
  38160. proto._update = function _update(inp, inOff, out, outOff) {
  38161. var state = this._cbcState;
  38162. var superProto = this.constructor.super_.prototype;
  38163. var iv = state.iv;
  38164. if (this.type === 'encrypt') {
  38165. for (var i = 0; i < this.blockSize; i++)
  38166. iv[i] ^= inp[inOff + i];
  38167. superProto._update.call(this, iv, 0, out, outOff);
  38168. for (var i = 0; i < this.blockSize; i++)
  38169. iv[i] = out[outOff + i];
  38170. } else {
  38171. superProto._update.call(this, inp, inOff, out, outOff);
  38172. for (var i = 0; i < this.blockSize; i++)
  38173. out[outOff + i] ^= iv[i];
  38174. for (var i = 0; i < this.blockSize; i++)
  38175. iv[i] = inp[inOff + i];
  38176. }
  38177. };
  38178. /***/ }),
  38179. /* 174 */
  38180. /*!********************************************!*\
  38181. !*** ./node_modules/des.js/lib/des/ede.js ***!
  38182. \********************************************/
  38183. /*! no static exports found */
  38184. /***/ (function(module, exports, __webpack_require__) {
  38185. "use strict";
  38186. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  38187. var inherits = __webpack_require__(/*! inherits */ 121);
  38188. var Cipher = __webpack_require__(/*! ./cipher */ 170);
  38189. var DES = __webpack_require__(/*! ./des */ 172);
  38190. function EDEState(type, key) {
  38191. assert.equal(key.length, 24, 'Invalid key length');
  38192. var k1 = key.slice(0, 8);
  38193. var k2 = key.slice(8, 16);
  38194. var k3 = key.slice(16, 24);
  38195. if (type === 'encrypt') {
  38196. this.ciphers = [
  38197. DES.create({ type: 'encrypt', key: k1 }),
  38198. DES.create({ type: 'decrypt', key: k2 }),
  38199. DES.create({ type: 'encrypt', key: k3 })
  38200. ];
  38201. } else {
  38202. this.ciphers = [
  38203. DES.create({ type: 'decrypt', key: k3 }),
  38204. DES.create({ type: 'encrypt', key: k2 }),
  38205. DES.create({ type: 'decrypt', key: k1 })
  38206. ];
  38207. }
  38208. }
  38209. function EDE(options) {
  38210. Cipher.call(this, options);
  38211. var state = new EDEState(this.type, this.options.key);
  38212. this._edeState = state;
  38213. }
  38214. inherits(EDE, Cipher);
  38215. module.exports = EDE;
  38216. EDE.create = function create(options) {
  38217. return new EDE(options);
  38218. };
  38219. EDE.prototype._update = function _update(inp, inOff, out, outOff) {
  38220. var state = this._edeState;
  38221. state.ciphers[0]._update(inp, inOff, out, outOff);
  38222. state.ciphers[1]._update(out, outOff, out, outOff);
  38223. state.ciphers[2]._update(out, outOff, out, outOff);
  38224. };
  38225. EDE.prototype._pad = DES.prototype._pad;
  38226. EDE.prototype._unpad = DES.prototype._unpad;
  38227. /***/ }),
  38228. /* 175 */
  38229. /*!************************************************!*\
  38230. !*** ./node_modules/browserify-aes/browser.js ***!
  38231. \************************************************/
  38232. /*! no static exports found */
  38233. /***/ (function(module, exports, __webpack_require__) {
  38234. var ciphers = __webpack_require__(/*! ./encrypter */ 176)
  38235. var deciphers = __webpack_require__(/*! ./decrypter */ 193)
  38236. var modes = __webpack_require__(/*! ./modes/list.json */ 187)
  38237. function getCiphers () {
  38238. return Object.keys(modes)
  38239. }
  38240. exports.createCipher = exports.Cipher = ciphers.createCipher
  38241. exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
  38242. exports.createDecipher = exports.Decipher = deciphers.createDecipher
  38243. exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
  38244. exports.listCiphers = exports.getCiphers = getCiphers
  38245. /***/ }),
  38246. /* 176 */
  38247. /*!**************************************************!*\
  38248. !*** ./node_modules/browserify-aes/encrypter.js ***!
  38249. \**************************************************/
  38250. /*! no static exports found */
  38251. /***/ (function(module, exports, __webpack_require__) {
  38252. var MODES = __webpack_require__(/*! ./modes */ 177)
  38253. var AuthCipher = __webpack_require__(/*! ./authCipher */ 188)
  38254. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38255. var StreamCipher = __webpack_require__(/*! ./streamCipher */ 191)
  38256. var Transform = __webpack_require__(/*! cipher-base */ 149)
  38257. var aes = __webpack_require__(/*! ./aes */ 189)
  38258. var ebtk = __webpack_require__(/*! evp_bytestokey */ 192)
  38259. var inherits = __webpack_require__(/*! inherits */ 121)
  38260. function Cipher (mode, key, iv) {
  38261. Transform.call(this)
  38262. this._cache = new Splitter()
  38263. this._cipher = new aes.AES(key)
  38264. this._prev = Buffer.from(iv)
  38265. this._mode = mode
  38266. this._autopadding = true
  38267. }
  38268. inherits(Cipher, Transform)
  38269. Cipher.prototype._update = function (data) {
  38270. this._cache.add(data)
  38271. var chunk
  38272. var thing
  38273. var out = []
  38274. while ((chunk = this._cache.get())) {
  38275. thing = this._mode.encrypt(this, chunk)
  38276. out.push(thing)
  38277. }
  38278. return Buffer.concat(out)
  38279. }
  38280. var PADDING = Buffer.alloc(16, 0x10)
  38281. Cipher.prototype._final = function () {
  38282. var chunk = this._cache.flush()
  38283. if (this._autopadding) {
  38284. chunk = this._mode.encrypt(this, chunk)
  38285. this._cipher.scrub()
  38286. return chunk
  38287. }
  38288. if (!chunk.equals(PADDING)) {
  38289. this._cipher.scrub()
  38290. throw new Error('data not multiple of block length')
  38291. }
  38292. }
  38293. Cipher.prototype.setAutoPadding = function (setTo) {
  38294. this._autopadding = !!setTo
  38295. return this
  38296. }
  38297. function Splitter () {
  38298. this.cache = Buffer.allocUnsafe(0)
  38299. }
  38300. Splitter.prototype.add = function (data) {
  38301. this.cache = Buffer.concat([this.cache, data])
  38302. }
  38303. Splitter.prototype.get = function () {
  38304. if (this.cache.length > 15) {
  38305. var out = this.cache.slice(0, 16)
  38306. this.cache = this.cache.slice(16)
  38307. return out
  38308. }
  38309. return null
  38310. }
  38311. Splitter.prototype.flush = function () {
  38312. var len = 16 - this.cache.length
  38313. var padBuff = Buffer.allocUnsafe(len)
  38314. var i = -1
  38315. while (++i < len) {
  38316. padBuff.writeUInt8(len, i)
  38317. }
  38318. return Buffer.concat([this.cache, padBuff])
  38319. }
  38320. function createCipheriv (suite, password, iv) {
  38321. var config = MODES[suite.toLowerCase()]
  38322. if (!config) throw new TypeError('invalid suite type')
  38323. if (typeof password === 'string') password = Buffer.from(password)
  38324. if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
  38325. if (typeof iv === 'string') iv = Buffer.from(iv)
  38326. if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
  38327. if (config.type === 'stream') {
  38328. return new StreamCipher(config.module, password, iv)
  38329. } else if (config.type === 'auth') {
  38330. return new AuthCipher(config.module, password, iv)
  38331. }
  38332. return new Cipher(config.module, password, iv)
  38333. }
  38334. function createCipher (suite, password) {
  38335. var config = MODES[suite.toLowerCase()]
  38336. if (!config) throw new TypeError('invalid suite type')
  38337. var keys = ebtk(password, false, config.key, config.iv)
  38338. return createCipheriv(suite, keys.key, keys.iv)
  38339. }
  38340. exports.createCipheriv = createCipheriv
  38341. exports.createCipher = createCipher
  38342. /***/ }),
  38343. /* 177 */
  38344. /*!****************************************************!*\
  38345. !*** ./node_modules/browserify-aes/modes/index.js ***!
  38346. \****************************************************/
  38347. /*! no static exports found */
  38348. /***/ (function(module, exports, __webpack_require__) {
  38349. var modeModules = {
  38350. ECB: __webpack_require__(/*! ./ecb */ 178),
  38351. CBC: __webpack_require__(/*! ./cbc */ 179),
  38352. CFB: __webpack_require__(/*! ./cfb */ 181),
  38353. CFB8: __webpack_require__(/*! ./cfb8 */ 182),
  38354. CFB1: __webpack_require__(/*! ./cfb1 */ 183),
  38355. OFB: __webpack_require__(/*! ./ofb */ 184),
  38356. CTR: __webpack_require__(/*! ./ctr */ 185),
  38357. GCM: __webpack_require__(/*! ./ctr */ 185)
  38358. }
  38359. var modes = __webpack_require__(/*! ./list.json */ 187)
  38360. for (var key in modes) {
  38361. modes[key].module = modeModules[modes[key].mode]
  38362. }
  38363. module.exports = modes
  38364. /***/ }),
  38365. /* 178 */
  38366. /*!**************************************************!*\
  38367. !*** ./node_modules/browserify-aes/modes/ecb.js ***!
  38368. \**************************************************/
  38369. /*! no static exports found */
  38370. /***/ (function(module, exports) {
  38371. exports.encrypt = function (self, block) {
  38372. return self._cipher.encryptBlock(block)
  38373. }
  38374. exports.decrypt = function (self, block) {
  38375. return self._cipher.decryptBlock(block)
  38376. }
  38377. /***/ }),
  38378. /* 179 */
  38379. /*!**************************************************!*\
  38380. !*** ./node_modules/browserify-aes/modes/cbc.js ***!
  38381. \**************************************************/
  38382. /*! no static exports found */
  38383. /***/ (function(module, exports, __webpack_require__) {
  38384. var xor = __webpack_require__(/*! buffer-xor */ 180)
  38385. exports.encrypt = function (self, block) {
  38386. var data = xor(block, self._prev)
  38387. self._prev = self._cipher.encryptBlock(data)
  38388. return self._prev
  38389. }
  38390. exports.decrypt = function (self, block) {
  38391. var pad = self._prev
  38392. self._prev = block
  38393. var out = self._cipher.decryptBlock(block)
  38394. return xor(out, pad)
  38395. }
  38396. /***/ }),
  38397. /* 180 */
  38398. /*!******************************************!*\
  38399. !*** ./node_modules/buffer-xor/index.js ***!
  38400. \******************************************/
  38401. /*! no static exports found */
  38402. /***/ (function(module, exports, __webpack_require__) {
  38403. /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
  38404. var length = Math.min(a.length, b.length)
  38405. var buffer = new Buffer(length)
  38406. for (var i = 0; i < length; ++i) {
  38407. buffer[i] = a[i] ^ b[i]
  38408. }
  38409. return buffer
  38410. }
  38411. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
  38412. /***/ }),
  38413. /* 181 */
  38414. /*!**************************************************!*\
  38415. !*** ./node_modules/browserify-aes/modes/cfb.js ***!
  38416. \**************************************************/
  38417. /*! no static exports found */
  38418. /***/ (function(module, exports, __webpack_require__) {
  38419. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38420. var xor = __webpack_require__(/*! buffer-xor */ 180)
  38421. function encryptStart (self, data, decrypt) {
  38422. var len = data.length
  38423. var out = xor(data, self._cache)
  38424. self._cache = self._cache.slice(len)
  38425. self._prev = Buffer.concat([self._prev, decrypt ? data : out])
  38426. return out
  38427. }
  38428. exports.encrypt = function (self, data, decrypt) {
  38429. var out = Buffer.allocUnsafe(0)
  38430. var len
  38431. while (data.length) {
  38432. if (self._cache.length === 0) {
  38433. self._cache = self._cipher.encryptBlock(self._prev)
  38434. self._prev = Buffer.allocUnsafe(0)
  38435. }
  38436. if (self._cache.length <= data.length) {
  38437. len = self._cache.length
  38438. out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
  38439. data = data.slice(len)
  38440. } else {
  38441. out = Buffer.concat([out, encryptStart(self, data, decrypt)])
  38442. break
  38443. }
  38444. }
  38445. return out
  38446. }
  38447. /***/ }),
  38448. /* 182 */
  38449. /*!***************************************************!*\
  38450. !*** ./node_modules/browserify-aes/modes/cfb8.js ***!
  38451. \***************************************************/
  38452. /*! no static exports found */
  38453. /***/ (function(module, exports, __webpack_require__) {
  38454. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38455. function encryptByte (self, byteParam, decrypt) {
  38456. var pad = self._cipher.encryptBlock(self._prev)
  38457. var out = pad[0] ^ byteParam
  38458. self._prev = Buffer.concat([
  38459. self._prev.slice(1),
  38460. Buffer.from([decrypt ? byteParam : out])
  38461. ])
  38462. return out
  38463. }
  38464. exports.encrypt = function (self, chunk, decrypt) {
  38465. var len = chunk.length
  38466. var out = Buffer.allocUnsafe(len)
  38467. var i = -1
  38468. while (++i < len) {
  38469. out[i] = encryptByte(self, chunk[i], decrypt)
  38470. }
  38471. return out
  38472. }
  38473. /***/ }),
  38474. /* 183 */
  38475. /*!***************************************************!*\
  38476. !*** ./node_modules/browserify-aes/modes/cfb1.js ***!
  38477. \***************************************************/
  38478. /*! no static exports found */
  38479. /***/ (function(module, exports, __webpack_require__) {
  38480. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38481. function encryptByte (self, byteParam, decrypt) {
  38482. var pad
  38483. var i = -1
  38484. var len = 8
  38485. var out = 0
  38486. var bit, value
  38487. while (++i < len) {
  38488. pad = self._cipher.encryptBlock(self._prev)
  38489. bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
  38490. value = pad[0] ^ bit
  38491. out += ((value & 0x80) >> (i % 8))
  38492. self._prev = shiftIn(self._prev, decrypt ? bit : value)
  38493. }
  38494. return out
  38495. }
  38496. function shiftIn (buffer, value) {
  38497. var len = buffer.length
  38498. var i = -1
  38499. var out = Buffer.allocUnsafe(buffer.length)
  38500. buffer = Buffer.concat([buffer, Buffer.from([value])])
  38501. while (++i < len) {
  38502. out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
  38503. }
  38504. return out
  38505. }
  38506. exports.encrypt = function (self, chunk, decrypt) {
  38507. var len = chunk.length
  38508. var out = Buffer.allocUnsafe(len)
  38509. var i = -1
  38510. while (++i < len) {
  38511. out[i] = encryptByte(self, chunk[i], decrypt)
  38512. }
  38513. return out
  38514. }
  38515. /***/ }),
  38516. /* 184 */
  38517. /*!**************************************************!*\
  38518. !*** ./node_modules/browserify-aes/modes/ofb.js ***!
  38519. \**************************************************/
  38520. /*! no static exports found */
  38521. /***/ (function(module, exports, __webpack_require__) {
  38522. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(/*! buffer-xor */ 180)
  38523. function getBlock (self) {
  38524. self._prev = self._cipher.encryptBlock(self._prev)
  38525. return self._prev
  38526. }
  38527. exports.encrypt = function (self, chunk) {
  38528. while (self._cache.length < chunk.length) {
  38529. self._cache = Buffer.concat([self._cache, getBlock(self)])
  38530. }
  38531. var pad = self._cache.slice(0, chunk.length)
  38532. self._cache = self._cache.slice(chunk.length)
  38533. return xor(chunk, pad)
  38534. }
  38535. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 116).Buffer))
  38536. /***/ }),
  38537. /* 185 */
  38538. /*!**************************************************!*\
  38539. !*** ./node_modules/browserify-aes/modes/ctr.js ***!
  38540. \**************************************************/
  38541. /*! no static exports found */
  38542. /***/ (function(module, exports, __webpack_require__) {
  38543. var xor = __webpack_require__(/*! buffer-xor */ 180)
  38544. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38545. var incr32 = __webpack_require__(/*! ../incr32 */ 186)
  38546. function getBlock (self) {
  38547. var out = self._cipher.encryptBlockRaw(self._prev)
  38548. incr32(self._prev)
  38549. return out
  38550. }
  38551. var blockSize = 16
  38552. exports.encrypt = function (self, chunk) {
  38553. var chunkNum = Math.ceil(chunk.length / blockSize)
  38554. var start = self._cache.length
  38555. self._cache = Buffer.concat([
  38556. self._cache,
  38557. Buffer.allocUnsafe(chunkNum * blockSize)
  38558. ])
  38559. for (var i = 0; i < chunkNum; i++) {
  38560. var out = getBlock(self)
  38561. var offset = start + i * blockSize
  38562. self._cache.writeUInt32BE(out[0], offset + 0)
  38563. self._cache.writeUInt32BE(out[1], offset + 4)
  38564. self._cache.writeUInt32BE(out[2], offset + 8)
  38565. self._cache.writeUInt32BE(out[3], offset + 12)
  38566. }
  38567. var pad = self._cache.slice(0, chunk.length)
  38568. self._cache = self._cache.slice(chunk.length)
  38569. return xor(chunk, pad)
  38570. }
  38571. /***/ }),
  38572. /* 186 */
  38573. /*!***********************************************!*\
  38574. !*** ./node_modules/browserify-aes/incr32.js ***!
  38575. \***********************************************/
  38576. /*! no static exports found */
  38577. /***/ (function(module, exports) {
  38578. function incr32 (iv) {
  38579. var len = iv.length
  38580. var item
  38581. while (len--) {
  38582. item = iv.readUInt8(len)
  38583. if (item === 255) {
  38584. iv.writeUInt8(0, len)
  38585. } else {
  38586. item++
  38587. iv.writeUInt8(item, len)
  38588. break
  38589. }
  38590. }
  38591. }
  38592. module.exports = incr32
  38593. /***/ }),
  38594. /* 187 */
  38595. /*!*****************************************************!*\
  38596. !*** ./node_modules/browserify-aes/modes/list.json ***!
  38597. \*****************************************************/
  38598. /*! 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 */
  38599. /***/ (function(module) {
  38600. 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\"}}");
  38601. /***/ }),
  38602. /* 188 */
  38603. /*!***************************************************!*\
  38604. !*** ./node_modules/browserify-aes/authCipher.js ***!
  38605. \***************************************************/
  38606. /*! no static exports found */
  38607. /***/ (function(module, exports, __webpack_require__) {
  38608. var aes = __webpack_require__(/*! ./aes */ 189)
  38609. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38610. var Transform = __webpack_require__(/*! cipher-base */ 149)
  38611. var inherits = __webpack_require__(/*! inherits */ 121)
  38612. var GHASH = __webpack_require__(/*! ./ghash */ 190)
  38613. var xor = __webpack_require__(/*! buffer-xor */ 180)
  38614. var incr32 = __webpack_require__(/*! ./incr32 */ 186)
  38615. function xorTest (a, b) {
  38616. var out = 0
  38617. if (a.length !== b.length) out++
  38618. var len = Math.min(a.length, b.length)
  38619. for (var i = 0; i < len; ++i) {
  38620. out += (a[i] ^ b[i])
  38621. }
  38622. return out
  38623. }
  38624. function calcIv (self, iv, ck) {
  38625. if (iv.length === 12) {
  38626. self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])
  38627. return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])
  38628. }
  38629. var ghash = new GHASH(ck)
  38630. var len = iv.length
  38631. var toPad = len % 16
  38632. ghash.update(iv)
  38633. if (toPad) {
  38634. toPad = 16 - toPad
  38635. ghash.update(Buffer.alloc(toPad, 0))
  38636. }
  38637. ghash.update(Buffer.alloc(8, 0))
  38638. var ivBits = len * 8
  38639. var tail = Buffer.alloc(8)
  38640. tail.writeUIntBE(ivBits, 0, 8)
  38641. ghash.update(tail)
  38642. self._finID = ghash.state
  38643. var out = Buffer.from(self._finID)
  38644. incr32(out)
  38645. return out
  38646. }
  38647. function StreamCipher (mode, key, iv, decrypt) {
  38648. Transform.call(this)
  38649. var h = Buffer.alloc(4, 0)
  38650. this._cipher = new aes.AES(key)
  38651. var ck = this._cipher.encryptBlock(h)
  38652. this._ghash = new GHASH(ck)
  38653. iv = calcIv(this, iv, ck)
  38654. this._prev = Buffer.from(iv)
  38655. this._cache = Buffer.allocUnsafe(0)
  38656. this._secCache = Buffer.allocUnsafe(0)
  38657. this._decrypt = decrypt
  38658. this._alen = 0
  38659. this._len = 0
  38660. this._mode = mode
  38661. this._authTag = null
  38662. this._called = false
  38663. }
  38664. inherits(StreamCipher, Transform)
  38665. StreamCipher.prototype._update = function (chunk) {
  38666. if (!this._called && this._alen) {
  38667. var rump = 16 - (this._alen % 16)
  38668. if (rump < 16) {
  38669. rump = Buffer.alloc(rump, 0)
  38670. this._ghash.update(rump)
  38671. }
  38672. }
  38673. this._called = true
  38674. var out = this._mode.encrypt(this, chunk)
  38675. if (this._decrypt) {
  38676. this._ghash.update(chunk)
  38677. } else {
  38678. this._ghash.update(out)
  38679. }
  38680. this._len += chunk.length
  38681. return out
  38682. }
  38683. StreamCipher.prototype._final = function () {
  38684. if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')
  38685. var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
  38686. if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')
  38687. this._authTag = tag
  38688. this._cipher.scrub()
  38689. }
  38690. StreamCipher.prototype.getAuthTag = function getAuthTag () {
  38691. if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')
  38692. return this._authTag
  38693. }
  38694. StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
  38695. if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')
  38696. this._authTag = tag
  38697. }
  38698. StreamCipher.prototype.setAAD = function setAAD (buf) {
  38699. if (this._called) throw new Error('Attempting to set AAD in unsupported state')
  38700. this._ghash.update(buf)
  38701. this._alen += buf.length
  38702. }
  38703. module.exports = StreamCipher
  38704. /***/ }),
  38705. /* 189 */
  38706. /*!********************************************!*\
  38707. !*** ./node_modules/browserify-aes/aes.js ***!
  38708. \********************************************/
  38709. /*! no static exports found */
  38710. /***/ (function(module, exports, __webpack_require__) {
  38711. // based on the aes implimentation in triple sec
  38712. // https://github.com/keybase/triplesec
  38713. // which is in turn based on the one from crypto-js
  38714. // https://code.google.com/p/crypto-js/
  38715. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38716. function asUInt32Array (buf) {
  38717. if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
  38718. var len = (buf.length / 4) | 0
  38719. var out = new Array(len)
  38720. for (var i = 0; i < len; i++) {
  38721. out[i] = buf.readUInt32BE(i * 4)
  38722. }
  38723. return out
  38724. }
  38725. function scrubVec (v) {
  38726. for (var i = 0; i < v.length; v++) {
  38727. v[i] = 0
  38728. }
  38729. }
  38730. function cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {
  38731. var SUB_MIX0 = SUB_MIX[0]
  38732. var SUB_MIX1 = SUB_MIX[1]
  38733. var SUB_MIX2 = SUB_MIX[2]
  38734. var SUB_MIX3 = SUB_MIX[3]
  38735. var s0 = M[0] ^ keySchedule[0]
  38736. var s1 = M[1] ^ keySchedule[1]
  38737. var s2 = M[2] ^ keySchedule[2]
  38738. var s3 = M[3] ^ keySchedule[3]
  38739. var t0, t1, t2, t3
  38740. var ksRow = 4
  38741. for (var round = 1; round < nRounds; round++) {
  38742. t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]
  38743. t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]
  38744. t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]
  38745. t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]
  38746. s0 = t0
  38747. s1 = t1
  38748. s2 = t2
  38749. s3 = t3
  38750. }
  38751. t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
  38752. t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
  38753. t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
  38754. t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
  38755. t0 = t0 >>> 0
  38756. t1 = t1 >>> 0
  38757. t2 = t2 >>> 0
  38758. t3 = t3 >>> 0
  38759. return [t0, t1, t2, t3]
  38760. }
  38761. // AES constants
  38762. var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
  38763. var G = (function () {
  38764. // Compute double table
  38765. var d = new Array(256)
  38766. for (var j = 0; j < 256; j++) {
  38767. if (j < 128) {
  38768. d[j] = j << 1
  38769. } else {
  38770. d[j] = (j << 1) ^ 0x11b
  38771. }
  38772. }
  38773. var SBOX = []
  38774. var INV_SBOX = []
  38775. var SUB_MIX = [[], [], [], []]
  38776. var INV_SUB_MIX = [[], [], [], []]
  38777. // Walk GF(2^8)
  38778. var x = 0
  38779. var xi = 0
  38780. for (var i = 0; i < 256; ++i) {
  38781. // Compute sbox
  38782. var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
  38783. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
  38784. SBOX[x] = sx
  38785. INV_SBOX[sx] = x
  38786. // Compute multiplication
  38787. var x2 = d[x]
  38788. var x4 = d[x2]
  38789. var x8 = d[x4]
  38790. // Compute sub bytes, mix columns tables
  38791. var t = (d[sx] * 0x101) ^ (sx * 0x1010100)
  38792. SUB_MIX[0][x] = (t << 24) | (t >>> 8)
  38793. SUB_MIX[1][x] = (t << 16) | (t >>> 16)
  38794. SUB_MIX[2][x] = (t << 8) | (t >>> 24)
  38795. SUB_MIX[3][x] = t
  38796. // Compute inv sub bytes, inv mix columns tables
  38797. t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
  38798. INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
  38799. INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
  38800. INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
  38801. INV_SUB_MIX[3][sx] = t
  38802. if (x === 0) {
  38803. x = xi = 1
  38804. } else {
  38805. x = x2 ^ d[d[d[x8 ^ x2]]]
  38806. xi ^= d[d[xi]]
  38807. }
  38808. }
  38809. return {
  38810. SBOX: SBOX,
  38811. INV_SBOX: INV_SBOX,
  38812. SUB_MIX: SUB_MIX,
  38813. INV_SUB_MIX: INV_SUB_MIX
  38814. }
  38815. })()
  38816. function AES (key) {
  38817. this._key = asUInt32Array(key)
  38818. this._reset()
  38819. }
  38820. AES.blockSize = 4 * 4
  38821. AES.keySize = 256 / 8
  38822. AES.prototype.blockSize = AES.blockSize
  38823. AES.prototype.keySize = AES.keySize
  38824. AES.prototype._reset = function () {
  38825. var keyWords = this._key
  38826. var keySize = keyWords.length
  38827. var nRounds = keySize + 6
  38828. var ksRows = (nRounds + 1) * 4
  38829. var keySchedule = []
  38830. for (var k = 0; k < keySize; k++) {
  38831. keySchedule[k] = keyWords[k]
  38832. }
  38833. for (k = keySize; k < ksRows; k++) {
  38834. var t = keySchedule[k - 1]
  38835. if (k % keySize === 0) {
  38836. t = (t << 8) | (t >>> 24)
  38837. t =
  38838. (G.SBOX[t >>> 24] << 24) |
  38839. (G.SBOX[(t >>> 16) & 0xff] << 16) |
  38840. (G.SBOX[(t >>> 8) & 0xff] << 8) |
  38841. (G.SBOX[t & 0xff])
  38842. t ^= RCON[(k / keySize) | 0] << 24
  38843. } else if (keySize > 6 && k % keySize === 4) {
  38844. t =
  38845. (G.SBOX[t >>> 24] << 24) |
  38846. (G.SBOX[(t >>> 16) & 0xff] << 16) |
  38847. (G.SBOX[(t >>> 8) & 0xff] << 8) |
  38848. (G.SBOX[t & 0xff])
  38849. }
  38850. keySchedule[k] = keySchedule[k - keySize] ^ t
  38851. }
  38852. var invKeySchedule = []
  38853. for (var ik = 0; ik < ksRows; ik++) {
  38854. var ksR = ksRows - ik
  38855. var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]
  38856. if (ik < 4 || ksR <= 4) {
  38857. invKeySchedule[ik] = tt
  38858. } else {
  38859. invKeySchedule[ik] =
  38860. G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^
  38861. G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^
  38862. G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^
  38863. G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]
  38864. }
  38865. }
  38866. this._nRounds = nRounds
  38867. this._keySchedule = keySchedule
  38868. this._invKeySchedule = invKeySchedule
  38869. }
  38870. AES.prototype.encryptBlockRaw = function (M) {
  38871. M = asUInt32Array(M)
  38872. return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
  38873. }
  38874. AES.prototype.encryptBlock = function (M) {
  38875. var out = this.encryptBlockRaw(M)
  38876. var buf = Buffer.allocUnsafe(16)
  38877. buf.writeUInt32BE(out[0], 0)
  38878. buf.writeUInt32BE(out[1], 4)
  38879. buf.writeUInt32BE(out[2], 8)
  38880. buf.writeUInt32BE(out[3], 12)
  38881. return buf
  38882. }
  38883. AES.prototype.decryptBlock = function (M) {
  38884. M = asUInt32Array(M)
  38885. // swap
  38886. var m1 = M[1]
  38887. M[1] = M[3]
  38888. M[3] = m1
  38889. var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)
  38890. var buf = Buffer.allocUnsafe(16)
  38891. buf.writeUInt32BE(out[0], 0)
  38892. buf.writeUInt32BE(out[3], 4)
  38893. buf.writeUInt32BE(out[2], 8)
  38894. buf.writeUInt32BE(out[1], 12)
  38895. return buf
  38896. }
  38897. AES.prototype.scrub = function () {
  38898. scrubVec(this._keySchedule)
  38899. scrubVec(this._invKeySchedule)
  38900. scrubVec(this._key)
  38901. }
  38902. module.exports.AES = AES
  38903. /***/ }),
  38904. /* 190 */
  38905. /*!**********************************************!*\
  38906. !*** ./node_modules/browserify-aes/ghash.js ***!
  38907. \**********************************************/
  38908. /*! no static exports found */
  38909. /***/ (function(module, exports, __webpack_require__) {
  38910. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38911. var ZEROES = Buffer.alloc(16, 0)
  38912. function toArray (buf) {
  38913. return [
  38914. buf.readUInt32BE(0),
  38915. buf.readUInt32BE(4),
  38916. buf.readUInt32BE(8),
  38917. buf.readUInt32BE(12)
  38918. ]
  38919. }
  38920. function fromArray (out) {
  38921. var buf = Buffer.allocUnsafe(16)
  38922. buf.writeUInt32BE(out[0] >>> 0, 0)
  38923. buf.writeUInt32BE(out[1] >>> 0, 4)
  38924. buf.writeUInt32BE(out[2] >>> 0, 8)
  38925. buf.writeUInt32BE(out[3] >>> 0, 12)
  38926. return buf
  38927. }
  38928. function GHASH (key) {
  38929. this.h = key
  38930. this.state = Buffer.alloc(16, 0)
  38931. this.cache = Buffer.allocUnsafe(0)
  38932. }
  38933. // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
  38934. // by Juho Vähä-Herttua
  38935. GHASH.prototype.ghash = function (block) {
  38936. var i = -1
  38937. while (++i < block.length) {
  38938. this.state[i] ^= block[i]
  38939. }
  38940. this._multiply()
  38941. }
  38942. GHASH.prototype._multiply = function () {
  38943. var Vi = toArray(this.h)
  38944. var Zi = [0, 0, 0, 0]
  38945. var j, xi, lsbVi
  38946. var i = -1
  38947. while (++i < 128) {
  38948. xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0
  38949. if (xi) {
  38950. // Z_i+1 = Z_i ^ V_i
  38951. Zi[0] ^= Vi[0]
  38952. Zi[1] ^= Vi[1]
  38953. Zi[2] ^= Vi[2]
  38954. Zi[3] ^= Vi[3]
  38955. }
  38956. // Store the value of LSB(V_i)
  38957. lsbVi = (Vi[3] & 1) !== 0
  38958. // V_i+1 = V_i >> 1
  38959. for (j = 3; j > 0; j--) {
  38960. Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
  38961. }
  38962. Vi[0] = Vi[0] >>> 1
  38963. // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
  38964. if (lsbVi) {
  38965. Vi[0] = Vi[0] ^ (0xe1 << 24)
  38966. }
  38967. }
  38968. this.state = fromArray(Zi)
  38969. }
  38970. GHASH.prototype.update = function (buf) {
  38971. this.cache = Buffer.concat([this.cache, buf])
  38972. var chunk
  38973. while (this.cache.length >= 16) {
  38974. chunk = this.cache.slice(0, 16)
  38975. this.cache = this.cache.slice(16)
  38976. this.ghash(chunk)
  38977. }
  38978. }
  38979. GHASH.prototype.final = function (abl, bl) {
  38980. if (this.cache.length) {
  38981. this.ghash(Buffer.concat([this.cache, ZEROES], 16))
  38982. }
  38983. this.ghash(fromArray([0, abl, 0, bl]))
  38984. return this.state
  38985. }
  38986. module.exports = GHASH
  38987. /***/ }),
  38988. /* 191 */
  38989. /*!*****************************************************!*\
  38990. !*** ./node_modules/browserify-aes/streamCipher.js ***!
  38991. \*****************************************************/
  38992. /*! no static exports found */
  38993. /***/ (function(module, exports, __webpack_require__) {
  38994. var aes = __webpack_require__(/*! ./aes */ 189)
  38995. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  38996. var Transform = __webpack_require__(/*! cipher-base */ 149)
  38997. var inherits = __webpack_require__(/*! inherits */ 121)
  38998. function StreamCipher (mode, key, iv, decrypt) {
  38999. Transform.call(this)
  39000. this._cipher = new aes.AES(key)
  39001. this._prev = Buffer.from(iv)
  39002. this._cache = Buffer.allocUnsafe(0)
  39003. this._secCache = Buffer.allocUnsafe(0)
  39004. this._decrypt = decrypt
  39005. this._mode = mode
  39006. }
  39007. inherits(StreamCipher, Transform)
  39008. StreamCipher.prototype._update = function (chunk) {
  39009. return this._mode.encrypt(this, chunk, this._decrypt)
  39010. }
  39011. StreamCipher.prototype._final = function () {
  39012. this._cipher.scrub()
  39013. }
  39014. module.exports = StreamCipher
  39015. /***/ }),
  39016. /* 192 */
  39017. /*!**********************************************!*\
  39018. !*** ./node_modules/evp_bytestokey/index.js ***!
  39019. \**********************************************/
  39020. /*! no static exports found */
  39021. /***/ (function(module, exports, __webpack_require__) {
  39022. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  39023. var MD5 = __webpack_require__(/*! md5.js */ 122)
  39024. /* eslint-disable camelcase */
  39025. function EVP_BytesToKey (password, salt, keyBits, ivLen) {
  39026. if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
  39027. if (salt) {
  39028. if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
  39029. if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
  39030. }
  39031. var keyLen = keyBits / 8
  39032. var key = Buffer.alloc(keyLen)
  39033. var iv = Buffer.alloc(ivLen || 0)
  39034. var tmp = Buffer.alloc(0)
  39035. while (keyLen > 0 || ivLen > 0) {
  39036. var hash = new MD5()
  39037. hash.update(tmp)
  39038. hash.update(password)
  39039. if (salt) hash.update(salt)
  39040. tmp = hash.digest()
  39041. var used = 0
  39042. if (keyLen > 0) {
  39043. var keyStart = key.length - keyLen
  39044. used = Math.min(keyLen, tmp.length)
  39045. tmp.copy(key, keyStart, 0, used)
  39046. keyLen -= used
  39047. }
  39048. if (used < tmp.length && ivLen > 0) {
  39049. var ivStart = iv.length - ivLen
  39050. var length = Math.min(ivLen, tmp.length - used)
  39051. tmp.copy(iv, ivStart, used, used + length)
  39052. ivLen -= length
  39053. }
  39054. }
  39055. tmp.fill(0)
  39056. return { key: key, iv: iv }
  39057. }
  39058. module.exports = EVP_BytesToKey
  39059. /***/ }),
  39060. /* 193 */
  39061. /*!**************************************************!*\
  39062. !*** ./node_modules/browserify-aes/decrypter.js ***!
  39063. \**************************************************/
  39064. /*! no static exports found */
  39065. /***/ (function(module, exports, __webpack_require__) {
  39066. var AuthCipher = __webpack_require__(/*! ./authCipher */ 188)
  39067. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  39068. var MODES = __webpack_require__(/*! ./modes */ 177)
  39069. var StreamCipher = __webpack_require__(/*! ./streamCipher */ 191)
  39070. var Transform = __webpack_require__(/*! cipher-base */ 149)
  39071. var aes = __webpack_require__(/*! ./aes */ 189)
  39072. var ebtk = __webpack_require__(/*! evp_bytestokey */ 192)
  39073. var inherits = __webpack_require__(/*! inherits */ 121)
  39074. function Decipher (mode, key, iv) {
  39075. Transform.call(this)
  39076. this._cache = new Splitter()
  39077. this._last = void 0
  39078. this._cipher = new aes.AES(key)
  39079. this._prev = Buffer.from(iv)
  39080. this._mode = mode
  39081. this._autopadding = true
  39082. }
  39083. inherits(Decipher, Transform)
  39084. Decipher.prototype._update = function (data) {
  39085. this._cache.add(data)
  39086. var chunk
  39087. var thing
  39088. var out = []
  39089. while ((chunk = this._cache.get(this._autopadding))) {
  39090. thing = this._mode.decrypt(this, chunk)
  39091. out.push(thing)
  39092. }
  39093. return Buffer.concat(out)
  39094. }
  39095. Decipher.prototype._final = function () {
  39096. var chunk = this._cache.flush()
  39097. if (this._autopadding) {
  39098. return unpad(this._mode.decrypt(this, chunk))
  39099. } else if (chunk) {
  39100. throw new Error('data not multiple of block length')
  39101. }
  39102. }
  39103. Decipher.prototype.setAutoPadding = function (setTo) {
  39104. this._autopadding = !!setTo
  39105. return this
  39106. }
  39107. function Splitter () {
  39108. this.cache = Buffer.allocUnsafe(0)
  39109. }
  39110. Splitter.prototype.add = function (data) {
  39111. this.cache = Buffer.concat([this.cache, data])
  39112. }
  39113. Splitter.prototype.get = function (autoPadding) {
  39114. var out
  39115. if (autoPadding) {
  39116. if (this.cache.length > 16) {
  39117. out = this.cache.slice(0, 16)
  39118. this.cache = this.cache.slice(16)
  39119. return out
  39120. }
  39121. } else {
  39122. if (this.cache.length >= 16) {
  39123. out = this.cache.slice(0, 16)
  39124. this.cache = this.cache.slice(16)
  39125. return out
  39126. }
  39127. }
  39128. return null
  39129. }
  39130. Splitter.prototype.flush = function () {
  39131. if (this.cache.length) return this.cache
  39132. }
  39133. function unpad (last) {
  39134. var padded = last[15]
  39135. if (padded < 1 || padded > 16) {
  39136. throw new Error('unable to decrypt data')
  39137. }
  39138. var i = -1
  39139. while (++i < padded) {
  39140. if (last[(i + (16 - padded))] !== padded) {
  39141. throw new Error('unable to decrypt data')
  39142. }
  39143. }
  39144. if (padded === 16) return
  39145. return last.slice(0, 16 - padded)
  39146. }
  39147. function createDecipheriv (suite, password, iv) {
  39148. var config = MODES[suite.toLowerCase()]
  39149. if (!config) throw new TypeError('invalid suite type')
  39150. if (typeof iv === 'string') iv = Buffer.from(iv)
  39151. if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length)
  39152. if (typeof password === 'string') password = Buffer.from(password)
  39153. if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length)
  39154. if (config.type === 'stream') {
  39155. return new StreamCipher(config.module, password, iv, true)
  39156. } else if (config.type === 'auth') {
  39157. return new AuthCipher(config.module, password, iv, true)
  39158. }
  39159. return new Decipher(config.module, password, iv)
  39160. }
  39161. function createDecipher (suite, password) {
  39162. var config = MODES[suite.toLowerCase()]
  39163. if (!config) throw new TypeError('invalid suite type')
  39164. var keys = ebtk(password, false, config.key, config.iv)
  39165. return createDecipheriv(suite, keys.key, keys.iv)
  39166. }
  39167. exports.createDecipher = createDecipher
  39168. exports.createDecipheriv = createDecipheriv
  39169. /***/ }),
  39170. /* 194 */
  39171. /*!**********************************************!*\
  39172. !*** ./node_modules/browserify-des/modes.js ***!
  39173. \**********************************************/
  39174. /*! no static exports found */
  39175. /***/ (function(module, exports) {
  39176. exports['des-ecb'] = {
  39177. key: 8,
  39178. iv: 0
  39179. }
  39180. exports['des-cbc'] = exports.des = {
  39181. key: 8,
  39182. iv: 8
  39183. }
  39184. exports['des-ede3-cbc'] = exports.des3 = {
  39185. key: 24,
  39186. iv: 8
  39187. }
  39188. exports['des-ede3'] = {
  39189. key: 24,
  39190. iv: 0
  39191. }
  39192. exports['des-ede-cbc'] = {
  39193. key: 16,
  39194. iv: 8
  39195. }
  39196. exports['des-ede'] = {
  39197. key: 16,
  39198. iv: 0
  39199. }
  39200. /***/ }),
  39201. /* 195 */
  39202. /*!************************************************!*\
  39203. !*** ./node_modules/diffie-hellman/browser.js ***!
  39204. \************************************************/
  39205. /*! no static exports found */
  39206. /***/ (function(module, exports, __webpack_require__) {
  39207. /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(/*! ./lib/generatePrime */ 196)
  39208. var primes = __webpack_require__(/*! ./lib/primes.json */ 203)
  39209. var DH = __webpack_require__(/*! ./lib/dh */ 204)
  39210. function getDiffieHellman (mod) {
  39211. var prime = new Buffer(primes[mod].prime, 'hex')
  39212. var gen = new Buffer(primes[mod].gen, 'hex')
  39213. return new DH(prime, gen)
  39214. }
  39215. var ENCODINGS = {
  39216. 'binary': true, 'hex': true, 'base64': true
  39217. }
  39218. function createDiffieHellman (prime, enc, generator, genc) {
  39219. if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
  39220. return createDiffieHellman(prime, 'binary', enc, generator)
  39221. }
  39222. enc = enc || 'binary'
  39223. genc = genc || 'binary'
  39224. generator = generator || new Buffer([2])
  39225. if (!Buffer.isBuffer(generator)) {
  39226. generator = new Buffer(generator, genc)
  39227. }
  39228. if (typeof prime === 'number') {
  39229. return new DH(generatePrime(prime, generator), generator, true)
  39230. }
  39231. if (!Buffer.isBuffer(prime)) {
  39232. prime = new Buffer(prime, enc)
  39233. }
  39234. return new DH(prime, generator, true)
  39235. }
  39236. exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
  39237. exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
  39238. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
  39239. /***/ }),
  39240. /* 196 */
  39241. /*!**********************************************************!*\
  39242. !*** ./node_modules/diffie-hellman/lib/generatePrime.js ***!
  39243. \**********************************************************/
  39244. /*! no static exports found */
  39245. /***/ (function(module, exports, __webpack_require__) {
  39246. var randomBytes = __webpack_require__(/*! randombytes */ 112);
  39247. module.exports = findPrime;
  39248. findPrime.simpleSieve = simpleSieve;
  39249. findPrime.fermatTest = fermatTest;
  39250. var BN = __webpack_require__(/*! bn.js */ 197);
  39251. var TWENTYFOUR = new BN(24);
  39252. var MillerRabin = __webpack_require__(/*! miller-rabin */ 200);
  39253. var millerRabin = new MillerRabin();
  39254. var ONE = new BN(1);
  39255. var TWO = new BN(2);
  39256. var FIVE = new BN(5);
  39257. var SIXTEEN = new BN(16);
  39258. var EIGHT = new BN(8);
  39259. var TEN = new BN(10);
  39260. var THREE = new BN(3);
  39261. var SEVEN = new BN(7);
  39262. var ELEVEN = new BN(11);
  39263. var FOUR = new BN(4);
  39264. var TWELVE = new BN(12);
  39265. var primes = null;
  39266. function _getPrimes() {
  39267. if (primes !== null)
  39268. return primes;
  39269. var limit = 0x100000;
  39270. var res = [];
  39271. res[0] = 2;
  39272. for (var i = 1, k = 3; k < limit; k += 2) {
  39273. var sqrt = Math.ceil(Math.sqrt(k));
  39274. for (var j = 0; j < i && res[j] <= sqrt; j++)
  39275. if (k % res[j] === 0)
  39276. break;
  39277. if (i !== j && res[j] <= sqrt)
  39278. continue;
  39279. res[i++] = k;
  39280. }
  39281. primes = res;
  39282. return res;
  39283. }
  39284. function simpleSieve(p) {
  39285. var primes = _getPrimes();
  39286. for (var i = 0; i < primes.length; i++)
  39287. if (p.modn(primes[i]) === 0) {
  39288. if (p.cmpn(primes[i]) === 0) {
  39289. return true;
  39290. } else {
  39291. return false;
  39292. }
  39293. }
  39294. return true;
  39295. }
  39296. function fermatTest(p) {
  39297. var red = BN.mont(p);
  39298. return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
  39299. }
  39300. function findPrime(bits, gen) {
  39301. if (bits < 16) {
  39302. // this is what openssl does
  39303. if (gen === 2 || gen === 5) {
  39304. return new BN([0x8c, 0x7b]);
  39305. } else {
  39306. return new BN([0x8c, 0x27]);
  39307. }
  39308. }
  39309. gen = new BN(gen);
  39310. var num, n2;
  39311. while (true) {
  39312. num = new BN(randomBytes(Math.ceil(bits / 8)));
  39313. while (num.bitLength() > bits) {
  39314. num.ishrn(1);
  39315. }
  39316. if (num.isEven()) {
  39317. num.iadd(ONE);
  39318. }
  39319. if (!num.testn(1)) {
  39320. num.iadd(TWO);
  39321. }
  39322. if (!gen.cmp(TWO)) {
  39323. while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
  39324. num.iadd(FOUR);
  39325. }
  39326. } else if (!gen.cmp(FIVE)) {
  39327. while (num.mod(TEN).cmp(THREE)) {
  39328. num.iadd(FOUR);
  39329. }
  39330. }
  39331. n2 = num.shrn(1);
  39332. if (simpleSieve(n2) && simpleSieve(num) &&
  39333. fermatTest(n2) && fermatTest(num) &&
  39334. millerRabin.test(n2) && millerRabin.test(num)) {
  39335. return num;
  39336. }
  39337. }
  39338. }
  39339. /***/ }),
  39340. /* 197 */
  39341. /*!**************************************!*\
  39342. !*** ./node_modules/bn.js/lib/bn.js ***!
  39343. \**************************************/
  39344. /*! no static exports found */
  39345. /***/ (function(module, exports, __webpack_require__) {
  39346. /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
  39347. 'use strict';
  39348. // Utils
  39349. function assert (val, msg) {
  39350. if (!val) throw new Error(msg || 'Assertion failed');
  39351. }
  39352. // Could use `inherits` module, but don't want to move from single file
  39353. // architecture yet.
  39354. function inherits (ctor, superCtor) {
  39355. ctor.super_ = superCtor;
  39356. var TempCtor = function () {};
  39357. TempCtor.prototype = superCtor.prototype;
  39358. ctor.prototype = new TempCtor();
  39359. ctor.prototype.constructor = ctor;
  39360. }
  39361. // BN
  39362. function BN (number, base, endian) {
  39363. if (BN.isBN(number)) {
  39364. return number;
  39365. }
  39366. this.negative = 0;
  39367. this.words = null;
  39368. this.length = 0;
  39369. // Reduction context
  39370. this.red = null;
  39371. if (number !== null) {
  39372. if (base === 'le' || base === 'be') {
  39373. endian = base;
  39374. base = 10;
  39375. }
  39376. this._init(number || 0, base || 10, endian || 'be');
  39377. }
  39378. }
  39379. if (typeof module === 'object') {
  39380. module.exports = BN;
  39381. } else {
  39382. exports.BN = BN;
  39383. }
  39384. BN.BN = BN;
  39385. BN.wordSize = 26;
  39386. var Buffer;
  39387. try {
  39388. if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
  39389. Buffer = window.Buffer;
  39390. } else {
  39391. Buffer = __webpack_require__(/*! buffer */ 199).Buffer;
  39392. }
  39393. } catch (e) {
  39394. }
  39395. BN.isBN = function isBN (num) {
  39396. if (num instanceof BN) {
  39397. return true;
  39398. }
  39399. return num !== null && typeof num === 'object' &&
  39400. num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
  39401. };
  39402. BN.max = function max (left, right) {
  39403. if (left.cmp(right) > 0) return left;
  39404. return right;
  39405. };
  39406. BN.min = function min (left, right) {
  39407. if (left.cmp(right) < 0) return left;
  39408. return right;
  39409. };
  39410. BN.prototype._init = function init (number, base, endian) {
  39411. if (typeof number === 'number') {
  39412. return this._initNumber(number, base, endian);
  39413. }
  39414. if (typeof number === 'object') {
  39415. return this._initArray(number, base, endian);
  39416. }
  39417. if (base === 'hex') {
  39418. base = 16;
  39419. }
  39420. assert(base === (base | 0) && base >= 2 && base <= 36);
  39421. number = number.toString().replace(/\s+/g, '');
  39422. var start = 0;
  39423. if (number[0] === '-') {
  39424. start++;
  39425. this.negative = 1;
  39426. }
  39427. if (start < number.length) {
  39428. if (base === 16) {
  39429. this._parseHex(number, start, endian);
  39430. } else {
  39431. this._parseBase(number, base, start);
  39432. if (endian === 'le') {
  39433. this._initArray(this.toArray(), base, endian);
  39434. }
  39435. }
  39436. }
  39437. };
  39438. BN.prototype._initNumber = function _initNumber (number, base, endian) {
  39439. if (number < 0) {
  39440. this.negative = 1;
  39441. number = -number;
  39442. }
  39443. if (number < 0x4000000) {
  39444. this.words = [ number & 0x3ffffff ];
  39445. this.length = 1;
  39446. } else if (number < 0x10000000000000) {
  39447. this.words = [
  39448. number & 0x3ffffff,
  39449. (number / 0x4000000) & 0x3ffffff
  39450. ];
  39451. this.length = 2;
  39452. } else {
  39453. assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
  39454. this.words = [
  39455. number & 0x3ffffff,
  39456. (number / 0x4000000) & 0x3ffffff,
  39457. 1
  39458. ];
  39459. this.length = 3;
  39460. }
  39461. if (endian !== 'le') return;
  39462. // Reverse the bytes
  39463. this._initArray(this.toArray(), base, endian);
  39464. };
  39465. BN.prototype._initArray = function _initArray (number, base, endian) {
  39466. // Perhaps a Uint8Array
  39467. assert(typeof number.length === 'number');
  39468. if (number.length <= 0) {
  39469. this.words = [ 0 ];
  39470. this.length = 1;
  39471. return this;
  39472. }
  39473. this.length = Math.ceil(number.length / 3);
  39474. this.words = new Array(this.length);
  39475. for (var i = 0; i < this.length; i++) {
  39476. this.words[i] = 0;
  39477. }
  39478. var j, w;
  39479. var off = 0;
  39480. if (endian === 'be') {
  39481. for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
  39482. w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
  39483. this.words[j] |= (w << off) & 0x3ffffff;
  39484. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  39485. off += 24;
  39486. if (off >= 26) {
  39487. off -= 26;
  39488. j++;
  39489. }
  39490. }
  39491. } else if (endian === 'le') {
  39492. for (i = 0, j = 0; i < number.length; i += 3) {
  39493. w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
  39494. this.words[j] |= (w << off) & 0x3ffffff;
  39495. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  39496. off += 24;
  39497. if (off >= 26) {
  39498. off -= 26;
  39499. j++;
  39500. }
  39501. }
  39502. }
  39503. return this.strip();
  39504. };
  39505. function parseHex4Bits (string, index) {
  39506. var c = string.charCodeAt(index);
  39507. // 'A' - 'F'
  39508. if (c >= 65 && c <= 70) {
  39509. return c - 55;
  39510. // 'a' - 'f'
  39511. } else if (c >= 97 && c <= 102) {
  39512. return c - 87;
  39513. // '0' - '9'
  39514. } else {
  39515. return (c - 48) & 0xf;
  39516. }
  39517. }
  39518. function parseHexByte (string, lowerBound, index) {
  39519. var r = parseHex4Bits(string, index);
  39520. if (index - 1 >= lowerBound) {
  39521. r |= parseHex4Bits(string, index - 1) << 4;
  39522. }
  39523. return r;
  39524. }
  39525. BN.prototype._parseHex = function _parseHex (number, start, endian) {
  39526. // Create possibly bigger array to ensure that it fits the number
  39527. this.length = Math.ceil((number.length - start) / 6);
  39528. this.words = new Array(this.length);
  39529. for (var i = 0; i < this.length; i++) {
  39530. this.words[i] = 0;
  39531. }
  39532. // 24-bits chunks
  39533. var off = 0;
  39534. var j = 0;
  39535. var w;
  39536. if (endian === 'be') {
  39537. for (i = number.length - 1; i >= start; i -= 2) {
  39538. w = parseHexByte(number, start, i) << off;
  39539. this.words[j] |= w & 0x3ffffff;
  39540. if (off >= 18) {
  39541. off -= 18;
  39542. j += 1;
  39543. this.words[j] |= w >>> 26;
  39544. } else {
  39545. off += 8;
  39546. }
  39547. }
  39548. } else {
  39549. var parseLength = number.length - start;
  39550. for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {
  39551. w = parseHexByte(number, start, i) << off;
  39552. this.words[j] |= w & 0x3ffffff;
  39553. if (off >= 18) {
  39554. off -= 18;
  39555. j += 1;
  39556. this.words[j] |= w >>> 26;
  39557. } else {
  39558. off += 8;
  39559. }
  39560. }
  39561. }
  39562. this.strip();
  39563. };
  39564. function parseBase (str, start, end, mul) {
  39565. var r = 0;
  39566. var len = Math.min(str.length, end);
  39567. for (var i = start; i < len; i++) {
  39568. var c = str.charCodeAt(i) - 48;
  39569. r *= mul;
  39570. // 'a'
  39571. if (c >= 49) {
  39572. r += c - 49 + 0xa;
  39573. // 'A'
  39574. } else if (c >= 17) {
  39575. r += c - 17 + 0xa;
  39576. // '0' - '9'
  39577. } else {
  39578. r += c;
  39579. }
  39580. }
  39581. return r;
  39582. }
  39583. BN.prototype._parseBase = function _parseBase (number, base, start) {
  39584. // Initialize as zero
  39585. this.words = [ 0 ];
  39586. this.length = 1;
  39587. // Find length of limb in base
  39588. for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
  39589. limbLen++;
  39590. }
  39591. limbLen--;
  39592. limbPow = (limbPow / base) | 0;
  39593. var total = number.length - start;
  39594. var mod = total % limbLen;
  39595. var end = Math.min(total, total - mod) + start;
  39596. var word = 0;
  39597. for (var i = start; i < end; i += limbLen) {
  39598. word = parseBase(number, i, i + limbLen, base);
  39599. this.imuln(limbPow);
  39600. if (this.words[0] + word < 0x4000000) {
  39601. this.words[0] += word;
  39602. } else {
  39603. this._iaddn(word);
  39604. }
  39605. }
  39606. if (mod !== 0) {
  39607. var pow = 1;
  39608. word = parseBase(number, i, number.length, base);
  39609. for (i = 0; i < mod; i++) {
  39610. pow *= base;
  39611. }
  39612. this.imuln(pow);
  39613. if (this.words[0] + word < 0x4000000) {
  39614. this.words[0] += word;
  39615. } else {
  39616. this._iaddn(word);
  39617. }
  39618. }
  39619. this.strip();
  39620. };
  39621. BN.prototype.copy = function copy (dest) {
  39622. dest.words = new Array(this.length);
  39623. for (var i = 0; i < this.length; i++) {
  39624. dest.words[i] = this.words[i];
  39625. }
  39626. dest.length = this.length;
  39627. dest.negative = this.negative;
  39628. dest.red = this.red;
  39629. };
  39630. BN.prototype.clone = function clone () {
  39631. var r = new BN(null);
  39632. this.copy(r);
  39633. return r;
  39634. };
  39635. BN.prototype._expand = function _expand (size) {
  39636. while (this.length < size) {
  39637. this.words[this.length++] = 0;
  39638. }
  39639. return this;
  39640. };
  39641. // Remove leading `0` from `this`
  39642. BN.prototype.strip = function strip () {
  39643. while (this.length > 1 && this.words[this.length - 1] === 0) {
  39644. this.length--;
  39645. }
  39646. return this._normSign();
  39647. };
  39648. BN.prototype._normSign = function _normSign () {
  39649. // -0 = 0
  39650. if (this.length === 1 && this.words[0] === 0) {
  39651. this.negative = 0;
  39652. }
  39653. return this;
  39654. };
  39655. BN.prototype.inspect = function inspect () {
  39656. return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
  39657. };
  39658. /*
  39659. var zeros = [];
  39660. var groupSizes = [];
  39661. var groupBases = [];
  39662. var s = '';
  39663. var i = -1;
  39664. while (++i < BN.wordSize) {
  39665. zeros[i] = s;
  39666. s += '0';
  39667. }
  39668. groupSizes[0] = 0;
  39669. groupSizes[1] = 0;
  39670. groupBases[0] = 0;
  39671. groupBases[1] = 0;
  39672. var base = 2 - 1;
  39673. while (++base < 36 + 1) {
  39674. var groupSize = 0;
  39675. var groupBase = 1;
  39676. while (groupBase < (1 << BN.wordSize) / base) {
  39677. groupBase *= base;
  39678. groupSize += 1;
  39679. }
  39680. groupSizes[base] = groupSize;
  39681. groupBases[base] = groupBase;
  39682. }
  39683. */
  39684. var zeros = [
  39685. '',
  39686. '0',
  39687. '00',
  39688. '000',
  39689. '0000',
  39690. '00000',
  39691. '000000',
  39692. '0000000',
  39693. '00000000',
  39694. '000000000',
  39695. '0000000000',
  39696. '00000000000',
  39697. '000000000000',
  39698. '0000000000000',
  39699. '00000000000000',
  39700. '000000000000000',
  39701. '0000000000000000',
  39702. '00000000000000000',
  39703. '000000000000000000',
  39704. '0000000000000000000',
  39705. '00000000000000000000',
  39706. '000000000000000000000',
  39707. '0000000000000000000000',
  39708. '00000000000000000000000',
  39709. '000000000000000000000000',
  39710. '0000000000000000000000000'
  39711. ];
  39712. var groupSizes = [
  39713. 0, 0,
  39714. 25, 16, 12, 11, 10, 9, 8,
  39715. 8, 7, 7, 7, 7, 6, 6,
  39716. 6, 6, 6, 6, 6, 5, 5,
  39717. 5, 5, 5, 5, 5, 5, 5,
  39718. 5, 5, 5, 5, 5, 5, 5
  39719. ];
  39720. var groupBases = [
  39721. 0, 0,
  39722. 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
  39723. 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
  39724. 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
  39725. 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
  39726. 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  39727. ];
  39728. BN.prototype.toString = function toString (base, padding) {
  39729. base = base || 10;
  39730. padding = padding | 0 || 1;
  39731. var out;
  39732. if (base === 16 || base === 'hex') {
  39733. out = '';
  39734. var off = 0;
  39735. var carry = 0;
  39736. for (var i = 0; i < this.length; i++) {
  39737. var w = this.words[i];
  39738. var word = (((w << off) | carry) & 0xffffff).toString(16);
  39739. carry = (w >>> (24 - off)) & 0xffffff;
  39740. if (carry !== 0 || i !== this.length - 1) {
  39741. out = zeros[6 - word.length] + word + out;
  39742. } else {
  39743. out = word + out;
  39744. }
  39745. off += 2;
  39746. if (off >= 26) {
  39747. off -= 26;
  39748. i--;
  39749. }
  39750. }
  39751. if (carry !== 0) {
  39752. out = carry.toString(16) + out;
  39753. }
  39754. while (out.length % padding !== 0) {
  39755. out = '0' + out;
  39756. }
  39757. if (this.negative !== 0) {
  39758. out = '-' + out;
  39759. }
  39760. return out;
  39761. }
  39762. if (base === (base | 0) && base >= 2 && base <= 36) {
  39763. // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
  39764. var groupSize = groupSizes[base];
  39765. // var groupBase = Math.pow(base, groupSize);
  39766. var groupBase = groupBases[base];
  39767. out = '';
  39768. var c = this.clone();
  39769. c.negative = 0;
  39770. while (!c.isZero()) {
  39771. var r = c.modn(groupBase).toString(base);
  39772. c = c.idivn(groupBase);
  39773. if (!c.isZero()) {
  39774. out = zeros[groupSize - r.length] + r + out;
  39775. } else {
  39776. out = r + out;
  39777. }
  39778. }
  39779. if (this.isZero()) {
  39780. out = '0' + out;
  39781. }
  39782. while (out.length % padding !== 0) {
  39783. out = '0' + out;
  39784. }
  39785. if (this.negative !== 0) {
  39786. out = '-' + out;
  39787. }
  39788. return out;
  39789. }
  39790. assert(false, 'Base should be between 2 and 36');
  39791. };
  39792. BN.prototype.toNumber = function toNumber () {
  39793. var ret = this.words[0];
  39794. if (this.length === 2) {
  39795. ret += this.words[1] * 0x4000000;
  39796. } else if (this.length === 3 && this.words[2] === 0x01) {
  39797. // NOTE: at this stage it is known that the top bit is set
  39798. ret += 0x10000000000000 + (this.words[1] * 0x4000000);
  39799. } else if (this.length > 2) {
  39800. assert(false, 'Number can only safely store up to 53 bits');
  39801. }
  39802. return (this.negative !== 0) ? -ret : ret;
  39803. };
  39804. BN.prototype.toJSON = function toJSON () {
  39805. return this.toString(16);
  39806. };
  39807. BN.prototype.toBuffer = function toBuffer (endian, length) {
  39808. assert(typeof Buffer !== 'undefined');
  39809. return this.toArrayLike(Buffer, endian, length);
  39810. };
  39811. BN.prototype.toArray = function toArray (endian, length) {
  39812. return this.toArrayLike(Array, endian, length);
  39813. };
  39814. BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
  39815. var byteLength = this.byteLength();
  39816. var reqLength = length || Math.max(1, byteLength);
  39817. assert(byteLength <= reqLength, 'byte array longer than desired length');
  39818. assert(reqLength > 0, 'Requested array length <= 0');
  39819. this.strip();
  39820. var littleEndian = endian === 'le';
  39821. var res = new ArrayType(reqLength);
  39822. var b, i;
  39823. var q = this.clone();
  39824. if (!littleEndian) {
  39825. // Assume big-endian
  39826. for (i = 0; i < reqLength - byteLength; i++) {
  39827. res[i] = 0;
  39828. }
  39829. for (i = 0; !q.isZero(); i++) {
  39830. b = q.andln(0xff);
  39831. q.iushrn(8);
  39832. res[reqLength - i - 1] = b;
  39833. }
  39834. } else {
  39835. for (i = 0; !q.isZero(); i++) {
  39836. b = q.andln(0xff);
  39837. q.iushrn(8);
  39838. res[i] = b;
  39839. }
  39840. for (; i < reqLength; i++) {
  39841. res[i] = 0;
  39842. }
  39843. }
  39844. return res;
  39845. };
  39846. if (Math.clz32) {
  39847. BN.prototype._countBits = function _countBits (w) {
  39848. return 32 - Math.clz32(w);
  39849. };
  39850. } else {
  39851. BN.prototype._countBits = function _countBits (w) {
  39852. var t = w;
  39853. var r = 0;
  39854. if (t >= 0x1000) {
  39855. r += 13;
  39856. t >>>= 13;
  39857. }
  39858. if (t >= 0x40) {
  39859. r += 7;
  39860. t >>>= 7;
  39861. }
  39862. if (t >= 0x8) {
  39863. r += 4;
  39864. t >>>= 4;
  39865. }
  39866. if (t >= 0x02) {
  39867. r += 2;
  39868. t >>>= 2;
  39869. }
  39870. return r + t;
  39871. };
  39872. }
  39873. BN.prototype._zeroBits = function _zeroBits (w) {
  39874. // Short-cut
  39875. if (w === 0) return 26;
  39876. var t = w;
  39877. var r = 0;
  39878. if ((t & 0x1fff) === 0) {
  39879. r += 13;
  39880. t >>>= 13;
  39881. }
  39882. if ((t & 0x7f) === 0) {
  39883. r += 7;
  39884. t >>>= 7;
  39885. }
  39886. if ((t & 0xf) === 0) {
  39887. r += 4;
  39888. t >>>= 4;
  39889. }
  39890. if ((t & 0x3) === 0) {
  39891. r += 2;
  39892. t >>>= 2;
  39893. }
  39894. if ((t & 0x1) === 0) {
  39895. r++;
  39896. }
  39897. return r;
  39898. };
  39899. // Return number of used bits in a BN
  39900. BN.prototype.bitLength = function bitLength () {
  39901. var w = this.words[this.length - 1];
  39902. var hi = this._countBits(w);
  39903. return (this.length - 1) * 26 + hi;
  39904. };
  39905. function toBitArray (num) {
  39906. var w = new Array(num.bitLength());
  39907. for (var bit = 0; bit < w.length; bit++) {
  39908. var off = (bit / 26) | 0;
  39909. var wbit = bit % 26;
  39910. w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
  39911. }
  39912. return w;
  39913. }
  39914. // Number of trailing zero bits
  39915. BN.prototype.zeroBits = function zeroBits () {
  39916. if (this.isZero()) return 0;
  39917. var r = 0;
  39918. for (var i = 0; i < this.length; i++) {
  39919. var b = this._zeroBits(this.words[i]);
  39920. r += b;
  39921. if (b !== 26) break;
  39922. }
  39923. return r;
  39924. };
  39925. BN.prototype.byteLength = function byteLength () {
  39926. return Math.ceil(this.bitLength() / 8);
  39927. };
  39928. BN.prototype.toTwos = function toTwos (width) {
  39929. if (this.negative !== 0) {
  39930. return this.abs().inotn(width).iaddn(1);
  39931. }
  39932. return this.clone();
  39933. };
  39934. BN.prototype.fromTwos = function fromTwos (width) {
  39935. if (this.testn(width - 1)) {
  39936. return this.notn(width).iaddn(1).ineg();
  39937. }
  39938. return this.clone();
  39939. };
  39940. BN.prototype.isNeg = function isNeg () {
  39941. return this.negative !== 0;
  39942. };
  39943. // Return negative clone of `this`
  39944. BN.prototype.neg = function neg () {
  39945. return this.clone().ineg();
  39946. };
  39947. BN.prototype.ineg = function ineg () {
  39948. if (!this.isZero()) {
  39949. this.negative ^= 1;
  39950. }
  39951. return this;
  39952. };
  39953. // Or `num` with `this` in-place
  39954. BN.prototype.iuor = function iuor (num) {
  39955. while (this.length < num.length) {
  39956. this.words[this.length++] = 0;
  39957. }
  39958. for (var i = 0; i < num.length; i++) {
  39959. this.words[i] = this.words[i] | num.words[i];
  39960. }
  39961. return this.strip();
  39962. };
  39963. BN.prototype.ior = function ior (num) {
  39964. assert((this.negative | num.negative) === 0);
  39965. return this.iuor(num);
  39966. };
  39967. // Or `num` with `this`
  39968. BN.prototype.or = function or (num) {
  39969. if (this.length > num.length) return this.clone().ior(num);
  39970. return num.clone().ior(this);
  39971. };
  39972. BN.prototype.uor = function uor (num) {
  39973. if (this.length > num.length) return this.clone().iuor(num);
  39974. return num.clone().iuor(this);
  39975. };
  39976. // And `num` with `this` in-place
  39977. BN.prototype.iuand = function iuand (num) {
  39978. // b = min-length(num, this)
  39979. var b;
  39980. if (this.length > num.length) {
  39981. b = num;
  39982. } else {
  39983. b = this;
  39984. }
  39985. for (var i = 0; i < b.length; i++) {
  39986. this.words[i] = this.words[i] & num.words[i];
  39987. }
  39988. this.length = b.length;
  39989. return this.strip();
  39990. };
  39991. BN.prototype.iand = function iand (num) {
  39992. assert((this.negative | num.negative) === 0);
  39993. return this.iuand(num);
  39994. };
  39995. // And `num` with `this`
  39996. BN.prototype.and = function and (num) {
  39997. if (this.length > num.length) return this.clone().iand(num);
  39998. return num.clone().iand(this);
  39999. };
  40000. BN.prototype.uand = function uand (num) {
  40001. if (this.length > num.length) return this.clone().iuand(num);
  40002. return num.clone().iuand(this);
  40003. };
  40004. // Xor `num` with `this` in-place
  40005. BN.prototype.iuxor = function iuxor (num) {
  40006. // a.length > b.length
  40007. var a;
  40008. var b;
  40009. if (this.length > num.length) {
  40010. a = this;
  40011. b = num;
  40012. } else {
  40013. a = num;
  40014. b = this;
  40015. }
  40016. for (var i = 0; i < b.length; i++) {
  40017. this.words[i] = a.words[i] ^ b.words[i];
  40018. }
  40019. if (this !== a) {
  40020. for (; i < a.length; i++) {
  40021. this.words[i] = a.words[i];
  40022. }
  40023. }
  40024. this.length = a.length;
  40025. return this.strip();
  40026. };
  40027. BN.prototype.ixor = function ixor (num) {
  40028. assert((this.negative | num.negative) === 0);
  40029. return this.iuxor(num);
  40030. };
  40031. // Xor `num` with `this`
  40032. BN.prototype.xor = function xor (num) {
  40033. if (this.length > num.length) return this.clone().ixor(num);
  40034. return num.clone().ixor(this);
  40035. };
  40036. BN.prototype.uxor = function uxor (num) {
  40037. if (this.length > num.length) return this.clone().iuxor(num);
  40038. return num.clone().iuxor(this);
  40039. };
  40040. // Not ``this`` with ``width`` bitwidth
  40041. BN.prototype.inotn = function inotn (width) {
  40042. assert(typeof width === 'number' && width >= 0);
  40043. var bytesNeeded = Math.ceil(width / 26) | 0;
  40044. var bitsLeft = width % 26;
  40045. // Extend the buffer with leading zeroes
  40046. this._expand(bytesNeeded);
  40047. if (bitsLeft > 0) {
  40048. bytesNeeded--;
  40049. }
  40050. // Handle complete words
  40051. for (var i = 0; i < bytesNeeded; i++) {
  40052. this.words[i] = ~this.words[i] & 0x3ffffff;
  40053. }
  40054. // Handle the residue
  40055. if (bitsLeft > 0) {
  40056. this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
  40057. }
  40058. // And remove leading zeroes
  40059. return this.strip();
  40060. };
  40061. BN.prototype.notn = function notn (width) {
  40062. return this.clone().inotn(width);
  40063. };
  40064. // Set `bit` of `this`
  40065. BN.prototype.setn = function setn (bit, val) {
  40066. assert(typeof bit === 'number' && bit >= 0);
  40067. var off = (bit / 26) | 0;
  40068. var wbit = bit % 26;
  40069. this._expand(off + 1);
  40070. if (val) {
  40071. this.words[off] = this.words[off] | (1 << wbit);
  40072. } else {
  40073. this.words[off] = this.words[off] & ~(1 << wbit);
  40074. }
  40075. return this.strip();
  40076. };
  40077. // Add `num` to `this` in-place
  40078. BN.prototype.iadd = function iadd (num) {
  40079. var r;
  40080. // negative + positive
  40081. if (this.negative !== 0 && num.negative === 0) {
  40082. this.negative = 0;
  40083. r = this.isub(num);
  40084. this.negative ^= 1;
  40085. return this._normSign();
  40086. // positive + negative
  40087. } else if (this.negative === 0 && num.negative !== 0) {
  40088. num.negative = 0;
  40089. r = this.isub(num);
  40090. num.negative = 1;
  40091. return r._normSign();
  40092. }
  40093. // a.length > b.length
  40094. var a, b;
  40095. if (this.length > num.length) {
  40096. a = this;
  40097. b = num;
  40098. } else {
  40099. a = num;
  40100. b = this;
  40101. }
  40102. var carry = 0;
  40103. for (var i = 0; i < b.length; i++) {
  40104. r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
  40105. this.words[i] = r & 0x3ffffff;
  40106. carry = r >>> 26;
  40107. }
  40108. for (; carry !== 0 && i < a.length; i++) {
  40109. r = (a.words[i] | 0) + carry;
  40110. this.words[i] = r & 0x3ffffff;
  40111. carry = r >>> 26;
  40112. }
  40113. this.length = a.length;
  40114. if (carry !== 0) {
  40115. this.words[this.length] = carry;
  40116. this.length++;
  40117. // Copy the rest of the words
  40118. } else if (a !== this) {
  40119. for (; i < a.length; i++) {
  40120. this.words[i] = a.words[i];
  40121. }
  40122. }
  40123. return this;
  40124. };
  40125. // Add `num` to `this`
  40126. BN.prototype.add = function add (num) {
  40127. var res;
  40128. if (num.negative !== 0 && this.negative === 0) {
  40129. num.negative = 0;
  40130. res = this.sub(num);
  40131. num.negative ^= 1;
  40132. return res;
  40133. } else if (num.negative === 0 && this.negative !== 0) {
  40134. this.negative = 0;
  40135. res = num.sub(this);
  40136. this.negative = 1;
  40137. return res;
  40138. }
  40139. if (this.length > num.length) return this.clone().iadd(num);
  40140. return num.clone().iadd(this);
  40141. };
  40142. // Subtract `num` from `this` in-place
  40143. BN.prototype.isub = function isub (num) {
  40144. // this - (-num) = this + num
  40145. if (num.negative !== 0) {
  40146. num.negative = 0;
  40147. var r = this.iadd(num);
  40148. num.negative = 1;
  40149. return r._normSign();
  40150. // -this - num = -(this + num)
  40151. } else if (this.negative !== 0) {
  40152. this.negative = 0;
  40153. this.iadd(num);
  40154. this.negative = 1;
  40155. return this._normSign();
  40156. }
  40157. // At this point both numbers are positive
  40158. var cmp = this.cmp(num);
  40159. // Optimization - zeroify
  40160. if (cmp === 0) {
  40161. this.negative = 0;
  40162. this.length = 1;
  40163. this.words[0] = 0;
  40164. return this;
  40165. }
  40166. // a > b
  40167. var a, b;
  40168. if (cmp > 0) {
  40169. a = this;
  40170. b = num;
  40171. } else {
  40172. a = num;
  40173. b = this;
  40174. }
  40175. var carry = 0;
  40176. for (var i = 0; i < b.length; i++) {
  40177. r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
  40178. carry = r >> 26;
  40179. this.words[i] = r & 0x3ffffff;
  40180. }
  40181. for (; carry !== 0 && i < a.length; i++) {
  40182. r = (a.words[i] | 0) + carry;
  40183. carry = r >> 26;
  40184. this.words[i] = r & 0x3ffffff;
  40185. }
  40186. // Copy rest of the words
  40187. if (carry === 0 && i < a.length && a !== this) {
  40188. for (; i < a.length; i++) {
  40189. this.words[i] = a.words[i];
  40190. }
  40191. }
  40192. this.length = Math.max(this.length, i);
  40193. if (a !== this) {
  40194. this.negative = 1;
  40195. }
  40196. return this.strip();
  40197. };
  40198. // Subtract `num` from `this`
  40199. BN.prototype.sub = function sub (num) {
  40200. return this.clone().isub(num);
  40201. };
  40202. function smallMulTo (self, num, out) {
  40203. out.negative = num.negative ^ self.negative;
  40204. var len = (self.length + num.length) | 0;
  40205. out.length = len;
  40206. len = (len - 1) | 0;
  40207. // Peel one iteration (compiler can't do it, because of code complexity)
  40208. var a = self.words[0] | 0;
  40209. var b = num.words[0] | 0;
  40210. var r = a * b;
  40211. var lo = r & 0x3ffffff;
  40212. var carry = (r / 0x4000000) | 0;
  40213. out.words[0] = lo;
  40214. for (var k = 1; k < len; k++) {
  40215. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  40216. // note that ncarry could be >= 0x3ffffff
  40217. var ncarry = carry >>> 26;
  40218. var rword = carry & 0x3ffffff;
  40219. var maxJ = Math.min(k, num.length - 1);
  40220. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  40221. var i = (k - j) | 0;
  40222. a = self.words[i] | 0;
  40223. b = num.words[j] | 0;
  40224. r = a * b + rword;
  40225. ncarry += (r / 0x4000000) | 0;
  40226. rword = r & 0x3ffffff;
  40227. }
  40228. out.words[k] = rword | 0;
  40229. carry = ncarry | 0;
  40230. }
  40231. if (carry !== 0) {
  40232. out.words[k] = carry | 0;
  40233. } else {
  40234. out.length--;
  40235. }
  40236. return out.strip();
  40237. }
  40238. // TODO(indutny): it may be reasonable to omit it for users who don't need
  40239. // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
  40240. // multiplication (like elliptic secp256k1).
  40241. var comb10MulTo = function comb10MulTo (self, num, out) {
  40242. var a = self.words;
  40243. var b = num.words;
  40244. var o = out.words;
  40245. var c = 0;
  40246. var lo;
  40247. var mid;
  40248. var hi;
  40249. var a0 = a[0] | 0;
  40250. var al0 = a0 & 0x1fff;
  40251. var ah0 = a0 >>> 13;
  40252. var a1 = a[1] | 0;
  40253. var al1 = a1 & 0x1fff;
  40254. var ah1 = a1 >>> 13;
  40255. var a2 = a[2] | 0;
  40256. var al2 = a2 & 0x1fff;
  40257. var ah2 = a2 >>> 13;
  40258. var a3 = a[3] | 0;
  40259. var al3 = a3 & 0x1fff;
  40260. var ah3 = a3 >>> 13;
  40261. var a4 = a[4] | 0;
  40262. var al4 = a4 & 0x1fff;
  40263. var ah4 = a4 >>> 13;
  40264. var a5 = a[5] | 0;
  40265. var al5 = a5 & 0x1fff;
  40266. var ah5 = a5 >>> 13;
  40267. var a6 = a[6] | 0;
  40268. var al6 = a6 & 0x1fff;
  40269. var ah6 = a6 >>> 13;
  40270. var a7 = a[7] | 0;
  40271. var al7 = a7 & 0x1fff;
  40272. var ah7 = a7 >>> 13;
  40273. var a8 = a[8] | 0;
  40274. var al8 = a8 & 0x1fff;
  40275. var ah8 = a8 >>> 13;
  40276. var a9 = a[9] | 0;
  40277. var al9 = a9 & 0x1fff;
  40278. var ah9 = a9 >>> 13;
  40279. var b0 = b[0] | 0;
  40280. var bl0 = b0 & 0x1fff;
  40281. var bh0 = b0 >>> 13;
  40282. var b1 = b[1] | 0;
  40283. var bl1 = b1 & 0x1fff;
  40284. var bh1 = b1 >>> 13;
  40285. var b2 = b[2] | 0;
  40286. var bl2 = b2 & 0x1fff;
  40287. var bh2 = b2 >>> 13;
  40288. var b3 = b[3] | 0;
  40289. var bl3 = b3 & 0x1fff;
  40290. var bh3 = b3 >>> 13;
  40291. var b4 = b[4] | 0;
  40292. var bl4 = b4 & 0x1fff;
  40293. var bh4 = b4 >>> 13;
  40294. var b5 = b[5] | 0;
  40295. var bl5 = b5 & 0x1fff;
  40296. var bh5 = b5 >>> 13;
  40297. var b6 = b[6] | 0;
  40298. var bl6 = b6 & 0x1fff;
  40299. var bh6 = b6 >>> 13;
  40300. var b7 = b[7] | 0;
  40301. var bl7 = b7 & 0x1fff;
  40302. var bh7 = b7 >>> 13;
  40303. var b8 = b[8] | 0;
  40304. var bl8 = b8 & 0x1fff;
  40305. var bh8 = b8 >>> 13;
  40306. var b9 = b[9] | 0;
  40307. var bl9 = b9 & 0x1fff;
  40308. var bh9 = b9 >>> 13;
  40309. out.negative = self.negative ^ num.negative;
  40310. out.length = 19;
  40311. /* k = 0 */
  40312. lo = Math.imul(al0, bl0);
  40313. mid = Math.imul(al0, bh0);
  40314. mid = (mid + Math.imul(ah0, bl0)) | 0;
  40315. hi = Math.imul(ah0, bh0);
  40316. var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40317. c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
  40318. w0 &= 0x3ffffff;
  40319. /* k = 1 */
  40320. lo = Math.imul(al1, bl0);
  40321. mid = Math.imul(al1, bh0);
  40322. mid = (mid + Math.imul(ah1, bl0)) | 0;
  40323. hi = Math.imul(ah1, bh0);
  40324. lo = (lo + Math.imul(al0, bl1)) | 0;
  40325. mid = (mid + Math.imul(al0, bh1)) | 0;
  40326. mid = (mid + Math.imul(ah0, bl1)) | 0;
  40327. hi = (hi + Math.imul(ah0, bh1)) | 0;
  40328. var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40329. c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
  40330. w1 &= 0x3ffffff;
  40331. /* k = 2 */
  40332. lo = Math.imul(al2, bl0);
  40333. mid = Math.imul(al2, bh0);
  40334. mid = (mid + Math.imul(ah2, bl0)) | 0;
  40335. hi = Math.imul(ah2, bh0);
  40336. lo = (lo + Math.imul(al1, bl1)) | 0;
  40337. mid = (mid + Math.imul(al1, bh1)) | 0;
  40338. mid = (mid + Math.imul(ah1, bl1)) | 0;
  40339. hi = (hi + Math.imul(ah1, bh1)) | 0;
  40340. lo = (lo + Math.imul(al0, bl2)) | 0;
  40341. mid = (mid + Math.imul(al0, bh2)) | 0;
  40342. mid = (mid + Math.imul(ah0, bl2)) | 0;
  40343. hi = (hi + Math.imul(ah0, bh2)) | 0;
  40344. var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40345. c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
  40346. w2 &= 0x3ffffff;
  40347. /* k = 3 */
  40348. lo = Math.imul(al3, bl0);
  40349. mid = Math.imul(al3, bh0);
  40350. mid = (mid + Math.imul(ah3, bl0)) | 0;
  40351. hi = Math.imul(ah3, bh0);
  40352. lo = (lo + Math.imul(al2, bl1)) | 0;
  40353. mid = (mid + Math.imul(al2, bh1)) | 0;
  40354. mid = (mid + Math.imul(ah2, bl1)) | 0;
  40355. hi = (hi + Math.imul(ah2, bh1)) | 0;
  40356. lo = (lo + Math.imul(al1, bl2)) | 0;
  40357. mid = (mid + Math.imul(al1, bh2)) | 0;
  40358. mid = (mid + Math.imul(ah1, bl2)) | 0;
  40359. hi = (hi + Math.imul(ah1, bh2)) | 0;
  40360. lo = (lo + Math.imul(al0, bl3)) | 0;
  40361. mid = (mid + Math.imul(al0, bh3)) | 0;
  40362. mid = (mid + Math.imul(ah0, bl3)) | 0;
  40363. hi = (hi + Math.imul(ah0, bh3)) | 0;
  40364. var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40365. c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
  40366. w3 &= 0x3ffffff;
  40367. /* k = 4 */
  40368. lo = Math.imul(al4, bl0);
  40369. mid = Math.imul(al4, bh0);
  40370. mid = (mid + Math.imul(ah4, bl0)) | 0;
  40371. hi = Math.imul(ah4, bh0);
  40372. lo = (lo + Math.imul(al3, bl1)) | 0;
  40373. mid = (mid + Math.imul(al3, bh1)) | 0;
  40374. mid = (mid + Math.imul(ah3, bl1)) | 0;
  40375. hi = (hi + Math.imul(ah3, bh1)) | 0;
  40376. lo = (lo + Math.imul(al2, bl2)) | 0;
  40377. mid = (mid + Math.imul(al2, bh2)) | 0;
  40378. mid = (mid + Math.imul(ah2, bl2)) | 0;
  40379. hi = (hi + Math.imul(ah2, bh2)) | 0;
  40380. lo = (lo + Math.imul(al1, bl3)) | 0;
  40381. mid = (mid + Math.imul(al1, bh3)) | 0;
  40382. mid = (mid + Math.imul(ah1, bl3)) | 0;
  40383. hi = (hi + Math.imul(ah1, bh3)) | 0;
  40384. lo = (lo + Math.imul(al0, bl4)) | 0;
  40385. mid = (mid + Math.imul(al0, bh4)) | 0;
  40386. mid = (mid + Math.imul(ah0, bl4)) | 0;
  40387. hi = (hi + Math.imul(ah0, bh4)) | 0;
  40388. var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40389. c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
  40390. w4 &= 0x3ffffff;
  40391. /* k = 5 */
  40392. lo = Math.imul(al5, bl0);
  40393. mid = Math.imul(al5, bh0);
  40394. mid = (mid + Math.imul(ah5, bl0)) | 0;
  40395. hi = Math.imul(ah5, bh0);
  40396. lo = (lo + Math.imul(al4, bl1)) | 0;
  40397. mid = (mid + Math.imul(al4, bh1)) | 0;
  40398. mid = (mid + Math.imul(ah4, bl1)) | 0;
  40399. hi = (hi + Math.imul(ah4, bh1)) | 0;
  40400. lo = (lo + Math.imul(al3, bl2)) | 0;
  40401. mid = (mid + Math.imul(al3, bh2)) | 0;
  40402. mid = (mid + Math.imul(ah3, bl2)) | 0;
  40403. hi = (hi + Math.imul(ah3, bh2)) | 0;
  40404. lo = (lo + Math.imul(al2, bl3)) | 0;
  40405. mid = (mid + Math.imul(al2, bh3)) | 0;
  40406. mid = (mid + Math.imul(ah2, bl3)) | 0;
  40407. hi = (hi + Math.imul(ah2, bh3)) | 0;
  40408. lo = (lo + Math.imul(al1, bl4)) | 0;
  40409. mid = (mid + Math.imul(al1, bh4)) | 0;
  40410. mid = (mid + Math.imul(ah1, bl4)) | 0;
  40411. hi = (hi + Math.imul(ah1, bh4)) | 0;
  40412. lo = (lo + Math.imul(al0, bl5)) | 0;
  40413. mid = (mid + Math.imul(al0, bh5)) | 0;
  40414. mid = (mid + Math.imul(ah0, bl5)) | 0;
  40415. hi = (hi + Math.imul(ah0, bh5)) | 0;
  40416. var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40417. c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
  40418. w5 &= 0x3ffffff;
  40419. /* k = 6 */
  40420. lo = Math.imul(al6, bl0);
  40421. mid = Math.imul(al6, bh0);
  40422. mid = (mid + Math.imul(ah6, bl0)) | 0;
  40423. hi = Math.imul(ah6, bh0);
  40424. lo = (lo + Math.imul(al5, bl1)) | 0;
  40425. mid = (mid + Math.imul(al5, bh1)) | 0;
  40426. mid = (mid + Math.imul(ah5, bl1)) | 0;
  40427. hi = (hi + Math.imul(ah5, bh1)) | 0;
  40428. lo = (lo + Math.imul(al4, bl2)) | 0;
  40429. mid = (mid + Math.imul(al4, bh2)) | 0;
  40430. mid = (mid + Math.imul(ah4, bl2)) | 0;
  40431. hi = (hi + Math.imul(ah4, bh2)) | 0;
  40432. lo = (lo + Math.imul(al3, bl3)) | 0;
  40433. mid = (mid + Math.imul(al3, bh3)) | 0;
  40434. mid = (mid + Math.imul(ah3, bl3)) | 0;
  40435. hi = (hi + Math.imul(ah3, bh3)) | 0;
  40436. lo = (lo + Math.imul(al2, bl4)) | 0;
  40437. mid = (mid + Math.imul(al2, bh4)) | 0;
  40438. mid = (mid + Math.imul(ah2, bl4)) | 0;
  40439. hi = (hi + Math.imul(ah2, bh4)) | 0;
  40440. lo = (lo + Math.imul(al1, bl5)) | 0;
  40441. mid = (mid + Math.imul(al1, bh5)) | 0;
  40442. mid = (mid + Math.imul(ah1, bl5)) | 0;
  40443. hi = (hi + Math.imul(ah1, bh5)) | 0;
  40444. lo = (lo + Math.imul(al0, bl6)) | 0;
  40445. mid = (mid + Math.imul(al0, bh6)) | 0;
  40446. mid = (mid + Math.imul(ah0, bl6)) | 0;
  40447. hi = (hi + Math.imul(ah0, bh6)) | 0;
  40448. var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40449. c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
  40450. w6 &= 0x3ffffff;
  40451. /* k = 7 */
  40452. lo = Math.imul(al7, bl0);
  40453. mid = Math.imul(al7, bh0);
  40454. mid = (mid + Math.imul(ah7, bl0)) | 0;
  40455. hi = Math.imul(ah7, bh0);
  40456. lo = (lo + Math.imul(al6, bl1)) | 0;
  40457. mid = (mid + Math.imul(al6, bh1)) | 0;
  40458. mid = (mid + Math.imul(ah6, bl1)) | 0;
  40459. hi = (hi + Math.imul(ah6, bh1)) | 0;
  40460. lo = (lo + Math.imul(al5, bl2)) | 0;
  40461. mid = (mid + Math.imul(al5, bh2)) | 0;
  40462. mid = (mid + Math.imul(ah5, bl2)) | 0;
  40463. hi = (hi + Math.imul(ah5, bh2)) | 0;
  40464. lo = (lo + Math.imul(al4, bl3)) | 0;
  40465. mid = (mid + Math.imul(al4, bh3)) | 0;
  40466. mid = (mid + Math.imul(ah4, bl3)) | 0;
  40467. hi = (hi + Math.imul(ah4, bh3)) | 0;
  40468. lo = (lo + Math.imul(al3, bl4)) | 0;
  40469. mid = (mid + Math.imul(al3, bh4)) | 0;
  40470. mid = (mid + Math.imul(ah3, bl4)) | 0;
  40471. hi = (hi + Math.imul(ah3, bh4)) | 0;
  40472. lo = (lo + Math.imul(al2, bl5)) | 0;
  40473. mid = (mid + Math.imul(al2, bh5)) | 0;
  40474. mid = (mid + Math.imul(ah2, bl5)) | 0;
  40475. hi = (hi + Math.imul(ah2, bh5)) | 0;
  40476. lo = (lo + Math.imul(al1, bl6)) | 0;
  40477. mid = (mid + Math.imul(al1, bh6)) | 0;
  40478. mid = (mid + Math.imul(ah1, bl6)) | 0;
  40479. hi = (hi + Math.imul(ah1, bh6)) | 0;
  40480. lo = (lo + Math.imul(al0, bl7)) | 0;
  40481. mid = (mid + Math.imul(al0, bh7)) | 0;
  40482. mid = (mid + Math.imul(ah0, bl7)) | 0;
  40483. hi = (hi + Math.imul(ah0, bh7)) | 0;
  40484. var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40485. c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
  40486. w7 &= 0x3ffffff;
  40487. /* k = 8 */
  40488. lo = Math.imul(al8, bl0);
  40489. mid = Math.imul(al8, bh0);
  40490. mid = (mid + Math.imul(ah8, bl0)) | 0;
  40491. hi = Math.imul(ah8, bh0);
  40492. lo = (lo + Math.imul(al7, bl1)) | 0;
  40493. mid = (mid + Math.imul(al7, bh1)) | 0;
  40494. mid = (mid + Math.imul(ah7, bl1)) | 0;
  40495. hi = (hi + Math.imul(ah7, bh1)) | 0;
  40496. lo = (lo + Math.imul(al6, bl2)) | 0;
  40497. mid = (mid + Math.imul(al6, bh2)) | 0;
  40498. mid = (mid + Math.imul(ah6, bl2)) | 0;
  40499. hi = (hi + Math.imul(ah6, bh2)) | 0;
  40500. lo = (lo + Math.imul(al5, bl3)) | 0;
  40501. mid = (mid + Math.imul(al5, bh3)) | 0;
  40502. mid = (mid + Math.imul(ah5, bl3)) | 0;
  40503. hi = (hi + Math.imul(ah5, bh3)) | 0;
  40504. lo = (lo + Math.imul(al4, bl4)) | 0;
  40505. mid = (mid + Math.imul(al4, bh4)) | 0;
  40506. mid = (mid + Math.imul(ah4, bl4)) | 0;
  40507. hi = (hi + Math.imul(ah4, bh4)) | 0;
  40508. lo = (lo + Math.imul(al3, bl5)) | 0;
  40509. mid = (mid + Math.imul(al3, bh5)) | 0;
  40510. mid = (mid + Math.imul(ah3, bl5)) | 0;
  40511. hi = (hi + Math.imul(ah3, bh5)) | 0;
  40512. lo = (lo + Math.imul(al2, bl6)) | 0;
  40513. mid = (mid + Math.imul(al2, bh6)) | 0;
  40514. mid = (mid + Math.imul(ah2, bl6)) | 0;
  40515. hi = (hi + Math.imul(ah2, bh6)) | 0;
  40516. lo = (lo + Math.imul(al1, bl7)) | 0;
  40517. mid = (mid + Math.imul(al1, bh7)) | 0;
  40518. mid = (mid + Math.imul(ah1, bl7)) | 0;
  40519. hi = (hi + Math.imul(ah1, bh7)) | 0;
  40520. lo = (lo + Math.imul(al0, bl8)) | 0;
  40521. mid = (mid + Math.imul(al0, bh8)) | 0;
  40522. mid = (mid + Math.imul(ah0, bl8)) | 0;
  40523. hi = (hi + Math.imul(ah0, bh8)) | 0;
  40524. var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40525. c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
  40526. w8 &= 0x3ffffff;
  40527. /* k = 9 */
  40528. lo = Math.imul(al9, bl0);
  40529. mid = Math.imul(al9, bh0);
  40530. mid = (mid + Math.imul(ah9, bl0)) | 0;
  40531. hi = Math.imul(ah9, bh0);
  40532. lo = (lo + Math.imul(al8, bl1)) | 0;
  40533. mid = (mid + Math.imul(al8, bh1)) | 0;
  40534. mid = (mid + Math.imul(ah8, bl1)) | 0;
  40535. hi = (hi + Math.imul(ah8, bh1)) | 0;
  40536. lo = (lo + Math.imul(al7, bl2)) | 0;
  40537. mid = (mid + Math.imul(al7, bh2)) | 0;
  40538. mid = (mid + Math.imul(ah7, bl2)) | 0;
  40539. hi = (hi + Math.imul(ah7, bh2)) | 0;
  40540. lo = (lo + Math.imul(al6, bl3)) | 0;
  40541. mid = (mid + Math.imul(al6, bh3)) | 0;
  40542. mid = (mid + Math.imul(ah6, bl3)) | 0;
  40543. hi = (hi + Math.imul(ah6, bh3)) | 0;
  40544. lo = (lo + Math.imul(al5, bl4)) | 0;
  40545. mid = (mid + Math.imul(al5, bh4)) | 0;
  40546. mid = (mid + Math.imul(ah5, bl4)) | 0;
  40547. hi = (hi + Math.imul(ah5, bh4)) | 0;
  40548. lo = (lo + Math.imul(al4, bl5)) | 0;
  40549. mid = (mid + Math.imul(al4, bh5)) | 0;
  40550. mid = (mid + Math.imul(ah4, bl5)) | 0;
  40551. hi = (hi + Math.imul(ah4, bh5)) | 0;
  40552. lo = (lo + Math.imul(al3, bl6)) | 0;
  40553. mid = (mid + Math.imul(al3, bh6)) | 0;
  40554. mid = (mid + Math.imul(ah3, bl6)) | 0;
  40555. hi = (hi + Math.imul(ah3, bh6)) | 0;
  40556. lo = (lo + Math.imul(al2, bl7)) | 0;
  40557. mid = (mid + Math.imul(al2, bh7)) | 0;
  40558. mid = (mid + Math.imul(ah2, bl7)) | 0;
  40559. hi = (hi + Math.imul(ah2, bh7)) | 0;
  40560. lo = (lo + Math.imul(al1, bl8)) | 0;
  40561. mid = (mid + Math.imul(al1, bh8)) | 0;
  40562. mid = (mid + Math.imul(ah1, bl8)) | 0;
  40563. hi = (hi + Math.imul(ah1, bh8)) | 0;
  40564. lo = (lo + Math.imul(al0, bl9)) | 0;
  40565. mid = (mid + Math.imul(al0, bh9)) | 0;
  40566. mid = (mid + Math.imul(ah0, bl9)) | 0;
  40567. hi = (hi + Math.imul(ah0, bh9)) | 0;
  40568. var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40569. c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
  40570. w9 &= 0x3ffffff;
  40571. /* k = 10 */
  40572. lo = Math.imul(al9, bl1);
  40573. mid = Math.imul(al9, bh1);
  40574. mid = (mid + Math.imul(ah9, bl1)) | 0;
  40575. hi = Math.imul(ah9, bh1);
  40576. lo = (lo + Math.imul(al8, bl2)) | 0;
  40577. mid = (mid + Math.imul(al8, bh2)) | 0;
  40578. mid = (mid + Math.imul(ah8, bl2)) | 0;
  40579. hi = (hi + Math.imul(ah8, bh2)) | 0;
  40580. lo = (lo + Math.imul(al7, bl3)) | 0;
  40581. mid = (mid + Math.imul(al7, bh3)) | 0;
  40582. mid = (mid + Math.imul(ah7, bl3)) | 0;
  40583. hi = (hi + Math.imul(ah7, bh3)) | 0;
  40584. lo = (lo + Math.imul(al6, bl4)) | 0;
  40585. mid = (mid + Math.imul(al6, bh4)) | 0;
  40586. mid = (mid + Math.imul(ah6, bl4)) | 0;
  40587. hi = (hi + Math.imul(ah6, bh4)) | 0;
  40588. lo = (lo + Math.imul(al5, bl5)) | 0;
  40589. mid = (mid + Math.imul(al5, bh5)) | 0;
  40590. mid = (mid + Math.imul(ah5, bl5)) | 0;
  40591. hi = (hi + Math.imul(ah5, bh5)) | 0;
  40592. lo = (lo + Math.imul(al4, bl6)) | 0;
  40593. mid = (mid + Math.imul(al4, bh6)) | 0;
  40594. mid = (mid + Math.imul(ah4, bl6)) | 0;
  40595. hi = (hi + Math.imul(ah4, bh6)) | 0;
  40596. lo = (lo + Math.imul(al3, bl7)) | 0;
  40597. mid = (mid + Math.imul(al3, bh7)) | 0;
  40598. mid = (mid + Math.imul(ah3, bl7)) | 0;
  40599. hi = (hi + Math.imul(ah3, bh7)) | 0;
  40600. lo = (lo + Math.imul(al2, bl8)) | 0;
  40601. mid = (mid + Math.imul(al2, bh8)) | 0;
  40602. mid = (mid + Math.imul(ah2, bl8)) | 0;
  40603. hi = (hi + Math.imul(ah2, bh8)) | 0;
  40604. lo = (lo + Math.imul(al1, bl9)) | 0;
  40605. mid = (mid + Math.imul(al1, bh9)) | 0;
  40606. mid = (mid + Math.imul(ah1, bl9)) | 0;
  40607. hi = (hi + Math.imul(ah1, bh9)) | 0;
  40608. var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40609. c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
  40610. w10 &= 0x3ffffff;
  40611. /* k = 11 */
  40612. lo = Math.imul(al9, bl2);
  40613. mid = Math.imul(al9, bh2);
  40614. mid = (mid + Math.imul(ah9, bl2)) | 0;
  40615. hi = Math.imul(ah9, bh2);
  40616. lo = (lo + Math.imul(al8, bl3)) | 0;
  40617. mid = (mid + Math.imul(al8, bh3)) | 0;
  40618. mid = (mid + Math.imul(ah8, bl3)) | 0;
  40619. hi = (hi + Math.imul(ah8, bh3)) | 0;
  40620. lo = (lo + Math.imul(al7, bl4)) | 0;
  40621. mid = (mid + Math.imul(al7, bh4)) | 0;
  40622. mid = (mid + Math.imul(ah7, bl4)) | 0;
  40623. hi = (hi + Math.imul(ah7, bh4)) | 0;
  40624. lo = (lo + Math.imul(al6, bl5)) | 0;
  40625. mid = (mid + Math.imul(al6, bh5)) | 0;
  40626. mid = (mid + Math.imul(ah6, bl5)) | 0;
  40627. hi = (hi + Math.imul(ah6, bh5)) | 0;
  40628. lo = (lo + Math.imul(al5, bl6)) | 0;
  40629. mid = (mid + Math.imul(al5, bh6)) | 0;
  40630. mid = (mid + Math.imul(ah5, bl6)) | 0;
  40631. hi = (hi + Math.imul(ah5, bh6)) | 0;
  40632. lo = (lo + Math.imul(al4, bl7)) | 0;
  40633. mid = (mid + Math.imul(al4, bh7)) | 0;
  40634. mid = (mid + Math.imul(ah4, bl7)) | 0;
  40635. hi = (hi + Math.imul(ah4, bh7)) | 0;
  40636. lo = (lo + Math.imul(al3, bl8)) | 0;
  40637. mid = (mid + Math.imul(al3, bh8)) | 0;
  40638. mid = (mid + Math.imul(ah3, bl8)) | 0;
  40639. hi = (hi + Math.imul(ah3, bh8)) | 0;
  40640. lo = (lo + Math.imul(al2, bl9)) | 0;
  40641. mid = (mid + Math.imul(al2, bh9)) | 0;
  40642. mid = (mid + Math.imul(ah2, bl9)) | 0;
  40643. hi = (hi + Math.imul(ah2, bh9)) | 0;
  40644. var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40645. c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
  40646. w11 &= 0x3ffffff;
  40647. /* k = 12 */
  40648. lo = Math.imul(al9, bl3);
  40649. mid = Math.imul(al9, bh3);
  40650. mid = (mid + Math.imul(ah9, bl3)) | 0;
  40651. hi = Math.imul(ah9, bh3);
  40652. lo = (lo + Math.imul(al8, bl4)) | 0;
  40653. mid = (mid + Math.imul(al8, bh4)) | 0;
  40654. mid = (mid + Math.imul(ah8, bl4)) | 0;
  40655. hi = (hi + Math.imul(ah8, bh4)) | 0;
  40656. lo = (lo + Math.imul(al7, bl5)) | 0;
  40657. mid = (mid + Math.imul(al7, bh5)) | 0;
  40658. mid = (mid + Math.imul(ah7, bl5)) | 0;
  40659. hi = (hi + Math.imul(ah7, bh5)) | 0;
  40660. lo = (lo + Math.imul(al6, bl6)) | 0;
  40661. mid = (mid + Math.imul(al6, bh6)) | 0;
  40662. mid = (mid + Math.imul(ah6, bl6)) | 0;
  40663. hi = (hi + Math.imul(ah6, bh6)) | 0;
  40664. lo = (lo + Math.imul(al5, bl7)) | 0;
  40665. mid = (mid + Math.imul(al5, bh7)) | 0;
  40666. mid = (mid + Math.imul(ah5, bl7)) | 0;
  40667. hi = (hi + Math.imul(ah5, bh7)) | 0;
  40668. lo = (lo + Math.imul(al4, bl8)) | 0;
  40669. mid = (mid + Math.imul(al4, bh8)) | 0;
  40670. mid = (mid + Math.imul(ah4, bl8)) | 0;
  40671. hi = (hi + Math.imul(ah4, bh8)) | 0;
  40672. lo = (lo + Math.imul(al3, bl9)) | 0;
  40673. mid = (mid + Math.imul(al3, bh9)) | 0;
  40674. mid = (mid + Math.imul(ah3, bl9)) | 0;
  40675. hi = (hi + Math.imul(ah3, bh9)) | 0;
  40676. var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40677. c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
  40678. w12 &= 0x3ffffff;
  40679. /* k = 13 */
  40680. lo = Math.imul(al9, bl4);
  40681. mid = Math.imul(al9, bh4);
  40682. mid = (mid + Math.imul(ah9, bl4)) | 0;
  40683. hi = Math.imul(ah9, bh4);
  40684. lo = (lo + Math.imul(al8, bl5)) | 0;
  40685. mid = (mid + Math.imul(al8, bh5)) | 0;
  40686. mid = (mid + Math.imul(ah8, bl5)) | 0;
  40687. hi = (hi + Math.imul(ah8, bh5)) | 0;
  40688. lo = (lo + Math.imul(al7, bl6)) | 0;
  40689. mid = (mid + Math.imul(al7, bh6)) | 0;
  40690. mid = (mid + Math.imul(ah7, bl6)) | 0;
  40691. hi = (hi + Math.imul(ah7, bh6)) | 0;
  40692. lo = (lo + Math.imul(al6, bl7)) | 0;
  40693. mid = (mid + Math.imul(al6, bh7)) | 0;
  40694. mid = (mid + Math.imul(ah6, bl7)) | 0;
  40695. hi = (hi + Math.imul(ah6, bh7)) | 0;
  40696. lo = (lo + Math.imul(al5, bl8)) | 0;
  40697. mid = (mid + Math.imul(al5, bh8)) | 0;
  40698. mid = (mid + Math.imul(ah5, bl8)) | 0;
  40699. hi = (hi + Math.imul(ah5, bh8)) | 0;
  40700. lo = (lo + Math.imul(al4, bl9)) | 0;
  40701. mid = (mid + Math.imul(al4, bh9)) | 0;
  40702. mid = (mid + Math.imul(ah4, bl9)) | 0;
  40703. hi = (hi + Math.imul(ah4, bh9)) | 0;
  40704. var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40705. c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
  40706. w13 &= 0x3ffffff;
  40707. /* k = 14 */
  40708. lo = Math.imul(al9, bl5);
  40709. mid = Math.imul(al9, bh5);
  40710. mid = (mid + Math.imul(ah9, bl5)) | 0;
  40711. hi = Math.imul(ah9, bh5);
  40712. lo = (lo + Math.imul(al8, bl6)) | 0;
  40713. mid = (mid + Math.imul(al8, bh6)) | 0;
  40714. mid = (mid + Math.imul(ah8, bl6)) | 0;
  40715. hi = (hi + Math.imul(ah8, bh6)) | 0;
  40716. lo = (lo + Math.imul(al7, bl7)) | 0;
  40717. mid = (mid + Math.imul(al7, bh7)) | 0;
  40718. mid = (mid + Math.imul(ah7, bl7)) | 0;
  40719. hi = (hi + Math.imul(ah7, bh7)) | 0;
  40720. lo = (lo + Math.imul(al6, bl8)) | 0;
  40721. mid = (mid + Math.imul(al6, bh8)) | 0;
  40722. mid = (mid + Math.imul(ah6, bl8)) | 0;
  40723. hi = (hi + Math.imul(ah6, bh8)) | 0;
  40724. lo = (lo + Math.imul(al5, bl9)) | 0;
  40725. mid = (mid + Math.imul(al5, bh9)) | 0;
  40726. mid = (mid + Math.imul(ah5, bl9)) | 0;
  40727. hi = (hi + Math.imul(ah5, bh9)) | 0;
  40728. var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40729. c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
  40730. w14 &= 0x3ffffff;
  40731. /* k = 15 */
  40732. lo = Math.imul(al9, bl6);
  40733. mid = Math.imul(al9, bh6);
  40734. mid = (mid + Math.imul(ah9, bl6)) | 0;
  40735. hi = Math.imul(ah9, bh6);
  40736. lo = (lo + Math.imul(al8, bl7)) | 0;
  40737. mid = (mid + Math.imul(al8, bh7)) | 0;
  40738. mid = (mid + Math.imul(ah8, bl7)) | 0;
  40739. hi = (hi + Math.imul(ah8, bh7)) | 0;
  40740. lo = (lo + Math.imul(al7, bl8)) | 0;
  40741. mid = (mid + Math.imul(al7, bh8)) | 0;
  40742. mid = (mid + Math.imul(ah7, bl8)) | 0;
  40743. hi = (hi + Math.imul(ah7, bh8)) | 0;
  40744. lo = (lo + Math.imul(al6, bl9)) | 0;
  40745. mid = (mid + Math.imul(al6, bh9)) | 0;
  40746. mid = (mid + Math.imul(ah6, bl9)) | 0;
  40747. hi = (hi + Math.imul(ah6, bh9)) | 0;
  40748. var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40749. c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
  40750. w15 &= 0x3ffffff;
  40751. /* k = 16 */
  40752. lo = Math.imul(al9, bl7);
  40753. mid = Math.imul(al9, bh7);
  40754. mid = (mid + Math.imul(ah9, bl7)) | 0;
  40755. hi = Math.imul(ah9, bh7);
  40756. lo = (lo + Math.imul(al8, bl8)) | 0;
  40757. mid = (mid + Math.imul(al8, bh8)) | 0;
  40758. mid = (mid + Math.imul(ah8, bl8)) | 0;
  40759. hi = (hi + Math.imul(ah8, bh8)) | 0;
  40760. lo = (lo + Math.imul(al7, bl9)) | 0;
  40761. mid = (mid + Math.imul(al7, bh9)) | 0;
  40762. mid = (mid + Math.imul(ah7, bl9)) | 0;
  40763. hi = (hi + Math.imul(ah7, bh9)) | 0;
  40764. var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40765. c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
  40766. w16 &= 0x3ffffff;
  40767. /* k = 17 */
  40768. lo = Math.imul(al9, bl8);
  40769. mid = Math.imul(al9, bh8);
  40770. mid = (mid + Math.imul(ah9, bl8)) | 0;
  40771. hi = Math.imul(ah9, bh8);
  40772. lo = (lo + Math.imul(al8, bl9)) | 0;
  40773. mid = (mid + Math.imul(al8, bh9)) | 0;
  40774. mid = (mid + Math.imul(ah8, bl9)) | 0;
  40775. hi = (hi + Math.imul(ah8, bh9)) | 0;
  40776. var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40777. c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
  40778. w17 &= 0x3ffffff;
  40779. /* k = 18 */
  40780. lo = Math.imul(al9, bl9);
  40781. mid = Math.imul(al9, bh9);
  40782. mid = (mid + Math.imul(ah9, bl9)) | 0;
  40783. hi = Math.imul(ah9, bh9);
  40784. var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  40785. c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
  40786. w18 &= 0x3ffffff;
  40787. o[0] = w0;
  40788. o[1] = w1;
  40789. o[2] = w2;
  40790. o[3] = w3;
  40791. o[4] = w4;
  40792. o[5] = w5;
  40793. o[6] = w6;
  40794. o[7] = w7;
  40795. o[8] = w8;
  40796. o[9] = w9;
  40797. o[10] = w10;
  40798. o[11] = w11;
  40799. o[12] = w12;
  40800. o[13] = w13;
  40801. o[14] = w14;
  40802. o[15] = w15;
  40803. o[16] = w16;
  40804. o[17] = w17;
  40805. o[18] = w18;
  40806. if (c !== 0) {
  40807. o[19] = c;
  40808. out.length++;
  40809. }
  40810. return out;
  40811. };
  40812. // Polyfill comb
  40813. if (!Math.imul) {
  40814. comb10MulTo = smallMulTo;
  40815. }
  40816. function bigMulTo (self, num, out) {
  40817. out.negative = num.negative ^ self.negative;
  40818. out.length = self.length + num.length;
  40819. var carry = 0;
  40820. var hncarry = 0;
  40821. for (var k = 0; k < out.length - 1; k++) {
  40822. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  40823. // note that ncarry could be >= 0x3ffffff
  40824. var ncarry = hncarry;
  40825. hncarry = 0;
  40826. var rword = carry & 0x3ffffff;
  40827. var maxJ = Math.min(k, num.length - 1);
  40828. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  40829. var i = k - j;
  40830. var a = self.words[i] | 0;
  40831. var b = num.words[j] | 0;
  40832. var r = a * b;
  40833. var lo = r & 0x3ffffff;
  40834. ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
  40835. lo = (lo + rword) | 0;
  40836. rword = lo & 0x3ffffff;
  40837. ncarry = (ncarry + (lo >>> 26)) | 0;
  40838. hncarry += ncarry >>> 26;
  40839. ncarry &= 0x3ffffff;
  40840. }
  40841. out.words[k] = rword;
  40842. carry = ncarry;
  40843. ncarry = hncarry;
  40844. }
  40845. if (carry !== 0) {
  40846. out.words[k] = carry;
  40847. } else {
  40848. out.length--;
  40849. }
  40850. return out.strip();
  40851. }
  40852. function jumboMulTo (self, num, out) {
  40853. var fftm = new FFTM();
  40854. return fftm.mulp(self, num, out);
  40855. }
  40856. BN.prototype.mulTo = function mulTo (num, out) {
  40857. var res;
  40858. var len = this.length + num.length;
  40859. if (this.length === 10 && num.length === 10) {
  40860. res = comb10MulTo(this, num, out);
  40861. } else if (len < 63) {
  40862. res = smallMulTo(this, num, out);
  40863. } else if (len < 1024) {
  40864. res = bigMulTo(this, num, out);
  40865. } else {
  40866. res = jumboMulTo(this, num, out);
  40867. }
  40868. return res;
  40869. };
  40870. // Cooley-Tukey algorithm for FFT
  40871. // slightly revisited to rely on looping instead of recursion
  40872. function FFTM (x, y) {
  40873. this.x = x;
  40874. this.y = y;
  40875. }
  40876. FFTM.prototype.makeRBT = function makeRBT (N) {
  40877. var t = new Array(N);
  40878. var l = BN.prototype._countBits(N) - 1;
  40879. for (var i = 0; i < N; i++) {
  40880. t[i] = this.revBin(i, l, N);
  40881. }
  40882. return t;
  40883. };
  40884. // Returns binary-reversed representation of `x`
  40885. FFTM.prototype.revBin = function revBin (x, l, N) {
  40886. if (x === 0 || x === N - 1) return x;
  40887. var rb = 0;
  40888. for (var i = 0; i < l; i++) {
  40889. rb |= (x & 1) << (l - i - 1);
  40890. x >>= 1;
  40891. }
  40892. return rb;
  40893. };
  40894. // Performs "tweedling" phase, therefore 'emulating'
  40895. // behaviour of the recursive algorithm
  40896. FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
  40897. for (var i = 0; i < N; i++) {
  40898. rtws[i] = rws[rbt[i]];
  40899. itws[i] = iws[rbt[i]];
  40900. }
  40901. };
  40902. FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
  40903. this.permute(rbt, rws, iws, rtws, itws, N);
  40904. for (var s = 1; s < N; s <<= 1) {
  40905. var l = s << 1;
  40906. var rtwdf = Math.cos(2 * Math.PI / l);
  40907. var itwdf = Math.sin(2 * Math.PI / l);
  40908. for (var p = 0; p < N; p += l) {
  40909. var rtwdf_ = rtwdf;
  40910. var itwdf_ = itwdf;
  40911. for (var j = 0; j < s; j++) {
  40912. var re = rtws[p + j];
  40913. var ie = itws[p + j];
  40914. var ro = rtws[p + j + s];
  40915. var io = itws[p + j + s];
  40916. var rx = rtwdf_ * ro - itwdf_ * io;
  40917. io = rtwdf_ * io + itwdf_ * ro;
  40918. ro = rx;
  40919. rtws[p + j] = re + ro;
  40920. itws[p + j] = ie + io;
  40921. rtws[p + j + s] = re - ro;
  40922. itws[p + j + s] = ie - io;
  40923. /* jshint maxdepth : false */
  40924. if (j !== l) {
  40925. rx = rtwdf * rtwdf_ - itwdf * itwdf_;
  40926. itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
  40927. rtwdf_ = rx;
  40928. }
  40929. }
  40930. }
  40931. }
  40932. };
  40933. FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
  40934. var N = Math.max(m, n) | 1;
  40935. var odd = N & 1;
  40936. var i = 0;
  40937. for (N = N / 2 | 0; N; N = N >>> 1) {
  40938. i++;
  40939. }
  40940. return 1 << i + 1 + odd;
  40941. };
  40942. FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
  40943. if (N <= 1) return;
  40944. for (var i = 0; i < N / 2; i++) {
  40945. var t = rws[i];
  40946. rws[i] = rws[N - i - 1];
  40947. rws[N - i - 1] = t;
  40948. t = iws[i];
  40949. iws[i] = -iws[N - i - 1];
  40950. iws[N - i - 1] = -t;
  40951. }
  40952. };
  40953. FFTM.prototype.normalize13b = function normalize13b (ws, N) {
  40954. var carry = 0;
  40955. for (var i = 0; i < N / 2; i++) {
  40956. var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
  40957. Math.round(ws[2 * i] / N) +
  40958. carry;
  40959. ws[i] = w & 0x3ffffff;
  40960. if (w < 0x4000000) {
  40961. carry = 0;
  40962. } else {
  40963. carry = w / 0x4000000 | 0;
  40964. }
  40965. }
  40966. return ws;
  40967. };
  40968. FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
  40969. var carry = 0;
  40970. for (var i = 0; i < len; i++) {
  40971. carry = carry + (ws[i] | 0);
  40972. rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
  40973. rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
  40974. }
  40975. // Pad with zeroes
  40976. for (i = 2 * len; i < N; ++i) {
  40977. rws[i] = 0;
  40978. }
  40979. assert(carry === 0);
  40980. assert((carry & ~0x1fff) === 0);
  40981. };
  40982. FFTM.prototype.stub = function stub (N) {
  40983. var ph = new Array(N);
  40984. for (var i = 0; i < N; i++) {
  40985. ph[i] = 0;
  40986. }
  40987. return ph;
  40988. };
  40989. FFTM.prototype.mulp = function mulp (x, y, out) {
  40990. var N = 2 * this.guessLen13b(x.length, y.length);
  40991. var rbt = this.makeRBT(N);
  40992. var _ = this.stub(N);
  40993. var rws = new Array(N);
  40994. var rwst = new Array(N);
  40995. var iwst = new Array(N);
  40996. var nrws = new Array(N);
  40997. var nrwst = new Array(N);
  40998. var niwst = new Array(N);
  40999. var rmws = out.words;
  41000. rmws.length = N;
  41001. this.convert13b(x.words, x.length, rws, N);
  41002. this.convert13b(y.words, y.length, nrws, N);
  41003. this.transform(rws, _, rwst, iwst, N, rbt);
  41004. this.transform(nrws, _, nrwst, niwst, N, rbt);
  41005. for (var i = 0; i < N; i++) {
  41006. var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
  41007. iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
  41008. rwst[i] = rx;
  41009. }
  41010. this.conjugate(rwst, iwst, N);
  41011. this.transform(rwst, iwst, rmws, _, N, rbt);
  41012. this.conjugate(rmws, _, N);
  41013. this.normalize13b(rmws, N);
  41014. out.negative = x.negative ^ y.negative;
  41015. out.length = x.length + y.length;
  41016. return out.strip();
  41017. };
  41018. // Multiply `this` by `num`
  41019. BN.prototype.mul = function mul (num) {
  41020. var out = new BN(null);
  41021. out.words = new Array(this.length + num.length);
  41022. return this.mulTo(num, out);
  41023. };
  41024. // Multiply employing FFT
  41025. BN.prototype.mulf = function mulf (num) {
  41026. var out = new BN(null);
  41027. out.words = new Array(this.length + num.length);
  41028. return jumboMulTo(this, num, out);
  41029. };
  41030. // In-place Multiplication
  41031. BN.prototype.imul = function imul (num) {
  41032. return this.clone().mulTo(num, this);
  41033. };
  41034. BN.prototype.imuln = function imuln (num) {
  41035. assert(typeof num === 'number');
  41036. assert(num < 0x4000000);
  41037. // Carry
  41038. var carry = 0;
  41039. for (var i = 0; i < this.length; i++) {
  41040. var w = (this.words[i] | 0) * num;
  41041. var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
  41042. carry >>= 26;
  41043. carry += (w / 0x4000000) | 0;
  41044. // NOTE: lo is 27bit maximum
  41045. carry += lo >>> 26;
  41046. this.words[i] = lo & 0x3ffffff;
  41047. }
  41048. if (carry !== 0) {
  41049. this.words[i] = carry;
  41050. this.length++;
  41051. }
  41052. return this;
  41053. };
  41054. BN.prototype.muln = function muln (num) {
  41055. return this.clone().imuln(num);
  41056. };
  41057. // `this` * `this`
  41058. BN.prototype.sqr = function sqr () {
  41059. return this.mul(this);
  41060. };
  41061. // `this` * `this` in-place
  41062. BN.prototype.isqr = function isqr () {
  41063. return this.imul(this.clone());
  41064. };
  41065. // Math.pow(`this`, `num`)
  41066. BN.prototype.pow = function pow (num) {
  41067. var w = toBitArray(num);
  41068. if (w.length === 0) return new BN(1);
  41069. // Skip leading zeroes
  41070. var res = this;
  41071. for (var i = 0; i < w.length; i++, res = res.sqr()) {
  41072. if (w[i] !== 0) break;
  41073. }
  41074. if (++i < w.length) {
  41075. for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
  41076. if (w[i] === 0) continue;
  41077. res = res.mul(q);
  41078. }
  41079. }
  41080. return res;
  41081. };
  41082. // Shift-left in-place
  41083. BN.prototype.iushln = function iushln (bits) {
  41084. assert(typeof bits === 'number' && bits >= 0);
  41085. var r = bits % 26;
  41086. var s = (bits - r) / 26;
  41087. var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
  41088. var i;
  41089. if (r !== 0) {
  41090. var carry = 0;
  41091. for (i = 0; i < this.length; i++) {
  41092. var newCarry = this.words[i] & carryMask;
  41093. var c = ((this.words[i] | 0) - newCarry) << r;
  41094. this.words[i] = c | carry;
  41095. carry = newCarry >>> (26 - r);
  41096. }
  41097. if (carry) {
  41098. this.words[i] = carry;
  41099. this.length++;
  41100. }
  41101. }
  41102. if (s !== 0) {
  41103. for (i = this.length - 1; i >= 0; i--) {
  41104. this.words[i + s] = this.words[i];
  41105. }
  41106. for (i = 0; i < s; i++) {
  41107. this.words[i] = 0;
  41108. }
  41109. this.length += s;
  41110. }
  41111. return this.strip();
  41112. };
  41113. BN.prototype.ishln = function ishln (bits) {
  41114. // TODO(indutny): implement me
  41115. assert(this.negative === 0);
  41116. return this.iushln(bits);
  41117. };
  41118. // Shift-right in-place
  41119. // NOTE: `hint` is a lowest bit before trailing zeroes
  41120. // NOTE: if `extended` is present - it will be filled with destroyed bits
  41121. BN.prototype.iushrn = function iushrn (bits, hint, extended) {
  41122. assert(typeof bits === 'number' && bits >= 0);
  41123. var h;
  41124. if (hint) {
  41125. h = (hint - (hint % 26)) / 26;
  41126. } else {
  41127. h = 0;
  41128. }
  41129. var r = bits % 26;
  41130. var s = Math.min((bits - r) / 26, this.length);
  41131. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  41132. var maskedWords = extended;
  41133. h -= s;
  41134. h = Math.max(0, h);
  41135. // Extended mode, copy masked part
  41136. if (maskedWords) {
  41137. for (var i = 0; i < s; i++) {
  41138. maskedWords.words[i] = this.words[i];
  41139. }
  41140. maskedWords.length = s;
  41141. }
  41142. if (s === 0) {
  41143. // No-op, we should not move anything at all
  41144. } else if (this.length > s) {
  41145. this.length -= s;
  41146. for (i = 0; i < this.length; i++) {
  41147. this.words[i] = this.words[i + s];
  41148. }
  41149. } else {
  41150. this.words[0] = 0;
  41151. this.length = 1;
  41152. }
  41153. var carry = 0;
  41154. for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
  41155. var word = this.words[i] | 0;
  41156. this.words[i] = (carry << (26 - r)) | (word >>> r);
  41157. carry = word & mask;
  41158. }
  41159. // Push carried bits as a mask
  41160. if (maskedWords && carry !== 0) {
  41161. maskedWords.words[maskedWords.length++] = carry;
  41162. }
  41163. if (this.length === 0) {
  41164. this.words[0] = 0;
  41165. this.length = 1;
  41166. }
  41167. return this.strip();
  41168. };
  41169. BN.prototype.ishrn = function ishrn (bits, hint, extended) {
  41170. // TODO(indutny): implement me
  41171. assert(this.negative === 0);
  41172. return this.iushrn(bits, hint, extended);
  41173. };
  41174. // Shift-left
  41175. BN.prototype.shln = function shln (bits) {
  41176. return this.clone().ishln(bits);
  41177. };
  41178. BN.prototype.ushln = function ushln (bits) {
  41179. return this.clone().iushln(bits);
  41180. };
  41181. // Shift-right
  41182. BN.prototype.shrn = function shrn (bits) {
  41183. return this.clone().ishrn(bits);
  41184. };
  41185. BN.prototype.ushrn = function ushrn (bits) {
  41186. return this.clone().iushrn(bits);
  41187. };
  41188. // Test if n bit is set
  41189. BN.prototype.testn = function testn (bit) {
  41190. assert(typeof bit === 'number' && bit >= 0);
  41191. var r = bit % 26;
  41192. var s = (bit - r) / 26;
  41193. var q = 1 << r;
  41194. // Fast case: bit is much higher than all existing words
  41195. if (this.length <= s) return false;
  41196. // Check bit and return
  41197. var w = this.words[s];
  41198. return !!(w & q);
  41199. };
  41200. // Return only lowers bits of number (in-place)
  41201. BN.prototype.imaskn = function imaskn (bits) {
  41202. assert(typeof bits === 'number' && bits >= 0);
  41203. var r = bits % 26;
  41204. var s = (bits - r) / 26;
  41205. assert(this.negative === 0, 'imaskn works only with positive numbers');
  41206. if (this.length <= s) {
  41207. return this;
  41208. }
  41209. if (r !== 0) {
  41210. s++;
  41211. }
  41212. this.length = Math.min(s, this.length);
  41213. if (r !== 0) {
  41214. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  41215. this.words[this.length - 1] &= mask;
  41216. }
  41217. return this.strip();
  41218. };
  41219. // Return only lowers bits of number
  41220. BN.prototype.maskn = function maskn (bits) {
  41221. return this.clone().imaskn(bits);
  41222. };
  41223. // Add plain number `num` to `this`
  41224. BN.prototype.iaddn = function iaddn (num) {
  41225. assert(typeof num === 'number');
  41226. assert(num < 0x4000000);
  41227. if (num < 0) return this.isubn(-num);
  41228. // Possible sign change
  41229. if (this.negative !== 0) {
  41230. if (this.length === 1 && (this.words[0] | 0) < num) {
  41231. this.words[0] = num - (this.words[0] | 0);
  41232. this.negative = 0;
  41233. return this;
  41234. }
  41235. this.negative = 0;
  41236. this.isubn(num);
  41237. this.negative = 1;
  41238. return this;
  41239. }
  41240. // Add without checks
  41241. return this._iaddn(num);
  41242. };
  41243. BN.prototype._iaddn = function _iaddn (num) {
  41244. this.words[0] += num;
  41245. // Carry
  41246. for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
  41247. this.words[i] -= 0x4000000;
  41248. if (i === this.length - 1) {
  41249. this.words[i + 1] = 1;
  41250. } else {
  41251. this.words[i + 1]++;
  41252. }
  41253. }
  41254. this.length = Math.max(this.length, i + 1);
  41255. return this;
  41256. };
  41257. // Subtract plain number `num` from `this`
  41258. BN.prototype.isubn = function isubn (num) {
  41259. assert(typeof num === 'number');
  41260. assert(num < 0x4000000);
  41261. if (num < 0) return this.iaddn(-num);
  41262. if (this.negative !== 0) {
  41263. this.negative = 0;
  41264. this.iaddn(num);
  41265. this.negative = 1;
  41266. return this;
  41267. }
  41268. this.words[0] -= num;
  41269. if (this.length === 1 && this.words[0] < 0) {
  41270. this.words[0] = -this.words[0];
  41271. this.negative = 1;
  41272. } else {
  41273. // Carry
  41274. for (var i = 0; i < this.length && this.words[i] < 0; i++) {
  41275. this.words[i] += 0x4000000;
  41276. this.words[i + 1] -= 1;
  41277. }
  41278. }
  41279. return this.strip();
  41280. };
  41281. BN.prototype.addn = function addn (num) {
  41282. return this.clone().iaddn(num);
  41283. };
  41284. BN.prototype.subn = function subn (num) {
  41285. return this.clone().isubn(num);
  41286. };
  41287. BN.prototype.iabs = function iabs () {
  41288. this.negative = 0;
  41289. return this;
  41290. };
  41291. BN.prototype.abs = function abs () {
  41292. return this.clone().iabs();
  41293. };
  41294. BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
  41295. var len = num.length + shift;
  41296. var i;
  41297. this._expand(len);
  41298. var w;
  41299. var carry = 0;
  41300. for (i = 0; i < num.length; i++) {
  41301. w = (this.words[i + shift] | 0) + carry;
  41302. var right = (num.words[i] | 0) * mul;
  41303. w -= right & 0x3ffffff;
  41304. carry = (w >> 26) - ((right / 0x4000000) | 0);
  41305. this.words[i + shift] = w & 0x3ffffff;
  41306. }
  41307. for (; i < this.length - shift; i++) {
  41308. w = (this.words[i + shift] | 0) + carry;
  41309. carry = w >> 26;
  41310. this.words[i + shift] = w & 0x3ffffff;
  41311. }
  41312. if (carry === 0) return this.strip();
  41313. // Subtraction overflow
  41314. assert(carry === -1);
  41315. carry = 0;
  41316. for (i = 0; i < this.length; i++) {
  41317. w = -(this.words[i] | 0) + carry;
  41318. carry = w >> 26;
  41319. this.words[i] = w & 0x3ffffff;
  41320. }
  41321. this.negative = 1;
  41322. return this.strip();
  41323. };
  41324. BN.prototype._wordDiv = function _wordDiv (num, mode) {
  41325. var shift = this.length - num.length;
  41326. var a = this.clone();
  41327. var b = num;
  41328. // Normalize
  41329. var bhi = b.words[b.length - 1] | 0;
  41330. var bhiBits = this._countBits(bhi);
  41331. shift = 26 - bhiBits;
  41332. if (shift !== 0) {
  41333. b = b.ushln(shift);
  41334. a.iushln(shift);
  41335. bhi = b.words[b.length - 1] | 0;
  41336. }
  41337. // Initialize quotient
  41338. var m = a.length - b.length;
  41339. var q;
  41340. if (mode !== 'mod') {
  41341. q = new BN(null);
  41342. q.length = m + 1;
  41343. q.words = new Array(q.length);
  41344. for (var i = 0; i < q.length; i++) {
  41345. q.words[i] = 0;
  41346. }
  41347. }
  41348. var diff = a.clone()._ishlnsubmul(b, 1, m);
  41349. if (diff.negative === 0) {
  41350. a = diff;
  41351. if (q) {
  41352. q.words[m] = 1;
  41353. }
  41354. }
  41355. for (var j = m - 1; j >= 0; j--) {
  41356. var qj = (a.words[b.length + j] | 0) * 0x4000000 +
  41357. (a.words[b.length + j - 1] | 0);
  41358. // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
  41359. // (0x7ffffff)
  41360. qj = Math.min((qj / bhi) | 0, 0x3ffffff);
  41361. a._ishlnsubmul(b, qj, j);
  41362. while (a.negative !== 0) {
  41363. qj--;
  41364. a.negative = 0;
  41365. a._ishlnsubmul(b, 1, j);
  41366. if (!a.isZero()) {
  41367. a.negative ^= 1;
  41368. }
  41369. }
  41370. if (q) {
  41371. q.words[j] = qj;
  41372. }
  41373. }
  41374. if (q) {
  41375. q.strip();
  41376. }
  41377. a.strip();
  41378. // Denormalize
  41379. if (mode !== 'div' && shift !== 0) {
  41380. a.iushrn(shift);
  41381. }
  41382. return {
  41383. div: q || null,
  41384. mod: a
  41385. };
  41386. };
  41387. // NOTE: 1) `mode` can be set to `mod` to request mod only,
  41388. // to `div` to request div only, or be absent to
  41389. // request both div & mod
  41390. // 2) `positive` is true if unsigned mod is requested
  41391. BN.prototype.divmod = function divmod (num, mode, positive) {
  41392. assert(!num.isZero());
  41393. if (this.isZero()) {
  41394. return {
  41395. div: new BN(0),
  41396. mod: new BN(0)
  41397. };
  41398. }
  41399. var div, mod, res;
  41400. if (this.negative !== 0 && num.negative === 0) {
  41401. res = this.neg().divmod(num, mode);
  41402. if (mode !== 'mod') {
  41403. div = res.div.neg();
  41404. }
  41405. if (mode !== 'div') {
  41406. mod = res.mod.neg();
  41407. if (positive && mod.negative !== 0) {
  41408. mod.iadd(num);
  41409. }
  41410. }
  41411. return {
  41412. div: div,
  41413. mod: mod
  41414. };
  41415. }
  41416. if (this.negative === 0 && num.negative !== 0) {
  41417. res = this.divmod(num.neg(), mode);
  41418. if (mode !== 'mod') {
  41419. div = res.div.neg();
  41420. }
  41421. return {
  41422. div: div,
  41423. mod: res.mod
  41424. };
  41425. }
  41426. if ((this.negative & num.negative) !== 0) {
  41427. res = this.neg().divmod(num.neg(), mode);
  41428. if (mode !== 'div') {
  41429. mod = res.mod.neg();
  41430. if (positive && mod.negative !== 0) {
  41431. mod.isub(num);
  41432. }
  41433. }
  41434. return {
  41435. div: res.div,
  41436. mod: mod
  41437. };
  41438. }
  41439. // Both numbers are positive at this point
  41440. // Strip both numbers to approximate shift value
  41441. if (num.length > this.length || this.cmp(num) < 0) {
  41442. return {
  41443. div: new BN(0),
  41444. mod: this
  41445. };
  41446. }
  41447. // Very short reduction
  41448. if (num.length === 1) {
  41449. if (mode === 'div') {
  41450. return {
  41451. div: this.divn(num.words[0]),
  41452. mod: null
  41453. };
  41454. }
  41455. if (mode === 'mod') {
  41456. return {
  41457. div: null,
  41458. mod: new BN(this.modn(num.words[0]))
  41459. };
  41460. }
  41461. return {
  41462. div: this.divn(num.words[0]),
  41463. mod: new BN(this.modn(num.words[0]))
  41464. };
  41465. }
  41466. return this._wordDiv(num, mode);
  41467. };
  41468. // Find `this` / `num`
  41469. BN.prototype.div = function div (num) {
  41470. return this.divmod(num, 'div', false).div;
  41471. };
  41472. // Find `this` % `num`
  41473. BN.prototype.mod = function mod (num) {
  41474. return this.divmod(num, 'mod', false).mod;
  41475. };
  41476. BN.prototype.umod = function umod (num) {
  41477. return this.divmod(num, 'mod', true).mod;
  41478. };
  41479. // Find Round(`this` / `num`)
  41480. BN.prototype.divRound = function divRound (num) {
  41481. var dm = this.divmod(num);
  41482. // Fast case - exact division
  41483. if (dm.mod.isZero()) return dm.div;
  41484. var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
  41485. var half = num.ushrn(1);
  41486. var r2 = num.andln(1);
  41487. var cmp = mod.cmp(half);
  41488. // Round down
  41489. if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
  41490. // Round up
  41491. return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
  41492. };
  41493. BN.prototype.modn = function modn (num) {
  41494. assert(num <= 0x3ffffff);
  41495. var p = (1 << 26) % num;
  41496. var acc = 0;
  41497. for (var i = this.length - 1; i >= 0; i--) {
  41498. acc = (p * acc + (this.words[i] | 0)) % num;
  41499. }
  41500. return acc;
  41501. };
  41502. // In-place division by number
  41503. BN.prototype.idivn = function idivn (num) {
  41504. assert(num <= 0x3ffffff);
  41505. var carry = 0;
  41506. for (var i = this.length - 1; i >= 0; i--) {
  41507. var w = (this.words[i] | 0) + carry * 0x4000000;
  41508. this.words[i] = (w / num) | 0;
  41509. carry = w % num;
  41510. }
  41511. return this.strip();
  41512. };
  41513. BN.prototype.divn = function divn (num) {
  41514. return this.clone().idivn(num);
  41515. };
  41516. BN.prototype.egcd = function egcd (p) {
  41517. assert(p.negative === 0);
  41518. assert(!p.isZero());
  41519. var x = this;
  41520. var y = p.clone();
  41521. if (x.negative !== 0) {
  41522. x = x.umod(p);
  41523. } else {
  41524. x = x.clone();
  41525. }
  41526. // A * x + B * y = x
  41527. var A = new BN(1);
  41528. var B = new BN(0);
  41529. // C * x + D * y = y
  41530. var C = new BN(0);
  41531. var D = new BN(1);
  41532. var g = 0;
  41533. while (x.isEven() && y.isEven()) {
  41534. x.iushrn(1);
  41535. y.iushrn(1);
  41536. ++g;
  41537. }
  41538. var yp = y.clone();
  41539. var xp = x.clone();
  41540. while (!x.isZero()) {
  41541. for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  41542. if (i > 0) {
  41543. x.iushrn(i);
  41544. while (i-- > 0) {
  41545. if (A.isOdd() || B.isOdd()) {
  41546. A.iadd(yp);
  41547. B.isub(xp);
  41548. }
  41549. A.iushrn(1);
  41550. B.iushrn(1);
  41551. }
  41552. }
  41553. for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  41554. if (j > 0) {
  41555. y.iushrn(j);
  41556. while (j-- > 0) {
  41557. if (C.isOdd() || D.isOdd()) {
  41558. C.iadd(yp);
  41559. D.isub(xp);
  41560. }
  41561. C.iushrn(1);
  41562. D.iushrn(1);
  41563. }
  41564. }
  41565. if (x.cmp(y) >= 0) {
  41566. x.isub(y);
  41567. A.isub(C);
  41568. B.isub(D);
  41569. } else {
  41570. y.isub(x);
  41571. C.isub(A);
  41572. D.isub(B);
  41573. }
  41574. }
  41575. return {
  41576. a: C,
  41577. b: D,
  41578. gcd: y.iushln(g)
  41579. };
  41580. };
  41581. // This is reduced incarnation of the binary EEA
  41582. // above, designated to invert members of the
  41583. // _prime_ fields F(p) at a maximal speed
  41584. BN.prototype._invmp = function _invmp (p) {
  41585. assert(p.negative === 0);
  41586. assert(!p.isZero());
  41587. var a = this;
  41588. var b = p.clone();
  41589. if (a.negative !== 0) {
  41590. a = a.umod(p);
  41591. } else {
  41592. a = a.clone();
  41593. }
  41594. var x1 = new BN(1);
  41595. var x2 = new BN(0);
  41596. var delta = b.clone();
  41597. while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
  41598. for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  41599. if (i > 0) {
  41600. a.iushrn(i);
  41601. while (i-- > 0) {
  41602. if (x1.isOdd()) {
  41603. x1.iadd(delta);
  41604. }
  41605. x1.iushrn(1);
  41606. }
  41607. }
  41608. for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  41609. if (j > 0) {
  41610. b.iushrn(j);
  41611. while (j-- > 0) {
  41612. if (x2.isOdd()) {
  41613. x2.iadd(delta);
  41614. }
  41615. x2.iushrn(1);
  41616. }
  41617. }
  41618. if (a.cmp(b) >= 0) {
  41619. a.isub(b);
  41620. x1.isub(x2);
  41621. } else {
  41622. b.isub(a);
  41623. x2.isub(x1);
  41624. }
  41625. }
  41626. var res;
  41627. if (a.cmpn(1) === 0) {
  41628. res = x1;
  41629. } else {
  41630. res = x2;
  41631. }
  41632. if (res.cmpn(0) < 0) {
  41633. res.iadd(p);
  41634. }
  41635. return res;
  41636. };
  41637. BN.prototype.gcd = function gcd (num) {
  41638. if (this.isZero()) return num.abs();
  41639. if (num.isZero()) return this.abs();
  41640. var a = this.clone();
  41641. var b = num.clone();
  41642. a.negative = 0;
  41643. b.negative = 0;
  41644. // Remove common factor of two
  41645. for (var shift = 0; a.isEven() && b.isEven(); shift++) {
  41646. a.iushrn(1);
  41647. b.iushrn(1);
  41648. }
  41649. do {
  41650. while (a.isEven()) {
  41651. a.iushrn(1);
  41652. }
  41653. while (b.isEven()) {
  41654. b.iushrn(1);
  41655. }
  41656. var r = a.cmp(b);
  41657. if (r < 0) {
  41658. // Swap `a` and `b` to make `a` always bigger than `b`
  41659. var t = a;
  41660. a = b;
  41661. b = t;
  41662. } else if (r === 0 || b.cmpn(1) === 0) {
  41663. break;
  41664. }
  41665. a.isub(b);
  41666. } while (true);
  41667. return b.iushln(shift);
  41668. };
  41669. // Invert number in the field F(num)
  41670. BN.prototype.invm = function invm (num) {
  41671. return this.egcd(num).a.umod(num);
  41672. };
  41673. BN.prototype.isEven = function isEven () {
  41674. return (this.words[0] & 1) === 0;
  41675. };
  41676. BN.prototype.isOdd = function isOdd () {
  41677. return (this.words[0] & 1) === 1;
  41678. };
  41679. // And first word and num
  41680. BN.prototype.andln = function andln (num) {
  41681. return this.words[0] & num;
  41682. };
  41683. // Increment at the bit position in-line
  41684. BN.prototype.bincn = function bincn (bit) {
  41685. assert(typeof bit === 'number');
  41686. var r = bit % 26;
  41687. var s = (bit - r) / 26;
  41688. var q = 1 << r;
  41689. // Fast case: bit is much higher than all existing words
  41690. if (this.length <= s) {
  41691. this._expand(s + 1);
  41692. this.words[s] |= q;
  41693. return this;
  41694. }
  41695. // Add bit and propagate, if needed
  41696. var carry = q;
  41697. for (var i = s; carry !== 0 && i < this.length; i++) {
  41698. var w = this.words[i] | 0;
  41699. w += carry;
  41700. carry = w >>> 26;
  41701. w &= 0x3ffffff;
  41702. this.words[i] = w;
  41703. }
  41704. if (carry !== 0) {
  41705. this.words[i] = carry;
  41706. this.length++;
  41707. }
  41708. return this;
  41709. };
  41710. BN.prototype.isZero = function isZero () {
  41711. return this.length === 1 && this.words[0] === 0;
  41712. };
  41713. BN.prototype.cmpn = function cmpn (num) {
  41714. var negative = num < 0;
  41715. if (this.negative !== 0 && !negative) return -1;
  41716. if (this.negative === 0 && negative) return 1;
  41717. this.strip();
  41718. var res;
  41719. if (this.length > 1) {
  41720. res = 1;
  41721. } else {
  41722. if (negative) {
  41723. num = -num;
  41724. }
  41725. assert(num <= 0x3ffffff, 'Number is too big');
  41726. var w = this.words[0] | 0;
  41727. res = w === num ? 0 : w < num ? -1 : 1;
  41728. }
  41729. if (this.negative !== 0) return -res | 0;
  41730. return res;
  41731. };
  41732. // Compare two numbers and return:
  41733. // 1 - if `this` > `num`
  41734. // 0 - if `this` == `num`
  41735. // -1 - if `this` < `num`
  41736. BN.prototype.cmp = function cmp (num) {
  41737. if (this.negative !== 0 && num.negative === 0) return -1;
  41738. if (this.negative === 0 && num.negative !== 0) return 1;
  41739. var res = this.ucmp(num);
  41740. if (this.negative !== 0) return -res | 0;
  41741. return res;
  41742. };
  41743. // Unsigned comparison
  41744. BN.prototype.ucmp = function ucmp (num) {
  41745. // At this point both numbers have the same sign
  41746. if (this.length > num.length) return 1;
  41747. if (this.length < num.length) return -1;
  41748. var res = 0;
  41749. for (var i = this.length - 1; i >= 0; i--) {
  41750. var a = this.words[i] | 0;
  41751. var b = num.words[i] | 0;
  41752. if (a === b) continue;
  41753. if (a < b) {
  41754. res = -1;
  41755. } else if (a > b) {
  41756. res = 1;
  41757. }
  41758. break;
  41759. }
  41760. return res;
  41761. };
  41762. BN.prototype.gtn = function gtn (num) {
  41763. return this.cmpn(num) === 1;
  41764. };
  41765. BN.prototype.gt = function gt (num) {
  41766. return this.cmp(num) === 1;
  41767. };
  41768. BN.prototype.gten = function gten (num) {
  41769. return this.cmpn(num) >= 0;
  41770. };
  41771. BN.prototype.gte = function gte (num) {
  41772. return this.cmp(num) >= 0;
  41773. };
  41774. BN.prototype.ltn = function ltn (num) {
  41775. return this.cmpn(num) === -1;
  41776. };
  41777. BN.prototype.lt = function lt (num) {
  41778. return this.cmp(num) === -1;
  41779. };
  41780. BN.prototype.lten = function lten (num) {
  41781. return this.cmpn(num) <= 0;
  41782. };
  41783. BN.prototype.lte = function lte (num) {
  41784. return this.cmp(num) <= 0;
  41785. };
  41786. BN.prototype.eqn = function eqn (num) {
  41787. return this.cmpn(num) === 0;
  41788. };
  41789. BN.prototype.eq = function eq (num) {
  41790. return this.cmp(num) === 0;
  41791. };
  41792. //
  41793. // A reduce context, could be using montgomery or something better, depending
  41794. // on the `m` itself.
  41795. //
  41796. BN.red = function red (num) {
  41797. return new Red(num);
  41798. };
  41799. BN.prototype.toRed = function toRed (ctx) {
  41800. assert(!this.red, 'Already a number in reduction context');
  41801. assert(this.negative === 0, 'red works only with positives');
  41802. return ctx.convertTo(this)._forceRed(ctx);
  41803. };
  41804. BN.prototype.fromRed = function fromRed () {
  41805. assert(this.red, 'fromRed works only with numbers in reduction context');
  41806. return this.red.convertFrom(this);
  41807. };
  41808. BN.prototype._forceRed = function _forceRed (ctx) {
  41809. this.red = ctx;
  41810. return this;
  41811. };
  41812. BN.prototype.forceRed = function forceRed (ctx) {
  41813. assert(!this.red, 'Already a number in reduction context');
  41814. return this._forceRed(ctx);
  41815. };
  41816. BN.prototype.redAdd = function redAdd (num) {
  41817. assert(this.red, 'redAdd works only with red numbers');
  41818. return this.red.add(this, num);
  41819. };
  41820. BN.prototype.redIAdd = function redIAdd (num) {
  41821. assert(this.red, 'redIAdd works only with red numbers');
  41822. return this.red.iadd(this, num);
  41823. };
  41824. BN.prototype.redSub = function redSub (num) {
  41825. assert(this.red, 'redSub works only with red numbers');
  41826. return this.red.sub(this, num);
  41827. };
  41828. BN.prototype.redISub = function redISub (num) {
  41829. assert(this.red, 'redISub works only with red numbers');
  41830. return this.red.isub(this, num);
  41831. };
  41832. BN.prototype.redShl = function redShl (num) {
  41833. assert(this.red, 'redShl works only with red numbers');
  41834. return this.red.shl(this, num);
  41835. };
  41836. BN.prototype.redMul = function redMul (num) {
  41837. assert(this.red, 'redMul works only with red numbers');
  41838. this.red._verify2(this, num);
  41839. return this.red.mul(this, num);
  41840. };
  41841. BN.prototype.redIMul = function redIMul (num) {
  41842. assert(this.red, 'redMul works only with red numbers');
  41843. this.red._verify2(this, num);
  41844. return this.red.imul(this, num);
  41845. };
  41846. BN.prototype.redSqr = function redSqr () {
  41847. assert(this.red, 'redSqr works only with red numbers');
  41848. this.red._verify1(this);
  41849. return this.red.sqr(this);
  41850. };
  41851. BN.prototype.redISqr = function redISqr () {
  41852. assert(this.red, 'redISqr works only with red numbers');
  41853. this.red._verify1(this);
  41854. return this.red.isqr(this);
  41855. };
  41856. // Square root over p
  41857. BN.prototype.redSqrt = function redSqrt () {
  41858. assert(this.red, 'redSqrt works only with red numbers');
  41859. this.red._verify1(this);
  41860. return this.red.sqrt(this);
  41861. };
  41862. BN.prototype.redInvm = function redInvm () {
  41863. assert(this.red, 'redInvm works only with red numbers');
  41864. this.red._verify1(this);
  41865. return this.red.invm(this);
  41866. };
  41867. // Return negative clone of `this` % `red modulo`
  41868. BN.prototype.redNeg = function redNeg () {
  41869. assert(this.red, 'redNeg works only with red numbers');
  41870. this.red._verify1(this);
  41871. return this.red.neg(this);
  41872. };
  41873. BN.prototype.redPow = function redPow (num) {
  41874. assert(this.red && !num.red, 'redPow(normalNum)');
  41875. this.red._verify1(this);
  41876. return this.red.pow(this, num);
  41877. };
  41878. // Prime numbers with efficient reduction
  41879. var primes = {
  41880. k256: null,
  41881. p224: null,
  41882. p192: null,
  41883. p25519: null
  41884. };
  41885. // Pseudo-Mersenne prime
  41886. function MPrime (name, p) {
  41887. // P = 2 ^ N - K
  41888. this.name = name;
  41889. this.p = new BN(p, 16);
  41890. this.n = this.p.bitLength();
  41891. this.k = new BN(1).iushln(this.n).isub(this.p);
  41892. this.tmp = this._tmp();
  41893. }
  41894. MPrime.prototype._tmp = function _tmp () {
  41895. var tmp = new BN(null);
  41896. tmp.words = new Array(Math.ceil(this.n / 13));
  41897. return tmp;
  41898. };
  41899. MPrime.prototype.ireduce = function ireduce (num) {
  41900. // Assumes that `num` is less than `P^2`
  41901. // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
  41902. var r = num;
  41903. var rlen;
  41904. do {
  41905. this.split(r, this.tmp);
  41906. r = this.imulK(r);
  41907. r = r.iadd(this.tmp);
  41908. rlen = r.bitLength();
  41909. } while (rlen > this.n);
  41910. var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
  41911. if (cmp === 0) {
  41912. r.words[0] = 0;
  41913. r.length = 1;
  41914. } else if (cmp > 0) {
  41915. r.isub(this.p);
  41916. } else {
  41917. if (r.strip !== undefined) {
  41918. // r is BN v4 instance
  41919. r.strip();
  41920. } else {
  41921. // r is BN v5 instance
  41922. r._strip();
  41923. }
  41924. }
  41925. return r;
  41926. };
  41927. MPrime.prototype.split = function split (input, out) {
  41928. input.iushrn(this.n, 0, out);
  41929. };
  41930. MPrime.prototype.imulK = function imulK (num) {
  41931. return num.imul(this.k);
  41932. };
  41933. function K256 () {
  41934. MPrime.call(
  41935. this,
  41936. 'k256',
  41937. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
  41938. }
  41939. inherits(K256, MPrime);
  41940. K256.prototype.split = function split (input, output) {
  41941. // 256 = 9 * 26 + 22
  41942. var mask = 0x3fffff;
  41943. var outLen = Math.min(input.length, 9);
  41944. for (var i = 0; i < outLen; i++) {
  41945. output.words[i] = input.words[i];
  41946. }
  41947. output.length = outLen;
  41948. if (input.length <= 9) {
  41949. input.words[0] = 0;
  41950. input.length = 1;
  41951. return;
  41952. }
  41953. // Shift by 9 limbs
  41954. var prev = input.words[9];
  41955. output.words[output.length++] = prev & mask;
  41956. for (i = 10; i < input.length; i++) {
  41957. var next = input.words[i] | 0;
  41958. input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
  41959. prev = next;
  41960. }
  41961. prev >>>= 22;
  41962. input.words[i - 10] = prev;
  41963. if (prev === 0 && input.length > 10) {
  41964. input.length -= 10;
  41965. } else {
  41966. input.length -= 9;
  41967. }
  41968. };
  41969. K256.prototype.imulK = function imulK (num) {
  41970. // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
  41971. num.words[num.length] = 0;
  41972. num.words[num.length + 1] = 0;
  41973. num.length += 2;
  41974. // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
  41975. var lo = 0;
  41976. for (var i = 0; i < num.length; i++) {
  41977. var w = num.words[i] | 0;
  41978. lo += w * 0x3d1;
  41979. num.words[i] = lo & 0x3ffffff;
  41980. lo = w * 0x40 + ((lo / 0x4000000) | 0);
  41981. }
  41982. // Fast length reduction
  41983. if (num.words[num.length - 1] === 0) {
  41984. num.length--;
  41985. if (num.words[num.length - 1] === 0) {
  41986. num.length--;
  41987. }
  41988. }
  41989. return num;
  41990. };
  41991. function P224 () {
  41992. MPrime.call(
  41993. this,
  41994. 'p224',
  41995. 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
  41996. }
  41997. inherits(P224, MPrime);
  41998. function P192 () {
  41999. MPrime.call(
  42000. this,
  42001. 'p192',
  42002. 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
  42003. }
  42004. inherits(P192, MPrime);
  42005. function P25519 () {
  42006. // 2 ^ 255 - 19
  42007. MPrime.call(
  42008. this,
  42009. '25519',
  42010. '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
  42011. }
  42012. inherits(P25519, MPrime);
  42013. P25519.prototype.imulK = function imulK (num) {
  42014. // K = 0x13
  42015. var carry = 0;
  42016. for (var i = 0; i < num.length; i++) {
  42017. var hi = (num.words[i] | 0) * 0x13 + carry;
  42018. var lo = hi & 0x3ffffff;
  42019. hi >>>= 26;
  42020. num.words[i] = lo;
  42021. carry = hi;
  42022. }
  42023. if (carry !== 0) {
  42024. num.words[num.length++] = carry;
  42025. }
  42026. return num;
  42027. };
  42028. // Exported mostly for testing purposes, use plain name instead
  42029. BN._prime = function prime (name) {
  42030. // Cached version of prime
  42031. if (primes[name]) return primes[name];
  42032. var prime;
  42033. if (name === 'k256') {
  42034. prime = new K256();
  42035. } else if (name === 'p224') {
  42036. prime = new P224();
  42037. } else if (name === 'p192') {
  42038. prime = new P192();
  42039. } else if (name === 'p25519') {
  42040. prime = new P25519();
  42041. } else {
  42042. throw new Error('Unknown prime ' + name);
  42043. }
  42044. primes[name] = prime;
  42045. return prime;
  42046. };
  42047. //
  42048. // Base reduction engine
  42049. //
  42050. function Red (m) {
  42051. if (typeof m === 'string') {
  42052. var prime = BN._prime(m);
  42053. this.m = prime.p;
  42054. this.prime = prime;
  42055. } else {
  42056. assert(m.gtn(1), 'modulus must be greater than 1');
  42057. this.m = m;
  42058. this.prime = null;
  42059. }
  42060. }
  42061. Red.prototype._verify1 = function _verify1 (a) {
  42062. assert(a.negative === 0, 'red works only with positives');
  42063. assert(a.red, 'red works only with red numbers');
  42064. };
  42065. Red.prototype._verify2 = function _verify2 (a, b) {
  42066. assert((a.negative | b.negative) === 0, 'red works only with positives');
  42067. assert(a.red && a.red === b.red,
  42068. 'red works only with red numbers');
  42069. };
  42070. Red.prototype.imod = function imod (a) {
  42071. if (this.prime) return this.prime.ireduce(a)._forceRed(this);
  42072. return a.umod(this.m)._forceRed(this);
  42073. };
  42074. Red.prototype.neg = function neg (a) {
  42075. if (a.isZero()) {
  42076. return a.clone();
  42077. }
  42078. return this.m.sub(a)._forceRed(this);
  42079. };
  42080. Red.prototype.add = function add (a, b) {
  42081. this._verify2(a, b);
  42082. var res = a.add(b);
  42083. if (res.cmp(this.m) >= 0) {
  42084. res.isub(this.m);
  42085. }
  42086. return res._forceRed(this);
  42087. };
  42088. Red.prototype.iadd = function iadd (a, b) {
  42089. this._verify2(a, b);
  42090. var res = a.iadd(b);
  42091. if (res.cmp(this.m) >= 0) {
  42092. res.isub(this.m);
  42093. }
  42094. return res;
  42095. };
  42096. Red.prototype.sub = function sub (a, b) {
  42097. this._verify2(a, b);
  42098. var res = a.sub(b);
  42099. if (res.cmpn(0) < 0) {
  42100. res.iadd(this.m);
  42101. }
  42102. return res._forceRed(this);
  42103. };
  42104. Red.prototype.isub = function isub (a, b) {
  42105. this._verify2(a, b);
  42106. var res = a.isub(b);
  42107. if (res.cmpn(0) < 0) {
  42108. res.iadd(this.m);
  42109. }
  42110. return res;
  42111. };
  42112. Red.prototype.shl = function shl (a, num) {
  42113. this._verify1(a);
  42114. return this.imod(a.ushln(num));
  42115. };
  42116. Red.prototype.imul = function imul (a, b) {
  42117. this._verify2(a, b);
  42118. return this.imod(a.imul(b));
  42119. };
  42120. Red.prototype.mul = function mul (a, b) {
  42121. this._verify2(a, b);
  42122. return this.imod(a.mul(b));
  42123. };
  42124. Red.prototype.isqr = function isqr (a) {
  42125. return this.imul(a, a.clone());
  42126. };
  42127. Red.prototype.sqr = function sqr (a) {
  42128. return this.mul(a, a);
  42129. };
  42130. Red.prototype.sqrt = function sqrt (a) {
  42131. if (a.isZero()) return a.clone();
  42132. var mod3 = this.m.andln(3);
  42133. assert(mod3 % 2 === 1);
  42134. // Fast case
  42135. if (mod3 === 3) {
  42136. var pow = this.m.add(new BN(1)).iushrn(2);
  42137. return this.pow(a, pow);
  42138. }
  42139. // Tonelli-Shanks algorithm (Totally unoptimized and slow)
  42140. //
  42141. // Find Q and S, that Q * 2 ^ S = (P - 1)
  42142. var q = this.m.subn(1);
  42143. var s = 0;
  42144. while (!q.isZero() && q.andln(1) === 0) {
  42145. s++;
  42146. q.iushrn(1);
  42147. }
  42148. assert(!q.isZero());
  42149. var one = new BN(1).toRed(this);
  42150. var nOne = one.redNeg();
  42151. // Find quadratic non-residue
  42152. // NOTE: Max is such because of generalized Riemann hypothesis.
  42153. var lpow = this.m.subn(1).iushrn(1);
  42154. var z = this.m.bitLength();
  42155. z = new BN(2 * z * z).toRed(this);
  42156. while (this.pow(z, lpow).cmp(nOne) !== 0) {
  42157. z.redIAdd(nOne);
  42158. }
  42159. var c = this.pow(z, q);
  42160. var r = this.pow(a, q.addn(1).iushrn(1));
  42161. var t = this.pow(a, q);
  42162. var m = s;
  42163. while (t.cmp(one) !== 0) {
  42164. var tmp = t;
  42165. for (var i = 0; tmp.cmp(one) !== 0; i++) {
  42166. tmp = tmp.redSqr();
  42167. }
  42168. assert(i < m);
  42169. var b = this.pow(c, new BN(1).iushln(m - i - 1));
  42170. r = r.redMul(b);
  42171. c = b.redSqr();
  42172. t = t.redMul(c);
  42173. m = i;
  42174. }
  42175. return r;
  42176. };
  42177. Red.prototype.invm = function invm (a) {
  42178. var inv = a._invmp(this.m);
  42179. if (inv.negative !== 0) {
  42180. inv.negative = 0;
  42181. return this.imod(inv).redNeg();
  42182. } else {
  42183. return this.imod(inv);
  42184. }
  42185. };
  42186. Red.prototype.pow = function pow (a, num) {
  42187. if (num.isZero()) return new BN(1).toRed(this);
  42188. if (num.cmpn(1) === 0) return a.clone();
  42189. var windowSize = 4;
  42190. var wnd = new Array(1 << windowSize);
  42191. wnd[0] = new BN(1).toRed(this);
  42192. wnd[1] = a;
  42193. for (var i = 2; i < wnd.length; i++) {
  42194. wnd[i] = this.mul(wnd[i - 1], a);
  42195. }
  42196. var res = wnd[0];
  42197. var current = 0;
  42198. var currentLen = 0;
  42199. var start = num.bitLength() % 26;
  42200. if (start === 0) {
  42201. start = 26;
  42202. }
  42203. for (i = num.length - 1; i >= 0; i--) {
  42204. var word = num.words[i];
  42205. for (var j = start - 1; j >= 0; j--) {
  42206. var bit = (word >> j) & 1;
  42207. if (res !== wnd[0]) {
  42208. res = this.sqr(res);
  42209. }
  42210. if (bit === 0 && current === 0) {
  42211. currentLen = 0;
  42212. continue;
  42213. }
  42214. current <<= 1;
  42215. current |= bit;
  42216. currentLen++;
  42217. if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
  42218. res = this.mul(res, wnd[current]);
  42219. currentLen = 0;
  42220. current = 0;
  42221. }
  42222. start = 26;
  42223. }
  42224. return res;
  42225. };
  42226. Red.prototype.convertTo = function convertTo (num) {
  42227. var r = num.umod(this.m);
  42228. return r === num ? r.clone() : r;
  42229. };
  42230. Red.prototype.convertFrom = function convertFrom (num) {
  42231. var res = num.clone();
  42232. res.red = null;
  42233. return res;
  42234. };
  42235. //
  42236. // Montgomery method engine
  42237. //
  42238. BN.mont = function mont (num) {
  42239. return new Mont(num);
  42240. };
  42241. function Mont (m) {
  42242. Red.call(this, m);
  42243. this.shift = this.m.bitLength();
  42244. if (this.shift % 26 !== 0) {
  42245. this.shift += 26 - (this.shift % 26);
  42246. }
  42247. this.r = new BN(1).iushln(this.shift);
  42248. this.r2 = this.imod(this.r.sqr());
  42249. this.rinv = this.r._invmp(this.m);
  42250. this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
  42251. this.minv = this.minv.umod(this.r);
  42252. this.minv = this.r.sub(this.minv);
  42253. }
  42254. inherits(Mont, Red);
  42255. Mont.prototype.convertTo = function convertTo (num) {
  42256. return this.imod(num.ushln(this.shift));
  42257. };
  42258. Mont.prototype.convertFrom = function convertFrom (num) {
  42259. var r = this.imod(num.mul(this.rinv));
  42260. r.red = null;
  42261. return r;
  42262. };
  42263. Mont.prototype.imul = function imul (a, b) {
  42264. if (a.isZero() || b.isZero()) {
  42265. a.words[0] = 0;
  42266. a.length = 1;
  42267. return a;
  42268. }
  42269. var t = a.imul(b);
  42270. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  42271. var u = t.isub(c).iushrn(this.shift);
  42272. var res = u;
  42273. if (u.cmp(this.m) >= 0) {
  42274. res = u.isub(this.m);
  42275. } else if (u.cmpn(0) < 0) {
  42276. res = u.iadd(this.m);
  42277. }
  42278. return res._forceRed(this);
  42279. };
  42280. Mont.prototype.mul = function mul (a, b) {
  42281. if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
  42282. var t = a.mul(b);
  42283. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  42284. var u = t.isub(c).iushrn(this.shift);
  42285. var res = u;
  42286. if (u.cmp(this.m) >= 0) {
  42287. res = u.isub(this.m);
  42288. } else if (u.cmpn(0) < 0) {
  42289. res = u.iadd(this.m);
  42290. }
  42291. return res._forceRed(this);
  42292. };
  42293. Mont.prototype.invm = function invm (a) {
  42294. // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
  42295. var res = this.imod(a._invmp(this.m).mul(this.r2));
  42296. return res._forceRed(this);
  42297. };
  42298. })( false || module, this);
  42299. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ 198)(module)))
  42300. /***/ }),
  42301. /* 198 */
  42302. /*!***********************************!*\
  42303. !*** (webpack)/buildin/module.js ***!
  42304. \***********************************/
  42305. /*! no static exports found */
  42306. /***/ (function(module, exports) {
  42307. module.exports = function(module) {
  42308. if (!module.webpackPolyfill) {
  42309. module.deprecate = function() {};
  42310. module.paths = [];
  42311. // module.parent = undefined by default
  42312. if (!module.children) module.children = [];
  42313. Object.defineProperty(module, "loaded", {
  42314. enumerable: true,
  42315. get: function() {
  42316. return module.l;
  42317. }
  42318. });
  42319. Object.defineProperty(module, "id", {
  42320. enumerable: true,
  42321. get: function() {
  42322. return module.i;
  42323. }
  42324. });
  42325. module.webpackPolyfill = 1;
  42326. }
  42327. return module;
  42328. };
  42329. /***/ }),
  42330. /* 199 */
  42331. /*!************************!*\
  42332. !*** buffer (ignored) ***!
  42333. \************************/
  42334. /*! no static exports found */
  42335. /***/ (function(module, exports) {
  42336. /* (ignored) */
  42337. /***/ }),
  42338. /* 200 */
  42339. /*!*********************************************!*\
  42340. !*** ./node_modules/miller-rabin/lib/mr.js ***!
  42341. \*********************************************/
  42342. /*! no static exports found */
  42343. /***/ (function(module, exports, __webpack_require__) {
  42344. var bn = __webpack_require__(/*! bn.js */ 197);
  42345. var brorand = __webpack_require__(/*! brorand */ 201);
  42346. function MillerRabin(rand) {
  42347. this.rand = rand || new brorand.Rand();
  42348. }
  42349. module.exports = MillerRabin;
  42350. MillerRabin.create = function create(rand) {
  42351. return new MillerRabin(rand);
  42352. };
  42353. MillerRabin.prototype._randbelow = function _randbelow(n) {
  42354. var len = n.bitLength();
  42355. var min_bytes = Math.ceil(len / 8);
  42356. // Generage random bytes until a number less than n is found.
  42357. // This ensures that 0..n-1 have an equal probability of being selected.
  42358. do
  42359. var a = new bn(this.rand.generate(min_bytes));
  42360. while (a.cmp(n) >= 0);
  42361. return a;
  42362. };
  42363. MillerRabin.prototype._randrange = function _randrange(start, stop) {
  42364. // Generate a random number greater than or equal to start and less than stop.
  42365. var size = stop.sub(start);
  42366. return start.add(this._randbelow(size));
  42367. };
  42368. MillerRabin.prototype.test = function test(n, k, cb) {
  42369. var len = n.bitLength();
  42370. var red = bn.mont(n);
  42371. var rone = new bn(1).toRed(red);
  42372. if (!k)
  42373. k = Math.max(1, (len / 48) | 0);
  42374. // Find d and s, (n - 1) = (2 ^ s) * d;
  42375. var n1 = n.subn(1);
  42376. for (var s = 0; !n1.testn(s); s++) {}
  42377. var d = n.shrn(s);
  42378. var rn1 = n1.toRed(red);
  42379. var prime = true;
  42380. for (; k > 0; k--) {
  42381. var a = this._randrange(new bn(2), n1);
  42382. if (cb)
  42383. cb(a);
  42384. var x = a.toRed(red).redPow(d);
  42385. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  42386. continue;
  42387. for (var i = 1; i < s; i++) {
  42388. x = x.redSqr();
  42389. if (x.cmp(rone) === 0)
  42390. return false;
  42391. if (x.cmp(rn1) === 0)
  42392. break;
  42393. }
  42394. if (i === s)
  42395. return false;
  42396. }
  42397. return prime;
  42398. };
  42399. MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
  42400. var len = n.bitLength();
  42401. var red = bn.mont(n);
  42402. var rone = new bn(1).toRed(red);
  42403. if (!k)
  42404. k = Math.max(1, (len / 48) | 0);
  42405. // Find d and s, (n - 1) = (2 ^ s) * d;
  42406. var n1 = n.subn(1);
  42407. for (var s = 0; !n1.testn(s); s++) {}
  42408. var d = n.shrn(s);
  42409. var rn1 = n1.toRed(red);
  42410. for (; k > 0; k--) {
  42411. var a = this._randrange(new bn(2), n1);
  42412. var g = n.gcd(a);
  42413. if (g.cmpn(1) !== 0)
  42414. return g;
  42415. var x = a.toRed(red).redPow(d);
  42416. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  42417. continue;
  42418. for (var i = 1; i < s; i++) {
  42419. x = x.redSqr();
  42420. if (x.cmp(rone) === 0)
  42421. return x.fromRed().subn(1).gcd(n);
  42422. if (x.cmp(rn1) === 0)
  42423. break;
  42424. }
  42425. if (i === s) {
  42426. x = x.redSqr();
  42427. return x.fromRed().subn(1).gcd(n);
  42428. }
  42429. }
  42430. return false;
  42431. };
  42432. /***/ }),
  42433. /* 201 */
  42434. /*!***************************************!*\
  42435. !*** ./node_modules/brorand/index.js ***!
  42436. \***************************************/
  42437. /*! no static exports found */
  42438. /***/ (function(module, exports, __webpack_require__) {
  42439. var r;
  42440. module.exports = function rand(len) {
  42441. if (!r)
  42442. r = new Rand(null);
  42443. return r.generate(len);
  42444. };
  42445. function Rand(rand) {
  42446. this.rand = rand;
  42447. }
  42448. module.exports.Rand = Rand;
  42449. Rand.prototype.generate = function generate(len) {
  42450. return this._rand(len);
  42451. };
  42452. // Emulate crypto API using randy
  42453. Rand.prototype._rand = function _rand(n) {
  42454. if (this.rand.getBytes)
  42455. return this.rand.getBytes(n);
  42456. var res = new Uint8Array(n);
  42457. for (var i = 0; i < res.length; i++)
  42458. res[i] = this.rand.getByte();
  42459. return res;
  42460. };
  42461. if (typeof self === 'object') {
  42462. if (self.crypto && self.crypto.getRandomValues) {
  42463. // Modern browsers
  42464. Rand.prototype._rand = function _rand(n) {
  42465. var arr = new Uint8Array(n);
  42466. self.crypto.getRandomValues(arr);
  42467. return arr;
  42468. };
  42469. } else if (self.msCrypto && self.msCrypto.getRandomValues) {
  42470. // IE
  42471. Rand.prototype._rand = function _rand(n) {
  42472. var arr = new Uint8Array(n);
  42473. self.msCrypto.getRandomValues(arr);
  42474. return arr;
  42475. };
  42476. // Safari's WebWorkers do not have `crypto`
  42477. } else if (typeof window === 'object') {
  42478. // Old junk
  42479. Rand.prototype._rand = function() {
  42480. throw new Error('Not implemented yet');
  42481. };
  42482. }
  42483. } else {
  42484. // Node.js or Web worker with no crypto support
  42485. try {
  42486. var crypto = __webpack_require__(/*! crypto */ 202);
  42487. if (typeof crypto.randomBytes !== 'function')
  42488. throw new Error('Not supported');
  42489. Rand.prototype._rand = function _rand(n) {
  42490. return crypto.randomBytes(n);
  42491. };
  42492. } catch (e) {
  42493. }
  42494. }
  42495. /***/ }),
  42496. /* 202 */
  42497. /*!************************!*\
  42498. !*** crypto (ignored) ***!
  42499. \************************/
  42500. /*! no static exports found */
  42501. /***/ (function(module, exports) {
  42502. /* (ignored) */
  42503. /***/ }),
  42504. /* 203 */
  42505. /*!*****************************************************!*\
  42506. !*** ./node_modules/diffie-hellman/lib/primes.json ***!
  42507. \*****************************************************/
  42508. /*! exports provided: modp1, modp2, modp5, modp14, modp15, modp16, modp17, modp18, default */
  42509. /***/ (function(module) {
  42510. 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\"}}");
  42511. /***/ }),
  42512. /* 204 */
  42513. /*!***********************************************!*\
  42514. !*** ./node_modules/diffie-hellman/lib/dh.js ***!
  42515. \***********************************************/
  42516. /*! no static exports found */
  42517. /***/ (function(module, exports, __webpack_require__) {
  42518. /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(/*! bn.js */ 197);
  42519. var MillerRabin = __webpack_require__(/*! miller-rabin */ 200);
  42520. var millerRabin = new MillerRabin();
  42521. var TWENTYFOUR = new BN(24);
  42522. var ELEVEN = new BN(11);
  42523. var TEN = new BN(10);
  42524. var THREE = new BN(3);
  42525. var SEVEN = new BN(7);
  42526. var primes = __webpack_require__(/*! ./generatePrime */ 196);
  42527. var randomBytes = __webpack_require__(/*! randombytes */ 112);
  42528. module.exports = DH;
  42529. function setPublicKey(pub, enc) {
  42530. enc = enc || 'utf8';
  42531. if (!Buffer.isBuffer(pub)) {
  42532. pub = new Buffer(pub, enc);
  42533. }
  42534. this._pub = new BN(pub);
  42535. return this;
  42536. }
  42537. function setPrivateKey(priv, enc) {
  42538. enc = enc || 'utf8';
  42539. if (!Buffer.isBuffer(priv)) {
  42540. priv = new Buffer(priv, enc);
  42541. }
  42542. this._priv = new BN(priv);
  42543. return this;
  42544. }
  42545. var primeCache = {};
  42546. function checkPrime(prime, generator) {
  42547. var gen = generator.toString('hex');
  42548. var hex = [gen, prime.toString(16)].join('_');
  42549. if (hex in primeCache) {
  42550. return primeCache[hex];
  42551. }
  42552. var error = 0;
  42553. if (prime.isEven() ||
  42554. !primes.simpleSieve ||
  42555. !primes.fermatTest(prime) ||
  42556. !millerRabin.test(prime)) {
  42557. //not a prime so +1
  42558. error += 1;
  42559. if (gen === '02' || gen === '05') {
  42560. // we'd be able to check the generator
  42561. // it would fail so +8
  42562. error += 8;
  42563. } else {
  42564. //we wouldn't be able to test the generator
  42565. // so +4
  42566. error += 4;
  42567. }
  42568. primeCache[hex] = error;
  42569. return error;
  42570. }
  42571. if (!millerRabin.test(prime.shrn(1))) {
  42572. //not a safe prime
  42573. error += 2;
  42574. }
  42575. var rem;
  42576. switch (gen) {
  42577. case '02':
  42578. if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
  42579. // unsuidable generator
  42580. error += 8;
  42581. }
  42582. break;
  42583. case '05':
  42584. rem = prime.mod(TEN);
  42585. if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
  42586. // prime mod 10 needs to equal 3 or 7
  42587. error += 8;
  42588. }
  42589. break;
  42590. default:
  42591. error += 4;
  42592. }
  42593. primeCache[hex] = error;
  42594. return error;
  42595. }
  42596. function DH(prime, generator, malleable) {
  42597. this.setGenerator(generator);
  42598. this.__prime = new BN(prime);
  42599. this._prime = BN.mont(this.__prime);
  42600. this._primeLen = prime.length;
  42601. this._pub = undefined;
  42602. this._priv = undefined;
  42603. this._primeCode = undefined;
  42604. if (malleable) {
  42605. this.setPublicKey = setPublicKey;
  42606. this.setPrivateKey = setPrivateKey;
  42607. } else {
  42608. this._primeCode = 8;
  42609. }
  42610. }
  42611. Object.defineProperty(DH.prototype, 'verifyError', {
  42612. enumerable: true,
  42613. get: function () {
  42614. if (typeof this._primeCode !== 'number') {
  42615. this._primeCode = checkPrime(this.__prime, this.__gen);
  42616. }
  42617. return this._primeCode;
  42618. }
  42619. });
  42620. DH.prototype.generateKeys = function () {
  42621. if (!this._priv) {
  42622. this._priv = new BN(randomBytes(this._primeLen));
  42623. }
  42624. this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
  42625. return this.getPublicKey();
  42626. };
  42627. DH.prototype.computeSecret = function (other) {
  42628. other = new BN(other);
  42629. other = other.toRed(this._prime);
  42630. var secret = other.redPow(this._priv).fromRed();
  42631. var out = new Buffer(secret.toArray());
  42632. var prime = this.getPrime();
  42633. if (out.length < prime.length) {
  42634. var front = new Buffer(prime.length - out.length);
  42635. front.fill(0);
  42636. out = Buffer.concat([front, out]);
  42637. }
  42638. return out;
  42639. };
  42640. DH.prototype.getPublicKey = function getPublicKey(enc) {
  42641. return formatReturnValue(this._pub, enc);
  42642. };
  42643. DH.prototype.getPrivateKey = function getPrivateKey(enc) {
  42644. return formatReturnValue(this._priv, enc);
  42645. };
  42646. DH.prototype.getPrime = function (enc) {
  42647. return formatReturnValue(this.__prime, enc);
  42648. };
  42649. DH.prototype.getGenerator = function (enc) {
  42650. return formatReturnValue(this._gen, enc);
  42651. };
  42652. DH.prototype.setGenerator = function (gen, enc) {
  42653. enc = enc || 'utf8';
  42654. if (!Buffer.isBuffer(gen)) {
  42655. gen = new Buffer(gen, enc);
  42656. }
  42657. this.__gen = gen;
  42658. this._gen = new BN(gen);
  42659. return this;
  42660. };
  42661. function formatReturnValue(bn, enc) {
  42662. var buf = new Buffer(bn.toArray());
  42663. if (!enc) {
  42664. return buf;
  42665. } else {
  42666. return buf.toString(enc);
  42667. }
  42668. }
  42669. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ 116).Buffer))
  42670. /***/ }),
  42671. /* 205 */
  42672. /*!*******************************************************!*\
  42673. !*** ./node_modules/browserify-sign/browser/index.js ***!
  42674. \*******************************************************/
  42675. /*! no static exports found */
  42676. /***/ (function(module, exports, __webpack_require__) {
  42677. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  42678. var createHash = __webpack_require__(/*! create-hash */ 120)
  42679. var stream = __webpack_require__(/*! readable-stream */ 124)
  42680. var inherits = __webpack_require__(/*! inherits */ 121)
  42681. var sign = __webpack_require__(/*! ./sign */ 206)
  42682. var verify = __webpack_require__(/*! ./verify */ 259)
  42683. var algorithms = __webpack_require__(/*! ./algorithms.json */ 159)
  42684. Object.keys(algorithms).forEach(function (key) {
  42685. algorithms[key].id = Buffer.from(algorithms[key].id, 'hex')
  42686. algorithms[key.toLowerCase()] = algorithms[key]
  42687. })
  42688. function Sign (algorithm) {
  42689. stream.Writable.call(this)
  42690. var data = algorithms[algorithm]
  42691. if (!data) throw new Error('Unknown message digest')
  42692. this._hashType = data.hash
  42693. this._hash = createHash(data.hash)
  42694. this._tag = data.id
  42695. this._signType = data.sign
  42696. }
  42697. inherits(Sign, stream.Writable)
  42698. Sign.prototype._write = function _write (data, _, done) {
  42699. this._hash.update(data)
  42700. done()
  42701. }
  42702. Sign.prototype.update = function update (data, enc) {
  42703. if (typeof data === 'string') data = Buffer.from(data, enc)
  42704. this._hash.update(data)
  42705. return this
  42706. }
  42707. Sign.prototype.sign = function signMethod (key, enc) {
  42708. this.end()
  42709. var hash = this._hash.digest()
  42710. var sig = sign(hash, key, this._hashType, this._signType, this._tag)
  42711. return enc ? sig.toString(enc) : sig
  42712. }
  42713. function Verify (algorithm) {
  42714. stream.Writable.call(this)
  42715. var data = algorithms[algorithm]
  42716. if (!data) throw new Error('Unknown message digest')
  42717. this._hash = createHash(data.hash)
  42718. this._tag = data.id
  42719. this._signType = data.sign
  42720. }
  42721. inherits(Verify, stream.Writable)
  42722. Verify.prototype._write = function _write (data, _, done) {
  42723. this._hash.update(data)
  42724. done()
  42725. }
  42726. Verify.prototype.update = function update (data, enc) {
  42727. if (typeof data === 'string') data = Buffer.from(data, enc)
  42728. this._hash.update(data)
  42729. return this
  42730. }
  42731. Verify.prototype.verify = function verifyMethod (key, sig, enc) {
  42732. if (typeof sig === 'string') sig = Buffer.from(sig, enc)
  42733. this.end()
  42734. var hash = this._hash.digest()
  42735. return verify(sig, hash, key, this._signType, this._tag)
  42736. }
  42737. function createSign (algorithm) {
  42738. return new Sign(algorithm)
  42739. }
  42740. function createVerify (algorithm) {
  42741. return new Verify(algorithm)
  42742. }
  42743. module.exports = {
  42744. Sign: createSign,
  42745. Verify: createVerify,
  42746. createSign: createSign,
  42747. createVerify: createVerify
  42748. }
  42749. /***/ }),
  42750. /* 206 */
  42751. /*!******************************************************!*\
  42752. !*** ./node_modules/browserify-sign/browser/sign.js ***!
  42753. \******************************************************/
  42754. /*! no static exports found */
  42755. /***/ (function(module, exports, __webpack_require__) {
  42756. // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  42757. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  42758. var createHmac = __webpack_require__(/*! create-hmac */ 155)
  42759. var crt = __webpack_require__(/*! browserify-rsa */ 207)
  42760. var EC = __webpack_require__(/*! elliptic */ 208).ec
  42761. var BN = __webpack_require__(/*! bn.js */ 197)
  42762. var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
  42763. var curves = __webpack_require__(/*! ./curves.json */ 258)
  42764. function sign (hash, key, hashType, signType, tag) {
  42765. var priv = parseKeys(key)
  42766. if (priv.curve) {
  42767. // rsa keys can be interpreted as ecdsa ones in openssl
  42768. if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
  42769. return ecSign(hash, priv)
  42770. } else if (priv.type === 'dsa') {
  42771. if (signType !== 'dsa') throw new Error('wrong private key type')
  42772. return dsaSign(hash, priv, hashType)
  42773. } else {
  42774. if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong private key type')
  42775. }
  42776. hash = Buffer.concat([tag, hash])
  42777. var len = priv.modulus.byteLength()
  42778. var pad = [0, 1]
  42779. while (hash.length + pad.length + 1 < len) pad.push(0xff)
  42780. pad.push(0x00)
  42781. var i = -1
  42782. while (++i < hash.length) pad.push(hash[i])
  42783. var out = crt(pad, priv)
  42784. return out
  42785. }
  42786. function ecSign (hash, priv) {
  42787. var curveId = curves[priv.curve.join('.')]
  42788. if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
  42789. var curve = new EC(curveId)
  42790. var key = curve.keyFromPrivate(priv.privateKey)
  42791. var out = key.sign(hash)
  42792. return Buffer.from(out.toDER())
  42793. }
  42794. function dsaSign (hash, priv, algo) {
  42795. var x = priv.params.priv_key
  42796. var p = priv.params.p
  42797. var q = priv.params.q
  42798. var g = priv.params.g
  42799. var r = new BN(0)
  42800. var k
  42801. var H = bits2int(hash, q).mod(q)
  42802. var s = false
  42803. var kv = getKey(x, q, hash, algo)
  42804. while (s === false) {
  42805. k = makeKey(q, kv, algo)
  42806. r = makeR(g, k, p, q)
  42807. s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
  42808. if (s.cmpn(0) === 0) {
  42809. s = false
  42810. r = new BN(0)
  42811. }
  42812. }
  42813. return toDER(r, s)
  42814. }
  42815. function toDER (r, s) {
  42816. r = r.toArray()
  42817. s = s.toArray()
  42818. // Pad values
  42819. if (r[0] & 0x80) r = [0].concat(r)
  42820. if (s[0] & 0x80) s = [0].concat(s)
  42821. var total = r.length + s.length + 4
  42822. var res = [0x30, total, 0x02, r.length]
  42823. res = res.concat(r, [0x02, s.length], s)
  42824. return Buffer.from(res)
  42825. }
  42826. function getKey (x, q, hash, algo) {
  42827. x = Buffer.from(x.toArray())
  42828. if (x.length < q.byteLength()) {
  42829. var zeros = Buffer.alloc(q.byteLength() - x.length)
  42830. x = Buffer.concat([zeros, x])
  42831. }
  42832. var hlen = hash.length
  42833. var hbits = bits2octets(hash, q)
  42834. var v = Buffer.alloc(hlen)
  42835. v.fill(1)
  42836. var k = Buffer.alloc(hlen)
  42837. k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest()
  42838. v = createHmac(algo, k).update(v).digest()
  42839. k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest()
  42840. v = createHmac(algo, k).update(v).digest()
  42841. return { k: k, v: v }
  42842. }
  42843. function bits2int (obits, q) {
  42844. var bits = new BN(obits)
  42845. var shift = (obits.length << 3) - q.bitLength()
  42846. if (shift > 0) bits.ishrn(shift)
  42847. return bits
  42848. }
  42849. function bits2octets (bits, q) {
  42850. bits = bits2int(bits, q)
  42851. bits = bits.mod(q)
  42852. var out = Buffer.from(bits.toArray())
  42853. if (out.length < q.byteLength()) {
  42854. var zeros = Buffer.alloc(q.byteLength() - out.length)
  42855. out = Buffer.concat([zeros, out])
  42856. }
  42857. return out
  42858. }
  42859. function makeKey (q, kv, algo) {
  42860. var t
  42861. var k
  42862. do {
  42863. t = Buffer.alloc(0)
  42864. while (t.length * 8 < q.bitLength()) {
  42865. kv.v = createHmac(algo, kv.k).update(kv.v).digest()
  42866. t = Buffer.concat([t, kv.v])
  42867. }
  42868. k = bits2int(t, q)
  42869. kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest()
  42870. kv.v = createHmac(algo, kv.k).update(kv.v).digest()
  42871. } while (k.cmp(q) !== -1)
  42872. return k
  42873. }
  42874. function makeR (g, k, p, q) {
  42875. return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
  42876. }
  42877. module.exports = sign
  42878. module.exports.getKey = getKey
  42879. module.exports.makeKey = makeKey
  42880. /***/ }),
  42881. /* 207 */
  42882. /*!**********************************************!*\
  42883. !*** ./node_modules/browserify-rsa/index.js ***!
  42884. \**********************************************/
  42885. /*! no static exports found */
  42886. /***/ (function(module, exports, __webpack_require__) {
  42887. /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(/*! bn.js */ 197)
  42888. var randomBytes = __webpack_require__(/*! randombytes */ 112)
  42889. function blind (priv) {
  42890. var r = getr(priv)
  42891. var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed()
  42892. return { blinder: blinder, unblinder: r.invm(priv.modulus) }
  42893. }
  42894. function getr (priv) {
  42895. var len = priv.modulus.byteLength()
  42896. var r
  42897. do {
  42898. r = new BN(randomBytes(len))
  42899. } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2))
  42900. return r
  42901. }
  42902. function crt (msg, priv) {
  42903. var blinds = blind(priv)
  42904. var len = priv.modulus.byteLength()
  42905. var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus)
  42906. var c1 = blinded.toRed(BN.mont(priv.prime1))
  42907. var c2 = blinded.toRed(BN.mont(priv.prime2))
  42908. var qinv = priv.coefficient
  42909. var p = priv.prime1
  42910. var q = priv.prime2
  42911. var m1 = c1.redPow(priv.exponent1).fromRed()
  42912. var m2 = c2.redPow(priv.exponent2).fromRed()
  42913. var h = m1.isub(m2).imul(qinv).umod(p).imul(q)
  42914. return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len)
  42915. }
  42916. crt.getr = getr
  42917. module.exports = crt
  42918. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
  42919. /***/ }),
  42920. /* 208 */
  42921. /*!***********************************************!*\
  42922. !*** ./node_modules/elliptic/lib/elliptic.js ***!
  42923. \***********************************************/
  42924. /*! no static exports found */
  42925. /***/ (function(module, exports, __webpack_require__) {
  42926. "use strict";
  42927. var elliptic = exports;
  42928. elliptic.version = __webpack_require__(/*! ../package.json */ 209).version;
  42929. elliptic.utils = __webpack_require__(/*! ./elliptic/utils */ 210);
  42930. elliptic.rand = __webpack_require__(/*! brorand */ 201);
  42931. elliptic.curve = __webpack_require__(/*! ./elliptic/curve */ 212);
  42932. elliptic.curves = __webpack_require__(/*! ./elliptic/curves */ 217);
  42933. // Protocols
  42934. elliptic.ec = __webpack_require__(/*! ./elliptic/ec */ 231);
  42935. elliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ 235);
  42936. /***/ }),
  42937. /* 209 */
  42938. /*!********************************************!*\
  42939. !*** ./node_modules/elliptic/package.json ***!
  42940. \********************************************/
  42941. /*! exports provided: name, version, description, main, files, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, dependencies, default */
  42942. /***/ (function(module) {
  42943. module.exports = JSON.parse("{\"name\":\"elliptic\",\"version\":\"6.5.4\",\"description\":\"EC cryptography\",\"main\":\"lib/elliptic.js\",\"files\":[\"lib\"],\"scripts\":{\"lint\":\"eslint lib test\",\"lint:fix\":\"npm run lint -- --fix\",\"unit\":\"istanbul test _mocha --reporter=spec test/index.js\",\"test\":\"npm run lint && npm run unit\",\"version\":\"grunt dist && git add dist/\"},\"repository\":{\"type\":\"git\",\"url\":\"git@github.com:indutny/elliptic\"},\"keywords\":[\"EC\",\"Elliptic\",\"curve\",\"Cryptography\"],\"author\":\"Fedor Indutny <fedor@indutny.com>\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/indutny/elliptic/issues\"},\"homepage\":\"https://github.com/indutny/elliptic\",\"devDependencies\":{\"brfs\":\"^2.0.2\",\"coveralls\":\"^3.1.0\",\"eslint\":\"^7.6.0\",\"grunt\":\"^1.2.1\",\"grunt-browserify\":\"^5.3.0\",\"grunt-cli\":\"^1.3.2\",\"grunt-contrib-connect\":\"^3.0.0\",\"grunt-contrib-copy\":\"^1.0.0\",\"grunt-contrib-uglify\":\"^5.0.0\",\"grunt-mocha-istanbul\":\"^5.0.2\",\"grunt-saucelabs\":\"^9.0.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^8.0.1\"},\"dependencies\":{\"bn.js\":\"^4.11.9\",\"brorand\":\"^1.1.0\",\"hash.js\":\"^1.0.0\",\"hmac-drbg\":\"^1.0.1\",\"inherits\":\"^2.0.4\",\"minimalistic-assert\":\"^1.0.1\",\"minimalistic-crypto-utils\":\"^1.0.1\"}}");
  42944. /***/ }),
  42945. /* 210 */
  42946. /*!*****************************************************!*\
  42947. !*** ./node_modules/elliptic/lib/elliptic/utils.js ***!
  42948. \*****************************************************/
  42949. /*! no static exports found */
  42950. /***/ (function(module, exports, __webpack_require__) {
  42951. "use strict";
  42952. var utils = exports;
  42953. var BN = __webpack_require__(/*! bn.js */ 197);
  42954. var minAssert = __webpack_require__(/*! minimalistic-assert */ 171);
  42955. var minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ 211);
  42956. utils.assert = minAssert;
  42957. utils.toArray = minUtils.toArray;
  42958. utils.zero2 = minUtils.zero2;
  42959. utils.toHex = minUtils.toHex;
  42960. utils.encode = minUtils.encode;
  42961. // Represent num in a w-NAF form
  42962. function getNAF(num, w, bits) {
  42963. var naf = new Array(Math.max(num.bitLength(), bits) + 1);
  42964. naf.fill(0);
  42965. var ws = 1 << (w + 1);
  42966. var k = num.clone();
  42967. for (var i = 0; i < naf.length; i++) {
  42968. var z;
  42969. var mod = k.andln(ws - 1);
  42970. if (k.isOdd()) {
  42971. if (mod > (ws >> 1) - 1)
  42972. z = (ws >> 1) - mod;
  42973. else
  42974. z = mod;
  42975. k.isubn(z);
  42976. } else {
  42977. z = 0;
  42978. }
  42979. naf[i] = z;
  42980. k.iushrn(1);
  42981. }
  42982. return naf;
  42983. }
  42984. utils.getNAF = getNAF;
  42985. // Represent k1, k2 in a Joint Sparse Form
  42986. function getJSF(k1, k2) {
  42987. var jsf = [
  42988. [],
  42989. [],
  42990. ];
  42991. k1 = k1.clone();
  42992. k2 = k2.clone();
  42993. var d1 = 0;
  42994. var d2 = 0;
  42995. var m8;
  42996. while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
  42997. // First phase
  42998. var m14 = (k1.andln(3) + d1) & 3;
  42999. var m24 = (k2.andln(3) + d2) & 3;
  43000. if (m14 === 3)
  43001. m14 = -1;
  43002. if (m24 === 3)
  43003. m24 = -1;
  43004. var u1;
  43005. if ((m14 & 1) === 0) {
  43006. u1 = 0;
  43007. } else {
  43008. m8 = (k1.andln(7) + d1) & 7;
  43009. if ((m8 === 3 || m8 === 5) && m24 === 2)
  43010. u1 = -m14;
  43011. else
  43012. u1 = m14;
  43013. }
  43014. jsf[0].push(u1);
  43015. var u2;
  43016. if ((m24 & 1) === 0) {
  43017. u2 = 0;
  43018. } else {
  43019. m8 = (k2.andln(7) + d2) & 7;
  43020. if ((m8 === 3 || m8 === 5) && m14 === 2)
  43021. u2 = -m24;
  43022. else
  43023. u2 = m24;
  43024. }
  43025. jsf[1].push(u2);
  43026. // Second phase
  43027. if (2 * d1 === u1 + 1)
  43028. d1 = 1 - d1;
  43029. if (2 * d2 === u2 + 1)
  43030. d2 = 1 - d2;
  43031. k1.iushrn(1);
  43032. k2.iushrn(1);
  43033. }
  43034. return jsf;
  43035. }
  43036. utils.getJSF = getJSF;
  43037. function cachedProperty(obj, name, computer) {
  43038. var key = '_' + name;
  43039. obj.prototype[name] = function cachedProperty() {
  43040. return this[key] !== undefined ? this[key] :
  43041. this[key] = computer.call(this);
  43042. };
  43043. }
  43044. utils.cachedProperty = cachedProperty;
  43045. function parseBytes(bytes) {
  43046. return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
  43047. bytes;
  43048. }
  43049. utils.parseBytes = parseBytes;
  43050. function intFromLE(bytes) {
  43051. return new BN(bytes, 'hex', 'le');
  43052. }
  43053. utils.intFromLE = intFromLE;
  43054. /***/ }),
  43055. /* 211 */
  43056. /*!*************************************************************!*\
  43057. !*** ./node_modules/minimalistic-crypto-utils/lib/utils.js ***!
  43058. \*************************************************************/
  43059. /*! no static exports found */
  43060. /***/ (function(module, exports, __webpack_require__) {
  43061. "use strict";
  43062. var utils = exports;
  43063. function toArray(msg, enc) {
  43064. if (Array.isArray(msg))
  43065. return msg.slice();
  43066. if (!msg)
  43067. return [];
  43068. var res = [];
  43069. if (typeof msg !== 'string') {
  43070. for (var i = 0; i < msg.length; i++)
  43071. res[i] = msg[i] | 0;
  43072. return res;
  43073. }
  43074. if (enc === 'hex') {
  43075. msg = msg.replace(/[^a-z0-9]+/ig, '');
  43076. if (msg.length % 2 !== 0)
  43077. msg = '0' + msg;
  43078. for (var i = 0; i < msg.length; i += 2)
  43079. res.push(parseInt(msg[i] + msg[i + 1], 16));
  43080. } else {
  43081. for (var i = 0; i < msg.length; i++) {
  43082. var c = msg.charCodeAt(i);
  43083. var hi = c >> 8;
  43084. var lo = c & 0xff;
  43085. if (hi)
  43086. res.push(hi, lo);
  43087. else
  43088. res.push(lo);
  43089. }
  43090. }
  43091. return res;
  43092. }
  43093. utils.toArray = toArray;
  43094. function zero2(word) {
  43095. if (word.length === 1)
  43096. return '0' + word;
  43097. else
  43098. return word;
  43099. }
  43100. utils.zero2 = zero2;
  43101. function toHex(msg) {
  43102. var res = '';
  43103. for (var i = 0; i < msg.length; i++)
  43104. res += zero2(msg[i].toString(16));
  43105. return res;
  43106. }
  43107. utils.toHex = toHex;
  43108. utils.encode = function encode(arr, enc) {
  43109. if (enc === 'hex')
  43110. return toHex(arr);
  43111. else
  43112. return arr;
  43113. };
  43114. /***/ }),
  43115. /* 212 */
  43116. /*!***********************************************************!*\
  43117. !*** ./node_modules/elliptic/lib/elliptic/curve/index.js ***!
  43118. \***********************************************************/
  43119. /*! no static exports found */
  43120. /***/ (function(module, exports, __webpack_require__) {
  43121. "use strict";
  43122. var curve = exports;
  43123. curve.base = __webpack_require__(/*! ./base */ 213);
  43124. curve.short = __webpack_require__(/*! ./short */ 214);
  43125. curve.mont = __webpack_require__(/*! ./mont */ 215);
  43126. curve.edwards = __webpack_require__(/*! ./edwards */ 216);
  43127. /***/ }),
  43128. /* 213 */
  43129. /*!**********************************************************!*\
  43130. !*** ./node_modules/elliptic/lib/elliptic/curve/base.js ***!
  43131. \**********************************************************/
  43132. /*! no static exports found */
  43133. /***/ (function(module, exports, __webpack_require__) {
  43134. "use strict";
  43135. var BN = __webpack_require__(/*! bn.js */ 197);
  43136. var utils = __webpack_require__(/*! ../utils */ 210);
  43137. var getNAF = utils.getNAF;
  43138. var getJSF = utils.getJSF;
  43139. var assert = utils.assert;
  43140. function BaseCurve(type, conf) {
  43141. this.type = type;
  43142. this.p = new BN(conf.p, 16);
  43143. // Use Montgomery, when there is no fast reduction for the prime
  43144. this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
  43145. // Useful for many curves
  43146. this.zero = new BN(0).toRed(this.red);
  43147. this.one = new BN(1).toRed(this.red);
  43148. this.two = new BN(2).toRed(this.red);
  43149. // Curve configuration, optional
  43150. this.n = conf.n && new BN(conf.n, 16);
  43151. this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
  43152. // Temporary arrays
  43153. this._wnafT1 = new Array(4);
  43154. this._wnafT2 = new Array(4);
  43155. this._wnafT3 = new Array(4);
  43156. this._wnafT4 = new Array(4);
  43157. this._bitLength = this.n ? this.n.bitLength() : 0;
  43158. // Generalized Greg Maxwell's trick
  43159. var adjustCount = this.n && this.p.div(this.n);
  43160. if (!adjustCount || adjustCount.cmpn(100) > 0) {
  43161. this.redN = null;
  43162. } else {
  43163. this._maxwellTrick = true;
  43164. this.redN = this.n.toRed(this.red);
  43165. }
  43166. }
  43167. module.exports = BaseCurve;
  43168. BaseCurve.prototype.point = function point() {
  43169. throw new Error('Not implemented');
  43170. };
  43171. BaseCurve.prototype.validate = function validate() {
  43172. throw new Error('Not implemented');
  43173. };
  43174. BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
  43175. assert(p.precomputed);
  43176. var doubles = p._getDoubles();
  43177. var naf = getNAF(k, 1, this._bitLength);
  43178. var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
  43179. I /= 3;
  43180. // Translate into more windowed form
  43181. var repr = [];
  43182. var j;
  43183. var nafW;
  43184. for (j = 0; j < naf.length; j += doubles.step) {
  43185. nafW = 0;
  43186. for (var l = j + doubles.step - 1; l >= j; l--)
  43187. nafW = (nafW << 1) + naf[l];
  43188. repr.push(nafW);
  43189. }
  43190. var a = this.jpoint(null, null, null);
  43191. var b = this.jpoint(null, null, null);
  43192. for (var i = I; i > 0; i--) {
  43193. for (j = 0; j < repr.length; j++) {
  43194. nafW = repr[j];
  43195. if (nafW === i)
  43196. b = b.mixedAdd(doubles.points[j]);
  43197. else if (nafW === -i)
  43198. b = b.mixedAdd(doubles.points[j].neg());
  43199. }
  43200. a = a.add(b);
  43201. }
  43202. return a.toP();
  43203. };
  43204. BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
  43205. var w = 4;
  43206. // Precompute window
  43207. var nafPoints = p._getNAFPoints(w);
  43208. w = nafPoints.wnd;
  43209. var wnd = nafPoints.points;
  43210. // Get NAF form
  43211. var naf = getNAF(k, w, this._bitLength);
  43212. // Add `this`*(N+1) for every w-NAF index
  43213. var acc = this.jpoint(null, null, null);
  43214. for (var i = naf.length - 1; i >= 0; i--) {
  43215. // Count zeroes
  43216. for (var l = 0; i >= 0 && naf[i] === 0; i--)
  43217. l++;
  43218. if (i >= 0)
  43219. l++;
  43220. acc = acc.dblp(l);
  43221. if (i < 0)
  43222. break;
  43223. var z = naf[i];
  43224. assert(z !== 0);
  43225. if (p.type === 'affine') {
  43226. // J +- P
  43227. if (z > 0)
  43228. acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
  43229. else
  43230. acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
  43231. } else {
  43232. // J +- J
  43233. if (z > 0)
  43234. acc = acc.add(wnd[(z - 1) >> 1]);
  43235. else
  43236. acc = acc.add(wnd[(-z - 1) >> 1].neg());
  43237. }
  43238. }
  43239. return p.type === 'affine' ? acc.toP() : acc;
  43240. };
  43241. BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
  43242. points,
  43243. coeffs,
  43244. len,
  43245. jacobianResult) {
  43246. var wndWidth = this._wnafT1;
  43247. var wnd = this._wnafT2;
  43248. var naf = this._wnafT3;
  43249. // Fill all arrays
  43250. var max = 0;
  43251. var i;
  43252. var j;
  43253. var p;
  43254. for (i = 0; i < len; i++) {
  43255. p = points[i];
  43256. var nafPoints = p._getNAFPoints(defW);
  43257. wndWidth[i] = nafPoints.wnd;
  43258. wnd[i] = nafPoints.points;
  43259. }
  43260. // Comb small window NAFs
  43261. for (i = len - 1; i >= 1; i -= 2) {
  43262. var a = i - 1;
  43263. var b = i;
  43264. if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
  43265. naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);
  43266. naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);
  43267. max = Math.max(naf[a].length, max);
  43268. max = Math.max(naf[b].length, max);
  43269. continue;
  43270. }
  43271. var comb = [
  43272. points[a], /* 1 */
  43273. null, /* 3 */
  43274. null, /* 5 */
  43275. points[b], /* 7 */
  43276. ];
  43277. // Try to avoid Projective points, if possible
  43278. if (points[a].y.cmp(points[b].y) === 0) {
  43279. comb[1] = points[a].add(points[b]);
  43280. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  43281. } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
  43282. comb[1] = points[a].toJ().mixedAdd(points[b]);
  43283. comb[2] = points[a].add(points[b].neg());
  43284. } else {
  43285. comb[1] = points[a].toJ().mixedAdd(points[b]);
  43286. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  43287. }
  43288. var index = [
  43289. -3, /* -1 -1 */
  43290. -1, /* -1 0 */
  43291. -5, /* -1 1 */
  43292. -7, /* 0 -1 */
  43293. 0, /* 0 0 */
  43294. 7, /* 0 1 */
  43295. 5, /* 1 -1 */
  43296. 1, /* 1 0 */
  43297. 3, /* 1 1 */
  43298. ];
  43299. var jsf = getJSF(coeffs[a], coeffs[b]);
  43300. max = Math.max(jsf[0].length, max);
  43301. naf[a] = new Array(max);
  43302. naf[b] = new Array(max);
  43303. for (j = 0; j < max; j++) {
  43304. var ja = jsf[0][j] | 0;
  43305. var jb = jsf[1][j] | 0;
  43306. naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
  43307. naf[b][j] = 0;
  43308. wnd[a] = comb;
  43309. }
  43310. }
  43311. var acc = this.jpoint(null, null, null);
  43312. var tmp = this._wnafT4;
  43313. for (i = max; i >= 0; i--) {
  43314. var k = 0;
  43315. while (i >= 0) {
  43316. var zero = true;
  43317. for (j = 0; j < len; j++) {
  43318. tmp[j] = naf[j][i] | 0;
  43319. if (tmp[j] !== 0)
  43320. zero = false;
  43321. }
  43322. if (!zero)
  43323. break;
  43324. k++;
  43325. i--;
  43326. }
  43327. if (i >= 0)
  43328. k++;
  43329. acc = acc.dblp(k);
  43330. if (i < 0)
  43331. break;
  43332. for (j = 0; j < len; j++) {
  43333. var z = tmp[j];
  43334. p;
  43335. if (z === 0)
  43336. continue;
  43337. else if (z > 0)
  43338. p = wnd[j][(z - 1) >> 1];
  43339. else if (z < 0)
  43340. p = wnd[j][(-z - 1) >> 1].neg();
  43341. if (p.type === 'affine')
  43342. acc = acc.mixedAdd(p);
  43343. else
  43344. acc = acc.add(p);
  43345. }
  43346. }
  43347. // Zeroify references
  43348. for (i = 0; i < len; i++)
  43349. wnd[i] = null;
  43350. if (jacobianResult)
  43351. return acc;
  43352. else
  43353. return acc.toP();
  43354. };
  43355. function BasePoint(curve, type) {
  43356. this.curve = curve;
  43357. this.type = type;
  43358. this.precomputed = null;
  43359. }
  43360. BaseCurve.BasePoint = BasePoint;
  43361. BasePoint.prototype.eq = function eq(/*other*/) {
  43362. throw new Error('Not implemented');
  43363. };
  43364. BasePoint.prototype.validate = function validate() {
  43365. return this.curve.validate(this);
  43366. };
  43367. BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  43368. bytes = utils.toArray(bytes, enc);
  43369. var len = this.p.byteLength();
  43370. // uncompressed, hybrid-odd, hybrid-even
  43371. if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
  43372. bytes.length - 1 === 2 * len) {
  43373. if (bytes[0] === 0x06)
  43374. assert(bytes[bytes.length - 1] % 2 === 0);
  43375. else if (bytes[0] === 0x07)
  43376. assert(bytes[bytes.length - 1] % 2 === 1);
  43377. var res = this.point(bytes.slice(1, 1 + len),
  43378. bytes.slice(1 + len, 1 + 2 * len));
  43379. return res;
  43380. } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
  43381. bytes.length - 1 === len) {
  43382. return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
  43383. }
  43384. throw new Error('Unknown point format');
  43385. };
  43386. BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
  43387. return this.encode(enc, true);
  43388. };
  43389. BasePoint.prototype._encode = function _encode(compact) {
  43390. var len = this.curve.p.byteLength();
  43391. var x = this.getX().toArray('be', len);
  43392. if (compact)
  43393. return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
  43394. return [ 0x04 ].concat(x, this.getY().toArray('be', len));
  43395. };
  43396. BasePoint.prototype.encode = function encode(enc, compact) {
  43397. return utils.encode(this._encode(compact), enc);
  43398. };
  43399. BasePoint.prototype.precompute = function precompute(power) {
  43400. if (this.precomputed)
  43401. return this;
  43402. var precomputed = {
  43403. doubles: null,
  43404. naf: null,
  43405. beta: null,
  43406. };
  43407. precomputed.naf = this._getNAFPoints(8);
  43408. precomputed.doubles = this._getDoubles(4, power);
  43409. precomputed.beta = this._getBeta();
  43410. this.precomputed = precomputed;
  43411. return this;
  43412. };
  43413. BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
  43414. if (!this.precomputed)
  43415. return false;
  43416. var doubles = this.precomputed.doubles;
  43417. if (!doubles)
  43418. return false;
  43419. return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
  43420. };
  43421. BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
  43422. if (this.precomputed && this.precomputed.doubles)
  43423. return this.precomputed.doubles;
  43424. var doubles = [ this ];
  43425. var acc = this;
  43426. for (var i = 0; i < power; i += step) {
  43427. for (var j = 0; j < step; j++)
  43428. acc = acc.dbl();
  43429. doubles.push(acc);
  43430. }
  43431. return {
  43432. step: step,
  43433. points: doubles,
  43434. };
  43435. };
  43436. BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
  43437. if (this.precomputed && this.precomputed.naf)
  43438. return this.precomputed.naf;
  43439. var res = [ this ];
  43440. var max = (1 << wnd) - 1;
  43441. var dbl = max === 1 ? null : this.dbl();
  43442. for (var i = 1; i < max; i++)
  43443. res[i] = res[i - 1].add(dbl);
  43444. return {
  43445. wnd: wnd,
  43446. points: res,
  43447. };
  43448. };
  43449. BasePoint.prototype._getBeta = function _getBeta() {
  43450. return null;
  43451. };
  43452. BasePoint.prototype.dblp = function dblp(k) {
  43453. var r = this;
  43454. for (var i = 0; i < k; i++)
  43455. r = r.dbl();
  43456. return r;
  43457. };
  43458. /***/ }),
  43459. /* 214 */
  43460. /*!***********************************************************!*\
  43461. !*** ./node_modules/elliptic/lib/elliptic/curve/short.js ***!
  43462. \***********************************************************/
  43463. /*! no static exports found */
  43464. /***/ (function(module, exports, __webpack_require__) {
  43465. "use strict";
  43466. var utils = __webpack_require__(/*! ../utils */ 210);
  43467. var BN = __webpack_require__(/*! bn.js */ 197);
  43468. var inherits = __webpack_require__(/*! inherits */ 121);
  43469. var Base = __webpack_require__(/*! ./base */ 213);
  43470. var assert = utils.assert;
  43471. function ShortCurve(conf) {
  43472. Base.call(this, 'short', conf);
  43473. this.a = new BN(conf.a, 16).toRed(this.red);
  43474. this.b = new BN(conf.b, 16).toRed(this.red);
  43475. this.tinv = this.two.redInvm();
  43476. this.zeroA = this.a.fromRed().cmpn(0) === 0;
  43477. this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
  43478. // If the curve is endomorphic, precalculate beta and lambda
  43479. this.endo = this._getEndomorphism(conf);
  43480. this._endoWnafT1 = new Array(4);
  43481. this._endoWnafT2 = new Array(4);
  43482. }
  43483. inherits(ShortCurve, Base);
  43484. module.exports = ShortCurve;
  43485. ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
  43486. // No efficient endomorphism
  43487. if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
  43488. return;
  43489. // Compute beta and lambda, that lambda * P = (beta * Px; Py)
  43490. var beta;
  43491. var lambda;
  43492. if (conf.beta) {
  43493. beta = new BN(conf.beta, 16).toRed(this.red);
  43494. } else {
  43495. var betas = this._getEndoRoots(this.p);
  43496. // Choose the smallest beta
  43497. beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
  43498. beta = beta.toRed(this.red);
  43499. }
  43500. if (conf.lambda) {
  43501. lambda = new BN(conf.lambda, 16);
  43502. } else {
  43503. // Choose the lambda that is matching selected beta
  43504. var lambdas = this._getEndoRoots(this.n);
  43505. if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
  43506. lambda = lambdas[0];
  43507. } else {
  43508. lambda = lambdas[1];
  43509. assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
  43510. }
  43511. }
  43512. // Get basis vectors, used for balanced length-two representation
  43513. var basis;
  43514. if (conf.basis) {
  43515. basis = conf.basis.map(function(vec) {
  43516. return {
  43517. a: new BN(vec.a, 16),
  43518. b: new BN(vec.b, 16),
  43519. };
  43520. });
  43521. } else {
  43522. basis = this._getEndoBasis(lambda);
  43523. }
  43524. return {
  43525. beta: beta,
  43526. lambda: lambda,
  43527. basis: basis,
  43528. };
  43529. };
  43530. ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
  43531. // Find roots of for x^2 + x + 1 in F
  43532. // Root = (-1 +- Sqrt(-3)) / 2
  43533. //
  43534. var red = num === this.p ? this.red : BN.mont(num);
  43535. var tinv = new BN(2).toRed(red).redInvm();
  43536. var ntinv = tinv.redNeg();
  43537. var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
  43538. var l1 = ntinv.redAdd(s).fromRed();
  43539. var l2 = ntinv.redSub(s).fromRed();
  43540. return [ l1, l2 ];
  43541. };
  43542. ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
  43543. // aprxSqrt >= sqrt(this.n)
  43544. var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
  43545. // 3.74
  43546. // Run EGCD, until r(L + 1) < aprxSqrt
  43547. var u = lambda;
  43548. var v = this.n.clone();
  43549. var x1 = new BN(1);
  43550. var y1 = new BN(0);
  43551. var x2 = new BN(0);
  43552. var y2 = new BN(1);
  43553. // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
  43554. var a0;
  43555. var b0;
  43556. // First vector
  43557. var a1;
  43558. var b1;
  43559. // Second vector
  43560. var a2;
  43561. var b2;
  43562. var prevR;
  43563. var i = 0;
  43564. var r;
  43565. var x;
  43566. while (u.cmpn(0) !== 0) {
  43567. var q = v.div(u);
  43568. r = v.sub(q.mul(u));
  43569. x = x2.sub(q.mul(x1));
  43570. var y = y2.sub(q.mul(y1));
  43571. if (!a1 && r.cmp(aprxSqrt) < 0) {
  43572. a0 = prevR.neg();
  43573. b0 = x1;
  43574. a1 = r.neg();
  43575. b1 = x;
  43576. } else if (a1 && ++i === 2) {
  43577. break;
  43578. }
  43579. prevR = r;
  43580. v = u;
  43581. u = r;
  43582. x2 = x1;
  43583. x1 = x;
  43584. y2 = y1;
  43585. y1 = y;
  43586. }
  43587. a2 = r.neg();
  43588. b2 = x;
  43589. var len1 = a1.sqr().add(b1.sqr());
  43590. var len2 = a2.sqr().add(b2.sqr());
  43591. if (len2.cmp(len1) >= 0) {
  43592. a2 = a0;
  43593. b2 = b0;
  43594. }
  43595. // Normalize signs
  43596. if (a1.negative) {
  43597. a1 = a1.neg();
  43598. b1 = b1.neg();
  43599. }
  43600. if (a2.negative) {
  43601. a2 = a2.neg();
  43602. b2 = b2.neg();
  43603. }
  43604. return [
  43605. { a: a1, b: b1 },
  43606. { a: a2, b: b2 },
  43607. ];
  43608. };
  43609. ShortCurve.prototype._endoSplit = function _endoSplit(k) {
  43610. var basis = this.endo.basis;
  43611. var v1 = basis[0];
  43612. var v2 = basis[1];
  43613. var c1 = v2.b.mul(k).divRound(this.n);
  43614. var c2 = v1.b.neg().mul(k).divRound(this.n);
  43615. var p1 = c1.mul(v1.a);
  43616. var p2 = c2.mul(v2.a);
  43617. var q1 = c1.mul(v1.b);
  43618. var q2 = c2.mul(v2.b);
  43619. // Calculate answer
  43620. var k1 = k.sub(p1).sub(p2);
  43621. var k2 = q1.add(q2).neg();
  43622. return { k1: k1, k2: k2 };
  43623. };
  43624. ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
  43625. x = new BN(x, 16);
  43626. if (!x.red)
  43627. x = x.toRed(this.red);
  43628. var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
  43629. var y = y2.redSqrt();
  43630. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  43631. throw new Error('invalid point');
  43632. // XXX Is there any way to tell if the number is odd without converting it
  43633. // to non-red form?
  43634. var isOdd = y.fromRed().isOdd();
  43635. if (odd && !isOdd || !odd && isOdd)
  43636. y = y.redNeg();
  43637. return this.point(x, y);
  43638. };
  43639. ShortCurve.prototype.validate = function validate(point) {
  43640. if (point.inf)
  43641. return true;
  43642. var x = point.x;
  43643. var y = point.y;
  43644. var ax = this.a.redMul(x);
  43645. var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
  43646. return y.redSqr().redISub(rhs).cmpn(0) === 0;
  43647. };
  43648. ShortCurve.prototype._endoWnafMulAdd =
  43649. function _endoWnafMulAdd(points, coeffs, jacobianResult) {
  43650. var npoints = this._endoWnafT1;
  43651. var ncoeffs = this._endoWnafT2;
  43652. for (var i = 0; i < points.length; i++) {
  43653. var split = this._endoSplit(coeffs[i]);
  43654. var p = points[i];
  43655. var beta = p._getBeta();
  43656. if (split.k1.negative) {
  43657. split.k1.ineg();
  43658. p = p.neg(true);
  43659. }
  43660. if (split.k2.negative) {
  43661. split.k2.ineg();
  43662. beta = beta.neg(true);
  43663. }
  43664. npoints[i * 2] = p;
  43665. npoints[i * 2 + 1] = beta;
  43666. ncoeffs[i * 2] = split.k1;
  43667. ncoeffs[i * 2 + 1] = split.k2;
  43668. }
  43669. var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
  43670. // Clean-up references to points and coefficients
  43671. for (var j = 0; j < i * 2; j++) {
  43672. npoints[j] = null;
  43673. ncoeffs[j] = null;
  43674. }
  43675. return res;
  43676. };
  43677. function Point(curve, x, y, isRed) {
  43678. Base.BasePoint.call(this, curve, 'affine');
  43679. if (x === null && y === null) {
  43680. this.x = null;
  43681. this.y = null;
  43682. this.inf = true;
  43683. } else {
  43684. this.x = new BN(x, 16);
  43685. this.y = new BN(y, 16);
  43686. // Force redgomery representation when loading from JSON
  43687. if (isRed) {
  43688. this.x.forceRed(this.curve.red);
  43689. this.y.forceRed(this.curve.red);
  43690. }
  43691. if (!this.x.red)
  43692. this.x = this.x.toRed(this.curve.red);
  43693. if (!this.y.red)
  43694. this.y = this.y.toRed(this.curve.red);
  43695. this.inf = false;
  43696. }
  43697. }
  43698. inherits(Point, Base.BasePoint);
  43699. ShortCurve.prototype.point = function point(x, y, isRed) {
  43700. return new Point(this, x, y, isRed);
  43701. };
  43702. ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
  43703. return Point.fromJSON(this, obj, red);
  43704. };
  43705. Point.prototype._getBeta = function _getBeta() {
  43706. if (!this.curve.endo)
  43707. return;
  43708. var pre = this.precomputed;
  43709. if (pre && pre.beta)
  43710. return pre.beta;
  43711. var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
  43712. if (pre) {
  43713. var curve = this.curve;
  43714. var endoMul = function(p) {
  43715. return curve.point(p.x.redMul(curve.endo.beta), p.y);
  43716. };
  43717. pre.beta = beta;
  43718. beta.precomputed = {
  43719. beta: null,
  43720. naf: pre.naf && {
  43721. wnd: pre.naf.wnd,
  43722. points: pre.naf.points.map(endoMul),
  43723. },
  43724. doubles: pre.doubles && {
  43725. step: pre.doubles.step,
  43726. points: pre.doubles.points.map(endoMul),
  43727. },
  43728. };
  43729. }
  43730. return beta;
  43731. };
  43732. Point.prototype.toJSON = function toJSON() {
  43733. if (!this.precomputed)
  43734. return [ this.x, this.y ];
  43735. return [ this.x, this.y, this.precomputed && {
  43736. doubles: this.precomputed.doubles && {
  43737. step: this.precomputed.doubles.step,
  43738. points: this.precomputed.doubles.points.slice(1),
  43739. },
  43740. naf: this.precomputed.naf && {
  43741. wnd: this.precomputed.naf.wnd,
  43742. points: this.precomputed.naf.points.slice(1),
  43743. },
  43744. } ];
  43745. };
  43746. Point.fromJSON = function fromJSON(curve, obj, red) {
  43747. if (typeof obj === 'string')
  43748. obj = JSON.parse(obj);
  43749. var res = curve.point(obj[0], obj[1], red);
  43750. if (!obj[2])
  43751. return res;
  43752. function obj2point(obj) {
  43753. return curve.point(obj[0], obj[1], red);
  43754. }
  43755. var pre = obj[2];
  43756. res.precomputed = {
  43757. beta: null,
  43758. doubles: pre.doubles && {
  43759. step: pre.doubles.step,
  43760. points: [ res ].concat(pre.doubles.points.map(obj2point)),
  43761. },
  43762. naf: pre.naf && {
  43763. wnd: pre.naf.wnd,
  43764. points: [ res ].concat(pre.naf.points.map(obj2point)),
  43765. },
  43766. };
  43767. return res;
  43768. };
  43769. Point.prototype.inspect = function inspect() {
  43770. if (this.isInfinity())
  43771. return '<EC Point Infinity>';
  43772. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  43773. ' y: ' + this.y.fromRed().toString(16, 2) + '>';
  43774. };
  43775. Point.prototype.isInfinity = function isInfinity() {
  43776. return this.inf;
  43777. };
  43778. Point.prototype.add = function add(p) {
  43779. // O + P = P
  43780. if (this.inf)
  43781. return p;
  43782. // P + O = P
  43783. if (p.inf)
  43784. return this;
  43785. // P + P = 2P
  43786. if (this.eq(p))
  43787. return this.dbl();
  43788. // P + (-P) = O
  43789. if (this.neg().eq(p))
  43790. return this.curve.point(null, null);
  43791. // P + Q = O
  43792. if (this.x.cmp(p.x) === 0)
  43793. return this.curve.point(null, null);
  43794. var c = this.y.redSub(p.y);
  43795. if (c.cmpn(0) !== 0)
  43796. c = c.redMul(this.x.redSub(p.x).redInvm());
  43797. var nx = c.redSqr().redISub(this.x).redISub(p.x);
  43798. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  43799. return this.curve.point(nx, ny);
  43800. };
  43801. Point.prototype.dbl = function dbl() {
  43802. if (this.inf)
  43803. return this;
  43804. // 2P = O
  43805. var ys1 = this.y.redAdd(this.y);
  43806. if (ys1.cmpn(0) === 0)
  43807. return this.curve.point(null, null);
  43808. var a = this.curve.a;
  43809. var x2 = this.x.redSqr();
  43810. var dyinv = ys1.redInvm();
  43811. var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
  43812. var nx = c.redSqr().redISub(this.x.redAdd(this.x));
  43813. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  43814. return this.curve.point(nx, ny);
  43815. };
  43816. Point.prototype.getX = function getX() {
  43817. return this.x.fromRed();
  43818. };
  43819. Point.prototype.getY = function getY() {
  43820. return this.y.fromRed();
  43821. };
  43822. Point.prototype.mul = function mul(k) {
  43823. k = new BN(k, 16);
  43824. if (this.isInfinity())
  43825. return this;
  43826. else if (this._hasDoubles(k))
  43827. return this.curve._fixedNafMul(this, k);
  43828. else if (this.curve.endo)
  43829. return this.curve._endoWnafMulAdd([ this ], [ k ]);
  43830. else
  43831. return this.curve._wnafMul(this, k);
  43832. };
  43833. Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
  43834. var points = [ this, p2 ];
  43835. var coeffs = [ k1, k2 ];
  43836. if (this.curve.endo)
  43837. return this.curve._endoWnafMulAdd(points, coeffs);
  43838. else
  43839. return this.curve._wnafMulAdd(1, points, coeffs, 2);
  43840. };
  43841. Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
  43842. var points = [ this, p2 ];
  43843. var coeffs = [ k1, k2 ];
  43844. if (this.curve.endo)
  43845. return this.curve._endoWnafMulAdd(points, coeffs, true);
  43846. else
  43847. return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
  43848. };
  43849. Point.prototype.eq = function eq(p) {
  43850. return this === p ||
  43851. this.inf === p.inf &&
  43852. (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
  43853. };
  43854. Point.prototype.neg = function neg(_precompute) {
  43855. if (this.inf)
  43856. return this;
  43857. var res = this.curve.point(this.x, this.y.redNeg());
  43858. if (_precompute && this.precomputed) {
  43859. var pre = this.precomputed;
  43860. var negate = function(p) {
  43861. return p.neg();
  43862. };
  43863. res.precomputed = {
  43864. naf: pre.naf && {
  43865. wnd: pre.naf.wnd,
  43866. points: pre.naf.points.map(negate),
  43867. },
  43868. doubles: pre.doubles && {
  43869. step: pre.doubles.step,
  43870. points: pre.doubles.points.map(negate),
  43871. },
  43872. };
  43873. }
  43874. return res;
  43875. };
  43876. Point.prototype.toJ = function toJ() {
  43877. if (this.inf)
  43878. return this.curve.jpoint(null, null, null);
  43879. var res = this.curve.jpoint(this.x, this.y, this.curve.one);
  43880. return res;
  43881. };
  43882. function JPoint(curve, x, y, z) {
  43883. Base.BasePoint.call(this, curve, 'jacobian');
  43884. if (x === null && y === null && z === null) {
  43885. this.x = this.curve.one;
  43886. this.y = this.curve.one;
  43887. this.z = new BN(0);
  43888. } else {
  43889. this.x = new BN(x, 16);
  43890. this.y = new BN(y, 16);
  43891. this.z = new BN(z, 16);
  43892. }
  43893. if (!this.x.red)
  43894. this.x = this.x.toRed(this.curve.red);
  43895. if (!this.y.red)
  43896. this.y = this.y.toRed(this.curve.red);
  43897. if (!this.z.red)
  43898. this.z = this.z.toRed(this.curve.red);
  43899. this.zOne = this.z === this.curve.one;
  43900. }
  43901. inherits(JPoint, Base.BasePoint);
  43902. ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
  43903. return new JPoint(this, x, y, z);
  43904. };
  43905. JPoint.prototype.toP = function toP() {
  43906. if (this.isInfinity())
  43907. return this.curve.point(null, null);
  43908. var zinv = this.z.redInvm();
  43909. var zinv2 = zinv.redSqr();
  43910. var ax = this.x.redMul(zinv2);
  43911. var ay = this.y.redMul(zinv2).redMul(zinv);
  43912. return this.curve.point(ax, ay);
  43913. };
  43914. JPoint.prototype.neg = function neg() {
  43915. return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
  43916. };
  43917. JPoint.prototype.add = function add(p) {
  43918. // O + P = P
  43919. if (this.isInfinity())
  43920. return p;
  43921. // P + O = P
  43922. if (p.isInfinity())
  43923. return this;
  43924. // 12M + 4S + 7A
  43925. var pz2 = p.z.redSqr();
  43926. var z2 = this.z.redSqr();
  43927. var u1 = this.x.redMul(pz2);
  43928. var u2 = p.x.redMul(z2);
  43929. var s1 = this.y.redMul(pz2.redMul(p.z));
  43930. var s2 = p.y.redMul(z2.redMul(this.z));
  43931. var h = u1.redSub(u2);
  43932. var r = s1.redSub(s2);
  43933. if (h.cmpn(0) === 0) {
  43934. if (r.cmpn(0) !== 0)
  43935. return this.curve.jpoint(null, null, null);
  43936. else
  43937. return this.dbl();
  43938. }
  43939. var h2 = h.redSqr();
  43940. var h3 = h2.redMul(h);
  43941. var v = u1.redMul(h2);
  43942. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  43943. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  43944. var nz = this.z.redMul(p.z).redMul(h);
  43945. return this.curve.jpoint(nx, ny, nz);
  43946. };
  43947. JPoint.prototype.mixedAdd = function mixedAdd(p) {
  43948. // O + P = P
  43949. if (this.isInfinity())
  43950. return p.toJ();
  43951. // P + O = P
  43952. if (p.isInfinity())
  43953. return this;
  43954. // 8M + 3S + 7A
  43955. var z2 = this.z.redSqr();
  43956. var u1 = this.x;
  43957. var u2 = p.x.redMul(z2);
  43958. var s1 = this.y;
  43959. var s2 = p.y.redMul(z2).redMul(this.z);
  43960. var h = u1.redSub(u2);
  43961. var r = s1.redSub(s2);
  43962. if (h.cmpn(0) === 0) {
  43963. if (r.cmpn(0) !== 0)
  43964. return this.curve.jpoint(null, null, null);
  43965. else
  43966. return this.dbl();
  43967. }
  43968. var h2 = h.redSqr();
  43969. var h3 = h2.redMul(h);
  43970. var v = u1.redMul(h2);
  43971. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  43972. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  43973. var nz = this.z.redMul(h);
  43974. return this.curve.jpoint(nx, ny, nz);
  43975. };
  43976. JPoint.prototype.dblp = function dblp(pow) {
  43977. if (pow === 0)
  43978. return this;
  43979. if (this.isInfinity())
  43980. return this;
  43981. if (!pow)
  43982. return this.dbl();
  43983. var i;
  43984. if (this.curve.zeroA || this.curve.threeA) {
  43985. var r = this;
  43986. for (i = 0; i < pow; i++)
  43987. r = r.dbl();
  43988. return r;
  43989. }
  43990. // 1M + 2S + 1A + N * (4S + 5M + 8A)
  43991. // N = 1 => 6M + 6S + 9A
  43992. var a = this.curve.a;
  43993. var tinv = this.curve.tinv;
  43994. var jx = this.x;
  43995. var jy = this.y;
  43996. var jz = this.z;
  43997. var jz4 = jz.redSqr().redSqr();
  43998. // Reuse results
  43999. var jyd = jy.redAdd(jy);
  44000. for (i = 0; i < pow; i++) {
  44001. var jx2 = jx.redSqr();
  44002. var jyd2 = jyd.redSqr();
  44003. var jyd4 = jyd2.redSqr();
  44004. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  44005. var t1 = jx.redMul(jyd2);
  44006. var nx = c.redSqr().redISub(t1.redAdd(t1));
  44007. var t2 = t1.redISub(nx);
  44008. var dny = c.redMul(t2);
  44009. dny = dny.redIAdd(dny).redISub(jyd4);
  44010. var nz = jyd.redMul(jz);
  44011. if (i + 1 < pow)
  44012. jz4 = jz4.redMul(jyd4);
  44013. jx = nx;
  44014. jz = nz;
  44015. jyd = dny;
  44016. }
  44017. return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
  44018. };
  44019. JPoint.prototype.dbl = function dbl() {
  44020. if (this.isInfinity())
  44021. return this;
  44022. if (this.curve.zeroA)
  44023. return this._zeroDbl();
  44024. else if (this.curve.threeA)
  44025. return this._threeDbl();
  44026. else
  44027. return this._dbl();
  44028. };
  44029. JPoint.prototype._zeroDbl = function _zeroDbl() {
  44030. var nx;
  44031. var ny;
  44032. var nz;
  44033. // Z = 1
  44034. if (this.zOne) {
  44035. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  44036. // #doubling-mdbl-2007-bl
  44037. // 1M + 5S + 14A
  44038. // XX = X1^2
  44039. var xx = this.x.redSqr();
  44040. // YY = Y1^2
  44041. var yy = this.y.redSqr();
  44042. // YYYY = YY^2
  44043. var yyyy = yy.redSqr();
  44044. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  44045. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  44046. s = s.redIAdd(s);
  44047. // M = 3 * XX + a; a = 0
  44048. var m = xx.redAdd(xx).redIAdd(xx);
  44049. // T = M ^ 2 - 2*S
  44050. var t = m.redSqr().redISub(s).redISub(s);
  44051. // 8 * YYYY
  44052. var yyyy8 = yyyy.redIAdd(yyyy);
  44053. yyyy8 = yyyy8.redIAdd(yyyy8);
  44054. yyyy8 = yyyy8.redIAdd(yyyy8);
  44055. // X3 = T
  44056. nx = t;
  44057. // Y3 = M * (S - T) - 8 * YYYY
  44058. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  44059. // Z3 = 2*Y1
  44060. nz = this.y.redAdd(this.y);
  44061. } else {
  44062. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  44063. // #doubling-dbl-2009-l
  44064. // 2M + 5S + 13A
  44065. // A = X1^2
  44066. var a = this.x.redSqr();
  44067. // B = Y1^2
  44068. var b = this.y.redSqr();
  44069. // C = B^2
  44070. var c = b.redSqr();
  44071. // D = 2 * ((X1 + B)^2 - A - C)
  44072. var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
  44073. d = d.redIAdd(d);
  44074. // E = 3 * A
  44075. var e = a.redAdd(a).redIAdd(a);
  44076. // F = E^2
  44077. var f = e.redSqr();
  44078. // 8 * C
  44079. var c8 = c.redIAdd(c);
  44080. c8 = c8.redIAdd(c8);
  44081. c8 = c8.redIAdd(c8);
  44082. // X3 = F - 2 * D
  44083. nx = f.redISub(d).redISub(d);
  44084. // Y3 = E * (D - X3) - 8 * C
  44085. ny = e.redMul(d.redISub(nx)).redISub(c8);
  44086. // Z3 = 2 * Y1 * Z1
  44087. nz = this.y.redMul(this.z);
  44088. nz = nz.redIAdd(nz);
  44089. }
  44090. return this.curve.jpoint(nx, ny, nz);
  44091. };
  44092. JPoint.prototype._threeDbl = function _threeDbl() {
  44093. var nx;
  44094. var ny;
  44095. var nz;
  44096. // Z = 1
  44097. if (this.zOne) {
  44098. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
  44099. // #doubling-mdbl-2007-bl
  44100. // 1M + 5S + 15A
  44101. // XX = X1^2
  44102. var xx = this.x.redSqr();
  44103. // YY = Y1^2
  44104. var yy = this.y.redSqr();
  44105. // YYYY = YY^2
  44106. var yyyy = yy.redSqr();
  44107. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  44108. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  44109. s = s.redIAdd(s);
  44110. // M = 3 * XX + a
  44111. var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
  44112. // T = M^2 - 2 * S
  44113. var t = m.redSqr().redISub(s).redISub(s);
  44114. // X3 = T
  44115. nx = t;
  44116. // Y3 = M * (S - T) - 8 * YYYY
  44117. var yyyy8 = yyyy.redIAdd(yyyy);
  44118. yyyy8 = yyyy8.redIAdd(yyyy8);
  44119. yyyy8 = yyyy8.redIAdd(yyyy8);
  44120. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  44121. // Z3 = 2 * Y1
  44122. nz = this.y.redAdd(this.y);
  44123. } else {
  44124. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
  44125. // 3M + 5S
  44126. // delta = Z1^2
  44127. var delta = this.z.redSqr();
  44128. // gamma = Y1^2
  44129. var gamma = this.y.redSqr();
  44130. // beta = X1 * gamma
  44131. var beta = this.x.redMul(gamma);
  44132. // alpha = 3 * (X1 - delta) * (X1 + delta)
  44133. var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
  44134. alpha = alpha.redAdd(alpha).redIAdd(alpha);
  44135. // X3 = alpha^2 - 8 * beta
  44136. var beta4 = beta.redIAdd(beta);
  44137. beta4 = beta4.redIAdd(beta4);
  44138. var beta8 = beta4.redAdd(beta4);
  44139. nx = alpha.redSqr().redISub(beta8);
  44140. // Z3 = (Y1 + Z1)^2 - gamma - delta
  44141. nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
  44142. // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
  44143. var ggamma8 = gamma.redSqr();
  44144. ggamma8 = ggamma8.redIAdd(ggamma8);
  44145. ggamma8 = ggamma8.redIAdd(ggamma8);
  44146. ggamma8 = ggamma8.redIAdd(ggamma8);
  44147. ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
  44148. }
  44149. return this.curve.jpoint(nx, ny, nz);
  44150. };
  44151. JPoint.prototype._dbl = function _dbl() {
  44152. var a = this.curve.a;
  44153. // 4M + 6S + 10A
  44154. var jx = this.x;
  44155. var jy = this.y;
  44156. var jz = this.z;
  44157. var jz4 = jz.redSqr().redSqr();
  44158. var jx2 = jx.redSqr();
  44159. var jy2 = jy.redSqr();
  44160. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  44161. var jxd4 = jx.redAdd(jx);
  44162. jxd4 = jxd4.redIAdd(jxd4);
  44163. var t1 = jxd4.redMul(jy2);
  44164. var nx = c.redSqr().redISub(t1.redAdd(t1));
  44165. var t2 = t1.redISub(nx);
  44166. var jyd8 = jy2.redSqr();
  44167. jyd8 = jyd8.redIAdd(jyd8);
  44168. jyd8 = jyd8.redIAdd(jyd8);
  44169. jyd8 = jyd8.redIAdd(jyd8);
  44170. var ny = c.redMul(t2).redISub(jyd8);
  44171. var nz = jy.redAdd(jy).redMul(jz);
  44172. return this.curve.jpoint(nx, ny, nz);
  44173. };
  44174. JPoint.prototype.trpl = function trpl() {
  44175. if (!this.curve.zeroA)
  44176. return this.dbl().add(this);
  44177. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
  44178. // 5M + 10S + ...
  44179. // XX = X1^2
  44180. var xx = this.x.redSqr();
  44181. // YY = Y1^2
  44182. var yy = this.y.redSqr();
  44183. // ZZ = Z1^2
  44184. var zz = this.z.redSqr();
  44185. // YYYY = YY^2
  44186. var yyyy = yy.redSqr();
  44187. // M = 3 * XX + a * ZZ2; a = 0
  44188. var m = xx.redAdd(xx).redIAdd(xx);
  44189. // MM = M^2
  44190. var mm = m.redSqr();
  44191. // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
  44192. var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  44193. e = e.redIAdd(e);
  44194. e = e.redAdd(e).redIAdd(e);
  44195. e = e.redISub(mm);
  44196. // EE = E^2
  44197. var ee = e.redSqr();
  44198. // T = 16*YYYY
  44199. var t = yyyy.redIAdd(yyyy);
  44200. t = t.redIAdd(t);
  44201. t = t.redIAdd(t);
  44202. t = t.redIAdd(t);
  44203. // U = (M + E)^2 - MM - EE - T
  44204. var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
  44205. // X3 = 4 * (X1 * EE - 4 * YY * U)
  44206. var yyu4 = yy.redMul(u);
  44207. yyu4 = yyu4.redIAdd(yyu4);
  44208. yyu4 = yyu4.redIAdd(yyu4);
  44209. var nx = this.x.redMul(ee).redISub(yyu4);
  44210. nx = nx.redIAdd(nx);
  44211. nx = nx.redIAdd(nx);
  44212. // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
  44213. var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
  44214. ny = ny.redIAdd(ny);
  44215. ny = ny.redIAdd(ny);
  44216. ny = ny.redIAdd(ny);
  44217. // Z3 = (Z1 + E)^2 - ZZ - EE
  44218. var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
  44219. return this.curve.jpoint(nx, ny, nz);
  44220. };
  44221. JPoint.prototype.mul = function mul(k, kbase) {
  44222. k = new BN(k, kbase);
  44223. return this.curve._wnafMul(this, k);
  44224. };
  44225. JPoint.prototype.eq = function eq(p) {
  44226. if (p.type === 'affine')
  44227. return this.eq(p.toJ());
  44228. if (this === p)
  44229. return true;
  44230. // x1 * z2^2 == x2 * z1^2
  44231. var z2 = this.z.redSqr();
  44232. var pz2 = p.z.redSqr();
  44233. if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
  44234. return false;
  44235. // y1 * z2^3 == y2 * z1^3
  44236. var z3 = z2.redMul(this.z);
  44237. var pz3 = pz2.redMul(p.z);
  44238. return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
  44239. };
  44240. JPoint.prototype.eqXToP = function eqXToP(x) {
  44241. var zs = this.z.redSqr();
  44242. var rx = x.toRed(this.curve.red).redMul(zs);
  44243. if (this.x.cmp(rx) === 0)
  44244. return true;
  44245. var xc = x.clone();
  44246. var t = this.curve.redN.redMul(zs);
  44247. for (;;) {
  44248. xc.iadd(this.curve.n);
  44249. if (xc.cmp(this.curve.p) >= 0)
  44250. return false;
  44251. rx.redIAdd(t);
  44252. if (this.x.cmp(rx) === 0)
  44253. return true;
  44254. }
  44255. };
  44256. JPoint.prototype.inspect = function inspect() {
  44257. if (this.isInfinity())
  44258. return '<EC JPoint Infinity>';
  44259. return '<EC JPoint x: ' + this.x.toString(16, 2) +
  44260. ' y: ' + this.y.toString(16, 2) +
  44261. ' z: ' + this.z.toString(16, 2) + '>';
  44262. };
  44263. JPoint.prototype.isInfinity = function isInfinity() {
  44264. // XXX This code assumes that zero is always zero in red
  44265. return this.z.cmpn(0) === 0;
  44266. };
  44267. /***/ }),
  44268. /* 215 */
  44269. /*!**********************************************************!*\
  44270. !*** ./node_modules/elliptic/lib/elliptic/curve/mont.js ***!
  44271. \**********************************************************/
  44272. /*! no static exports found */
  44273. /***/ (function(module, exports, __webpack_require__) {
  44274. "use strict";
  44275. var BN = __webpack_require__(/*! bn.js */ 197);
  44276. var inherits = __webpack_require__(/*! inherits */ 121);
  44277. var Base = __webpack_require__(/*! ./base */ 213);
  44278. var utils = __webpack_require__(/*! ../utils */ 210);
  44279. function MontCurve(conf) {
  44280. Base.call(this, 'mont', conf);
  44281. this.a = new BN(conf.a, 16).toRed(this.red);
  44282. this.b = new BN(conf.b, 16).toRed(this.red);
  44283. this.i4 = new BN(4).toRed(this.red).redInvm();
  44284. this.two = new BN(2).toRed(this.red);
  44285. this.a24 = this.i4.redMul(this.a.redAdd(this.two));
  44286. }
  44287. inherits(MontCurve, Base);
  44288. module.exports = MontCurve;
  44289. MontCurve.prototype.validate = function validate(point) {
  44290. var x = point.normalize().x;
  44291. var x2 = x.redSqr();
  44292. var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
  44293. var y = rhs.redSqrt();
  44294. return y.redSqr().cmp(rhs) === 0;
  44295. };
  44296. function Point(curve, x, z) {
  44297. Base.BasePoint.call(this, curve, 'projective');
  44298. if (x === null && z === null) {
  44299. this.x = this.curve.one;
  44300. this.z = this.curve.zero;
  44301. } else {
  44302. this.x = new BN(x, 16);
  44303. this.z = new BN(z, 16);
  44304. if (!this.x.red)
  44305. this.x = this.x.toRed(this.curve.red);
  44306. if (!this.z.red)
  44307. this.z = this.z.toRed(this.curve.red);
  44308. }
  44309. }
  44310. inherits(Point, Base.BasePoint);
  44311. MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  44312. return this.point(utils.toArray(bytes, enc), 1);
  44313. };
  44314. MontCurve.prototype.point = function point(x, z) {
  44315. return new Point(this, x, z);
  44316. };
  44317. MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  44318. return Point.fromJSON(this, obj);
  44319. };
  44320. Point.prototype.precompute = function precompute() {
  44321. // No-op
  44322. };
  44323. Point.prototype._encode = function _encode() {
  44324. return this.getX().toArray('be', this.curve.p.byteLength());
  44325. };
  44326. Point.fromJSON = function fromJSON(curve, obj) {
  44327. return new Point(curve, obj[0], obj[1] || curve.one);
  44328. };
  44329. Point.prototype.inspect = function inspect() {
  44330. if (this.isInfinity())
  44331. return '<EC Point Infinity>';
  44332. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  44333. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  44334. };
  44335. Point.prototype.isInfinity = function isInfinity() {
  44336. // XXX This code assumes that zero is always zero in red
  44337. return this.z.cmpn(0) === 0;
  44338. };
  44339. Point.prototype.dbl = function dbl() {
  44340. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
  44341. // 2M + 2S + 4A
  44342. // A = X1 + Z1
  44343. var a = this.x.redAdd(this.z);
  44344. // AA = A^2
  44345. var aa = a.redSqr();
  44346. // B = X1 - Z1
  44347. var b = this.x.redSub(this.z);
  44348. // BB = B^2
  44349. var bb = b.redSqr();
  44350. // C = AA - BB
  44351. var c = aa.redSub(bb);
  44352. // X3 = AA * BB
  44353. var nx = aa.redMul(bb);
  44354. // Z3 = C * (BB + A24 * C)
  44355. var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
  44356. return this.curve.point(nx, nz);
  44357. };
  44358. Point.prototype.add = function add() {
  44359. throw new Error('Not supported on Montgomery curve');
  44360. };
  44361. Point.prototype.diffAdd = function diffAdd(p, diff) {
  44362. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
  44363. // 4M + 2S + 6A
  44364. // A = X2 + Z2
  44365. var a = this.x.redAdd(this.z);
  44366. // B = X2 - Z2
  44367. var b = this.x.redSub(this.z);
  44368. // C = X3 + Z3
  44369. var c = p.x.redAdd(p.z);
  44370. // D = X3 - Z3
  44371. var d = p.x.redSub(p.z);
  44372. // DA = D * A
  44373. var da = d.redMul(a);
  44374. // CB = C * B
  44375. var cb = c.redMul(b);
  44376. // X5 = Z1 * (DA + CB)^2
  44377. var nx = diff.z.redMul(da.redAdd(cb).redSqr());
  44378. // Z5 = X1 * (DA - CB)^2
  44379. var nz = diff.x.redMul(da.redISub(cb).redSqr());
  44380. return this.curve.point(nx, nz);
  44381. };
  44382. Point.prototype.mul = function mul(k) {
  44383. var t = k.clone();
  44384. var a = this; // (N / 2) * Q + Q
  44385. var b = this.curve.point(null, null); // (N / 2) * Q
  44386. var c = this; // Q
  44387. for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
  44388. bits.push(t.andln(1));
  44389. for (var i = bits.length - 1; i >= 0; i--) {
  44390. if (bits[i] === 0) {
  44391. // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
  44392. a = a.diffAdd(b, c);
  44393. // N * Q = 2 * ((N / 2) * Q + Q))
  44394. b = b.dbl();
  44395. } else {
  44396. // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
  44397. b = a.diffAdd(b, c);
  44398. // N * Q + Q = 2 * ((N / 2) * Q + Q)
  44399. a = a.dbl();
  44400. }
  44401. }
  44402. return b;
  44403. };
  44404. Point.prototype.mulAdd = function mulAdd() {
  44405. throw new Error('Not supported on Montgomery curve');
  44406. };
  44407. Point.prototype.jumlAdd = function jumlAdd() {
  44408. throw new Error('Not supported on Montgomery curve');
  44409. };
  44410. Point.prototype.eq = function eq(other) {
  44411. return this.getX().cmp(other.getX()) === 0;
  44412. };
  44413. Point.prototype.normalize = function normalize() {
  44414. this.x = this.x.redMul(this.z.redInvm());
  44415. this.z = this.curve.one;
  44416. return this;
  44417. };
  44418. Point.prototype.getX = function getX() {
  44419. // Normalize coordinates
  44420. this.normalize();
  44421. return this.x.fromRed();
  44422. };
  44423. /***/ }),
  44424. /* 216 */
  44425. /*!*************************************************************!*\
  44426. !*** ./node_modules/elliptic/lib/elliptic/curve/edwards.js ***!
  44427. \*************************************************************/
  44428. /*! no static exports found */
  44429. /***/ (function(module, exports, __webpack_require__) {
  44430. "use strict";
  44431. var utils = __webpack_require__(/*! ../utils */ 210);
  44432. var BN = __webpack_require__(/*! bn.js */ 197);
  44433. var inherits = __webpack_require__(/*! inherits */ 121);
  44434. var Base = __webpack_require__(/*! ./base */ 213);
  44435. var assert = utils.assert;
  44436. function EdwardsCurve(conf) {
  44437. // NOTE: Important as we are creating point in Base.call()
  44438. this.twisted = (conf.a | 0) !== 1;
  44439. this.mOneA = this.twisted && (conf.a | 0) === -1;
  44440. this.extended = this.mOneA;
  44441. Base.call(this, 'edwards', conf);
  44442. this.a = new BN(conf.a, 16).umod(this.red.m);
  44443. this.a = this.a.toRed(this.red);
  44444. this.c = new BN(conf.c, 16).toRed(this.red);
  44445. this.c2 = this.c.redSqr();
  44446. this.d = new BN(conf.d, 16).toRed(this.red);
  44447. this.dd = this.d.redAdd(this.d);
  44448. assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
  44449. this.oneC = (conf.c | 0) === 1;
  44450. }
  44451. inherits(EdwardsCurve, Base);
  44452. module.exports = EdwardsCurve;
  44453. EdwardsCurve.prototype._mulA = function _mulA(num) {
  44454. if (this.mOneA)
  44455. return num.redNeg();
  44456. else
  44457. return this.a.redMul(num);
  44458. };
  44459. EdwardsCurve.prototype._mulC = function _mulC(num) {
  44460. if (this.oneC)
  44461. return num;
  44462. else
  44463. return this.c.redMul(num);
  44464. };
  44465. // Just for compatibility with Short curve
  44466. EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
  44467. return this.point(x, y, z, t);
  44468. };
  44469. EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
  44470. x = new BN(x, 16);
  44471. if (!x.red)
  44472. x = x.toRed(this.red);
  44473. var x2 = x.redSqr();
  44474. var rhs = this.c2.redSub(this.a.redMul(x2));
  44475. var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
  44476. var y2 = rhs.redMul(lhs.redInvm());
  44477. var y = y2.redSqrt();
  44478. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  44479. throw new Error('invalid point');
  44480. var isOdd = y.fromRed().isOdd();
  44481. if (odd && !isOdd || !odd && isOdd)
  44482. y = y.redNeg();
  44483. return this.point(x, y);
  44484. };
  44485. EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
  44486. y = new BN(y, 16);
  44487. if (!y.red)
  44488. y = y.toRed(this.red);
  44489. // x^2 = (y^2 - c^2) / (c^2 d y^2 - a)
  44490. var y2 = y.redSqr();
  44491. var lhs = y2.redSub(this.c2);
  44492. var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a);
  44493. var x2 = lhs.redMul(rhs.redInvm());
  44494. if (x2.cmp(this.zero) === 0) {
  44495. if (odd)
  44496. throw new Error('invalid point');
  44497. else
  44498. return this.point(this.zero, y);
  44499. }
  44500. var x = x2.redSqrt();
  44501. if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
  44502. throw new Error('invalid point');
  44503. if (x.fromRed().isOdd() !== odd)
  44504. x = x.redNeg();
  44505. return this.point(x, y);
  44506. };
  44507. EdwardsCurve.prototype.validate = function validate(point) {
  44508. if (point.isInfinity())
  44509. return true;
  44510. // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
  44511. point.normalize();
  44512. var x2 = point.x.redSqr();
  44513. var y2 = point.y.redSqr();
  44514. var lhs = x2.redMul(this.a).redAdd(y2);
  44515. var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
  44516. return lhs.cmp(rhs) === 0;
  44517. };
  44518. function Point(curve, x, y, z, t) {
  44519. Base.BasePoint.call(this, curve, 'projective');
  44520. if (x === null && y === null && z === null) {
  44521. this.x = this.curve.zero;
  44522. this.y = this.curve.one;
  44523. this.z = this.curve.one;
  44524. this.t = this.curve.zero;
  44525. this.zOne = true;
  44526. } else {
  44527. this.x = new BN(x, 16);
  44528. this.y = new BN(y, 16);
  44529. this.z = z ? new BN(z, 16) : this.curve.one;
  44530. this.t = t && new BN(t, 16);
  44531. if (!this.x.red)
  44532. this.x = this.x.toRed(this.curve.red);
  44533. if (!this.y.red)
  44534. this.y = this.y.toRed(this.curve.red);
  44535. if (!this.z.red)
  44536. this.z = this.z.toRed(this.curve.red);
  44537. if (this.t && !this.t.red)
  44538. this.t = this.t.toRed(this.curve.red);
  44539. this.zOne = this.z === this.curve.one;
  44540. // Use extended coordinates
  44541. if (this.curve.extended && !this.t) {
  44542. this.t = this.x.redMul(this.y);
  44543. if (!this.zOne)
  44544. this.t = this.t.redMul(this.z.redInvm());
  44545. }
  44546. }
  44547. }
  44548. inherits(Point, Base.BasePoint);
  44549. EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  44550. return Point.fromJSON(this, obj);
  44551. };
  44552. EdwardsCurve.prototype.point = function point(x, y, z, t) {
  44553. return new Point(this, x, y, z, t);
  44554. };
  44555. Point.fromJSON = function fromJSON(curve, obj) {
  44556. return new Point(curve, obj[0], obj[1], obj[2]);
  44557. };
  44558. Point.prototype.inspect = function inspect() {
  44559. if (this.isInfinity())
  44560. return '<EC Point Infinity>';
  44561. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  44562. ' y: ' + this.y.fromRed().toString(16, 2) +
  44563. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  44564. };
  44565. Point.prototype.isInfinity = function isInfinity() {
  44566. // XXX This code assumes that zero is always zero in red
  44567. return this.x.cmpn(0) === 0 &&
  44568. (this.y.cmp(this.z) === 0 ||
  44569. (this.zOne && this.y.cmp(this.curve.c) === 0));
  44570. };
  44571. Point.prototype._extDbl = function _extDbl() {
  44572. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  44573. // #doubling-dbl-2008-hwcd
  44574. // 4M + 4S
  44575. // A = X1^2
  44576. var a = this.x.redSqr();
  44577. // B = Y1^2
  44578. var b = this.y.redSqr();
  44579. // C = 2 * Z1^2
  44580. var c = this.z.redSqr();
  44581. c = c.redIAdd(c);
  44582. // D = a * A
  44583. var d = this.curve._mulA(a);
  44584. // E = (X1 + Y1)^2 - A - B
  44585. var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
  44586. // G = D + B
  44587. var g = d.redAdd(b);
  44588. // F = G - C
  44589. var f = g.redSub(c);
  44590. // H = D - B
  44591. var h = d.redSub(b);
  44592. // X3 = E * F
  44593. var nx = e.redMul(f);
  44594. // Y3 = G * H
  44595. var ny = g.redMul(h);
  44596. // T3 = E * H
  44597. var nt = e.redMul(h);
  44598. // Z3 = F * G
  44599. var nz = f.redMul(g);
  44600. return this.curve.point(nx, ny, nz, nt);
  44601. };
  44602. Point.prototype._projDbl = function _projDbl() {
  44603. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  44604. // #doubling-dbl-2008-bbjlp
  44605. // #doubling-dbl-2007-bl
  44606. // and others
  44607. // Generally 3M + 4S or 2M + 4S
  44608. // B = (X1 + Y1)^2
  44609. var b = this.x.redAdd(this.y).redSqr();
  44610. // C = X1^2
  44611. var c = this.x.redSqr();
  44612. // D = Y1^2
  44613. var d = this.y.redSqr();
  44614. var nx;
  44615. var ny;
  44616. var nz;
  44617. var e;
  44618. var h;
  44619. var j;
  44620. if (this.curve.twisted) {
  44621. // E = a * C
  44622. e = this.curve._mulA(c);
  44623. // F = E + D
  44624. var f = e.redAdd(d);
  44625. if (this.zOne) {
  44626. // X3 = (B - C - D) * (F - 2)
  44627. nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
  44628. // Y3 = F * (E - D)
  44629. ny = f.redMul(e.redSub(d));
  44630. // Z3 = F^2 - 2 * F
  44631. nz = f.redSqr().redSub(f).redSub(f);
  44632. } else {
  44633. // H = Z1^2
  44634. h = this.z.redSqr();
  44635. // J = F - 2 * H
  44636. j = f.redSub(h).redISub(h);
  44637. // X3 = (B-C-D)*J
  44638. nx = b.redSub(c).redISub(d).redMul(j);
  44639. // Y3 = F * (E - D)
  44640. ny = f.redMul(e.redSub(d));
  44641. // Z3 = F * J
  44642. nz = f.redMul(j);
  44643. }
  44644. } else {
  44645. // E = C + D
  44646. e = c.redAdd(d);
  44647. // H = (c * Z1)^2
  44648. h = this.curve._mulC(this.z).redSqr();
  44649. // J = E - 2 * H
  44650. j = e.redSub(h).redSub(h);
  44651. // X3 = c * (B - E) * J
  44652. nx = this.curve._mulC(b.redISub(e)).redMul(j);
  44653. // Y3 = c * E * (C - D)
  44654. ny = this.curve._mulC(e).redMul(c.redISub(d));
  44655. // Z3 = E * J
  44656. nz = e.redMul(j);
  44657. }
  44658. return this.curve.point(nx, ny, nz);
  44659. };
  44660. Point.prototype.dbl = function dbl() {
  44661. if (this.isInfinity())
  44662. return this;
  44663. // Double in extended coordinates
  44664. if (this.curve.extended)
  44665. return this._extDbl();
  44666. else
  44667. return this._projDbl();
  44668. };
  44669. Point.prototype._extAdd = function _extAdd(p) {
  44670. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  44671. // #addition-add-2008-hwcd-3
  44672. // 8M
  44673. // A = (Y1 - X1) * (Y2 - X2)
  44674. var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
  44675. // B = (Y1 + X1) * (Y2 + X2)
  44676. var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
  44677. // C = T1 * k * T2
  44678. var c = this.t.redMul(this.curve.dd).redMul(p.t);
  44679. // D = Z1 * 2 * Z2
  44680. var d = this.z.redMul(p.z.redAdd(p.z));
  44681. // E = B - A
  44682. var e = b.redSub(a);
  44683. // F = D - C
  44684. var f = d.redSub(c);
  44685. // G = D + C
  44686. var g = d.redAdd(c);
  44687. // H = B + A
  44688. var h = b.redAdd(a);
  44689. // X3 = E * F
  44690. var nx = e.redMul(f);
  44691. // Y3 = G * H
  44692. var ny = g.redMul(h);
  44693. // T3 = E * H
  44694. var nt = e.redMul(h);
  44695. // Z3 = F * G
  44696. var nz = f.redMul(g);
  44697. return this.curve.point(nx, ny, nz, nt);
  44698. };
  44699. Point.prototype._projAdd = function _projAdd(p) {
  44700. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  44701. // #addition-add-2008-bbjlp
  44702. // #addition-add-2007-bl
  44703. // 10M + 1S
  44704. // A = Z1 * Z2
  44705. var a = this.z.redMul(p.z);
  44706. // B = A^2
  44707. var b = a.redSqr();
  44708. // C = X1 * X2
  44709. var c = this.x.redMul(p.x);
  44710. // D = Y1 * Y2
  44711. var d = this.y.redMul(p.y);
  44712. // E = d * C * D
  44713. var e = this.curve.d.redMul(c).redMul(d);
  44714. // F = B - E
  44715. var f = b.redSub(e);
  44716. // G = B + E
  44717. var g = b.redAdd(e);
  44718. // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
  44719. var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
  44720. var nx = a.redMul(f).redMul(tmp);
  44721. var ny;
  44722. var nz;
  44723. if (this.curve.twisted) {
  44724. // Y3 = A * G * (D - a * C)
  44725. ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
  44726. // Z3 = F * G
  44727. nz = f.redMul(g);
  44728. } else {
  44729. // Y3 = A * G * (D - C)
  44730. ny = a.redMul(g).redMul(d.redSub(c));
  44731. // Z3 = c * F * G
  44732. nz = this.curve._mulC(f).redMul(g);
  44733. }
  44734. return this.curve.point(nx, ny, nz);
  44735. };
  44736. Point.prototype.add = function add(p) {
  44737. if (this.isInfinity())
  44738. return p;
  44739. if (p.isInfinity())
  44740. return this;
  44741. if (this.curve.extended)
  44742. return this._extAdd(p);
  44743. else
  44744. return this._projAdd(p);
  44745. };
  44746. Point.prototype.mul = function mul(k) {
  44747. if (this._hasDoubles(k))
  44748. return this.curve._fixedNafMul(this, k);
  44749. else
  44750. return this.curve._wnafMul(this, k);
  44751. };
  44752. Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
  44753. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
  44754. };
  44755. Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
  44756. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
  44757. };
  44758. Point.prototype.normalize = function normalize() {
  44759. if (this.zOne)
  44760. return this;
  44761. // Normalize coordinates
  44762. var zi = this.z.redInvm();
  44763. this.x = this.x.redMul(zi);
  44764. this.y = this.y.redMul(zi);
  44765. if (this.t)
  44766. this.t = this.t.redMul(zi);
  44767. this.z = this.curve.one;
  44768. this.zOne = true;
  44769. return this;
  44770. };
  44771. Point.prototype.neg = function neg() {
  44772. return this.curve.point(this.x.redNeg(),
  44773. this.y,
  44774. this.z,
  44775. this.t && this.t.redNeg());
  44776. };
  44777. Point.prototype.getX = function getX() {
  44778. this.normalize();
  44779. return this.x.fromRed();
  44780. };
  44781. Point.prototype.getY = function getY() {
  44782. this.normalize();
  44783. return this.y.fromRed();
  44784. };
  44785. Point.prototype.eq = function eq(other) {
  44786. return this === other ||
  44787. this.getX().cmp(other.getX()) === 0 &&
  44788. this.getY().cmp(other.getY()) === 0;
  44789. };
  44790. Point.prototype.eqXToP = function eqXToP(x) {
  44791. var rx = x.toRed(this.curve.red).redMul(this.z);
  44792. if (this.x.cmp(rx) === 0)
  44793. return true;
  44794. var xc = x.clone();
  44795. var t = this.curve.redN.redMul(this.z);
  44796. for (;;) {
  44797. xc.iadd(this.curve.n);
  44798. if (xc.cmp(this.curve.p) >= 0)
  44799. return false;
  44800. rx.redIAdd(t);
  44801. if (this.x.cmp(rx) === 0)
  44802. return true;
  44803. }
  44804. };
  44805. // Compatibility with BaseCurve
  44806. Point.prototype.toP = Point.prototype.normalize;
  44807. Point.prototype.mixedAdd = Point.prototype.add;
  44808. /***/ }),
  44809. /* 217 */
  44810. /*!******************************************************!*\
  44811. !*** ./node_modules/elliptic/lib/elliptic/curves.js ***!
  44812. \******************************************************/
  44813. /*! no static exports found */
  44814. /***/ (function(module, exports, __webpack_require__) {
  44815. "use strict";
  44816. var curves = exports;
  44817. var hash = __webpack_require__(/*! hash.js */ 218);
  44818. var curve = __webpack_require__(/*! ./curve */ 212);
  44819. var utils = __webpack_require__(/*! ./utils */ 210);
  44820. var assert = utils.assert;
  44821. function PresetCurve(options) {
  44822. if (options.type === 'short')
  44823. this.curve = new curve.short(options);
  44824. else if (options.type === 'edwards')
  44825. this.curve = new curve.edwards(options);
  44826. else
  44827. this.curve = new curve.mont(options);
  44828. this.g = this.curve.g;
  44829. this.n = this.curve.n;
  44830. this.hash = options.hash;
  44831. assert(this.g.validate(), 'Invalid curve');
  44832. assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
  44833. }
  44834. curves.PresetCurve = PresetCurve;
  44835. function defineCurve(name, options) {
  44836. Object.defineProperty(curves, name, {
  44837. configurable: true,
  44838. enumerable: true,
  44839. get: function() {
  44840. var curve = new PresetCurve(options);
  44841. Object.defineProperty(curves, name, {
  44842. configurable: true,
  44843. enumerable: true,
  44844. value: curve,
  44845. });
  44846. return curve;
  44847. },
  44848. });
  44849. }
  44850. defineCurve('p192', {
  44851. type: 'short',
  44852. prime: 'p192',
  44853. p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
  44854. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
  44855. b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
  44856. n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
  44857. hash: hash.sha256,
  44858. gRed: false,
  44859. g: [
  44860. '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
  44861. '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',
  44862. ],
  44863. });
  44864. defineCurve('p224', {
  44865. type: 'short',
  44866. prime: 'p224',
  44867. p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
  44868. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
  44869. b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
  44870. n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
  44871. hash: hash.sha256,
  44872. gRed: false,
  44873. g: [
  44874. 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
  44875. 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',
  44876. ],
  44877. });
  44878. defineCurve('p256', {
  44879. type: 'short',
  44880. prime: null,
  44881. p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
  44882. a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
  44883. b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
  44884. n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
  44885. hash: hash.sha256,
  44886. gRed: false,
  44887. g: [
  44888. '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
  44889. '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',
  44890. ],
  44891. });
  44892. defineCurve('p384', {
  44893. type: 'short',
  44894. prime: null,
  44895. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44896. 'fffffffe ffffffff 00000000 00000000 ffffffff',
  44897. a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44898. 'fffffffe ffffffff 00000000 00000000 fffffffc',
  44899. b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
  44900. '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
  44901. n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
  44902. 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
  44903. hash: hash.sha384,
  44904. gRed: false,
  44905. g: [
  44906. 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
  44907. '5502f25d bf55296c 3a545e38 72760ab7',
  44908. '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
  44909. '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',
  44910. ],
  44911. });
  44912. defineCurve('p521', {
  44913. type: 'short',
  44914. prime: null,
  44915. p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44916. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44917. 'ffffffff ffffffff ffffffff ffffffff ffffffff',
  44918. a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44919. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44920. 'ffffffff ffffffff ffffffff ffffffff fffffffc',
  44921. b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
  44922. '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
  44923. '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
  44924. n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  44925. 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
  44926. 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
  44927. hash: hash.sha512,
  44928. gRed: false,
  44929. g: [
  44930. '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
  44931. '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
  44932. 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
  44933. '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
  44934. '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
  44935. '3fad0761 353c7086 a272c240 88be9476 9fd16650',
  44936. ],
  44937. });
  44938. defineCurve('curve25519', {
  44939. type: 'mont',
  44940. prime: 'p25519',
  44941. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  44942. a: '76d06',
  44943. b: '1',
  44944. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  44945. hash: hash.sha256,
  44946. gRed: false,
  44947. g: [
  44948. '9',
  44949. ],
  44950. });
  44951. defineCurve('ed25519', {
  44952. type: 'edwards',
  44953. prime: 'p25519',
  44954. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  44955. a: '-1',
  44956. c: '1',
  44957. // -121665 * (121666^(-1)) (mod P)
  44958. d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
  44959. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  44960. hash: hash.sha256,
  44961. gRed: false,
  44962. g: [
  44963. '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
  44964. // 4/5
  44965. '6666666666666666666666666666666666666666666666666666666666666658',
  44966. ],
  44967. });
  44968. var pre;
  44969. try {
  44970. pre = __webpack_require__(/*! ./precomputed/secp256k1 */ 230);
  44971. } catch (e) {
  44972. pre = undefined;
  44973. }
  44974. defineCurve('secp256k1', {
  44975. type: 'short',
  44976. prime: 'k256',
  44977. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
  44978. a: '0',
  44979. b: '7',
  44980. n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
  44981. h: '1',
  44982. hash: hash.sha256,
  44983. // Precomputed endomorphism
  44984. beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
  44985. lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
  44986. basis: [
  44987. {
  44988. a: '3086d221a7d46bcde86c90e49284eb15',
  44989. b: '-e4437ed6010e88286f547fa90abfe4c3',
  44990. },
  44991. {
  44992. a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
  44993. b: '3086d221a7d46bcde86c90e49284eb15',
  44994. },
  44995. ],
  44996. gRed: false,
  44997. g: [
  44998. '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
  44999. '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
  45000. pre,
  45001. ],
  45002. });
  45003. /***/ }),
  45004. /* 218 */
  45005. /*!******************************************!*\
  45006. !*** ./node_modules/hash.js/lib/hash.js ***!
  45007. \******************************************/
  45008. /*! no static exports found */
  45009. /***/ (function(module, exports, __webpack_require__) {
  45010. var hash = exports;
  45011. hash.utils = __webpack_require__(/*! ./hash/utils */ 219);
  45012. hash.common = __webpack_require__(/*! ./hash/common */ 220);
  45013. hash.sha = __webpack_require__(/*! ./hash/sha */ 221);
  45014. hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ 228);
  45015. hash.hmac = __webpack_require__(/*! ./hash/hmac */ 229);
  45016. // Proxy hash functions to the main object
  45017. hash.sha1 = hash.sha.sha1;
  45018. hash.sha256 = hash.sha.sha256;
  45019. hash.sha224 = hash.sha.sha224;
  45020. hash.sha384 = hash.sha.sha384;
  45021. hash.sha512 = hash.sha.sha512;
  45022. hash.ripemd160 = hash.ripemd.ripemd160;
  45023. /***/ }),
  45024. /* 219 */
  45025. /*!************************************************!*\
  45026. !*** ./node_modules/hash.js/lib/hash/utils.js ***!
  45027. \************************************************/
  45028. /*! no static exports found */
  45029. /***/ (function(module, exports, __webpack_require__) {
  45030. "use strict";
  45031. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  45032. var inherits = __webpack_require__(/*! inherits */ 121);
  45033. exports.inherits = inherits;
  45034. function isSurrogatePair(msg, i) {
  45035. if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {
  45036. return false;
  45037. }
  45038. if (i < 0 || i + 1 >= msg.length) {
  45039. return false;
  45040. }
  45041. return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;
  45042. }
  45043. function toArray(msg, enc) {
  45044. if (Array.isArray(msg))
  45045. return msg.slice();
  45046. if (!msg)
  45047. return [];
  45048. var res = [];
  45049. if (typeof msg === 'string') {
  45050. if (!enc) {
  45051. // Inspired by stringToUtf8ByteArray() in closure-library by Google
  45052. // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143
  45053. // Apache License 2.0
  45054. // https://github.com/google/closure-library/blob/master/LICENSE
  45055. var p = 0;
  45056. for (var i = 0; i < msg.length; i++) {
  45057. var c = msg.charCodeAt(i);
  45058. if (c < 128) {
  45059. res[p++] = c;
  45060. } else if (c < 2048) {
  45061. res[p++] = (c >> 6) | 192;
  45062. res[p++] = (c & 63) | 128;
  45063. } else if (isSurrogatePair(msg, i)) {
  45064. c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);
  45065. res[p++] = (c >> 18) | 240;
  45066. res[p++] = ((c >> 12) & 63) | 128;
  45067. res[p++] = ((c >> 6) & 63) | 128;
  45068. res[p++] = (c & 63) | 128;
  45069. } else {
  45070. res[p++] = (c >> 12) | 224;
  45071. res[p++] = ((c >> 6) & 63) | 128;
  45072. res[p++] = (c & 63) | 128;
  45073. }
  45074. }
  45075. } else if (enc === 'hex') {
  45076. msg = msg.replace(/[^a-z0-9]+/ig, '');
  45077. if (msg.length % 2 !== 0)
  45078. msg = '0' + msg;
  45079. for (i = 0; i < msg.length; i += 2)
  45080. res.push(parseInt(msg[i] + msg[i + 1], 16));
  45081. }
  45082. } else {
  45083. for (i = 0; i < msg.length; i++)
  45084. res[i] = msg[i] | 0;
  45085. }
  45086. return res;
  45087. }
  45088. exports.toArray = toArray;
  45089. function toHex(msg) {
  45090. var res = '';
  45091. for (var i = 0; i < msg.length; i++)
  45092. res += zero2(msg[i].toString(16));
  45093. return res;
  45094. }
  45095. exports.toHex = toHex;
  45096. function htonl(w) {
  45097. var res = (w >>> 24) |
  45098. ((w >>> 8) & 0xff00) |
  45099. ((w << 8) & 0xff0000) |
  45100. ((w & 0xff) << 24);
  45101. return res >>> 0;
  45102. }
  45103. exports.htonl = htonl;
  45104. function toHex32(msg, endian) {
  45105. var res = '';
  45106. for (var i = 0; i < msg.length; i++) {
  45107. var w = msg[i];
  45108. if (endian === 'little')
  45109. w = htonl(w);
  45110. res += zero8(w.toString(16));
  45111. }
  45112. return res;
  45113. }
  45114. exports.toHex32 = toHex32;
  45115. function zero2(word) {
  45116. if (word.length === 1)
  45117. return '0' + word;
  45118. else
  45119. return word;
  45120. }
  45121. exports.zero2 = zero2;
  45122. function zero8(word) {
  45123. if (word.length === 7)
  45124. return '0' + word;
  45125. else if (word.length === 6)
  45126. return '00' + word;
  45127. else if (word.length === 5)
  45128. return '000' + word;
  45129. else if (word.length === 4)
  45130. return '0000' + word;
  45131. else if (word.length === 3)
  45132. return '00000' + word;
  45133. else if (word.length === 2)
  45134. return '000000' + word;
  45135. else if (word.length === 1)
  45136. return '0000000' + word;
  45137. else
  45138. return word;
  45139. }
  45140. exports.zero8 = zero8;
  45141. function join32(msg, start, end, endian) {
  45142. var len = end - start;
  45143. assert(len % 4 === 0);
  45144. var res = new Array(len / 4);
  45145. for (var i = 0, k = start; i < res.length; i++, k += 4) {
  45146. var w;
  45147. if (endian === 'big')
  45148. w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
  45149. else
  45150. w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
  45151. res[i] = w >>> 0;
  45152. }
  45153. return res;
  45154. }
  45155. exports.join32 = join32;
  45156. function split32(msg, endian) {
  45157. var res = new Array(msg.length * 4);
  45158. for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
  45159. var m = msg[i];
  45160. if (endian === 'big') {
  45161. res[k] = m >>> 24;
  45162. res[k + 1] = (m >>> 16) & 0xff;
  45163. res[k + 2] = (m >>> 8) & 0xff;
  45164. res[k + 3] = m & 0xff;
  45165. } else {
  45166. res[k + 3] = m >>> 24;
  45167. res[k + 2] = (m >>> 16) & 0xff;
  45168. res[k + 1] = (m >>> 8) & 0xff;
  45169. res[k] = m & 0xff;
  45170. }
  45171. }
  45172. return res;
  45173. }
  45174. exports.split32 = split32;
  45175. function rotr32(w, b) {
  45176. return (w >>> b) | (w << (32 - b));
  45177. }
  45178. exports.rotr32 = rotr32;
  45179. function rotl32(w, b) {
  45180. return (w << b) | (w >>> (32 - b));
  45181. }
  45182. exports.rotl32 = rotl32;
  45183. function sum32(a, b) {
  45184. return (a + b) >>> 0;
  45185. }
  45186. exports.sum32 = sum32;
  45187. function sum32_3(a, b, c) {
  45188. return (a + b + c) >>> 0;
  45189. }
  45190. exports.sum32_3 = sum32_3;
  45191. function sum32_4(a, b, c, d) {
  45192. return (a + b + c + d) >>> 0;
  45193. }
  45194. exports.sum32_4 = sum32_4;
  45195. function sum32_5(a, b, c, d, e) {
  45196. return (a + b + c + d + e) >>> 0;
  45197. }
  45198. exports.sum32_5 = sum32_5;
  45199. function sum64(buf, pos, ah, al) {
  45200. var bh = buf[pos];
  45201. var bl = buf[pos + 1];
  45202. var lo = (al + bl) >>> 0;
  45203. var hi = (lo < al ? 1 : 0) + ah + bh;
  45204. buf[pos] = hi >>> 0;
  45205. buf[pos + 1] = lo;
  45206. }
  45207. exports.sum64 = sum64;
  45208. function sum64_hi(ah, al, bh, bl) {
  45209. var lo = (al + bl) >>> 0;
  45210. var hi = (lo < al ? 1 : 0) + ah + bh;
  45211. return hi >>> 0;
  45212. }
  45213. exports.sum64_hi = sum64_hi;
  45214. function sum64_lo(ah, al, bh, bl) {
  45215. var lo = al + bl;
  45216. return lo >>> 0;
  45217. }
  45218. exports.sum64_lo = sum64_lo;
  45219. function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
  45220. var carry = 0;
  45221. var lo = al;
  45222. lo = (lo + bl) >>> 0;
  45223. carry += lo < al ? 1 : 0;
  45224. lo = (lo + cl) >>> 0;
  45225. carry += lo < cl ? 1 : 0;
  45226. lo = (lo + dl) >>> 0;
  45227. carry += lo < dl ? 1 : 0;
  45228. var hi = ah + bh + ch + dh + carry;
  45229. return hi >>> 0;
  45230. }
  45231. exports.sum64_4_hi = sum64_4_hi;
  45232. function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
  45233. var lo = al + bl + cl + dl;
  45234. return lo >>> 0;
  45235. }
  45236. exports.sum64_4_lo = sum64_4_lo;
  45237. function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  45238. var carry = 0;
  45239. var lo = al;
  45240. lo = (lo + bl) >>> 0;
  45241. carry += lo < al ? 1 : 0;
  45242. lo = (lo + cl) >>> 0;
  45243. carry += lo < cl ? 1 : 0;
  45244. lo = (lo + dl) >>> 0;
  45245. carry += lo < dl ? 1 : 0;
  45246. lo = (lo + el) >>> 0;
  45247. carry += lo < el ? 1 : 0;
  45248. var hi = ah + bh + ch + dh + eh + carry;
  45249. return hi >>> 0;
  45250. }
  45251. exports.sum64_5_hi = sum64_5_hi;
  45252. function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  45253. var lo = al + bl + cl + dl + el;
  45254. return lo >>> 0;
  45255. }
  45256. exports.sum64_5_lo = sum64_5_lo;
  45257. function rotr64_hi(ah, al, num) {
  45258. var r = (al << (32 - num)) | (ah >>> num);
  45259. return r >>> 0;
  45260. }
  45261. exports.rotr64_hi = rotr64_hi;
  45262. function rotr64_lo(ah, al, num) {
  45263. var r = (ah << (32 - num)) | (al >>> num);
  45264. return r >>> 0;
  45265. }
  45266. exports.rotr64_lo = rotr64_lo;
  45267. function shr64_hi(ah, al, num) {
  45268. return ah >>> num;
  45269. }
  45270. exports.shr64_hi = shr64_hi;
  45271. function shr64_lo(ah, al, num) {
  45272. var r = (ah << (32 - num)) | (al >>> num);
  45273. return r >>> 0;
  45274. }
  45275. exports.shr64_lo = shr64_lo;
  45276. /***/ }),
  45277. /* 220 */
  45278. /*!*************************************************!*\
  45279. !*** ./node_modules/hash.js/lib/hash/common.js ***!
  45280. \*************************************************/
  45281. /*! no static exports found */
  45282. /***/ (function(module, exports, __webpack_require__) {
  45283. "use strict";
  45284. var utils = __webpack_require__(/*! ./utils */ 219);
  45285. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  45286. function BlockHash() {
  45287. this.pending = null;
  45288. this.pendingTotal = 0;
  45289. this.blockSize = this.constructor.blockSize;
  45290. this.outSize = this.constructor.outSize;
  45291. this.hmacStrength = this.constructor.hmacStrength;
  45292. this.padLength = this.constructor.padLength / 8;
  45293. this.endian = 'big';
  45294. this._delta8 = this.blockSize / 8;
  45295. this._delta32 = this.blockSize / 32;
  45296. }
  45297. exports.BlockHash = BlockHash;
  45298. BlockHash.prototype.update = function update(msg, enc) {
  45299. // Convert message to array, pad it, and join into 32bit blocks
  45300. msg = utils.toArray(msg, enc);
  45301. if (!this.pending)
  45302. this.pending = msg;
  45303. else
  45304. this.pending = this.pending.concat(msg);
  45305. this.pendingTotal += msg.length;
  45306. // Enough data, try updating
  45307. if (this.pending.length >= this._delta8) {
  45308. msg = this.pending;
  45309. // Process pending data in blocks
  45310. var r = msg.length % this._delta8;
  45311. this.pending = msg.slice(msg.length - r, msg.length);
  45312. if (this.pending.length === 0)
  45313. this.pending = null;
  45314. msg = utils.join32(msg, 0, msg.length - r, this.endian);
  45315. for (var i = 0; i < msg.length; i += this._delta32)
  45316. this._update(msg, i, i + this._delta32);
  45317. }
  45318. return this;
  45319. };
  45320. BlockHash.prototype.digest = function digest(enc) {
  45321. this.update(this._pad());
  45322. assert(this.pending === null);
  45323. return this._digest(enc);
  45324. };
  45325. BlockHash.prototype._pad = function pad() {
  45326. var len = this.pendingTotal;
  45327. var bytes = this._delta8;
  45328. var k = bytes - ((len + this.padLength) % bytes);
  45329. var res = new Array(k + this.padLength);
  45330. res[0] = 0x80;
  45331. for (var i = 1; i < k; i++)
  45332. res[i] = 0;
  45333. // Append length
  45334. len <<= 3;
  45335. if (this.endian === 'big') {
  45336. for (var t = 8; t < this.padLength; t++)
  45337. res[i++] = 0;
  45338. res[i++] = 0;
  45339. res[i++] = 0;
  45340. res[i++] = 0;
  45341. res[i++] = 0;
  45342. res[i++] = (len >>> 24) & 0xff;
  45343. res[i++] = (len >>> 16) & 0xff;
  45344. res[i++] = (len >>> 8) & 0xff;
  45345. res[i++] = len & 0xff;
  45346. } else {
  45347. res[i++] = len & 0xff;
  45348. res[i++] = (len >>> 8) & 0xff;
  45349. res[i++] = (len >>> 16) & 0xff;
  45350. res[i++] = (len >>> 24) & 0xff;
  45351. res[i++] = 0;
  45352. res[i++] = 0;
  45353. res[i++] = 0;
  45354. res[i++] = 0;
  45355. for (t = 8; t < this.padLength; t++)
  45356. res[i++] = 0;
  45357. }
  45358. return res;
  45359. };
  45360. /***/ }),
  45361. /* 221 */
  45362. /*!**********************************************!*\
  45363. !*** ./node_modules/hash.js/lib/hash/sha.js ***!
  45364. \**********************************************/
  45365. /*! no static exports found */
  45366. /***/ (function(module, exports, __webpack_require__) {
  45367. "use strict";
  45368. exports.sha1 = __webpack_require__(/*! ./sha/1 */ 222);
  45369. exports.sha224 = __webpack_require__(/*! ./sha/224 */ 224);
  45370. exports.sha256 = __webpack_require__(/*! ./sha/256 */ 225);
  45371. exports.sha384 = __webpack_require__(/*! ./sha/384 */ 226);
  45372. exports.sha512 = __webpack_require__(/*! ./sha/512 */ 227);
  45373. /***/ }),
  45374. /* 222 */
  45375. /*!************************************************!*\
  45376. !*** ./node_modules/hash.js/lib/hash/sha/1.js ***!
  45377. \************************************************/
  45378. /*! no static exports found */
  45379. /***/ (function(module, exports, __webpack_require__) {
  45380. "use strict";
  45381. var utils = __webpack_require__(/*! ../utils */ 219);
  45382. var common = __webpack_require__(/*! ../common */ 220);
  45383. var shaCommon = __webpack_require__(/*! ./common */ 223);
  45384. var rotl32 = utils.rotl32;
  45385. var sum32 = utils.sum32;
  45386. var sum32_5 = utils.sum32_5;
  45387. var ft_1 = shaCommon.ft_1;
  45388. var BlockHash = common.BlockHash;
  45389. var sha1_K = [
  45390. 0x5A827999, 0x6ED9EBA1,
  45391. 0x8F1BBCDC, 0xCA62C1D6
  45392. ];
  45393. function SHA1() {
  45394. if (!(this instanceof SHA1))
  45395. return new SHA1();
  45396. BlockHash.call(this);
  45397. this.h = [
  45398. 0x67452301, 0xefcdab89, 0x98badcfe,
  45399. 0x10325476, 0xc3d2e1f0 ];
  45400. this.W = new Array(80);
  45401. }
  45402. utils.inherits(SHA1, BlockHash);
  45403. module.exports = SHA1;
  45404. SHA1.blockSize = 512;
  45405. SHA1.outSize = 160;
  45406. SHA1.hmacStrength = 80;
  45407. SHA1.padLength = 64;
  45408. SHA1.prototype._update = function _update(msg, start) {
  45409. var W = this.W;
  45410. for (var i = 0; i < 16; i++)
  45411. W[i] = msg[start + i];
  45412. for(; i < W.length; i++)
  45413. W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
  45414. var a = this.h[0];
  45415. var b = this.h[1];
  45416. var c = this.h[2];
  45417. var d = this.h[3];
  45418. var e = this.h[4];
  45419. for (i = 0; i < W.length; i++) {
  45420. var s = ~~(i / 20);
  45421. var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
  45422. e = d;
  45423. d = c;
  45424. c = rotl32(b, 30);
  45425. b = a;
  45426. a = t;
  45427. }
  45428. this.h[0] = sum32(this.h[0], a);
  45429. this.h[1] = sum32(this.h[1], b);
  45430. this.h[2] = sum32(this.h[2], c);
  45431. this.h[3] = sum32(this.h[3], d);
  45432. this.h[4] = sum32(this.h[4], e);
  45433. };
  45434. SHA1.prototype._digest = function digest(enc) {
  45435. if (enc === 'hex')
  45436. return utils.toHex32(this.h, 'big');
  45437. else
  45438. return utils.split32(this.h, 'big');
  45439. };
  45440. /***/ }),
  45441. /* 223 */
  45442. /*!*****************************************************!*\
  45443. !*** ./node_modules/hash.js/lib/hash/sha/common.js ***!
  45444. \*****************************************************/
  45445. /*! no static exports found */
  45446. /***/ (function(module, exports, __webpack_require__) {
  45447. "use strict";
  45448. var utils = __webpack_require__(/*! ../utils */ 219);
  45449. var rotr32 = utils.rotr32;
  45450. function ft_1(s, x, y, z) {
  45451. if (s === 0)
  45452. return ch32(x, y, z);
  45453. if (s === 1 || s === 3)
  45454. return p32(x, y, z);
  45455. if (s === 2)
  45456. return maj32(x, y, z);
  45457. }
  45458. exports.ft_1 = ft_1;
  45459. function ch32(x, y, z) {
  45460. return (x & y) ^ ((~x) & z);
  45461. }
  45462. exports.ch32 = ch32;
  45463. function maj32(x, y, z) {
  45464. return (x & y) ^ (x & z) ^ (y & z);
  45465. }
  45466. exports.maj32 = maj32;
  45467. function p32(x, y, z) {
  45468. return x ^ y ^ z;
  45469. }
  45470. exports.p32 = p32;
  45471. function s0_256(x) {
  45472. return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
  45473. }
  45474. exports.s0_256 = s0_256;
  45475. function s1_256(x) {
  45476. return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
  45477. }
  45478. exports.s1_256 = s1_256;
  45479. function g0_256(x) {
  45480. return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
  45481. }
  45482. exports.g0_256 = g0_256;
  45483. function g1_256(x) {
  45484. return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
  45485. }
  45486. exports.g1_256 = g1_256;
  45487. /***/ }),
  45488. /* 224 */
  45489. /*!**************************************************!*\
  45490. !*** ./node_modules/hash.js/lib/hash/sha/224.js ***!
  45491. \**************************************************/
  45492. /*! no static exports found */
  45493. /***/ (function(module, exports, __webpack_require__) {
  45494. "use strict";
  45495. var utils = __webpack_require__(/*! ../utils */ 219);
  45496. var SHA256 = __webpack_require__(/*! ./256 */ 225);
  45497. function SHA224() {
  45498. if (!(this instanceof SHA224))
  45499. return new SHA224();
  45500. SHA256.call(this);
  45501. this.h = [
  45502. 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  45503. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
  45504. }
  45505. utils.inherits(SHA224, SHA256);
  45506. module.exports = SHA224;
  45507. SHA224.blockSize = 512;
  45508. SHA224.outSize = 224;
  45509. SHA224.hmacStrength = 192;
  45510. SHA224.padLength = 64;
  45511. SHA224.prototype._digest = function digest(enc) {
  45512. // Just truncate output
  45513. if (enc === 'hex')
  45514. return utils.toHex32(this.h.slice(0, 7), 'big');
  45515. else
  45516. return utils.split32(this.h.slice(0, 7), 'big');
  45517. };
  45518. /***/ }),
  45519. /* 225 */
  45520. /*!**************************************************!*\
  45521. !*** ./node_modules/hash.js/lib/hash/sha/256.js ***!
  45522. \**************************************************/
  45523. /*! no static exports found */
  45524. /***/ (function(module, exports, __webpack_require__) {
  45525. "use strict";
  45526. var utils = __webpack_require__(/*! ../utils */ 219);
  45527. var common = __webpack_require__(/*! ../common */ 220);
  45528. var shaCommon = __webpack_require__(/*! ./common */ 223);
  45529. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  45530. var sum32 = utils.sum32;
  45531. var sum32_4 = utils.sum32_4;
  45532. var sum32_5 = utils.sum32_5;
  45533. var ch32 = shaCommon.ch32;
  45534. var maj32 = shaCommon.maj32;
  45535. var s0_256 = shaCommon.s0_256;
  45536. var s1_256 = shaCommon.s1_256;
  45537. var g0_256 = shaCommon.g0_256;
  45538. var g1_256 = shaCommon.g1_256;
  45539. var BlockHash = common.BlockHash;
  45540. var sha256_K = [
  45541. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
  45542. 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
  45543. 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
  45544. 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
  45545. 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  45546. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
  45547. 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
  45548. 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
  45549. 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
  45550. 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  45551. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
  45552. 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
  45553. 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
  45554. 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
  45555. 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  45556. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
  45557. ];
  45558. function SHA256() {
  45559. if (!(this instanceof SHA256))
  45560. return new SHA256();
  45561. BlockHash.call(this);
  45562. this.h = [
  45563. 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
  45564. 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
  45565. ];
  45566. this.k = sha256_K;
  45567. this.W = new Array(64);
  45568. }
  45569. utils.inherits(SHA256, BlockHash);
  45570. module.exports = SHA256;
  45571. SHA256.blockSize = 512;
  45572. SHA256.outSize = 256;
  45573. SHA256.hmacStrength = 192;
  45574. SHA256.padLength = 64;
  45575. SHA256.prototype._update = function _update(msg, start) {
  45576. var W = this.W;
  45577. for (var i = 0; i < 16; i++)
  45578. W[i] = msg[start + i];
  45579. for (; i < W.length; i++)
  45580. W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
  45581. var a = this.h[0];
  45582. var b = this.h[1];
  45583. var c = this.h[2];
  45584. var d = this.h[3];
  45585. var e = this.h[4];
  45586. var f = this.h[5];
  45587. var g = this.h[6];
  45588. var h = this.h[7];
  45589. assert(this.k.length === W.length);
  45590. for (i = 0; i < W.length; i++) {
  45591. var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
  45592. var T2 = sum32(s0_256(a), maj32(a, b, c));
  45593. h = g;
  45594. g = f;
  45595. f = e;
  45596. e = sum32(d, T1);
  45597. d = c;
  45598. c = b;
  45599. b = a;
  45600. a = sum32(T1, T2);
  45601. }
  45602. this.h[0] = sum32(this.h[0], a);
  45603. this.h[1] = sum32(this.h[1], b);
  45604. this.h[2] = sum32(this.h[2], c);
  45605. this.h[3] = sum32(this.h[3], d);
  45606. this.h[4] = sum32(this.h[4], e);
  45607. this.h[5] = sum32(this.h[5], f);
  45608. this.h[6] = sum32(this.h[6], g);
  45609. this.h[7] = sum32(this.h[7], h);
  45610. };
  45611. SHA256.prototype._digest = function digest(enc) {
  45612. if (enc === 'hex')
  45613. return utils.toHex32(this.h, 'big');
  45614. else
  45615. return utils.split32(this.h, 'big');
  45616. };
  45617. /***/ }),
  45618. /* 226 */
  45619. /*!**************************************************!*\
  45620. !*** ./node_modules/hash.js/lib/hash/sha/384.js ***!
  45621. \**************************************************/
  45622. /*! no static exports found */
  45623. /***/ (function(module, exports, __webpack_require__) {
  45624. "use strict";
  45625. var utils = __webpack_require__(/*! ../utils */ 219);
  45626. var SHA512 = __webpack_require__(/*! ./512 */ 227);
  45627. function SHA384() {
  45628. if (!(this instanceof SHA384))
  45629. return new SHA384();
  45630. SHA512.call(this);
  45631. this.h = [
  45632. 0xcbbb9d5d, 0xc1059ed8,
  45633. 0x629a292a, 0x367cd507,
  45634. 0x9159015a, 0x3070dd17,
  45635. 0x152fecd8, 0xf70e5939,
  45636. 0x67332667, 0xffc00b31,
  45637. 0x8eb44a87, 0x68581511,
  45638. 0xdb0c2e0d, 0x64f98fa7,
  45639. 0x47b5481d, 0xbefa4fa4 ];
  45640. }
  45641. utils.inherits(SHA384, SHA512);
  45642. module.exports = SHA384;
  45643. SHA384.blockSize = 1024;
  45644. SHA384.outSize = 384;
  45645. SHA384.hmacStrength = 192;
  45646. SHA384.padLength = 128;
  45647. SHA384.prototype._digest = function digest(enc) {
  45648. if (enc === 'hex')
  45649. return utils.toHex32(this.h.slice(0, 12), 'big');
  45650. else
  45651. return utils.split32(this.h.slice(0, 12), 'big');
  45652. };
  45653. /***/ }),
  45654. /* 227 */
  45655. /*!**************************************************!*\
  45656. !*** ./node_modules/hash.js/lib/hash/sha/512.js ***!
  45657. \**************************************************/
  45658. /*! no static exports found */
  45659. /***/ (function(module, exports, __webpack_require__) {
  45660. "use strict";
  45661. var utils = __webpack_require__(/*! ../utils */ 219);
  45662. var common = __webpack_require__(/*! ../common */ 220);
  45663. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  45664. var rotr64_hi = utils.rotr64_hi;
  45665. var rotr64_lo = utils.rotr64_lo;
  45666. var shr64_hi = utils.shr64_hi;
  45667. var shr64_lo = utils.shr64_lo;
  45668. var sum64 = utils.sum64;
  45669. var sum64_hi = utils.sum64_hi;
  45670. var sum64_lo = utils.sum64_lo;
  45671. var sum64_4_hi = utils.sum64_4_hi;
  45672. var sum64_4_lo = utils.sum64_4_lo;
  45673. var sum64_5_hi = utils.sum64_5_hi;
  45674. var sum64_5_lo = utils.sum64_5_lo;
  45675. var BlockHash = common.BlockHash;
  45676. var sha512_K = [
  45677. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  45678. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  45679. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  45680. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  45681. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  45682. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  45683. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  45684. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  45685. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  45686. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  45687. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  45688. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  45689. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  45690. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  45691. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  45692. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  45693. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  45694. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  45695. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  45696. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  45697. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  45698. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  45699. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  45700. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  45701. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  45702. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  45703. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  45704. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  45705. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  45706. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  45707. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  45708. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  45709. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  45710. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  45711. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  45712. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  45713. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  45714. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  45715. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  45716. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  45717. ];
  45718. function SHA512() {
  45719. if (!(this instanceof SHA512))
  45720. return new SHA512();
  45721. BlockHash.call(this);
  45722. this.h = [
  45723. 0x6a09e667, 0xf3bcc908,
  45724. 0xbb67ae85, 0x84caa73b,
  45725. 0x3c6ef372, 0xfe94f82b,
  45726. 0xa54ff53a, 0x5f1d36f1,
  45727. 0x510e527f, 0xade682d1,
  45728. 0x9b05688c, 0x2b3e6c1f,
  45729. 0x1f83d9ab, 0xfb41bd6b,
  45730. 0x5be0cd19, 0x137e2179 ];
  45731. this.k = sha512_K;
  45732. this.W = new Array(160);
  45733. }
  45734. utils.inherits(SHA512, BlockHash);
  45735. module.exports = SHA512;
  45736. SHA512.blockSize = 1024;
  45737. SHA512.outSize = 512;
  45738. SHA512.hmacStrength = 192;
  45739. SHA512.padLength = 128;
  45740. SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
  45741. var W = this.W;
  45742. // 32 x 32bit words
  45743. for (var i = 0; i < 32; i++)
  45744. W[i] = msg[start + i];
  45745. for (; i < W.length; i += 2) {
  45746. var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
  45747. var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
  45748. var c1_hi = W[i - 14]; // i - 7
  45749. var c1_lo = W[i - 13];
  45750. var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
  45751. var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
  45752. var c3_hi = W[i - 32]; // i - 16
  45753. var c3_lo = W[i - 31];
  45754. W[i] = sum64_4_hi(
  45755. c0_hi, c0_lo,
  45756. c1_hi, c1_lo,
  45757. c2_hi, c2_lo,
  45758. c3_hi, c3_lo);
  45759. W[i + 1] = sum64_4_lo(
  45760. c0_hi, c0_lo,
  45761. c1_hi, c1_lo,
  45762. c2_hi, c2_lo,
  45763. c3_hi, c3_lo);
  45764. }
  45765. };
  45766. SHA512.prototype._update = function _update(msg, start) {
  45767. this._prepareBlock(msg, start);
  45768. var W = this.W;
  45769. var ah = this.h[0];
  45770. var al = this.h[1];
  45771. var bh = this.h[2];
  45772. var bl = this.h[3];
  45773. var ch = this.h[4];
  45774. var cl = this.h[5];
  45775. var dh = this.h[6];
  45776. var dl = this.h[7];
  45777. var eh = this.h[8];
  45778. var el = this.h[9];
  45779. var fh = this.h[10];
  45780. var fl = this.h[11];
  45781. var gh = this.h[12];
  45782. var gl = this.h[13];
  45783. var hh = this.h[14];
  45784. var hl = this.h[15];
  45785. assert(this.k.length === W.length);
  45786. for (var i = 0; i < W.length; i += 2) {
  45787. var c0_hi = hh;
  45788. var c0_lo = hl;
  45789. var c1_hi = s1_512_hi(eh, el);
  45790. var c1_lo = s1_512_lo(eh, el);
  45791. var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
  45792. var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
  45793. var c3_hi = this.k[i];
  45794. var c3_lo = this.k[i + 1];
  45795. var c4_hi = W[i];
  45796. var c4_lo = W[i + 1];
  45797. var T1_hi = sum64_5_hi(
  45798. c0_hi, c0_lo,
  45799. c1_hi, c1_lo,
  45800. c2_hi, c2_lo,
  45801. c3_hi, c3_lo,
  45802. c4_hi, c4_lo);
  45803. var T1_lo = sum64_5_lo(
  45804. c0_hi, c0_lo,
  45805. c1_hi, c1_lo,
  45806. c2_hi, c2_lo,
  45807. c3_hi, c3_lo,
  45808. c4_hi, c4_lo);
  45809. c0_hi = s0_512_hi(ah, al);
  45810. c0_lo = s0_512_lo(ah, al);
  45811. c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
  45812. c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
  45813. var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
  45814. var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
  45815. hh = gh;
  45816. hl = gl;
  45817. gh = fh;
  45818. gl = fl;
  45819. fh = eh;
  45820. fl = el;
  45821. eh = sum64_hi(dh, dl, T1_hi, T1_lo);
  45822. el = sum64_lo(dl, dl, T1_hi, T1_lo);
  45823. dh = ch;
  45824. dl = cl;
  45825. ch = bh;
  45826. cl = bl;
  45827. bh = ah;
  45828. bl = al;
  45829. ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
  45830. al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
  45831. }
  45832. sum64(this.h, 0, ah, al);
  45833. sum64(this.h, 2, bh, bl);
  45834. sum64(this.h, 4, ch, cl);
  45835. sum64(this.h, 6, dh, dl);
  45836. sum64(this.h, 8, eh, el);
  45837. sum64(this.h, 10, fh, fl);
  45838. sum64(this.h, 12, gh, gl);
  45839. sum64(this.h, 14, hh, hl);
  45840. };
  45841. SHA512.prototype._digest = function digest(enc) {
  45842. if (enc === 'hex')
  45843. return utils.toHex32(this.h, 'big');
  45844. else
  45845. return utils.split32(this.h, 'big');
  45846. };
  45847. function ch64_hi(xh, xl, yh, yl, zh) {
  45848. var r = (xh & yh) ^ ((~xh) & zh);
  45849. if (r < 0)
  45850. r += 0x100000000;
  45851. return r;
  45852. }
  45853. function ch64_lo(xh, xl, yh, yl, zh, zl) {
  45854. var r = (xl & yl) ^ ((~xl) & zl);
  45855. if (r < 0)
  45856. r += 0x100000000;
  45857. return r;
  45858. }
  45859. function maj64_hi(xh, xl, yh, yl, zh) {
  45860. var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
  45861. if (r < 0)
  45862. r += 0x100000000;
  45863. return r;
  45864. }
  45865. function maj64_lo(xh, xl, yh, yl, zh, zl) {
  45866. var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
  45867. if (r < 0)
  45868. r += 0x100000000;
  45869. return r;
  45870. }
  45871. function s0_512_hi(xh, xl) {
  45872. var c0_hi = rotr64_hi(xh, xl, 28);
  45873. var c1_hi = rotr64_hi(xl, xh, 2); // 34
  45874. var c2_hi = rotr64_hi(xl, xh, 7); // 39
  45875. var r = c0_hi ^ c1_hi ^ c2_hi;
  45876. if (r < 0)
  45877. r += 0x100000000;
  45878. return r;
  45879. }
  45880. function s0_512_lo(xh, xl) {
  45881. var c0_lo = rotr64_lo(xh, xl, 28);
  45882. var c1_lo = rotr64_lo(xl, xh, 2); // 34
  45883. var c2_lo = rotr64_lo(xl, xh, 7); // 39
  45884. var r = c0_lo ^ c1_lo ^ c2_lo;
  45885. if (r < 0)
  45886. r += 0x100000000;
  45887. return r;
  45888. }
  45889. function s1_512_hi(xh, xl) {
  45890. var c0_hi = rotr64_hi(xh, xl, 14);
  45891. var c1_hi = rotr64_hi(xh, xl, 18);
  45892. var c2_hi = rotr64_hi(xl, xh, 9); // 41
  45893. var r = c0_hi ^ c1_hi ^ c2_hi;
  45894. if (r < 0)
  45895. r += 0x100000000;
  45896. return r;
  45897. }
  45898. function s1_512_lo(xh, xl) {
  45899. var c0_lo = rotr64_lo(xh, xl, 14);
  45900. var c1_lo = rotr64_lo(xh, xl, 18);
  45901. var c2_lo = rotr64_lo(xl, xh, 9); // 41
  45902. var r = c0_lo ^ c1_lo ^ c2_lo;
  45903. if (r < 0)
  45904. r += 0x100000000;
  45905. return r;
  45906. }
  45907. function g0_512_hi(xh, xl) {
  45908. var c0_hi = rotr64_hi(xh, xl, 1);
  45909. var c1_hi = rotr64_hi(xh, xl, 8);
  45910. var c2_hi = shr64_hi(xh, xl, 7);
  45911. var r = c0_hi ^ c1_hi ^ c2_hi;
  45912. if (r < 0)
  45913. r += 0x100000000;
  45914. return r;
  45915. }
  45916. function g0_512_lo(xh, xl) {
  45917. var c0_lo = rotr64_lo(xh, xl, 1);
  45918. var c1_lo = rotr64_lo(xh, xl, 8);
  45919. var c2_lo = shr64_lo(xh, xl, 7);
  45920. var r = c0_lo ^ c1_lo ^ c2_lo;
  45921. if (r < 0)
  45922. r += 0x100000000;
  45923. return r;
  45924. }
  45925. function g1_512_hi(xh, xl) {
  45926. var c0_hi = rotr64_hi(xh, xl, 19);
  45927. var c1_hi = rotr64_hi(xl, xh, 29); // 61
  45928. var c2_hi = shr64_hi(xh, xl, 6);
  45929. var r = c0_hi ^ c1_hi ^ c2_hi;
  45930. if (r < 0)
  45931. r += 0x100000000;
  45932. return r;
  45933. }
  45934. function g1_512_lo(xh, xl) {
  45935. var c0_lo = rotr64_lo(xh, xl, 19);
  45936. var c1_lo = rotr64_lo(xl, xh, 29); // 61
  45937. var c2_lo = shr64_lo(xh, xl, 6);
  45938. var r = c0_lo ^ c1_lo ^ c2_lo;
  45939. if (r < 0)
  45940. r += 0x100000000;
  45941. return r;
  45942. }
  45943. /***/ }),
  45944. /* 228 */
  45945. /*!*************************************************!*\
  45946. !*** ./node_modules/hash.js/lib/hash/ripemd.js ***!
  45947. \*************************************************/
  45948. /*! no static exports found */
  45949. /***/ (function(module, exports, __webpack_require__) {
  45950. "use strict";
  45951. var utils = __webpack_require__(/*! ./utils */ 219);
  45952. var common = __webpack_require__(/*! ./common */ 220);
  45953. var rotl32 = utils.rotl32;
  45954. var sum32 = utils.sum32;
  45955. var sum32_3 = utils.sum32_3;
  45956. var sum32_4 = utils.sum32_4;
  45957. var BlockHash = common.BlockHash;
  45958. function RIPEMD160() {
  45959. if (!(this instanceof RIPEMD160))
  45960. return new RIPEMD160();
  45961. BlockHash.call(this);
  45962. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
  45963. this.endian = 'little';
  45964. }
  45965. utils.inherits(RIPEMD160, BlockHash);
  45966. exports.ripemd160 = RIPEMD160;
  45967. RIPEMD160.blockSize = 512;
  45968. RIPEMD160.outSize = 160;
  45969. RIPEMD160.hmacStrength = 192;
  45970. RIPEMD160.padLength = 64;
  45971. RIPEMD160.prototype._update = function update(msg, start) {
  45972. var A = this.h[0];
  45973. var B = this.h[1];
  45974. var C = this.h[2];
  45975. var D = this.h[3];
  45976. var E = this.h[4];
  45977. var Ah = A;
  45978. var Bh = B;
  45979. var Ch = C;
  45980. var Dh = D;
  45981. var Eh = E;
  45982. for (var j = 0; j < 80; j++) {
  45983. var T = sum32(
  45984. rotl32(
  45985. sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
  45986. s[j]),
  45987. E);
  45988. A = E;
  45989. E = D;
  45990. D = rotl32(C, 10);
  45991. C = B;
  45992. B = T;
  45993. T = sum32(
  45994. rotl32(
  45995. sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
  45996. sh[j]),
  45997. Eh);
  45998. Ah = Eh;
  45999. Eh = Dh;
  46000. Dh = rotl32(Ch, 10);
  46001. Ch = Bh;
  46002. Bh = T;
  46003. }
  46004. T = sum32_3(this.h[1], C, Dh);
  46005. this.h[1] = sum32_3(this.h[2], D, Eh);
  46006. this.h[2] = sum32_3(this.h[3], E, Ah);
  46007. this.h[3] = sum32_3(this.h[4], A, Bh);
  46008. this.h[4] = sum32_3(this.h[0], B, Ch);
  46009. this.h[0] = T;
  46010. };
  46011. RIPEMD160.prototype._digest = function digest(enc) {
  46012. if (enc === 'hex')
  46013. return utils.toHex32(this.h, 'little');
  46014. else
  46015. return utils.split32(this.h, 'little');
  46016. };
  46017. function f(j, x, y, z) {
  46018. if (j <= 15)
  46019. return x ^ y ^ z;
  46020. else if (j <= 31)
  46021. return (x & y) | ((~x) & z);
  46022. else if (j <= 47)
  46023. return (x | (~y)) ^ z;
  46024. else if (j <= 63)
  46025. return (x & z) | (y & (~z));
  46026. else
  46027. return x ^ (y | (~z));
  46028. }
  46029. function K(j) {
  46030. if (j <= 15)
  46031. return 0x00000000;
  46032. else if (j <= 31)
  46033. return 0x5a827999;
  46034. else if (j <= 47)
  46035. return 0x6ed9eba1;
  46036. else if (j <= 63)
  46037. return 0x8f1bbcdc;
  46038. else
  46039. return 0xa953fd4e;
  46040. }
  46041. function Kh(j) {
  46042. if (j <= 15)
  46043. return 0x50a28be6;
  46044. else if (j <= 31)
  46045. return 0x5c4dd124;
  46046. else if (j <= 47)
  46047. return 0x6d703ef3;
  46048. else if (j <= 63)
  46049. return 0x7a6d76e9;
  46050. else
  46051. return 0x00000000;
  46052. }
  46053. var r = [
  46054. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  46055. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  46056. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  46057. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  46058. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  46059. ];
  46060. var rh = [
  46061. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  46062. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  46063. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  46064. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  46065. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  46066. ];
  46067. var s = [
  46068. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  46069. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  46070. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  46071. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  46072. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  46073. ];
  46074. var sh = [
  46075. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  46076. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  46077. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  46078. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  46079. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  46080. ];
  46081. /***/ }),
  46082. /* 229 */
  46083. /*!***********************************************!*\
  46084. !*** ./node_modules/hash.js/lib/hash/hmac.js ***!
  46085. \***********************************************/
  46086. /*! no static exports found */
  46087. /***/ (function(module, exports, __webpack_require__) {
  46088. "use strict";
  46089. var utils = __webpack_require__(/*! ./utils */ 219);
  46090. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  46091. function Hmac(hash, key, enc) {
  46092. if (!(this instanceof Hmac))
  46093. return new Hmac(hash, key, enc);
  46094. this.Hash = hash;
  46095. this.blockSize = hash.blockSize / 8;
  46096. this.outSize = hash.outSize / 8;
  46097. this.inner = null;
  46098. this.outer = null;
  46099. this._init(utils.toArray(key, enc));
  46100. }
  46101. module.exports = Hmac;
  46102. Hmac.prototype._init = function init(key) {
  46103. // Shorten key, if needed
  46104. if (key.length > this.blockSize)
  46105. key = new this.Hash().update(key).digest();
  46106. assert(key.length <= this.blockSize);
  46107. // Add padding to key
  46108. for (var i = key.length; i < this.blockSize; i++)
  46109. key.push(0);
  46110. for (i = 0; i < key.length; i++)
  46111. key[i] ^= 0x36;
  46112. this.inner = new this.Hash().update(key);
  46113. // 0x36 ^ 0x5c = 0x6a
  46114. for (i = 0; i < key.length; i++)
  46115. key[i] ^= 0x6a;
  46116. this.outer = new this.Hash().update(key);
  46117. };
  46118. Hmac.prototype.update = function update(msg, enc) {
  46119. this.inner.update(msg, enc);
  46120. return this;
  46121. };
  46122. Hmac.prototype.digest = function digest(enc) {
  46123. this.outer.update(this.inner.digest());
  46124. return this.outer.digest(enc);
  46125. };
  46126. /***/ }),
  46127. /* 230 */
  46128. /*!*********************************************************************!*\
  46129. !*** ./node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***!
  46130. \*********************************************************************/
  46131. /*! no static exports found */
  46132. /***/ (function(module, exports) {
  46133. module.exports = {
  46134. doubles: {
  46135. step: 4,
  46136. points: [
  46137. [
  46138. 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
  46139. 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821',
  46140. ],
  46141. [
  46142. '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
  46143. '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf',
  46144. ],
  46145. [
  46146. '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
  46147. 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695',
  46148. ],
  46149. [
  46150. '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
  46151. '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9',
  46152. ],
  46153. [
  46154. '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
  46155. '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36',
  46156. ],
  46157. [
  46158. '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
  46159. '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f',
  46160. ],
  46161. [
  46162. 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
  46163. '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999',
  46164. ],
  46165. [
  46166. '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
  46167. 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09',
  46168. ],
  46169. [
  46170. 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
  46171. '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d',
  46172. ],
  46173. [
  46174. 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
  46175. 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088',
  46176. ],
  46177. [
  46178. 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
  46179. '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d',
  46180. ],
  46181. [
  46182. '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
  46183. '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8',
  46184. ],
  46185. [
  46186. '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
  46187. '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a',
  46188. ],
  46189. [
  46190. '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
  46191. '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453',
  46192. ],
  46193. [
  46194. '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
  46195. '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160',
  46196. ],
  46197. [
  46198. '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
  46199. '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0',
  46200. ],
  46201. [
  46202. '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
  46203. '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6',
  46204. ],
  46205. [
  46206. '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
  46207. '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589',
  46208. ],
  46209. [
  46210. '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
  46211. 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17',
  46212. ],
  46213. [
  46214. 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
  46215. '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda',
  46216. ],
  46217. [
  46218. 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
  46219. '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd',
  46220. ],
  46221. [
  46222. '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
  46223. '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2',
  46224. ],
  46225. [
  46226. '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
  46227. '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6',
  46228. ],
  46229. [
  46230. 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
  46231. '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f',
  46232. ],
  46233. [
  46234. '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
  46235. 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01',
  46236. ],
  46237. [
  46238. 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
  46239. '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3',
  46240. ],
  46241. [
  46242. 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
  46243. 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f',
  46244. ],
  46245. [
  46246. 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
  46247. '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7',
  46248. ],
  46249. [
  46250. 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
  46251. 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78',
  46252. ],
  46253. [
  46254. 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
  46255. '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1',
  46256. ],
  46257. [
  46258. '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
  46259. 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150',
  46260. ],
  46261. [
  46262. '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
  46263. '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82',
  46264. ],
  46265. [
  46266. 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
  46267. '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc',
  46268. ],
  46269. [
  46270. '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
  46271. 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b',
  46272. ],
  46273. [
  46274. 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
  46275. '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51',
  46276. ],
  46277. [
  46278. 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
  46279. '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45',
  46280. ],
  46281. [
  46282. 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
  46283. 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120',
  46284. ],
  46285. [
  46286. '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
  46287. '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84',
  46288. ],
  46289. [
  46290. '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
  46291. '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d',
  46292. ],
  46293. [
  46294. '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
  46295. 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d',
  46296. ],
  46297. [
  46298. '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
  46299. '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8',
  46300. ],
  46301. [
  46302. 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
  46303. '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8',
  46304. ],
  46305. [
  46306. '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
  46307. '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac',
  46308. ],
  46309. [
  46310. '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
  46311. 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f',
  46312. ],
  46313. [
  46314. '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
  46315. '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962',
  46316. ],
  46317. [
  46318. 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
  46319. '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907',
  46320. ],
  46321. [
  46322. '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
  46323. 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec',
  46324. ],
  46325. [
  46326. 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
  46327. 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d',
  46328. ],
  46329. [
  46330. 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
  46331. '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414',
  46332. ],
  46333. [
  46334. '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
  46335. 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd',
  46336. ],
  46337. [
  46338. '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
  46339. 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0',
  46340. ],
  46341. [
  46342. 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
  46343. '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811',
  46344. ],
  46345. [
  46346. 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
  46347. '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1',
  46348. ],
  46349. [
  46350. 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
  46351. '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c',
  46352. ],
  46353. [
  46354. '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
  46355. 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73',
  46356. ],
  46357. [
  46358. '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
  46359. '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd',
  46360. ],
  46361. [
  46362. 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
  46363. 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405',
  46364. ],
  46365. [
  46366. '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
  46367. 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589',
  46368. ],
  46369. [
  46370. '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
  46371. '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e',
  46372. ],
  46373. [
  46374. '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
  46375. '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27',
  46376. ],
  46377. [
  46378. 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
  46379. 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1',
  46380. ],
  46381. [
  46382. '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
  46383. '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482',
  46384. ],
  46385. [
  46386. '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
  46387. '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945',
  46388. ],
  46389. [
  46390. 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
  46391. '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573',
  46392. ],
  46393. [
  46394. 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
  46395. 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82',
  46396. ],
  46397. ],
  46398. },
  46399. naf: {
  46400. wnd: 7,
  46401. points: [
  46402. [
  46403. 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
  46404. '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672',
  46405. ],
  46406. [
  46407. '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
  46408. 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6',
  46409. ],
  46410. [
  46411. '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
  46412. '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da',
  46413. ],
  46414. [
  46415. 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
  46416. 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37',
  46417. ],
  46418. [
  46419. '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
  46420. 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b',
  46421. ],
  46422. [
  46423. 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
  46424. 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81',
  46425. ],
  46426. [
  46427. 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
  46428. '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58',
  46429. ],
  46430. [
  46431. 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
  46432. '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77',
  46433. ],
  46434. [
  46435. '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
  46436. '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a',
  46437. ],
  46438. [
  46439. '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
  46440. '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c',
  46441. ],
  46442. [
  46443. '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
  46444. '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67',
  46445. ],
  46446. [
  46447. '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
  46448. '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402',
  46449. ],
  46450. [
  46451. 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
  46452. 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55',
  46453. ],
  46454. [
  46455. 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
  46456. '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482',
  46457. ],
  46458. [
  46459. '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
  46460. 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82',
  46461. ],
  46462. [
  46463. '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
  46464. 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396',
  46465. ],
  46466. [
  46467. '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
  46468. '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49',
  46469. ],
  46470. [
  46471. '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
  46472. '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf',
  46473. ],
  46474. [
  46475. '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
  46476. '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a',
  46477. ],
  46478. [
  46479. '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
  46480. 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7',
  46481. ],
  46482. [
  46483. 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
  46484. 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933',
  46485. ],
  46486. [
  46487. '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
  46488. '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a',
  46489. ],
  46490. [
  46491. '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
  46492. '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6',
  46493. ],
  46494. [
  46495. 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
  46496. 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37',
  46497. ],
  46498. [
  46499. '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
  46500. '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e',
  46501. ],
  46502. [
  46503. 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
  46504. 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6',
  46505. ],
  46506. [
  46507. 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
  46508. 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476',
  46509. ],
  46510. [
  46511. '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
  46512. '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40',
  46513. ],
  46514. [
  46515. '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
  46516. '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61',
  46517. ],
  46518. [
  46519. '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
  46520. '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683',
  46521. ],
  46522. [
  46523. 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
  46524. '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5',
  46525. ],
  46526. [
  46527. '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
  46528. '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b',
  46529. ],
  46530. [
  46531. 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
  46532. '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417',
  46533. ],
  46534. [
  46535. '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
  46536. 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868',
  46537. ],
  46538. [
  46539. '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
  46540. 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a',
  46541. ],
  46542. [
  46543. 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
  46544. 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6',
  46545. ],
  46546. [
  46547. '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
  46548. '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996',
  46549. ],
  46550. [
  46551. '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
  46552. 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e',
  46553. ],
  46554. [
  46555. 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
  46556. 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d',
  46557. ],
  46558. [
  46559. '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
  46560. '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2',
  46561. ],
  46562. [
  46563. '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
  46564. 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e',
  46565. ],
  46566. [
  46567. '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
  46568. '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437',
  46569. ],
  46570. [
  46571. '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
  46572. 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311',
  46573. ],
  46574. [
  46575. 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
  46576. '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4',
  46577. ],
  46578. [
  46579. '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
  46580. '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575',
  46581. ],
  46582. [
  46583. '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
  46584. 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d',
  46585. ],
  46586. [
  46587. '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
  46588. 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d',
  46589. ],
  46590. [
  46591. 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
  46592. 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629',
  46593. ],
  46594. [
  46595. 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
  46596. 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06',
  46597. ],
  46598. [
  46599. '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
  46600. '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374',
  46601. ],
  46602. [
  46603. '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
  46604. '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee',
  46605. ],
  46606. [
  46607. 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
  46608. '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1',
  46609. ],
  46610. [
  46611. 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
  46612. 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b',
  46613. ],
  46614. [
  46615. '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
  46616. '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661',
  46617. ],
  46618. [
  46619. '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
  46620. '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6',
  46621. ],
  46622. [
  46623. 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
  46624. '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e',
  46625. ],
  46626. [
  46627. '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
  46628. '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d',
  46629. ],
  46630. [
  46631. 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
  46632. 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc',
  46633. ],
  46634. [
  46635. '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
  46636. 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4',
  46637. ],
  46638. [
  46639. '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
  46640. '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c',
  46641. ],
  46642. [
  46643. 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
  46644. '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b',
  46645. ],
  46646. [
  46647. 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
  46648. '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913',
  46649. ],
  46650. [
  46651. '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
  46652. '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154',
  46653. ],
  46654. [
  46655. '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
  46656. '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865',
  46657. ],
  46658. [
  46659. '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
  46660. 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc',
  46661. ],
  46662. [
  46663. '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
  46664. 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224',
  46665. ],
  46666. [
  46667. '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
  46668. '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e',
  46669. ],
  46670. [
  46671. '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
  46672. '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6',
  46673. ],
  46674. [
  46675. '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
  46676. '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511',
  46677. ],
  46678. [
  46679. '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
  46680. 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b',
  46681. ],
  46682. [
  46683. 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
  46684. 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2',
  46685. ],
  46686. [
  46687. '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
  46688. 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c',
  46689. ],
  46690. [
  46691. 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
  46692. '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3',
  46693. ],
  46694. [
  46695. 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
  46696. '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d',
  46697. ],
  46698. [
  46699. 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
  46700. '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700',
  46701. ],
  46702. [
  46703. 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
  46704. '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4',
  46705. ],
  46706. [
  46707. '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
  46708. 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196',
  46709. ],
  46710. [
  46711. '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
  46712. '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4',
  46713. ],
  46714. [
  46715. '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
  46716. 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257',
  46717. ],
  46718. [
  46719. 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
  46720. 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13',
  46721. ],
  46722. [
  46723. 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
  46724. '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096',
  46725. ],
  46726. [
  46727. 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
  46728. 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38',
  46729. ],
  46730. [
  46731. 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
  46732. '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f',
  46733. ],
  46734. [
  46735. '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
  46736. '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448',
  46737. ],
  46738. [
  46739. 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
  46740. '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a',
  46741. ],
  46742. [
  46743. 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
  46744. '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4',
  46745. ],
  46746. [
  46747. '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
  46748. '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437',
  46749. ],
  46750. [
  46751. '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
  46752. 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7',
  46753. ],
  46754. [
  46755. 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
  46756. '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d',
  46757. ],
  46758. [
  46759. 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
  46760. '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a',
  46761. ],
  46762. [
  46763. 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
  46764. '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54',
  46765. ],
  46766. [
  46767. '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
  46768. '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77',
  46769. ],
  46770. [
  46771. 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
  46772. 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517',
  46773. ],
  46774. [
  46775. '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
  46776. 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10',
  46777. ],
  46778. [
  46779. 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
  46780. 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125',
  46781. ],
  46782. [
  46783. 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
  46784. '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e',
  46785. ],
  46786. [
  46787. '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
  46788. 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1',
  46789. ],
  46790. [
  46791. 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
  46792. '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2',
  46793. ],
  46794. [
  46795. 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
  46796. '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423',
  46797. ],
  46798. [
  46799. 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
  46800. '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8',
  46801. ],
  46802. [
  46803. '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
  46804. 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758',
  46805. ],
  46806. [
  46807. '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
  46808. 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375',
  46809. ],
  46810. [
  46811. 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
  46812. '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d',
  46813. ],
  46814. [
  46815. '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
  46816. 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec',
  46817. ],
  46818. [
  46819. '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
  46820. '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0',
  46821. ],
  46822. [
  46823. '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
  46824. 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c',
  46825. ],
  46826. [
  46827. 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
  46828. 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4',
  46829. ],
  46830. [
  46831. '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
  46832. 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f',
  46833. ],
  46834. [
  46835. '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
  46836. '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649',
  46837. ],
  46838. [
  46839. '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
  46840. 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826',
  46841. ],
  46842. [
  46843. '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
  46844. '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5',
  46845. ],
  46846. [
  46847. 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
  46848. 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87',
  46849. ],
  46850. [
  46851. '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
  46852. '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b',
  46853. ],
  46854. [
  46855. 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
  46856. '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc',
  46857. ],
  46858. [
  46859. '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
  46860. '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c',
  46861. ],
  46862. [
  46863. 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
  46864. 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f',
  46865. ],
  46866. [
  46867. 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
  46868. '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a',
  46869. ],
  46870. [
  46871. 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
  46872. 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46',
  46873. ],
  46874. [
  46875. '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
  46876. 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f',
  46877. ],
  46878. [
  46879. '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
  46880. '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03',
  46881. ],
  46882. [
  46883. '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
  46884. 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08',
  46885. ],
  46886. [
  46887. '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
  46888. '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8',
  46889. ],
  46890. [
  46891. '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
  46892. '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373',
  46893. ],
  46894. [
  46895. '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
  46896. 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3',
  46897. ],
  46898. [
  46899. '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
  46900. '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8',
  46901. ],
  46902. [
  46903. '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
  46904. '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1',
  46905. ],
  46906. [
  46907. '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
  46908. '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9',
  46909. ],
  46910. ],
  46911. },
  46912. };
  46913. /***/ }),
  46914. /* 231 */
  46915. /*!********************************************************!*\
  46916. !*** ./node_modules/elliptic/lib/elliptic/ec/index.js ***!
  46917. \********************************************************/
  46918. /*! no static exports found */
  46919. /***/ (function(module, exports, __webpack_require__) {
  46920. "use strict";
  46921. var BN = __webpack_require__(/*! bn.js */ 197);
  46922. var HmacDRBG = __webpack_require__(/*! hmac-drbg */ 232);
  46923. var utils = __webpack_require__(/*! ../utils */ 210);
  46924. var curves = __webpack_require__(/*! ../curves */ 217);
  46925. var rand = __webpack_require__(/*! brorand */ 201);
  46926. var assert = utils.assert;
  46927. var KeyPair = __webpack_require__(/*! ./key */ 233);
  46928. var Signature = __webpack_require__(/*! ./signature */ 234);
  46929. function EC(options) {
  46930. if (!(this instanceof EC))
  46931. return new EC(options);
  46932. // Shortcut `elliptic.ec(curve-name)`
  46933. if (typeof options === 'string') {
  46934. assert(Object.prototype.hasOwnProperty.call(curves, options),
  46935. 'Unknown curve ' + options);
  46936. options = curves[options];
  46937. }
  46938. // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
  46939. if (options instanceof curves.PresetCurve)
  46940. options = { curve: options };
  46941. this.curve = options.curve.curve;
  46942. this.n = this.curve.n;
  46943. this.nh = this.n.ushrn(1);
  46944. this.g = this.curve.g;
  46945. // Point on curve
  46946. this.g = options.curve.g;
  46947. this.g.precompute(options.curve.n.bitLength() + 1);
  46948. // Hash for function for DRBG
  46949. this.hash = options.hash || options.curve.hash;
  46950. }
  46951. module.exports = EC;
  46952. EC.prototype.keyPair = function keyPair(options) {
  46953. return new KeyPair(this, options);
  46954. };
  46955. EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
  46956. return KeyPair.fromPrivate(this, priv, enc);
  46957. };
  46958. EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
  46959. return KeyPair.fromPublic(this, pub, enc);
  46960. };
  46961. EC.prototype.genKeyPair = function genKeyPair(options) {
  46962. if (!options)
  46963. options = {};
  46964. // Instantiate Hmac_DRBG
  46965. var drbg = new HmacDRBG({
  46966. hash: this.hash,
  46967. pers: options.pers,
  46968. persEnc: options.persEnc || 'utf8',
  46969. entropy: options.entropy || rand(this.hash.hmacStrength),
  46970. entropyEnc: options.entropy && options.entropyEnc || 'utf8',
  46971. nonce: this.n.toArray(),
  46972. });
  46973. var bytes = this.n.byteLength();
  46974. var ns2 = this.n.sub(new BN(2));
  46975. for (;;) {
  46976. var priv = new BN(drbg.generate(bytes));
  46977. if (priv.cmp(ns2) > 0)
  46978. continue;
  46979. priv.iaddn(1);
  46980. return this.keyFromPrivate(priv);
  46981. }
  46982. };
  46983. EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) {
  46984. var delta = msg.byteLength() * 8 - this.n.bitLength();
  46985. if (delta > 0)
  46986. msg = msg.ushrn(delta);
  46987. if (!truncOnly && msg.cmp(this.n) >= 0)
  46988. return msg.sub(this.n);
  46989. else
  46990. return msg;
  46991. };
  46992. EC.prototype.sign = function sign(msg, key, enc, options) {
  46993. if (typeof enc === 'object') {
  46994. options = enc;
  46995. enc = null;
  46996. }
  46997. if (!options)
  46998. options = {};
  46999. key = this.keyFromPrivate(key, enc);
  47000. msg = this._truncateToN(new BN(msg, 16));
  47001. // Zero-extend key to provide enough entropy
  47002. var bytes = this.n.byteLength();
  47003. var bkey = key.getPrivate().toArray('be', bytes);
  47004. // Zero-extend nonce to have the same byte size as N
  47005. var nonce = msg.toArray('be', bytes);
  47006. // Instantiate Hmac_DRBG
  47007. var drbg = new HmacDRBG({
  47008. hash: this.hash,
  47009. entropy: bkey,
  47010. nonce: nonce,
  47011. pers: options.pers,
  47012. persEnc: options.persEnc || 'utf8',
  47013. });
  47014. // Number of bytes to generate
  47015. var ns1 = this.n.sub(new BN(1));
  47016. for (var iter = 0; ; iter++) {
  47017. var k = options.k ?
  47018. options.k(iter) :
  47019. new BN(drbg.generate(this.n.byteLength()));
  47020. k = this._truncateToN(k, true);
  47021. if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
  47022. continue;
  47023. var kp = this.g.mul(k);
  47024. if (kp.isInfinity())
  47025. continue;
  47026. var kpX = kp.getX();
  47027. var r = kpX.umod(this.n);
  47028. if (r.cmpn(0) === 0)
  47029. continue;
  47030. var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
  47031. s = s.umod(this.n);
  47032. if (s.cmpn(0) === 0)
  47033. continue;
  47034. var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
  47035. (kpX.cmp(r) !== 0 ? 2 : 0);
  47036. // Use complement of `s`, if it is > `n / 2`
  47037. if (options.canonical && s.cmp(this.nh) > 0) {
  47038. s = this.n.sub(s);
  47039. recoveryParam ^= 1;
  47040. }
  47041. return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
  47042. }
  47043. };
  47044. EC.prototype.verify = function verify(msg, signature, key, enc) {
  47045. msg = this._truncateToN(new BN(msg, 16));
  47046. key = this.keyFromPublic(key, enc);
  47047. signature = new Signature(signature, 'hex');
  47048. // Perform primitive values validation
  47049. var r = signature.r;
  47050. var s = signature.s;
  47051. if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
  47052. return false;
  47053. if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
  47054. return false;
  47055. // Validate signature
  47056. var sinv = s.invm(this.n);
  47057. var u1 = sinv.mul(msg).umod(this.n);
  47058. var u2 = sinv.mul(r).umod(this.n);
  47059. var p;
  47060. if (!this.curve._maxwellTrick) {
  47061. p = this.g.mulAdd(u1, key.getPublic(), u2);
  47062. if (p.isInfinity())
  47063. return false;
  47064. return p.getX().umod(this.n).cmp(r) === 0;
  47065. }
  47066. // NOTE: Greg Maxwell's trick, inspired by:
  47067. // https://git.io/vad3K
  47068. p = this.g.jmulAdd(u1, key.getPublic(), u2);
  47069. if (p.isInfinity())
  47070. return false;
  47071. // Compare `p.x` of Jacobian point with `r`,
  47072. // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
  47073. // inverse of `p.z^2`
  47074. return p.eqXToP(r);
  47075. };
  47076. EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
  47077. assert((3 & j) === j, 'The recovery param is more than two bits');
  47078. signature = new Signature(signature, enc);
  47079. var n = this.n;
  47080. var e = new BN(msg);
  47081. var r = signature.r;
  47082. var s = signature.s;
  47083. // A set LSB signifies that the y-coordinate is odd
  47084. var isYOdd = j & 1;
  47085. var isSecondKey = j >> 1;
  47086. if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
  47087. throw new Error('Unable to find sencond key candinate');
  47088. // 1.1. Let x = r + jn.
  47089. if (isSecondKey)
  47090. r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
  47091. else
  47092. r = this.curve.pointFromX(r, isYOdd);
  47093. var rInv = signature.r.invm(n);
  47094. var s1 = n.sub(e).mul(rInv).umod(n);
  47095. var s2 = s.mul(rInv).umod(n);
  47096. // 1.6.1 Compute Q = r^-1 (sR - eG)
  47097. // Q = r^-1 (sR + -eG)
  47098. return this.g.mulAdd(s1, r, s2);
  47099. };
  47100. EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
  47101. signature = new Signature(signature, enc);
  47102. if (signature.recoveryParam !== null)
  47103. return signature.recoveryParam;
  47104. for (var i = 0; i < 4; i++) {
  47105. var Qprime;
  47106. try {
  47107. Qprime = this.recoverPubKey(e, signature, i);
  47108. } catch (e) {
  47109. continue;
  47110. }
  47111. if (Qprime.eq(Q))
  47112. return i;
  47113. }
  47114. throw new Error('Unable to find valid recovery factor');
  47115. };
  47116. /***/ }),
  47117. /* 232 */
  47118. /*!*************************************************!*\
  47119. !*** ./node_modules/hmac-drbg/lib/hmac-drbg.js ***!
  47120. \*************************************************/
  47121. /*! no static exports found */
  47122. /***/ (function(module, exports, __webpack_require__) {
  47123. "use strict";
  47124. var hash = __webpack_require__(/*! hash.js */ 218);
  47125. var utils = __webpack_require__(/*! minimalistic-crypto-utils */ 211);
  47126. var assert = __webpack_require__(/*! minimalistic-assert */ 171);
  47127. function HmacDRBG(options) {
  47128. if (!(this instanceof HmacDRBG))
  47129. return new HmacDRBG(options);
  47130. this.hash = options.hash;
  47131. this.predResist = !!options.predResist;
  47132. this.outLen = this.hash.outSize;
  47133. this.minEntropy = options.minEntropy || this.hash.hmacStrength;
  47134. this._reseed = null;
  47135. this.reseedInterval = null;
  47136. this.K = null;
  47137. this.V = null;
  47138. var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex');
  47139. var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex');
  47140. var pers = utils.toArray(options.pers, options.persEnc || 'hex');
  47141. assert(entropy.length >= (this.minEntropy / 8),
  47142. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  47143. this._init(entropy, nonce, pers);
  47144. }
  47145. module.exports = HmacDRBG;
  47146. HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
  47147. var seed = entropy.concat(nonce).concat(pers);
  47148. this.K = new Array(this.outLen / 8);
  47149. this.V = new Array(this.outLen / 8);
  47150. for (var i = 0; i < this.V.length; i++) {
  47151. this.K[i] = 0x00;
  47152. this.V[i] = 0x01;
  47153. }
  47154. this._update(seed);
  47155. this._reseed = 1;
  47156. this.reseedInterval = 0x1000000000000; // 2^48
  47157. };
  47158. HmacDRBG.prototype._hmac = function hmac() {
  47159. return new hash.hmac(this.hash, this.K);
  47160. };
  47161. HmacDRBG.prototype._update = function update(seed) {
  47162. var kmac = this._hmac()
  47163. .update(this.V)
  47164. .update([ 0x00 ]);
  47165. if (seed)
  47166. kmac = kmac.update(seed);
  47167. this.K = kmac.digest();
  47168. this.V = this._hmac().update(this.V).digest();
  47169. if (!seed)
  47170. return;
  47171. this.K = this._hmac()
  47172. .update(this.V)
  47173. .update([ 0x01 ])
  47174. .update(seed)
  47175. .digest();
  47176. this.V = this._hmac().update(this.V).digest();
  47177. };
  47178. HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
  47179. // Optional entropy enc
  47180. if (typeof entropyEnc !== 'string') {
  47181. addEnc = add;
  47182. add = entropyEnc;
  47183. entropyEnc = null;
  47184. }
  47185. entropy = utils.toArray(entropy, entropyEnc);
  47186. add = utils.toArray(add, addEnc);
  47187. assert(entropy.length >= (this.minEntropy / 8),
  47188. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  47189. this._update(entropy.concat(add || []));
  47190. this._reseed = 1;
  47191. };
  47192. HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
  47193. if (this._reseed > this.reseedInterval)
  47194. throw new Error('Reseed is required');
  47195. // Optional encoding
  47196. if (typeof enc !== 'string') {
  47197. addEnc = add;
  47198. add = enc;
  47199. enc = null;
  47200. }
  47201. // Optional additional data
  47202. if (add) {
  47203. add = utils.toArray(add, addEnc || 'hex');
  47204. this._update(add);
  47205. }
  47206. var temp = [];
  47207. while (temp.length < len) {
  47208. this.V = this._hmac().update(this.V).digest();
  47209. temp = temp.concat(this.V);
  47210. }
  47211. var res = temp.slice(0, len);
  47212. this._update(add);
  47213. this._reseed++;
  47214. return utils.encode(res, enc);
  47215. };
  47216. /***/ }),
  47217. /* 233 */
  47218. /*!******************************************************!*\
  47219. !*** ./node_modules/elliptic/lib/elliptic/ec/key.js ***!
  47220. \******************************************************/
  47221. /*! no static exports found */
  47222. /***/ (function(module, exports, __webpack_require__) {
  47223. "use strict";
  47224. var BN = __webpack_require__(/*! bn.js */ 197);
  47225. var utils = __webpack_require__(/*! ../utils */ 210);
  47226. var assert = utils.assert;
  47227. function KeyPair(ec, options) {
  47228. this.ec = ec;
  47229. this.priv = null;
  47230. this.pub = null;
  47231. // KeyPair(ec, { priv: ..., pub: ... })
  47232. if (options.priv)
  47233. this._importPrivate(options.priv, options.privEnc);
  47234. if (options.pub)
  47235. this._importPublic(options.pub, options.pubEnc);
  47236. }
  47237. module.exports = KeyPair;
  47238. KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
  47239. if (pub instanceof KeyPair)
  47240. return pub;
  47241. return new KeyPair(ec, {
  47242. pub: pub,
  47243. pubEnc: enc,
  47244. });
  47245. };
  47246. KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
  47247. if (priv instanceof KeyPair)
  47248. return priv;
  47249. return new KeyPair(ec, {
  47250. priv: priv,
  47251. privEnc: enc,
  47252. });
  47253. };
  47254. KeyPair.prototype.validate = function validate() {
  47255. var pub = this.getPublic();
  47256. if (pub.isInfinity())
  47257. return { result: false, reason: 'Invalid public key' };
  47258. if (!pub.validate())
  47259. return { result: false, reason: 'Public key is not a point' };
  47260. if (!pub.mul(this.ec.curve.n).isInfinity())
  47261. return { result: false, reason: 'Public key * N != O' };
  47262. return { result: true, reason: null };
  47263. };
  47264. KeyPair.prototype.getPublic = function getPublic(compact, enc) {
  47265. // compact is optional argument
  47266. if (typeof compact === 'string') {
  47267. enc = compact;
  47268. compact = null;
  47269. }
  47270. if (!this.pub)
  47271. this.pub = this.ec.g.mul(this.priv);
  47272. if (!enc)
  47273. return this.pub;
  47274. return this.pub.encode(enc, compact);
  47275. };
  47276. KeyPair.prototype.getPrivate = function getPrivate(enc) {
  47277. if (enc === 'hex')
  47278. return this.priv.toString(16, 2);
  47279. else
  47280. return this.priv;
  47281. };
  47282. KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
  47283. this.priv = new BN(key, enc || 16);
  47284. // Ensure that the priv won't be bigger than n, otherwise we may fail
  47285. // in fixed multiplication method
  47286. this.priv = this.priv.umod(this.ec.curve.n);
  47287. };
  47288. KeyPair.prototype._importPublic = function _importPublic(key, enc) {
  47289. if (key.x || key.y) {
  47290. // Montgomery points only have an `x` coordinate.
  47291. // Weierstrass/Edwards points on the other hand have both `x` and
  47292. // `y` coordinates.
  47293. if (this.ec.curve.type === 'mont') {
  47294. assert(key.x, 'Need x coordinate');
  47295. } else if (this.ec.curve.type === 'short' ||
  47296. this.ec.curve.type === 'edwards') {
  47297. assert(key.x && key.y, 'Need both x and y coordinate');
  47298. }
  47299. this.pub = this.ec.curve.point(key.x, key.y);
  47300. return;
  47301. }
  47302. this.pub = this.ec.curve.decodePoint(key, enc);
  47303. };
  47304. // ECDH
  47305. KeyPair.prototype.derive = function derive(pub) {
  47306. if(!pub.validate()) {
  47307. assert(pub.validate(), 'public point not validated');
  47308. }
  47309. return pub.mul(this.priv).getX();
  47310. };
  47311. // ECDSA
  47312. KeyPair.prototype.sign = function sign(msg, enc, options) {
  47313. return this.ec.sign(msg, this, enc, options);
  47314. };
  47315. KeyPair.prototype.verify = function verify(msg, signature) {
  47316. return this.ec.verify(msg, signature, this);
  47317. };
  47318. KeyPair.prototype.inspect = function inspect() {
  47319. return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
  47320. ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
  47321. };
  47322. /***/ }),
  47323. /* 234 */
  47324. /*!************************************************************!*\
  47325. !*** ./node_modules/elliptic/lib/elliptic/ec/signature.js ***!
  47326. \************************************************************/
  47327. /*! no static exports found */
  47328. /***/ (function(module, exports, __webpack_require__) {
  47329. "use strict";
  47330. var BN = __webpack_require__(/*! bn.js */ 197);
  47331. var utils = __webpack_require__(/*! ../utils */ 210);
  47332. var assert = utils.assert;
  47333. function Signature(options, enc) {
  47334. if (options instanceof Signature)
  47335. return options;
  47336. if (this._importDER(options, enc))
  47337. return;
  47338. assert(options.r && options.s, 'Signature without r or s');
  47339. this.r = new BN(options.r, 16);
  47340. this.s = new BN(options.s, 16);
  47341. if (options.recoveryParam === undefined)
  47342. this.recoveryParam = null;
  47343. else
  47344. this.recoveryParam = options.recoveryParam;
  47345. }
  47346. module.exports = Signature;
  47347. function Position() {
  47348. this.place = 0;
  47349. }
  47350. function getLength(buf, p) {
  47351. var initial = buf[p.place++];
  47352. if (!(initial & 0x80)) {
  47353. return initial;
  47354. }
  47355. var octetLen = initial & 0xf;
  47356. // Indefinite length or overflow
  47357. if (octetLen === 0 || octetLen > 4) {
  47358. return false;
  47359. }
  47360. var val = 0;
  47361. for (var i = 0, off = p.place; i < octetLen; i++, off++) {
  47362. val <<= 8;
  47363. val |= buf[off];
  47364. val >>>= 0;
  47365. }
  47366. // Leading zeroes
  47367. if (val <= 0x7f) {
  47368. return false;
  47369. }
  47370. p.place = off;
  47371. return val;
  47372. }
  47373. function rmPadding(buf) {
  47374. var i = 0;
  47375. var len = buf.length - 1;
  47376. while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
  47377. i++;
  47378. }
  47379. if (i === 0) {
  47380. return buf;
  47381. }
  47382. return buf.slice(i);
  47383. }
  47384. Signature.prototype._importDER = function _importDER(data, enc) {
  47385. data = utils.toArray(data, enc);
  47386. var p = new Position();
  47387. if (data[p.place++] !== 0x30) {
  47388. return false;
  47389. }
  47390. var len = getLength(data, p);
  47391. if (len === false) {
  47392. return false;
  47393. }
  47394. if ((len + p.place) !== data.length) {
  47395. return false;
  47396. }
  47397. if (data[p.place++] !== 0x02) {
  47398. return false;
  47399. }
  47400. var rlen = getLength(data, p);
  47401. if (rlen === false) {
  47402. return false;
  47403. }
  47404. var r = data.slice(p.place, rlen + p.place);
  47405. p.place += rlen;
  47406. if (data[p.place++] !== 0x02) {
  47407. return false;
  47408. }
  47409. var slen = getLength(data, p);
  47410. if (slen === false) {
  47411. return false;
  47412. }
  47413. if (data.length !== slen + p.place) {
  47414. return false;
  47415. }
  47416. var s = data.slice(p.place, slen + p.place);
  47417. if (r[0] === 0) {
  47418. if (r[1] & 0x80) {
  47419. r = r.slice(1);
  47420. } else {
  47421. // Leading zeroes
  47422. return false;
  47423. }
  47424. }
  47425. if (s[0] === 0) {
  47426. if (s[1] & 0x80) {
  47427. s = s.slice(1);
  47428. } else {
  47429. // Leading zeroes
  47430. return false;
  47431. }
  47432. }
  47433. this.r = new BN(r);
  47434. this.s = new BN(s);
  47435. this.recoveryParam = null;
  47436. return true;
  47437. };
  47438. function constructLength(arr, len) {
  47439. if (len < 0x80) {
  47440. arr.push(len);
  47441. return;
  47442. }
  47443. var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
  47444. arr.push(octets | 0x80);
  47445. while (--octets) {
  47446. arr.push((len >>> (octets << 3)) & 0xff);
  47447. }
  47448. arr.push(len);
  47449. }
  47450. Signature.prototype.toDER = function toDER(enc) {
  47451. var r = this.r.toArray();
  47452. var s = this.s.toArray();
  47453. // Pad values
  47454. if (r[0] & 0x80)
  47455. r = [ 0 ].concat(r);
  47456. // Pad values
  47457. if (s[0] & 0x80)
  47458. s = [ 0 ].concat(s);
  47459. r = rmPadding(r);
  47460. s = rmPadding(s);
  47461. while (!s[0] && !(s[1] & 0x80)) {
  47462. s = s.slice(1);
  47463. }
  47464. var arr = [ 0x02 ];
  47465. constructLength(arr, r.length);
  47466. arr = arr.concat(r);
  47467. arr.push(0x02);
  47468. constructLength(arr, s.length);
  47469. var backHalf = arr.concat(s);
  47470. var res = [ 0x30 ];
  47471. constructLength(res, backHalf.length);
  47472. res = res.concat(backHalf);
  47473. return utils.encode(res, enc);
  47474. };
  47475. /***/ }),
  47476. /* 235 */
  47477. /*!***********************************************************!*\
  47478. !*** ./node_modules/elliptic/lib/elliptic/eddsa/index.js ***!
  47479. \***********************************************************/
  47480. /*! no static exports found */
  47481. /***/ (function(module, exports, __webpack_require__) {
  47482. "use strict";
  47483. var hash = __webpack_require__(/*! hash.js */ 218);
  47484. var curves = __webpack_require__(/*! ../curves */ 217);
  47485. var utils = __webpack_require__(/*! ../utils */ 210);
  47486. var assert = utils.assert;
  47487. var parseBytes = utils.parseBytes;
  47488. var KeyPair = __webpack_require__(/*! ./key */ 236);
  47489. var Signature = __webpack_require__(/*! ./signature */ 237);
  47490. function EDDSA(curve) {
  47491. assert(curve === 'ed25519', 'only tested with ed25519 so far');
  47492. if (!(this instanceof EDDSA))
  47493. return new EDDSA(curve);
  47494. curve = curves[curve].curve;
  47495. this.curve = curve;
  47496. this.g = curve.g;
  47497. this.g.precompute(curve.n.bitLength() + 1);
  47498. this.pointClass = curve.point().constructor;
  47499. this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
  47500. this.hash = hash.sha512;
  47501. }
  47502. module.exports = EDDSA;
  47503. /**
  47504. * @param {Array|String} message - message bytes
  47505. * @param {Array|String|KeyPair} secret - secret bytes or a keypair
  47506. * @returns {Signature} - signature
  47507. */
  47508. EDDSA.prototype.sign = function sign(message, secret) {
  47509. message = parseBytes(message);
  47510. var key = this.keyFromSecret(secret);
  47511. var r = this.hashInt(key.messagePrefix(), message);
  47512. var R = this.g.mul(r);
  47513. var Rencoded = this.encodePoint(R);
  47514. var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
  47515. .mul(key.priv());
  47516. var S = r.add(s_).umod(this.curve.n);
  47517. return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
  47518. };
  47519. /**
  47520. * @param {Array} message - message bytes
  47521. * @param {Array|String|Signature} sig - sig bytes
  47522. * @param {Array|String|Point|KeyPair} pub - public key
  47523. * @returns {Boolean} - true if public key matches sig of message
  47524. */
  47525. EDDSA.prototype.verify = function verify(message, sig, pub) {
  47526. message = parseBytes(message);
  47527. sig = this.makeSignature(sig);
  47528. var key = this.keyFromPublic(pub);
  47529. var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
  47530. var SG = this.g.mul(sig.S());
  47531. var RplusAh = sig.R().add(key.pub().mul(h));
  47532. return RplusAh.eq(SG);
  47533. };
  47534. EDDSA.prototype.hashInt = function hashInt() {
  47535. var hash = this.hash();
  47536. for (var i = 0; i < arguments.length; i++)
  47537. hash.update(arguments[i]);
  47538. return utils.intFromLE(hash.digest()).umod(this.curve.n);
  47539. };
  47540. EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
  47541. return KeyPair.fromPublic(this, pub);
  47542. };
  47543. EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
  47544. return KeyPair.fromSecret(this, secret);
  47545. };
  47546. EDDSA.prototype.makeSignature = function makeSignature(sig) {
  47547. if (sig instanceof Signature)
  47548. return sig;
  47549. return new Signature(this, sig);
  47550. };
  47551. /**
  47552. * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
  47553. *
  47554. * EDDSA defines methods for encoding and decoding points and integers. These are
  47555. * helper convenience methods, that pass along to utility functions implied
  47556. * parameters.
  47557. *
  47558. */
  47559. EDDSA.prototype.encodePoint = function encodePoint(point) {
  47560. var enc = point.getY().toArray('le', this.encodingLength);
  47561. enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
  47562. return enc;
  47563. };
  47564. EDDSA.prototype.decodePoint = function decodePoint(bytes) {
  47565. bytes = utils.parseBytes(bytes);
  47566. var lastIx = bytes.length - 1;
  47567. var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
  47568. var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
  47569. var y = utils.intFromLE(normed);
  47570. return this.curve.pointFromY(y, xIsOdd);
  47571. };
  47572. EDDSA.prototype.encodeInt = function encodeInt(num) {
  47573. return num.toArray('le', this.encodingLength);
  47574. };
  47575. EDDSA.prototype.decodeInt = function decodeInt(bytes) {
  47576. return utils.intFromLE(bytes);
  47577. };
  47578. EDDSA.prototype.isPoint = function isPoint(val) {
  47579. return val instanceof this.pointClass;
  47580. };
  47581. /***/ }),
  47582. /* 236 */
  47583. /*!*********************************************************!*\
  47584. !*** ./node_modules/elliptic/lib/elliptic/eddsa/key.js ***!
  47585. \*********************************************************/
  47586. /*! no static exports found */
  47587. /***/ (function(module, exports, __webpack_require__) {
  47588. "use strict";
  47589. var utils = __webpack_require__(/*! ../utils */ 210);
  47590. var assert = utils.assert;
  47591. var parseBytes = utils.parseBytes;
  47592. var cachedProperty = utils.cachedProperty;
  47593. /**
  47594. * @param {EDDSA} eddsa - instance
  47595. * @param {Object} params - public/private key parameters
  47596. *
  47597. * @param {Array<Byte>} [params.secret] - secret seed bytes
  47598. * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
  47599. * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
  47600. *
  47601. */
  47602. function KeyPair(eddsa, params) {
  47603. this.eddsa = eddsa;
  47604. this._secret = parseBytes(params.secret);
  47605. if (eddsa.isPoint(params.pub))
  47606. this._pub = params.pub;
  47607. else
  47608. this._pubBytes = parseBytes(params.pub);
  47609. }
  47610. KeyPair.fromPublic = function fromPublic(eddsa, pub) {
  47611. if (pub instanceof KeyPair)
  47612. return pub;
  47613. return new KeyPair(eddsa, { pub: pub });
  47614. };
  47615. KeyPair.fromSecret = function fromSecret(eddsa, secret) {
  47616. if (secret instanceof KeyPair)
  47617. return secret;
  47618. return new KeyPair(eddsa, { secret: secret });
  47619. };
  47620. KeyPair.prototype.secret = function secret() {
  47621. return this._secret;
  47622. };
  47623. cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
  47624. return this.eddsa.encodePoint(this.pub());
  47625. });
  47626. cachedProperty(KeyPair, 'pub', function pub() {
  47627. if (this._pubBytes)
  47628. return this.eddsa.decodePoint(this._pubBytes);
  47629. return this.eddsa.g.mul(this.priv());
  47630. });
  47631. cachedProperty(KeyPair, 'privBytes', function privBytes() {
  47632. var eddsa = this.eddsa;
  47633. var hash = this.hash();
  47634. var lastIx = eddsa.encodingLength - 1;
  47635. var a = hash.slice(0, eddsa.encodingLength);
  47636. a[0] &= 248;
  47637. a[lastIx] &= 127;
  47638. a[lastIx] |= 64;
  47639. return a;
  47640. });
  47641. cachedProperty(KeyPair, 'priv', function priv() {
  47642. return this.eddsa.decodeInt(this.privBytes());
  47643. });
  47644. cachedProperty(KeyPair, 'hash', function hash() {
  47645. return this.eddsa.hash().update(this.secret()).digest();
  47646. });
  47647. cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
  47648. return this.hash().slice(this.eddsa.encodingLength);
  47649. });
  47650. KeyPair.prototype.sign = function sign(message) {
  47651. assert(this._secret, 'KeyPair can only verify');
  47652. return this.eddsa.sign(message, this);
  47653. };
  47654. KeyPair.prototype.verify = function verify(message, sig) {
  47655. return this.eddsa.verify(message, sig, this);
  47656. };
  47657. KeyPair.prototype.getSecret = function getSecret(enc) {
  47658. assert(this._secret, 'KeyPair is public only');
  47659. return utils.encode(this.secret(), enc);
  47660. };
  47661. KeyPair.prototype.getPublic = function getPublic(enc) {
  47662. return utils.encode(this.pubBytes(), enc);
  47663. };
  47664. module.exports = KeyPair;
  47665. /***/ }),
  47666. /* 237 */
  47667. /*!***************************************************************!*\
  47668. !*** ./node_modules/elliptic/lib/elliptic/eddsa/signature.js ***!
  47669. \***************************************************************/
  47670. /*! no static exports found */
  47671. /***/ (function(module, exports, __webpack_require__) {
  47672. "use strict";
  47673. var BN = __webpack_require__(/*! bn.js */ 197);
  47674. var utils = __webpack_require__(/*! ../utils */ 210);
  47675. var assert = utils.assert;
  47676. var cachedProperty = utils.cachedProperty;
  47677. var parseBytes = utils.parseBytes;
  47678. /**
  47679. * @param {EDDSA} eddsa - eddsa instance
  47680. * @param {Array<Bytes>|Object} sig -
  47681. * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
  47682. * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
  47683. * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
  47684. * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
  47685. */
  47686. function Signature(eddsa, sig) {
  47687. this.eddsa = eddsa;
  47688. if (typeof sig !== 'object')
  47689. sig = parseBytes(sig);
  47690. if (Array.isArray(sig)) {
  47691. sig = {
  47692. R: sig.slice(0, eddsa.encodingLength),
  47693. S: sig.slice(eddsa.encodingLength),
  47694. };
  47695. }
  47696. assert(sig.R && sig.S, 'Signature without R or S');
  47697. if (eddsa.isPoint(sig.R))
  47698. this._R = sig.R;
  47699. if (sig.S instanceof BN)
  47700. this._S = sig.S;
  47701. this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
  47702. this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
  47703. }
  47704. cachedProperty(Signature, 'S', function S() {
  47705. return this.eddsa.decodeInt(this.Sencoded());
  47706. });
  47707. cachedProperty(Signature, 'R', function R() {
  47708. return this.eddsa.decodePoint(this.Rencoded());
  47709. });
  47710. cachedProperty(Signature, 'Rencoded', function Rencoded() {
  47711. return this.eddsa.encodePoint(this.R());
  47712. });
  47713. cachedProperty(Signature, 'Sencoded', function Sencoded() {
  47714. return this.eddsa.encodeInt(this.S());
  47715. });
  47716. Signature.prototype.toBytes = function toBytes() {
  47717. return this.Rencoded().concat(this.Sencoded());
  47718. };
  47719. Signature.prototype.toHex = function toHex() {
  47720. return utils.encode(this.toBytes(), 'hex').toUpperCase();
  47721. };
  47722. module.exports = Signature;
  47723. /***/ }),
  47724. /* 238 */
  47725. /*!******************************************!*\
  47726. !*** ./node_modules/parse-asn1/index.js ***!
  47727. \******************************************/
  47728. /*! no static exports found */
  47729. /***/ (function(module, exports, __webpack_require__) {
  47730. var asn1 = __webpack_require__(/*! ./asn1 */ 239)
  47731. var aesid = __webpack_require__(/*! ./aesid.json */ 256)
  47732. var fixProc = __webpack_require__(/*! ./fixProc */ 257)
  47733. var ciphers = __webpack_require__(/*! browserify-aes */ 175)
  47734. var compat = __webpack_require__(/*! pbkdf2 */ 160)
  47735. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  47736. module.exports = parseKeys
  47737. function parseKeys (buffer) {
  47738. var password
  47739. if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
  47740. password = buffer.passphrase
  47741. buffer = buffer.key
  47742. }
  47743. if (typeof buffer === 'string') {
  47744. buffer = Buffer.from(buffer)
  47745. }
  47746. var stripped = fixProc(buffer, password)
  47747. var type = stripped.tag
  47748. var data = stripped.data
  47749. var subtype, ndata
  47750. switch (type) {
  47751. case 'CERTIFICATE':
  47752. ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo
  47753. // falls through
  47754. case 'PUBLIC KEY':
  47755. if (!ndata) {
  47756. ndata = asn1.PublicKey.decode(data, 'der')
  47757. }
  47758. subtype = ndata.algorithm.algorithm.join('.')
  47759. switch (subtype) {
  47760. case '1.2.840.113549.1.1.1':
  47761. return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
  47762. case '1.2.840.10045.2.1':
  47763. ndata.subjectPrivateKey = ndata.subjectPublicKey
  47764. return {
  47765. type: 'ec',
  47766. data: ndata
  47767. }
  47768. case '1.2.840.10040.4.1':
  47769. ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
  47770. return {
  47771. type: 'dsa',
  47772. data: ndata.algorithm.params
  47773. }
  47774. default: throw new Error('unknown key id ' + subtype)
  47775. }
  47776. // throw new Error('unknown key type ' + type)
  47777. case 'ENCRYPTED PRIVATE KEY':
  47778. data = asn1.EncryptedPrivateKey.decode(data, 'der')
  47779. data = decrypt(data, password)
  47780. // falls through
  47781. case 'PRIVATE KEY':
  47782. ndata = asn1.PrivateKey.decode(data, 'der')
  47783. subtype = ndata.algorithm.algorithm.join('.')
  47784. switch (subtype) {
  47785. case '1.2.840.113549.1.1.1':
  47786. return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
  47787. case '1.2.840.10045.2.1':
  47788. return {
  47789. curve: ndata.algorithm.curve,
  47790. privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
  47791. }
  47792. case '1.2.840.10040.4.1':
  47793. ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
  47794. return {
  47795. type: 'dsa',
  47796. params: ndata.algorithm.params
  47797. }
  47798. default: throw new Error('unknown key id ' + subtype)
  47799. }
  47800. // throw new Error('unknown key type ' + type)
  47801. case 'RSA PUBLIC KEY':
  47802. return asn1.RSAPublicKey.decode(data, 'der')
  47803. case 'RSA PRIVATE KEY':
  47804. return asn1.RSAPrivateKey.decode(data, 'der')
  47805. case 'DSA PRIVATE KEY':
  47806. return {
  47807. type: 'dsa',
  47808. params: asn1.DSAPrivateKey.decode(data, 'der')
  47809. }
  47810. case 'EC PRIVATE KEY':
  47811. data = asn1.ECPrivateKey.decode(data, 'der')
  47812. return {
  47813. curve: data.parameters.value,
  47814. privateKey: data.privateKey
  47815. }
  47816. default: throw new Error('unknown key type ' + type)
  47817. }
  47818. }
  47819. parseKeys.signature = asn1.signature
  47820. function decrypt (data, password) {
  47821. var salt = data.algorithm.decrypt.kde.kdeparams.salt
  47822. var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
  47823. var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
  47824. var iv = data.algorithm.decrypt.cipher.iv
  47825. var cipherText = data.subjectPrivateKey
  47826. var keylen = parseInt(algo.split('-')[1], 10) / 8
  47827. var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')
  47828. var cipher = ciphers.createDecipheriv(algo, key, iv)
  47829. var out = []
  47830. out.push(cipher.update(cipherText))
  47831. out.push(cipher.final())
  47832. return Buffer.concat(out)
  47833. }
  47834. /***/ }),
  47835. /* 239 */
  47836. /*!*****************************************!*\
  47837. !*** ./node_modules/parse-asn1/asn1.js ***!
  47838. \*****************************************/
  47839. /*! no static exports found */
  47840. /***/ (function(module, exports, __webpack_require__) {
  47841. "use strict";
  47842. // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
  47843. // Fedor, you are amazing.
  47844. var asn1 = __webpack_require__(/*! asn1.js */ 240)
  47845. exports.certificate = __webpack_require__(/*! ./certificate */ 255)
  47846. var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
  47847. this.seq().obj(
  47848. this.key('version').int(),
  47849. this.key('modulus').int(),
  47850. this.key('publicExponent').int(),
  47851. this.key('privateExponent').int(),
  47852. this.key('prime1').int(),
  47853. this.key('prime2').int(),
  47854. this.key('exponent1').int(),
  47855. this.key('exponent2').int(),
  47856. this.key('coefficient').int()
  47857. )
  47858. })
  47859. exports.RSAPrivateKey = RSAPrivateKey
  47860. var RSAPublicKey = asn1.define('RSAPublicKey', function () {
  47861. this.seq().obj(
  47862. this.key('modulus').int(),
  47863. this.key('publicExponent').int()
  47864. )
  47865. })
  47866. exports.RSAPublicKey = RSAPublicKey
  47867. var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
  47868. this.seq().obj(
  47869. this.key('algorithm').use(AlgorithmIdentifier),
  47870. this.key('subjectPublicKey').bitstr()
  47871. )
  47872. })
  47873. exports.PublicKey = PublicKey
  47874. var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
  47875. this.seq().obj(
  47876. this.key('algorithm').objid(),
  47877. this.key('none').null_().optional(),
  47878. this.key('curve').objid().optional(),
  47879. this.key('params').seq().obj(
  47880. this.key('p').int(),
  47881. this.key('q').int(),
  47882. this.key('g').int()
  47883. ).optional()
  47884. )
  47885. })
  47886. var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
  47887. this.seq().obj(
  47888. this.key('version').int(),
  47889. this.key('algorithm').use(AlgorithmIdentifier),
  47890. this.key('subjectPrivateKey').octstr()
  47891. )
  47892. })
  47893. exports.PrivateKey = PrivateKeyInfo
  47894. var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
  47895. this.seq().obj(
  47896. this.key('algorithm').seq().obj(
  47897. this.key('id').objid(),
  47898. this.key('decrypt').seq().obj(
  47899. this.key('kde').seq().obj(
  47900. this.key('id').objid(),
  47901. this.key('kdeparams').seq().obj(
  47902. this.key('salt').octstr(),
  47903. this.key('iters').int()
  47904. )
  47905. ),
  47906. this.key('cipher').seq().obj(
  47907. this.key('algo').objid(),
  47908. this.key('iv').octstr()
  47909. )
  47910. )
  47911. ),
  47912. this.key('subjectPrivateKey').octstr()
  47913. )
  47914. })
  47915. exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
  47916. var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
  47917. this.seq().obj(
  47918. this.key('version').int(),
  47919. this.key('p').int(),
  47920. this.key('q').int(),
  47921. this.key('g').int(),
  47922. this.key('pub_key').int(),
  47923. this.key('priv_key').int()
  47924. )
  47925. })
  47926. exports.DSAPrivateKey = DSAPrivateKey
  47927. exports.DSAparam = asn1.define('DSAparam', function () {
  47928. this.int()
  47929. })
  47930. var ECPrivateKey = asn1.define('ECPrivateKey', function () {
  47931. this.seq().obj(
  47932. this.key('version').int(),
  47933. this.key('privateKey').octstr(),
  47934. this.key('parameters').optional().explicit(0).use(ECParameters),
  47935. this.key('publicKey').optional().explicit(1).bitstr()
  47936. )
  47937. })
  47938. exports.ECPrivateKey = ECPrivateKey
  47939. var ECParameters = asn1.define('ECParameters', function () {
  47940. this.choice({
  47941. namedCurve: this.objid()
  47942. })
  47943. })
  47944. exports.signature = asn1.define('signature', function () {
  47945. this.seq().obj(
  47946. this.key('r').int(),
  47947. this.key('s').int()
  47948. )
  47949. })
  47950. /***/ }),
  47951. /* 240 */
  47952. /*!******************************************!*\
  47953. !*** ./node_modules/asn1.js/lib/asn1.js ***!
  47954. \******************************************/
  47955. /*! no static exports found */
  47956. /***/ (function(module, exports, __webpack_require__) {
  47957. "use strict";
  47958. const asn1 = exports;
  47959. asn1.bignum = __webpack_require__(/*! bn.js */ 197);
  47960. asn1.define = __webpack_require__(/*! ./asn1/api */ 241).define;
  47961. asn1.base = __webpack_require__(/*! ./asn1/base */ 253);
  47962. asn1.constants = __webpack_require__(/*! ./asn1/constants */ 254);
  47963. asn1.decoders = __webpack_require__(/*! ./asn1/decoders */ 250);
  47964. asn1.encoders = __webpack_require__(/*! ./asn1/encoders */ 242);
  47965. /***/ }),
  47966. /* 241 */
  47967. /*!**********************************************!*\
  47968. !*** ./node_modules/asn1.js/lib/asn1/api.js ***!
  47969. \**********************************************/
  47970. /*! no static exports found */
  47971. /***/ (function(module, exports, __webpack_require__) {
  47972. "use strict";
  47973. const encoders = __webpack_require__(/*! ./encoders */ 242);
  47974. const decoders = __webpack_require__(/*! ./decoders */ 250);
  47975. const inherits = __webpack_require__(/*! inherits */ 121);
  47976. const api = exports;
  47977. api.define = function define(name, body) {
  47978. return new Entity(name, body);
  47979. };
  47980. function Entity(name, body) {
  47981. this.name = name;
  47982. this.body = body;
  47983. this.decoders = {};
  47984. this.encoders = {};
  47985. }
  47986. Entity.prototype._createNamed = function createNamed(Base) {
  47987. const name = this.name;
  47988. function Generated(entity) {
  47989. this._initNamed(entity, name);
  47990. }
  47991. inherits(Generated, Base);
  47992. Generated.prototype._initNamed = function _initNamed(entity, name) {
  47993. Base.call(this, entity, name);
  47994. };
  47995. return new Generated(this);
  47996. };
  47997. Entity.prototype._getDecoder = function _getDecoder(enc) {
  47998. enc = enc || 'der';
  47999. // Lazily create decoder
  48000. if (!this.decoders.hasOwnProperty(enc))
  48001. this.decoders[enc] = this._createNamed(decoders[enc]);
  48002. return this.decoders[enc];
  48003. };
  48004. Entity.prototype.decode = function decode(data, enc, options) {
  48005. return this._getDecoder(enc).decode(data, options);
  48006. };
  48007. Entity.prototype._getEncoder = function _getEncoder(enc) {
  48008. enc = enc || 'der';
  48009. // Lazily create encoder
  48010. if (!this.encoders.hasOwnProperty(enc))
  48011. this.encoders[enc] = this._createNamed(encoders[enc]);
  48012. return this.encoders[enc];
  48013. };
  48014. Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
  48015. return this._getEncoder(enc).encode(data, reporter);
  48016. };
  48017. /***/ }),
  48018. /* 242 */
  48019. /*!*********************************************************!*\
  48020. !*** ./node_modules/asn1.js/lib/asn1/encoders/index.js ***!
  48021. \*********************************************************/
  48022. /*! no static exports found */
  48023. /***/ (function(module, exports, __webpack_require__) {
  48024. "use strict";
  48025. const encoders = exports;
  48026. encoders.der = __webpack_require__(/*! ./der */ 243);
  48027. encoders.pem = __webpack_require__(/*! ./pem */ 249);
  48028. /***/ }),
  48029. /* 243 */
  48030. /*!*******************************************************!*\
  48031. !*** ./node_modules/asn1.js/lib/asn1/encoders/der.js ***!
  48032. \*******************************************************/
  48033. /*! no static exports found */
  48034. /***/ (function(module, exports, __webpack_require__) {
  48035. "use strict";
  48036. const inherits = __webpack_require__(/*! inherits */ 121);
  48037. const Buffer = __webpack_require__(/*! safer-buffer */ 244).Buffer;
  48038. const Node = __webpack_require__(/*! ../base/node */ 245);
  48039. // Import DER constants
  48040. const der = __webpack_require__(/*! ../constants/der */ 248);
  48041. function DEREncoder(entity) {
  48042. this.enc = 'der';
  48043. this.name = entity.name;
  48044. this.entity = entity;
  48045. // Construct base tree
  48046. this.tree = new DERNode();
  48047. this.tree._init(entity.body);
  48048. }
  48049. module.exports = DEREncoder;
  48050. DEREncoder.prototype.encode = function encode(data, reporter) {
  48051. return this.tree._encode(data, reporter).join();
  48052. };
  48053. // Tree methods
  48054. function DERNode(parent) {
  48055. Node.call(this, 'der', parent);
  48056. }
  48057. inherits(DERNode, Node);
  48058. DERNode.prototype._encodeComposite = function encodeComposite(tag,
  48059. primitive,
  48060. cls,
  48061. content) {
  48062. const encodedTag = encodeTag(tag, primitive, cls, this.reporter);
  48063. // Short form
  48064. if (content.length < 0x80) {
  48065. const header = Buffer.alloc(2);
  48066. header[0] = encodedTag;
  48067. header[1] = content.length;
  48068. return this._createEncoderBuffer([ header, content ]);
  48069. }
  48070. // Long form
  48071. // Count octets required to store length
  48072. let lenOctets = 1;
  48073. for (let i = content.length; i >= 0x100; i >>= 8)
  48074. lenOctets++;
  48075. const header = Buffer.alloc(1 + 1 + lenOctets);
  48076. header[0] = encodedTag;
  48077. header[1] = 0x80 | lenOctets;
  48078. for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
  48079. header[i] = j & 0xff;
  48080. return this._createEncoderBuffer([ header, content ]);
  48081. };
  48082. DERNode.prototype._encodeStr = function encodeStr(str, tag) {
  48083. if (tag === 'bitstr') {
  48084. return this._createEncoderBuffer([ str.unused | 0, str.data ]);
  48085. } else if (tag === 'bmpstr') {
  48086. const buf = Buffer.alloc(str.length * 2);
  48087. for (let i = 0; i < str.length; i++) {
  48088. buf.writeUInt16BE(str.charCodeAt(i), i * 2);
  48089. }
  48090. return this._createEncoderBuffer(buf);
  48091. } else if (tag === 'numstr') {
  48092. if (!this._isNumstr(str)) {
  48093. return this.reporter.error('Encoding of string type: numstr supports ' +
  48094. 'only digits and space');
  48095. }
  48096. return this._createEncoderBuffer(str);
  48097. } else if (tag === 'printstr') {
  48098. if (!this._isPrintstr(str)) {
  48099. return this.reporter.error('Encoding of string type: printstr supports ' +
  48100. 'only latin upper and lower case letters, ' +
  48101. 'digits, space, apostrophe, left and rigth ' +
  48102. 'parenthesis, plus sign, comma, hyphen, ' +
  48103. 'dot, slash, colon, equal sign, ' +
  48104. 'question mark');
  48105. }
  48106. return this._createEncoderBuffer(str);
  48107. } else if (/str$/.test(tag)) {
  48108. return this._createEncoderBuffer(str);
  48109. } else if (tag === 'objDesc') {
  48110. return this._createEncoderBuffer(str);
  48111. } else {
  48112. return this.reporter.error('Encoding of string type: ' + tag +
  48113. ' unsupported');
  48114. }
  48115. };
  48116. DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
  48117. if (typeof id === 'string') {
  48118. if (!values)
  48119. return this.reporter.error('string objid given, but no values map found');
  48120. if (!values.hasOwnProperty(id))
  48121. return this.reporter.error('objid not found in values map');
  48122. id = values[id].split(/[\s.]+/g);
  48123. for (let i = 0; i < id.length; i++)
  48124. id[i] |= 0;
  48125. } else if (Array.isArray(id)) {
  48126. id = id.slice();
  48127. for (let i = 0; i < id.length; i++)
  48128. id[i] |= 0;
  48129. }
  48130. if (!Array.isArray(id)) {
  48131. return this.reporter.error('objid() should be either array or string, ' +
  48132. 'got: ' + JSON.stringify(id));
  48133. }
  48134. if (!relative) {
  48135. if (id[1] >= 40)
  48136. return this.reporter.error('Second objid identifier OOB');
  48137. id.splice(0, 2, id[0] * 40 + id[1]);
  48138. }
  48139. // Count number of octets
  48140. let size = 0;
  48141. for (let i = 0; i < id.length; i++) {
  48142. let ident = id[i];
  48143. for (size++; ident >= 0x80; ident >>= 7)
  48144. size++;
  48145. }
  48146. const objid = Buffer.alloc(size);
  48147. let offset = objid.length - 1;
  48148. for (let i = id.length - 1; i >= 0; i--) {
  48149. let ident = id[i];
  48150. objid[offset--] = ident & 0x7f;
  48151. while ((ident >>= 7) > 0)
  48152. objid[offset--] = 0x80 | (ident & 0x7f);
  48153. }
  48154. return this._createEncoderBuffer(objid);
  48155. };
  48156. function two(num) {
  48157. if (num < 10)
  48158. return '0' + num;
  48159. else
  48160. return num;
  48161. }
  48162. DERNode.prototype._encodeTime = function encodeTime(time, tag) {
  48163. let str;
  48164. const date = new Date(time);
  48165. if (tag === 'gentime') {
  48166. str = [
  48167. two(date.getUTCFullYear()),
  48168. two(date.getUTCMonth() + 1),
  48169. two(date.getUTCDate()),
  48170. two(date.getUTCHours()),
  48171. two(date.getUTCMinutes()),
  48172. two(date.getUTCSeconds()),
  48173. 'Z'
  48174. ].join('');
  48175. } else if (tag === 'utctime') {
  48176. str = [
  48177. two(date.getUTCFullYear() % 100),
  48178. two(date.getUTCMonth() + 1),
  48179. two(date.getUTCDate()),
  48180. two(date.getUTCHours()),
  48181. two(date.getUTCMinutes()),
  48182. two(date.getUTCSeconds()),
  48183. 'Z'
  48184. ].join('');
  48185. } else {
  48186. this.reporter.error('Encoding ' + tag + ' time is not supported yet');
  48187. }
  48188. return this._encodeStr(str, 'octstr');
  48189. };
  48190. DERNode.prototype._encodeNull = function encodeNull() {
  48191. return this._createEncoderBuffer('');
  48192. };
  48193. DERNode.prototype._encodeInt = function encodeInt(num, values) {
  48194. if (typeof num === 'string') {
  48195. if (!values)
  48196. return this.reporter.error('String int or enum given, but no values map');
  48197. if (!values.hasOwnProperty(num)) {
  48198. return this.reporter.error('Values map doesn\'t contain: ' +
  48199. JSON.stringify(num));
  48200. }
  48201. num = values[num];
  48202. }
  48203. // Bignum, assume big endian
  48204. if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
  48205. const numArray = num.toArray();
  48206. if (!num.sign && numArray[0] & 0x80) {
  48207. numArray.unshift(0);
  48208. }
  48209. num = Buffer.from(numArray);
  48210. }
  48211. if (Buffer.isBuffer(num)) {
  48212. let size = num.length;
  48213. if (num.length === 0)
  48214. size++;
  48215. const out = Buffer.alloc(size);
  48216. num.copy(out);
  48217. if (num.length === 0)
  48218. out[0] = 0;
  48219. return this._createEncoderBuffer(out);
  48220. }
  48221. if (num < 0x80)
  48222. return this._createEncoderBuffer(num);
  48223. if (num < 0x100)
  48224. return this._createEncoderBuffer([0, num]);
  48225. let size = 1;
  48226. for (let i = num; i >= 0x100; i >>= 8)
  48227. size++;
  48228. const out = new Array(size);
  48229. for (let i = out.length - 1; i >= 0; i--) {
  48230. out[i] = num & 0xff;
  48231. num >>= 8;
  48232. }
  48233. if(out[0] & 0x80) {
  48234. out.unshift(0);
  48235. }
  48236. return this._createEncoderBuffer(Buffer.from(out));
  48237. };
  48238. DERNode.prototype._encodeBool = function encodeBool(value) {
  48239. return this._createEncoderBuffer(value ? 0xff : 0);
  48240. };
  48241. DERNode.prototype._use = function use(entity, obj) {
  48242. if (typeof entity === 'function')
  48243. entity = entity(obj);
  48244. return entity._getEncoder('der').tree;
  48245. };
  48246. DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
  48247. const state = this._baseState;
  48248. let i;
  48249. if (state['default'] === null)
  48250. return false;
  48251. const data = dataBuffer.join();
  48252. if (state.defaultBuffer === undefined)
  48253. state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
  48254. if (data.length !== state.defaultBuffer.length)
  48255. return false;
  48256. for (i=0; i < data.length; i++)
  48257. if (data[i] !== state.defaultBuffer[i])
  48258. return false;
  48259. return true;
  48260. };
  48261. // Utility methods
  48262. function encodeTag(tag, primitive, cls, reporter) {
  48263. let res;
  48264. if (tag === 'seqof')
  48265. tag = 'seq';
  48266. else if (tag === 'setof')
  48267. tag = 'set';
  48268. if (der.tagByName.hasOwnProperty(tag))
  48269. res = der.tagByName[tag];
  48270. else if (typeof tag === 'number' && (tag | 0) === tag)
  48271. res = tag;
  48272. else
  48273. return reporter.error('Unknown tag: ' + tag);
  48274. if (res >= 0x1f)
  48275. return reporter.error('Multi-octet tag encoding unsupported');
  48276. if (!primitive)
  48277. res |= 0x20;
  48278. res |= (der.tagClassByName[cls || 'universal'] << 6);
  48279. return res;
  48280. }
  48281. /***/ }),
  48282. /* 244 */
  48283. /*!********************************************!*\
  48284. !*** ./node_modules/safer-buffer/safer.js ***!
  48285. \********************************************/
  48286. /*! no static exports found */
  48287. /***/ (function(module, exports, __webpack_require__) {
  48288. "use strict";
  48289. /* WEBPACK VAR INJECTION */(function(process) {/* eslint-disable node/no-deprecated-api */
  48290. var buffer = __webpack_require__(/*! buffer */ 116)
  48291. var Buffer = buffer.Buffer
  48292. var safer = {}
  48293. var key
  48294. for (key in buffer) {
  48295. if (!buffer.hasOwnProperty(key)) continue
  48296. if (key === 'SlowBuffer' || key === 'Buffer') continue
  48297. safer[key] = buffer[key]
  48298. }
  48299. var Safer = safer.Buffer = {}
  48300. for (key in Buffer) {
  48301. if (!Buffer.hasOwnProperty(key)) continue
  48302. if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
  48303. Safer[key] = Buffer[key]
  48304. }
  48305. safer.Buffer.prototype = Buffer.prototype
  48306. if (!Safer.from || Safer.from === Uint8Array.from) {
  48307. Safer.from = function (value, encodingOrOffset, length) {
  48308. if (typeof value === 'number') {
  48309. throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
  48310. }
  48311. if (value && typeof value.length === 'undefined') {
  48312. throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
  48313. }
  48314. return Buffer(value, encodingOrOffset, length)
  48315. }
  48316. }
  48317. if (!Safer.alloc) {
  48318. Safer.alloc = function (size, fill, encoding) {
  48319. if (typeof size !== 'number') {
  48320. throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
  48321. }
  48322. if (size < 0 || size >= 2 * (1 << 30)) {
  48323. throw new RangeError('The value "' + size + '" is invalid for option "size"')
  48324. }
  48325. var buf = Buffer(size)
  48326. if (!fill || fill.length === 0) {
  48327. buf.fill(0)
  48328. } else if (typeof encoding === 'string') {
  48329. buf.fill(fill, encoding)
  48330. } else {
  48331. buf.fill(fill)
  48332. }
  48333. return buf
  48334. }
  48335. }
  48336. if (!safer.kStringMaxLength) {
  48337. try {
  48338. safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
  48339. } catch (e) {
  48340. // we can't determine kStringMaxLength in environments where process.binding
  48341. // is unsupported, so let's not set it
  48342. }
  48343. }
  48344. if (!safer.constants) {
  48345. safer.constants = {
  48346. MAX_LENGTH: safer.kMaxLength
  48347. }
  48348. if (safer.kStringMaxLength) {
  48349. safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
  48350. }
  48351. }
  48352. module.exports = safer
  48353. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
  48354. /***/ }),
  48355. /* 245 */
  48356. /*!****************************************************!*\
  48357. !*** ./node_modules/asn1.js/lib/asn1/base/node.js ***!
  48358. \****************************************************/
  48359. /*! no static exports found */
  48360. /***/ (function(module, exports, __webpack_require__) {
  48361. "use strict";
  48362. const Reporter = __webpack_require__(/*! ../base/reporter */ 246).Reporter;
  48363. const EncoderBuffer = __webpack_require__(/*! ../base/buffer */ 247).EncoderBuffer;
  48364. const DecoderBuffer = __webpack_require__(/*! ../base/buffer */ 247).DecoderBuffer;
  48365. const assert = __webpack_require__(/*! minimalistic-assert */ 171);
  48366. // Supported tags
  48367. const tags = [
  48368. 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
  48369. 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',
  48370. 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
  48371. 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
  48372. ];
  48373. // Public methods list
  48374. const methods = [
  48375. 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
  48376. 'any', 'contains'
  48377. ].concat(tags);
  48378. // Overrided methods list
  48379. const overrided = [
  48380. '_peekTag', '_decodeTag', '_use',
  48381. '_decodeStr', '_decodeObjid', '_decodeTime',
  48382. '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
  48383. '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
  48384. '_encodeNull', '_encodeInt', '_encodeBool'
  48385. ];
  48386. function Node(enc, parent, name) {
  48387. const state = {};
  48388. this._baseState = state;
  48389. state.name = name;
  48390. state.enc = enc;
  48391. state.parent = parent || null;
  48392. state.children = null;
  48393. // State
  48394. state.tag = null;
  48395. state.args = null;
  48396. state.reverseArgs = null;
  48397. state.choice = null;
  48398. state.optional = false;
  48399. state.any = false;
  48400. state.obj = false;
  48401. state.use = null;
  48402. state.useDecoder = null;
  48403. state.key = null;
  48404. state['default'] = null;
  48405. state.explicit = null;
  48406. state.implicit = null;
  48407. state.contains = null;
  48408. // Should create new instance on each method
  48409. if (!state.parent) {
  48410. state.children = [];
  48411. this._wrap();
  48412. }
  48413. }
  48414. module.exports = Node;
  48415. const stateProps = [
  48416. 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
  48417. 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
  48418. 'implicit', 'contains'
  48419. ];
  48420. Node.prototype.clone = function clone() {
  48421. const state = this._baseState;
  48422. const cstate = {};
  48423. stateProps.forEach(function(prop) {
  48424. cstate[prop] = state[prop];
  48425. });
  48426. const res = new this.constructor(cstate.parent);
  48427. res._baseState = cstate;
  48428. return res;
  48429. };
  48430. Node.prototype._wrap = function wrap() {
  48431. const state = this._baseState;
  48432. methods.forEach(function(method) {
  48433. this[method] = function _wrappedMethod() {
  48434. const clone = new this.constructor(this);
  48435. state.children.push(clone);
  48436. return clone[method].apply(clone, arguments);
  48437. };
  48438. }, this);
  48439. };
  48440. Node.prototype._init = function init(body) {
  48441. const state = this._baseState;
  48442. assert(state.parent === null);
  48443. body.call(this);
  48444. // Filter children
  48445. state.children = state.children.filter(function(child) {
  48446. return child._baseState.parent === this;
  48447. }, this);
  48448. assert.equal(state.children.length, 1, 'Root node can have only one child');
  48449. };
  48450. Node.prototype._useArgs = function useArgs(args) {
  48451. const state = this._baseState;
  48452. // Filter children and args
  48453. const children = args.filter(function(arg) {
  48454. return arg instanceof this.constructor;
  48455. }, this);
  48456. args = args.filter(function(arg) {
  48457. return !(arg instanceof this.constructor);
  48458. }, this);
  48459. if (children.length !== 0) {
  48460. assert(state.children === null);
  48461. state.children = children;
  48462. // Replace parent to maintain backward link
  48463. children.forEach(function(child) {
  48464. child._baseState.parent = this;
  48465. }, this);
  48466. }
  48467. if (args.length !== 0) {
  48468. assert(state.args === null);
  48469. state.args = args;
  48470. state.reverseArgs = args.map(function(arg) {
  48471. if (typeof arg !== 'object' || arg.constructor !== Object)
  48472. return arg;
  48473. const res = {};
  48474. Object.keys(arg).forEach(function(key) {
  48475. if (key == (key | 0))
  48476. key |= 0;
  48477. const value = arg[key];
  48478. res[value] = key;
  48479. });
  48480. return res;
  48481. });
  48482. }
  48483. };
  48484. //
  48485. // Overrided methods
  48486. //
  48487. overrided.forEach(function(method) {
  48488. Node.prototype[method] = function _overrided() {
  48489. const state = this._baseState;
  48490. throw new Error(method + ' not implemented for encoding: ' + state.enc);
  48491. };
  48492. });
  48493. //
  48494. // Public methods
  48495. //
  48496. tags.forEach(function(tag) {
  48497. Node.prototype[tag] = function _tagMethod() {
  48498. const state = this._baseState;
  48499. const args = Array.prototype.slice.call(arguments);
  48500. assert(state.tag === null);
  48501. state.tag = tag;
  48502. this._useArgs(args);
  48503. return this;
  48504. };
  48505. });
  48506. Node.prototype.use = function use(item) {
  48507. assert(item);
  48508. const state = this._baseState;
  48509. assert(state.use === null);
  48510. state.use = item;
  48511. return this;
  48512. };
  48513. Node.prototype.optional = function optional() {
  48514. const state = this._baseState;
  48515. state.optional = true;
  48516. return this;
  48517. };
  48518. Node.prototype.def = function def(val) {
  48519. const state = this._baseState;
  48520. assert(state['default'] === null);
  48521. state['default'] = val;
  48522. state.optional = true;
  48523. return this;
  48524. };
  48525. Node.prototype.explicit = function explicit(num) {
  48526. const state = this._baseState;
  48527. assert(state.explicit === null && state.implicit === null);
  48528. state.explicit = num;
  48529. return this;
  48530. };
  48531. Node.prototype.implicit = function implicit(num) {
  48532. const state = this._baseState;
  48533. assert(state.explicit === null && state.implicit === null);
  48534. state.implicit = num;
  48535. return this;
  48536. };
  48537. Node.prototype.obj = function obj() {
  48538. const state = this._baseState;
  48539. const args = Array.prototype.slice.call(arguments);
  48540. state.obj = true;
  48541. if (args.length !== 0)
  48542. this._useArgs(args);
  48543. return this;
  48544. };
  48545. Node.prototype.key = function key(newKey) {
  48546. const state = this._baseState;
  48547. assert(state.key === null);
  48548. state.key = newKey;
  48549. return this;
  48550. };
  48551. Node.prototype.any = function any() {
  48552. const state = this._baseState;
  48553. state.any = true;
  48554. return this;
  48555. };
  48556. Node.prototype.choice = function choice(obj) {
  48557. const state = this._baseState;
  48558. assert(state.choice === null);
  48559. state.choice = obj;
  48560. this._useArgs(Object.keys(obj).map(function(key) {
  48561. return obj[key];
  48562. }));
  48563. return this;
  48564. };
  48565. Node.prototype.contains = function contains(item) {
  48566. const state = this._baseState;
  48567. assert(state.use === null);
  48568. state.contains = item;
  48569. return this;
  48570. };
  48571. //
  48572. // Decoding
  48573. //
  48574. Node.prototype._decode = function decode(input, options) {
  48575. const state = this._baseState;
  48576. // Decode root node
  48577. if (state.parent === null)
  48578. return input.wrapResult(state.children[0]._decode(input, options));
  48579. let result = state['default'];
  48580. let present = true;
  48581. let prevKey = null;
  48582. if (state.key !== null)
  48583. prevKey = input.enterKey(state.key);
  48584. // Check if tag is there
  48585. if (state.optional) {
  48586. let tag = null;
  48587. if (state.explicit !== null)
  48588. tag = state.explicit;
  48589. else if (state.implicit !== null)
  48590. tag = state.implicit;
  48591. else if (state.tag !== null)
  48592. tag = state.tag;
  48593. if (tag === null && !state.any) {
  48594. // Trial and Error
  48595. const save = input.save();
  48596. try {
  48597. if (state.choice === null)
  48598. this._decodeGeneric(state.tag, input, options);
  48599. else
  48600. this._decodeChoice(input, options);
  48601. present = true;
  48602. } catch (e) {
  48603. present = false;
  48604. }
  48605. input.restore(save);
  48606. } else {
  48607. present = this._peekTag(input, tag, state.any);
  48608. if (input.isError(present))
  48609. return present;
  48610. }
  48611. }
  48612. // Push object on stack
  48613. let prevObj;
  48614. if (state.obj && present)
  48615. prevObj = input.enterObject();
  48616. if (present) {
  48617. // Unwrap explicit values
  48618. if (state.explicit !== null) {
  48619. const explicit = this._decodeTag(input, state.explicit);
  48620. if (input.isError(explicit))
  48621. return explicit;
  48622. input = explicit;
  48623. }
  48624. const start = input.offset;
  48625. // Unwrap implicit and normal values
  48626. if (state.use === null && state.choice === null) {
  48627. let save;
  48628. if (state.any)
  48629. save = input.save();
  48630. const body = this._decodeTag(
  48631. input,
  48632. state.implicit !== null ? state.implicit : state.tag,
  48633. state.any
  48634. );
  48635. if (input.isError(body))
  48636. return body;
  48637. if (state.any)
  48638. result = input.raw(save);
  48639. else
  48640. input = body;
  48641. }
  48642. if (options && options.track && state.tag !== null)
  48643. options.track(input.path(), start, input.length, 'tagged');
  48644. if (options && options.track && state.tag !== null)
  48645. options.track(input.path(), input.offset, input.length, 'content');
  48646. // Select proper method for tag
  48647. if (state.any) {
  48648. // no-op
  48649. } else if (state.choice === null) {
  48650. result = this._decodeGeneric(state.tag, input, options);
  48651. } else {
  48652. result = this._decodeChoice(input, options);
  48653. }
  48654. if (input.isError(result))
  48655. return result;
  48656. // Decode children
  48657. if (!state.any && state.choice === null && state.children !== null) {
  48658. state.children.forEach(function decodeChildren(child) {
  48659. // NOTE: We are ignoring errors here, to let parser continue with other
  48660. // parts of encoded data
  48661. child._decode(input, options);
  48662. });
  48663. }
  48664. // Decode contained/encoded by schema, only in bit or octet strings
  48665. if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
  48666. const data = new DecoderBuffer(result);
  48667. result = this._getUse(state.contains, input._reporterState.obj)
  48668. ._decode(data, options);
  48669. }
  48670. }
  48671. // Pop object
  48672. if (state.obj && present)
  48673. result = input.leaveObject(prevObj);
  48674. // Set key
  48675. if (state.key !== null && (result !== null || present === true))
  48676. input.leaveKey(prevKey, state.key, result);
  48677. else if (prevKey !== null)
  48678. input.exitKey(prevKey);
  48679. return result;
  48680. };
  48681. Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
  48682. const state = this._baseState;
  48683. if (tag === 'seq' || tag === 'set')
  48684. return null;
  48685. if (tag === 'seqof' || tag === 'setof')
  48686. return this._decodeList(input, tag, state.args[0], options);
  48687. else if (/str$/.test(tag))
  48688. return this._decodeStr(input, tag, options);
  48689. else if (tag === 'objid' && state.args)
  48690. return this._decodeObjid(input, state.args[0], state.args[1], options);
  48691. else if (tag === 'objid')
  48692. return this._decodeObjid(input, null, null, options);
  48693. else if (tag === 'gentime' || tag === 'utctime')
  48694. return this._decodeTime(input, tag, options);
  48695. else if (tag === 'null_')
  48696. return this._decodeNull(input, options);
  48697. else if (tag === 'bool')
  48698. return this._decodeBool(input, options);
  48699. else if (tag === 'objDesc')
  48700. return this._decodeStr(input, tag, options);
  48701. else if (tag === 'int' || tag === 'enum')
  48702. return this._decodeInt(input, state.args && state.args[0], options);
  48703. if (state.use !== null) {
  48704. return this._getUse(state.use, input._reporterState.obj)
  48705. ._decode(input, options);
  48706. } else {
  48707. return input.error('unknown tag: ' + tag);
  48708. }
  48709. };
  48710. Node.prototype._getUse = function _getUse(entity, obj) {
  48711. const state = this._baseState;
  48712. // Create altered use decoder if implicit is set
  48713. state.useDecoder = this._use(entity, obj);
  48714. assert(state.useDecoder._baseState.parent === null);
  48715. state.useDecoder = state.useDecoder._baseState.children[0];
  48716. if (state.implicit !== state.useDecoder._baseState.implicit) {
  48717. state.useDecoder = state.useDecoder.clone();
  48718. state.useDecoder._baseState.implicit = state.implicit;
  48719. }
  48720. return state.useDecoder;
  48721. };
  48722. Node.prototype._decodeChoice = function decodeChoice(input, options) {
  48723. const state = this._baseState;
  48724. let result = null;
  48725. let match = false;
  48726. Object.keys(state.choice).some(function(key) {
  48727. const save = input.save();
  48728. const node = state.choice[key];
  48729. try {
  48730. const value = node._decode(input, options);
  48731. if (input.isError(value))
  48732. return false;
  48733. result = { type: key, value: value };
  48734. match = true;
  48735. } catch (e) {
  48736. input.restore(save);
  48737. return false;
  48738. }
  48739. return true;
  48740. }, this);
  48741. if (!match)
  48742. return input.error('Choice not matched');
  48743. return result;
  48744. };
  48745. //
  48746. // Encoding
  48747. //
  48748. Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
  48749. return new EncoderBuffer(data, this.reporter);
  48750. };
  48751. Node.prototype._encode = function encode(data, reporter, parent) {
  48752. const state = this._baseState;
  48753. if (state['default'] !== null && state['default'] === data)
  48754. return;
  48755. const result = this._encodeValue(data, reporter, parent);
  48756. if (result === undefined)
  48757. return;
  48758. if (this._skipDefault(result, reporter, parent))
  48759. return;
  48760. return result;
  48761. };
  48762. Node.prototype._encodeValue = function encode(data, reporter, parent) {
  48763. const state = this._baseState;
  48764. // Decode root node
  48765. if (state.parent === null)
  48766. return state.children[0]._encode(data, reporter || new Reporter());
  48767. let result = null;
  48768. // Set reporter to share it with a child class
  48769. this.reporter = reporter;
  48770. // Check if data is there
  48771. if (state.optional && data === undefined) {
  48772. if (state['default'] !== null)
  48773. data = state['default'];
  48774. else
  48775. return;
  48776. }
  48777. // Encode children first
  48778. let content = null;
  48779. let primitive = false;
  48780. if (state.any) {
  48781. // Anything that was given is translated to buffer
  48782. result = this._createEncoderBuffer(data);
  48783. } else if (state.choice) {
  48784. result = this._encodeChoice(data, reporter);
  48785. } else if (state.contains) {
  48786. content = this._getUse(state.contains, parent)._encode(data, reporter);
  48787. primitive = true;
  48788. } else if (state.children) {
  48789. content = state.children.map(function(child) {
  48790. if (child._baseState.tag === 'null_')
  48791. return child._encode(null, reporter, data);
  48792. if (child._baseState.key === null)
  48793. return reporter.error('Child should have a key');
  48794. const prevKey = reporter.enterKey(child._baseState.key);
  48795. if (typeof data !== 'object')
  48796. return reporter.error('Child expected, but input is not object');
  48797. const res = child._encode(data[child._baseState.key], reporter, data);
  48798. reporter.leaveKey(prevKey);
  48799. return res;
  48800. }, this).filter(function(child) {
  48801. return child;
  48802. });
  48803. content = this._createEncoderBuffer(content);
  48804. } else {
  48805. if (state.tag === 'seqof' || state.tag === 'setof') {
  48806. // TODO(indutny): this should be thrown on DSL level
  48807. if (!(state.args && state.args.length === 1))
  48808. return reporter.error('Too many args for : ' + state.tag);
  48809. if (!Array.isArray(data))
  48810. return reporter.error('seqof/setof, but data is not Array');
  48811. const child = this.clone();
  48812. child._baseState.implicit = null;
  48813. content = this._createEncoderBuffer(data.map(function(item) {
  48814. const state = this._baseState;
  48815. return this._getUse(state.args[0], data)._encode(item, reporter);
  48816. }, child));
  48817. } else if (state.use !== null) {
  48818. result = this._getUse(state.use, parent)._encode(data, reporter);
  48819. } else {
  48820. content = this._encodePrimitive(state.tag, data);
  48821. primitive = true;
  48822. }
  48823. }
  48824. // Encode data itself
  48825. if (!state.any && state.choice === null) {
  48826. const tag = state.implicit !== null ? state.implicit : state.tag;
  48827. const cls = state.implicit === null ? 'universal' : 'context';
  48828. if (tag === null) {
  48829. if (state.use === null)
  48830. reporter.error('Tag could be omitted only for .use()');
  48831. } else {
  48832. if (state.use === null)
  48833. result = this._encodeComposite(tag, primitive, cls, content);
  48834. }
  48835. }
  48836. // Wrap in explicit
  48837. if (state.explicit !== null)
  48838. result = this._encodeComposite(state.explicit, false, 'context', result);
  48839. return result;
  48840. };
  48841. Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
  48842. const state = this._baseState;
  48843. const node = state.choice[data.type];
  48844. if (!node) {
  48845. assert(
  48846. false,
  48847. data.type + ' not found in ' +
  48848. JSON.stringify(Object.keys(state.choice)));
  48849. }
  48850. return node._encode(data.value, reporter);
  48851. };
  48852. Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
  48853. const state = this._baseState;
  48854. if (/str$/.test(tag))
  48855. return this._encodeStr(data, tag);
  48856. else if (tag === 'objid' && state.args)
  48857. return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
  48858. else if (tag === 'objid')
  48859. return this._encodeObjid(data, null, null);
  48860. else if (tag === 'gentime' || tag === 'utctime')
  48861. return this._encodeTime(data, tag);
  48862. else if (tag === 'null_')
  48863. return this._encodeNull();
  48864. else if (tag === 'int' || tag === 'enum')
  48865. return this._encodeInt(data, state.args && state.reverseArgs[0]);
  48866. else if (tag === 'bool')
  48867. return this._encodeBool(data);
  48868. else if (tag === 'objDesc')
  48869. return this._encodeStr(data, tag);
  48870. else
  48871. throw new Error('Unsupported tag: ' + tag);
  48872. };
  48873. Node.prototype._isNumstr = function isNumstr(str) {
  48874. return /^[0-9 ]*$/.test(str);
  48875. };
  48876. Node.prototype._isPrintstr = function isPrintstr(str) {
  48877. return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str);
  48878. };
  48879. /***/ }),
  48880. /* 246 */
  48881. /*!********************************************************!*\
  48882. !*** ./node_modules/asn1.js/lib/asn1/base/reporter.js ***!
  48883. \********************************************************/
  48884. /*! no static exports found */
  48885. /***/ (function(module, exports, __webpack_require__) {
  48886. "use strict";
  48887. const inherits = __webpack_require__(/*! inherits */ 121);
  48888. function Reporter(options) {
  48889. this._reporterState = {
  48890. obj: null,
  48891. path: [],
  48892. options: options || {},
  48893. errors: []
  48894. };
  48895. }
  48896. exports.Reporter = Reporter;
  48897. Reporter.prototype.isError = function isError(obj) {
  48898. return obj instanceof ReporterError;
  48899. };
  48900. Reporter.prototype.save = function save() {
  48901. const state = this._reporterState;
  48902. return { obj: state.obj, pathLen: state.path.length };
  48903. };
  48904. Reporter.prototype.restore = function restore(data) {
  48905. const state = this._reporterState;
  48906. state.obj = data.obj;
  48907. state.path = state.path.slice(0, data.pathLen);
  48908. };
  48909. Reporter.prototype.enterKey = function enterKey(key) {
  48910. return this._reporterState.path.push(key);
  48911. };
  48912. Reporter.prototype.exitKey = function exitKey(index) {
  48913. const state = this._reporterState;
  48914. state.path = state.path.slice(0, index - 1);
  48915. };
  48916. Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
  48917. const state = this._reporterState;
  48918. this.exitKey(index);
  48919. if (state.obj !== null)
  48920. state.obj[key] = value;
  48921. };
  48922. Reporter.prototype.path = function path() {
  48923. return this._reporterState.path.join('/');
  48924. };
  48925. Reporter.prototype.enterObject = function enterObject() {
  48926. const state = this._reporterState;
  48927. const prev = state.obj;
  48928. state.obj = {};
  48929. return prev;
  48930. };
  48931. Reporter.prototype.leaveObject = function leaveObject(prev) {
  48932. const state = this._reporterState;
  48933. const now = state.obj;
  48934. state.obj = prev;
  48935. return now;
  48936. };
  48937. Reporter.prototype.error = function error(msg) {
  48938. let err;
  48939. const state = this._reporterState;
  48940. const inherited = msg instanceof ReporterError;
  48941. if (inherited) {
  48942. err = msg;
  48943. } else {
  48944. err = new ReporterError(state.path.map(function(elem) {
  48945. return '[' + JSON.stringify(elem) + ']';
  48946. }).join(''), msg.message || msg, msg.stack);
  48947. }
  48948. if (!state.options.partial)
  48949. throw err;
  48950. if (!inherited)
  48951. state.errors.push(err);
  48952. return err;
  48953. };
  48954. Reporter.prototype.wrapResult = function wrapResult(result) {
  48955. const state = this._reporterState;
  48956. if (!state.options.partial)
  48957. return result;
  48958. return {
  48959. result: this.isError(result) ? null : result,
  48960. errors: state.errors
  48961. };
  48962. };
  48963. function ReporterError(path, msg) {
  48964. this.path = path;
  48965. this.rethrow(msg);
  48966. }
  48967. inherits(ReporterError, Error);
  48968. ReporterError.prototype.rethrow = function rethrow(msg) {
  48969. this.message = msg + ' at: ' + (this.path || '(shallow)');
  48970. if (Error.captureStackTrace)
  48971. Error.captureStackTrace(this, ReporterError);
  48972. if (!this.stack) {
  48973. try {
  48974. // IE only adds stack when thrown
  48975. throw new Error(this.message);
  48976. } catch (e) {
  48977. this.stack = e.stack;
  48978. }
  48979. }
  48980. return this;
  48981. };
  48982. /***/ }),
  48983. /* 247 */
  48984. /*!******************************************************!*\
  48985. !*** ./node_modules/asn1.js/lib/asn1/base/buffer.js ***!
  48986. \******************************************************/
  48987. /*! no static exports found */
  48988. /***/ (function(module, exports, __webpack_require__) {
  48989. "use strict";
  48990. const inherits = __webpack_require__(/*! inherits */ 121);
  48991. const Reporter = __webpack_require__(/*! ../base/reporter */ 246).Reporter;
  48992. const Buffer = __webpack_require__(/*! safer-buffer */ 244).Buffer;
  48993. function DecoderBuffer(base, options) {
  48994. Reporter.call(this, options);
  48995. if (!Buffer.isBuffer(base)) {
  48996. this.error('Input not Buffer');
  48997. return;
  48998. }
  48999. this.base = base;
  49000. this.offset = 0;
  49001. this.length = base.length;
  49002. }
  49003. inherits(DecoderBuffer, Reporter);
  49004. exports.DecoderBuffer = DecoderBuffer;
  49005. DecoderBuffer.isDecoderBuffer = function isDecoderBuffer(data) {
  49006. if (data instanceof DecoderBuffer) {
  49007. return true;
  49008. }
  49009. // Or accept compatible API
  49010. const isCompatible = typeof data === 'object' &&
  49011. Buffer.isBuffer(data.base) &&
  49012. data.constructor.name === 'DecoderBuffer' &&
  49013. typeof data.offset === 'number' &&
  49014. typeof data.length === 'number' &&
  49015. typeof data.save === 'function' &&
  49016. typeof data.restore === 'function' &&
  49017. typeof data.isEmpty === 'function' &&
  49018. typeof data.readUInt8 === 'function' &&
  49019. typeof data.skip === 'function' &&
  49020. typeof data.raw === 'function';
  49021. return isCompatible;
  49022. };
  49023. DecoderBuffer.prototype.save = function save() {
  49024. return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
  49025. };
  49026. DecoderBuffer.prototype.restore = function restore(save) {
  49027. // Return skipped data
  49028. const res = new DecoderBuffer(this.base);
  49029. res.offset = save.offset;
  49030. res.length = this.offset;
  49031. this.offset = save.offset;
  49032. Reporter.prototype.restore.call(this, save.reporter);
  49033. return res;
  49034. };
  49035. DecoderBuffer.prototype.isEmpty = function isEmpty() {
  49036. return this.offset === this.length;
  49037. };
  49038. DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
  49039. if (this.offset + 1 <= this.length)
  49040. return this.base.readUInt8(this.offset++, true);
  49041. else
  49042. return this.error(fail || 'DecoderBuffer overrun');
  49043. };
  49044. DecoderBuffer.prototype.skip = function skip(bytes, fail) {
  49045. if (!(this.offset + bytes <= this.length))
  49046. return this.error(fail || 'DecoderBuffer overrun');
  49047. const res = new DecoderBuffer(this.base);
  49048. // Share reporter state
  49049. res._reporterState = this._reporterState;
  49050. res.offset = this.offset;
  49051. res.length = this.offset + bytes;
  49052. this.offset += bytes;
  49053. return res;
  49054. };
  49055. DecoderBuffer.prototype.raw = function raw(save) {
  49056. return this.base.slice(save ? save.offset : this.offset, this.length);
  49057. };
  49058. function EncoderBuffer(value, reporter) {
  49059. if (Array.isArray(value)) {
  49060. this.length = 0;
  49061. this.value = value.map(function(item) {
  49062. if (!EncoderBuffer.isEncoderBuffer(item))
  49063. item = new EncoderBuffer(item, reporter);
  49064. this.length += item.length;
  49065. return item;
  49066. }, this);
  49067. } else if (typeof value === 'number') {
  49068. if (!(0 <= value && value <= 0xff))
  49069. return reporter.error('non-byte EncoderBuffer value');
  49070. this.value = value;
  49071. this.length = 1;
  49072. } else if (typeof value === 'string') {
  49073. this.value = value;
  49074. this.length = Buffer.byteLength(value);
  49075. } else if (Buffer.isBuffer(value)) {
  49076. this.value = value;
  49077. this.length = value.length;
  49078. } else {
  49079. return reporter.error('Unsupported type: ' + typeof value);
  49080. }
  49081. }
  49082. exports.EncoderBuffer = EncoderBuffer;
  49083. EncoderBuffer.isEncoderBuffer = function isEncoderBuffer(data) {
  49084. if (data instanceof EncoderBuffer) {
  49085. return true;
  49086. }
  49087. // Or accept compatible API
  49088. const isCompatible = typeof data === 'object' &&
  49089. data.constructor.name === 'EncoderBuffer' &&
  49090. typeof data.length === 'number' &&
  49091. typeof data.join === 'function';
  49092. return isCompatible;
  49093. };
  49094. EncoderBuffer.prototype.join = function join(out, offset) {
  49095. if (!out)
  49096. out = Buffer.alloc(this.length);
  49097. if (!offset)
  49098. offset = 0;
  49099. if (this.length === 0)
  49100. return out;
  49101. if (Array.isArray(this.value)) {
  49102. this.value.forEach(function(item) {
  49103. item.join(out, offset);
  49104. offset += item.length;
  49105. });
  49106. } else {
  49107. if (typeof this.value === 'number')
  49108. out[offset] = this.value;
  49109. else if (typeof this.value === 'string')
  49110. out.write(this.value, offset);
  49111. else if (Buffer.isBuffer(this.value))
  49112. this.value.copy(out, offset);
  49113. offset += this.length;
  49114. }
  49115. return out;
  49116. };
  49117. /***/ }),
  49118. /* 248 */
  49119. /*!********************************************************!*\
  49120. !*** ./node_modules/asn1.js/lib/asn1/constants/der.js ***!
  49121. \********************************************************/
  49122. /*! no static exports found */
  49123. /***/ (function(module, exports, __webpack_require__) {
  49124. "use strict";
  49125. // Helper
  49126. function reverse(map) {
  49127. const res = {};
  49128. Object.keys(map).forEach(function(key) {
  49129. // Convert key to integer if it is stringified
  49130. if ((key | 0) == key)
  49131. key = key | 0;
  49132. const value = map[key];
  49133. res[value] = key;
  49134. });
  49135. return res;
  49136. }
  49137. exports.tagClass = {
  49138. 0: 'universal',
  49139. 1: 'application',
  49140. 2: 'context',
  49141. 3: 'private'
  49142. };
  49143. exports.tagClassByName = reverse(exports.tagClass);
  49144. exports.tag = {
  49145. 0x00: 'end',
  49146. 0x01: 'bool',
  49147. 0x02: 'int',
  49148. 0x03: 'bitstr',
  49149. 0x04: 'octstr',
  49150. 0x05: 'null_',
  49151. 0x06: 'objid',
  49152. 0x07: 'objDesc',
  49153. 0x08: 'external',
  49154. 0x09: 'real',
  49155. 0x0a: 'enum',
  49156. 0x0b: 'embed',
  49157. 0x0c: 'utf8str',
  49158. 0x0d: 'relativeOid',
  49159. 0x10: 'seq',
  49160. 0x11: 'set',
  49161. 0x12: 'numstr',
  49162. 0x13: 'printstr',
  49163. 0x14: 't61str',
  49164. 0x15: 'videostr',
  49165. 0x16: 'ia5str',
  49166. 0x17: 'utctime',
  49167. 0x18: 'gentime',
  49168. 0x19: 'graphstr',
  49169. 0x1a: 'iso646str',
  49170. 0x1b: 'genstr',
  49171. 0x1c: 'unistr',
  49172. 0x1d: 'charstr',
  49173. 0x1e: 'bmpstr'
  49174. };
  49175. exports.tagByName = reverse(exports.tag);
  49176. /***/ }),
  49177. /* 249 */
  49178. /*!*******************************************************!*\
  49179. !*** ./node_modules/asn1.js/lib/asn1/encoders/pem.js ***!
  49180. \*******************************************************/
  49181. /*! no static exports found */
  49182. /***/ (function(module, exports, __webpack_require__) {
  49183. "use strict";
  49184. const inherits = __webpack_require__(/*! inherits */ 121);
  49185. const DEREncoder = __webpack_require__(/*! ./der */ 243);
  49186. function PEMEncoder(entity) {
  49187. DEREncoder.call(this, entity);
  49188. this.enc = 'pem';
  49189. }
  49190. inherits(PEMEncoder, DEREncoder);
  49191. module.exports = PEMEncoder;
  49192. PEMEncoder.prototype.encode = function encode(data, options) {
  49193. const buf = DEREncoder.prototype.encode.call(this, data);
  49194. const p = buf.toString('base64');
  49195. const out = [ '-----BEGIN ' + options.label + '-----' ];
  49196. for (let i = 0; i < p.length; i += 64)
  49197. out.push(p.slice(i, i + 64));
  49198. out.push('-----END ' + options.label + '-----');
  49199. return out.join('\n');
  49200. };
  49201. /***/ }),
  49202. /* 250 */
  49203. /*!*********************************************************!*\
  49204. !*** ./node_modules/asn1.js/lib/asn1/decoders/index.js ***!
  49205. \*********************************************************/
  49206. /*! no static exports found */
  49207. /***/ (function(module, exports, __webpack_require__) {
  49208. "use strict";
  49209. const decoders = exports;
  49210. decoders.der = __webpack_require__(/*! ./der */ 251);
  49211. decoders.pem = __webpack_require__(/*! ./pem */ 252);
  49212. /***/ }),
  49213. /* 251 */
  49214. /*!*******************************************************!*\
  49215. !*** ./node_modules/asn1.js/lib/asn1/decoders/der.js ***!
  49216. \*******************************************************/
  49217. /*! no static exports found */
  49218. /***/ (function(module, exports, __webpack_require__) {
  49219. "use strict";
  49220. const inherits = __webpack_require__(/*! inherits */ 121);
  49221. const bignum = __webpack_require__(/*! bn.js */ 197);
  49222. const DecoderBuffer = __webpack_require__(/*! ../base/buffer */ 247).DecoderBuffer;
  49223. const Node = __webpack_require__(/*! ../base/node */ 245);
  49224. // Import DER constants
  49225. const der = __webpack_require__(/*! ../constants/der */ 248);
  49226. function DERDecoder(entity) {
  49227. this.enc = 'der';
  49228. this.name = entity.name;
  49229. this.entity = entity;
  49230. // Construct base tree
  49231. this.tree = new DERNode();
  49232. this.tree._init(entity.body);
  49233. }
  49234. module.exports = DERDecoder;
  49235. DERDecoder.prototype.decode = function decode(data, options) {
  49236. if (!DecoderBuffer.isDecoderBuffer(data)) {
  49237. data = new DecoderBuffer(data, options);
  49238. }
  49239. return this.tree._decode(data, options);
  49240. };
  49241. // Tree methods
  49242. function DERNode(parent) {
  49243. Node.call(this, 'der', parent);
  49244. }
  49245. inherits(DERNode, Node);
  49246. DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
  49247. if (buffer.isEmpty())
  49248. return false;
  49249. const state = buffer.save();
  49250. const decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
  49251. if (buffer.isError(decodedTag))
  49252. return decodedTag;
  49253. buffer.restore(state);
  49254. return decodedTag.tag === tag || decodedTag.tagStr === tag ||
  49255. (decodedTag.tagStr + 'of') === tag || any;
  49256. };
  49257. DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
  49258. const decodedTag = derDecodeTag(buffer,
  49259. 'Failed to decode tag of "' + tag + '"');
  49260. if (buffer.isError(decodedTag))
  49261. return decodedTag;
  49262. let len = derDecodeLen(buffer,
  49263. decodedTag.primitive,
  49264. 'Failed to get length of "' + tag + '"');
  49265. // Failure
  49266. if (buffer.isError(len))
  49267. return len;
  49268. if (!any &&
  49269. decodedTag.tag !== tag &&
  49270. decodedTag.tagStr !== tag &&
  49271. decodedTag.tagStr + 'of' !== tag) {
  49272. return buffer.error('Failed to match tag: "' + tag + '"');
  49273. }
  49274. if (decodedTag.primitive || len !== null)
  49275. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  49276. // Indefinite length... find END tag
  49277. const state = buffer.save();
  49278. const res = this._skipUntilEnd(
  49279. buffer,
  49280. 'Failed to skip indefinite length body: "' + this.tag + '"');
  49281. if (buffer.isError(res))
  49282. return res;
  49283. len = buffer.offset - state.offset;
  49284. buffer.restore(state);
  49285. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  49286. };
  49287. DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
  49288. for (;;) {
  49289. const tag = derDecodeTag(buffer, fail);
  49290. if (buffer.isError(tag))
  49291. return tag;
  49292. const len = derDecodeLen(buffer, tag.primitive, fail);
  49293. if (buffer.isError(len))
  49294. return len;
  49295. let res;
  49296. if (tag.primitive || len !== null)
  49297. res = buffer.skip(len);
  49298. else
  49299. res = this._skipUntilEnd(buffer, fail);
  49300. // Failure
  49301. if (buffer.isError(res))
  49302. return res;
  49303. if (tag.tagStr === 'end')
  49304. break;
  49305. }
  49306. };
  49307. DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
  49308. options) {
  49309. const result = [];
  49310. while (!buffer.isEmpty()) {
  49311. const possibleEnd = this._peekTag(buffer, 'end');
  49312. if (buffer.isError(possibleEnd))
  49313. return possibleEnd;
  49314. const res = decoder.decode(buffer, 'der', options);
  49315. if (buffer.isError(res) && possibleEnd)
  49316. break;
  49317. result.push(res);
  49318. }
  49319. return result;
  49320. };
  49321. DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
  49322. if (tag === 'bitstr') {
  49323. const unused = buffer.readUInt8();
  49324. if (buffer.isError(unused))
  49325. return unused;
  49326. return { unused: unused, data: buffer.raw() };
  49327. } else if (tag === 'bmpstr') {
  49328. const raw = buffer.raw();
  49329. if (raw.length % 2 === 1)
  49330. return buffer.error('Decoding of string type: bmpstr length mismatch');
  49331. let str = '';
  49332. for (let i = 0; i < raw.length / 2; i++) {
  49333. str += String.fromCharCode(raw.readUInt16BE(i * 2));
  49334. }
  49335. return str;
  49336. } else if (tag === 'numstr') {
  49337. const numstr = buffer.raw().toString('ascii');
  49338. if (!this._isNumstr(numstr)) {
  49339. return buffer.error('Decoding of string type: ' +
  49340. 'numstr unsupported characters');
  49341. }
  49342. return numstr;
  49343. } else if (tag === 'octstr') {
  49344. return buffer.raw();
  49345. } else if (tag === 'objDesc') {
  49346. return buffer.raw();
  49347. } else if (tag === 'printstr') {
  49348. const printstr = buffer.raw().toString('ascii');
  49349. if (!this._isPrintstr(printstr)) {
  49350. return buffer.error('Decoding of string type: ' +
  49351. 'printstr unsupported characters');
  49352. }
  49353. return printstr;
  49354. } else if (/str$/.test(tag)) {
  49355. return buffer.raw().toString();
  49356. } else {
  49357. return buffer.error('Decoding of string type: ' + tag + ' unsupported');
  49358. }
  49359. };
  49360. DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
  49361. let result;
  49362. const identifiers = [];
  49363. let ident = 0;
  49364. let subident = 0;
  49365. while (!buffer.isEmpty()) {
  49366. subident = buffer.readUInt8();
  49367. ident <<= 7;
  49368. ident |= subident & 0x7f;
  49369. if ((subident & 0x80) === 0) {
  49370. identifiers.push(ident);
  49371. ident = 0;
  49372. }
  49373. }
  49374. if (subident & 0x80)
  49375. identifiers.push(ident);
  49376. const first = (identifiers[0] / 40) | 0;
  49377. const second = identifiers[0] % 40;
  49378. if (relative)
  49379. result = identifiers;
  49380. else
  49381. result = [first, second].concat(identifiers.slice(1));
  49382. if (values) {
  49383. let tmp = values[result.join(' ')];
  49384. if (tmp === undefined)
  49385. tmp = values[result.join('.')];
  49386. if (tmp !== undefined)
  49387. result = tmp;
  49388. }
  49389. return result;
  49390. };
  49391. DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
  49392. const str = buffer.raw().toString();
  49393. let year;
  49394. let mon;
  49395. let day;
  49396. let hour;
  49397. let min;
  49398. let sec;
  49399. if (tag === 'gentime') {
  49400. year = str.slice(0, 4) | 0;
  49401. mon = str.slice(4, 6) | 0;
  49402. day = str.slice(6, 8) | 0;
  49403. hour = str.slice(8, 10) | 0;
  49404. min = str.slice(10, 12) | 0;
  49405. sec = str.slice(12, 14) | 0;
  49406. } else if (tag === 'utctime') {
  49407. year = str.slice(0, 2) | 0;
  49408. mon = str.slice(2, 4) | 0;
  49409. day = str.slice(4, 6) | 0;
  49410. hour = str.slice(6, 8) | 0;
  49411. min = str.slice(8, 10) | 0;
  49412. sec = str.slice(10, 12) | 0;
  49413. if (year < 70)
  49414. year = 2000 + year;
  49415. else
  49416. year = 1900 + year;
  49417. } else {
  49418. return buffer.error('Decoding ' + tag + ' time is not supported yet');
  49419. }
  49420. return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
  49421. };
  49422. DERNode.prototype._decodeNull = function decodeNull() {
  49423. return null;
  49424. };
  49425. DERNode.prototype._decodeBool = function decodeBool(buffer) {
  49426. const res = buffer.readUInt8();
  49427. if (buffer.isError(res))
  49428. return res;
  49429. else
  49430. return res !== 0;
  49431. };
  49432. DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
  49433. // Bigint, return as it is (assume big endian)
  49434. const raw = buffer.raw();
  49435. let res = new bignum(raw);
  49436. if (values)
  49437. res = values[res.toString(10)] || res;
  49438. return res;
  49439. };
  49440. DERNode.prototype._use = function use(entity, obj) {
  49441. if (typeof entity === 'function')
  49442. entity = entity(obj);
  49443. return entity._getDecoder('der').tree;
  49444. };
  49445. // Utility methods
  49446. function derDecodeTag(buf, fail) {
  49447. let tag = buf.readUInt8(fail);
  49448. if (buf.isError(tag))
  49449. return tag;
  49450. const cls = der.tagClass[tag >> 6];
  49451. const primitive = (tag & 0x20) === 0;
  49452. // Multi-octet tag - load
  49453. if ((tag & 0x1f) === 0x1f) {
  49454. let oct = tag;
  49455. tag = 0;
  49456. while ((oct & 0x80) === 0x80) {
  49457. oct = buf.readUInt8(fail);
  49458. if (buf.isError(oct))
  49459. return oct;
  49460. tag <<= 7;
  49461. tag |= oct & 0x7f;
  49462. }
  49463. } else {
  49464. tag &= 0x1f;
  49465. }
  49466. const tagStr = der.tag[tag];
  49467. return {
  49468. cls: cls,
  49469. primitive: primitive,
  49470. tag: tag,
  49471. tagStr: tagStr
  49472. };
  49473. }
  49474. function derDecodeLen(buf, primitive, fail) {
  49475. let len = buf.readUInt8(fail);
  49476. if (buf.isError(len))
  49477. return len;
  49478. // Indefinite form
  49479. if (!primitive && len === 0x80)
  49480. return null;
  49481. // Definite form
  49482. if ((len & 0x80) === 0) {
  49483. // Short form
  49484. return len;
  49485. }
  49486. // Long form
  49487. const num = len & 0x7f;
  49488. if (num > 4)
  49489. return buf.error('length octect is too long');
  49490. len = 0;
  49491. for (let i = 0; i < num; i++) {
  49492. len <<= 8;
  49493. const j = buf.readUInt8(fail);
  49494. if (buf.isError(j))
  49495. return j;
  49496. len |= j;
  49497. }
  49498. return len;
  49499. }
  49500. /***/ }),
  49501. /* 252 */
  49502. /*!*******************************************************!*\
  49503. !*** ./node_modules/asn1.js/lib/asn1/decoders/pem.js ***!
  49504. \*******************************************************/
  49505. /*! no static exports found */
  49506. /***/ (function(module, exports, __webpack_require__) {
  49507. "use strict";
  49508. const inherits = __webpack_require__(/*! inherits */ 121);
  49509. const Buffer = __webpack_require__(/*! safer-buffer */ 244).Buffer;
  49510. const DERDecoder = __webpack_require__(/*! ./der */ 251);
  49511. function PEMDecoder(entity) {
  49512. DERDecoder.call(this, entity);
  49513. this.enc = 'pem';
  49514. }
  49515. inherits(PEMDecoder, DERDecoder);
  49516. module.exports = PEMDecoder;
  49517. PEMDecoder.prototype.decode = function decode(data, options) {
  49518. const lines = data.toString().split(/[\r\n]+/g);
  49519. const label = options.label.toUpperCase();
  49520. const re = /^-----(BEGIN|END) ([^-]+)-----$/;
  49521. let start = -1;
  49522. let end = -1;
  49523. for (let i = 0; i < lines.length; i++) {
  49524. const match = lines[i].match(re);
  49525. if (match === null)
  49526. continue;
  49527. if (match[2] !== label)
  49528. continue;
  49529. if (start === -1) {
  49530. if (match[1] !== 'BEGIN')
  49531. break;
  49532. start = i;
  49533. } else {
  49534. if (match[1] !== 'END')
  49535. break;
  49536. end = i;
  49537. break;
  49538. }
  49539. }
  49540. if (start === -1 || end === -1)
  49541. throw new Error('PEM section not found for: ' + label);
  49542. const base64 = lines.slice(start + 1, end).join('');
  49543. // Remove excessive symbols
  49544. base64.replace(/[^a-z0-9+/=]+/gi, '');
  49545. const input = Buffer.from(base64, 'base64');
  49546. return DERDecoder.prototype.decode.call(this, input, options);
  49547. };
  49548. /***/ }),
  49549. /* 253 */
  49550. /*!*****************************************************!*\
  49551. !*** ./node_modules/asn1.js/lib/asn1/base/index.js ***!
  49552. \*****************************************************/
  49553. /*! no static exports found */
  49554. /***/ (function(module, exports, __webpack_require__) {
  49555. "use strict";
  49556. const base = exports;
  49557. base.Reporter = __webpack_require__(/*! ./reporter */ 246).Reporter;
  49558. base.DecoderBuffer = __webpack_require__(/*! ./buffer */ 247).DecoderBuffer;
  49559. base.EncoderBuffer = __webpack_require__(/*! ./buffer */ 247).EncoderBuffer;
  49560. base.Node = __webpack_require__(/*! ./node */ 245);
  49561. /***/ }),
  49562. /* 254 */
  49563. /*!**********************************************************!*\
  49564. !*** ./node_modules/asn1.js/lib/asn1/constants/index.js ***!
  49565. \**********************************************************/
  49566. /*! no static exports found */
  49567. /***/ (function(module, exports, __webpack_require__) {
  49568. "use strict";
  49569. const constants = exports;
  49570. // Helper
  49571. constants._reverse = function reverse(map) {
  49572. const res = {};
  49573. Object.keys(map).forEach(function(key) {
  49574. // Convert key to integer if it is stringified
  49575. if ((key | 0) == key)
  49576. key = key | 0;
  49577. const value = map[key];
  49578. res[value] = key;
  49579. });
  49580. return res;
  49581. };
  49582. constants.der = __webpack_require__(/*! ./der */ 248);
  49583. /***/ }),
  49584. /* 255 */
  49585. /*!************************************************!*\
  49586. !*** ./node_modules/parse-asn1/certificate.js ***!
  49587. \************************************************/
  49588. /*! no static exports found */
  49589. /***/ (function(module, exports, __webpack_require__) {
  49590. "use strict";
  49591. // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js
  49592. // thanks to @Rantanen
  49593. var asn = __webpack_require__(/*! asn1.js */ 240)
  49594. var Time = asn.define('Time', function () {
  49595. this.choice({
  49596. utcTime: this.utctime(),
  49597. generalTime: this.gentime()
  49598. })
  49599. })
  49600. var AttributeTypeValue = asn.define('AttributeTypeValue', function () {
  49601. this.seq().obj(
  49602. this.key('type').objid(),
  49603. this.key('value').any()
  49604. )
  49605. })
  49606. var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () {
  49607. this.seq().obj(
  49608. this.key('algorithm').objid(),
  49609. this.key('parameters').optional(),
  49610. this.key('curve').objid().optional()
  49611. )
  49612. })
  49613. var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () {
  49614. this.seq().obj(
  49615. this.key('algorithm').use(AlgorithmIdentifier),
  49616. this.key('subjectPublicKey').bitstr()
  49617. )
  49618. })
  49619. var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () {
  49620. this.setof(AttributeTypeValue)
  49621. })
  49622. var RDNSequence = asn.define('RDNSequence', function () {
  49623. this.seqof(RelativeDistinguishedName)
  49624. })
  49625. var Name = asn.define('Name', function () {
  49626. this.choice({
  49627. rdnSequence: this.use(RDNSequence)
  49628. })
  49629. })
  49630. var Validity = asn.define('Validity', function () {
  49631. this.seq().obj(
  49632. this.key('notBefore').use(Time),
  49633. this.key('notAfter').use(Time)
  49634. )
  49635. })
  49636. var Extension = asn.define('Extension', function () {
  49637. this.seq().obj(
  49638. this.key('extnID').objid(),
  49639. this.key('critical').bool().def(false),
  49640. this.key('extnValue').octstr()
  49641. )
  49642. })
  49643. var TBSCertificate = asn.define('TBSCertificate', function () {
  49644. this.seq().obj(
  49645. this.key('version').explicit(0).int().optional(),
  49646. this.key('serialNumber').int(),
  49647. this.key('signature').use(AlgorithmIdentifier),
  49648. this.key('issuer').use(Name),
  49649. this.key('validity').use(Validity),
  49650. this.key('subject').use(Name),
  49651. this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),
  49652. this.key('issuerUniqueID').implicit(1).bitstr().optional(),
  49653. this.key('subjectUniqueID').implicit(2).bitstr().optional(),
  49654. this.key('extensions').explicit(3).seqof(Extension).optional()
  49655. )
  49656. })
  49657. var X509Certificate = asn.define('X509Certificate', function () {
  49658. this.seq().obj(
  49659. this.key('tbsCertificate').use(TBSCertificate),
  49660. this.key('signatureAlgorithm').use(AlgorithmIdentifier),
  49661. this.key('signatureValue').bitstr()
  49662. )
  49663. })
  49664. module.exports = X509Certificate
  49665. /***/ }),
  49666. /* 256 */
  49667. /*!********************************************!*\
  49668. !*** ./node_modules/parse-asn1/aesid.json ***!
  49669. \********************************************/
  49670. /*! 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 */
  49671. /***/ (function(module) {
  49672. 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\"}");
  49673. /***/ }),
  49674. /* 257 */
  49675. /*!********************************************!*\
  49676. !*** ./node_modules/parse-asn1/fixProc.js ***!
  49677. \********************************************/
  49678. /*! no static exports found */
  49679. /***/ (function(module, exports, __webpack_require__) {
  49680. // adapted from https://github.com/apatil/pemstrip
  49681. 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
  49682. var startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m
  49683. var fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m
  49684. var evp = __webpack_require__(/*! evp_bytestokey */ 192)
  49685. var ciphers = __webpack_require__(/*! browserify-aes */ 175)
  49686. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  49687. module.exports = function (okey, password) {
  49688. var key = okey.toString()
  49689. var match = key.match(findProc)
  49690. var decrypted
  49691. if (!match) {
  49692. var match2 = key.match(fullRegex)
  49693. decrypted = Buffer.from(match2[2].replace(/[\r\n]/g, ''), 'base64')
  49694. } else {
  49695. var suite = 'aes' + match[1]
  49696. var iv = Buffer.from(match[2], 'hex')
  49697. var cipherText = Buffer.from(match[3].replace(/[\r\n]/g, ''), 'base64')
  49698. var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
  49699. var out = []
  49700. var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
  49701. out.push(cipher.update(cipherText))
  49702. out.push(cipher.final())
  49703. decrypted = Buffer.concat(out)
  49704. }
  49705. var tag = key.match(startRegex)[1]
  49706. return {
  49707. tag: tag,
  49708. data: decrypted
  49709. }
  49710. }
  49711. /***/ }),
  49712. /* 258 */
  49713. /*!**********************************************************!*\
  49714. !*** ./node_modules/browserify-sign/browser/curves.json ***!
  49715. \**********************************************************/
  49716. /*! 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 */
  49717. /***/ (function(module) {
  49718. 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\"}");
  49719. /***/ }),
  49720. /* 259 */
  49721. /*!********************************************************!*\
  49722. !*** ./node_modules/browserify-sign/browser/verify.js ***!
  49723. \********************************************************/
  49724. /*! no static exports found */
  49725. /***/ (function(module, exports, __webpack_require__) {
  49726. // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  49727. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  49728. var BN = __webpack_require__(/*! bn.js */ 197)
  49729. var EC = __webpack_require__(/*! elliptic */ 208).ec
  49730. var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
  49731. var curves = __webpack_require__(/*! ./curves.json */ 258)
  49732. function verify (sig, hash, key, signType, tag) {
  49733. var pub = parseKeys(key)
  49734. if (pub.type === 'ec') {
  49735. // rsa keys can be interpreted as ecdsa ones in openssl
  49736. if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
  49737. return ecVerify(sig, hash, pub)
  49738. } else if (pub.type === 'dsa') {
  49739. if (signType !== 'dsa') throw new Error('wrong public key type')
  49740. return dsaVerify(sig, hash, pub)
  49741. } else {
  49742. if (signType !== 'rsa' && signType !== 'ecdsa/rsa') throw new Error('wrong public key type')
  49743. }
  49744. hash = Buffer.concat([tag, hash])
  49745. var len = pub.modulus.byteLength()
  49746. var pad = [1]
  49747. var padNum = 0
  49748. while (hash.length + pad.length + 2 < len) {
  49749. pad.push(0xff)
  49750. padNum++
  49751. }
  49752. pad.push(0x00)
  49753. var i = -1
  49754. while (++i < hash.length) {
  49755. pad.push(hash[i])
  49756. }
  49757. pad = Buffer.from(pad)
  49758. var red = BN.mont(pub.modulus)
  49759. sig = new BN(sig).toRed(red)
  49760. sig = sig.redPow(new BN(pub.publicExponent))
  49761. sig = Buffer.from(sig.fromRed().toArray())
  49762. var out = padNum < 8 ? 1 : 0
  49763. len = Math.min(sig.length, pad.length)
  49764. if (sig.length !== pad.length) out = 1
  49765. i = -1
  49766. while (++i < len) out |= sig[i] ^ pad[i]
  49767. return out === 0
  49768. }
  49769. function ecVerify (sig, hash, pub) {
  49770. var curveId = curves[pub.data.algorithm.curve.join('.')]
  49771. if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
  49772. var curve = new EC(curveId)
  49773. var pubkey = pub.data.subjectPrivateKey.data
  49774. return curve.verify(hash, sig, pubkey)
  49775. }
  49776. function dsaVerify (sig, hash, pub) {
  49777. var p = pub.data.p
  49778. var q = pub.data.q
  49779. var g = pub.data.g
  49780. var y = pub.data.pub_key
  49781. var unpacked = parseKeys.signature.decode(sig, 'der')
  49782. var s = unpacked.s
  49783. var r = unpacked.r
  49784. checkValue(s, q)
  49785. checkValue(r, q)
  49786. var montp = BN.mont(p)
  49787. var w = s.invm(q)
  49788. var v = g.toRed(montp)
  49789. .redPow(new BN(hash).mul(w).mod(q))
  49790. .fromRed()
  49791. .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed())
  49792. .mod(p)
  49793. .mod(q)
  49794. return v.cmp(r) === 0
  49795. }
  49796. function checkValue (b, q) {
  49797. if (b.cmpn(0) <= 0) throw new Error('invalid sig')
  49798. if (b.cmp(q) >= q) throw new Error('invalid sig')
  49799. }
  49800. module.exports = verify
  49801. /***/ }),
  49802. /* 260 */
  49803. /*!*********************************************!*\
  49804. !*** ./node_modules/create-ecdh/browser.js ***!
  49805. \*********************************************/
  49806. /*! no static exports found */
  49807. /***/ (function(module, exports, __webpack_require__) {
  49808. /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(/*! elliptic */ 208)
  49809. var BN = __webpack_require__(/*! bn.js */ 197)
  49810. module.exports = function createECDH (curve) {
  49811. return new ECDH(curve)
  49812. }
  49813. var aliases = {
  49814. secp256k1: {
  49815. name: 'secp256k1',
  49816. byteLength: 32
  49817. },
  49818. secp224r1: {
  49819. name: 'p224',
  49820. byteLength: 28
  49821. },
  49822. prime256v1: {
  49823. name: 'p256',
  49824. byteLength: 32
  49825. },
  49826. prime192v1: {
  49827. name: 'p192',
  49828. byteLength: 24
  49829. },
  49830. ed25519: {
  49831. name: 'ed25519',
  49832. byteLength: 32
  49833. },
  49834. secp384r1: {
  49835. name: 'p384',
  49836. byteLength: 48
  49837. },
  49838. secp521r1: {
  49839. name: 'p521',
  49840. byteLength: 66
  49841. }
  49842. }
  49843. aliases.p224 = aliases.secp224r1
  49844. aliases.p256 = aliases.secp256r1 = aliases.prime256v1
  49845. aliases.p192 = aliases.secp192r1 = aliases.prime192v1
  49846. aliases.p384 = aliases.secp384r1
  49847. aliases.p521 = aliases.secp521r1
  49848. function ECDH (curve) {
  49849. this.curveType = aliases[curve]
  49850. if (!this.curveType) {
  49851. this.curveType = {
  49852. name: curve
  49853. }
  49854. }
  49855. this.curve = new elliptic.ec(this.curveType.name) // eslint-disable-line new-cap
  49856. this.keys = void 0
  49857. }
  49858. ECDH.prototype.generateKeys = function (enc, format) {
  49859. this.keys = this.curve.genKeyPair()
  49860. return this.getPublicKey(enc, format)
  49861. }
  49862. ECDH.prototype.computeSecret = function (other, inenc, enc) {
  49863. inenc = inenc || 'utf8'
  49864. if (!Buffer.isBuffer(other)) {
  49865. other = new Buffer(other, inenc)
  49866. }
  49867. var otherPub = this.curve.keyFromPublic(other).getPublic()
  49868. var out = otherPub.mul(this.keys.getPrivate()).getX()
  49869. return formatReturnValue(out, enc, this.curveType.byteLength)
  49870. }
  49871. ECDH.prototype.getPublicKey = function (enc, format) {
  49872. var key = this.keys.getPublic(format === 'compressed', true)
  49873. if (format === 'hybrid') {
  49874. if (key[key.length - 1] % 2) {
  49875. key[0] = 7
  49876. } else {
  49877. key[0] = 6
  49878. }
  49879. }
  49880. return formatReturnValue(key, enc)
  49881. }
  49882. ECDH.prototype.getPrivateKey = function (enc) {
  49883. return formatReturnValue(this.keys.getPrivate(), enc)
  49884. }
  49885. ECDH.prototype.setPublicKey = function (pub, enc) {
  49886. enc = enc || 'utf8'
  49887. if (!Buffer.isBuffer(pub)) {
  49888. pub = new Buffer(pub, enc)
  49889. }
  49890. this.keys._importPublic(pub)
  49891. return this
  49892. }
  49893. ECDH.prototype.setPrivateKey = function (priv, enc) {
  49894. enc = enc || 'utf8'
  49895. if (!Buffer.isBuffer(priv)) {
  49896. priv = new Buffer(priv, enc)
  49897. }
  49898. var _priv = new BN(priv)
  49899. _priv = _priv.toString(16)
  49900. this.keys = this.curve.genKeyPair()
  49901. this.keys._importPrivate(_priv)
  49902. return this
  49903. }
  49904. function formatReturnValue (bn, enc, len) {
  49905. if (!Array.isArray(bn)) {
  49906. bn = bn.toArray()
  49907. }
  49908. var buf = new Buffer(bn)
  49909. if (len && buf.length < len) {
  49910. var zeros = new Buffer(len - buf.length)
  49911. zeros.fill(0)
  49912. buf = Buffer.concat([zeros, buf])
  49913. }
  49914. if (!enc) {
  49915. return buf
  49916. } else {
  49917. return buf.toString(enc)
  49918. }
  49919. }
  49920. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../buffer/index.js */ 116).Buffer))
  49921. /***/ }),
  49922. /* 261 */
  49923. /*!************************************************!*\
  49924. !*** ./node_modules/public-encrypt/browser.js ***!
  49925. \************************************************/
  49926. /*! no static exports found */
  49927. /***/ (function(module, exports, __webpack_require__) {
  49928. exports.publicEncrypt = __webpack_require__(/*! ./publicEncrypt */ 262)
  49929. exports.privateDecrypt = __webpack_require__(/*! ./privateDecrypt */ 266)
  49930. exports.privateEncrypt = function privateEncrypt (key, buf) {
  49931. return exports.publicEncrypt(key, buf, true)
  49932. }
  49933. exports.publicDecrypt = function publicDecrypt (key, buf) {
  49934. return exports.privateDecrypt(key, buf, true)
  49935. }
  49936. /***/ }),
  49937. /* 262 */
  49938. /*!******************************************************!*\
  49939. !*** ./node_modules/public-encrypt/publicEncrypt.js ***!
  49940. \******************************************************/
  49941. /*! no static exports found */
  49942. /***/ (function(module, exports, __webpack_require__) {
  49943. var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
  49944. var randomBytes = __webpack_require__(/*! randombytes */ 112)
  49945. var createHash = __webpack_require__(/*! create-hash */ 120)
  49946. var mgf = __webpack_require__(/*! ./mgf */ 263)
  49947. var xor = __webpack_require__(/*! ./xor */ 264)
  49948. var BN = __webpack_require__(/*! bn.js */ 197)
  49949. var withPublic = __webpack_require__(/*! ./withPublic */ 265)
  49950. var crt = __webpack_require__(/*! browserify-rsa */ 207)
  49951. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  49952. module.exports = function publicEncrypt (publicKey, msg, reverse) {
  49953. var padding
  49954. if (publicKey.padding) {
  49955. padding = publicKey.padding
  49956. } else if (reverse) {
  49957. padding = 1
  49958. } else {
  49959. padding = 4
  49960. }
  49961. var key = parseKeys(publicKey)
  49962. var paddedMsg
  49963. if (padding === 4) {
  49964. paddedMsg = oaep(key, msg)
  49965. } else if (padding === 1) {
  49966. paddedMsg = pkcs1(key, msg, reverse)
  49967. } else if (padding === 3) {
  49968. paddedMsg = new BN(msg)
  49969. if (paddedMsg.cmp(key.modulus) >= 0) {
  49970. throw new Error('data too long for modulus')
  49971. }
  49972. } else {
  49973. throw new Error('unknown padding')
  49974. }
  49975. if (reverse) {
  49976. return crt(paddedMsg, key)
  49977. } else {
  49978. return withPublic(paddedMsg, key)
  49979. }
  49980. }
  49981. function oaep (key, msg) {
  49982. var k = key.modulus.byteLength()
  49983. var mLen = msg.length
  49984. var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
  49985. var hLen = iHash.length
  49986. var hLen2 = 2 * hLen
  49987. if (mLen > k - hLen2 - 2) {
  49988. throw new Error('message too long')
  49989. }
  49990. var ps = Buffer.alloc(k - mLen - hLen2 - 2)
  49991. var dblen = k - hLen - 1
  49992. var seed = randomBytes(hLen)
  49993. var maskedDb = xor(Buffer.concat([iHash, ps, Buffer.alloc(1, 1), msg], dblen), mgf(seed, dblen))
  49994. var maskedSeed = xor(seed, mgf(maskedDb, hLen))
  49995. return new BN(Buffer.concat([Buffer.alloc(1), maskedSeed, maskedDb], k))
  49996. }
  49997. function pkcs1 (key, msg, reverse) {
  49998. var mLen = msg.length
  49999. var k = key.modulus.byteLength()
  50000. if (mLen > k - 11) {
  50001. throw new Error('message too long')
  50002. }
  50003. var ps
  50004. if (reverse) {
  50005. ps = Buffer.alloc(k - mLen - 3, 0xff)
  50006. } else {
  50007. ps = nonZero(k - mLen - 3)
  50008. }
  50009. return new BN(Buffer.concat([Buffer.from([0, reverse ? 1 : 2]), ps, Buffer.alloc(1), msg], k))
  50010. }
  50011. function nonZero (len) {
  50012. var out = Buffer.allocUnsafe(len)
  50013. var i = 0
  50014. var cache = randomBytes(len * 2)
  50015. var cur = 0
  50016. var num
  50017. while (i < len) {
  50018. if (cur === cache.length) {
  50019. cache = randomBytes(len * 2)
  50020. cur = 0
  50021. }
  50022. num = cache[cur++]
  50023. if (num) {
  50024. out[i++] = num
  50025. }
  50026. }
  50027. return out
  50028. }
  50029. /***/ }),
  50030. /* 263 */
  50031. /*!********************************************!*\
  50032. !*** ./node_modules/public-encrypt/mgf.js ***!
  50033. \********************************************/
  50034. /*! no static exports found */
  50035. /***/ (function(module, exports, __webpack_require__) {
  50036. var createHash = __webpack_require__(/*! create-hash */ 120)
  50037. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  50038. module.exports = function (seed, len) {
  50039. var t = Buffer.alloc(0)
  50040. var i = 0
  50041. var c
  50042. while (t.length < len) {
  50043. c = i2ops(i++)
  50044. t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])
  50045. }
  50046. return t.slice(0, len)
  50047. }
  50048. function i2ops (c) {
  50049. var out = Buffer.allocUnsafe(4)
  50050. out.writeUInt32BE(c, 0)
  50051. return out
  50052. }
  50053. /***/ }),
  50054. /* 264 */
  50055. /*!********************************************!*\
  50056. !*** ./node_modules/public-encrypt/xor.js ***!
  50057. \********************************************/
  50058. /*! no static exports found */
  50059. /***/ (function(module, exports) {
  50060. module.exports = function xor (a, b) {
  50061. var len = a.length
  50062. var i = -1
  50063. while (++i < len) {
  50064. a[i] ^= b[i]
  50065. }
  50066. return a
  50067. }
  50068. /***/ }),
  50069. /* 265 */
  50070. /*!***************************************************!*\
  50071. !*** ./node_modules/public-encrypt/withPublic.js ***!
  50072. \***************************************************/
  50073. /*! no static exports found */
  50074. /***/ (function(module, exports, __webpack_require__) {
  50075. var BN = __webpack_require__(/*! bn.js */ 197)
  50076. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  50077. function withPublic (paddedMsg, key) {
  50078. return Buffer.from(paddedMsg
  50079. .toRed(BN.mont(key.modulus))
  50080. .redPow(new BN(key.publicExponent))
  50081. .fromRed()
  50082. .toArray())
  50083. }
  50084. module.exports = withPublic
  50085. /***/ }),
  50086. /* 266 */
  50087. /*!*******************************************************!*\
  50088. !*** ./node_modules/public-encrypt/privateDecrypt.js ***!
  50089. \*******************************************************/
  50090. /*! no static exports found */
  50091. /***/ (function(module, exports, __webpack_require__) {
  50092. var parseKeys = __webpack_require__(/*! parse-asn1 */ 238)
  50093. var mgf = __webpack_require__(/*! ./mgf */ 263)
  50094. var xor = __webpack_require__(/*! ./xor */ 264)
  50095. var BN = __webpack_require__(/*! bn.js */ 197)
  50096. var crt = __webpack_require__(/*! browserify-rsa */ 207)
  50097. var createHash = __webpack_require__(/*! create-hash */ 120)
  50098. var withPublic = __webpack_require__(/*! ./withPublic */ 265)
  50099. var Buffer = __webpack_require__(/*! safe-buffer */ 115).Buffer
  50100. module.exports = function privateDecrypt (privateKey, enc, reverse) {
  50101. var padding
  50102. if (privateKey.padding) {
  50103. padding = privateKey.padding
  50104. } else if (reverse) {
  50105. padding = 1
  50106. } else {
  50107. padding = 4
  50108. }
  50109. var key = parseKeys(privateKey)
  50110. var k = key.modulus.byteLength()
  50111. if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) {
  50112. throw new Error('decryption error')
  50113. }
  50114. var msg
  50115. if (reverse) {
  50116. msg = withPublic(new BN(enc), key)
  50117. } else {
  50118. msg = crt(enc, key)
  50119. }
  50120. var zBuffer = Buffer.alloc(k - msg.length)
  50121. msg = Buffer.concat([zBuffer, msg], k)
  50122. if (padding === 4) {
  50123. return oaep(key, msg)
  50124. } else if (padding === 1) {
  50125. return pkcs1(key, msg, reverse)
  50126. } else if (padding === 3) {
  50127. return msg
  50128. } else {
  50129. throw new Error('unknown padding')
  50130. }
  50131. }
  50132. function oaep (key, msg) {
  50133. var k = key.modulus.byteLength()
  50134. var iHash = createHash('sha1').update(Buffer.alloc(0)).digest()
  50135. var hLen = iHash.length
  50136. if (msg[0] !== 0) {
  50137. throw new Error('decryption error')
  50138. }
  50139. var maskedSeed = msg.slice(1, hLen + 1)
  50140. var maskedDb = msg.slice(hLen + 1)
  50141. var seed = xor(maskedSeed, mgf(maskedDb, hLen))
  50142. var db = xor(maskedDb, mgf(seed, k - hLen - 1))
  50143. if (compare(iHash, db.slice(0, hLen))) {
  50144. throw new Error('decryption error')
  50145. }
  50146. var i = hLen
  50147. while (db[i] === 0) {
  50148. i++
  50149. }
  50150. if (db[i++] !== 1) {
  50151. throw new Error('decryption error')
  50152. }
  50153. return db.slice(i)
  50154. }
  50155. function pkcs1 (key, msg, reverse) {
  50156. var p1 = msg.slice(0, 2)
  50157. var i = 2
  50158. var status = 0
  50159. while (msg[i++] !== 0) {
  50160. if (i >= msg.length) {
  50161. status++
  50162. break
  50163. }
  50164. }
  50165. var ps = msg.slice(2, i - 1)
  50166. if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) {
  50167. status++
  50168. }
  50169. if (ps.length < 8) {
  50170. status++
  50171. }
  50172. if (status) {
  50173. throw new Error('decryption error')
  50174. }
  50175. return msg.slice(i)
  50176. }
  50177. function compare (a, b) {
  50178. a = Buffer.from(a)
  50179. b = Buffer.from(b)
  50180. var dif = 0
  50181. var len = a.length
  50182. if (a.length !== b.length) {
  50183. dif++
  50184. len = Math.min(a.length, b.length)
  50185. }
  50186. var i = -1
  50187. while (++i < len) {
  50188. dif += (a[i] ^ b[i])
  50189. }
  50190. return dif
  50191. }
  50192. /***/ }),
  50193. /* 267 */
  50194. /*!********************************************!*\
  50195. !*** ./node_modules/randomfill/browser.js ***!
  50196. \********************************************/
  50197. /*! no static exports found */
  50198. /***/ (function(module, exports, __webpack_require__) {
  50199. "use strict";
  50200. /* WEBPACK VAR INJECTION */(function(global, process) {
  50201. function oldBrowser () {
  50202. throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
  50203. }
  50204. var safeBuffer = __webpack_require__(/*! safe-buffer */ 115)
  50205. var randombytes = __webpack_require__(/*! randombytes */ 112)
  50206. var Buffer = safeBuffer.Buffer
  50207. var kBufferMaxLength = safeBuffer.kMaxLength
  50208. var crypto = global.crypto || global.msCrypto
  50209. var kMaxUint32 = Math.pow(2, 32) - 1
  50210. function assertOffset (offset, length) {
  50211. if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare
  50212. throw new TypeError('offset must be a number')
  50213. }
  50214. if (offset > kMaxUint32 || offset < 0) {
  50215. throw new TypeError('offset must be a uint32')
  50216. }
  50217. if (offset > kBufferMaxLength || offset > length) {
  50218. throw new RangeError('offset out of range')
  50219. }
  50220. }
  50221. function assertSize (size, offset, length) {
  50222. if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare
  50223. throw new TypeError('size must be a number')
  50224. }
  50225. if (size > kMaxUint32 || size < 0) {
  50226. throw new TypeError('size must be a uint32')
  50227. }
  50228. if (size + offset > length || size > kBufferMaxLength) {
  50229. throw new RangeError('buffer too small')
  50230. }
  50231. }
  50232. if ((crypto && crypto.getRandomValues) || !process.browser) {
  50233. exports.randomFill = randomFill
  50234. exports.randomFillSync = randomFillSync
  50235. } else {
  50236. exports.randomFill = oldBrowser
  50237. exports.randomFillSync = oldBrowser
  50238. }
  50239. function randomFill (buf, offset, size, cb) {
  50240. if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
  50241. throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
  50242. }
  50243. if (typeof offset === 'function') {
  50244. cb = offset
  50245. offset = 0
  50246. size = buf.length
  50247. } else if (typeof size === 'function') {
  50248. cb = size
  50249. size = buf.length - offset
  50250. } else if (typeof cb !== 'function') {
  50251. throw new TypeError('"cb" argument must be a function')
  50252. }
  50253. assertOffset(offset, buf.length)
  50254. assertSize(size, offset, buf.length)
  50255. return actualFill(buf, offset, size, cb)
  50256. }
  50257. function actualFill (buf, offset, size, cb) {
  50258. if (process.browser) {
  50259. var ourBuf = buf.buffer
  50260. var uint = new Uint8Array(ourBuf, offset, size)
  50261. crypto.getRandomValues(uint)
  50262. if (cb) {
  50263. process.nextTick(function () {
  50264. cb(null, buf)
  50265. })
  50266. return
  50267. }
  50268. return buf
  50269. }
  50270. if (cb) {
  50271. randombytes(size, function (err, bytes) {
  50272. if (err) {
  50273. return cb(err)
  50274. }
  50275. bytes.copy(buf, offset)
  50276. cb(null, buf)
  50277. })
  50278. return
  50279. }
  50280. var bytes = randombytes(size)
  50281. bytes.copy(buf, offset)
  50282. return buf
  50283. }
  50284. function randomFillSync (buf, offset, size) {
  50285. if (typeof offset === 'undefined') {
  50286. offset = 0
  50287. }
  50288. if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) {
  50289. throw new TypeError('"buf" argument must be a Buffer or Uint8Array')
  50290. }
  50291. assertOffset(offset, buf.length)
  50292. if (size === undefined) size = buf.length - offset
  50293. assertSize(size, offset, buf.length)
  50294. return actualFill(buf, offset, size)
  50295. }
  50296. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 113)))
  50297. /***/ }),
  50298. /* 268 */,
  50299. /* 269 */,
  50300. /* 270 */,
  50301. /* 271 */,
  50302. /* 272 */,
  50303. /* 273 */,
  50304. /* 274 */,
  50305. /* 275 */,
  50306. /* 276 */,
  50307. /* 277 */,
  50308. /* 278 */,
  50309. /* 279 */,
  50310. /* 280 */,
  50311. /* 281 */,
  50312. /* 282 */,
  50313. /* 283 */,
  50314. /* 284 */,
  50315. /* 285 */,
  50316. /* 286 */,
  50317. /* 287 */,
  50318. /* 288 */,
  50319. /* 289 */,
  50320. /* 290 */,
  50321. /* 291 */,
  50322. /* 292 */,
  50323. /* 293 */,
  50324. /* 294 */,
  50325. /* 295 */,
  50326. /* 296 */,
  50327. /* 297 */,
  50328. /* 298 */,
  50329. /* 299 */,
  50330. /* 300 */
  50331. /*!********************************************************************!*\
  50332. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/index.js ***!
  50333. \********************************************************************/
  50334. /*! no static exports found */
  50335. /***/ (function(module, exports, __webpack_require__) {
  50336. "use strict";
  50337. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  50338. var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  50339. Object.defineProperty(exports, "__esModule", {
  50340. value: true
  50341. });
  50342. var _exportNames = {
  50343. ArgumentException: true,
  50344. ArithmeticException: true,
  50345. ChecksumException: true,
  50346. Exception: true,
  50347. FormatException: true,
  50348. IllegalArgumentException: true,
  50349. IllegalStateException: true,
  50350. NotFoundException: true,
  50351. ReaderException: true,
  50352. ReedSolomonException: true,
  50353. UnsupportedOperationException: true,
  50354. WriterException: true,
  50355. BarcodeFormat: true,
  50356. Binarizer: true,
  50357. BinaryBitmap: true,
  50358. DecodeHintType: true,
  50359. InvertedLuminanceSource: true,
  50360. LuminanceSource: true,
  50361. MultiFormatReader: true,
  50362. MultiFormatWriter: true,
  50363. PlanarYUVLuminanceSource: true,
  50364. Result: true,
  50365. ResultMetadataType: true,
  50366. RGBLuminanceSource: true,
  50367. ResultPoint: true,
  50368. ZXingSystem: true,
  50369. ZXingStringBuilder: true,
  50370. ZXingStringEncoding: true,
  50371. ZXingCharset: true,
  50372. ZXingArrays: true,
  50373. ZXingStandardCharsets: true,
  50374. ZXingInteger: true,
  50375. BitArray: true,
  50376. BitMatrix: true,
  50377. BitSource: true,
  50378. CharacterSetECI: true,
  50379. DecoderResult: true,
  50380. DefaultGridSampler: true,
  50381. DetectorResult: true,
  50382. EncodeHintType: true,
  50383. GlobalHistogramBinarizer: true,
  50384. GridSampler: true,
  50385. GridSamplerInstance: true,
  50386. HybridBinarizer: true,
  50387. PerspectiveTransform: true,
  50388. StringUtils: true,
  50389. MathUtils: true,
  50390. WhiteRectangleDetector: true,
  50391. GenericGF: true,
  50392. GenericGFPoly: true,
  50393. ReedSolomonDecoder: true,
  50394. ReedSolomonEncoder: true,
  50395. DataMatrixReader: true,
  50396. DataMatrixDecodedBitStreamParser: true,
  50397. DataMatrixDefaultPlacement: true,
  50398. DataMatrixErrorCorrection: true,
  50399. DataMatrixHighLevelEncoder: true,
  50400. DataMatrixSymbolInfo: true,
  50401. DataMatrixSymbolShapeHint: true,
  50402. DataMatrixWriter: true,
  50403. PDF417Reader: true,
  50404. PDF417ResultMetadata: true,
  50405. PDF417DecodedBitStreamParser: true,
  50406. PDF417DecoderErrorCorrection: true,
  50407. QRCodeReader: true,
  50408. QRCodeWriter: true,
  50409. QRCodeDecoderErrorCorrectionLevel: true,
  50410. QRCodeDecoderFormatInformation: true,
  50411. QRCodeVersion: true,
  50412. QRCodeMode: true,
  50413. QRCodeDecodedBitStreamParser: true,
  50414. QRCodeDataMask: true,
  50415. QRCodeEncoder: true,
  50416. QRCodeEncoderQRCode: true,
  50417. QRCodeMatrixUtil: true,
  50418. QRCodeByteMatrix: true,
  50419. QRCodeMaskUtil: true,
  50420. AztecCodeReader: true,
  50421. AztecCodeWriter: true,
  50422. AztecDetectorResult: true,
  50423. AztecEncoder: true,
  50424. AztecHighLevelEncoder: true,
  50425. AztecCode: true,
  50426. AztecDecoder: true,
  50427. AztecDetector: true,
  50428. AztecPoint: true,
  50429. OneDReader: true,
  50430. EAN13Reader: true,
  50431. Code128Reader: true,
  50432. ITFReader: true,
  50433. Code39Reader: true,
  50434. Code93Reader: true,
  50435. RSS14Reader: true,
  50436. RSSExpandedReader: true,
  50437. AbstractExpandedDecoder: true,
  50438. createAbstractExpandedDecoder: true,
  50439. MultiFormatOneDReader: true,
  50440. CodaBarReader: true
  50441. };
  50442. Object.defineProperty(exports, "AbstractExpandedDecoder", {
  50443. enumerable: true,
  50444. get: function get() {
  50445. return _AbstractExpandedDecoder.default;
  50446. }
  50447. });
  50448. Object.defineProperty(exports, "ArgumentException", {
  50449. enumerable: true,
  50450. get: function get() {
  50451. return _ArgumentException.default;
  50452. }
  50453. });
  50454. Object.defineProperty(exports, "ArithmeticException", {
  50455. enumerable: true,
  50456. get: function get() {
  50457. return _ArithmeticException.default;
  50458. }
  50459. });
  50460. Object.defineProperty(exports, "AztecCode", {
  50461. enumerable: true,
  50462. get: function get() {
  50463. return _AztecCode.default;
  50464. }
  50465. });
  50466. Object.defineProperty(exports, "AztecCodeReader", {
  50467. enumerable: true,
  50468. get: function get() {
  50469. return _AztecReader.default;
  50470. }
  50471. });
  50472. Object.defineProperty(exports, "AztecCodeWriter", {
  50473. enumerable: true,
  50474. get: function get() {
  50475. return _AztecWriter.default;
  50476. }
  50477. });
  50478. Object.defineProperty(exports, "AztecDecoder", {
  50479. enumerable: true,
  50480. get: function get() {
  50481. return _Decoder.default;
  50482. }
  50483. });
  50484. Object.defineProperty(exports, "AztecDetector", {
  50485. enumerable: true,
  50486. get: function get() {
  50487. return _Detector.default;
  50488. }
  50489. });
  50490. Object.defineProperty(exports, "AztecDetectorResult", {
  50491. enumerable: true,
  50492. get: function get() {
  50493. return _AztecDetectorResult.default;
  50494. }
  50495. });
  50496. Object.defineProperty(exports, "AztecEncoder", {
  50497. enumerable: true,
  50498. get: function get() {
  50499. return _Encoder2.default;
  50500. }
  50501. });
  50502. Object.defineProperty(exports, "AztecHighLevelEncoder", {
  50503. enumerable: true,
  50504. get: function get() {
  50505. return _HighLevelEncoder2.default;
  50506. }
  50507. });
  50508. Object.defineProperty(exports, "AztecPoint", {
  50509. enumerable: true,
  50510. get: function get() {
  50511. return _Detector.Point;
  50512. }
  50513. });
  50514. Object.defineProperty(exports, "BarcodeFormat", {
  50515. enumerable: true,
  50516. get: function get() {
  50517. return _BarcodeFormat.default;
  50518. }
  50519. });
  50520. Object.defineProperty(exports, "Binarizer", {
  50521. enumerable: true,
  50522. get: function get() {
  50523. return _Binarizer.default;
  50524. }
  50525. });
  50526. Object.defineProperty(exports, "BinaryBitmap", {
  50527. enumerable: true,
  50528. get: function get() {
  50529. return _BinaryBitmap.default;
  50530. }
  50531. });
  50532. Object.defineProperty(exports, "BitArray", {
  50533. enumerable: true,
  50534. get: function get() {
  50535. return _BitArray.default;
  50536. }
  50537. });
  50538. Object.defineProperty(exports, "BitMatrix", {
  50539. enumerable: true,
  50540. get: function get() {
  50541. return _BitMatrix.default;
  50542. }
  50543. });
  50544. Object.defineProperty(exports, "BitSource", {
  50545. enumerable: true,
  50546. get: function get() {
  50547. return _BitSource.default;
  50548. }
  50549. });
  50550. Object.defineProperty(exports, "CharacterSetECI", {
  50551. enumerable: true,
  50552. get: function get() {
  50553. return _CharacterSetECI.default;
  50554. }
  50555. });
  50556. Object.defineProperty(exports, "ChecksumException", {
  50557. enumerable: true,
  50558. get: function get() {
  50559. return _ChecksumException.default;
  50560. }
  50561. });
  50562. Object.defineProperty(exports, "CodaBarReader", {
  50563. enumerable: true,
  50564. get: function get() {
  50565. return _CodaBarReader.default;
  50566. }
  50567. });
  50568. Object.defineProperty(exports, "Code128Reader", {
  50569. enumerable: true,
  50570. get: function get() {
  50571. return _Code128Reader.default;
  50572. }
  50573. });
  50574. Object.defineProperty(exports, "Code39Reader", {
  50575. enumerable: true,
  50576. get: function get() {
  50577. return _Code39Reader.default;
  50578. }
  50579. });
  50580. Object.defineProperty(exports, "Code93Reader", {
  50581. enumerable: true,
  50582. get: function get() {
  50583. return _Code93Reader.default;
  50584. }
  50585. });
  50586. Object.defineProperty(exports, "DataMatrixDecodedBitStreamParser", {
  50587. enumerable: true,
  50588. get: function get() {
  50589. return _DecodedBitStreamParser.default;
  50590. }
  50591. });
  50592. Object.defineProperty(exports, "DataMatrixDefaultPlacement", {
  50593. enumerable: true,
  50594. get: function get() {
  50595. return _DefaultPlacement.default;
  50596. }
  50597. });
  50598. Object.defineProperty(exports, "DataMatrixErrorCorrection", {
  50599. enumerable: true,
  50600. get: function get() {
  50601. return _ErrorCorrection.default;
  50602. }
  50603. });
  50604. Object.defineProperty(exports, "DataMatrixHighLevelEncoder", {
  50605. enumerable: true,
  50606. get: function get() {
  50607. return _HighLevelEncoder.default;
  50608. }
  50609. });
  50610. Object.defineProperty(exports, "DataMatrixReader", {
  50611. enumerable: true,
  50612. get: function get() {
  50613. return _DataMatrixReader.default;
  50614. }
  50615. });
  50616. Object.defineProperty(exports, "DataMatrixSymbolInfo", {
  50617. enumerable: true,
  50618. get: function get() {
  50619. return _SymbolInfo.default;
  50620. }
  50621. });
  50622. Object.defineProperty(exports, "DataMatrixSymbolShapeHint", {
  50623. enumerable: true,
  50624. get: function get() {
  50625. return _constants.SymbolShapeHint;
  50626. }
  50627. });
  50628. Object.defineProperty(exports, "DataMatrixWriter", {
  50629. enumerable: true,
  50630. get: function get() {
  50631. return _DataMatrixWriter.default;
  50632. }
  50633. });
  50634. Object.defineProperty(exports, "DecodeHintType", {
  50635. enumerable: true,
  50636. get: function get() {
  50637. return _DecodeHintType.default;
  50638. }
  50639. });
  50640. Object.defineProperty(exports, "DecoderResult", {
  50641. enumerable: true,
  50642. get: function get() {
  50643. return _DecoderResult.default;
  50644. }
  50645. });
  50646. Object.defineProperty(exports, "DefaultGridSampler", {
  50647. enumerable: true,
  50648. get: function get() {
  50649. return _DefaultGridSampler.default;
  50650. }
  50651. });
  50652. Object.defineProperty(exports, "DetectorResult", {
  50653. enumerable: true,
  50654. get: function get() {
  50655. return _DetectorResult.default;
  50656. }
  50657. });
  50658. Object.defineProperty(exports, "EAN13Reader", {
  50659. enumerable: true,
  50660. get: function get() {
  50661. return _EAN13Reader.default;
  50662. }
  50663. });
  50664. Object.defineProperty(exports, "EncodeHintType", {
  50665. enumerable: true,
  50666. get: function get() {
  50667. return _EncodeHintType.default;
  50668. }
  50669. });
  50670. Object.defineProperty(exports, "Exception", {
  50671. enumerable: true,
  50672. get: function get() {
  50673. return _Exception.default;
  50674. }
  50675. });
  50676. Object.defineProperty(exports, "FormatException", {
  50677. enumerable: true,
  50678. get: function get() {
  50679. return _FormatException.default;
  50680. }
  50681. });
  50682. Object.defineProperty(exports, "GenericGF", {
  50683. enumerable: true,
  50684. get: function get() {
  50685. return _GenericGF.default;
  50686. }
  50687. });
  50688. Object.defineProperty(exports, "GenericGFPoly", {
  50689. enumerable: true,
  50690. get: function get() {
  50691. return _GenericGFPoly.default;
  50692. }
  50693. });
  50694. Object.defineProperty(exports, "GlobalHistogramBinarizer", {
  50695. enumerable: true,
  50696. get: function get() {
  50697. return _GlobalHistogramBinarizer.default;
  50698. }
  50699. });
  50700. Object.defineProperty(exports, "GridSampler", {
  50701. enumerable: true,
  50702. get: function get() {
  50703. return _GridSampler.default;
  50704. }
  50705. });
  50706. Object.defineProperty(exports, "GridSamplerInstance", {
  50707. enumerable: true,
  50708. get: function get() {
  50709. return _GridSamplerInstance.default;
  50710. }
  50711. });
  50712. Object.defineProperty(exports, "HybridBinarizer", {
  50713. enumerable: true,
  50714. get: function get() {
  50715. return _HybridBinarizer.default;
  50716. }
  50717. });
  50718. Object.defineProperty(exports, "ITFReader", {
  50719. enumerable: true,
  50720. get: function get() {
  50721. return _ITFReader.default;
  50722. }
  50723. });
  50724. Object.defineProperty(exports, "IllegalArgumentException", {
  50725. enumerable: true,
  50726. get: function get() {
  50727. return _IllegalArgumentException.default;
  50728. }
  50729. });
  50730. Object.defineProperty(exports, "IllegalStateException", {
  50731. enumerable: true,
  50732. get: function get() {
  50733. return _IllegalStateException.default;
  50734. }
  50735. });
  50736. Object.defineProperty(exports, "InvertedLuminanceSource", {
  50737. enumerable: true,
  50738. get: function get() {
  50739. return _InvertedLuminanceSource.default;
  50740. }
  50741. });
  50742. Object.defineProperty(exports, "LuminanceSource", {
  50743. enumerable: true,
  50744. get: function get() {
  50745. return _LuminanceSource.default;
  50746. }
  50747. });
  50748. Object.defineProperty(exports, "MathUtils", {
  50749. enumerable: true,
  50750. get: function get() {
  50751. return _MathUtils.default;
  50752. }
  50753. });
  50754. Object.defineProperty(exports, "MultiFormatOneDReader", {
  50755. enumerable: true,
  50756. get: function get() {
  50757. return _MultiFormatOneDReader.default;
  50758. }
  50759. });
  50760. Object.defineProperty(exports, "MultiFormatReader", {
  50761. enumerable: true,
  50762. get: function get() {
  50763. return _MultiFormatReader.default;
  50764. }
  50765. });
  50766. Object.defineProperty(exports, "MultiFormatWriter", {
  50767. enumerable: true,
  50768. get: function get() {
  50769. return _MultiFormatWriter.default;
  50770. }
  50771. });
  50772. Object.defineProperty(exports, "NotFoundException", {
  50773. enumerable: true,
  50774. get: function get() {
  50775. return _NotFoundException.default;
  50776. }
  50777. });
  50778. Object.defineProperty(exports, "OneDReader", {
  50779. enumerable: true,
  50780. get: function get() {
  50781. return _OneDReader.default;
  50782. }
  50783. });
  50784. Object.defineProperty(exports, "PDF417DecodedBitStreamParser", {
  50785. enumerable: true,
  50786. get: function get() {
  50787. return _DecodedBitStreamParser2.default;
  50788. }
  50789. });
  50790. Object.defineProperty(exports, "PDF417DecoderErrorCorrection", {
  50791. enumerable: true,
  50792. get: function get() {
  50793. return _ErrorCorrection2.default;
  50794. }
  50795. });
  50796. Object.defineProperty(exports, "PDF417Reader", {
  50797. enumerable: true,
  50798. get: function get() {
  50799. return _PDF417Reader.default;
  50800. }
  50801. });
  50802. Object.defineProperty(exports, "PDF417ResultMetadata", {
  50803. enumerable: true,
  50804. get: function get() {
  50805. return _PDF417ResultMetadata.default;
  50806. }
  50807. });
  50808. Object.defineProperty(exports, "PerspectiveTransform", {
  50809. enumerable: true,
  50810. get: function get() {
  50811. return _PerspectiveTransform.default;
  50812. }
  50813. });
  50814. Object.defineProperty(exports, "PlanarYUVLuminanceSource", {
  50815. enumerable: true,
  50816. get: function get() {
  50817. return _PlanarYUVLuminanceSource.default;
  50818. }
  50819. });
  50820. Object.defineProperty(exports, "QRCodeByteMatrix", {
  50821. enumerable: true,
  50822. get: function get() {
  50823. return _ByteMatrix.default;
  50824. }
  50825. });
  50826. Object.defineProperty(exports, "QRCodeDataMask", {
  50827. enumerable: true,
  50828. get: function get() {
  50829. return _DataMask.default;
  50830. }
  50831. });
  50832. Object.defineProperty(exports, "QRCodeDecodedBitStreamParser", {
  50833. enumerable: true,
  50834. get: function get() {
  50835. return _DecodedBitStreamParser3.default;
  50836. }
  50837. });
  50838. Object.defineProperty(exports, "QRCodeDecoderErrorCorrectionLevel", {
  50839. enumerable: true,
  50840. get: function get() {
  50841. return _ErrorCorrectionLevel.default;
  50842. }
  50843. });
  50844. Object.defineProperty(exports, "QRCodeDecoderFormatInformation", {
  50845. enumerable: true,
  50846. get: function get() {
  50847. return _FormatInformation.default;
  50848. }
  50849. });
  50850. Object.defineProperty(exports, "QRCodeEncoder", {
  50851. enumerable: true,
  50852. get: function get() {
  50853. return _Encoder.default;
  50854. }
  50855. });
  50856. Object.defineProperty(exports, "QRCodeEncoderQRCode", {
  50857. enumerable: true,
  50858. get: function get() {
  50859. return _QRCode.default;
  50860. }
  50861. });
  50862. Object.defineProperty(exports, "QRCodeMaskUtil", {
  50863. enumerable: true,
  50864. get: function get() {
  50865. return _MaskUtil.default;
  50866. }
  50867. });
  50868. Object.defineProperty(exports, "QRCodeMatrixUtil", {
  50869. enumerable: true,
  50870. get: function get() {
  50871. return _MatrixUtil.default;
  50872. }
  50873. });
  50874. Object.defineProperty(exports, "QRCodeMode", {
  50875. enumerable: true,
  50876. get: function get() {
  50877. return _Mode.default;
  50878. }
  50879. });
  50880. Object.defineProperty(exports, "QRCodeReader", {
  50881. enumerable: true,
  50882. get: function get() {
  50883. return _QRCodeReader.default;
  50884. }
  50885. });
  50886. Object.defineProperty(exports, "QRCodeVersion", {
  50887. enumerable: true,
  50888. get: function get() {
  50889. return _Version.default;
  50890. }
  50891. });
  50892. Object.defineProperty(exports, "QRCodeWriter", {
  50893. enumerable: true,
  50894. get: function get() {
  50895. return _QRCodeWriter.default;
  50896. }
  50897. });
  50898. Object.defineProperty(exports, "RGBLuminanceSource", {
  50899. enumerable: true,
  50900. get: function get() {
  50901. return _RGBLuminanceSource.default;
  50902. }
  50903. });
  50904. Object.defineProperty(exports, "RSS14Reader", {
  50905. enumerable: true,
  50906. get: function get() {
  50907. return _RSS14Reader.default;
  50908. }
  50909. });
  50910. Object.defineProperty(exports, "RSSExpandedReader", {
  50911. enumerable: true,
  50912. get: function get() {
  50913. return _RSSExpandedReader.default;
  50914. }
  50915. });
  50916. Object.defineProperty(exports, "ReaderException", {
  50917. enumerable: true,
  50918. get: function get() {
  50919. return _ReaderException.default;
  50920. }
  50921. });
  50922. Object.defineProperty(exports, "ReedSolomonDecoder", {
  50923. enumerable: true,
  50924. get: function get() {
  50925. return _ReedSolomonDecoder.default;
  50926. }
  50927. });
  50928. Object.defineProperty(exports, "ReedSolomonEncoder", {
  50929. enumerable: true,
  50930. get: function get() {
  50931. return _ReedSolomonEncoder.default;
  50932. }
  50933. });
  50934. Object.defineProperty(exports, "ReedSolomonException", {
  50935. enumerable: true,
  50936. get: function get() {
  50937. return _ReedSolomonException.default;
  50938. }
  50939. });
  50940. Object.defineProperty(exports, "Result", {
  50941. enumerable: true,
  50942. get: function get() {
  50943. return _Result.default;
  50944. }
  50945. });
  50946. Object.defineProperty(exports, "ResultMetadataType", {
  50947. enumerable: true,
  50948. get: function get() {
  50949. return _ResultMetadataType.default;
  50950. }
  50951. });
  50952. Object.defineProperty(exports, "ResultPoint", {
  50953. enumerable: true,
  50954. get: function get() {
  50955. return _ResultPoint.default;
  50956. }
  50957. });
  50958. Object.defineProperty(exports, "StringUtils", {
  50959. enumerable: true,
  50960. get: function get() {
  50961. return _StringUtils.default;
  50962. }
  50963. });
  50964. Object.defineProperty(exports, "UnsupportedOperationException", {
  50965. enumerable: true,
  50966. get: function get() {
  50967. return _UnsupportedOperationException.default;
  50968. }
  50969. });
  50970. Object.defineProperty(exports, "WhiteRectangleDetector", {
  50971. enumerable: true,
  50972. get: function get() {
  50973. return _WhiteRectangleDetector.default;
  50974. }
  50975. });
  50976. Object.defineProperty(exports, "WriterException", {
  50977. enumerable: true,
  50978. get: function get() {
  50979. return _WriterException.default;
  50980. }
  50981. });
  50982. Object.defineProperty(exports, "ZXingArrays", {
  50983. enumerable: true,
  50984. get: function get() {
  50985. return _Arrays.default;
  50986. }
  50987. });
  50988. Object.defineProperty(exports, "ZXingCharset", {
  50989. enumerable: true,
  50990. get: function get() {
  50991. return _Charset.default;
  50992. }
  50993. });
  50994. Object.defineProperty(exports, "ZXingInteger", {
  50995. enumerable: true,
  50996. get: function get() {
  50997. return _Integer.default;
  50998. }
  50999. });
  51000. Object.defineProperty(exports, "ZXingStandardCharsets", {
  51001. enumerable: true,
  51002. get: function get() {
  51003. return _StandardCharsets.default;
  51004. }
  51005. });
  51006. Object.defineProperty(exports, "ZXingStringBuilder", {
  51007. enumerable: true,
  51008. get: function get() {
  51009. return _StringBuilder.default;
  51010. }
  51011. });
  51012. Object.defineProperty(exports, "ZXingStringEncoding", {
  51013. enumerable: true,
  51014. get: function get() {
  51015. return _StringEncoding.default;
  51016. }
  51017. });
  51018. Object.defineProperty(exports, "ZXingSystem", {
  51019. enumerable: true,
  51020. get: function get() {
  51021. return _System.default;
  51022. }
  51023. });
  51024. Object.defineProperty(exports, "createAbstractExpandedDecoder", {
  51025. enumerable: true,
  51026. get: function get() {
  51027. return _AbstractExpandedDecoderComplement.createDecoder;
  51028. }
  51029. });
  51030. var _browser = __webpack_require__(/*! ./browser */ 301);
  51031. Object.keys(_browser).forEach(function (key) {
  51032. if (key === "default" || key === "__esModule") return;
  51033. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  51034. if (key in exports && exports[key] === _browser[key]) return;
  51035. Object.defineProperty(exports, key, {
  51036. enumerable: true,
  51037. get: function get() {
  51038. return _browser[key];
  51039. }
  51040. });
  51041. });
  51042. var _ArgumentException = _interopRequireDefault(__webpack_require__(/*! ./core/ArgumentException */ 304));
  51043. var _ArithmeticException = _interopRequireDefault(__webpack_require__(/*! ./core/ArithmeticException */ 341));
  51044. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ./core/ChecksumException */ 309));
  51045. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./core/Exception */ 305));
  51046. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ./core/FormatException */ 324));
  51047. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./core/IllegalArgumentException */ 308));
  51048. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ./core/IllegalStateException */ 344));
  51049. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ./core/NotFoundException */ 327));
  51050. var _ReaderException = _interopRequireDefault(__webpack_require__(/*! ./core/ReaderException */ 458));
  51051. var _ReedSolomonException = _interopRequireDefault(__webpack_require__(/*! ./core/ReedSolomonException */ 343));
  51052. var _UnsupportedOperationException = _interopRequireDefault(__webpack_require__(/*! ./core/UnsupportedOperationException */ 326));
  51053. var _WriterException = _interopRequireDefault(__webpack_require__(/*! ./core/WriterException */ 469));
  51054. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ./core/BarcodeFormat */ 334));
  51055. var _Binarizer = _interopRequireDefault(__webpack_require__(/*! ./core/Binarizer */ 312));
  51056. var _BinaryBitmap = _interopRequireDefault(__webpack_require__(/*! ./core/BinaryBitmap */ 307));
  51057. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ./core/DecodeHintType */ 322));
  51058. var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/InvertedLuminanceSource */ 329));
  51059. var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/LuminanceSource */ 330));
  51060. var _MultiFormatReader = _interopRequireDefault(__webpack_require__(/*! ./core/MultiFormatReader */ 413));
  51061. var _MultiFormatWriter = _interopRequireDefault(__webpack_require__(/*! ./core/MultiFormatWriter */ 473));
  51062. var _PlanarYUVLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/PlanarYUVLuminanceSource */ 475));
  51063. var _Result = _interopRequireDefault(__webpack_require__(/*! ./core/Result */ 333));
  51064. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ./core/ResultMetadataType */ 335));
  51065. var _RGBLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./core/RGBLuminanceSource */ 476));
  51066. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ./core/ResultPoint */ 346));
  51067. var _System = _interopRequireDefault(__webpack_require__(/*! ./core/util/System */ 315));
  51068. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ./core/util/StringBuilder */ 320));
  51069. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ./core/util/StringEncoding */ 325));
  51070. var _Charset = _interopRequireDefault(__webpack_require__(/*! ./core/util/Charset */ 477));
  51071. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ./core/util/Arrays */ 314));
  51072. var _StandardCharsets = _interopRequireDefault(__webpack_require__(/*! ./core/util/StandardCharsets */ 478));
  51073. var _Integer = _interopRequireDefault(__webpack_require__(/*! ./core/util/Integer */ 318));
  51074. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ./core/common/BitArray */ 313));
  51075. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./core/common/BitMatrix */ 319));
  51076. var _BitSource = _interopRequireDefault(__webpack_require__(/*! ./core/common/BitSource */ 410));
  51077. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ./core/common/CharacterSetECI */ 323));
  51078. var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ./core/common/DecoderResult */ 337));
  51079. var _DefaultGridSampler = _interopRequireDefault(__webpack_require__(/*! ./core/common/DefaultGridSampler */ 353));
  51080. var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ./core/common/DetectorResult */ 350));
  51081. var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ./core/EncodeHintType */ 462));
  51082. var _GlobalHistogramBinarizer = _interopRequireDefault(__webpack_require__(/*! ./core/common/GlobalHistogramBinarizer */ 311));
  51083. var _GridSampler = _interopRequireDefault(__webpack_require__(/*! ./core/common/GridSampler */ 354));
  51084. var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ./core/common/GridSamplerInstance */ 352));
  51085. var _HybridBinarizer = _interopRequireDefault(__webpack_require__(/*! ./core/common/HybridBinarizer */ 310));
  51086. var _PerspectiveTransform = _interopRequireDefault(__webpack_require__(/*! ./core/common/PerspectiveTransform */ 355));
  51087. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ./core/common/StringUtils */ 321));
  51088. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ./core/common/detector/MathUtils */ 347));
  51089. var _WhiteRectangleDetector = _interopRequireDefault(__webpack_require__(/*! ./core/common/detector/WhiteRectangleDetector */ 351));
  51090. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/GenericGF */ 338));
  51091. var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/GenericGFPoly */ 339));
  51092. var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/ReedSolomonDecoder */ 342));
  51093. var _ReedSolomonEncoder = _interopRequireDefault(__webpack_require__(/*! ./core/common/reedsolomon/ReedSolomonEncoder */ 464));
  51094. var _DataMatrixReader = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/DataMatrixReader */ 404));
  51095. var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/decoder/DecodedBitStreamParser */ 409));
  51096. var _DefaultPlacement = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/DefaultPlacement */ 479));
  51097. var _ErrorCorrection = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/ErrorCorrection */ 480));
  51098. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/HighLevelEncoder */ 482));
  51099. var _SymbolInfo = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/encoder/SymbolInfo */ 488));
  51100. var _constants = __webpack_require__(/*! ./core/datamatrix/encoder/constants */ 481);
  51101. var _DataMatrixWriter = _interopRequireDefault(__webpack_require__(/*! ./core/datamatrix/DataMatrixWriter */ 491));
  51102. var _PDF417Reader = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/PDF417Reader */ 433));
  51103. var _PDF417ResultMetadata = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/PDF417ResultMetadata */ 452));
  51104. var _DecodedBitStreamParser2 = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/decoder/DecodedBitStreamParser */ 451));
  51105. var _ErrorCorrection2 = _interopRequireDefault(__webpack_require__(/*! ./core/pdf417/decoder/ec/ErrorCorrection */ 438));
  51106. var _QRCodeReader = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/QRCodeReader */ 414));
  51107. var _QRCodeWriter = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/QRCodeWriter */ 474));
  51108. var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/ErrorCorrectionLevel */ 419));
  51109. var _FormatInformation = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/FormatInformation */ 418));
  51110. var _Version = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/Version */ 417));
  51111. var _Mode = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/Mode */ 425));
  51112. var _DecodedBitStreamParser3 = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/DecodedBitStreamParser */ 424));
  51113. var _DataMask = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/decoder/DataMask */ 422));
  51114. var _Encoder = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/Encoder */ 463));
  51115. var _QRCode = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/QRCode */ 467));
  51116. var _MatrixUtil = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/MatrixUtil */ 468));
  51117. var _ByteMatrix = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/ByteMatrix */ 466));
  51118. var _MaskUtil = _interopRequireDefault(__webpack_require__(/*! ./core/qrcode/encoder/MaskUtil */ 465));
  51119. var _AztecReader = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/AztecReader */ 332));
  51120. var _AztecWriter = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/AztecWriter */ 496));
  51121. var _AztecDetectorResult = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/AztecDetectorResult */ 349));
  51122. var _Encoder2 = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/encoder/Encoder */ 497));
  51123. var _HighLevelEncoder2 = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/encoder/HighLevelEncoder */ 499));
  51124. var _AztecCode = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/encoder/AztecCode */ 498));
  51125. var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./core/aztec/decoder/Decoder */ 336));
  51126. var _Detector = _interopRequireWildcard(__webpack_require__(/*! ./core/aztec/detector/Detector */ 345));
  51127. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/OneDReader */ 359));
  51128. var _EAN13Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/EAN13Reader */ 364));
  51129. var _Code128Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/Code128Reader */ 358));
  51130. var _ITFReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/ITFReader */ 362));
  51131. var _Code39Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/Code39Reader */ 360));
  51132. var _Code93Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/Code93Reader */ 361));
  51133. var _RSS14Reader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/rss/RSS14Reader */ 401));
  51134. var _RSSExpandedReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/rss/expanded/RSSExpandedReader */ 374));
  51135. var _AbstractExpandedDecoder = _interopRequireDefault(__webpack_require__(/*! ./core/oned/rss/expanded/decoders/AbstractExpandedDecoder */ 390));
  51136. var _AbstractExpandedDecoderComplement = __webpack_require__(/*! ./core/oned/rss/expanded/decoders/AbstractExpandedDecoderComplement */ 380);
  51137. var _MultiFormatOneDReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/MultiFormatOneDReader */ 357));
  51138. var _CodaBarReader = _interopRequireDefault(__webpack_require__(/*! ./core/oned/CodaBarReader */ 373));
  51139. function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  51140. function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  51141. /***/ }),
  51142. /* 301 */
  51143. /*!**********************************************************************!*\
  51144. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser.js ***!
  51145. \**********************************************************************/
  51146. /*! no static exports found */
  51147. /***/ (function(module, exports, __webpack_require__) {
  51148. "use strict";
  51149. Object.defineProperty(exports, "__esModule", {
  51150. value: true
  51151. });
  51152. var _BrowserAztecCodeReader = __webpack_require__(/*! ./browser/BrowserAztecCodeReader */ 302);
  51153. Object.keys(_BrowserAztecCodeReader).forEach(function (key) {
  51154. if (key === "default" || key === "__esModule") return;
  51155. if (key in exports && exports[key] === _BrowserAztecCodeReader[key]) return;
  51156. Object.defineProperty(exports, key, {
  51157. enumerable: true,
  51158. get: function get() {
  51159. return _BrowserAztecCodeReader[key];
  51160. }
  51161. });
  51162. });
  51163. var _BrowserBarcodeReader = __webpack_require__(/*! ./browser/BrowserBarcodeReader */ 356);
  51164. Object.keys(_BrowserBarcodeReader).forEach(function (key) {
  51165. if (key === "default" || key === "__esModule") return;
  51166. if (key in exports && exports[key] === _BrowserBarcodeReader[key]) return;
  51167. Object.defineProperty(exports, key, {
  51168. enumerable: true,
  51169. get: function get() {
  51170. return _BrowserBarcodeReader[key];
  51171. }
  51172. });
  51173. });
  51174. var _BrowserCodeReader = __webpack_require__(/*! ./browser/BrowserCodeReader */ 303);
  51175. Object.keys(_BrowserCodeReader).forEach(function (key) {
  51176. if (key === "default" || key === "__esModule") return;
  51177. if (key in exports && exports[key] === _BrowserCodeReader[key]) return;
  51178. Object.defineProperty(exports, key, {
  51179. enumerable: true,
  51180. get: function get() {
  51181. return _BrowserCodeReader[key];
  51182. }
  51183. });
  51184. });
  51185. var _BrowserDatamatrixCodeReader = __webpack_require__(/*! ./browser/BrowserDatamatrixCodeReader */ 403);
  51186. Object.keys(_BrowserDatamatrixCodeReader).forEach(function (key) {
  51187. if (key === "default" || key === "__esModule") return;
  51188. if (key in exports && exports[key] === _BrowserDatamatrixCodeReader[key]) return;
  51189. Object.defineProperty(exports, key, {
  51190. enumerable: true,
  51191. get: function get() {
  51192. return _BrowserDatamatrixCodeReader[key];
  51193. }
  51194. });
  51195. });
  51196. var _BrowserMultiFormatReader = __webpack_require__(/*! ./browser/BrowserMultiFormatReader */ 412);
  51197. Object.keys(_BrowserMultiFormatReader).forEach(function (key) {
  51198. if (key === "default" || key === "__esModule") return;
  51199. if (key in exports && exports[key] === _BrowserMultiFormatReader[key]) return;
  51200. Object.defineProperty(exports, key, {
  51201. enumerable: true,
  51202. get: function get() {
  51203. return _BrowserMultiFormatReader[key];
  51204. }
  51205. });
  51206. });
  51207. var _BrowserPDF417Reader = __webpack_require__(/*! ./browser/BrowserPDF417Reader */ 459);
  51208. Object.keys(_BrowserPDF417Reader).forEach(function (key) {
  51209. if (key === "default" || key === "__esModule") return;
  51210. if (key in exports && exports[key] === _BrowserPDF417Reader[key]) return;
  51211. Object.defineProperty(exports, key, {
  51212. enumerable: true,
  51213. get: function get() {
  51214. return _BrowserPDF417Reader[key];
  51215. }
  51216. });
  51217. });
  51218. var _BrowserQRCodeReader = __webpack_require__(/*! ./browser/BrowserQRCodeReader */ 460);
  51219. Object.keys(_BrowserQRCodeReader).forEach(function (key) {
  51220. if (key === "default" || key === "__esModule") return;
  51221. if (key in exports && exports[key] === _BrowserQRCodeReader[key]) return;
  51222. Object.defineProperty(exports, key, {
  51223. enumerable: true,
  51224. get: function get() {
  51225. return _BrowserQRCodeReader[key];
  51226. }
  51227. });
  51228. });
  51229. var _BrowserQRCodeSvgWriter = __webpack_require__(/*! ./browser/BrowserQRCodeSvgWriter */ 461);
  51230. Object.keys(_BrowserQRCodeSvgWriter).forEach(function (key) {
  51231. if (key === "default" || key === "__esModule") return;
  51232. if (key in exports && exports[key] === _BrowserQRCodeSvgWriter[key]) return;
  51233. Object.defineProperty(exports, key, {
  51234. enumerable: true,
  51235. get: function get() {
  51236. return _BrowserQRCodeSvgWriter[key];
  51237. }
  51238. });
  51239. });
  51240. var _DecodeContinuouslyCallback = __webpack_require__(/*! ./browser/DecodeContinuouslyCallback */ 471);
  51241. Object.keys(_DecodeContinuouslyCallback).forEach(function (key) {
  51242. if (key === "default" || key === "__esModule") return;
  51243. if (key in exports && exports[key] === _DecodeContinuouslyCallback[key]) return;
  51244. Object.defineProperty(exports, key, {
  51245. enumerable: true,
  51246. get: function get() {
  51247. return _DecodeContinuouslyCallback[key];
  51248. }
  51249. });
  51250. });
  51251. var _HTMLCanvasElementLuminanceSource = __webpack_require__(/*! ./browser/HTMLCanvasElementLuminanceSource */ 328);
  51252. Object.keys(_HTMLCanvasElementLuminanceSource).forEach(function (key) {
  51253. if (key === "default" || key === "__esModule") return;
  51254. if (key in exports && exports[key] === _HTMLCanvasElementLuminanceSource[key]) return;
  51255. Object.defineProperty(exports, key, {
  51256. enumerable: true,
  51257. get: function get() {
  51258. return _HTMLCanvasElementLuminanceSource[key];
  51259. }
  51260. });
  51261. });
  51262. var _HTMLVisualMediaElement = __webpack_require__(/*! ./browser/HTMLVisualMediaElement */ 472);
  51263. Object.keys(_HTMLVisualMediaElement).forEach(function (key) {
  51264. if (key === "default" || key === "__esModule") return;
  51265. if (key in exports && exports[key] === _HTMLVisualMediaElement[key]) return;
  51266. Object.defineProperty(exports, key, {
  51267. enumerable: true,
  51268. get: function get() {
  51269. return _HTMLVisualMediaElement[key];
  51270. }
  51271. });
  51272. });
  51273. var _VideoInputDevice = __webpack_require__(/*! ./browser/VideoInputDevice */ 331);
  51274. Object.keys(_VideoInputDevice).forEach(function (key) {
  51275. if (key === "default" || key === "__esModule") return;
  51276. if (key in exports && exports[key] === _VideoInputDevice[key]) return;
  51277. Object.defineProperty(exports, key, {
  51278. enumerable: true,
  51279. get: function get() {
  51280. return _VideoInputDevice[key];
  51281. }
  51282. });
  51283. });
  51284. /***/ }),
  51285. /* 302 */
  51286. /*!*********************************************************************************************!*\
  51287. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserAztecCodeReader.js ***!
  51288. \*********************************************************************************************/
  51289. /*! no static exports found */
  51290. /***/ (function(module, exports, __webpack_require__) {
  51291. "use strict";
  51292. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  51293. Object.defineProperty(exports, "__esModule", {
  51294. value: true
  51295. });
  51296. exports.BrowserAztecCodeReader = void 0;
  51297. var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
  51298. var _AztecReader = _interopRequireDefault(__webpack_require__(/*! ../core/aztec/AztecReader */ 332));
  51299. var __extends = void 0 && (void 0).__extends || function () {
  51300. var _extendStatics = function extendStatics(d, b) {
  51301. _extendStatics = Object.setPrototypeOf || {
  51302. __proto__: []
  51303. } instanceof Array && function (d, b) {
  51304. d.__proto__ = b;
  51305. } || function (d, b) {
  51306. for (var p in b) {
  51307. if (b.hasOwnProperty(p)) d[p] = b[p];
  51308. }
  51309. };
  51310. return _extendStatics(d, b);
  51311. };
  51312. return function (d, b) {
  51313. _extendStatics(d, b);
  51314. function __() {
  51315. this.constructor = d;
  51316. }
  51317. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  51318. };
  51319. }();
  51320. /**
  51321. * Aztec Code reader to use from browser.
  51322. *
  51323. * @class BrowserAztecCodeReader
  51324. * @extends {BrowserCodeReader}
  51325. */
  51326. var BrowserAztecCodeReader = /** @class */function (_super) {
  51327. __extends(BrowserAztecCodeReader, _super);
  51328. /**
  51329. * Creates an instance of BrowserAztecCodeReader.
  51330. * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
  51331. *
  51332. * @memberOf BrowserAztecCodeReader
  51333. */
  51334. function BrowserAztecCodeReader(timeBetweenScansMillis) {
  51335. if (timeBetweenScansMillis === void 0) {
  51336. timeBetweenScansMillis = 500;
  51337. }
  51338. return _super.call(this, new _AztecReader.default(), timeBetweenScansMillis) || this;
  51339. }
  51340. return BrowserAztecCodeReader;
  51341. }(_BrowserCodeReader.BrowserCodeReader);
  51342. exports.BrowserAztecCodeReader = BrowserAztecCodeReader;
  51343. /***/ }),
  51344. /* 303 */
  51345. /*!****************************************************************************************!*\
  51346. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserCodeReader.js ***!
  51347. \****************************************************************************************/
  51348. /*! no static exports found */
  51349. /***/ (function(module, exports, __webpack_require__) {
  51350. "use strict";
  51351. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  51352. Object.defineProperty(exports, "__esModule", {
  51353. value: true
  51354. });
  51355. exports.BrowserCodeReader = void 0;
  51356. var _ArgumentException = _interopRequireDefault(__webpack_require__(/*! ../core/ArgumentException */ 304));
  51357. var _BinaryBitmap = _interopRequireDefault(__webpack_require__(/*! ../core/BinaryBitmap */ 307));
  51358. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../core/ChecksumException */ 309));
  51359. var _HybridBinarizer = _interopRequireDefault(__webpack_require__(/*! ../core/common/HybridBinarizer */ 310));
  51360. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../core/FormatException */ 324));
  51361. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../core/NotFoundException */ 327));
  51362. var _HTMLCanvasElementLuminanceSource = __webpack_require__(/*! ./HTMLCanvasElementLuminanceSource */ 328);
  51363. var _VideoInputDevice = __webpack_require__(/*! ./VideoInputDevice */ 331);
  51364. var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
  51365. function adopt(value) {
  51366. return value instanceof P ? value : new P(function (resolve) {
  51367. resolve(value);
  51368. });
  51369. }
  51370. return new (P || (P = Promise))(function (resolve, reject) {
  51371. function fulfilled(value) {
  51372. try {
  51373. step(generator.next(value));
  51374. } catch (e) {
  51375. reject(e);
  51376. }
  51377. }
  51378. function rejected(value) {
  51379. try {
  51380. step(generator["throw"](value));
  51381. } catch (e) {
  51382. reject(e);
  51383. }
  51384. }
  51385. function step(result) {
  51386. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  51387. }
  51388. step((generator = generator.apply(thisArg, _arguments || [])).next());
  51389. });
  51390. };
  51391. var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
  51392. var _ = {
  51393. label: 0,
  51394. sent: function sent() {
  51395. if (t[0] & 1) throw t[1];
  51396. return t[1];
  51397. },
  51398. trys: [],
  51399. ops: []
  51400. },
  51401. f,
  51402. y,
  51403. t,
  51404. g;
  51405. return g = {
  51406. next: verb(0),
  51407. "throw": verb(1),
  51408. "return": verb(2)
  51409. }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
  51410. return this;
  51411. }), g;
  51412. function verb(n) {
  51413. return function (v) {
  51414. return step([n, v]);
  51415. };
  51416. }
  51417. function step(op) {
  51418. if (f) throw new TypeError("Generator is already executing.");
  51419. while (_) {
  51420. try {
  51421. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  51422. if (y = 0, t) op = [op[0] & 2, t.value];
  51423. switch (op[0]) {
  51424. case 0:
  51425. case 1:
  51426. t = op;
  51427. break;
  51428. case 4:
  51429. _.label++;
  51430. return {
  51431. value: op[1],
  51432. done: false
  51433. };
  51434. case 5:
  51435. _.label++;
  51436. y = op[1];
  51437. op = [0];
  51438. continue;
  51439. case 7:
  51440. op = _.ops.pop();
  51441. _.trys.pop();
  51442. continue;
  51443. default:
  51444. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  51445. _ = 0;
  51446. continue;
  51447. }
  51448. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  51449. _.label = op[1];
  51450. break;
  51451. }
  51452. if (op[0] === 6 && _.label < t[1]) {
  51453. _.label = t[1];
  51454. t = op;
  51455. break;
  51456. }
  51457. if (t && _.label < t[2]) {
  51458. _.label = t[2];
  51459. _.ops.push(op);
  51460. break;
  51461. }
  51462. if (t[2]) _.ops.pop();
  51463. _.trys.pop();
  51464. continue;
  51465. }
  51466. op = body.call(thisArg, _);
  51467. } catch (e) {
  51468. op = [6, e];
  51469. y = 0;
  51470. } finally {
  51471. f = t = 0;
  51472. }
  51473. }
  51474. if (op[0] & 5) throw op[1];
  51475. return {
  51476. value: op[0] ? op[1] : void 0,
  51477. done: true
  51478. };
  51479. }
  51480. };
  51481. var __values = void 0 && (void 0).__values || function (o) {
  51482. var s = typeof Symbol === "function" && Symbol.iterator,
  51483. m = s && o[s],
  51484. i = 0;
  51485. if (m) return m.call(o);
  51486. if (o && typeof o.length === "number") return {
  51487. next: function next() {
  51488. if (o && i >= o.length) o = void 0;
  51489. return {
  51490. value: o && o[i++],
  51491. done: !o
  51492. };
  51493. }
  51494. };
  51495. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  51496. };
  51497. /**
  51498. * @deprecated Moving to @zxing/browser
  51499. *
  51500. * Base class for browser code reader.
  51501. */
  51502. var BrowserCodeReader = /** @class */function () {
  51503. /**
  51504. * Creates an instance of BrowserCodeReader.
  51505. * @param {Reader} reader The reader instance to decode the barcode
  51506. * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent successful decode tries
  51507. *
  51508. * @memberOf BrowserCodeReader
  51509. */
  51510. function BrowserCodeReader(reader, timeBetweenScansMillis, _hints) {
  51511. if (timeBetweenScansMillis === void 0) {
  51512. timeBetweenScansMillis = 500;
  51513. }
  51514. this.reader = reader;
  51515. this.timeBetweenScansMillis = timeBetweenScansMillis;
  51516. this._hints = _hints;
  51517. /**
  51518. * This will break the loop.
  51519. */
  51520. this._stopContinuousDecode = false;
  51521. /**
  51522. * This will break the loop.
  51523. */
  51524. this._stopAsyncDecode = false;
  51525. /**
  51526. * Delay time between decode attempts made by the scanner.
  51527. */
  51528. this._timeBetweenDecodingAttempts = 0;
  51529. }
  51530. Object.defineProperty(BrowserCodeReader.prototype, "hasNavigator", {
  51531. /**
  51532. * If navigator is present.
  51533. */
  51534. get: function get() {
  51535. return typeof navigator !== 'undefined';
  51536. },
  51537. enumerable: false,
  51538. configurable: true
  51539. });
  51540. Object.defineProperty(BrowserCodeReader.prototype, "isMediaDevicesSuported", {
  51541. /**
  51542. * If mediaDevices under navigator is supported.
  51543. */
  51544. get: function get() {
  51545. return this.hasNavigator && !!navigator.mediaDevices;
  51546. },
  51547. enumerable: false,
  51548. configurable: true
  51549. });
  51550. Object.defineProperty(BrowserCodeReader.prototype, "canEnumerateDevices", {
  51551. /**
  51552. * If enumerateDevices under navigator is supported.
  51553. */
  51554. get: function get() {
  51555. return !!(this.isMediaDevicesSuported && navigator.mediaDevices.enumerateDevices);
  51556. },
  51557. enumerable: false,
  51558. configurable: true
  51559. });
  51560. Object.defineProperty(BrowserCodeReader.prototype, "timeBetweenDecodingAttempts", {
  51561. /** Time between two decoding tries in milli seconds. */
  51562. get: function get() {
  51563. return this._timeBetweenDecodingAttempts;
  51564. },
  51565. /**
  51566. * Change the time span the decoder waits between two decoding tries.
  51567. *
  51568. * @param {number} millis Time between two decoding tries in milli seconds.
  51569. */
  51570. set: function set(millis) {
  51571. this._timeBetweenDecodingAttempts = millis < 0 ? 0 : millis;
  51572. },
  51573. enumerable: false,
  51574. configurable: true
  51575. });
  51576. Object.defineProperty(BrowserCodeReader.prototype, "hints", {
  51577. /**
  51578. * Sets the hints.
  51579. */
  51580. get: function get() {
  51581. return this._hints;
  51582. },
  51583. /**
  51584. * Sets the hints.
  51585. */
  51586. set: function set(hints) {
  51587. this._hints = hints || null;
  51588. },
  51589. enumerable: false,
  51590. configurable: true
  51591. });
  51592. /**
  51593. * Lists all the available video input devices.
  51594. */
  51595. BrowserCodeReader.prototype.listVideoInputDevices = function () {
  51596. return __awaiter(this, void 0, void 0, function () {
  51597. var devices, videoDevices, devices_1, devices_1_1, device, kind, deviceId, label, groupId, videoDevice;
  51598. var e_1, _a;
  51599. return __generator(this, function (_b) {
  51600. switch (_b.label) {
  51601. case 0:
  51602. if (!this.hasNavigator) {
  51603. throw new Error("Can't enumerate devices, navigator is not present.");
  51604. }
  51605. if (!this.canEnumerateDevices) {
  51606. throw new Error("Can't enumerate devices, method not supported.");
  51607. }
  51608. return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
  51609. case 1:
  51610. devices = _b.sent();
  51611. videoDevices = [];
  51612. try {
  51613. for (devices_1 = __values(devices), devices_1_1 = devices_1.next(); !devices_1_1.done; devices_1_1 = devices_1.next()) {
  51614. device = devices_1_1.value;
  51615. kind = device.kind === 'video' ? 'videoinput' : device.kind;
  51616. if (kind !== 'videoinput') {
  51617. continue;
  51618. }
  51619. deviceId = device.deviceId || device.id;
  51620. label = device.label || "Video device " + (videoDevices.length + 1);
  51621. groupId = device.groupId;
  51622. videoDevice = {
  51623. deviceId: deviceId,
  51624. label: label,
  51625. kind: kind,
  51626. groupId: groupId
  51627. };
  51628. videoDevices.push(videoDevice);
  51629. }
  51630. } catch (e_1_1) {
  51631. e_1 = {
  51632. error: e_1_1
  51633. };
  51634. } finally {
  51635. try {
  51636. if (devices_1_1 && !devices_1_1.done && (_a = devices_1.return)) _a.call(devices_1);
  51637. } finally {
  51638. if (e_1) throw e_1.error;
  51639. }
  51640. }
  51641. return [2 /*return*/, videoDevices];
  51642. }
  51643. });
  51644. });
  51645. };
  51646. /**
  51647. * Obtain the list of available devices with type 'videoinput'.
  51648. *
  51649. * @returns {Promise<VideoInputDevice[]>} an array of available video input devices
  51650. *
  51651. * @memberOf BrowserCodeReader
  51652. *
  51653. * @deprecated Use `listVideoInputDevices` instead.
  51654. */
  51655. BrowserCodeReader.prototype.getVideoInputDevices = function () {
  51656. return __awaiter(this, void 0, void 0, function () {
  51657. var devices;
  51658. return __generator(this, function (_a) {
  51659. switch (_a.label) {
  51660. case 0:
  51661. return [4 /*yield*/, this.listVideoInputDevices()];
  51662. case 1:
  51663. devices = _a.sent();
  51664. return [2 /*return*/, devices.map(function (d) {
  51665. return new _VideoInputDevice.VideoInputDevice(d.deviceId, d.label);
  51666. })];
  51667. }
  51668. });
  51669. });
  51670. };
  51671. /**
  51672. * Let's you find a device using it's Id.
  51673. */
  51674. BrowserCodeReader.prototype.findDeviceById = function (deviceId) {
  51675. return __awaiter(this, void 0, void 0, function () {
  51676. var devices;
  51677. return __generator(this, function (_a) {
  51678. switch (_a.label) {
  51679. case 0:
  51680. return [4 /*yield*/, this.listVideoInputDevices()];
  51681. case 1:
  51682. devices = _a.sent();
  51683. if (!devices) {
  51684. return [2 /*return*/, null];
  51685. }
  51686. return [2 /*return*/, devices.find(function (x) {
  51687. return x.deviceId === deviceId;
  51688. })];
  51689. }
  51690. });
  51691. });
  51692. };
  51693. /**
  51694. * Decodes the barcode from the device specified by deviceId while showing the video in the specified video element.
  51695. *
  51696. * @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
  51697. * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51698. * @returns The decoding result.
  51699. *
  51700. * @memberOf BrowserCodeReader
  51701. *
  51702. * @deprecated Use `decodeOnceFromVideoDevice` instead.
  51703. */
  51704. BrowserCodeReader.prototype.decodeFromInputVideoDevice = function (deviceId, videoSource) {
  51705. return __awaiter(this, void 0, void 0, function () {
  51706. return __generator(this, function (_a) {
  51707. switch (_a.label) {
  51708. case 0:
  51709. return [4 /*yield*/, this.decodeOnceFromVideoDevice(deviceId, videoSource)];
  51710. case 1:
  51711. return [2 /*return*/, _a.sent()];
  51712. }
  51713. });
  51714. });
  51715. };
  51716. /**
  51717. * In one attempt, tries to decode the barcode from the device specified by deviceId while showing the video in the specified video element.
  51718. *
  51719. * @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
  51720. * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51721. * @returns The decoding result.
  51722. *
  51723. * @memberOf BrowserCodeReader
  51724. */
  51725. BrowserCodeReader.prototype.decodeOnceFromVideoDevice = function (deviceId, videoSource) {
  51726. return __awaiter(this, void 0, void 0, function () {
  51727. var videoConstraints, constraints;
  51728. return __generator(this, function (_a) {
  51729. switch (_a.label) {
  51730. case 0:
  51731. this.reset();
  51732. if (!deviceId) {
  51733. videoConstraints = {
  51734. facingMode: 'environment'
  51735. };
  51736. } else {
  51737. videoConstraints = {
  51738. deviceId: {
  51739. exact: deviceId
  51740. }
  51741. };
  51742. }
  51743. constraints = {
  51744. video: videoConstraints
  51745. };
  51746. return [4 /*yield*/, this.decodeOnceFromConstraints(constraints, videoSource)];
  51747. case 1:
  51748. return [2 /*return*/, _a.sent()];
  51749. }
  51750. });
  51751. });
  51752. };
  51753. /**
  51754. * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
  51755. *
  51756. * @param constraints the media stream constraints to get s valid media stream to decode from
  51757. * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51758. * @returns The decoding result.
  51759. *
  51760. * @memberOf BrowserCodeReader
  51761. */
  51762. BrowserCodeReader.prototype.decodeOnceFromConstraints = function (constraints, videoSource) {
  51763. return __awaiter(this, void 0, void 0, function () {
  51764. var stream;
  51765. return __generator(this, function (_a) {
  51766. switch (_a.label) {
  51767. case 0:
  51768. return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
  51769. case 1:
  51770. stream = _a.sent();
  51771. return [4 /*yield*/, this.decodeOnceFromStream(stream, videoSource)];
  51772. case 2:
  51773. return [2 /*return*/, _a.sent()];
  51774. }
  51775. });
  51776. });
  51777. };
  51778. /**
  51779. * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
  51780. *
  51781. * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
  51782. * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51783. * @returns {Promise<Result>} The decoding result.
  51784. *
  51785. * @memberOf BrowserCodeReader
  51786. */
  51787. BrowserCodeReader.prototype.decodeOnceFromStream = function (stream, videoSource) {
  51788. return __awaiter(this, void 0, void 0, function () {
  51789. var video, result;
  51790. return __generator(this, function (_a) {
  51791. switch (_a.label) {
  51792. case 0:
  51793. this.reset();
  51794. return [4 /*yield*/, this.attachStreamToVideo(stream, videoSource)];
  51795. case 1:
  51796. video = _a.sent();
  51797. return [4 /*yield*/, this.decodeOnce(video)];
  51798. case 2:
  51799. result = _a.sent();
  51800. return [2 /*return*/, result];
  51801. }
  51802. });
  51803. });
  51804. };
  51805. /**
  51806. * Continuously decodes the barcode from the device specified by device while showing the video in the specified video element.
  51807. *
  51808. * @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
  51809. * @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51810. * @returns {Promise<void>}
  51811. *
  51812. * @memberOf BrowserCodeReader
  51813. *
  51814. * @deprecated Use `decodeFromVideoDevice` instead.
  51815. */
  51816. BrowserCodeReader.prototype.decodeFromInputVideoDeviceContinuously = function (deviceId, videoSource, callbackFn) {
  51817. return __awaiter(this, void 0, void 0, function () {
  51818. return __generator(this, function (_a) {
  51819. switch (_a.label) {
  51820. case 0:
  51821. return [4 /*yield*/, this.decodeFromVideoDevice(deviceId, videoSource, callbackFn)];
  51822. case 1:
  51823. return [2 /*return*/, _a.sent()];
  51824. }
  51825. });
  51826. });
  51827. };
  51828. /**
  51829. * Continuously tries to decode the barcode from the device specified by device while showing the video in the specified video element.
  51830. *
  51831. * @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.
  51832. * @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51833. * @returns {Promise<void>}
  51834. *
  51835. * @memberOf BrowserCodeReader
  51836. */
  51837. BrowserCodeReader.prototype.decodeFromVideoDevice = function (deviceId, videoSource, callbackFn) {
  51838. return __awaiter(this, void 0, void 0, function () {
  51839. var videoConstraints, constraints;
  51840. return __generator(this, function (_a) {
  51841. switch (_a.label) {
  51842. case 0:
  51843. if (!deviceId) {
  51844. videoConstraints = {
  51845. facingMode: 'environment'
  51846. };
  51847. } else {
  51848. videoConstraints = {
  51849. deviceId: {
  51850. exact: deviceId
  51851. }
  51852. };
  51853. }
  51854. constraints = {
  51855. video: videoConstraints
  51856. };
  51857. return [4 /*yield*/, this.decodeFromConstraints(constraints, videoSource, callbackFn)];
  51858. case 1:
  51859. return [2 /*return*/, _a.sent()];
  51860. }
  51861. });
  51862. });
  51863. };
  51864. /**
  51865. * Continuously tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
  51866. *
  51867. * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
  51868. * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51869. * @returns {Promise<Result>} The decoding result.
  51870. *
  51871. * @memberOf BrowserCodeReader
  51872. */
  51873. BrowserCodeReader.prototype.decodeFromConstraints = function (constraints, videoSource, callbackFn) {
  51874. return __awaiter(this, void 0, void 0, function () {
  51875. var stream;
  51876. return __generator(this, function (_a) {
  51877. switch (_a.label) {
  51878. case 0:
  51879. return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
  51880. case 1:
  51881. stream = _a.sent();
  51882. return [4 /*yield*/, this.decodeFromStream(stream, videoSource, callbackFn)];
  51883. case 2:
  51884. return [2 /*return*/, _a.sent()];
  51885. }
  51886. });
  51887. });
  51888. };
  51889. /**
  51890. * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.
  51891. *
  51892. * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from
  51893. * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.
  51894. * @returns {Promise<Result>} The decoding result.
  51895. *
  51896. * @memberOf BrowserCodeReader
  51897. */
  51898. BrowserCodeReader.prototype.decodeFromStream = function (stream, videoSource, callbackFn) {
  51899. return __awaiter(this, void 0, void 0, function () {
  51900. var video;
  51901. return __generator(this, function (_a) {
  51902. switch (_a.label) {
  51903. case 0:
  51904. this.reset();
  51905. return [4 /*yield*/, this.attachStreamToVideo(stream, videoSource)];
  51906. case 1:
  51907. video = _a.sent();
  51908. return [4 /*yield*/, this.decodeContinuously(video, callbackFn)];
  51909. case 2:
  51910. return [2 /*return*/, _a.sent()];
  51911. }
  51912. });
  51913. });
  51914. };
  51915. /**
  51916. * Breaks the decoding loop.
  51917. */
  51918. BrowserCodeReader.prototype.stopAsyncDecode = function () {
  51919. this._stopAsyncDecode = true;
  51920. };
  51921. /**
  51922. * Breaks the decoding loop.
  51923. */
  51924. BrowserCodeReader.prototype.stopContinuousDecode = function () {
  51925. this._stopContinuousDecode = true;
  51926. };
  51927. /**
  51928. * Sets the new stream and request a new decoding-with-delay.
  51929. *
  51930. * @param stream The stream to be shown in the video element.
  51931. * @param decodeFn A callback for the decode method.
  51932. */
  51933. BrowserCodeReader.prototype.attachStreamToVideo = function (stream, videoSource) {
  51934. return __awaiter(this, void 0, void 0, function () {
  51935. var videoElement;
  51936. return __generator(this, function (_a) {
  51937. switch (_a.label) {
  51938. case 0:
  51939. videoElement = this.prepareVideoElement(videoSource);
  51940. this.addVideoSource(videoElement, stream);
  51941. this.videoElement = videoElement;
  51942. this.stream = stream;
  51943. return [4 /*yield*/, this.playVideoOnLoadAsync(videoElement)];
  51944. case 1:
  51945. _a.sent();
  51946. return [2 /*return*/, videoElement];
  51947. }
  51948. });
  51949. });
  51950. };
  51951. /**
  51952. *
  51953. * @param videoElement
  51954. */
  51955. BrowserCodeReader.prototype.playVideoOnLoadAsync = function (videoElement) {
  51956. var _this = this;
  51957. return new Promise(function (resolve, reject) {
  51958. return _this.playVideoOnLoad(videoElement, function () {
  51959. return resolve();
  51960. });
  51961. });
  51962. };
  51963. /**
  51964. * Binds listeners and callbacks to the videoElement.
  51965. *
  51966. * @param element
  51967. * @param callbackFn
  51968. */
  51969. BrowserCodeReader.prototype.playVideoOnLoad = function (element, callbackFn) {
  51970. var _this = this;
  51971. this.videoEndedListener = function () {
  51972. return _this.stopStreams();
  51973. };
  51974. this.videoCanPlayListener = function () {
  51975. return _this.tryPlayVideo(element);
  51976. };
  51977. element.addEventListener('ended', this.videoEndedListener);
  51978. element.addEventListener('canplay', this.videoCanPlayListener);
  51979. element.addEventListener('playing', callbackFn);
  51980. // if canplay was already fired, we won't know when to play, so just give it a try
  51981. this.tryPlayVideo(element);
  51982. };
  51983. /**
  51984. * Checks if the given video element is currently playing.
  51985. */
  51986. BrowserCodeReader.prototype.isVideoPlaying = function (video) {
  51987. return video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2;
  51988. };
  51989. /**
  51990. * Just tries to play the video and logs any errors.
  51991. * The play call is only made is the video is not already playing.
  51992. */
  51993. BrowserCodeReader.prototype.tryPlayVideo = function (videoElement) {
  51994. return __awaiter(this, void 0, void 0, function () {
  51995. var _a;
  51996. return __generator(this, function (_b) {
  51997. switch (_b.label) {
  51998. case 0:
  51999. if (this.isVideoPlaying(videoElement)) {
  52000. console.warn('Trying to play video that is already playing.');
  52001. return [2 /*return*/];
  52002. }
  52003. _b.label = 1;
  52004. case 1:
  52005. _b.trys.push([1, 3,, 4]);
  52006. return [4 /*yield*/, videoElement.play()];
  52007. case 2:
  52008. _b.sent();
  52009. return [3 /*break*/, 4];
  52010. case 3:
  52011. _a = _b.sent();
  52012. console.warn('It was not possible to play the video.');
  52013. return [3 /*break*/, 4];
  52014. case 4:
  52015. return [2 /*return*/];
  52016. }
  52017. });
  52018. });
  52019. };
  52020. /**
  52021. * Searches and validates a media element.
  52022. */
  52023. BrowserCodeReader.prototype.getMediaElement = function (mediaElementId, type) {
  52024. var mediaElement = document.getElementById(mediaElementId);
  52025. if (!mediaElement) {
  52026. throw new _ArgumentException.default("element with id '" + mediaElementId + "' not found");
  52027. }
  52028. if (mediaElement.nodeName.toLowerCase() !== type.toLowerCase()) {
  52029. throw new _ArgumentException.default("element with id '" + mediaElementId + "' must be an " + type + " element");
  52030. }
  52031. return mediaElement;
  52032. };
  52033. /**
  52034. * Decodes the barcode from an image.
  52035. *
  52036. * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
  52037. * @param {string} [url]
  52038. * @returns {Promise<Result>} The decoding result.
  52039. *
  52040. * @memberOf BrowserCodeReader
  52041. */
  52042. BrowserCodeReader.prototype.decodeFromImage = function (source, url) {
  52043. if (!source && !url) {
  52044. throw new _ArgumentException.default('either imageElement with a src set or an url must be provided');
  52045. }
  52046. if (url && !source) {
  52047. return this.decodeFromImageUrl(url);
  52048. }
  52049. return this.decodeFromImageElement(source);
  52050. };
  52051. /**
  52052. * Decodes the barcode from a video.
  52053. *
  52054. * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
  52055. * @param {string} [url]
  52056. * @returns {Promise<Result>} The decoding result.
  52057. *
  52058. * @memberOf BrowserCodeReader
  52059. */
  52060. BrowserCodeReader.prototype.decodeFromVideo = function (source, url) {
  52061. if (!source && !url) {
  52062. throw new _ArgumentException.default('Either an element with a src set or an URL must be provided');
  52063. }
  52064. if (url && !source) {
  52065. return this.decodeFromVideoUrl(url);
  52066. }
  52067. return this.decodeFromVideoElement(source);
  52068. };
  52069. /**
  52070. * Decodes continuously the barcode from a video.
  52071. *
  52072. * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.
  52073. * @param {string} [url]
  52074. * @returns {Promise<Result>} The decoding result.
  52075. *
  52076. * @memberOf BrowserCodeReader
  52077. *
  52078. * @experimental
  52079. */
  52080. BrowserCodeReader.prototype.decodeFromVideoContinuously = function (source, url, callbackFn) {
  52081. if (undefined === source && undefined === url) {
  52082. throw new _ArgumentException.default('Either an element with a src set or an URL must be provided');
  52083. }
  52084. if (url && !source) {
  52085. return this.decodeFromVideoUrlContinuously(url, callbackFn);
  52086. }
  52087. return this.decodeFromVideoElementContinuously(source, callbackFn);
  52088. };
  52089. /**
  52090. * Decodes something from an image HTML element.
  52091. */
  52092. BrowserCodeReader.prototype.decodeFromImageElement = function (source) {
  52093. if (!source) {
  52094. throw new _ArgumentException.default('An image element must be provided.');
  52095. }
  52096. this.reset();
  52097. var element = this.prepareImageElement(source);
  52098. this.imageElement = element;
  52099. var task;
  52100. if (this.isImageLoaded(element)) {
  52101. task = this.decodeOnce(element, false, true);
  52102. } else {
  52103. task = this._decodeOnLoadImage(element);
  52104. }
  52105. return task;
  52106. };
  52107. /**
  52108. * Decodes something from an image HTML element.
  52109. */
  52110. BrowserCodeReader.prototype.decodeFromVideoElement = function (source) {
  52111. var element = this._decodeFromVideoElementSetup(source);
  52112. return this._decodeOnLoadVideo(element);
  52113. };
  52114. /**
  52115. * Decodes something from an image HTML element.
  52116. */
  52117. BrowserCodeReader.prototype.decodeFromVideoElementContinuously = function (source, callbackFn) {
  52118. var element = this._decodeFromVideoElementSetup(source);
  52119. return this._decodeOnLoadVideoContinuously(element, callbackFn);
  52120. };
  52121. /**
  52122. * Sets up the video source so it can be decoded when loaded.
  52123. *
  52124. * @param source The video source element.
  52125. */
  52126. BrowserCodeReader.prototype._decodeFromVideoElementSetup = function (source) {
  52127. if (!source) {
  52128. throw new _ArgumentException.default('A video element must be provided.');
  52129. }
  52130. this.reset();
  52131. var element = this.prepareVideoElement(source);
  52132. // defines the video element before starts decoding
  52133. this.videoElement = element;
  52134. return element;
  52135. };
  52136. /**
  52137. * Decodes an image from a URL.
  52138. */
  52139. BrowserCodeReader.prototype.decodeFromImageUrl = function (url) {
  52140. if (!url) {
  52141. throw new _ArgumentException.default('An URL must be provided.');
  52142. }
  52143. this.reset();
  52144. var element = this.prepareImageElement();
  52145. this.imageElement = element;
  52146. var decodeTask = this._decodeOnLoadImage(element);
  52147. element.src = url;
  52148. return decodeTask;
  52149. };
  52150. /**
  52151. * Decodes an image from a URL.
  52152. */
  52153. BrowserCodeReader.prototype.decodeFromVideoUrl = function (url) {
  52154. if (!url) {
  52155. throw new _ArgumentException.default('An URL must be provided.');
  52156. }
  52157. this.reset();
  52158. // creates a new element
  52159. var element = this.prepareVideoElement();
  52160. var decodeTask = this.decodeFromVideoElement(element);
  52161. element.src = url;
  52162. return decodeTask;
  52163. };
  52164. /**
  52165. * Decodes an image from a URL.
  52166. *
  52167. * @experimental
  52168. */
  52169. BrowserCodeReader.prototype.decodeFromVideoUrlContinuously = function (url, callbackFn) {
  52170. if (!url) {
  52171. throw new _ArgumentException.default('An URL must be provided.');
  52172. }
  52173. this.reset();
  52174. // creates a new element
  52175. var element = this.prepareVideoElement();
  52176. var decodeTask = this.decodeFromVideoElementContinuously(element, callbackFn);
  52177. element.src = url;
  52178. return decodeTask;
  52179. };
  52180. BrowserCodeReader.prototype._decodeOnLoadImage = function (element) {
  52181. var _this = this;
  52182. return new Promise(function (resolve, reject) {
  52183. _this.imageLoadedListener = function () {
  52184. return _this.decodeOnce(element, false, true).then(resolve, reject);
  52185. };
  52186. element.addEventListener('load', _this.imageLoadedListener);
  52187. });
  52188. };
  52189. BrowserCodeReader.prototype._decodeOnLoadVideo = function (videoElement) {
  52190. return __awaiter(this, void 0, void 0, function () {
  52191. return __generator(this, function (_a) {
  52192. switch (_a.label) {
  52193. case 0:
  52194. // plays the video
  52195. return [4 /*yield*/, this.playVideoOnLoadAsync(videoElement)];
  52196. case 1:
  52197. // plays the video
  52198. _a.sent();
  52199. return [4 /*yield*/, this.decodeOnce(videoElement)];
  52200. case 2:
  52201. // starts decoding after played the video
  52202. return [2 /*return*/, _a.sent()];
  52203. }
  52204. });
  52205. });
  52206. };
  52207. BrowserCodeReader.prototype._decodeOnLoadVideoContinuously = function (videoElement, callbackFn) {
  52208. return __awaiter(this, void 0, void 0, function () {
  52209. return __generator(this, function (_a) {
  52210. switch (_a.label) {
  52211. case 0:
  52212. // plays the video
  52213. return [4 /*yield*/, this.playVideoOnLoadAsync(videoElement)];
  52214. case 1:
  52215. // plays the video
  52216. _a.sent();
  52217. // starts decoding after played the video
  52218. this.decodeContinuously(videoElement, callbackFn);
  52219. return [2 /*return*/];
  52220. }
  52221. });
  52222. });
  52223. };
  52224. BrowserCodeReader.prototype.isImageLoaded = function (img) {
  52225. // During the onload event, IE correctly identifies any images that
  52226. // weren’t downloaded as not complete. Others should too. Gecko-based
  52227. // browsers act like NS4 in that they report this incorrectly.
  52228. if (!img.complete) {
  52229. return false;
  52230. }
  52231. // However, they do have two very useful properties: naturalWidth and
  52232. // naturalHeight. These give the true size of the image. If it failed
  52233. // to load, either of these should be zero.
  52234. if (img.naturalWidth === 0) {
  52235. return false;
  52236. }
  52237. // No other way of checking: assume it’s ok.
  52238. return true;
  52239. };
  52240. BrowserCodeReader.prototype.prepareImageElement = function (imageSource) {
  52241. var imageElement;
  52242. if (typeof imageSource === 'undefined') {
  52243. imageElement = document.createElement('img');
  52244. imageElement.width = 200;
  52245. imageElement.height = 200;
  52246. }
  52247. if (typeof imageSource === 'string') {
  52248. imageElement = this.getMediaElement(imageSource, 'img');
  52249. }
  52250. if (imageSource instanceof HTMLImageElement) {
  52251. imageElement = imageSource;
  52252. }
  52253. return imageElement;
  52254. };
  52255. /**
  52256. * Sets a HTMLVideoElement for scanning or creates a new one.
  52257. *
  52258. * @param videoSource The HTMLVideoElement to be set.
  52259. */
  52260. BrowserCodeReader.prototype.prepareVideoElement = function (videoSource) {
  52261. var videoElement;
  52262. if (!videoSource && typeof document !== 'undefined') {
  52263. videoElement = document.createElement('video');
  52264. videoElement.width = 200;
  52265. videoElement.height = 200;
  52266. }
  52267. if (typeof videoSource === 'string') {
  52268. videoElement = this.getMediaElement(videoSource, 'video');
  52269. }
  52270. if (videoSource instanceof HTMLVideoElement) {
  52271. videoElement = videoSource;
  52272. }
  52273. // Needed for iOS 11
  52274. videoElement.setAttribute('autoplay', 'true');
  52275. videoElement.setAttribute('muted', 'true');
  52276. videoElement.setAttribute('playsinline', 'true');
  52277. return videoElement;
  52278. };
  52279. /**
  52280. * Tries to decode from the video input until it finds some value.
  52281. */
  52282. BrowserCodeReader.prototype.decodeOnce = function (element, retryIfNotFound, retryIfChecksumOrFormatError) {
  52283. var _this = this;
  52284. if (retryIfNotFound === void 0) {
  52285. retryIfNotFound = true;
  52286. }
  52287. if (retryIfChecksumOrFormatError === void 0) {
  52288. retryIfChecksumOrFormatError = true;
  52289. }
  52290. this._stopAsyncDecode = false;
  52291. var loop = function loop(resolve, reject) {
  52292. if (_this._stopAsyncDecode) {
  52293. reject(new _NotFoundException.default('Video stream has ended before any code could be detected.'));
  52294. _this._stopAsyncDecode = undefined;
  52295. return;
  52296. }
  52297. try {
  52298. var result = _this.decode(element);
  52299. resolve(result);
  52300. } catch (e) {
  52301. var ifNotFound = retryIfNotFound && e instanceof _NotFoundException.default;
  52302. var isChecksumOrFormatError = e instanceof _ChecksumException.default || e instanceof _FormatException.default;
  52303. var ifChecksumOrFormat = isChecksumOrFormatError && retryIfChecksumOrFormatError;
  52304. if (ifNotFound || ifChecksumOrFormat) {
  52305. // trying again
  52306. return setTimeout(loop, _this._timeBetweenDecodingAttempts, resolve, reject);
  52307. }
  52308. reject(e);
  52309. }
  52310. };
  52311. return new Promise(function (resolve, reject) {
  52312. return loop(resolve, reject);
  52313. });
  52314. };
  52315. /**
  52316. * Continuously decodes from video input.
  52317. */
  52318. BrowserCodeReader.prototype.decodeContinuously = function (element, callbackFn) {
  52319. var _this = this;
  52320. this._stopContinuousDecode = false;
  52321. var loop = function loop() {
  52322. if (_this._stopContinuousDecode) {
  52323. _this._stopContinuousDecode = undefined;
  52324. return;
  52325. }
  52326. try {
  52327. var result = _this.decode(element);
  52328. callbackFn(result, null);
  52329. setTimeout(loop, _this.timeBetweenScansMillis);
  52330. } catch (e) {
  52331. callbackFn(null, e);
  52332. var isChecksumOrFormatError = e instanceof _ChecksumException.default || e instanceof _FormatException.default;
  52333. var isNotFound = e instanceof _NotFoundException.default;
  52334. if (isChecksumOrFormatError || isNotFound) {
  52335. // trying again
  52336. setTimeout(loop, _this._timeBetweenDecodingAttempts);
  52337. }
  52338. }
  52339. };
  52340. loop();
  52341. };
  52342. /**
  52343. * Gets the BinaryBitmap for ya! (and decodes it)
  52344. */
  52345. BrowserCodeReader.prototype.decode = function (element) {
  52346. // get binary bitmap for decode function
  52347. var binaryBitmap = this.createBinaryBitmap(element);
  52348. return this.decodeBitmap(binaryBitmap);
  52349. };
  52350. /**
  52351. * Creates a binaryBitmap based in some image source.
  52352. *
  52353. * @param mediaElement HTML element containing drawable image source.
  52354. */
  52355. BrowserCodeReader.prototype.createBinaryBitmap = function (mediaElement) {
  52356. var ctx = this.getCaptureCanvasContext(mediaElement);
  52357. // doing a scan with inverted colors on the second scan should only happen for video elements
  52358. var doAutoInvert = false;
  52359. if (mediaElement instanceof HTMLVideoElement) {
  52360. this.drawFrameOnCanvas(mediaElement);
  52361. doAutoInvert = true;
  52362. } else {
  52363. this.drawImageOnCanvas(mediaElement);
  52364. }
  52365. var canvas = this.getCaptureCanvas(mediaElement);
  52366. var luminanceSource = new _HTMLCanvasElementLuminanceSource.HTMLCanvasElementLuminanceSource(canvas, doAutoInvert);
  52367. var hybridBinarizer = new _HybridBinarizer.default(luminanceSource);
  52368. return new _BinaryBitmap.default(hybridBinarizer);
  52369. };
  52370. /**
  52371. *
  52372. */
  52373. BrowserCodeReader.prototype.getCaptureCanvasContext = function (mediaElement) {
  52374. if (!this.captureCanvasContext) {
  52375. var elem = this.getCaptureCanvas(mediaElement);
  52376. var ctx = void 0;
  52377. try {
  52378. ctx = elem.getContext('2d', {
  52379. willReadFrequently: true
  52380. });
  52381. } catch (e) {
  52382. ctx = elem.getContext('2d');
  52383. }
  52384. this.captureCanvasContext = ctx;
  52385. }
  52386. return this.captureCanvasContext;
  52387. };
  52388. /**
  52389. *
  52390. */
  52391. BrowserCodeReader.prototype.getCaptureCanvas = function (mediaElement) {
  52392. if (!this.captureCanvas) {
  52393. var elem = this.createCaptureCanvas(mediaElement);
  52394. this.captureCanvas = elem;
  52395. }
  52396. return this.captureCanvas;
  52397. };
  52398. /**
  52399. * Overwriting this allows you to manipulate the next frame in anyway you want before decode.
  52400. */
  52401. BrowserCodeReader.prototype.drawFrameOnCanvas = function (srcElement, dimensions, canvasElementContext) {
  52402. if (dimensions === void 0) {
  52403. dimensions = {
  52404. sx: 0,
  52405. sy: 0,
  52406. sWidth: srcElement.videoWidth,
  52407. sHeight: srcElement.videoHeight,
  52408. dx: 0,
  52409. dy: 0,
  52410. dWidth: srcElement.videoWidth,
  52411. dHeight: srcElement.videoHeight
  52412. };
  52413. }
  52414. if (canvasElementContext === void 0) {
  52415. canvasElementContext = this.captureCanvasContext;
  52416. }
  52417. canvasElementContext.drawImage(srcElement, dimensions.sx, dimensions.sy, dimensions.sWidth, dimensions.sHeight, dimensions.dx, dimensions.dy, dimensions.dWidth, dimensions.dHeight);
  52418. };
  52419. /**
  52420. * Ovewriting this allows you to manipulate the snapshot image in anyway you want before decode.
  52421. */
  52422. BrowserCodeReader.prototype.drawImageOnCanvas = function (srcElement, dimensions, canvasElementContext) {
  52423. if (dimensions === void 0) {
  52424. dimensions = {
  52425. sx: 0,
  52426. sy: 0,
  52427. sWidth: srcElement.naturalWidth,
  52428. sHeight: srcElement.naturalHeight,
  52429. dx: 0,
  52430. dy: 0,
  52431. dWidth: srcElement.naturalWidth,
  52432. dHeight: srcElement.naturalHeight
  52433. };
  52434. }
  52435. if (canvasElementContext === void 0) {
  52436. canvasElementContext = this.captureCanvasContext;
  52437. }
  52438. canvasElementContext.drawImage(srcElement, dimensions.sx, dimensions.sy, dimensions.sWidth, dimensions.sHeight, dimensions.dx, dimensions.dy, dimensions.dWidth, dimensions.dHeight);
  52439. };
  52440. /**
  52441. * Call the encapsulated readers decode
  52442. */
  52443. BrowserCodeReader.prototype.decodeBitmap = function (binaryBitmap) {
  52444. return this.reader.decode(binaryBitmap, this._hints);
  52445. };
  52446. /**
  52447. * 🖌 Prepares the canvas for capture and scan frames.
  52448. */
  52449. BrowserCodeReader.prototype.createCaptureCanvas = function (mediaElement) {
  52450. if (typeof document === 'undefined') {
  52451. this._destroyCaptureCanvas();
  52452. return null;
  52453. }
  52454. var canvasElement = document.createElement('canvas');
  52455. var width;
  52456. var height;
  52457. if (typeof mediaElement !== 'undefined') {
  52458. if (mediaElement instanceof HTMLVideoElement) {
  52459. width = mediaElement.videoWidth;
  52460. height = mediaElement.videoHeight;
  52461. } else if (mediaElement instanceof HTMLImageElement) {
  52462. width = mediaElement.naturalWidth || mediaElement.width;
  52463. height = mediaElement.naturalHeight || mediaElement.height;
  52464. }
  52465. }
  52466. canvasElement.style.width = width + 'px';
  52467. canvasElement.style.height = height + 'px';
  52468. canvasElement.width = width;
  52469. canvasElement.height = height;
  52470. return canvasElement;
  52471. };
  52472. /**
  52473. * Stops the continuous scan and cleans the stream.
  52474. */
  52475. BrowserCodeReader.prototype.stopStreams = function () {
  52476. if (this.stream) {
  52477. this.stream.getVideoTracks().forEach(function (t) {
  52478. return t.stop();
  52479. });
  52480. this.stream = undefined;
  52481. }
  52482. if (this._stopAsyncDecode === false) {
  52483. this.stopAsyncDecode();
  52484. }
  52485. if (this._stopContinuousDecode === false) {
  52486. this.stopContinuousDecode();
  52487. }
  52488. };
  52489. /**
  52490. * Resets the code reader to the initial state. Cancels any ongoing barcode scanning from video or camera.
  52491. *
  52492. * @memberOf BrowserCodeReader
  52493. */
  52494. BrowserCodeReader.prototype.reset = function () {
  52495. // stops the camera, preview and scan 🔴
  52496. this.stopStreams();
  52497. // clean and forget about HTML elements
  52498. this._destroyVideoElement();
  52499. this._destroyImageElement();
  52500. this._destroyCaptureCanvas();
  52501. };
  52502. BrowserCodeReader.prototype._destroyVideoElement = function () {
  52503. if (!this.videoElement) {
  52504. return;
  52505. }
  52506. // first gives freedon to the element 🕊
  52507. if (typeof this.videoEndedListener !== 'undefined') {
  52508. this.videoElement.removeEventListener('ended', this.videoEndedListener);
  52509. }
  52510. if (typeof this.videoPlayingEventListener !== 'undefined') {
  52511. this.videoElement.removeEventListener('playing', this.videoPlayingEventListener);
  52512. }
  52513. if (typeof this.videoCanPlayListener !== 'undefined') {
  52514. this.videoElement.removeEventListener('loadedmetadata', this.videoCanPlayListener);
  52515. }
  52516. // then forgets about that element 😢
  52517. this.cleanVideoSource(this.videoElement);
  52518. this.videoElement = undefined;
  52519. };
  52520. BrowserCodeReader.prototype._destroyImageElement = function () {
  52521. if (!this.imageElement) {
  52522. return;
  52523. }
  52524. // first gives freedon to the element 🕊
  52525. if (undefined !== this.imageLoadedListener) {
  52526. this.imageElement.removeEventListener('load', this.imageLoadedListener);
  52527. }
  52528. // then forget about that element 😢
  52529. this.imageElement.src = undefined;
  52530. this.imageElement.removeAttribute('src');
  52531. this.imageElement = undefined;
  52532. };
  52533. /**
  52534. * Cleans canvas references 🖌
  52535. */
  52536. BrowserCodeReader.prototype._destroyCaptureCanvas = function () {
  52537. // then forget about that element 😢
  52538. this.captureCanvasContext = undefined;
  52539. this.captureCanvas = undefined;
  52540. };
  52541. /**
  52542. * Defines what the videoElement src will be.
  52543. *
  52544. * @param videoElement
  52545. * @param stream
  52546. */
  52547. BrowserCodeReader.prototype.addVideoSource = function (videoElement, stream) {
  52548. // Older browsers may not have `srcObject`
  52549. try {
  52550. // @note Throws Exception if interrupted by a new loaded request
  52551. videoElement.srcObject = stream;
  52552. } catch (err) {
  52553. // @note Avoid using this in new browsers, as it is going away.
  52554. // @ts-ignore
  52555. videoElement.src = URL.createObjectURL(stream);
  52556. }
  52557. };
  52558. /**
  52559. * Unbinds a HTML video src property.
  52560. *
  52561. * @param videoElement
  52562. */
  52563. BrowserCodeReader.prototype.cleanVideoSource = function (videoElement) {
  52564. try {
  52565. videoElement.srcObject = null;
  52566. } catch (err) {
  52567. videoElement.src = '';
  52568. }
  52569. this.videoElement.removeAttribute('src');
  52570. };
  52571. return BrowserCodeReader;
  52572. }();
  52573. exports.BrowserCodeReader = BrowserCodeReader;
  52574. /***/ }),
  52575. /* 304 */
  52576. /*!*************************************************************************************!*\
  52577. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ArgumentException.js ***!
  52578. \*************************************************************************************/
  52579. /*! no static exports found */
  52580. /***/ (function(module, exports, __webpack_require__) {
  52581. "use strict";
  52582. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  52583. Object.defineProperty(exports, "__esModule", {
  52584. value: true
  52585. });
  52586. exports.default = void 0;
  52587. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  52588. var __extends = void 0 && (void 0).__extends || function () {
  52589. var _extendStatics = function extendStatics(d, b) {
  52590. _extendStatics = Object.setPrototypeOf || {
  52591. __proto__: []
  52592. } instanceof Array && function (d, b) {
  52593. d.__proto__ = b;
  52594. } || function (d, b) {
  52595. for (var p in b) {
  52596. if (b.hasOwnProperty(p)) d[p] = b[p];
  52597. }
  52598. };
  52599. return _extendStatics(d, b);
  52600. };
  52601. return function (d, b) {
  52602. _extendStatics(d, b);
  52603. function __() {
  52604. this.constructor = d;
  52605. }
  52606. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  52607. };
  52608. }();
  52609. /**
  52610. * Custom Error class of type Exception.
  52611. */
  52612. var ArgumentException = /** @class */function (_super) {
  52613. __extends(ArgumentException, _super);
  52614. function ArgumentException() {
  52615. return _super !== null && _super.apply(this, arguments) || this;
  52616. }
  52617. ArgumentException.kind = 'ArgumentException';
  52618. return ArgumentException;
  52619. }(_Exception.default);
  52620. var _default = ArgumentException;
  52621. exports.default = _default;
  52622. /***/ }),
  52623. /* 305 */
  52624. /*!*****************************************************************************!*\
  52625. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/Exception.js ***!
  52626. \*****************************************************************************/
  52627. /*! no static exports found */
  52628. /***/ (function(module, exports, __webpack_require__) {
  52629. "use strict";
  52630. Object.defineProperty(exports, "__esModule", {
  52631. value: true
  52632. });
  52633. exports.default = void 0;
  52634. var _tsCustomError = __webpack_require__(/*! ts-custom-error */ 306);
  52635. var __extends = void 0 && (void 0).__extends || function () {
  52636. var _extendStatics = function extendStatics(d, b) {
  52637. _extendStatics = Object.setPrototypeOf || {
  52638. __proto__: []
  52639. } instanceof Array && function (d, b) {
  52640. d.__proto__ = b;
  52641. } || function (d, b) {
  52642. for (var p in b) {
  52643. if (b.hasOwnProperty(p)) d[p] = b[p];
  52644. }
  52645. };
  52646. return _extendStatics(d, b);
  52647. };
  52648. return function (d, b) {
  52649. _extendStatics(d, b);
  52650. function __() {
  52651. this.constructor = d;
  52652. }
  52653. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  52654. };
  52655. }();
  52656. /**
  52657. * Custom Error class of type Exception.
  52658. */
  52659. var Exception = /** @class */function (_super) {
  52660. __extends(Exception, _super);
  52661. /**
  52662. * Allows Exception to be constructed directly
  52663. * with some message and prototype definition.
  52664. */
  52665. function Exception(message) {
  52666. if (message === void 0) {
  52667. message = undefined;
  52668. }
  52669. var _this = _super.call(this, message) || this;
  52670. _this.message = message;
  52671. return _this;
  52672. }
  52673. Exception.prototype.getKind = function () {
  52674. var ex = this.constructor;
  52675. return ex.kind;
  52676. };
  52677. /**
  52678. * It's typed as string so it can be extended and overriden.
  52679. */
  52680. Exception.kind = 'Exception';
  52681. return Exception;
  52682. }(_tsCustomError.CustomError);
  52683. var _default = Exception;
  52684. exports.default = _default;
  52685. /***/ }),
  52686. /* 306 */
  52687. /*!******************************************************************************!*\
  52688. !*** E:/git/2021项目/v3-H5/node_modules/ts-custom-error/dist/custom-error.mjs ***!
  52689. \******************************************************************************/
  52690. /*! no static exports found */
  52691. /***/ (function(module, exports, __webpack_require__) {
  52692. "use strict";
  52693. Object.defineProperty(exports, "__esModule", {
  52694. value: true
  52695. });
  52696. exports.CustomError = void 0;
  52697. exports.customErrorFactory = customErrorFactory;
  52698. function fixProto(target, prototype) {
  52699. var setPrototypeOf = Object.setPrototypeOf;
  52700. setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
  52701. }
  52702. function fixStack(target, fn) {
  52703. if (fn === void 0) {
  52704. fn = target.constructor;
  52705. }
  52706. var captureStackTrace = Error.captureStackTrace;
  52707. captureStackTrace && captureStackTrace(target, fn);
  52708. }
  52709. var __extends = undefined && undefined.__extends || function () {
  52710. var _extendStatics = function extendStatics(d, b) {
  52711. _extendStatics = Object.setPrototypeOf || {
  52712. __proto__: []
  52713. } instanceof Array && function (d, b) {
  52714. d.__proto__ = b;
  52715. } || function (d, b) {
  52716. for (var p in b) {
  52717. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  52718. }
  52719. };
  52720. return _extendStatics(d, b);
  52721. };
  52722. return function (d, b) {
  52723. if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  52724. _extendStatics(d, b);
  52725. function __() {
  52726. this.constructor = d;
  52727. }
  52728. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  52729. };
  52730. }();
  52731. var CustomError = function (_super) {
  52732. __extends(CustomError, _super);
  52733. function CustomError(message, options) {
  52734. var _newTarget = this.constructor;
  52735. var _this = _super.call(this, message, options) || this;
  52736. Object.defineProperty(_this, 'name', {
  52737. value: _newTarget.name,
  52738. enumerable: false,
  52739. configurable: true
  52740. });
  52741. fixProto(_this, _newTarget.prototype);
  52742. fixStack(_this);
  52743. return _this;
  52744. }
  52745. return CustomError;
  52746. }(Error);
  52747. exports.CustomError = CustomError;
  52748. var __spreadArray = undefined && undefined.__spreadArray || function (to, from, pack) {
  52749. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  52750. if (ar || !(i in from)) {
  52751. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  52752. ar[i] = from[i];
  52753. }
  52754. }
  52755. return to.concat(ar || Array.prototype.slice.call(from));
  52756. };
  52757. function customErrorFactory(fn, parent) {
  52758. if (parent === void 0) {
  52759. parent = Error;
  52760. }
  52761. function CustomError() {
  52762. var args = [];
  52763. for (var _i = 0; _i < arguments.length; _i++) {
  52764. args[_i] = arguments[_i];
  52765. }
  52766. if (!(this instanceof CustomError)) return new (CustomError.bind.apply(CustomError, __spreadArray([void 0], args, false)))();
  52767. parent.apply(this, args);
  52768. Object.defineProperty(this, 'name', {
  52769. value: fn.name || parent.name,
  52770. enumerable: false,
  52771. configurable: true
  52772. });
  52773. fn.apply(this, args);
  52774. fixStack(this, CustomError);
  52775. }
  52776. return Object.defineProperties(CustomError, {
  52777. prototype: {
  52778. value: Object.create(parent.prototype, {
  52779. constructor: {
  52780. value: CustomError,
  52781. writable: true,
  52782. configurable: true
  52783. }
  52784. })
  52785. }
  52786. });
  52787. }
  52788. /***/ }),
  52789. /* 307 */
  52790. /*!********************************************************************************!*\
  52791. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/BinaryBitmap.js ***!
  52792. \********************************************************************************/
  52793. /*! no static exports found */
  52794. /***/ (function(module, exports, __webpack_require__) {
  52795. "use strict";
  52796. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  52797. Object.defineProperty(exports, "__esModule", {
  52798. value: true
  52799. });
  52800. exports.default = void 0;
  52801. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
  52802. /*
  52803. * Copyright 2009 ZXing authors
  52804. *
  52805. * Licensed under the Apache License, Version 2.0 (the "License");
  52806. * you may not use this file except in compliance with the License.
  52807. * You may obtain a copy of the License at
  52808. *
  52809. * http://www.apache.org/licenses/LICENSE-2.0
  52810. *
  52811. * Unless required by applicable law or agreed to in writing, software
  52812. * distributed under the License is distributed on an "AS IS" BASIS,
  52813. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  52814. * See the License for the specific language governing permissions and
  52815. * limitations under the License.
  52816. */
  52817. var BinaryBitmap = /** @class */function () {
  52818. function BinaryBitmap(binarizer) {
  52819. this.binarizer = binarizer;
  52820. if (binarizer === null) {
  52821. throw new _IllegalArgumentException.default('Binarizer must be non-null.');
  52822. }
  52823. }
  52824. /**
  52825. * @return The width of the bitmap.
  52826. */
  52827. BinaryBitmap.prototype.getWidth = function () {
  52828. return this.binarizer.getWidth();
  52829. };
  52830. /**
  52831. * @return The height of the bitmap.
  52832. */
  52833. BinaryBitmap.prototype.getHeight = function () {
  52834. return this.binarizer.getHeight();
  52835. };
  52836. /**
  52837. * Converts one row of luminance data to 1 bit data. May actually do the conversion, or return
  52838. * cached data. Callers should assume this method is expensive and call it as seldom as possible.
  52839. * This method is intended for decoding 1D barcodes and may choose to apply sharpening.
  52840. *
  52841. * @param y The row to fetch, which must be in [0, bitmap height)
  52842. * @param row An optional preallocated array. If null or too small, it will be ignored.
  52843. * If used, the Binarizer will call BitArray.clear(). Always use the returned object.
  52844. * @return The array of bits for this row (true means black).
  52845. * @throws NotFoundException if row can't be binarized
  52846. */
  52847. BinaryBitmap.prototype.getBlackRow = function (y /*int*/, row) {
  52848. return this.binarizer.getBlackRow(y, row);
  52849. };
  52850. /**
  52851. * Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive
  52852. * and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or
  52853. * may not apply sharpening. Therefore, a row from this matrix may not be identical to one
  52854. * fetched using getBlackRow(), so don't mix and match between them.
  52855. *
  52856. * @return The 2D array of bits for the image (true means black).
  52857. * @throws NotFoundException if image can't be binarized to make a matrix
  52858. */
  52859. BinaryBitmap.prototype.getBlackMatrix = function () {
  52860. // The matrix is created on demand the first time it is requested, then cached. There are two
  52861. // reasons for this:
  52862. // 1. This work will never be done if the caller only installs 1D Reader objects, or if a
  52863. // 1D Reader finds a barcode before the 2D Readers run.
  52864. // 2. This work will only be done once even if the caller installs multiple 2D Readers.
  52865. if (this.matrix === null || this.matrix === undefined) {
  52866. this.matrix = this.binarizer.getBlackMatrix();
  52867. }
  52868. return this.matrix;
  52869. };
  52870. /**
  52871. * @return Whether this bitmap can be cropped.
  52872. */
  52873. BinaryBitmap.prototype.isCropSupported = function () {
  52874. return this.binarizer.getLuminanceSource().isCropSupported();
  52875. };
  52876. /**
  52877. * Returns a new object with cropped image data. Implementations may keep a reference to the
  52878. * original data rather than a copy. Only callable if isCropSupported() is true.
  52879. *
  52880. * @param left The left coordinate, which must be in [0,getWidth())
  52881. * @param top The top coordinate, which must be in [0,getHeight())
  52882. * @param width The width of the rectangle to crop.
  52883. * @param height The height of the rectangle to crop.
  52884. * @return A cropped version of this object.
  52885. */
  52886. BinaryBitmap.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  52887. var newSource = this.binarizer.getLuminanceSource().crop(left, top, width, height);
  52888. return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
  52889. };
  52890. /**
  52891. * @return Whether this bitmap supports counter-clockwise rotation.
  52892. */
  52893. BinaryBitmap.prototype.isRotateSupported = function () {
  52894. return this.binarizer.getLuminanceSource().isRotateSupported();
  52895. };
  52896. /**
  52897. * Returns a new object with rotated image data by 90 degrees counterclockwise.
  52898. * Only callable if {@link #isRotateSupported()} is true.
  52899. *
  52900. * @return A rotated version of this object.
  52901. */
  52902. BinaryBitmap.prototype.rotateCounterClockwise = function () {
  52903. var newSource = this.binarizer.getLuminanceSource().rotateCounterClockwise();
  52904. return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
  52905. };
  52906. /**
  52907. * Returns a new object with rotated image data by 45 degrees counterclockwise.
  52908. * Only callable if {@link #isRotateSupported()} is true.
  52909. *
  52910. * @return A rotated version of this object.
  52911. */
  52912. BinaryBitmap.prototype.rotateCounterClockwise45 = function () {
  52913. var newSource = this.binarizer.getLuminanceSource().rotateCounterClockwise45();
  52914. return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
  52915. };
  52916. /*@Override*/
  52917. BinaryBitmap.prototype.toString = function () {
  52918. try {
  52919. return this.getBlackMatrix().toString();
  52920. } catch (e /*: NotFoundException*/) {
  52921. return '';
  52922. }
  52923. };
  52924. return BinaryBitmap;
  52925. }();
  52926. var _default = BinaryBitmap;
  52927. exports.default = _default;
  52928. /***/ }),
  52929. /* 308 */
  52930. /*!********************************************************************************************!*\
  52931. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/IllegalArgumentException.js ***!
  52932. \********************************************************************************************/
  52933. /*! no static exports found */
  52934. /***/ (function(module, exports, __webpack_require__) {
  52935. "use strict";
  52936. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  52937. Object.defineProperty(exports, "__esModule", {
  52938. value: true
  52939. });
  52940. exports.default = void 0;
  52941. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  52942. var __extends = void 0 && (void 0).__extends || function () {
  52943. var _extendStatics = function extendStatics(d, b) {
  52944. _extendStatics = Object.setPrototypeOf || {
  52945. __proto__: []
  52946. } instanceof Array && function (d, b) {
  52947. d.__proto__ = b;
  52948. } || function (d, b) {
  52949. for (var p in b) {
  52950. if (b.hasOwnProperty(p)) d[p] = b[p];
  52951. }
  52952. };
  52953. return _extendStatics(d, b);
  52954. };
  52955. return function (d, b) {
  52956. _extendStatics(d, b);
  52957. function __() {
  52958. this.constructor = d;
  52959. }
  52960. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  52961. };
  52962. }();
  52963. /**
  52964. * Custom Error class of type Exception.
  52965. */
  52966. var IllegalArgumentException = /** @class */function (_super) {
  52967. __extends(IllegalArgumentException, _super);
  52968. function IllegalArgumentException() {
  52969. return _super !== null && _super.apply(this, arguments) || this;
  52970. }
  52971. IllegalArgumentException.kind = 'IllegalArgumentException';
  52972. return IllegalArgumentException;
  52973. }(_Exception.default);
  52974. var _default = IllegalArgumentException;
  52975. exports.default = _default;
  52976. /***/ }),
  52977. /* 309 */
  52978. /*!*************************************************************************************!*\
  52979. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ChecksumException.js ***!
  52980. \*************************************************************************************/
  52981. /*! no static exports found */
  52982. /***/ (function(module, exports, __webpack_require__) {
  52983. "use strict";
  52984. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  52985. Object.defineProperty(exports, "__esModule", {
  52986. value: true
  52987. });
  52988. exports.default = void 0;
  52989. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  52990. var __extends = void 0 && (void 0).__extends || function () {
  52991. var _extendStatics = function extendStatics(d, b) {
  52992. _extendStatics = Object.setPrototypeOf || {
  52993. __proto__: []
  52994. } instanceof Array && function (d, b) {
  52995. d.__proto__ = b;
  52996. } || function (d, b) {
  52997. for (var p in b) {
  52998. if (b.hasOwnProperty(p)) d[p] = b[p];
  52999. }
  53000. };
  53001. return _extendStatics(d, b);
  53002. };
  53003. return function (d, b) {
  53004. _extendStatics(d, b);
  53005. function __() {
  53006. this.constructor = d;
  53007. }
  53008. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  53009. };
  53010. }();
  53011. /**
  53012. * Custom Error class of type Exception.
  53013. */
  53014. var ChecksumException = /** @class */function (_super) {
  53015. __extends(ChecksumException, _super);
  53016. function ChecksumException() {
  53017. return _super !== null && _super.apply(this, arguments) || this;
  53018. }
  53019. ChecksumException.getChecksumInstance = function () {
  53020. return new ChecksumException();
  53021. };
  53022. ChecksumException.kind = 'ChecksumException';
  53023. return ChecksumException;
  53024. }(_Exception.default);
  53025. var _default = ChecksumException;
  53026. exports.default = _default;
  53027. /***/ }),
  53028. /* 310 */
  53029. /*!******************************************************************************************!*\
  53030. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/HybridBinarizer.js ***!
  53031. \******************************************************************************************/
  53032. /*! no static exports found */
  53033. /***/ (function(module, exports, __webpack_require__) {
  53034. "use strict";
  53035. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  53036. Object.defineProperty(exports, "__esModule", {
  53037. value: true
  53038. });
  53039. exports.default = void 0;
  53040. var _GlobalHistogramBinarizer = _interopRequireDefault(__webpack_require__(/*! ./GlobalHistogramBinarizer */ 311));
  53041. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./BitMatrix */ 319));
  53042. /*
  53043. * Copyright 2009 ZXing authors
  53044. *
  53045. * Licensed under the Apache License, Version 2.0 (the "License");
  53046. * you may not use this file except in compliance with the License.
  53047. * You may obtain a copy of the License at
  53048. *
  53049. * http://www.apache.org/licenses/LICENSE-2.0
  53050. *
  53051. * Unless required by applicable law or agreed to in writing, software
  53052. * distributed under the License is distributed on an "AS IS" BASIS,
  53053. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  53054. * See the License for the specific language governing permissions and
  53055. * limitations under the License.
  53056. */
  53057. var __extends = void 0 && (void 0).__extends || function () {
  53058. var _extendStatics = function extendStatics(d, b) {
  53059. _extendStatics = Object.setPrototypeOf || {
  53060. __proto__: []
  53061. } instanceof Array && function (d, b) {
  53062. d.__proto__ = b;
  53063. } || function (d, b) {
  53064. for (var p in b) {
  53065. if (b.hasOwnProperty(p)) d[p] = b[p];
  53066. }
  53067. };
  53068. return _extendStatics(d, b);
  53069. };
  53070. return function (d, b) {
  53071. _extendStatics(d, b);
  53072. function __() {
  53073. this.constructor = d;
  53074. }
  53075. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  53076. };
  53077. }();
  53078. /**
  53079. * This class implements a local thresholding algorithm, which while slower than the
  53080. * GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for
  53081. * high frequency images of barcodes with black data on white backgrounds. For this application,
  53082. * it does a much better job than a global blackpoint with severe shadows and gradients.
  53083. * However it tends to produce artifacts on lower frequency images and is therefore not
  53084. * a good general purpose binarizer for uses outside ZXing.
  53085. *
  53086. * This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers,
  53087. * and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already
  53088. * inherently local, and only fails for horizontal gradients. We can revisit that problem later,
  53089. * but for now it was not a win to use local blocks for 1D.
  53090. *
  53091. * This Binarizer is the default for the unit tests and the recommended class for library users.
  53092. *
  53093. * @author dswitkin@google.com (Daniel Switkin)
  53094. */
  53095. var HybridBinarizer = /** @class */function (_super) {
  53096. __extends(HybridBinarizer, _super);
  53097. function HybridBinarizer(source) {
  53098. var _this = _super.call(this, source) || this;
  53099. _this.matrix = null;
  53100. return _this;
  53101. }
  53102. /**
  53103. * Calculates the final BitMatrix once for all requests. This could be called once from the
  53104. * constructor instead, but there are some advantages to doing it lazily, such as making
  53105. * profiling easier, and not doing heavy lifting when callers don't expect it.
  53106. */
  53107. /*@Override*/
  53108. HybridBinarizer.prototype.getBlackMatrix = function () {
  53109. if (this.matrix !== null) {
  53110. return this.matrix;
  53111. }
  53112. var source = this.getLuminanceSource();
  53113. var width = source.getWidth();
  53114. var height = source.getHeight();
  53115. if (width >= HybridBinarizer.MINIMUM_DIMENSION && height >= HybridBinarizer.MINIMUM_DIMENSION) {
  53116. var luminances = source.getMatrix();
  53117. var subWidth = width >> HybridBinarizer.BLOCK_SIZE_POWER;
  53118. if ((width & HybridBinarizer.BLOCK_SIZE_MASK) !== 0) {
  53119. subWidth++;
  53120. }
  53121. var subHeight = height >> HybridBinarizer.BLOCK_SIZE_POWER;
  53122. if ((height & HybridBinarizer.BLOCK_SIZE_MASK) !== 0) {
  53123. subHeight++;
  53124. }
  53125. var blackPoints = HybridBinarizer.calculateBlackPoints(luminances, subWidth, subHeight, width, height);
  53126. var newMatrix = new _BitMatrix.default(width, height);
  53127. HybridBinarizer.calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix);
  53128. this.matrix = newMatrix;
  53129. } else {
  53130. // If the image is too small, fall back to the global histogram approach.
  53131. this.matrix = _super.prototype.getBlackMatrix.call(this);
  53132. }
  53133. return this.matrix;
  53134. };
  53135. /*@Override*/
  53136. HybridBinarizer.prototype.createBinarizer = function (source) {
  53137. return new HybridBinarizer(source);
  53138. };
  53139. /**
  53140. * For each block in the image, calculate the average black point using a 5x5 grid
  53141. * of the blocks around it. Also handles the corner cases (fractional blocks are computed based
  53142. * on the last pixels in the row/column which are also used in the previous block).
  53143. */
  53144. HybridBinarizer.calculateThresholdForBlock = function (luminances, subWidth /*int*/, subHeight /*int*/, width /*int*/, height /*int*/, blackPoints, matrix) {
  53145. var maxYOffset = height - HybridBinarizer.BLOCK_SIZE;
  53146. var maxXOffset = width - HybridBinarizer.BLOCK_SIZE;
  53147. for (var y = 0; y < subHeight; y++) {
  53148. var yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;
  53149. if (yoffset > maxYOffset) {
  53150. yoffset = maxYOffset;
  53151. }
  53152. var top_1 = HybridBinarizer.cap(y, 2, subHeight - 3);
  53153. for (var x = 0; x < subWidth; x++) {
  53154. var xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;
  53155. if (xoffset > maxXOffset) {
  53156. xoffset = maxXOffset;
  53157. }
  53158. var left = HybridBinarizer.cap(x, 2, subWidth - 3);
  53159. var sum = 0;
  53160. for (var z = -2; z <= 2; z++) {
  53161. var blackRow = blackPoints[top_1 + z];
  53162. sum += blackRow[left - 2] + blackRow[left - 1] + blackRow[left] + blackRow[left + 1] + blackRow[left + 2];
  53163. }
  53164. var average = sum / 25;
  53165. HybridBinarizer.thresholdBlock(luminances, xoffset, yoffset, average, width, matrix);
  53166. }
  53167. }
  53168. };
  53169. HybridBinarizer.cap = function (value /*int*/, min /*int*/, max /*int*/) {
  53170. return value < min ? min : value > max ? max : value;
  53171. };
  53172. /**
  53173. * Applies a single threshold to a block of pixels.
  53174. */
  53175. HybridBinarizer.thresholdBlock = function (luminances, xoffset /*int*/, yoffset /*int*/, threshold /*int*/, stride /*int*/, matrix) {
  53176. for (var y = 0, offset = yoffset * stride + xoffset; y < HybridBinarizer.BLOCK_SIZE; y++, offset += stride) {
  53177. for (var x = 0; x < HybridBinarizer.BLOCK_SIZE; x++) {
  53178. // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0.
  53179. if ((luminances[offset + x] & 0xFF) <= threshold) {
  53180. matrix.set(xoffset + x, yoffset + y);
  53181. }
  53182. }
  53183. }
  53184. };
  53185. /**
  53186. * Calculates a single black point for each block of pixels and saves it away.
  53187. * See the following thread for a discussion of this algorithm:
  53188. * http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0
  53189. */
  53190. HybridBinarizer.calculateBlackPoints = function (luminances, subWidth /*int*/, subHeight /*int*/, width /*int*/, height /*int*/) {
  53191. var maxYOffset = height - HybridBinarizer.BLOCK_SIZE;
  53192. var maxXOffset = width - HybridBinarizer.BLOCK_SIZE;
  53193. // tslint:disable-next-line:whitespace
  53194. var blackPoints = new Array(subHeight); // subWidth
  53195. for (var y = 0; y < subHeight; y++) {
  53196. blackPoints[y] = new Int32Array(subWidth);
  53197. var yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;
  53198. if (yoffset > maxYOffset) {
  53199. yoffset = maxYOffset;
  53200. }
  53201. for (var x = 0; x < subWidth; x++) {
  53202. var xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;
  53203. if (xoffset > maxXOffset) {
  53204. xoffset = maxXOffset;
  53205. }
  53206. var sum = 0;
  53207. var min = 0xFF;
  53208. var max = 0;
  53209. for (var yy = 0, offset = yoffset * width + xoffset; yy < HybridBinarizer.BLOCK_SIZE; yy++, offset += width) {
  53210. for (var xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {
  53211. var pixel = luminances[offset + xx] & 0xFF;
  53212. sum += pixel;
  53213. // still looking for good contrast
  53214. if (pixel < min) {
  53215. min = pixel;
  53216. }
  53217. if (pixel > max) {
  53218. max = pixel;
  53219. }
  53220. }
  53221. // short-circuit min/max tests once dynamic range is met
  53222. if (max - min > HybridBinarizer.MIN_DYNAMIC_RANGE) {
  53223. // finish the rest of the rows quickly
  53224. for (yy++, offset += width; yy < HybridBinarizer.BLOCK_SIZE; yy++, offset += width) {
  53225. for (var xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {
  53226. sum += luminances[offset + xx] & 0xFF;
  53227. }
  53228. }
  53229. }
  53230. }
  53231. // The default estimate is the average of the values in the block.
  53232. var average = sum >> HybridBinarizer.BLOCK_SIZE_POWER * 2;
  53233. if (max - min <= HybridBinarizer.MIN_DYNAMIC_RANGE) {
  53234. // If variation within the block is low, assume this is a block with only light or only
  53235. // dark pixels. In that case we do not want to use the average, as it would divide this
  53236. // low contrast area into black and white pixels, essentially creating data out of noise.
  53237. //
  53238. // The default assumption is that the block is light/background. Since no estimate for
  53239. // the level of dark pixels exists locally, use half the min for the block.
  53240. average = min / 2;
  53241. if (y > 0 && x > 0) {
  53242. // Correct the "white background" assumption for blocks that have neighbors by comparing
  53243. // the pixels in this block to the previously calculated black points. This is based on
  53244. // the fact that dark barcode symbology is always surrounded by some amount of light
  53245. // background for which reasonable black point estimates were made. The bp estimated at
  53246. // the boundaries is used for the interior.
  53247. // The (min < bp) is arbitrary but works better than other heuristics that were tried.
  53248. var averageNeighborBlackPoint = (blackPoints[y - 1][x] + 2 * blackPoints[y][x - 1] + blackPoints[y - 1][x - 1]) / 4;
  53249. if (min < averageNeighborBlackPoint) {
  53250. average = averageNeighborBlackPoint;
  53251. }
  53252. }
  53253. }
  53254. blackPoints[y][x] = average;
  53255. }
  53256. }
  53257. return blackPoints;
  53258. };
  53259. // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels.
  53260. // So this is the smallest dimension in each axis we can accept.
  53261. HybridBinarizer.BLOCK_SIZE_POWER = 3;
  53262. HybridBinarizer.BLOCK_SIZE = 1 << HybridBinarizer.BLOCK_SIZE_POWER; // ...0100...00
  53263. HybridBinarizer.BLOCK_SIZE_MASK = HybridBinarizer.BLOCK_SIZE - 1; // ...0011...11
  53264. HybridBinarizer.MINIMUM_DIMENSION = HybridBinarizer.BLOCK_SIZE * 5;
  53265. HybridBinarizer.MIN_DYNAMIC_RANGE = 24;
  53266. return HybridBinarizer;
  53267. }(_GlobalHistogramBinarizer.default);
  53268. var _default = HybridBinarizer;
  53269. exports.default = _default;
  53270. /***/ }),
  53271. /* 311 */
  53272. /*!***************************************************************************************************!*\
  53273. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/GlobalHistogramBinarizer.js ***!
  53274. \***************************************************************************************************/
  53275. /*! no static exports found */
  53276. /***/ (function(module, exports, __webpack_require__) {
  53277. "use strict";
  53278. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  53279. Object.defineProperty(exports, "__esModule", {
  53280. value: true
  53281. });
  53282. exports.default = void 0;
  53283. var _Binarizer = _interopRequireDefault(__webpack_require__(/*! ../Binarizer */ 312));
  53284. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ./BitArray */ 313));
  53285. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./BitMatrix */ 319));
  53286. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  53287. /*
  53288. * Copyright 2009 ZXing authors
  53289. *
  53290. * Licensed under the Apache License, Version 2.0 (the "License");
  53291. * you may not use this file except in compliance with the License.
  53292. * You may obtain a copy of the License at
  53293. *
  53294. * http://www.apache.org/licenses/LICENSE-2.0
  53295. *
  53296. * Unless required by applicable law or agreed to in writing, software
  53297. * distributed under the License is distributed on an "AS IS" BASIS,
  53298. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  53299. * See the License for the specific language governing permissions and
  53300. * limitations under the License.
  53301. */
  53302. var __extends = void 0 && (void 0).__extends || function () {
  53303. var _extendStatics = function extendStatics(d, b) {
  53304. _extendStatics = Object.setPrototypeOf || {
  53305. __proto__: []
  53306. } instanceof Array && function (d, b) {
  53307. d.__proto__ = b;
  53308. } || function (d, b) {
  53309. for (var p in b) {
  53310. if (b.hasOwnProperty(p)) d[p] = b[p];
  53311. }
  53312. };
  53313. return _extendStatics(d, b);
  53314. };
  53315. return function (d, b) {
  53316. _extendStatics(d, b);
  53317. function __() {
  53318. this.constructor = d;
  53319. }
  53320. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  53321. };
  53322. }();
  53323. /*namespace com.google.zxing.common {*/
  53324. /**
  53325. * This Binarizer implementation uses the old ZXing global histogram approach. It is suitable
  53326. * for low-end mobile devices which don't have enough CPU or memory to use a local thresholding
  53327. * algorithm. However, because it picks a global black point, it cannot handle difficult shadows
  53328. * and gradients.
  53329. *
  53330. * Faster mobile devices and all desktop applications should probably use HybridBinarizer instead.
  53331. *
  53332. * @author dswitkin@google.com (Daniel Switkin)
  53333. * @author Sean Owen
  53334. */
  53335. var GlobalHistogramBinarizer = /** @class */function (_super) {
  53336. __extends(GlobalHistogramBinarizer, _super);
  53337. function GlobalHistogramBinarizer(source) {
  53338. var _this = _super.call(this, source) || this;
  53339. _this.luminances = GlobalHistogramBinarizer.EMPTY;
  53340. _this.buckets = new Int32Array(GlobalHistogramBinarizer.LUMINANCE_BUCKETS);
  53341. return _this;
  53342. }
  53343. // Applies simple sharpening to the row data to improve performance of the 1D Readers.
  53344. /*@Override*/
  53345. GlobalHistogramBinarizer.prototype.getBlackRow = function (y /*int*/, row) {
  53346. var source = this.getLuminanceSource();
  53347. var width = source.getWidth();
  53348. if (row === undefined || row === null || row.getSize() < width) {
  53349. row = new _BitArray.default(width);
  53350. } else {
  53351. row.clear();
  53352. }
  53353. this.initArrays(width);
  53354. var localLuminances = source.getRow(y, this.luminances);
  53355. var localBuckets = this.buckets;
  53356. for (var x = 0; x < width; x++) {
  53357. localBuckets[(localLuminances[x] & 0xff) >> GlobalHistogramBinarizer.LUMINANCE_SHIFT]++;
  53358. }
  53359. var blackPoint = GlobalHistogramBinarizer.estimateBlackPoint(localBuckets);
  53360. if (width < 3) {
  53361. // Special case for very small images
  53362. for (var x = 0; x < width; x++) {
  53363. if ((localLuminances[x] & 0xff) < blackPoint) {
  53364. row.set(x);
  53365. }
  53366. }
  53367. } else {
  53368. var left = localLuminances[0] & 0xff;
  53369. var center = localLuminances[1] & 0xff;
  53370. for (var x = 1; x < width - 1; x++) {
  53371. var right = localLuminances[x + 1] & 0xff;
  53372. // A simple -1 4 -1 box filter with a weight of 2.
  53373. if ((center * 4 - left - right) / 2 < blackPoint) {
  53374. row.set(x);
  53375. }
  53376. left = center;
  53377. center = right;
  53378. }
  53379. }
  53380. return row;
  53381. };
  53382. // Does not sharpen the data, as this call is intended to only be used by 2D Readers.
  53383. /*@Override*/
  53384. GlobalHistogramBinarizer.prototype.getBlackMatrix = function () {
  53385. var source = this.getLuminanceSource();
  53386. var width = source.getWidth();
  53387. var height = source.getHeight();
  53388. var matrix = new _BitMatrix.default(width, height);
  53389. // Quickly calculates the histogram by sampling four rows from the image. This proved to be
  53390. // more robust on the blackbox tests than sampling a diagonal as we used to do.
  53391. this.initArrays(width);
  53392. var localBuckets = this.buckets;
  53393. for (var y = 1; y < 5; y++) {
  53394. var row = Math.floor(height * y / 5);
  53395. var localLuminances_1 = source.getRow(row, this.luminances);
  53396. var right = Math.floor(width * 4 / 5);
  53397. for (var x = Math.floor(width / 5); x < right; x++) {
  53398. var pixel = localLuminances_1[x] & 0xff;
  53399. localBuckets[pixel >> GlobalHistogramBinarizer.LUMINANCE_SHIFT]++;
  53400. }
  53401. }
  53402. var blackPoint = GlobalHistogramBinarizer.estimateBlackPoint(localBuckets);
  53403. // We delay reading the entire image luminance until the black point estimation succeeds.
  53404. // Although we end up reading four rows twice, it is consistent with our motto of
  53405. // "fail quickly" which is necessary for continuous scanning.
  53406. var localLuminances = source.getMatrix();
  53407. for (var y = 0; y < height; y++) {
  53408. var offset = y * width;
  53409. for (var x = 0; x < width; x++) {
  53410. var pixel = localLuminances[offset + x] & 0xff;
  53411. if (pixel < blackPoint) {
  53412. matrix.set(x, y);
  53413. }
  53414. }
  53415. }
  53416. return matrix;
  53417. };
  53418. /*@Override*/
  53419. GlobalHistogramBinarizer.prototype.createBinarizer = function (source) {
  53420. return new GlobalHistogramBinarizer(source);
  53421. };
  53422. GlobalHistogramBinarizer.prototype.initArrays = function (luminanceSize /*int*/) {
  53423. if (this.luminances.length < luminanceSize) {
  53424. this.luminances = new Uint8ClampedArray(luminanceSize);
  53425. }
  53426. var buckets = this.buckets;
  53427. for (var x = 0; x < GlobalHistogramBinarizer.LUMINANCE_BUCKETS; x++) {
  53428. buckets[x] = 0;
  53429. }
  53430. };
  53431. GlobalHistogramBinarizer.estimateBlackPoint = function (buckets) {
  53432. // Find the tallest peak in the histogram.
  53433. var numBuckets = buckets.length;
  53434. var maxBucketCount = 0;
  53435. var firstPeak = 0;
  53436. var firstPeakSize = 0;
  53437. for (var x = 0; x < numBuckets; x++) {
  53438. if (buckets[x] > firstPeakSize) {
  53439. firstPeak = x;
  53440. firstPeakSize = buckets[x];
  53441. }
  53442. if (buckets[x] > maxBucketCount) {
  53443. maxBucketCount = buckets[x];
  53444. }
  53445. }
  53446. // Find the second-tallest peak which is somewhat far from the tallest peak.
  53447. var secondPeak = 0;
  53448. var secondPeakScore = 0;
  53449. for (var x = 0; x < numBuckets; x++) {
  53450. var distanceToBiggest = x - firstPeak;
  53451. // Encourage more distant second peaks by multiplying by square of distance.
  53452. var score = buckets[x] * distanceToBiggest * distanceToBiggest;
  53453. if (score > secondPeakScore) {
  53454. secondPeak = x;
  53455. secondPeakScore = score;
  53456. }
  53457. }
  53458. // Make sure firstPeak corresponds to the black peak.
  53459. if (firstPeak > secondPeak) {
  53460. var temp = firstPeak;
  53461. firstPeak = secondPeak;
  53462. secondPeak = temp;
  53463. }
  53464. // If there is too little contrast in the image to pick a meaningful black point, throw rather
  53465. // than waste time trying to decode the image, and risk false positives.
  53466. if (secondPeak - firstPeak <= numBuckets / 16) {
  53467. throw new _NotFoundException.default();
  53468. }
  53469. // Find a valley between them that is low and closer to the white peak.
  53470. var bestValley = secondPeak - 1;
  53471. var bestValleyScore = -1;
  53472. for (var x = secondPeak - 1; x > firstPeak; x--) {
  53473. var fromFirst = x - firstPeak;
  53474. var score = fromFirst * fromFirst * (secondPeak - x) * (maxBucketCount - buckets[x]);
  53475. if (score > bestValleyScore) {
  53476. bestValley = x;
  53477. bestValleyScore = score;
  53478. }
  53479. }
  53480. return bestValley << GlobalHistogramBinarizer.LUMINANCE_SHIFT;
  53481. };
  53482. GlobalHistogramBinarizer.LUMINANCE_BITS = 5;
  53483. GlobalHistogramBinarizer.LUMINANCE_SHIFT = 8 - GlobalHistogramBinarizer.LUMINANCE_BITS;
  53484. GlobalHistogramBinarizer.LUMINANCE_BUCKETS = 1 << GlobalHistogramBinarizer.LUMINANCE_BITS;
  53485. GlobalHistogramBinarizer.EMPTY = Uint8ClampedArray.from([0]);
  53486. return GlobalHistogramBinarizer;
  53487. }(_Binarizer.default);
  53488. var _default = GlobalHistogramBinarizer;
  53489. exports.default = _default;
  53490. /***/ }),
  53491. /* 312 */
  53492. /*!*****************************************************************************!*\
  53493. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/Binarizer.js ***!
  53494. \*****************************************************************************/
  53495. /*! no static exports found */
  53496. /***/ (function(module, exports, __webpack_require__) {
  53497. "use strict";
  53498. Object.defineProperty(exports, "__esModule", {
  53499. value: true
  53500. });
  53501. exports.default = void 0;
  53502. /*
  53503. * Copyright 2009 ZXing authors
  53504. *
  53505. * Licensed under the Apache License, Version 2.0 (the "License");
  53506. * you may not use this file except in compliance with the License.
  53507. * You may obtain a copy of the License at
  53508. *
  53509. * http://www.apache.org/licenses/LICENSE-2.0
  53510. *
  53511. * Unless required by applicable law or agreed to in writing, software
  53512. * distributed under the License is distributed on an "AS IS" BASIS,
  53513. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  53514. * See the License for the specific language governing permissions and
  53515. * limitations under the License.
  53516. */
  53517. /**
  53518. * This class hierarchy provides a set of methods to convert luminance data to 1 bit data.
  53519. * It allows the algorithm to vary polymorphically, for example allowing a very expensive
  53520. * thresholding technique for servers and a fast one for mobile. It also permits the implementation
  53521. * to vary, e.g. a JNI version for Android and a Java fallback version for other platforms.
  53522. *
  53523. * @author dswitkin@google.com (Daniel Switkin)
  53524. */
  53525. var Binarizer = /** @class */function () {
  53526. function Binarizer(source) {
  53527. this.source = source;
  53528. }
  53529. Binarizer.prototype.getLuminanceSource = function () {
  53530. return this.source;
  53531. };
  53532. Binarizer.prototype.getWidth = function () {
  53533. return this.source.getWidth();
  53534. };
  53535. Binarizer.prototype.getHeight = function () {
  53536. return this.source.getHeight();
  53537. };
  53538. return Binarizer;
  53539. }();
  53540. var _default = Binarizer;
  53541. exports.default = _default;
  53542. /***/ }),
  53543. /* 313 */
  53544. /*!***********************************************************************************!*\
  53545. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/BitArray.js ***!
  53546. \***********************************************************************************/
  53547. /*! no static exports found */
  53548. /***/ (function(module, exports, __webpack_require__) {
  53549. "use strict";
  53550. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  53551. Object.defineProperty(exports, "__esModule", {
  53552. value: true
  53553. });
  53554. exports.default = void 0;
  53555. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  53556. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../util/Arrays */ 314));
  53557. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
  53558. var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
  53559. /*
  53560. * Copyright 2007 ZXing authors
  53561. *
  53562. * Licensed under the Apache License, Version 2.0 (the "License");
  53563. * you may not use this file except in compliance with the License.
  53564. * You may obtain a copy of the License at
  53565. *
  53566. * http://www.apache.org/licenses/LICENSE-2.0
  53567. *
  53568. * Unless required by applicable law or agreed to in writing, software
  53569. * distributed under the License is distributed on an "AS IS" BASIS,
  53570. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  53571. * See the License for the specific language governing permissions and
  53572. * limitations under the License.
  53573. */
  53574. /*namespace com.google.zxing.common {*/
  53575. /*import java.util.Arrays;*/
  53576. /**
  53577. * <p>A simple, fast array of bits, represented compactly by an array of ints internally.</p>
  53578. *
  53579. * @author Sean Owen
  53580. */
  53581. var BitArray /*implements Cloneable*/ = /** @class */function () {
  53582. // public constructor() {
  53583. // this.size = 0
  53584. // this.bits = new Int32Array(1)
  53585. // }
  53586. // public constructor(size?: number /*int*/) {
  53587. // if (undefined === size) {
  53588. // this.size = 0
  53589. // } else {
  53590. // this.size = size
  53591. // }
  53592. // this.bits = this.makeArray(size)
  53593. // }
  53594. // For testing only
  53595. function BitArray(size /*int*/, bits) {
  53596. if (undefined === size) {
  53597. this.size = 0;
  53598. this.bits = new Int32Array(1);
  53599. } else {
  53600. this.size = size;
  53601. if (undefined === bits || null === bits) {
  53602. this.bits = BitArray.makeArray(size);
  53603. } else {
  53604. this.bits = bits;
  53605. }
  53606. }
  53607. }
  53608. BitArray.prototype.getSize = function () {
  53609. return this.size;
  53610. };
  53611. BitArray.prototype.getSizeInBytes = function () {
  53612. return Math.floor((this.size + 7) / 8);
  53613. };
  53614. BitArray.prototype.ensureCapacity = function (size /*int*/) {
  53615. if (size > this.bits.length * 32) {
  53616. var newBits = BitArray.makeArray(size);
  53617. _System.default.arraycopy(this.bits, 0, newBits, 0, this.bits.length);
  53618. this.bits = newBits;
  53619. }
  53620. };
  53621. /**
  53622. * @param i bit to get
  53623. * @return true iff bit i is set
  53624. */
  53625. BitArray.prototype.get = function (i /*int*/) {
  53626. return (this.bits[Math.floor(i / 32)] & 1 << (i & 0x1F)) !== 0;
  53627. };
  53628. /**
  53629. * Sets bit i.
  53630. *
  53631. * @param i bit to set
  53632. */
  53633. BitArray.prototype.set = function (i /*int*/) {
  53634. this.bits[Math.floor(i / 32)] |= 1 << (i & 0x1F);
  53635. };
  53636. /**
  53637. * Flips bit i.
  53638. *
  53639. * @param i bit to set
  53640. */
  53641. BitArray.prototype.flip = function (i /*int*/) {
  53642. this.bits[Math.floor(i / 32)] ^= 1 << (i & 0x1F);
  53643. };
  53644. /**
  53645. * @param from first bit to check
  53646. * @return index of first bit that is set, starting from the given index, or size if none are set
  53647. * at or beyond this given index
  53648. * @see #getNextUnset(int)
  53649. */
  53650. BitArray.prototype.getNextSet = function (from /*int*/) {
  53651. var size = this.size;
  53652. if (from >= size) {
  53653. return size;
  53654. }
  53655. var bits = this.bits;
  53656. var bitsOffset = Math.floor(from / 32);
  53657. var currentBits = bits[bitsOffset];
  53658. // mask off lesser bits first
  53659. currentBits &= ~((1 << (from & 0x1F)) - 1);
  53660. var length = bits.length;
  53661. while (currentBits === 0) {
  53662. if (++bitsOffset === length) {
  53663. return size;
  53664. }
  53665. currentBits = bits[bitsOffset];
  53666. }
  53667. var result = bitsOffset * 32 + _Integer.default.numberOfTrailingZeros(currentBits);
  53668. return result > size ? size : result;
  53669. };
  53670. /**
  53671. * @param from index to start looking for unset bit
  53672. * @return index of next unset bit, or {@code size} if none are unset until the end
  53673. * @see #getNextSet(int)
  53674. */
  53675. BitArray.prototype.getNextUnset = function (from /*int*/) {
  53676. var size = this.size;
  53677. if (from >= size) {
  53678. return size;
  53679. }
  53680. var bits = this.bits;
  53681. var bitsOffset = Math.floor(from / 32);
  53682. var currentBits = ~bits[bitsOffset];
  53683. // mask off lesser bits first
  53684. currentBits &= ~((1 << (from & 0x1F)) - 1);
  53685. var length = bits.length;
  53686. while (currentBits === 0) {
  53687. if (++bitsOffset === length) {
  53688. return size;
  53689. }
  53690. currentBits = ~bits[bitsOffset];
  53691. }
  53692. var result = bitsOffset * 32 + _Integer.default.numberOfTrailingZeros(currentBits);
  53693. return result > size ? size : result;
  53694. };
  53695. /**
  53696. * Sets a block of 32 bits, starting at bit i.
  53697. *
  53698. * @param i first bit to set
  53699. * @param newBits the new value of the next 32 bits. Note again that the least-significant bit
  53700. * corresponds to bit i, the next-least-significant to i+1, and so on.
  53701. */
  53702. BitArray.prototype.setBulk = function (i /*int*/, newBits /*int*/) {
  53703. this.bits[Math.floor(i / 32)] = newBits;
  53704. };
  53705. /**
  53706. * Sets a range of bits.
  53707. *
  53708. * @param start start of range, inclusive.
  53709. * @param end end of range, exclusive
  53710. */
  53711. BitArray.prototype.setRange = function (start /*int*/, end /*int*/) {
  53712. if (end < start || start < 0 || end > this.size) {
  53713. throw new _IllegalArgumentException.default();
  53714. }
  53715. if (end === start) {
  53716. return;
  53717. }
  53718. end--; // will be easier to treat this as the last actually set bit -- inclusive
  53719. var firstInt = Math.floor(start / 32);
  53720. var lastInt = Math.floor(end / 32);
  53721. var bits = this.bits;
  53722. for (var i = firstInt; i <= lastInt; i++) {
  53723. var firstBit = i > firstInt ? 0 : start & 0x1F;
  53724. var lastBit = i < lastInt ? 31 : end & 0x1F;
  53725. // Ones from firstBit to lastBit, inclusive
  53726. var mask = (2 << lastBit) - (1 << firstBit);
  53727. bits[i] |= mask;
  53728. }
  53729. };
  53730. /**
  53731. * Clears all bits (sets to false).
  53732. */
  53733. BitArray.prototype.clear = function () {
  53734. var max = this.bits.length;
  53735. var bits = this.bits;
  53736. for (var i = 0; i < max; i++) {
  53737. bits[i] = 0;
  53738. }
  53739. };
  53740. /**
  53741. * Efficient method to check if a range of bits is set, or not set.
  53742. *
  53743. * @param start start of range, inclusive.
  53744. * @param end end of range, exclusive
  53745. * @param value if true, checks that bits in range are set, otherwise checks that they are not set
  53746. * @return true iff all bits are set or not set in range, according to value argument
  53747. * @throws IllegalArgumentException if end is less than start or the range is not contained in the array
  53748. */
  53749. BitArray.prototype.isRange = function (start /*int*/, end /*int*/, value) {
  53750. if (end < start || start < 0 || end > this.size) {
  53751. throw new _IllegalArgumentException.default();
  53752. }
  53753. if (end === start) {
  53754. return true; // empty range matches
  53755. }
  53756. end--; // will be easier to treat this as the last actually set bit -- inclusive
  53757. var firstInt = Math.floor(start / 32);
  53758. var lastInt = Math.floor(end / 32);
  53759. var bits = this.bits;
  53760. for (var i = firstInt; i <= lastInt; i++) {
  53761. var firstBit = i > firstInt ? 0 : start & 0x1F;
  53762. var lastBit = i < lastInt ? 31 : end & 0x1F;
  53763. // Ones from firstBit to lastBit, inclusive
  53764. var mask = (2 << lastBit) - (1 << firstBit) & 0xFFFFFFFF;
  53765. // TYPESCRIPTPORT: & 0xFFFFFFFF added to discard anything after 32 bits, as ES has 53 bits
  53766. // Return false if we're looking for 1s and the masked bits[i] isn't all 1s (is: that,
  53767. // equals the mask, or we're looking for 0s and the masked portion is not all 0s
  53768. if ((bits[i] & mask) !== (value ? mask : 0)) {
  53769. return false;
  53770. }
  53771. }
  53772. return true;
  53773. };
  53774. BitArray.prototype.appendBit = function (bit) {
  53775. this.ensureCapacity(this.size + 1);
  53776. if (bit) {
  53777. this.bits[Math.floor(this.size / 32)] |= 1 << (this.size & 0x1F);
  53778. }
  53779. this.size++;
  53780. };
  53781. /**
  53782. * Appends the least-significant bits, from value, in order from most-significant to
  53783. * least-significant. For example, appending 6 bits from 0x000001E will append the bits
  53784. * 0, 1, 1, 1, 1, 0 in that order.
  53785. *
  53786. * @param value {@code int} containing bits to append
  53787. * @param numBits bits from value to append
  53788. */
  53789. BitArray.prototype.appendBits = function (value /*int*/, numBits /*int*/) {
  53790. if (numBits < 0 || numBits > 32) {
  53791. throw new _IllegalArgumentException.default('Num bits must be between 0 and 32');
  53792. }
  53793. this.ensureCapacity(this.size + numBits);
  53794. // const appendBit = this.appendBit;
  53795. for (var numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) {
  53796. this.appendBit((value >> numBitsLeft - 1 & 0x01) === 1);
  53797. }
  53798. };
  53799. BitArray.prototype.appendBitArray = function (other) {
  53800. var otherSize = other.size;
  53801. this.ensureCapacity(this.size + otherSize);
  53802. // const appendBit = this.appendBit;
  53803. for (var i = 0; i < otherSize; i++) {
  53804. this.appendBit(other.get(i));
  53805. }
  53806. };
  53807. BitArray.prototype.xor = function (other) {
  53808. if (this.size !== other.size) {
  53809. throw new _IllegalArgumentException.default('Sizes don\'t match');
  53810. }
  53811. var bits = this.bits;
  53812. for (var i = 0, length_1 = bits.length; i < length_1; i++) {
  53813. // The last int could be incomplete (i.e. not have 32 bits in
  53814. // it) but there is no problem since 0 XOR 0 == 0.
  53815. bits[i] ^= other.bits[i];
  53816. }
  53817. };
  53818. /**
  53819. *
  53820. * @param bitOffset first bit to start writing
  53821. * @param array array to write into. Bytes are written most-significant byte first. This is the opposite
  53822. * of the internal representation, which is exposed by {@link #getBitArray()}
  53823. * @param offset position in array to start writing
  53824. * @param numBytes how many bytes to write
  53825. */
  53826. BitArray.prototype.toBytes = function (bitOffset /*int*/, array, offset /*int*/, numBytes /*int*/) {
  53827. for (var i = 0; i < numBytes; i++) {
  53828. var theByte = 0;
  53829. for (var j = 0; j < 8; j++) {
  53830. if (this.get(bitOffset)) {
  53831. theByte |= 1 << 7 - j;
  53832. }
  53833. bitOffset++;
  53834. }
  53835. array[offset + i] = /*(byte)*/theByte;
  53836. }
  53837. };
  53838. /**
  53839. * @return underlying array of ints. The first element holds the first 32 bits, and the least
  53840. * significant bit is bit 0.
  53841. */
  53842. BitArray.prototype.getBitArray = function () {
  53843. return this.bits;
  53844. };
  53845. /**
  53846. * Reverses all bits in the array.
  53847. */
  53848. BitArray.prototype.reverse = function () {
  53849. var newBits = new Int32Array(this.bits.length);
  53850. // reverse all int's first
  53851. var len = Math.floor((this.size - 1) / 32);
  53852. var oldBitsLen = len + 1;
  53853. var bits = this.bits;
  53854. for (var i = 0; i < oldBitsLen; i++) {
  53855. var x = bits[i];
  53856. x = x >> 1 & 0x55555555 | (x & 0x55555555) << 1;
  53857. x = x >> 2 & 0x33333333 | (x & 0x33333333) << 2;
  53858. x = x >> 4 & 0x0f0f0f0f | (x & 0x0f0f0f0f) << 4;
  53859. x = x >> 8 & 0x00ff00ff | (x & 0x00ff00ff) << 8;
  53860. x = x >> 16 & 0x0000ffff | (x & 0x0000ffff) << 16;
  53861. newBits[len - i] = /*(int)*/x;
  53862. }
  53863. // now correct the int's if the bit size isn't a multiple of 32
  53864. if (this.size !== oldBitsLen * 32) {
  53865. var leftOffset = oldBitsLen * 32 - this.size;
  53866. var currentInt = newBits[0] >>> leftOffset;
  53867. for (var i = 1; i < oldBitsLen; i++) {
  53868. var nextInt = newBits[i];
  53869. currentInt |= nextInt << 32 - leftOffset;
  53870. newBits[i - 1] = currentInt;
  53871. currentInt = nextInt >>> leftOffset;
  53872. }
  53873. newBits[oldBitsLen - 1] = currentInt;
  53874. }
  53875. this.bits = newBits;
  53876. };
  53877. BitArray.makeArray = function (size /*int*/) {
  53878. return new Int32Array(Math.floor((size + 31) / 32));
  53879. };
  53880. /*@Override*/
  53881. BitArray.prototype.equals = function (o) {
  53882. if (!(o instanceof BitArray)) {
  53883. return false;
  53884. }
  53885. var other = o;
  53886. return this.size === other.size && _Arrays.default.equals(this.bits, other.bits);
  53887. };
  53888. /*@Override*/
  53889. BitArray.prototype.hashCode = function () {
  53890. return 31 * this.size + _Arrays.default.hashCode(this.bits);
  53891. };
  53892. /*@Override*/
  53893. BitArray.prototype.toString = function () {
  53894. var result = '';
  53895. for (var i = 0, size = this.size; i < size; i++) {
  53896. if ((i & 0x07) === 0) {
  53897. result += ' ';
  53898. }
  53899. result += this.get(i) ? 'X' : '.';
  53900. }
  53901. return result;
  53902. };
  53903. /*@Override*/
  53904. BitArray.prototype.clone = function () {
  53905. return new BitArray(this.size, this.bits.slice());
  53906. };
  53907. /**
  53908. * converts to boolean array.
  53909. */
  53910. BitArray.prototype.toArray = function () {
  53911. var result = [];
  53912. for (var i = 0, size = this.size; i < size; i++) {
  53913. result.push(this.get(i));
  53914. }
  53915. return result;
  53916. };
  53917. return BitArray;
  53918. }();
  53919. var _default = BitArray;
  53920. exports.default = _default;
  53921. /***/ }),
  53922. /* 314 */
  53923. /*!*******************************************************************************!*\
  53924. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Arrays.js ***!
  53925. \*******************************************************************************/
  53926. /*! no static exports found */
  53927. /***/ (function(module, exports, __webpack_require__) {
  53928. "use strict";
  53929. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  53930. Object.defineProperty(exports, "__esModule", {
  53931. value: true
  53932. });
  53933. exports.default = void 0;
  53934. var _System = _interopRequireDefault(__webpack_require__(/*! ./System */ 315));
  53935. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  53936. var _ArrayIndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ../ArrayIndexOutOfBoundsException */ 316));
  53937. var __values = void 0 && (void 0).__values || function (o) {
  53938. var s = typeof Symbol === "function" && Symbol.iterator,
  53939. m = s && o[s],
  53940. i = 0;
  53941. if (m) return m.call(o);
  53942. if (o && typeof o.length === "number") return {
  53943. next: function next() {
  53944. if (o && i >= o.length) o = void 0;
  53945. return {
  53946. value: o && o[i++],
  53947. done: !o
  53948. };
  53949. }
  53950. };
  53951. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  53952. };
  53953. var Arrays = /** @class */function () {
  53954. function Arrays() {}
  53955. /**
  53956. * Assigns the specified int value to each element of the specified array
  53957. * of ints.
  53958. *
  53959. * @param a the array to be filled
  53960. * @param val the value to be stored in all elements of the array
  53961. */
  53962. Arrays.fill = function (a, val) {
  53963. for (var i = 0, len = a.length; i < len; i++) {
  53964. a[i] = val;
  53965. }
  53966. };
  53967. /**
  53968. * Assigns the specified int value to each element of the specified
  53969. * range of the specified array of ints. The range to be filled
  53970. * extends from index {@code fromIndex}, inclusive, to index
  53971. * {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
  53972. * range to be filled is empty.)
  53973. *
  53974. * @param a the array to be filled
  53975. * @param fromIndex the index of the first element (inclusive) to be
  53976. * filled with the specified value
  53977. * @param toIndex the index of the last element (exclusive) to be
  53978. * filled with the specified value
  53979. * @param val the value to be stored in all elements of the array
  53980. * @throws IllegalArgumentException if {@code fromIndex > toIndex}
  53981. * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
  53982. * {@code toIndex > a.length}
  53983. */
  53984. Arrays.fillWithin = function (a, fromIndex, toIndex, val) {
  53985. Arrays.rangeCheck(a.length, fromIndex, toIndex);
  53986. for (var i = fromIndex; i < toIndex; i++) {
  53987. a[i] = val;
  53988. }
  53989. };
  53990. /**
  53991. * Checks that {@code fromIndex} and {@code toIndex} are in
  53992. * the range and throws an exception if they aren't.
  53993. */
  53994. Arrays.rangeCheck = function (arrayLength, fromIndex, toIndex) {
  53995. if (fromIndex > toIndex) {
  53996. throw new _IllegalArgumentException.default('fromIndex(' + fromIndex + ') > toIndex(' + toIndex + ')');
  53997. }
  53998. if (fromIndex < 0) {
  53999. throw new _ArrayIndexOutOfBoundsException.default(fromIndex);
  54000. }
  54001. if (toIndex > arrayLength) {
  54002. throw new _ArrayIndexOutOfBoundsException.default(toIndex);
  54003. }
  54004. };
  54005. Arrays.asList = function () {
  54006. var args = [];
  54007. for (var _i = 0; _i < arguments.length; _i++) {
  54008. args[_i] = arguments[_i];
  54009. }
  54010. return args;
  54011. };
  54012. Arrays.create = function (rows, cols, value) {
  54013. var arr = Array.from({
  54014. length: rows
  54015. });
  54016. return arr.map(function (x) {
  54017. return Array.from({
  54018. length: cols
  54019. }).fill(value);
  54020. });
  54021. };
  54022. Arrays.createInt32Array = function (rows, cols, value) {
  54023. var arr = Array.from({
  54024. length: rows
  54025. });
  54026. return arr.map(function (x) {
  54027. return Int32Array.from({
  54028. length: cols
  54029. }).fill(value);
  54030. });
  54031. };
  54032. Arrays.equals = function (first, second) {
  54033. if (!first) {
  54034. return false;
  54035. }
  54036. if (!second) {
  54037. return false;
  54038. }
  54039. if (!first.length) {
  54040. return false;
  54041. }
  54042. if (!second.length) {
  54043. return false;
  54044. }
  54045. if (first.length !== second.length) {
  54046. return false;
  54047. }
  54048. for (var i = 0, length_1 = first.length; i < length_1; i++) {
  54049. if (first[i] !== second[i]) {
  54050. return false;
  54051. }
  54052. }
  54053. return true;
  54054. };
  54055. Arrays.hashCode = function (a) {
  54056. var e_1, _a;
  54057. if (a === null) {
  54058. return 0;
  54059. }
  54060. var result = 1;
  54061. try {
  54062. for (var a_1 = __values(a), a_1_1 = a_1.next(); !a_1_1.done; a_1_1 = a_1.next()) {
  54063. var element = a_1_1.value;
  54064. result = 31 * result + element;
  54065. }
  54066. } catch (e_1_1) {
  54067. e_1 = {
  54068. error: e_1_1
  54069. };
  54070. } finally {
  54071. try {
  54072. if (a_1_1 && !a_1_1.done && (_a = a_1.return)) _a.call(a_1);
  54073. } finally {
  54074. if (e_1) throw e_1.error;
  54075. }
  54076. }
  54077. return result;
  54078. };
  54079. Arrays.fillUint8Array = function (a, value) {
  54080. for (var i = 0; i !== a.length; i++) {
  54081. a[i] = value;
  54082. }
  54083. };
  54084. Arrays.copyOf = function (original, newLength) {
  54085. return original.slice(0, newLength);
  54086. };
  54087. Arrays.copyOfUint8Array = function (original, newLength) {
  54088. if (original.length <= newLength) {
  54089. var newArray = new Uint8Array(newLength);
  54090. newArray.set(original);
  54091. return newArray;
  54092. }
  54093. return original.slice(0, newLength);
  54094. };
  54095. Arrays.copyOfRange = function (original, from, to) {
  54096. var newLength = to - from;
  54097. var copy = new Int32Array(newLength);
  54098. _System.default.arraycopy(original, from, copy, 0, newLength);
  54099. return copy;
  54100. };
  54101. /*
  54102. * Returns the index of of the element in a sorted array or (-n-1) where n is the insertion point
  54103. * for the new element.
  54104. * Parameters:
  54105. * ar - A sorted array
  54106. * el - An element to search for
  54107. * comparator - A comparator function. The function takes two arguments: (a, b) and returns:
  54108. * a negative number if a is less than b;
  54109. * 0 if a is equal to b;
  54110. * a positive number of a is greater than b.
  54111. * The array may contain duplicate elements. If there are more than one equal elements in the array,
  54112. * the returned value can be the index of any one of the equal elements.
  54113. *
  54114. * http://jsfiddle.net/aryzhov/pkfst550/
  54115. */
  54116. Arrays.binarySearch = function (ar, el, comparator) {
  54117. if (undefined === comparator) {
  54118. comparator = Arrays.numberComparator;
  54119. }
  54120. var m = 0;
  54121. var n = ar.length - 1;
  54122. while (m <= n) {
  54123. var k = n + m >> 1;
  54124. var cmp = comparator(el, ar[k]);
  54125. if (cmp > 0) {
  54126. m = k + 1;
  54127. } else if (cmp < 0) {
  54128. n = k - 1;
  54129. } else {
  54130. return k;
  54131. }
  54132. }
  54133. return -m - 1;
  54134. };
  54135. Arrays.numberComparator = function (a, b) {
  54136. return a - b;
  54137. };
  54138. return Arrays;
  54139. }();
  54140. var _default = Arrays;
  54141. exports.default = _default;
  54142. /***/ }),
  54143. /* 315 */
  54144. /*!*******************************************************************************!*\
  54145. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/System.js ***!
  54146. \*******************************************************************************/
  54147. /*! no static exports found */
  54148. /***/ (function(module, exports, __webpack_require__) {
  54149. "use strict";
  54150. Object.defineProperty(exports, "__esModule", {
  54151. value: true
  54152. });
  54153. exports.default = void 0;
  54154. var System = /** @class */function () {
  54155. function System() {}
  54156. // public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
  54157. /**
  54158. * Makes a copy of a array.
  54159. */
  54160. System.arraycopy = function (src, srcPos, dest, destPos, length) {
  54161. // TODO: better use split or set?
  54162. while (length--) {
  54163. dest[destPos++] = src[srcPos++];
  54164. }
  54165. };
  54166. /**
  54167. * Returns the current time in milliseconds.
  54168. */
  54169. System.currentTimeMillis = function () {
  54170. return Date.now();
  54171. };
  54172. return System;
  54173. }();
  54174. var _default = System;
  54175. exports.default = _default;
  54176. /***/ }),
  54177. /* 316 */
  54178. /*!**************************************************************************************************!*\
  54179. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ArrayIndexOutOfBoundsException.js ***!
  54180. \**************************************************************************************************/
  54181. /*! no static exports found */
  54182. /***/ (function(module, exports, __webpack_require__) {
  54183. "use strict";
  54184. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  54185. Object.defineProperty(exports, "__esModule", {
  54186. value: true
  54187. });
  54188. exports.default = void 0;
  54189. var _IndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ./IndexOutOfBoundsException */ 317));
  54190. var __extends = void 0 && (void 0).__extends || function () {
  54191. var _extendStatics = function extendStatics(d, b) {
  54192. _extendStatics = Object.setPrototypeOf || {
  54193. __proto__: []
  54194. } instanceof Array && function (d, b) {
  54195. d.__proto__ = b;
  54196. } || function (d, b) {
  54197. for (var p in b) {
  54198. if (b.hasOwnProperty(p)) d[p] = b[p];
  54199. }
  54200. };
  54201. return _extendStatics(d, b);
  54202. };
  54203. return function (d, b) {
  54204. _extendStatics(d, b);
  54205. function __() {
  54206. this.constructor = d;
  54207. }
  54208. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  54209. };
  54210. }();
  54211. /**
  54212. * Custom Error class of type Exception.
  54213. */
  54214. var ArrayIndexOutOfBoundsException = /** @class */function (_super) {
  54215. __extends(ArrayIndexOutOfBoundsException, _super);
  54216. function ArrayIndexOutOfBoundsException(index, message) {
  54217. if (index === void 0) {
  54218. index = undefined;
  54219. }
  54220. if (message === void 0) {
  54221. message = undefined;
  54222. }
  54223. var _this = _super.call(this, message) || this;
  54224. _this.index = index;
  54225. _this.message = message;
  54226. return _this;
  54227. }
  54228. ArrayIndexOutOfBoundsException.kind = 'ArrayIndexOutOfBoundsException';
  54229. return ArrayIndexOutOfBoundsException;
  54230. }(_IndexOutOfBoundsException.default);
  54231. var _default = ArrayIndexOutOfBoundsException;
  54232. exports.default = _default;
  54233. /***/ }),
  54234. /* 317 */
  54235. /*!*********************************************************************************************!*\
  54236. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/IndexOutOfBoundsException.js ***!
  54237. \*********************************************************************************************/
  54238. /*! no static exports found */
  54239. /***/ (function(module, exports, __webpack_require__) {
  54240. "use strict";
  54241. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  54242. Object.defineProperty(exports, "__esModule", {
  54243. value: true
  54244. });
  54245. exports.default = void 0;
  54246. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  54247. var __extends = void 0 && (void 0).__extends || function () {
  54248. var _extendStatics = function extendStatics(d, b) {
  54249. _extendStatics = Object.setPrototypeOf || {
  54250. __proto__: []
  54251. } instanceof Array && function (d, b) {
  54252. d.__proto__ = b;
  54253. } || function (d, b) {
  54254. for (var p in b) {
  54255. if (b.hasOwnProperty(p)) d[p] = b[p];
  54256. }
  54257. };
  54258. return _extendStatics(d, b);
  54259. };
  54260. return function (d, b) {
  54261. _extendStatics(d, b);
  54262. function __() {
  54263. this.constructor = d;
  54264. }
  54265. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  54266. };
  54267. }();
  54268. /**
  54269. * Custom Error class of type Exception.
  54270. */
  54271. var IndexOutOfBoundsException = /** @class */function (_super) {
  54272. __extends(IndexOutOfBoundsException, _super);
  54273. function IndexOutOfBoundsException() {
  54274. return _super !== null && _super.apply(this, arguments) || this;
  54275. }
  54276. IndexOutOfBoundsException.kind = 'IndexOutOfBoundsException';
  54277. return IndexOutOfBoundsException;
  54278. }(_Exception.default);
  54279. var _default = IndexOutOfBoundsException;
  54280. exports.default = _default;
  54281. /***/ }),
  54282. /* 318 */
  54283. /*!********************************************************************************!*\
  54284. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Integer.js ***!
  54285. \********************************************************************************/
  54286. /*! no static exports found */
  54287. /***/ (function(module, exports, __webpack_require__) {
  54288. "use strict";
  54289. Object.defineProperty(exports, "__esModule", {
  54290. value: true
  54291. });
  54292. exports.default = void 0;
  54293. /**
  54294. * Ponyfill for Java's Integer class.
  54295. */
  54296. var Integer = /** @class */function () {
  54297. function Integer() {}
  54298. Integer.numberOfTrailingZeros = function (i) {
  54299. var y;
  54300. if (i === 0) return 32;
  54301. var n = 31;
  54302. y = i << 16;
  54303. if (y !== 0) {
  54304. n -= 16;
  54305. i = y;
  54306. }
  54307. y = i << 8;
  54308. if (y !== 0) {
  54309. n -= 8;
  54310. i = y;
  54311. }
  54312. y = i << 4;
  54313. if (y !== 0) {
  54314. n -= 4;
  54315. i = y;
  54316. }
  54317. y = i << 2;
  54318. if (y !== 0) {
  54319. n -= 2;
  54320. i = y;
  54321. }
  54322. return n - (i << 1 >>> 31);
  54323. };
  54324. Integer.numberOfLeadingZeros = function (i) {
  54325. // HD, Figure 5-6
  54326. if (i === 0) {
  54327. return 32;
  54328. }
  54329. var n = 1;
  54330. if (i >>> 16 === 0) {
  54331. n += 16;
  54332. i <<= 16;
  54333. }
  54334. if (i >>> 24 === 0) {
  54335. n += 8;
  54336. i <<= 8;
  54337. }
  54338. if (i >>> 28 === 0) {
  54339. n += 4;
  54340. i <<= 4;
  54341. }
  54342. if (i >>> 30 === 0) {
  54343. n += 2;
  54344. i <<= 2;
  54345. }
  54346. n -= i >>> 31;
  54347. return n;
  54348. };
  54349. Integer.toHexString = function (i) {
  54350. return i.toString(16);
  54351. };
  54352. Integer.toBinaryString = function (intNumber) {
  54353. return String(parseInt(String(intNumber), 2));
  54354. };
  54355. // Returns the number of one-bits in the two's complement binary representation of the specified int value. This function is sometimes referred to as the population count.
  54356. // Returns:
  54357. // the number of one-bits in the two's complement binary representation of the specified int value.
  54358. Integer.bitCount = function (i) {
  54359. // HD, Figure 5-2
  54360. i = i - (i >>> 1 & 0x55555555);
  54361. i = (i & 0x33333333) + (i >>> 2 & 0x33333333);
  54362. i = i + (i >>> 4) & 0x0f0f0f0f;
  54363. i = i + (i >>> 8);
  54364. i = i + (i >>> 16);
  54365. return i & 0x3f;
  54366. };
  54367. Integer.truncDivision = function (dividend, divisor) {
  54368. return Math.trunc(dividend / divisor);
  54369. };
  54370. /**
  54371. * Converts A string to an integer.
  54372. * @param s A string to convert into a number.
  54373. * @param radix A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
  54374. */
  54375. Integer.parseInt = function (num, radix) {
  54376. if (radix === void 0) {
  54377. radix = undefined;
  54378. }
  54379. return parseInt(num, radix);
  54380. };
  54381. Integer.MIN_VALUE_32_BITS = -2147483648;
  54382. Integer.MAX_VALUE = Number.MAX_SAFE_INTEGER;
  54383. return Integer;
  54384. }();
  54385. var _default = Integer;
  54386. exports.default = _default;
  54387. /***/ }),
  54388. /* 319 */
  54389. /*!************************************************************************************!*\
  54390. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/BitMatrix.js ***!
  54391. \************************************************************************************/
  54392. /*! no static exports found */
  54393. /***/ (function(module, exports, __webpack_require__) {
  54394. "use strict";
  54395. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  54396. Object.defineProperty(exports, "__esModule", {
  54397. value: true
  54398. });
  54399. exports.default = void 0;
  54400. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ./BitArray */ 313));
  54401. var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
  54402. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../util/Arrays */ 314));
  54403. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
  54404. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  54405. /*
  54406. * Copyright 2007 ZXing authors
  54407. *
  54408. * Licensed under the Apache License, Version 2.0 (the "License");
  54409. * you may not use this file except in compliance with the License.
  54410. * You may obtain a copy of the License at
  54411. *
  54412. * http://www.apache.org/licenses/LICENSE-2.0
  54413. *
  54414. * Unless required by applicable law or agreed to in writing, software
  54415. * distributed under the License is distributed on an "AS IS" BASIS,
  54416. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  54417. * See the License for the specific language governing permissions and
  54418. * limitations under the License.
  54419. */
  54420. /*namespace com.google.zxing.common {*/
  54421. /*import java.util.Arrays;*/
  54422. /**
  54423. * <p>Represents a 2D matrix of bits. In function arguments below, and throughout the common
  54424. * module, x is the column position, and y is the row position. The ordering is always x, y.
  54425. * The origin is at the top-left.</p>
  54426. *
  54427. * <p>Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins
  54428. * with a new int. This is done intentionally so that we can copy out a row into a BitArray very
  54429. * efficiently.</p>
  54430. *
  54431. * <p>The ordering of bits is row-major. Within each int, the least significant bits are used first,
  54432. * meaning they represent lower x values. This is compatible with BitArray's implementation.</p>
  54433. *
  54434. * @author Sean Owen
  54435. * @author dswitkin@google.com (Daniel Switkin)
  54436. */
  54437. var BitMatrix /*implements Cloneable*/ = /** @class */function () {
  54438. /**
  54439. * Creates an empty square {@link BitMatrix}.
  54440. *
  54441. * @param dimension height and width
  54442. */
  54443. // public constructor(dimension: number /*int*/) {
  54444. // this(dimension, dimension)
  54445. // }
  54446. /**
  54447. * Creates an empty {@link BitMatrix}.
  54448. *
  54449. * @param width bit matrix width
  54450. * @param height bit matrix height
  54451. */
  54452. // public constructor(width: number /*int*/, height: number /*int*/) {
  54453. // if (width < 1 || height < 1) {
  54454. // throw new IllegalArgumentException("Both dimensions must be greater than 0")
  54455. // }
  54456. // this.width = width
  54457. // this.height = height
  54458. // this.rowSize = (width + 31) / 32
  54459. // bits = new int[rowSize * height];
  54460. // }
  54461. function BitMatrix(width /*int*/, height /*int*/, rowSize /*int*/, bits) {
  54462. this.width = width;
  54463. this.height = height;
  54464. this.rowSize = rowSize;
  54465. this.bits = bits;
  54466. if (undefined === height || null === height) {
  54467. height = width;
  54468. }
  54469. this.height = height;
  54470. if (width < 1 || height < 1) {
  54471. throw new _IllegalArgumentException.default('Both dimensions must be greater than 0');
  54472. }
  54473. if (undefined === rowSize || null === rowSize) {
  54474. rowSize = Math.floor((width + 31) / 32);
  54475. }
  54476. this.rowSize = rowSize;
  54477. if (undefined === bits || null === bits) {
  54478. this.bits = new Int32Array(this.rowSize * this.height);
  54479. }
  54480. }
  54481. /**
  54482. * Interprets a 2D array of booleans as a {@link BitMatrix}, where "true" means an "on" bit.
  54483. *
  54484. * @function parse
  54485. * @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows
  54486. * @return {@link BitMatrix} representation of image
  54487. */
  54488. BitMatrix.parseFromBooleanArray = function (image) {
  54489. var height = image.length;
  54490. var width = image[0].length;
  54491. var bits = new BitMatrix(width, height);
  54492. for (var i = 0; i < height; i++) {
  54493. var imageI = image[i];
  54494. for (var j = 0; j < width; j++) {
  54495. if (imageI[j]) {
  54496. bits.set(j, i);
  54497. }
  54498. }
  54499. }
  54500. return bits;
  54501. };
  54502. /**
  54503. *
  54504. * @function parse
  54505. * @param stringRepresentation
  54506. * @param setString
  54507. * @param unsetString
  54508. */
  54509. BitMatrix.parseFromString = function (stringRepresentation, setString, unsetString) {
  54510. if (stringRepresentation === null) {
  54511. throw new _IllegalArgumentException.default('stringRepresentation cannot be null');
  54512. }
  54513. var bits = new Array(stringRepresentation.length);
  54514. var bitsPos = 0;
  54515. var rowStartPos = 0;
  54516. var rowLength = -1;
  54517. var nRows = 0;
  54518. var pos = 0;
  54519. while (pos < stringRepresentation.length) {
  54520. if (stringRepresentation.charAt(pos) === '\n' || stringRepresentation.charAt(pos) === '\r') {
  54521. if (bitsPos > rowStartPos) {
  54522. if (rowLength === -1) {
  54523. rowLength = bitsPos - rowStartPos;
  54524. } else if (bitsPos - rowStartPos !== rowLength) {
  54525. throw new _IllegalArgumentException.default('row lengths do not match');
  54526. }
  54527. rowStartPos = bitsPos;
  54528. nRows++;
  54529. }
  54530. pos++;
  54531. } else if (stringRepresentation.substring(pos, pos + setString.length) === setString) {
  54532. pos += setString.length;
  54533. bits[bitsPos] = true;
  54534. bitsPos++;
  54535. } else if (stringRepresentation.substring(pos, pos + unsetString.length) === unsetString) {
  54536. pos += unsetString.length;
  54537. bits[bitsPos] = false;
  54538. bitsPos++;
  54539. } else {
  54540. throw new _IllegalArgumentException.default('illegal character encountered: ' + stringRepresentation.substring(pos));
  54541. }
  54542. }
  54543. // no EOL at end?
  54544. if (bitsPos > rowStartPos) {
  54545. if (rowLength === -1) {
  54546. rowLength = bitsPos - rowStartPos;
  54547. } else if (bitsPos - rowStartPos !== rowLength) {
  54548. throw new _IllegalArgumentException.default('row lengths do not match');
  54549. }
  54550. nRows++;
  54551. }
  54552. var matrix = new BitMatrix(rowLength, nRows);
  54553. for (var i = 0; i < bitsPos; i++) {
  54554. if (bits[i]) {
  54555. matrix.set(Math.floor(i % rowLength), Math.floor(i / rowLength));
  54556. }
  54557. }
  54558. return matrix;
  54559. };
  54560. /**
  54561. * <p>Gets the requested bit, where true means black.</p>
  54562. *
  54563. * @param x The horizontal component (i.e. which column)
  54564. * @param y The vertical component (i.e. which row)
  54565. * @return value of given bit in matrix
  54566. */
  54567. BitMatrix.prototype.get = function (x /*int*/, y /*int*/) {
  54568. var offset = y * this.rowSize + Math.floor(x / 32);
  54569. return (this.bits[offset] >>> (x & 0x1f) & 1) !== 0;
  54570. };
  54571. /**
  54572. * <p>Sets the given bit to true.</p>
  54573. *
  54574. * @param x The horizontal component (i.e. which column)
  54575. * @param y The vertical component (i.e. which row)
  54576. */
  54577. BitMatrix.prototype.set = function (x /*int*/, y /*int*/) {
  54578. var offset = y * this.rowSize + Math.floor(x / 32);
  54579. this.bits[offset] |= 1 << (x & 0x1f) & 0xFFFFFFFF;
  54580. };
  54581. BitMatrix.prototype.unset = function (x /*int*/, y /*int*/) {
  54582. var offset = y * this.rowSize + Math.floor(x / 32);
  54583. this.bits[offset] &= ~(1 << (x & 0x1f) & 0xFFFFFFFF);
  54584. };
  54585. /**
  54586. * <p>Flips the given bit.</p>
  54587. *
  54588. * @param x The horizontal component (i.e. which column)
  54589. * @param y The vertical component (i.e. which row)
  54590. */
  54591. BitMatrix.prototype.flip = function (x /*int*/, y /*int*/) {
  54592. var offset = y * this.rowSize + Math.floor(x / 32);
  54593. this.bits[offset] ^= 1 << (x & 0x1f) & 0xFFFFFFFF;
  54594. };
  54595. /**
  54596. * Exclusive-or (XOR): Flip the bit in this {@code BitMatrix} if the corresponding
  54597. * mask bit is set.
  54598. *
  54599. * @param mask XOR mask
  54600. */
  54601. BitMatrix.prototype.xor = function (mask) {
  54602. if (this.width !== mask.getWidth() || this.height !== mask.getHeight() || this.rowSize !== mask.getRowSize()) {
  54603. throw new _IllegalArgumentException.default('input matrix dimensions do not match');
  54604. }
  54605. var rowArray = new _BitArray.default(Math.floor(this.width / 32) + 1);
  54606. var rowSize = this.rowSize;
  54607. var bits = this.bits;
  54608. for (var y = 0, height = this.height; y < height; y++) {
  54609. var offset = y * rowSize;
  54610. var row = mask.getRow(y, rowArray).getBitArray();
  54611. for (var x = 0; x < rowSize; x++) {
  54612. bits[offset + x] ^= row[x];
  54613. }
  54614. }
  54615. };
  54616. /**
  54617. * Clears all bits (sets to false).
  54618. */
  54619. BitMatrix.prototype.clear = function () {
  54620. var bits = this.bits;
  54621. var max = bits.length;
  54622. for (var i = 0; i < max; i++) {
  54623. bits[i] = 0;
  54624. }
  54625. };
  54626. /**
  54627. * <p>Sets a square region of the bit matrix to true.</p>
  54628. *
  54629. * @param left The horizontal position to begin at (inclusive)
  54630. * @param top The vertical position to begin at (inclusive)
  54631. * @param width The width of the region
  54632. * @param height The height of the region
  54633. */
  54634. BitMatrix.prototype.setRegion = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  54635. if (top < 0 || left < 0) {
  54636. throw new _IllegalArgumentException.default('Left and top must be nonnegative');
  54637. }
  54638. if (height < 1 || width < 1) {
  54639. throw new _IllegalArgumentException.default('Height and width must be at least 1');
  54640. }
  54641. var right = left + width;
  54642. var bottom = top + height;
  54643. if (bottom > this.height || right > this.width) {
  54644. throw new _IllegalArgumentException.default('The region must fit inside the matrix');
  54645. }
  54646. var rowSize = this.rowSize;
  54647. var bits = this.bits;
  54648. for (var y = top; y < bottom; y++) {
  54649. var offset = y * rowSize;
  54650. for (var x = left; x < right; x++) {
  54651. bits[offset + Math.floor(x / 32)] |= 1 << (x & 0x1f) & 0xFFFFFFFF;
  54652. }
  54653. }
  54654. };
  54655. /**
  54656. * A fast method to retrieve one row of data from the matrix as a BitArray.
  54657. *
  54658. * @param y The row to retrieve
  54659. * @param row An optional caller-allocated BitArray, will be allocated if null or too small
  54660. * @return The resulting BitArray - this reference should always be used even when passing
  54661. * your own row
  54662. */
  54663. BitMatrix.prototype.getRow = function (y /*int*/, row) {
  54664. if (row === null || row === undefined || row.getSize() < this.width) {
  54665. row = new _BitArray.default(this.width);
  54666. } else {
  54667. row.clear();
  54668. }
  54669. var rowSize = this.rowSize;
  54670. var bits = this.bits;
  54671. var offset = y * rowSize;
  54672. for (var x = 0; x < rowSize; x++) {
  54673. row.setBulk(x * 32, bits[offset + x]);
  54674. }
  54675. return row;
  54676. };
  54677. /**
  54678. * @param y row to set
  54679. * @param row {@link BitArray} to copy from
  54680. */
  54681. BitMatrix.prototype.setRow = function (y /*int*/, row) {
  54682. _System.default.arraycopy(row.getBitArray(), 0, this.bits, y * this.rowSize, this.rowSize);
  54683. };
  54684. /**
  54685. * Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees
  54686. */
  54687. BitMatrix.prototype.rotate180 = function () {
  54688. var width = this.getWidth();
  54689. var height = this.getHeight();
  54690. var topRow = new _BitArray.default(width);
  54691. var bottomRow = new _BitArray.default(width);
  54692. for (var i = 0, length_1 = Math.floor((height + 1) / 2); i < length_1; i++) {
  54693. topRow = this.getRow(i, topRow);
  54694. bottomRow = this.getRow(height - 1 - i, bottomRow);
  54695. topRow.reverse();
  54696. bottomRow.reverse();
  54697. this.setRow(i, bottomRow);
  54698. this.setRow(height - 1 - i, topRow);
  54699. }
  54700. };
  54701. /**
  54702. * This is useful in detecting the enclosing rectangle of a 'pure' barcode.
  54703. *
  54704. * @return {@code left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white
  54705. */
  54706. BitMatrix.prototype.getEnclosingRectangle = function () {
  54707. var width = this.width;
  54708. var height = this.height;
  54709. var rowSize = this.rowSize;
  54710. var bits = this.bits;
  54711. var left = width;
  54712. var top = height;
  54713. var right = -1;
  54714. var bottom = -1;
  54715. for (var y = 0; y < height; y++) {
  54716. for (var x32 = 0; x32 < rowSize; x32++) {
  54717. var theBits = bits[y * rowSize + x32];
  54718. if (theBits !== 0) {
  54719. if (y < top) {
  54720. top = y;
  54721. }
  54722. if (y > bottom) {
  54723. bottom = y;
  54724. }
  54725. if (x32 * 32 < left) {
  54726. var bit = 0;
  54727. while ((theBits << 31 - bit & 0xFFFFFFFF) === 0) {
  54728. bit++;
  54729. }
  54730. if (x32 * 32 + bit < left) {
  54731. left = x32 * 32 + bit;
  54732. }
  54733. }
  54734. if (x32 * 32 + 31 > right) {
  54735. var bit = 31;
  54736. while (theBits >>> bit === 0) {
  54737. bit--;
  54738. }
  54739. if (x32 * 32 + bit > right) {
  54740. right = x32 * 32 + bit;
  54741. }
  54742. }
  54743. }
  54744. }
  54745. }
  54746. if (right < left || bottom < top) {
  54747. return null;
  54748. }
  54749. return Int32Array.from([left, top, right - left + 1, bottom - top + 1]);
  54750. };
  54751. /**
  54752. * This is useful in detecting a corner of a 'pure' barcode.
  54753. *
  54754. * @return {@code x,y} coordinate of top-left-most 1 bit, or null if it is all white
  54755. */
  54756. BitMatrix.prototype.getTopLeftOnBit = function () {
  54757. var rowSize = this.rowSize;
  54758. var bits = this.bits;
  54759. var bitsOffset = 0;
  54760. while (bitsOffset < bits.length && bits[bitsOffset] === 0) {
  54761. bitsOffset++;
  54762. }
  54763. if (bitsOffset === bits.length) {
  54764. return null;
  54765. }
  54766. var y = bitsOffset / rowSize;
  54767. var x = bitsOffset % rowSize * 32;
  54768. var theBits = bits[bitsOffset];
  54769. var bit = 0;
  54770. while ((theBits << 31 - bit & 0xFFFFFFFF) === 0) {
  54771. bit++;
  54772. }
  54773. x += bit;
  54774. return Int32Array.from([x, y]);
  54775. };
  54776. BitMatrix.prototype.getBottomRightOnBit = function () {
  54777. var rowSize = this.rowSize;
  54778. var bits = this.bits;
  54779. var bitsOffset = bits.length - 1;
  54780. while (bitsOffset >= 0 && bits[bitsOffset] === 0) {
  54781. bitsOffset--;
  54782. }
  54783. if (bitsOffset < 0) {
  54784. return null;
  54785. }
  54786. var y = Math.floor(bitsOffset / rowSize);
  54787. var x = Math.floor(bitsOffset % rowSize) * 32;
  54788. var theBits = bits[bitsOffset];
  54789. var bit = 31;
  54790. while (theBits >>> bit === 0) {
  54791. bit--;
  54792. }
  54793. x += bit;
  54794. return Int32Array.from([x, y]);
  54795. };
  54796. /**
  54797. * @return The width of the matrix
  54798. */
  54799. BitMatrix.prototype.getWidth = function () {
  54800. return this.width;
  54801. };
  54802. /**
  54803. * @return The height of the matrix
  54804. */
  54805. BitMatrix.prototype.getHeight = function () {
  54806. return this.height;
  54807. };
  54808. /**
  54809. * @return The row size of the matrix
  54810. */
  54811. BitMatrix.prototype.getRowSize = function () {
  54812. return this.rowSize;
  54813. };
  54814. /*@Override*/
  54815. BitMatrix.prototype.equals = function (o) {
  54816. if (!(o instanceof BitMatrix)) {
  54817. return false;
  54818. }
  54819. var other = o;
  54820. return this.width === other.width && this.height === other.height && this.rowSize === other.rowSize && _Arrays.default.equals(this.bits, other.bits);
  54821. };
  54822. /*@Override*/
  54823. BitMatrix.prototype.hashCode = function () {
  54824. var hash = this.width;
  54825. hash = 31 * hash + this.width;
  54826. hash = 31 * hash + this.height;
  54827. hash = 31 * hash + this.rowSize;
  54828. hash = 31 * hash + _Arrays.default.hashCode(this.bits);
  54829. return hash;
  54830. };
  54831. /**
  54832. * @return string representation using "X" for set and " " for unset bits
  54833. */
  54834. /*@Override*/
  54835. // public toString(): string {
  54836. // return toString(": "X, " ")
  54837. // }
  54838. /**
  54839. * @param setString representation of a set bit
  54840. * @param unsetString representation of an unset bit
  54841. * @return string representation of entire matrix utilizing given strings
  54842. */
  54843. // public toString(setString: string = "X ", unsetString: string = " "): string {
  54844. // return this.buildToString(setString, unsetString, "\n")
  54845. // }
  54846. /**
  54847. * @param setString representation of a set bit
  54848. * @param unsetString representation of an unset bit
  54849. * @param lineSeparator newline character in string representation
  54850. * @return string representation of entire matrix utilizing given strings and line separator
  54851. * @deprecated call {@link #toString(String,String)} only, which uses \n line separator always
  54852. */
  54853. // @Deprecated
  54854. BitMatrix.prototype.toString = function (setString, unsetString, lineSeparator) {
  54855. if (setString === void 0) {
  54856. setString = 'X ';
  54857. }
  54858. if (unsetString === void 0) {
  54859. unsetString = ' ';
  54860. }
  54861. if (lineSeparator === void 0) {
  54862. lineSeparator = '\n';
  54863. }
  54864. return this.buildToString(setString, unsetString, lineSeparator);
  54865. };
  54866. BitMatrix.prototype.buildToString = function (setString, unsetString, lineSeparator) {
  54867. var result = new _StringBuilder.default();
  54868. // result.append(lineSeparator);
  54869. for (var y = 0, height = this.height; y < height; y++) {
  54870. for (var x = 0, width = this.width; x < width; x++) {
  54871. result.append(this.get(x, y) ? setString : unsetString);
  54872. }
  54873. result.append(lineSeparator);
  54874. }
  54875. return result.toString();
  54876. };
  54877. /*@Override*/
  54878. BitMatrix.prototype.clone = function () {
  54879. return new BitMatrix(this.width, this.height, this.rowSize, this.bits.slice());
  54880. };
  54881. return BitMatrix;
  54882. }();
  54883. var _default = BitMatrix;
  54884. exports.default = _default;
  54885. /***/ }),
  54886. /* 320 */
  54887. /*!**************************************************************************************!*\
  54888. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/StringBuilder.js ***!
  54889. \**************************************************************************************/
  54890. /*! no static exports found */
  54891. /***/ (function(module, exports, __webpack_require__) {
  54892. "use strict";
  54893. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  54894. Object.defineProperty(exports, "__esModule", {
  54895. value: true
  54896. });
  54897. exports.default = void 0;
  54898. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../common/StringUtils */ 321));
  54899. var StringBuilder = /** @class */function () {
  54900. function StringBuilder(value) {
  54901. if (value === void 0) {
  54902. value = '';
  54903. }
  54904. this.value = value;
  54905. }
  54906. StringBuilder.prototype.enableDecoding = function (encoding) {
  54907. this.encoding = encoding;
  54908. return this;
  54909. };
  54910. StringBuilder.prototype.append = function (s) {
  54911. if (typeof s === 'string') {
  54912. this.value += s.toString();
  54913. } else if (this.encoding) {
  54914. // use passed format (fromCharCode will return UTF8 encoding)
  54915. this.value += _StringUtils.default.castAsNonUtf8Char(s, this.encoding);
  54916. } else {
  54917. // correctly converts from UTF-8, but not other encodings
  54918. this.value += String.fromCharCode(s);
  54919. }
  54920. return this;
  54921. };
  54922. StringBuilder.prototype.appendChars = function (str, offset, len) {
  54923. for (var i = offset; offset < offset + len; i++) {
  54924. this.append(str[i]);
  54925. }
  54926. return this;
  54927. };
  54928. StringBuilder.prototype.length = function () {
  54929. return this.value.length;
  54930. };
  54931. StringBuilder.prototype.charAt = function (n) {
  54932. return this.value.charAt(n);
  54933. };
  54934. StringBuilder.prototype.deleteCharAt = function (n) {
  54935. this.value = this.value.substr(0, n) + this.value.substring(n + 1);
  54936. };
  54937. StringBuilder.prototype.setCharAt = function (n, c) {
  54938. this.value = this.value.substr(0, n) + c + this.value.substr(n + 1);
  54939. };
  54940. StringBuilder.prototype.substring = function (start, end) {
  54941. return this.value.substring(start, end);
  54942. };
  54943. /**
  54944. * @note helper method for RSS Expanded
  54945. */
  54946. StringBuilder.prototype.setLengthToZero = function () {
  54947. this.value = '';
  54948. };
  54949. StringBuilder.prototype.toString = function () {
  54950. return this.value;
  54951. };
  54952. StringBuilder.prototype.insert = function (n, c) {
  54953. this.value = this.value.substring(0, n) + c + this.value.substring(n);
  54954. };
  54955. return StringBuilder;
  54956. }();
  54957. var _default = StringBuilder;
  54958. exports.default = _default;
  54959. /***/ }),
  54960. /* 321 */
  54961. /*!**************************************************************************************!*\
  54962. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/StringUtils.js ***!
  54963. \**************************************************************************************/
  54964. /*! no static exports found */
  54965. /***/ (function(module, exports, __webpack_require__) {
  54966. "use strict";
  54967. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  54968. Object.defineProperty(exports, "__esModule", {
  54969. value: true
  54970. });
  54971. exports.default = void 0;
  54972. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  54973. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  54974. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ./CharacterSetECI */ 323));
  54975. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../util/StringEncoding */ 325));
  54976. /*
  54977. * Copyright (C) 2010 ZXing authors
  54978. *
  54979. * Licensed under the Apache License, Version 2.0 (the "License");
  54980. * you may not use this file except in compliance with the License.
  54981. * You may obtain a copy of the License at
  54982. *
  54983. * http://www.apache.org/licenses/LICENSE-2.0
  54984. *
  54985. * Unless required by applicable law or agreed to in writing, software
  54986. * distributed under the License is distributed on an "AS IS" BASIS,
  54987. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  54988. * See the License for the specific language governing permissions and
  54989. * limitations under the License.
  54990. */
  54991. /*namespace com.google.zxing.common {*/
  54992. /*import java.nio.charset.Charset;*/
  54993. /*import java.util.Map;*/
  54994. /**
  54995. * Common string-related functions.
  54996. *
  54997. * @author Sean Owen
  54998. * @author Alex Dupre
  54999. */
  55000. var StringUtils = /** @class */function () {
  55001. function StringUtils() {}
  55002. // SHIFT_JIS.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING) ||
  55003. // EUC_JP.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING);
  55004. StringUtils.castAsNonUtf8Char = function (code, encoding) {
  55005. if (encoding === void 0) {
  55006. encoding = null;
  55007. }
  55008. // ISO 8859-1 is the Java default as UTF-8 is JavaScripts
  55009. // you can see this method as a Java version of String.fromCharCode
  55010. var e = encoding ? encoding.getName() : this.ISO88591;
  55011. // use passed format (fromCharCode will return UTF8 encoding)
  55012. return _StringEncoding.default.decode(new Uint8Array([code]), e);
  55013. };
  55014. /**
  55015. * @param bytes bytes encoding a string, whose encoding should be guessed
  55016. * @param hints decode hints if applicable
  55017. * @return name of guessed encoding; at the moment will only guess one of:
  55018. * {@link #SHIFT_JIS}, {@link #UTF8}, {@link #ISO88591}, or the platform
  55019. * default encoding if none of these can possibly be correct
  55020. */
  55021. StringUtils.guessEncoding = function (bytes, hints) {
  55022. if (hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.CHARACTER_SET)) {
  55023. return hints.get(_DecodeHintType.default.CHARACTER_SET).toString();
  55024. }
  55025. // For now, merely tries to distinguish ISO-8859-1, UTF-8 and Shift_JIS,
  55026. // which should be by far the most common encodings.
  55027. var length = bytes.length;
  55028. var canBeISO88591 = true;
  55029. var canBeShiftJIS = true;
  55030. var canBeUTF8 = true;
  55031. var utf8BytesLeft = 0;
  55032. // int utf8LowChars = 0
  55033. var utf2BytesChars = 0;
  55034. var utf3BytesChars = 0;
  55035. var utf4BytesChars = 0;
  55036. var sjisBytesLeft = 0;
  55037. // int sjisLowChars = 0
  55038. var sjisKatakanaChars = 0;
  55039. // int sjisDoubleBytesChars = 0
  55040. var sjisCurKatakanaWordLength = 0;
  55041. var sjisCurDoubleBytesWordLength = 0;
  55042. var sjisMaxKatakanaWordLength = 0;
  55043. var sjisMaxDoubleBytesWordLength = 0;
  55044. // int isoLowChars = 0
  55045. // int isoHighChars = 0
  55046. var isoHighOther = 0;
  55047. var utf8bom = bytes.length > 3 && bytes[0] === /*(byte) */0xEF && bytes[1] === /*(byte) */0xBB && bytes[2] === /*(byte) */0xBF;
  55048. for (var i = 0; i < length && (canBeISO88591 || canBeShiftJIS || canBeUTF8); i++) {
  55049. var value = bytes[i] & 0xFF;
  55050. // UTF-8 stuff
  55051. if (canBeUTF8) {
  55052. if (utf8BytesLeft > 0) {
  55053. if ((value & 0x80) === 0) {
  55054. canBeUTF8 = false;
  55055. } else {
  55056. utf8BytesLeft--;
  55057. }
  55058. } else if ((value & 0x80) !== 0) {
  55059. if ((value & 0x40) === 0) {
  55060. canBeUTF8 = false;
  55061. } else {
  55062. utf8BytesLeft++;
  55063. if ((value & 0x20) === 0) {
  55064. utf2BytesChars++;
  55065. } else {
  55066. utf8BytesLeft++;
  55067. if ((value & 0x10) === 0) {
  55068. utf3BytesChars++;
  55069. } else {
  55070. utf8BytesLeft++;
  55071. if ((value & 0x08) === 0) {
  55072. utf4BytesChars++;
  55073. } else {
  55074. canBeUTF8 = false;
  55075. }
  55076. }
  55077. }
  55078. }
  55079. } // else {
  55080. // utf8LowChars++
  55081. // }
  55082. }
  55083. // ISO-8859-1 stuff
  55084. if (canBeISO88591) {
  55085. if (value > 0x7F && value < 0xA0) {
  55086. canBeISO88591 = false;
  55087. } else if (value > 0x9F) {
  55088. if (value < 0xC0 || value === 0xD7 || value === 0xF7) {
  55089. isoHighOther++;
  55090. } // else {
  55091. // isoHighChars++
  55092. // }
  55093. } // else {
  55094. // isoLowChars++
  55095. // }
  55096. }
  55097. // Shift_JIS stuff
  55098. if (canBeShiftJIS) {
  55099. if (sjisBytesLeft > 0) {
  55100. if (value < 0x40 || value === 0x7F || value > 0xFC) {
  55101. canBeShiftJIS = false;
  55102. } else {
  55103. sjisBytesLeft--;
  55104. }
  55105. } else if (value === 0x80 || value === 0xA0 || value > 0xEF) {
  55106. canBeShiftJIS = false;
  55107. } else if (value > 0xA0 && value < 0xE0) {
  55108. sjisKatakanaChars++;
  55109. sjisCurDoubleBytesWordLength = 0;
  55110. sjisCurKatakanaWordLength++;
  55111. if (sjisCurKatakanaWordLength > sjisMaxKatakanaWordLength) {
  55112. sjisMaxKatakanaWordLength = sjisCurKatakanaWordLength;
  55113. }
  55114. } else if (value > 0x7F) {
  55115. sjisBytesLeft++;
  55116. // sjisDoubleBytesChars++
  55117. sjisCurKatakanaWordLength = 0;
  55118. sjisCurDoubleBytesWordLength++;
  55119. if (sjisCurDoubleBytesWordLength > sjisMaxDoubleBytesWordLength) {
  55120. sjisMaxDoubleBytesWordLength = sjisCurDoubleBytesWordLength;
  55121. }
  55122. } else {
  55123. // sjisLowChars++
  55124. sjisCurKatakanaWordLength = 0;
  55125. sjisCurDoubleBytesWordLength = 0;
  55126. }
  55127. }
  55128. }
  55129. if (canBeUTF8 && utf8BytesLeft > 0) {
  55130. canBeUTF8 = false;
  55131. }
  55132. if (canBeShiftJIS && sjisBytesLeft > 0) {
  55133. canBeShiftJIS = false;
  55134. }
  55135. // Easy -- if there is BOM or at least 1 valid not-single byte character (and no evidence it can't be UTF-8), done
  55136. if (canBeUTF8 && (utf8bom || utf2BytesChars + utf3BytesChars + utf4BytesChars > 0)) {
  55137. return StringUtils.UTF8;
  55138. }
  55139. // Easy -- if assuming Shift_JIS or at least 3 valid consecutive not-ascii characters (and no evidence it can't be), done
  55140. if (canBeShiftJIS && (StringUtils.ASSUME_SHIFT_JIS || sjisMaxKatakanaWordLength >= 3 || sjisMaxDoubleBytesWordLength >= 3)) {
  55141. return StringUtils.SHIFT_JIS;
  55142. }
  55143. // Distinguishing Shift_JIS and ISO-8859-1 can be a little tough for short words. The crude heuristic is:
  55144. // - If we saw
  55145. // - only two consecutive katakana chars in the whole text, or
  55146. // - at least 10% of bytes that could be "upper" not-alphanumeric Latin1,
  55147. // - then we conclude Shift_JIS, else ISO-8859-1
  55148. if (canBeISO88591 && canBeShiftJIS) {
  55149. return sjisMaxKatakanaWordLength === 2 && sjisKatakanaChars === 2 || isoHighOther * 10 >= length ? StringUtils.SHIFT_JIS : StringUtils.ISO88591;
  55150. }
  55151. // Otherwise, try in order ISO-8859-1, Shift JIS, UTF-8 and fall back to default platform encoding
  55152. if (canBeISO88591) {
  55153. return StringUtils.ISO88591;
  55154. }
  55155. if (canBeShiftJIS) {
  55156. return StringUtils.SHIFT_JIS;
  55157. }
  55158. if (canBeUTF8) {
  55159. return StringUtils.UTF8;
  55160. }
  55161. // Otherwise, we take a wild guess with platform encoding
  55162. return StringUtils.PLATFORM_DEFAULT_ENCODING;
  55163. };
  55164. /**
  55165. *
  55166. * @see https://stackoverflow.com/a/13439711/4367683
  55167. *
  55168. * @param append The new string to append.
  55169. * @param args Argumets values to be formated.
  55170. */
  55171. StringUtils.format = function (append) {
  55172. var args = [];
  55173. for (var _i = 1; _i < arguments.length; _i++) {
  55174. args[_i - 1] = arguments[_i];
  55175. }
  55176. var i = -1;
  55177. function callback(exp, p0, p1, p2, p3, p4) {
  55178. if (exp === '%%') return '%';
  55179. if (args[++i] === undefined) return undefined;
  55180. exp = p2 ? parseInt(p2.substr(1)) : undefined;
  55181. var base = p3 ? parseInt(p3.substr(1)) : undefined;
  55182. var val;
  55183. switch (p4) {
  55184. case 's':
  55185. val = args[i];
  55186. break;
  55187. case 'c':
  55188. val = args[i][0];
  55189. break;
  55190. case 'f':
  55191. val = parseFloat(args[i]).toFixed(exp);
  55192. break;
  55193. case 'p':
  55194. val = parseFloat(args[i]).toPrecision(exp);
  55195. break;
  55196. case 'e':
  55197. val = parseFloat(args[i]).toExponential(exp);
  55198. break;
  55199. case 'x':
  55200. val = parseInt(args[i]).toString(base ? base : 16);
  55201. break;
  55202. case 'd':
  55203. val = parseFloat(parseInt(args[i], base ? base : 10).toPrecision(exp)).toFixed(0);
  55204. break;
  55205. }
  55206. val = (0, _typeof2.default)(val) === 'object' ? JSON.stringify(val) : (+val).toString(base);
  55207. var size = parseInt(p1); /* padding size */
  55208. var ch = p1 && p1[0] + '' === '0' ? '0' : ' '; /* isnull? */
  55209. while (val.length < size) {
  55210. val = p0 !== undefined ? val + ch : ch + val;
  55211. } /* isminus? */
  55212. return val;
  55213. }
  55214. var regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
  55215. return append.replace(regex, callback);
  55216. };
  55217. /**
  55218. *
  55219. */
  55220. StringUtils.getBytes = function (str, encoding) {
  55221. return _StringEncoding.default.encode(str, encoding);
  55222. };
  55223. /**
  55224. * Returns the charcode at the specified index or at index zero.
  55225. */
  55226. StringUtils.getCharCode = function (str, index) {
  55227. if (index === void 0) {
  55228. index = 0;
  55229. }
  55230. return str.charCodeAt(index);
  55231. };
  55232. /**
  55233. * Returns char for given charcode
  55234. */
  55235. StringUtils.getCharAt = function (charCode) {
  55236. return String.fromCharCode(charCode);
  55237. };
  55238. StringUtils.SHIFT_JIS = _CharacterSetECI.default.SJIS.getName(); // "SJIS"
  55239. StringUtils.GB2312 = 'GB2312';
  55240. StringUtils.ISO88591 = _CharacterSetECI.default.ISO8859_1.getName(); // "ISO8859_1"
  55241. StringUtils.EUC_JP = 'EUC_JP';
  55242. StringUtils.UTF8 = _CharacterSetECI.default.UTF8.getName(); // "UTF8"
  55243. StringUtils.PLATFORM_DEFAULT_ENCODING = StringUtils.UTF8; // "UTF8"//Charset.defaultCharset().name()
  55244. StringUtils.ASSUME_SHIFT_JIS = false;
  55245. return StringUtils;
  55246. }();
  55247. var _default = StringUtils;
  55248. exports.default = _default;
  55249. /***/ }),
  55250. /* 322 */
  55251. /*!**********************************************************************************!*\
  55252. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/DecodeHintType.js ***!
  55253. \**********************************************************************************/
  55254. /*! no static exports found */
  55255. /***/ (function(module, exports, __webpack_require__) {
  55256. "use strict";
  55257. Object.defineProperty(exports, "__esModule", {
  55258. value: true
  55259. });
  55260. exports.default = void 0;
  55261. /*
  55262. * Copyright 2009 ZXing authors
  55263. *
  55264. * Licensed under the Apache License, Version 2.0 (the "License");
  55265. * you may not use this file except in compliance with the License.
  55266. * You may obtain a copy of the License at
  55267. *
  55268. * http://www.apache.org/licenses/LICENSE-2.0
  55269. *
  55270. * Unless required by applicable law or agreed to in writing, software
  55271. * distributed under the License is distributed on an "AS IS" BASIS,
  55272. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  55273. * See the License for the specific language governing permissions and
  55274. * limitations under the License.
  55275. */
  55276. /*namespace com.google.zxing {*/
  55277. /**
  55278. * Encapsulates a type of hint that a caller may pass to a barcode reader to help it
  55279. * more quickly or accurately decode it. It is up to implementations to decide what,
  55280. * if anything, to do with the information that is supplied.
  55281. *
  55282. * @author Sean Owen
  55283. * @author dswitkin@google.com (Daniel Switkin)
  55284. * @see Reader#decode(BinaryBitmap,java.util.Map)
  55285. */
  55286. var DecodeHintType;
  55287. (function (DecodeHintType) {
  55288. /**
  55289. * Unspecified, application-specific hint. Maps to an unspecified {@link Object}.
  55290. */
  55291. DecodeHintType[DecodeHintType["OTHER"] = 0] = "OTHER"; /*(Object.class)*/
  55292. /**
  55293. * Image is a pure monochrome image of a barcode. Doesn't matter what it maps to;
  55294. * use {@link Boolean#TRUE}.
  55295. */
  55296. DecodeHintType[DecodeHintType["PURE_BARCODE"] = 1] = "PURE_BARCODE"; /*(Void.class)*/
  55297. /**
  55298. * Image is known to be of one of a few possible formats.
  55299. * Maps to a {@link List} of {@link BarcodeFormat}s.
  55300. */
  55301. DecodeHintType[DecodeHintType["POSSIBLE_FORMATS"] = 2] = "POSSIBLE_FORMATS"; /*(List.class)*/
  55302. /**
  55303. * Spend more time to try to find a barcode; optimize for accuracy, not speed.
  55304. * Doesn't matter what it maps to; use {@link Boolean#TRUE}.
  55305. */
  55306. DecodeHintType[DecodeHintType["TRY_HARDER"] = 3] = "TRY_HARDER"; /*(Void.class)*/
  55307. /**
  55308. * Specifies what character encoding to use when decoding, where applicable (type String)
  55309. */
  55310. DecodeHintType[DecodeHintType["CHARACTER_SET"] = 4] = "CHARACTER_SET"; /*(String.class)*/
  55311. /**
  55312. * Allowed lengths of encoded data -- reject anything else. Maps to an {@code Int32Array}.
  55313. */
  55314. DecodeHintType[DecodeHintType["ALLOWED_LENGTHS"] = 5] = "ALLOWED_LENGTHS"; /*(Int32Array.class)*/
  55315. /**
  55316. * Assume Code 39 codes employ a check digit. Doesn't matter what it maps to;
  55317. * use {@link Boolean#TRUE}.
  55318. */
  55319. DecodeHintType[DecodeHintType["ASSUME_CODE_39_CHECK_DIGIT"] = 6] = "ASSUME_CODE_39_CHECK_DIGIT"; /*(Void.class)*/
  55320. /**
  55321. * Enable extended mode for Code 39 codes. Doesn't matter what it maps to;
  55322. * use {@link Boolean#TRUE}.
  55323. */
  55324. DecodeHintType[DecodeHintType["ENABLE_CODE_39_EXTENDED_MODE"] = 7] = "ENABLE_CODE_39_EXTENDED_MODE"; /*(Void.class)*/
  55325. /**
  55326. * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed.
  55327. * For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to;
  55328. * use {@link Boolean#TRUE}.
  55329. */
  55330. DecodeHintType[DecodeHintType["ASSUME_GS1"] = 8] = "ASSUME_GS1"; /*(Void.class)*/
  55331. /**
  55332. * If true, return the start and end digits in a Codabar barcode instead of stripping them. They
  55333. * are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them
  55334. * to not be. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
  55335. */
  55336. DecodeHintType[DecodeHintType["RETURN_CODABAR_START_END"] = 9] = "RETURN_CODABAR_START_END"; /*(Void.class)*/
  55337. /**
  55338. * The caller needs to be notified via callback when a possible {@link ResultPoint}
  55339. * is found. Maps to a {@link ResultPointCallback}.
  55340. */
  55341. DecodeHintType[DecodeHintType["NEED_RESULT_POINT_CALLBACK"] = 10] = "NEED_RESULT_POINT_CALLBACK"; /*(ResultPointCallback.class)*/
  55342. /**
  55343. * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this.
  55344. * Maps to an {@code Int32Array} of the allowed extension lengths, for example [2], [5], or [2, 5].
  55345. * If it is optional to have an extension, do not set this hint. If this is set,
  55346. * and a UPC or EAN barcode is found but an extension is not, then no result will be returned
  55347. * at all.
  55348. */
  55349. DecodeHintType[DecodeHintType["ALLOWED_EAN_EXTENSIONS"] = 11] = "ALLOWED_EAN_EXTENSIONS"; /*(Int32Array.class)*/
  55350. // End of enumeration values.
  55351. /**
  55352. * Data type the hint is expecting.
  55353. * Among the possible values the {@link Void} stands out as being used for
  55354. * hints that do not expect a value to be supplied (flag hints). Such hints
  55355. * will possibly have their value ignored, or replaced by a
  55356. * {@link Boolean#TRUE}. Hint suppliers should probably use
  55357. * {@link Boolean#TRUE} as directed by the actual hint documentation.
  55358. */
  55359. // private valueType: Class<?>
  55360. // DecodeHintType(valueType: Class<?>) {
  55361. // this.valueType = valueType
  55362. // }
  55363. // public getValueType(): Class<?> {
  55364. // return valueType
  55365. // }
  55366. })(DecodeHintType || (DecodeHintType = {}));
  55367. var _default = DecodeHintType;
  55368. exports.default = _default;
  55369. /***/ }),
  55370. /* 323 */
  55371. /*!******************************************************************************************!*\
  55372. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/CharacterSetECI.js ***!
  55373. \******************************************************************************************/
  55374. /*! no static exports found */
  55375. /***/ (function(module, exports, __webpack_require__) {
  55376. "use strict";
  55377. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  55378. Object.defineProperty(exports, "__esModule", {
  55379. value: true
  55380. });
  55381. exports.default = exports.CharacterSetValueIdentifiers = void 0;
  55382. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  55383. /*
  55384. * Copyright 2008 ZXing authors
  55385. *
  55386. * Licensed under the Apache License, Version 2.0 (the "License");
  55387. * you may not use this file except in compliance with the License.
  55388. * You may obtain a copy of the License at
  55389. *
  55390. * http://www.apache.org/licenses/LICENSE-2.0
  55391. *
  55392. * Unless required by applicable law or agreed to in writing, software
  55393. * distributed under the License is distributed on an "AS IS" BASIS,
  55394. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  55395. * See the License for the specific language governing permissions and
  55396. * limitations under the License.
  55397. */
  55398. var __values = void 0 && (void 0).__values || function (o) {
  55399. var s = typeof Symbol === "function" && Symbol.iterator,
  55400. m = s && o[s],
  55401. i = 0;
  55402. if (m) return m.call(o);
  55403. if (o && typeof o.length === "number") return {
  55404. next: function next() {
  55405. if (o && i >= o.length) o = void 0;
  55406. return {
  55407. value: o && o[i++],
  55408. done: !o
  55409. };
  55410. }
  55411. };
  55412. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  55413. };
  55414. /*namespace com.google.zxing.common {*/
  55415. /*import java.util.HashMap;*/
  55416. /*import java.util.Map;*/
  55417. var CharacterSetValueIdentifiers;
  55418. exports.CharacterSetValueIdentifiers = CharacterSetValueIdentifiers;
  55419. (function (CharacterSetValueIdentifiers) {
  55420. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp437"] = 0] = "Cp437";
  55421. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_1"] = 1] = "ISO8859_1";
  55422. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_2"] = 2] = "ISO8859_2";
  55423. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_3"] = 3] = "ISO8859_3";
  55424. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_4"] = 4] = "ISO8859_4";
  55425. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_5"] = 5] = "ISO8859_5";
  55426. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_6"] = 6] = "ISO8859_6";
  55427. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_7"] = 7] = "ISO8859_7";
  55428. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_8"] = 8] = "ISO8859_8";
  55429. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_9"] = 9] = "ISO8859_9";
  55430. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_10"] = 10] = "ISO8859_10";
  55431. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_11"] = 11] = "ISO8859_11";
  55432. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_13"] = 12] = "ISO8859_13";
  55433. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_14"] = 13] = "ISO8859_14";
  55434. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_15"] = 14] = "ISO8859_15";
  55435. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ISO8859_16"] = 15] = "ISO8859_16";
  55436. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["SJIS"] = 16] = "SJIS";
  55437. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1250"] = 17] = "Cp1250";
  55438. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1251"] = 18] = "Cp1251";
  55439. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1252"] = 19] = "Cp1252";
  55440. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Cp1256"] = 20] = "Cp1256";
  55441. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["UnicodeBigUnmarked"] = 21] = "UnicodeBigUnmarked";
  55442. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["UTF8"] = 22] = "UTF8";
  55443. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["ASCII"] = 23] = "ASCII";
  55444. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["Big5"] = 24] = "Big5";
  55445. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["GB18030"] = 25] = "GB18030";
  55446. CharacterSetValueIdentifiers[CharacterSetValueIdentifiers["EUC_KR"] = 26] = "EUC_KR";
  55447. })(CharacterSetValueIdentifiers || (exports.CharacterSetValueIdentifiers = CharacterSetValueIdentifiers = {}));
  55448. /**
  55449. * Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1
  55450. * of ISO 18004.
  55451. *
  55452. * @author Sean Owen
  55453. */
  55454. var CharacterSetECI = /** @class */function () {
  55455. function CharacterSetECI(valueIdentifier, valuesParam, name) {
  55456. var e_1, _a;
  55457. var otherEncodingNames = [];
  55458. for (var _i = 3; _i < arguments.length; _i++) {
  55459. otherEncodingNames[_i - 3] = arguments[_i];
  55460. }
  55461. this.valueIdentifier = valueIdentifier;
  55462. this.name = name;
  55463. if (typeof valuesParam === 'number') {
  55464. this.values = Int32Array.from([valuesParam]);
  55465. } else {
  55466. this.values = valuesParam;
  55467. }
  55468. this.otherEncodingNames = otherEncodingNames;
  55469. CharacterSetECI.VALUE_IDENTIFIER_TO_ECI.set(valueIdentifier, this);
  55470. CharacterSetECI.NAME_TO_ECI.set(name, this);
  55471. var values = this.values;
  55472. for (var i = 0, length_1 = values.length; i !== length_1; i++) {
  55473. var v = values[i];
  55474. CharacterSetECI.VALUES_TO_ECI.set(v, this);
  55475. }
  55476. try {
  55477. for (var otherEncodingNames_1 = __values(otherEncodingNames), otherEncodingNames_1_1 = otherEncodingNames_1.next(); !otherEncodingNames_1_1.done; otherEncodingNames_1_1 = otherEncodingNames_1.next()) {
  55478. var otherName = otherEncodingNames_1_1.value;
  55479. CharacterSetECI.NAME_TO_ECI.set(otherName, this);
  55480. }
  55481. } catch (e_1_1) {
  55482. e_1 = {
  55483. error: e_1_1
  55484. };
  55485. } finally {
  55486. try {
  55487. if (otherEncodingNames_1_1 && !otherEncodingNames_1_1.done && (_a = otherEncodingNames_1.return)) _a.call(otherEncodingNames_1);
  55488. } finally {
  55489. if (e_1) throw e_1.error;
  55490. }
  55491. }
  55492. }
  55493. // CharacterSetECI(value: number /*int*/) {
  55494. // this(new Int32Array {value})
  55495. // }
  55496. // CharacterSetECI(value: number /*int*/, String... otherEncodingNames) {
  55497. // this.values = new Int32Array {value}
  55498. // this.otherEncodingNames = otherEncodingNames
  55499. // }
  55500. // CharacterSetECI(values: Int32Array, String... otherEncodingNames) {
  55501. // this.values = values
  55502. // this.otherEncodingNames = otherEncodingNames
  55503. // }
  55504. CharacterSetECI.prototype.getValueIdentifier = function () {
  55505. return this.valueIdentifier;
  55506. };
  55507. CharacterSetECI.prototype.getName = function () {
  55508. return this.name;
  55509. };
  55510. CharacterSetECI.prototype.getValue = function () {
  55511. return this.values[0];
  55512. };
  55513. /**
  55514. * @param value character set ECI value
  55515. * @return {@code CharacterSetECI} representing ECI of given value, or null if it is legal but
  55516. * unsupported
  55517. * @throws FormatException if ECI value is invalid
  55518. */
  55519. CharacterSetECI.getCharacterSetECIByValue = function (value /*int*/) {
  55520. if (value < 0 || value >= 900) {
  55521. throw new _FormatException.default('incorect value');
  55522. }
  55523. var characterSet = CharacterSetECI.VALUES_TO_ECI.get(value);
  55524. if (undefined === characterSet) {
  55525. throw new _FormatException.default('incorect value');
  55526. }
  55527. return characterSet;
  55528. };
  55529. /**
  55530. * @param name character set ECI encoding name
  55531. * @return CharacterSetECI representing ECI for character encoding, or null if it is legal
  55532. * but unsupported
  55533. */
  55534. CharacterSetECI.getCharacterSetECIByName = function (name) {
  55535. var characterSet = CharacterSetECI.NAME_TO_ECI.get(name);
  55536. if (undefined === characterSet) {
  55537. throw new _FormatException.default('incorect value');
  55538. }
  55539. return characterSet;
  55540. };
  55541. CharacterSetECI.prototype.equals = function (o) {
  55542. if (!(o instanceof CharacterSetECI)) {
  55543. return false;
  55544. }
  55545. var other = o;
  55546. return this.getName() === other.getName();
  55547. };
  55548. CharacterSetECI.VALUE_IDENTIFIER_TO_ECI = new Map();
  55549. CharacterSetECI.VALUES_TO_ECI = new Map();
  55550. CharacterSetECI.NAME_TO_ECI = new Map();
  55551. // Enum name is a Java encoding valid for java.lang and java.io
  55552. // TYPESCRIPTPORT: changed the main label for ISO as the TextEncoder did not recognized them in the form from java
  55553. // (eg ISO8859_1 must be ISO88591 or ISO8859-1 or ISO-8859-1)
  55554. // later on: well, except 16 wich does not work with ISO885916 so used ISO-8859-1 form for default
  55555. CharacterSetECI.Cp437 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp437, Int32Array.from([0, 2]), 'Cp437');
  55556. CharacterSetECI.ISO8859_1 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_1, Int32Array.from([1, 3]), 'ISO-8859-1', 'ISO88591', 'ISO8859_1');
  55557. CharacterSetECI.ISO8859_2 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_2, 4, 'ISO-8859-2', 'ISO88592', 'ISO8859_2');
  55558. CharacterSetECI.ISO8859_3 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_3, 5, 'ISO-8859-3', 'ISO88593', 'ISO8859_3');
  55559. CharacterSetECI.ISO8859_4 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_4, 6, 'ISO-8859-4', 'ISO88594', 'ISO8859_4');
  55560. CharacterSetECI.ISO8859_5 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_5, 7, 'ISO-8859-5', 'ISO88595', 'ISO8859_5');
  55561. CharacterSetECI.ISO8859_6 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_6, 8, 'ISO-8859-6', 'ISO88596', 'ISO8859_6');
  55562. CharacterSetECI.ISO8859_7 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_7, 9, 'ISO-8859-7', 'ISO88597', 'ISO8859_7');
  55563. CharacterSetECI.ISO8859_8 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_8, 10, 'ISO-8859-8', 'ISO88598', 'ISO8859_8');
  55564. CharacterSetECI.ISO8859_9 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_9, 11, 'ISO-8859-9', 'ISO88599', 'ISO8859_9');
  55565. CharacterSetECI.ISO8859_10 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_10, 12, 'ISO-8859-10', 'ISO885910', 'ISO8859_10');
  55566. CharacterSetECI.ISO8859_11 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_11, 13, 'ISO-8859-11', 'ISO885911', 'ISO8859_11');
  55567. CharacterSetECI.ISO8859_13 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_13, 15, 'ISO-8859-13', 'ISO885913', 'ISO8859_13');
  55568. CharacterSetECI.ISO8859_14 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_14, 16, 'ISO-8859-14', 'ISO885914', 'ISO8859_14');
  55569. CharacterSetECI.ISO8859_15 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_15, 17, 'ISO-8859-15', 'ISO885915', 'ISO8859_15');
  55570. CharacterSetECI.ISO8859_16 = new CharacterSetECI(CharacterSetValueIdentifiers.ISO8859_16, 18, 'ISO-8859-16', 'ISO885916', 'ISO8859_16');
  55571. CharacterSetECI.SJIS = new CharacterSetECI(CharacterSetValueIdentifiers.SJIS, 20, 'SJIS', 'Shift_JIS');
  55572. CharacterSetECI.Cp1250 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1250, 21, 'Cp1250', 'windows-1250');
  55573. CharacterSetECI.Cp1251 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1251, 22, 'Cp1251', 'windows-1251');
  55574. CharacterSetECI.Cp1252 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1252, 23, 'Cp1252', 'windows-1252');
  55575. CharacterSetECI.Cp1256 = new CharacterSetECI(CharacterSetValueIdentifiers.Cp1256, 24, 'Cp1256', 'windows-1256');
  55576. CharacterSetECI.UnicodeBigUnmarked = new CharacterSetECI(CharacterSetValueIdentifiers.UnicodeBigUnmarked, 25, 'UnicodeBigUnmarked', 'UTF-16BE', 'UnicodeBig');
  55577. CharacterSetECI.UTF8 = new CharacterSetECI(CharacterSetValueIdentifiers.UTF8, 26, 'UTF8', 'UTF-8');
  55578. CharacterSetECI.ASCII = new CharacterSetECI(CharacterSetValueIdentifiers.ASCII, Int32Array.from([27, 170]), 'ASCII', 'US-ASCII');
  55579. CharacterSetECI.Big5 = new CharacterSetECI(CharacterSetValueIdentifiers.Big5, 28, 'Big5');
  55580. CharacterSetECI.GB18030 = new CharacterSetECI(CharacterSetValueIdentifiers.GB18030, 29, 'GB18030', 'GB2312', 'EUC_CN', 'GBK');
  55581. CharacterSetECI.EUC_KR = new CharacterSetECI(CharacterSetValueIdentifiers.EUC_KR, 30, 'EUC_KR', 'EUC-KR');
  55582. return CharacterSetECI;
  55583. }();
  55584. var _default = CharacterSetECI;
  55585. exports.default = _default;
  55586. /***/ }),
  55587. /* 324 */
  55588. /*!***********************************************************************************!*\
  55589. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/FormatException.js ***!
  55590. \***********************************************************************************/
  55591. /*! no static exports found */
  55592. /***/ (function(module, exports, __webpack_require__) {
  55593. "use strict";
  55594. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  55595. Object.defineProperty(exports, "__esModule", {
  55596. value: true
  55597. });
  55598. exports.default = void 0;
  55599. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  55600. var __extends = void 0 && (void 0).__extends || function () {
  55601. var _extendStatics = function extendStatics(d, b) {
  55602. _extendStatics = Object.setPrototypeOf || {
  55603. __proto__: []
  55604. } instanceof Array && function (d, b) {
  55605. d.__proto__ = b;
  55606. } || function (d, b) {
  55607. for (var p in b) {
  55608. if (b.hasOwnProperty(p)) d[p] = b[p];
  55609. }
  55610. };
  55611. return _extendStatics(d, b);
  55612. };
  55613. return function (d, b) {
  55614. _extendStatics(d, b);
  55615. function __() {
  55616. this.constructor = d;
  55617. }
  55618. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  55619. };
  55620. }();
  55621. /**
  55622. * Custom Error class of type Exception.
  55623. */
  55624. var FormatException = /** @class */function (_super) {
  55625. __extends(FormatException, _super);
  55626. function FormatException() {
  55627. return _super !== null && _super.apply(this, arguments) || this;
  55628. }
  55629. FormatException.getFormatInstance = function () {
  55630. return new FormatException();
  55631. };
  55632. FormatException.kind = 'FormatException';
  55633. return FormatException;
  55634. }(_Exception.default);
  55635. var _default = FormatException;
  55636. exports.default = _default;
  55637. /***/ }),
  55638. /* 325 */
  55639. /*!***************************************************************************************!*\
  55640. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/StringEncoding.js ***!
  55641. \***************************************************************************************/
  55642. /*! no static exports found */
  55643. /***/ (function(module, exports, __webpack_require__) {
  55644. "use strict";
  55645. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  55646. Object.defineProperty(exports, "__esModule", {
  55647. value: true
  55648. });
  55649. exports.default = void 0;
  55650. var _UnsupportedOperationException = _interopRequireDefault(__webpack_require__(/*! ../UnsupportedOperationException */ 326));
  55651. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../common/CharacterSetECI */ 323));
  55652. /**
  55653. * Responsible for en/decoding strings.
  55654. */
  55655. var StringEncoding = /** @class */function () {
  55656. function StringEncoding() {}
  55657. /**
  55658. * Decodes some Uint8Array to a string format.
  55659. */
  55660. StringEncoding.decode = function (bytes, encoding) {
  55661. var encodingName = this.encodingName(encoding);
  55662. if (this.customDecoder) {
  55663. return this.customDecoder(bytes, encodingName);
  55664. }
  55665. // Increases browser support.
  55666. if (typeof TextDecoder === 'undefined' || this.shouldDecodeOnFallback(encodingName)) {
  55667. return this.decodeFallback(bytes, encodingName);
  55668. }
  55669. return new TextDecoder(encodingName).decode(bytes);
  55670. };
  55671. /**
  55672. * Checks if the decoding method should use the fallback for decoding
  55673. * once Node TextDecoder doesn't support all encoding formats.
  55674. *
  55675. * @param encodingName
  55676. */
  55677. StringEncoding.shouldDecodeOnFallback = function (encodingName) {
  55678. return !StringEncoding.isBrowser() && encodingName === 'ISO-8859-1';
  55679. };
  55680. /**
  55681. * Encodes some string into a Uint8Array.
  55682. */
  55683. StringEncoding.encode = function (s, encoding) {
  55684. var encodingName = this.encodingName(encoding);
  55685. if (this.customEncoder) {
  55686. return this.customEncoder(s, encodingName);
  55687. }
  55688. // Increases browser support.
  55689. if (typeof TextEncoder === 'undefined') {
  55690. return this.encodeFallback(s);
  55691. }
  55692. // TextEncoder only encodes to UTF8 by default as specified by encoding.spec.whatwg.org
  55693. return new TextEncoder().encode(s);
  55694. };
  55695. StringEncoding.isBrowser = function () {
  55696. return typeof window !== 'undefined' && {}.toString.call(window) === '[object Window]';
  55697. };
  55698. /**
  55699. * Returns the string value from some encoding character set.
  55700. */
  55701. StringEncoding.encodingName = function (encoding) {
  55702. return typeof encoding === 'string' ? encoding : encoding.getName();
  55703. };
  55704. /**
  55705. * Returns character set from some encoding character set.
  55706. */
  55707. StringEncoding.encodingCharacterSet = function (encoding) {
  55708. if (encoding instanceof _CharacterSetECI.default) {
  55709. return encoding;
  55710. }
  55711. return _CharacterSetECI.default.getCharacterSetECIByName(encoding);
  55712. };
  55713. /**
  55714. * Runs a fallback for the native decoding funcion.
  55715. */
  55716. StringEncoding.decodeFallback = function (bytes, encoding) {
  55717. var characterSet = this.encodingCharacterSet(encoding);
  55718. if (StringEncoding.isDecodeFallbackSupported(characterSet)) {
  55719. var s = '';
  55720. for (var i = 0, length_1 = bytes.length; i < length_1; i++) {
  55721. var h = bytes[i].toString(16);
  55722. if (h.length < 2) {
  55723. h = '0' + h;
  55724. }
  55725. s += '%' + h;
  55726. }
  55727. return decodeURIComponent(s);
  55728. }
  55729. if (characterSet.equals(_CharacterSetECI.default.UnicodeBigUnmarked)) {
  55730. return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer));
  55731. }
  55732. throw new _UnsupportedOperationException.default("Encoding " + this.encodingName(encoding) + " not supported by fallback.");
  55733. };
  55734. StringEncoding.isDecodeFallbackSupported = function (characterSet) {
  55735. return characterSet.equals(_CharacterSetECI.default.UTF8) || characterSet.equals(_CharacterSetECI.default.ISO8859_1) || characterSet.equals(_CharacterSetECI.default.ASCII);
  55736. };
  55737. /**
  55738. * Runs a fallback for the native encoding funcion.
  55739. *
  55740. * @see https://stackoverflow.com/a/17192845/4367683
  55741. */
  55742. StringEncoding.encodeFallback = function (s) {
  55743. var encodedURIstring = btoa(unescape(encodeURIComponent(s)));
  55744. var charList = encodedURIstring.split('');
  55745. var uintArray = [];
  55746. for (var i = 0; i < charList.length; i++) {
  55747. uintArray.push(charList[i].charCodeAt(0));
  55748. }
  55749. return new Uint8Array(uintArray);
  55750. };
  55751. return StringEncoding;
  55752. }();
  55753. var _default = StringEncoding;
  55754. exports.default = _default;
  55755. /***/ }),
  55756. /* 326 */
  55757. /*!*************************************************************************************************!*\
  55758. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/UnsupportedOperationException.js ***!
  55759. \*************************************************************************************************/
  55760. /*! no static exports found */
  55761. /***/ (function(module, exports, __webpack_require__) {
  55762. "use strict";
  55763. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  55764. Object.defineProperty(exports, "__esModule", {
  55765. value: true
  55766. });
  55767. exports.default = void 0;
  55768. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  55769. var __extends = void 0 && (void 0).__extends || function () {
  55770. var _extendStatics = function extendStatics(d, b) {
  55771. _extendStatics = Object.setPrototypeOf || {
  55772. __proto__: []
  55773. } instanceof Array && function (d, b) {
  55774. d.__proto__ = b;
  55775. } || function (d, b) {
  55776. for (var p in b) {
  55777. if (b.hasOwnProperty(p)) d[p] = b[p];
  55778. }
  55779. };
  55780. return _extendStatics(d, b);
  55781. };
  55782. return function (d, b) {
  55783. _extendStatics(d, b);
  55784. function __() {
  55785. this.constructor = d;
  55786. }
  55787. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  55788. };
  55789. }();
  55790. /**
  55791. * Custom Error class of type Exception.
  55792. */
  55793. var UnsupportedOperationException = /** @class */function (_super) {
  55794. __extends(UnsupportedOperationException, _super);
  55795. function UnsupportedOperationException() {
  55796. return _super !== null && _super.apply(this, arguments) || this;
  55797. }
  55798. UnsupportedOperationException.kind = 'UnsupportedOperationException';
  55799. return UnsupportedOperationException;
  55800. }(_Exception.default);
  55801. var _default = UnsupportedOperationException;
  55802. exports.default = _default;
  55803. /***/ }),
  55804. /* 327 */
  55805. /*!*************************************************************************************!*\
  55806. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/NotFoundException.js ***!
  55807. \*************************************************************************************/
  55808. /*! no static exports found */
  55809. /***/ (function(module, exports, __webpack_require__) {
  55810. "use strict";
  55811. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  55812. Object.defineProperty(exports, "__esModule", {
  55813. value: true
  55814. });
  55815. exports.default = void 0;
  55816. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  55817. var __extends = void 0 && (void 0).__extends || function () {
  55818. var _extendStatics = function extendStatics(d, b) {
  55819. _extendStatics = Object.setPrototypeOf || {
  55820. __proto__: []
  55821. } instanceof Array && function (d, b) {
  55822. d.__proto__ = b;
  55823. } || function (d, b) {
  55824. for (var p in b) {
  55825. if (b.hasOwnProperty(p)) d[p] = b[p];
  55826. }
  55827. };
  55828. return _extendStatics(d, b);
  55829. };
  55830. return function (d, b) {
  55831. _extendStatics(d, b);
  55832. function __() {
  55833. this.constructor = d;
  55834. }
  55835. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  55836. };
  55837. }();
  55838. /**
  55839. * Custom Error class of type Exception.
  55840. */
  55841. var NotFoundException = /** @class */function (_super) {
  55842. __extends(NotFoundException, _super);
  55843. function NotFoundException() {
  55844. return _super !== null && _super.apply(this, arguments) || this;
  55845. }
  55846. NotFoundException.getNotFoundInstance = function () {
  55847. return new NotFoundException();
  55848. };
  55849. NotFoundException.kind = 'NotFoundException';
  55850. return NotFoundException;
  55851. }(_Exception.default);
  55852. var _default = NotFoundException;
  55853. exports.default = _default;
  55854. /***/ }),
  55855. /* 328 */
  55856. /*!*******************************************************************************************************!*\
  55857. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/HTMLCanvasElementLuminanceSource.js ***!
  55858. \*******************************************************************************************************/
  55859. /*! no static exports found */
  55860. /***/ (function(module, exports, __webpack_require__) {
  55861. "use strict";
  55862. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  55863. Object.defineProperty(exports, "__esModule", {
  55864. value: true
  55865. });
  55866. exports.HTMLCanvasElementLuminanceSource = void 0;
  55867. var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ../core/InvertedLuminanceSource */ 329));
  55868. var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ../core/LuminanceSource */ 330));
  55869. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../core/IllegalArgumentException */ 308));
  55870. var __extends = void 0 && (void 0).__extends || function () {
  55871. var _extendStatics = function extendStatics(d, b) {
  55872. _extendStatics = Object.setPrototypeOf || {
  55873. __proto__: []
  55874. } instanceof Array && function (d, b) {
  55875. d.__proto__ = b;
  55876. } || function (d, b) {
  55877. for (var p in b) {
  55878. if (b.hasOwnProperty(p)) d[p] = b[p];
  55879. }
  55880. };
  55881. return _extendStatics(d, b);
  55882. };
  55883. return function (d, b) {
  55884. _extendStatics(d, b);
  55885. function __() {
  55886. this.constructor = d;
  55887. }
  55888. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  55889. };
  55890. }();
  55891. /**
  55892. * @deprecated Moving to @zxing/browser
  55893. */
  55894. var HTMLCanvasElementLuminanceSource = /** @class */function (_super) {
  55895. __extends(HTMLCanvasElementLuminanceSource, _super);
  55896. function HTMLCanvasElementLuminanceSource(canvas, doAutoInvert) {
  55897. if (doAutoInvert === void 0) {
  55898. doAutoInvert = false;
  55899. }
  55900. var _this = _super.call(this, canvas.width, canvas.height) || this;
  55901. _this.canvas = canvas;
  55902. _this.tempCanvasElement = null;
  55903. _this.buffer = HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData(canvas, doAutoInvert);
  55904. return _this;
  55905. }
  55906. HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData = function (canvas, doAutoInvert) {
  55907. if (doAutoInvert === void 0) {
  55908. doAutoInvert = false;
  55909. }
  55910. var imageData = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
  55911. return HTMLCanvasElementLuminanceSource.toGrayscaleBuffer(imageData.data, canvas.width, canvas.height, doAutoInvert);
  55912. };
  55913. HTMLCanvasElementLuminanceSource.toGrayscaleBuffer = function (imageBuffer, width, height, doAutoInvert) {
  55914. if (doAutoInvert === void 0) {
  55915. doAutoInvert = false;
  55916. }
  55917. var grayscaleBuffer = new Uint8ClampedArray(width * height);
  55918. HTMLCanvasElementLuminanceSource.FRAME_INDEX = !HTMLCanvasElementLuminanceSource.FRAME_INDEX;
  55919. if (HTMLCanvasElementLuminanceSource.FRAME_INDEX || !doAutoInvert) {
  55920. for (var i = 0, j = 0, length_1 = imageBuffer.length; i < length_1; i += 4, j++) {
  55921. var gray = void 0;
  55922. var alpha = imageBuffer[i + 3];
  55923. // The color of fully-transparent pixels is irrelevant. They are often, technically, fully-transparent
  55924. // black (0 alpha, and then 0 RGB). They are often used, of course as the "white" area in a
  55925. // barcode image. Force any such pixel to be white:
  55926. if (alpha === 0) {
  55927. gray = 0xFF;
  55928. } else {
  55929. var pixelR = imageBuffer[i];
  55930. var pixelG = imageBuffer[i + 1];
  55931. var pixelB = imageBuffer[i + 2];
  55932. // .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC),
  55933. // (306*R) >> 10 is approximately equal to R*0.299, and so on.
  55934. // 0x200 >> 10 is 0.5, it implements rounding.
  55935. gray = 306 * pixelR + 601 * pixelG + 117 * pixelB + 0x200 >> 10;
  55936. }
  55937. grayscaleBuffer[j] = gray;
  55938. }
  55939. } else {
  55940. for (var i = 0, j = 0, length_2 = imageBuffer.length; i < length_2; i += 4, j++) {
  55941. var gray = void 0;
  55942. var alpha = imageBuffer[i + 3];
  55943. // The color of fully-transparent pixels is irrelevant. They are often, technically, fully-transparent
  55944. // black (0 alpha, and then 0 RGB). They are often used, of course as the "white" area in a
  55945. // barcode image. Force any such pixel to be white:
  55946. if (alpha === 0) {
  55947. gray = 0xFF;
  55948. } else {
  55949. var pixelR = imageBuffer[i];
  55950. var pixelG = imageBuffer[i + 1];
  55951. var pixelB = imageBuffer[i + 2];
  55952. // .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC),
  55953. // (306*R) >> 10 is approximately equal to R*0.299, and so on.
  55954. // 0x200 >> 10 is 0.5, it implements rounding.
  55955. gray = 306 * pixelR + 601 * pixelG + 117 * pixelB + 0x200 >> 10;
  55956. }
  55957. grayscaleBuffer[j] = 0xFF - gray;
  55958. }
  55959. }
  55960. return grayscaleBuffer;
  55961. };
  55962. HTMLCanvasElementLuminanceSource.prototype.getRow = function (y /*int*/, row) {
  55963. if (y < 0 || y >= this.getHeight()) {
  55964. throw new _IllegalArgumentException.default('Requested row is outside the image: ' + y);
  55965. }
  55966. var width = this.getWidth();
  55967. var start = y * width;
  55968. if (row === null) {
  55969. row = this.buffer.slice(start, start + width);
  55970. } else {
  55971. if (row.length < width) {
  55972. row = new Uint8ClampedArray(width);
  55973. }
  55974. // The underlying raster of image consists of bytes with the luminance values
  55975. // TODO: can avoid set/slice?
  55976. row.set(this.buffer.slice(start, start + width));
  55977. }
  55978. return row;
  55979. };
  55980. HTMLCanvasElementLuminanceSource.prototype.getMatrix = function () {
  55981. return this.buffer;
  55982. };
  55983. HTMLCanvasElementLuminanceSource.prototype.isCropSupported = function () {
  55984. return true;
  55985. };
  55986. HTMLCanvasElementLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  55987. _super.prototype.crop.call(this, left, top, width, height);
  55988. return this;
  55989. };
  55990. /**
  55991. * This is always true, since the image is a gray-scale image.
  55992. *
  55993. * @return true
  55994. */
  55995. HTMLCanvasElementLuminanceSource.prototype.isRotateSupported = function () {
  55996. return true;
  55997. };
  55998. HTMLCanvasElementLuminanceSource.prototype.rotateCounterClockwise = function () {
  55999. this.rotate(-90);
  56000. return this;
  56001. };
  56002. HTMLCanvasElementLuminanceSource.prototype.rotateCounterClockwise45 = function () {
  56003. this.rotate(-45);
  56004. return this;
  56005. };
  56006. HTMLCanvasElementLuminanceSource.prototype.getTempCanvasElement = function () {
  56007. if (null === this.tempCanvasElement) {
  56008. var tempCanvasElement = this.canvas.ownerDocument.createElement('canvas');
  56009. tempCanvasElement.width = this.canvas.width;
  56010. tempCanvasElement.height = this.canvas.height;
  56011. this.tempCanvasElement = tempCanvasElement;
  56012. }
  56013. return this.tempCanvasElement;
  56014. };
  56015. HTMLCanvasElementLuminanceSource.prototype.rotate = function (angle) {
  56016. var tempCanvasElement = this.getTempCanvasElement();
  56017. var tempContext = tempCanvasElement.getContext('2d');
  56018. var angleRadians = angle * HTMLCanvasElementLuminanceSource.DEGREE_TO_RADIANS;
  56019. // Calculate and set new dimensions for temp canvas
  56020. var width = this.canvas.width;
  56021. var height = this.canvas.height;
  56022. var newWidth = Math.ceil(Math.abs(Math.cos(angleRadians)) * width + Math.abs(Math.sin(angleRadians)) * height);
  56023. var newHeight = Math.ceil(Math.abs(Math.sin(angleRadians)) * width + Math.abs(Math.cos(angleRadians)) * height);
  56024. tempCanvasElement.width = newWidth;
  56025. tempCanvasElement.height = newHeight;
  56026. // Draw at center of temp canvas to prevent clipping of image data
  56027. tempContext.translate(newWidth / 2, newHeight / 2);
  56028. tempContext.rotate(angleRadians);
  56029. tempContext.drawImage(this.canvas, width / -2, height / -2);
  56030. this.buffer = HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData(tempCanvasElement);
  56031. return this;
  56032. };
  56033. HTMLCanvasElementLuminanceSource.prototype.invert = function () {
  56034. return new _InvertedLuminanceSource.default(this);
  56035. };
  56036. HTMLCanvasElementLuminanceSource.DEGREE_TO_RADIANS = Math.PI / 180;
  56037. HTMLCanvasElementLuminanceSource.FRAME_INDEX = true;
  56038. return HTMLCanvasElementLuminanceSource;
  56039. }(_LuminanceSource.default);
  56040. exports.HTMLCanvasElementLuminanceSource = HTMLCanvasElementLuminanceSource;
  56041. /***/ }),
  56042. /* 329 */
  56043. /*!*******************************************************************************************!*\
  56044. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/InvertedLuminanceSource.js ***!
  56045. \*******************************************************************************************/
  56046. /*! no static exports found */
  56047. /***/ (function(module, exports, __webpack_require__) {
  56048. "use strict";
  56049. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  56050. Object.defineProperty(exports, "__esModule", {
  56051. value: true
  56052. });
  56053. exports.default = void 0;
  56054. var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./LuminanceSource */ 330));
  56055. /*
  56056. * Copyright 2009 ZXing authors
  56057. *
  56058. * Licensed under the Apache License, Version 2.0 (the "License");
  56059. * you may not use this file except in compliance with the License.
  56060. * You may obtain a copy of the License at
  56061. *
  56062. * http://www.apache.org/licenses/LICENSE-2.0
  56063. *
  56064. * Unless required by applicable law or agreed to in writing, software
  56065. * distributed under the License is distributed on an "AS IS" BASIS,
  56066. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56067. * See the License for the specific language governing permissions and
  56068. * limitations under the License.
  56069. */
  56070. var __extends = void 0 && (void 0).__extends || function () {
  56071. var _extendStatics = function extendStatics(d, b) {
  56072. _extendStatics = Object.setPrototypeOf || {
  56073. __proto__: []
  56074. } instanceof Array && function (d, b) {
  56075. d.__proto__ = b;
  56076. } || function (d, b) {
  56077. for (var p in b) {
  56078. if (b.hasOwnProperty(p)) d[p] = b[p];
  56079. }
  56080. };
  56081. return _extendStatics(d, b);
  56082. };
  56083. return function (d, b) {
  56084. _extendStatics(d, b);
  56085. function __() {
  56086. this.constructor = d;
  56087. }
  56088. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  56089. };
  56090. }();
  56091. /*namespace com.google.zxing {*/
  56092. /**
  56093. * A wrapper implementation of {@link LuminanceSource} which inverts the luminances it returns -- black becomes
  56094. * white and vice versa, and each value becomes (255-value).
  56095. *
  56096. * @author Sean Owen
  56097. */
  56098. var InvertedLuminanceSource = /** @class */function (_super) {
  56099. __extends(InvertedLuminanceSource, _super);
  56100. function InvertedLuminanceSource(delegate) {
  56101. var _this = _super.call(this, delegate.getWidth(), delegate.getHeight()) || this;
  56102. _this.delegate = delegate;
  56103. return _this;
  56104. }
  56105. /*@Override*/
  56106. InvertedLuminanceSource.prototype.getRow = function (y /*int*/, row) {
  56107. var sourceRow = this.delegate.getRow(y, row);
  56108. var width = this.getWidth();
  56109. for (var i = 0; i < width; i++) {
  56110. sourceRow[i] = /*(byte)*/255 - (sourceRow[i] & 0xFF);
  56111. }
  56112. return sourceRow;
  56113. };
  56114. /*@Override*/
  56115. InvertedLuminanceSource.prototype.getMatrix = function () {
  56116. var matrix = this.delegate.getMatrix();
  56117. var length = this.getWidth() * this.getHeight();
  56118. var invertedMatrix = new Uint8ClampedArray(length);
  56119. for (var i = 0; i < length; i++) {
  56120. invertedMatrix[i] = /*(byte)*/255 - (matrix[i] & 0xFF);
  56121. }
  56122. return invertedMatrix;
  56123. };
  56124. /*@Override*/
  56125. InvertedLuminanceSource.prototype.isCropSupported = function () {
  56126. return this.delegate.isCropSupported();
  56127. };
  56128. /*@Override*/
  56129. InvertedLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  56130. return new InvertedLuminanceSource(this.delegate.crop(left, top, width, height));
  56131. };
  56132. /*@Override*/
  56133. InvertedLuminanceSource.prototype.isRotateSupported = function () {
  56134. return this.delegate.isRotateSupported();
  56135. };
  56136. /**
  56137. * @return original delegate {@link LuminanceSource} since invert undoes itself
  56138. */
  56139. /*@Override*/
  56140. InvertedLuminanceSource.prototype.invert = function () {
  56141. return this.delegate;
  56142. };
  56143. /*@Override*/
  56144. InvertedLuminanceSource.prototype.rotateCounterClockwise = function () {
  56145. return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise());
  56146. };
  56147. /*@Override*/
  56148. InvertedLuminanceSource.prototype.rotateCounterClockwise45 = function () {
  56149. return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise45());
  56150. };
  56151. return InvertedLuminanceSource;
  56152. }(_LuminanceSource.default);
  56153. var _default = InvertedLuminanceSource;
  56154. exports.default = _default;
  56155. /***/ }),
  56156. /* 330 */
  56157. /*!***********************************************************************************!*\
  56158. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/LuminanceSource.js ***!
  56159. \***********************************************************************************/
  56160. /*! no static exports found */
  56161. /***/ (function(module, exports, __webpack_require__) {
  56162. "use strict";
  56163. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  56164. Object.defineProperty(exports, "__esModule", {
  56165. value: true
  56166. });
  56167. exports.default = void 0;
  56168. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ./util/StringBuilder */ 320));
  56169. var _UnsupportedOperationException = _interopRequireDefault(__webpack_require__(/*! ./UnsupportedOperationException */ 326));
  56170. /*
  56171. * Copyright 2009 ZXing authors
  56172. *
  56173. * Licensed under the Apache License, Version 2.0 (the "License");
  56174. * you may not use this file except in compliance with the License.
  56175. * You may obtain a copy of the License at
  56176. *
  56177. * http://www.apache.org/licenses/LICENSE-2.0
  56178. *
  56179. * Unless required by applicable law or agreed to in writing, software
  56180. * distributed under the License is distributed on an "AS IS" BASIS,
  56181. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56182. * See the License for the specific language governing permissions and
  56183. * limitations under the License.
  56184. */
  56185. /*namespace com.google.zxing {*/
  56186. /**
  56187. * The purpose of this class hierarchy is to abstract different bitmap implementations across
  56188. * platforms into a standard interface for requesting greyscale luminance values. The interface
  56189. * only provides immutable methods; therefore crop and rotation create copies. This is to ensure
  56190. * that one Reader does not modify the original luminance source and leave it in an unknown state
  56191. * for other Readers in the chain.
  56192. *
  56193. * @author dswitkin@google.com (Daniel Switkin)
  56194. */
  56195. var LuminanceSource = /** @class */function () {
  56196. function LuminanceSource(width /*int*/, height /*int*/) {
  56197. this.width = width;
  56198. this.height = height;
  56199. }
  56200. /**
  56201. * @return The width of the bitmap.
  56202. */
  56203. LuminanceSource.prototype.getWidth = function () {
  56204. return this.width;
  56205. };
  56206. /**
  56207. * @return The height of the bitmap.
  56208. */
  56209. LuminanceSource.prototype.getHeight = function () {
  56210. return this.height;
  56211. };
  56212. /**
  56213. * @return Whether this subclass supports cropping.
  56214. */
  56215. LuminanceSource.prototype.isCropSupported = function () {
  56216. return false;
  56217. };
  56218. /**
  56219. * Returns a new object with cropped image data. Implementations may keep a reference to the
  56220. * original data rather than a copy. Only callable if isCropSupported() is true.
  56221. *
  56222. * @param left The left coordinate, which must be in [0,getWidth())
  56223. * @param top The top coordinate, which must be in [0,getHeight())
  56224. * @param width The width of the rectangle to crop.
  56225. * @param height The height of the rectangle to crop.
  56226. * @return A cropped version of this object.
  56227. */
  56228. LuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  56229. throw new _UnsupportedOperationException.default('This luminance source does not support cropping.');
  56230. };
  56231. /**
  56232. * @return Whether this subclass supports counter-clockwise rotation.
  56233. */
  56234. LuminanceSource.prototype.isRotateSupported = function () {
  56235. return false;
  56236. };
  56237. /**
  56238. * Returns a new object with rotated image data by 90 degrees counterclockwise.
  56239. * Only callable if {@link #isRotateSupported()} is true.
  56240. *
  56241. * @return A rotated version of this object.
  56242. */
  56243. LuminanceSource.prototype.rotateCounterClockwise = function () {
  56244. throw new _UnsupportedOperationException.default('This luminance source does not support rotation by 90 degrees.');
  56245. };
  56246. /**
  56247. * Returns a new object with rotated image data by 45 degrees counterclockwise.
  56248. * Only callable if {@link #isRotateSupported()} is true.
  56249. *
  56250. * @return A rotated version of this object.
  56251. */
  56252. LuminanceSource.prototype.rotateCounterClockwise45 = function () {
  56253. throw new _UnsupportedOperationException.default('This luminance source does not support rotation by 45 degrees.');
  56254. };
  56255. /*@Override*/
  56256. LuminanceSource.prototype.toString = function () {
  56257. var row = new Uint8ClampedArray(this.width);
  56258. var result = new _StringBuilder.default();
  56259. for (var y = 0; y < this.height; y++) {
  56260. var sourceRow = this.getRow(y, row);
  56261. for (var x = 0; x < this.width; x++) {
  56262. var luminance = sourceRow[x] & 0xFF;
  56263. var c = void 0;
  56264. if (luminance < 0x40) {
  56265. c = '#';
  56266. } else if (luminance < 0x80) {
  56267. c = '+';
  56268. } else if (luminance < 0xC0) {
  56269. c = '.';
  56270. } else {
  56271. c = ' ';
  56272. }
  56273. result.append(c);
  56274. }
  56275. result.append('\n');
  56276. }
  56277. return result.toString();
  56278. };
  56279. return LuminanceSource;
  56280. }();
  56281. var _default = LuminanceSource;
  56282. exports.default = _default;
  56283. /***/ }),
  56284. /* 331 */
  56285. /*!***************************************************************************************!*\
  56286. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/VideoInputDevice.js ***!
  56287. \***************************************************************************************/
  56288. /*! no static exports found */
  56289. /***/ (function(module, exports, __webpack_require__) {
  56290. "use strict";
  56291. Object.defineProperty(exports, "__esModule", {
  56292. value: true
  56293. });
  56294. exports.VideoInputDevice = void 0;
  56295. /**
  56296. * @deprecated Moving to @zxing/browser
  56297. *
  56298. * Video input device metadata containing the id and label of the device if available.
  56299. */
  56300. var VideoInputDevice = /** @class */function () {
  56301. /**
  56302. * Creates an instance of VideoInputDevice.
  56303. *
  56304. * @param {string} deviceId the video input device id
  56305. * @param {string} label the label of the device if available
  56306. */
  56307. function VideoInputDevice(deviceId, label, groupId) {
  56308. this.deviceId = deviceId;
  56309. this.label = label;
  56310. /** @inheritdoc */
  56311. this.kind = 'videoinput';
  56312. this.groupId = groupId || undefined;
  56313. }
  56314. /** @inheritdoc */
  56315. VideoInputDevice.prototype.toJSON = function () {
  56316. return {
  56317. kind: this.kind,
  56318. groupId: this.groupId,
  56319. deviceId: this.deviceId,
  56320. label: this.label
  56321. };
  56322. };
  56323. return VideoInputDevice;
  56324. }();
  56325. exports.VideoInputDevice = VideoInputDevice;
  56326. /***/ }),
  56327. /* 332 */
  56328. /*!*************************************************************************************!*\
  56329. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/AztecReader.js ***!
  56330. \*************************************************************************************/
  56331. /*! no static exports found */
  56332. /***/ (function(module, exports, __webpack_require__) {
  56333. "use strict";
  56334. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  56335. Object.defineProperty(exports, "__esModule", {
  56336. value: true
  56337. });
  56338. exports.default = void 0;
  56339. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  56340. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  56341. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  56342. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  56343. var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
  56344. var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/Decoder */ 336));
  56345. var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 345));
  56346. /*
  56347. * Copyright 2010 ZXing authors
  56348. *
  56349. * Licensed under the Apache License, Version 2.0 (the "License");
  56350. * you may not use this file except in compliance with the License.
  56351. * You may obtain a copy of the License at
  56352. *
  56353. * http://www.apache.org/licenses/LICENSE-2.0
  56354. *
  56355. * Unless required by applicable law or agreed to in writing, software
  56356. * distributed under the License is distributed on an "AS IS" BASIS,
  56357. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56358. * See the License for the specific language governing permissions and
  56359. * limitations under the License.
  56360. */
  56361. // import java.util.List;
  56362. // import java.util.Map;
  56363. /**
  56364. * This implementation can detect and decode Aztec codes in an image.
  56365. *
  56366. * @author David Olivier
  56367. */
  56368. var AztecReader = /** @class */function () {
  56369. function AztecReader() {}
  56370. /**
  56371. * Locates and decodes a Data Matrix code in an image.
  56372. *
  56373. * @return a String representing the content encoded by the Data Matrix code
  56374. * @throws NotFoundException if a Data Matrix code cannot be found
  56375. * @throws FormatException if a Data Matrix code cannot be decoded
  56376. */
  56377. AztecReader.prototype.decode = function (image, hints) {
  56378. if (hints === void 0) {
  56379. hints = null;
  56380. }
  56381. var exception = null;
  56382. var detector = new _Detector.default(image.getBlackMatrix());
  56383. var points = null;
  56384. var decoderResult = null;
  56385. try {
  56386. var detectorResult = detector.detectMirror(false);
  56387. points = detectorResult.getPoints();
  56388. this.reportFoundResultPoints(hints, points);
  56389. decoderResult = new _Decoder.default().decode(detectorResult);
  56390. } catch (e) {
  56391. exception = e;
  56392. }
  56393. if (decoderResult == null) {
  56394. try {
  56395. var detectorResult = detector.detectMirror(true);
  56396. points = detectorResult.getPoints();
  56397. this.reportFoundResultPoints(hints, points);
  56398. decoderResult = new _Decoder.default().decode(detectorResult);
  56399. } catch (e) {
  56400. if (exception != null) {
  56401. throw exception;
  56402. }
  56403. throw e;
  56404. }
  56405. }
  56406. var result = new _Result.default(decoderResult.getText(), decoderResult.getRawBytes(), decoderResult.getNumBits(), points, _BarcodeFormat.default.AZTEC, _System.default.currentTimeMillis());
  56407. var byteSegments = decoderResult.getByteSegments();
  56408. if (byteSegments != null) {
  56409. result.putMetadata(_ResultMetadataType.default.BYTE_SEGMENTS, byteSegments);
  56410. }
  56411. var ecLevel = decoderResult.getECLevel();
  56412. if (ecLevel != null) {
  56413. result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, ecLevel);
  56414. }
  56415. return result;
  56416. };
  56417. AztecReader.prototype.reportFoundResultPoints = function (hints, points) {
  56418. if (hints != null) {
  56419. var rpcb_1 = hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
  56420. if (rpcb_1 != null) {
  56421. points.forEach(function (point, idx, arr) {
  56422. rpcb_1.foundPossibleResultPoint(point);
  56423. });
  56424. }
  56425. }
  56426. };
  56427. // @Override
  56428. AztecReader.prototype.reset = function () {
  56429. // do nothing
  56430. };
  56431. return AztecReader;
  56432. }();
  56433. var _default = AztecReader;
  56434. exports.default = _default;
  56435. /***/ }),
  56436. /* 333 */
  56437. /*!**************************************************************************!*\
  56438. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/Result.js ***!
  56439. \**************************************************************************/
  56440. /*! no static exports found */
  56441. /***/ (function(module, exports, __webpack_require__) {
  56442. "use strict";
  56443. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  56444. Object.defineProperty(exports, "__esModule", {
  56445. value: true
  56446. });
  56447. exports.default = void 0;
  56448. var _System = _interopRequireDefault(__webpack_require__(/*! ./util/System */ 315));
  56449. /*
  56450. * Copyright 2007 ZXing authors
  56451. *
  56452. * Licensed under the Apache License, Version 2.0 (the "License");
  56453. * you may not use this file except in compliance with the License.
  56454. * You may obtain a copy of the License at
  56455. *
  56456. * http://www.apache.org/licenses/LICENSE-2.0
  56457. *
  56458. * Unless required by applicable law or agreed to in writing, software
  56459. * distributed under the License is distributed on an "AS IS" BASIS,
  56460. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56461. * See the License for the specific language governing permissions and
  56462. * limitations under the License.
  56463. */
  56464. /**
  56465. * <p>Encapsulates the result of decoding a barcode within an image.</p>
  56466. *
  56467. * @author Sean Owen
  56468. */
  56469. var Result = /** @class */function () {
  56470. // public constructor(private text: string,
  56471. // Uint8Array rawBytes,
  56472. // ResultPoconst resultPoints: Int32Array,
  56473. // BarcodeFormat format) {
  56474. // this(text, rawBytes, resultPoints, format, System.currentTimeMillis())
  56475. // }
  56476. // public constructor(text: string,
  56477. // Uint8Array rawBytes,
  56478. // ResultPoconst resultPoints: Int32Array,
  56479. // BarcodeFormat format,
  56480. // long timestamp) {
  56481. // this(text, rawBytes, rawBytes == null ? 0 : 8 * rawBytes.length,
  56482. // resultPoints, format, timestamp)
  56483. // }
  56484. function Result(text, rawBytes, numBits, resultPoints, format, timestamp) {
  56485. if (numBits === void 0) {
  56486. numBits = rawBytes == null ? 0 : 8 * rawBytes.length;
  56487. }
  56488. if (timestamp === void 0) {
  56489. timestamp = _System.default.currentTimeMillis();
  56490. }
  56491. this.text = text;
  56492. this.rawBytes = rawBytes;
  56493. this.numBits = numBits;
  56494. this.resultPoints = resultPoints;
  56495. this.format = format;
  56496. this.timestamp = timestamp;
  56497. this.text = text;
  56498. this.rawBytes = rawBytes;
  56499. if (undefined === numBits || null === numBits) {
  56500. this.numBits = rawBytes === null || rawBytes === undefined ? 0 : 8 * rawBytes.length;
  56501. } else {
  56502. this.numBits = numBits;
  56503. }
  56504. this.resultPoints = resultPoints;
  56505. this.format = format;
  56506. this.resultMetadata = null;
  56507. if (undefined === timestamp || null === timestamp) {
  56508. this.timestamp = _System.default.currentTimeMillis();
  56509. } else {
  56510. this.timestamp = timestamp;
  56511. }
  56512. }
  56513. /**
  56514. * @return raw text encoded by the barcode
  56515. */
  56516. Result.prototype.getText = function () {
  56517. return this.text;
  56518. };
  56519. /**
  56520. * @return raw bytes encoded by the barcode, if applicable, otherwise {@code null}
  56521. */
  56522. Result.prototype.getRawBytes = function () {
  56523. return this.rawBytes;
  56524. };
  56525. /**
  56526. * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
  56527. * @since 3.3.0
  56528. */
  56529. Result.prototype.getNumBits = function () {
  56530. return this.numBits;
  56531. };
  56532. /**
  56533. * @return points related to the barcode in the image. These are typically points
  56534. * identifying finder patterns or the corners of the barcode. The exact meaning is
  56535. * specific to the type of barcode that was decoded.
  56536. */
  56537. Result.prototype.getResultPoints = function () {
  56538. return this.resultPoints;
  56539. };
  56540. /**
  56541. * @return {@link BarcodeFormat} representing the format of the barcode that was decoded
  56542. */
  56543. Result.prototype.getBarcodeFormat = function () {
  56544. return this.format;
  56545. };
  56546. /**
  56547. * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be
  56548. * {@code null}. This contains optional metadata about what was detected about the barcode,
  56549. * like orientation.
  56550. */
  56551. Result.prototype.getResultMetadata = function () {
  56552. return this.resultMetadata;
  56553. };
  56554. Result.prototype.putMetadata = function (type, value) {
  56555. if (this.resultMetadata === null) {
  56556. this.resultMetadata = new Map();
  56557. }
  56558. this.resultMetadata.set(type, value);
  56559. };
  56560. Result.prototype.putAllMetadata = function (metadata) {
  56561. if (metadata !== null) {
  56562. if (this.resultMetadata === null) {
  56563. this.resultMetadata = metadata;
  56564. } else {
  56565. this.resultMetadata = new Map(metadata);
  56566. }
  56567. }
  56568. };
  56569. Result.prototype.addResultPoints = function (newPoints) {
  56570. var oldPoints = this.resultPoints;
  56571. if (oldPoints === null) {
  56572. this.resultPoints = newPoints;
  56573. } else if (newPoints !== null && newPoints.length > 0) {
  56574. var allPoints = new Array(oldPoints.length + newPoints.length);
  56575. _System.default.arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);
  56576. _System.default.arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);
  56577. this.resultPoints = allPoints;
  56578. }
  56579. };
  56580. Result.prototype.getTimestamp = function () {
  56581. return this.timestamp;
  56582. };
  56583. /*@Override*/
  56584. Result.prototype.toString = function () {
  56585. return this.text;
  56586. };
  56587. return Result;
  56588. }();
  56589. var _default = Result;
  56590. exports.default = _default;
  56591. /***/ }),
  56592. /* 334 */
  56593. /*!*********************************************************************************!*\
  56594. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/BarcodeFormat.js ***!
  56595. \*********************************************************************************/
  56596. /*! no static exports found */
  56597. /***/ (function(module, exports, __webpack_require__) {
  56598. "use strict";
  56599. Object.defineProperty(exports, "__esModule", {
  56600. value: true
  56601. });
  56602. exports.default = void 0;
  56603. /*
  56604. * Direct port to TypeScript of ZXing by Adrian Toșcă
  56605. */
  56606. /*
  56607. * Copyright 2009 ZXing authors
  56608. *
  56609. * Licensed under the Apache License, Version 2.0 (the "License");
  56610. * you may not use this file except in compliance with the License.
  56611. * You may obtain a copy of the License at
  56612. *
  56613. * http://www.apache.org/licenses/LICENSE-2.0
  56614. *
  56615. * Unless required by applicable law or agreed to in writing, software
  56616. * distributed under the License is distributed on an "AS IS" BASIS,
  56617. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56618. * See the License for the specific language governing permissions and
  56619. * limitations under the License.
  56620. */
  56621. /*namespace com.google.zxing {*/
  56622. /**
  56623. * Enumerates barcode formats known to this package. Please keep alphabetized.
  56624. *
  56625. * @author Sean Owen
  56626. */
  56627. var BarcodeFormat;
  56628. (function (BarcodeFormat) {
  56629. /** Aztec 2D barcode format. */
  56630. BarcodeFormat[BarcodeFormat["AZTEC"] = 0] = "AZTEC";
  56631. /** CODABAR 1D format. */
  56632. BarcodeFormat[BarcodeFormat["CODABAR"] = 1] = "CODABAR";
  56633. /** Code 39 1D format. */
  56634. BarcodeFormat[BarcodeFormat["CODE_39"] = 2] = "CODE_39";
  56635. /** Code 93 1D format. */
  56636. BarcodeFormat[BarcodeFormat["CODE_93"] = 3] = "CODE_93";
  56637. /** Code 128 1D format. */
  56638. BarcodeFormat[BarcodeFormat["CODE_128"] = 4] = "CODE_128";
  56639. /** Data Matrix 2D barcode format. */
  56640. BarcodeFormat[BarcodeFormat["DATA_MATRIX"] = 5] = "DATA_MATRIX";
  56641. /** EAN-8 1D format. */
  56642. BarcodeFormat[BarcodeFormat["EAN_8"] = 6] = "EAN_8";
  56643. /** EAN-13 1D format. */
  56644. BarcodeFormat[BarcodeFormat["EAN_13"] = 7] = "EAN_13";
  56645. /** ITF (Interleaved Two of Five) 1D format. */
  56646. BarcodeFormat[BarcodeFormat["ITF"] = 8] = "ITF";
  56647. /** MaxiCode 2D barcode format. */
  56648. BarcodeFormat[BarcodeFormat["MAXICODE"] = 9] = "MAXICODE";
  56649. /** PDF417 format. */
  56650. BarcodeFormat[BarcodeFormat["PDF_417"] = 10] = "PDF_417";
  56651. /** QR Code 2D barcode format. */
  56652. BarcodeFormat[BarcodeFormat["QR_CODE"] = 11] = "QR_CODE";
  56653. /** RSS 14 */
  56654. BarcodeFormat[BarcodeFormat["RSS_14"] = 12] = "RSS_14";
  56655. /** RSS EXPANDED */
  56656. BarcodeFormat[BarcodeFormat["RSS_EXPANDED"] = 13] = "RSS_EXPANDED";
  56657. /** UPC-A 1D format. */
  56658. BarcodeFormat[BarcodeFormat["UPC_A"] = 14] = "UPC_A";
  56659. /** UPC-E 1D format. */
  56660. BarcodeFormat[BarcodeFormat["UPC_E"] = 15] = "UPC_E";
  56661. /** UPC/EAN extension format. Not a stand-alone format. */
  56662. BarcodeFormat[BarcodeFormat["UPC_EAN_EXTENSION"] = 16] = "UPC_EAN_EXTENSION";
  56663. })(BarcodeFormat || (BarcodeFormat = {}));
  56664. var _default = BarcodeFormat;
  56665. exports.default = _default;
  56666. /***/ }),
  56667. /* 335 */
  56668. /*!**************************************************************************************!*\
  56669. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ResultMetadataType.js ***!
  56670. \**************************************************************************************/
  56671. /*! no static exports found */
  56672. /***/ (function(module, exports, __webpack_require__) {
  56673. "use strict";
  56674. Object.defineProperty(exports, "__esModule", {
  56675. value: true
  56676. });
  56677. exports.default = void 0;
  56678. /*
  56679. * Copyright 2008 ZXing authors
  56680. *
  56681. * Licensed under the Apache License, Version 2.0 (the "License");
  56682. * you may not use this file except in compliance with the License.
  56683. * You may obtain a copy of the License at
  56684. *
  56685. * http://www.apache.org/licenses/LICENSE-2.0
  56686. *
  56687. * Unless required by applicable law or agreed to in writing, software
  56688. * distributed under the License is distributed on an "AS IS" BASIS,
  56689. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56690. * See the License for the specific language governing permissions and
  56691. * limitations under the License.
  56692. */
  56693. /*namespace com.google.zxing {*/
  56694. /**
  56695. * Represents some type of metadata about the result of the decoding that the decoder
  56696. * wishes to communicate back to the caller.
  56697. *
  56698. * @author Sean Owen
  56699. */
  56700. var ResultMetadataType;
  56701. (function (ResultMetadataType) {
  56702. /**
  56703. * Unspecified, application-specific metadata. Maps to an unspecified {@link Object}.
  56704. */
  56705. ResultMetadataType[ResultMetadataType["OTHER"] = 0] = "OTHER";
  56706. /**
  56707. * Denotes the likely approximate orientation of the barcode in the image. This value
  56708. * is given as degrees rotated clockwise from the normal, upright orientation.
  56709. * For example a 1D barcode which was found by reading top-to-bottom would be
  56710. * said to have orientation "90". This key maps to an {@link Integer} whose
  56711. * value is in the range [0,360).
  56712. */
  56713. ResultMetadataType[ResultMetadataType["ORIENTATION"] = 1] = "ORIENTATION";
  56714. /**
  56715. * <p>2D barcode formats typically encode text, but allow for a sort of 'byte mode'
  56716. * which is sometimes used to encode binary data. While {@link Result} makes available
  56717. * the complete raw bytes in the barcode for these formats, it does not offer the bytes
  56718. * from the byte segments alone.</p>
  56719. *
  56720. * <p>This maps to a {@link java.util.List} of byte arrays corresponding to the
  56721. * raw bytes in the byte segments in the barcode, in order.</p>
  56722. */
  56723. ResultMetadataType[ResultMetadataType["BYTE_SEGMENTS"] = 2] = "BYTE_SEGMENTS";
  56724. /**
  56725. * Error correction level used, if applicable. The value type depends on the
  56726. * format, but is typically a String.
  56727. */
  56728. ResultMetadataType[ResultMetadataType["ERROR_CORRECTION_LEVEL"] = 3] = "ERROR_CORRECTION_LEVEL";
  56729. /**
  56730. * For some periodicals, indicates the issue number as an {@link Integer}.
  56731. */
  56732. ResultMetadataType[ResultMetadataType["ISSUE_NUMBER"] = 4] = "ISSUE_NUMBER";
  56733. /**
  56734. * For some products, indicates the suggested retail price in the barcode as a
  56735. * formatted {@link String}.
  56736. */
  56737. ResultMetadataType[ResultMetadataType["SUGGESTED_PRICE"] = 5] = "SUGGESTED_PRICE";
  56738. /**
  56739. * For some products, the possible country of manufacture as a {@link String} denoting the
  56740. * ISO country code. Some map to multiple possible countries, like "US/CA".
  56741. */
  56742. ResultMetadataType[ResultMetadataType["POSSIBLE_COUNTRY"] = 6] = "POSSIBLE_COUNTRY";
  56743. /**
  56744. * For some products, the extension text
  56745. */
  56746. ResultMetadataType[ResultMetadataType["UPC_EAN_EXTENSION"] = 7] = "UPC_EAN_EXTENSION";
  56747. /**
  56748. * PDF417-specific metadata
  56749. */
  56750. ResultMetadataType[ResultMetadataType["PDF417_EXTRA_METADATA"] = 8] = "PDF417_EXTRA_METADATA";
  56751. /**
  56752. * If the code format supports structured append and the current scanned code is part of one then the
  56753. * sequence number is given with it.
  56754. */
  56755. ResultMetadataType[ResultMetadataType["STRUCTURED_APPEND_SEQUENCE"] = 9] = "STRUCTURED_APPEND_SEQUENCE";
  56756. /**
  56757. * If the code format supports structured append and the current scanned code is part of one then the
  56758. * parity is given with it.
  56759. */
  56760. ResultMetadataType[ResultMetadataType["STRUCTURED_APPEND_PARITY"] = 10] = "STRUCTURED_APPEND_PARITY";
  56761. })(ResultMetadataType || (ResultMetadataType = {}));
  56762. var _default = ResultMetadataType;
  56763. exports.default = _default;
  56764. /***/ }),
  56765. /* 336 */
  56766. /*!*****************************************************************************************!*\
  56767. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/decoder/Decoder.js ***!
  56768. \*****************************************************************************************/
  56769. /*! no static exports found */
  56770. /***/ (function(module, exports, __webpack_require__) {
  56771. "use strict";
  56772. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  56773. Object.defineProperty(exports, "__esModule", {
  56774. value: true
  56775. });
  56776. exports.default = void 0;
  56777. var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
  56778. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
  56779. var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
  56780. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalStateException */ 344));
  56781. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  56782. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  56783. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  56784. /*
  56785. * Copyright 2010 ZXing authors
  56786. *
  56787. * Licensed under the Apache License, Version 2.0 (the "License");
  56788. * you may not use this file except in compliance with the License.
  56789. * You may obtain a copy of the License at
  56790. *
  56791. * http://www.apache.org/licenses/LICENSE-2.0
  56792. *
  56793. * Unless required by applicable law or agreed to in writing, software
  56794. * distributed under the License is distributed on an "AS IS" BASIS,
  56795. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  56796. * See the License for the specific language governing permissions and
  56797. * limitations under the License.
  56798. */
  56799. // import java.util.Arrays;
  56800. var Table;
  56801. (function (Table) {
  56802. Table[Table["UPPER"] = 0] = "UPPER";
  56803. Table[Table["LOWER"] = 1] = "LOWER";
  56804. Table[Table["MIXED"] = 2] = "MIXED";
  56805. Table[Table["DIGIT"] = 3] = "DIGIT";
  56806. Table[Table["PUNCT"] = 4] = "PUNCT";
  56807. Table[Table["BINARY"] = 5] = "BINARY";
  56808. })(Table || (Table = {}));
  56809. /**
  56810. * <p>The main class which implements Aztec Code decoding -- as opposed to locating and extracting
  56811. * the Aztec Code from an image.</p>
  56812. *
  56813. * @author David Olivier
  56814. */
  56815. var Decoder = /** @class */function () {
  56816. function Decoder() {}
  56817. Decoder.prototype.decode = function (detectorResult) {
  56818. this.ddata = detectorResult;
  56819. var matrix = detectorResult.getBits();
  56820. var rawbits = this.extractBits(matrix);
  56821. var correctedBits = this.correctBits(rawbits);
  56822. var rawBytes = Decoder.convertBoolArrayToByteArray(correctedBits);
  56823. var result = Decoder.getEncodedData(correctedBits);
  56824. var decoderResult = new _DecoderResult.default(rawBytes, result, null, null);
  56825. decoderResult.setNumBits(correctedBits.length);
  56826. return decoderResult;
  56827. };
  56828. // This method is used for testing the high-level encoder
  56829. Decoder.highLevelDecode = function (correctedBits) {
  56830. return this.getEncodedData(correctedBits);
  56831. };
  56832. /**
  56833. * Gets the string encoded in the aztec code bits
  56834. *
  56835. * @return the decoded string
  56836. */
  56837. Decoder.getEncodedData = function (correctedBits) {
  56838. var endIndex = correctedBits.length;
  56839. var latchTable = Table.UPPER; // table most recently latched to
  56840. var shiftTable = Table.UPPER; // table to use for the next read
  56841. var result = '';
  56842. var index = 0;
  56843. while (index < endIndex) {
  56844. if (shiftTable === Table.BINARY) {
  56845. if (endIndex - index < 5) {
  56846. break;
  56847. }
  56848. var length_1 = Decoder.readCode(correctedBits, index, 5);
  56849. index += 5;
  56850. if (length_1 === 0) {
  56851. if (endIndex - index < 11) {
  56852. break;
  56853. }
  56854. length_1 = Decoder.readCode(correctedBits, index, 11) + 31;
  56855. index += 11;
  56856. }
  56857. for (var charCount = 0; charCount < length_1; charCount++) {
  56858. if (endIndex - index < 8) {
  56859. index = endIndex; // Force outer loop to exit
  56860. break;
  56861. }
  56862. var code = Decoder.readCode(correctedBits, index, 8);
  56863. result += /*(char)*/_StringUtils.default.castAsNonUtf8Char(code);
  56864. index += 8;
  56865. }
  56866. // Go back to whatever mode we had been in
  56867. shiftTable = latchTable;
  56868. } else {
  56869. var size = shiftTable === Table.DIGIT ? 4 : 5;
  56870. if (endIndex - index < size) {
  56871. break;
  56872. }
  56873. var code = Decoder.readCode(correctedBits, index, size);
  56874. index += size;
  56875. var str = Decoder.getCharacter(shiftTable, code);
  56876. if (str.startsWith('CTRL_')) {
  56877. // Table changes
  56878. // ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.
  56879. // That's including when that mode is a shift.
  56880. // Our test case dlusbs.png for issue #642 exercises that.
  56881. latchTable = shiftTable; // Latch the current mode, so as to return to Upper after U/S B/S
  56882. shiftTable = Decoder.getTable(str.charAt(5));
  56883. if (str.charAt(6) === 'L') {
  56884. latchTable = shiftTable;
  56885. }
  56886. } else {
  56887. result += str;
  56888. // Go back to whatever mode we had been in
  56889. shiftTable = latchTable;
  56890. }
  56891. }
  56892. }
  56893. return result;
  56894. };
  56895. /**
  56896. * gets the table corresponding to the char passed
  56897. */
  56898. Decoder.getTable = function (t) {
  56899. switch (t) {
  56900. case 'L':
  56901. return Table.LOWER;
  56902. case 'P':
  56903. return Table.PUNCT;
  56904. case 'M':
  56905. return Table.MIXED;
  56906. case 'D':
  56907. return Table.DIGIT;
  56908. case 'B':
  56909. return Table.BINARY;
  56910. case 'U':
  56911. default:
  56912. return Table.UPPER;
  56913. }
  56914. };
  56915. /**
  56916. * Gets the character (or string) corresponding to the passed code in the given table
  56917. *
  56918. * @param table the table used
  56919. * @param code the code of the character
  56920. */
  56921. Decoder.getCharacter = function (table, code) {
  56922. switch (table) {
  56923. case Table.UPPER:
  56924. return Decoder.UPPER_TABLE[code];
  56925. case Table.LOWER:
  56926. return Decoder.LOWER_TABLE[code];
  56927. case Table.MIXED:
  56928. return Decoder.MIXED_TABLE[code];
  56929. case Table.PUNCT:
  56930. return Decoder.PUNCT_TABLE[code];
  56931. case Table.DIGIT:
  56932. return Decoder.DIGIT_TABLE[code];
  56933. default:
  56934. // Should not reach here.
  56935. throw new _IllegalStateException.default('Bad table');
  56936. }
  56937. };
  56938. /**
  56939. * <p>Performs RS error correction on an array of bits.</p>
  56940. *
  56941. * @return the corrected array
  56942. * @throws FormatException if the input contains too many errors
  56943. */
  56944. Decoder.prototype.correctBits = function (rawbits) {
  56945. var gf;
  56946. var codewordSize;
  56947. if (this.ddata.getNbLayers() <= 2) {
  56948. codewordSize = 6;
  56949. gf = _GenericGF.default.AZTEC_DATA_6;
  56950. } else if (this.ddata.getNbLayers() <= 8) {
  56951. codewordSize = 8;
  56952. gf = _GenericGF.default.AZTEC_DATA_8;
  56953. } else if (this.ddata.getNbLayers() <= 22) {
  56954. codewordSize = 10;
  56955. gf = _GenericGF.default.AZTEC_DATA_10;
  56956. } else {
  56957. codewordSize = 12;
  56958. gf = _GenericGF.default.AZTEC_DATA_12;
  56959. }
  56960. var numDataCodewords = this.ddata.getNbDatablocks();
  56961. var numCodewords = rawbits.length / codewordSize;
  56962. if (numCodewords < numDataCodewords) {
  56963. throw new _FormatException.default();
  56964. }
  56965. var offset = rawbits.length % codewordSize;
  56966. var dataWords = new Int32Array(numCodewords);
  56967. for (var i = 0; i < numCodewords; i++, offset += codewordSize) {
  56968. dataWords[i] = Decoder.readCode(rawbits, offset, codewordSize);
  56969. }
  56970. try {
  56971. var rsDecoder = new _ReedSolomonDecoder.default(gf);
  56972. rsDecoder.decode(dataWords, numCodewords - numDataCodewords);
  56973. } catch (ex) {
  56974. throw new _FormatException.default(ex);
  56975. }
  56976. // Now perform the unstuffing operation.
  56977. // First, count how many bits are going to be thrown out as stuffing
  56978. var mask = (1 << codewordSize) - 1;
  56979. var stuffedBits = 0;
  56980. for (var i = 0; i < numDataCodewords; i++) {
  56981. var dataWord = dataWords[i];
  56982. if (dataWord === 0 || dataWord === mask) {
  56983. throw new _FormatException.default();
  56984. } else if (dataWord === 1 || dataWord === mask - 1) {
  56985. stuffedBits++;
  56986. }
  56987. }
  56988. // Now, actually unpack the bits and remove the stuffing
  56989. var correctedBits = new Array(numDataCodewords * codewordSize - stuffedBits);
  56990. var index = 0;
  56991. for (var i = 0; i < numDataCodewords; i++) {
  56992. var dataWord = dataWords[i];
  56993. if (dataWord === 1 || dataWord === mask - 1) {
  56994. // next codewordSize-1 bits are all zeros or all ones
  56995. correctedBits.fill(dataWord > 1, index, index + codewordSize - 1);
  56996. // Arrays.fill(correctedBits, index, index + codewordSize - 1, dataWord > 1);
  56997. index += codewordSize - 1;
  56998. } else {
  56999. for (var bit = codewordSize - 1; bit >= 0; --bit) {
  57000. correctedBits[index++] = (dataWord & 1 << bit) !== 0;
  57001. }
  57002. }
  57003. }
  57004. return correctedBits;
  57005. };
  57006. /**
  57007. * Gets the array of bits from an Aztec Code matrix
  57008. *
  57009. * @return the array of bits
  57010. */
  57011. Decoder.prototype.extractBits = function (matrix) {
  57012. var compact = this.ddata.isCompact();
  57013. var layers = this.ddata.getNbLayers();
  57014. var baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
  57015. var alignmentMap = new Int32Array(baseMatrixSize);
  57016. var rawbits = new Array(this.totalBitsInLayer(layers, compact));
  57017. if (compact) {
  57018. for (var i = 0; i < alignmentMap.length; i++) {
  57019. alignmentMap[i] = i;
  57020. }
  57021. } else {
  57022. var matrixSize = baseMatrixSize + 1 + 2 * _Integer.default.truncDivision(_Integer.default.truncDivision(baseMatrixSize, 2) - 1, 15);
  57023. var origCenter = baseMatrixSize / 2;
  57024. var center = _Integer.default.truncDivision(matrixSize, 2);
  57025. for (var i = 0; i < origCenter; i++) {
  57026. var newOffset = i + _Integer.default.truncDivision(i, 15);
  57027. alignmentMap[origCenter - i - 1] = center - newOffset - 1;
  57028. alignmentMap[origCenter + i] = center + newOffset + 1;
  57029. }
  57030. }
  57031. for (var i = 0, rowOffset = 0; i < layers; i++) {
  57032. var rowSize = (layers - i) * 4 + (compact ? 9 : 12);
  57033. // The top-left most point of this layer is <low, low> (not including alignment lines)
  57034. var low = i * 2;
  57035. // The bottom-right most point of this layer is <high, high> (not including alignment lines)
  57036. var high = baseMatrixSize - 1 - low;
  57037. // We pull bits from the two 2 x rowSize columns and two rowSize x 2 rows
  57038. for (var j = 0; j < rowSize; j++) {
  57039. var columnOffset = j * 2;
  57040. for (var k = 0; k < 2; k++) {
  57041. // left column
  57042. rawbits[rowOffset + columnOffset + k] = matrix.get(alignmentMap[low + k], alignmentMap[low + j]);
  57043. // bottom row
  57044. rawbits[rowOffset + 2 * rowSize + columnOffset + k] = matrix.get(alignmentMap[low + j], alignmentMap[high - k]);
  57045. // right column
  57046. rawbits[rowOffset + 4 * rowSize + columnOffset + k] = matrix.get(alignmentMap[high - k], alignmentMap[high - j]);
  57047. // top row
  57048. rawbits[rowOffset + 6 * rowSize + columnOffset + k] = matrix.get(alignmentMap[high - j], alignmentMap[low + k]);
  57049. }
  57050. }
  57051. rowOffset += rowSize * 8;
  57052. }
  57053. return rawbits;
  57054. };
  57055. /**
  57056. * Reads a code of given length and at given index in an array of bits
  57057. */
  57058. Decoder.readCode = function (rawbits, startIndex, length) {
  57059. var res = 0;
  57060. for (var i = startIndex; i < startIndex + length; i++) {
  57061. res <<= 1;
  57062. if (rawbits[i]) {
  57063. res |= 0x01;
  57064. }
  57065. }
  57066. return res;
  57067. };
  57068. /**
  57069. * Reads a code of length 8 in an array of bits, padding with zeros
  57070. */
  57071. Decoder.readByte = function (rawbits, startIndex) {
  57072. var n = rawbits.length - startIndex;
  57073. if (n >= 8) {
  57074. return Decoder.readCode(rawbits, startIndex, 8);
  57075. }
  57076. return Decoder.readCode(rawbits, startIndex, n) << 8 - n;
  57077. };
  57078. /**
  57079. * Packs a bit array into bytes, most significant bit first
  57080. */
  57081. Decoder.convertBoolArrayToByteArray = function (boolArr) {
  57082. var byteArr = new Uint8Array((boolArr.length + 7) / 8);
  57083. for (var i = 0; i < byteArr.length; i++) {
  57084. byteArr[i] = Decoder.readByte(boolArr, 8 * i);
  57085. }
  57086. return byteArr;
  57087. };
  57088. Decoder.prototype.totalBitsInLayer = function (layers, compact) {
  57089. return ((compact ? 88 : 112) + 16 * layers) * layers;
  57090. };
  57091. Decoder.UPPER_TABLE = ['CTRL_PS', ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'CTRL_LL', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'];
  57092. Decoder.LOWER_TABLE = ['CTRL_PS', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'CTRL_US', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'];
  57093. Decoder.MIXED_TABLE = ['CTRL_PS', ' ', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\b', '\t', '\n', '\x0b', '\f', '\r', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '@', '\\', '^', '_', '`', '|', '~', '\x7f', 'CTRL_LL', 'CTRL_UL', 'CTRL_PL', 'CTRL_BS'];
  57094. Decoder.PUNCT_TABLE = ['', '\r', '\r\n', '. ', ', ', ': ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}', 'CTRL_UL'];
  57095. Decoder.DIGIT_TABLE = ['CTRL_PS', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '.', 'CTRL_UL', 'CTRL_US'];
  57096. return Decoder;
  57097. }();
  57098. var _default = Decoder;
  57099. exports.default = _default;
  57100. /***/ }),
  57101. /* 337 */
  57102. /*!****************************************************************************************!*\
  57103. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/DecoderResult.js ***!
  57104. \****************************************************************************************/
  57105. /*! no static exports found */
  57106. /***/ (function(module, exports, __webpack_require__) {
  57107. "use strict";
  57108. Object.defineProperty(exports, "__esModule", {
  57109. value: true
  57110. });
  57111. exports.default = void 0;
  57112. /*
  57113. * Copyright 2007 ZXing authors
  57114. *
  57115. * Licensed under the Apache License, Version 2.0 (the "License");
  57116. * you may not use this file except in compliance with the License.
  57117. * You may obtain a copy of the License at
  57118. *
  57119. * http://www.apache.org/licenses/LICENSE-2.0
  57120. *
  57121. * Unless required by applicable law or agreed to in writing, software
  57122. * distributed under the License is distributed on an "AS IS" BASIS,
  57123. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  57124. * See the License for the specific language governing permissions and
  57125. * limitations under the License.
  57126. */
  57127. /*namespace com.google.zxing.common {*/
  57128. /*import java.util.List;*/
  57129. /**
  57130. * <p>Encapsulates the result of decoding a matrix of bits. This typically
  57131. * applies to 2D barcode formats. For now it contains the raw bytes obtained,
  57132. * as well as a String interpretation of those bytes, if applicable.</p>
  57133. *
  57134. * @author Sean Owen
  57135. */
  57136. var DecoderResult = /** @class */function () {
  57137. // public constructor(rawBytes: Uint8Array,
  57138. // text: string,
  57139. // List<Uint8Array> byteSegments,
  57140. // String ecLevel) {
  57141. // this(rawBytes, text, byteSegments, ecLevel, -1, -1)
  57142. // }
  57143. function DecoderResult(rawBytes, text, byteSegments, ecLevel, structuredAppendSequenceNumber, structuredAppendParity) {
  57144. if (structuredAppendSequenceNumber === void 0) {
  57145. structuredAppendSequenceNumber = -1;
  57146. }
  57147. if (structuredAppendParity === void 0) {
  57148. structuredAppendParity = -1;
  57149. }
  57150. this.rawBytes = rawBytes;
  57151. this.text = text;
  57152. this.byteSegments = byteSegments;
  57153. this.ecLevel = ecLevel;
  57154. this.structuredAppendSequenceNumber = structuredAppendSequenceNumber;
  57155. this.structuredAppendParity = structuredAppendParity;
  57156. this.numBits = rawBytes === undefined || rawBytes === null ? 0 : 8 * rawBytes.length;
  57157. }
  57158. /**
  57159. * @return raw bytes representing the result, or {@code null} if not applicable
  57160. */
  57161. DecoderResult.prototype.getRawBytes = function () {
  57162. return this.rawBytes;
  57163. };
  57164. /**
  57165. * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length
  57166. * @since 3.3.0
  57167. */
  57168. DecoderResult.prototype.getNumBits = function () {
  57169. return this.numBits;
  57170. };
  57171. /**
  57172. * @param numBits overrides the number of bits that are valid in {@link #getRawBytes()}
  57173. * @since 3.3.0
  57174. */
  57175. DecoderResult.prototype.setNumBits = function (numBits /*int*/) {
  57176. this.numBits = numBits;
  57177. };
  57178. /**
  57179. * @return text representation of the result
  57180. */
  57181. DecoderResult.prototype.getText = function () {
  57182. return this.text;
  57183. };
  57184. /**
  57185. * @return list of byte segments in the result, or {@code null} if not applicable
  57186. */
  57187. DecoderResult.prototype.getByteSegments = function () {
  57188. return this.byteSegments;
  57189. };
  57190. /**
  57191. * @return name of error correction level used, or {@code null} if not applicable
  57192. */
  57193. DecoderResult.prototype.getECLevel = function () {
  57194. return this.ecLevel;
  57195. };
  57196. /**
  57197. * @return number of errors corrected, or {@code null} if not applicable
  57198. */
  57199. DecoderResult.prototype.getErrorsCorrected = function () {
  57200. return this.errorsCorrected;
  57201. };
  57202. DecoderResult.prototype.setErrorsCorrected = function (errorsCorrected /*Integer*/) {
  57203. this.errorsCorrected = errorsCorrected;
  57204. };
  57205. /**
  57206. * @return number of erasures corrected, or {@code null} if not applicable
  57207. */
  57208. DecoderResult.prototype.getErasures = function () {
  57209. return this.erasures;
  57210. };
  57211. DecoderResult.prototype.setErasures = function (erasures /*Integer*/) {
  57212. this.erasures = erasures;
  57213. };
  57214. /**
  57215. * @return arbitrary additional metadata
  57216. */
  57217. DecoderResult.prototype.getOther = function () {
  57218. return this.other;
  57219. };
  57220. DecoderResult.prototype.setOther = function (other) {
  57221. this.other = other;
  57222. };
  57223. DecoderResult.prototype.hasStructuredAppend = function () {
  57224. return this.structuredAppendParity >= 0 && this.structuredAppendSequenceNumber >= 0;
  57225. };
  57226. DecoderResult.prototype.getStructuredAppendParity = function () {
  57227. return this.structuredAppendParity;
  57228. };
  57229. DecoderResult.prototype.getStructuredAppendSequenceNumber = function () {
  57230. return this.structuredAppendSequenceNumber;
  57231. };
  57232. return DecoderResult;
  57233. }();
  57234. var _default = DecoderResult;
  57235. exports.default = _default;
  57236. /***/ }),
  57237. /* 338 */
  57238. /*!************************************************************************************************!*\
  57239. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/GenericGF.js ***!
  57240. \************************************************************************************************/
  57241. /*! no static exports found */
  57242. /***/ (function(module, exports, __webpack_require__) {
  57243. "use strict";
  57244. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  57245. Object.defineProperty(exports, "__esModule", {
  57246. value: true
  57247. });
  57248. exports.default = void 0;
  57249. var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./GenericGFPoly */ 339));
  57250. var _AbstractGenericGF = _interopRequireDefault(__webpack_require__(/*! ./AbstractGenericGF */ 340));
  57251. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  57252. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  57253. var _ArithmeticException = _interopRequireDefault(__webpack_require__(/*! ../../ArithmeticException */ 341));
  57254. /*
  57255. * Copyright 2007 ZXing authors
  57256. *
  57257. * Licensed under the Apache License, Version 2.0 (the "License");
  57258. * you may not use this file except in compliance with the License.
  57259. * You may obtain a copy of the License at
  57260. *
  57261. * http://www.apache.org/licenses/LICENSE-2.0
  57262. *
  57263. * Unless required by applicable law or agreed to in writing, software
  57264. * distributed under the License is distributed on an "AS IS" BASIS,
  57265. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  57266. * See the License for the specific language governing permissions and
  57267. * limitations under the License.
  57268. */
  57269. var __extends = void 0 && (void 0).__extends || function () {
  57270. var _extendStatics = function extendStatics(d, b) {
  57271. _extendStatics = Object.setPrototypeOf || {
  57272. __proto__: []
  57273. } instanceof Array && function (d, b) {
  57274. d.__proto__ = b;
  57275. } || function (d, b) {
  57276. for (var p in b) {
  57277. if (b.hasOwnProperty(p)) d[p] = b[p];
  57278. }
  57279. };
  57280. return _extendStatics(d, b);
  57281. };
  57282. return function (d, b) {
  57283. _extendStatics(d, b);
  57284. function __() {
  57285. this.constructor = d;
  57286. }
  57287. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  57288. };
  57289. }();
  57290. /*namespace com.google.zxing.common.reedsolomon {*/
  57291. /**
  57292. * <p>This class contains utility methods for performing mathematical operations over
  57293. * the Galois Fields. Operations use a given primitive polynomial in calculations.</p>
  57294. *
  57295. * <p>Throughout this package, elements of the GF are represented as an {@code int}
  57296. * for convenience and speed (but at the cost of memory).
  57297. * </p>
  57298. *
  57299. * @author Sean Owen
  57300. * @author David Olivier
  57301. */
  57302. var GenericGF = /** @class */function (_super) {
  57303. __extends(GenericGF, _super);
  57304. /**
  57305. * Create a representation of GF(size) using the given primitive polynomial.
  57306. *
  57307. * @param primitive irreducible polynomial whose coefficients are represented by
  57308. * the bits of an int, where the least-significant bit represents the constant
  57309. * coefficient
  57310. * @param size the size of the field
  57311. * @param b the factor b in the generator polynomial can be 0- or 1-based
  57312. * (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))).
  57313. * In most cases it should be 1, but for QR code it is 0.
  57314. */
  57315. function GenericGF(primitive /*int*/, size /*int*/, generatorBase /*int*/) {
  57316. var _this = _super.call(this) || this;
  57317. _this.primitive = primitive;
  57318. _this.size = size;
  57319. _this.generatorBase = generatorBase;
  57320. var expTable = new Int32Array(size);
  57321. var x = 1;
  57322. for (var i = 0; i < size; i++) {
  57323. expTable[i] = x;
  57324. x *= 2; // we're assuming the generator alpha is 2
  57325. if (x >= size) {
  57326. x ^= primitive;
  57327. x &= size - 1;
  57328. }
  57329. }
  57330. _this.expTable = expTable;
  57331. var logTable = new Int32Array(size);
  57332. for (var i = 0; i < size - 1; i++) {
  57333. logTable[expTable[i]] = i;
  57334. }
  57335. _this.logTable = logTable;
  57336. // logTable[0] == 0 but this should never be used
  57337. _this.zero = new _GenericGFPoly.default(_this, Int32Array.from([0]));
  57338. _this.one = new _GenericGFPoly.default(_this, Int32Array.from([1]));
  57339. return _this;
  57340. }
  57341. GenericGF.prototype.getZero = function () {
  57342. return this.zero;
  57343. };
  57344. GenericGF.prototype.getOne = function () {
  57345. return this.one;
  57346. };
  57347. /**
  57348. * @return the monomial representing coefficient * x^degree
  57349. */
  57350. GenericGF.prototype.buildMonomial = function (degree /*int*/, coefficient /*int*/) {
  57351. if (degree < 0) {
  57352. throw new _IllegalArgumentException.default();
  57353. }
  57354. if (coefficient === 0) {
  57355. return this.zero;
  57356. }
  57357. var coefficients = new Int32Array(degree + 1);
  57358. coefficients[0] = coefficient;
  57359. return new _GenericGFPoly.default(this, coefficients);
  57360. };
  57361. /**
  57362. * @return multiplicative inverse of a
  57363. */
  57364. GenericGF.prototype.inverse = function (a /*int*/) {
  57365. if (a === 0) {
  57366. throw new _ArithmeticException.default();
  57367. }
  57368. return this.expTable[this.size - this.logTable[a] - 1];
  57369. };
  57370. /**
  57371. * @return product of a and b in GF(size)
  57372. */
  57373. GenericGF.prototype.multiply = function (a /*int*/, b /*int*/) {
  57374. if (a === 0 || b === 0) {
  57375. return 0;
  57376. }
  57377. return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.size - 1)];
  57378. };
  57379. GenericGF.prototype.getSize = function () {
  57380. return this.size;
  57381. };
  57382. GenericGF.prototype.getGeneratorBase = function () {
  57383. return this.generatorBase;
  57384. };
  57385. /*@Override*/
  57386. GenericGF.prototype.toString = function () {
  57387. return 'GF(0x' + _Integer.default.toHexString(this.primitive) + ',' + this.size + ')';
  57388. };
  57389. GenericGF.prototype.equals = function (o) {
  57390. return o === this;
  57391. };
  57392. GenericGF.AZTEC_DATA_12 = new GenericGF(0x1069, 4096, 1); // x^12 + x^6 + x^5 + x^3 + 1
  57393. GenericGF.AZTEC_DATA_10 = new GenericGF(0x409, 1024, 1); // x^10 + x^3 + 1
  57394. GenericGF.AZTEC_DATA_6 = new GenericGF(0x43, 64, 1); // x^6 + x + 1
  57395. GenericGF.AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1
  57396. GenericGF.QR_CODE_FIELD_256 = new GenericGF(0x011d, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1
  57397. GenericGF.DATA_MATRIX_FIELD_256 = new GenericGF(0x012d, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1
  57398. GenericGF.AZTEC_DATA_8 = GenericGF.DATA_MATRIX_FIELD_256;
  57399. GenericGF.MAXICODE_FIELD_64 = GenericGF.AZTEC_DATA_6;
  57400. return GenericGF;
  57401. }(_AbstractGenericGF.default);
  57402. var _default = GenericGF;
  57403. exports.default = _default;
  57404. /***/ }),
  57405. /* 339 */
  57406. /*!****************************************************************************************************!*\
  57407. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/GenericGFPoly.js ***!
  57408. \****************************************************************************************************/
  57409. /*! no static exports found */
  57410. /***/ (function(module, exports, __webpack_require__) {
  57411. "use strict";
  57412. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  57413. Object.defineProperty(exports, "__esModule", {
  57414. value: true
  57415. });
  57416. exports.default = void 0;
  57417. var _AbstractGenericGF = _interopRequireDefault(__webpack_require__(/*! ./AbstractGenericGF */ 340));
  57418. var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
  57419. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  57420. /*
  57421. * Copyright 2007 ZXing authors
  57422. *
  57423. * Licensed under the Apache License, Version 2.0 (the "License");
  57424. * you may not use this file except in compliance with the License.
  57425. * You may obtain a copy of the License at
  57426. *
  57427. * http://www.apache.org/licenses/LICENSE-2.0
  57428. *
  57429. * Unless required by applicable law or agreed to in writing, software
  57430. * distributed under the License is distributed on an "AS IS" BASIS,
  57431. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  57432. * See the License for the specific language governing permissions and
  57433. * limitations under the License.
  57434. */
  57435. /*namespace com.google.zxing.common.reedsolomon {*/
  57436. /**
  57437. * <p>Represents a polynomial whose coefficients are elements of a GF.
  57438. * Instances of this class are immutable.</p>
  57439. *
  57440. * <p>Much credit is due to William Rucklidge since portions of this code are an indirect
  57441. * port of his C++ Reed-Solomon implementation.</p>
  57442. *
  57443. * @author Sean Owen
  57444. */
  57445. var GenericGFPoly = /** @class */function () {
  57446. /**
  57447. * @param field the {@link GenericGF} instance representing the field to use
  57448. * to perform computations
  57449. * @param coefficients coefficients as ints representing elements of GF(size), arranged
  57450. * from most significant (highest-power term) coefficient to least significant
  57451. * @throws IllegalArgumentException if argument is null or empty,
  57452. * or if leading coefficient is 0 and this is not a
  57453. * constant polynomial (that is, it is not the monomial "0")
  57454. */
  57455. function GenericGFPoly(field, coefficients) {
  57456. if (coefficients.length === 0) {
  57457. throw new _IllegalArgumentException.default();
  57458. }
  57459. this.field = field;
  57460. var coefficientsLength = coefficients.length;
  57461. if (coefficientsLength > 1 && coefficients[0] === 0) {
  57462. // Leading term must be non-zero for anything except the constant polynomial "0"
  57463. var firstNonZero = 1;
  57464. while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {
  57465. firstNonZero++;
  57466. }
  57467. if (firstNonZero === coefficientsLength) {
  57468. this.coefficients = Int32Array.from([0]);
  57469. } else {
  57470. this.coefficients = new Int32Array(coefficientsLength - firstNonZero);
  57471. _System.default.arraycopy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);
  57472. }
  57473. } else {
  57474. this.coefficients = coefficients;
  57475. }
  57476. }
  57477. GenericGFPoly.prototype.getCoefficients = function () {
  57478. return this.coefficients;
  57479. };
  57480. /**
  57481. * @return degree of this polynomial
  57482. */
  57483. GenericGFPoly.prototype.getDegree = function () {
  57484. return this.coefficients.length - 1;
  57485. };
  57486. /**
  57487. * @return true iff this polynomial is the monomial "0"
  57488. */
  57489. GenericGFPoly.prototype.isZero = function () {
  57490. return this.coefficients[0] === 0;
  57491. };
  57492. /**
  57493. * @return coefficient of x^degree term in this polynomial
  57494. */
  57495. GenericGFPoly.prototype.getCoefficient = function (degree /*int*/) {
  57496. return this.coefficients[this.coefficients.length - 1 - degree];
  57497. };
  57498. /**
  57499. * @return evaluation of this polynomial at a given point
  57500. */
  57501. GenericGFPoly.prototype.evaluateAt = function (a /*int*/) {
  57502. if (a === 0) {
  57503. // Just return the x^0 coefficient
  57504. return this.getCoefficient(0);
  57505. }
  57506. var coefficients = this.coefficients;
  57507. var result;
  57508. if (a === 1) {
  57509. // Just the sum of the coefficients
  57510. result = 0;
  57511. for (var i = 0, length_1 = coefficients.length; i !== length_1; i++) {
  57512. var coefficient = coefficients[i];
  57513. result = _AbstractGenericGF.default.addOrSubtract(result, coefficient);
  57514. }
  57515. return result;
  57516. }
  57517. result = coefficients[0];
  57518. var size = coefficients.length;
  57519. var field = this.field;
  57520. for (var i = 1; i < size; i++) {
  57521. result = _AbstractGenericGF.default.addOrSubtract(field.multiply(a, result), coefficients[i]);
  57522. }
  57523. return result;
  57524. };
  57525. GenericGFPoly.prototype.addOrSubtract = function (other) {
  57526. if (!this.field.equals(other.field)) {
  57527. throw new _IllegalArgumentException.default('GenericGFPolys do not have same GenericGF field');
  57528. }
  57529. if (this.isZero()) {
  57530. return other;
  57531. }
  57532. if (other.isZero()) {
  57533. return this;
  57534. }
  57535. var smallerCoefficients = this.coefficients;
  57536. var largerCoefficients = other.coefficients;
  57537. if (smallerCoefficients.length > largerCoefficients.length) {
  57538. var temp = smallerCoefficients;
  57539. smallerCoefficients = largerCoefficients;
  57540. largerCoefficients = temp;
  57541. }
  57542. var sumDiff = new Int32Array(largerCoefficients.length);
  57543. var lengthDiff = largerCoefficients.length - smallerCoefficients.length;
  57544. // Copy high-order terms only found in higher-degree polynomial's coefficients
  57545. _System.default.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
  57546. for (var i = lengthDiff; i < largerCoefficients.length; i++) {
  57547. sumDiff[i] = _AbstractGenericGF.default.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
  57548. }
  57549. return new GenericGFPoly(this.field, sumDiff);
  57550. };
  57551. GenericGFPoly.prototype.multiply = function (other) {
  57552. if (!this.field.equals(other.field)) {
  57553. throw new _IllegalArgumentException.default('GenericGFPolys do not have same GenericGF field');
  57554. }
  57555. if (this.isZero() || other.isZero()) {
  57556. return this.field.getZero();
  57557. }
  57558. var aCoefficients = this.coefficients;
  57559. var aLength = aCoefficients.length;
  57560. var bCoefficients = other.coefficients;
  57561. var bLength = bCoefficients.length;
  57562. var product = new Int32Array(aLength + bLength - 1);
  57563. var field = this.field;
  57564. for (var i = 0; i < aLength; i++) {
  57565. var aCoeff = aCoefficients[i];
  57566. for (var j = 0; j < bLength; j++) {
  57567. product[i + j] = _AbstractGenericGF.default.addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
  57568. }
  57569. }
  57570. return new GenericGFPoly(field, product);
  57571. };
  57572. GenericGFPoly.prototype.multiplyScalar = function (scalar /*int*/) {
  57573. if (scalar === 0) {
  57574. return this.field.getZero();
  57575. }
  57576. if (scalar === 1) {
  57577. return this;
  57578. }
  57579. var size = this.coefficients.length;
  57580. var field = this.field;
  57581. var product = new Int32Array(size);
  57582. var coefficients = this.coefficients;
  57583. for (var i = 0; i < size; i++) {
  57584. product[i] = field.multiply(coefficients[i], scalar);
  57585. }
  57586. return new GenericGFPoly(field, product);
  57587. };
  57588. GenericGFPoly.prototype.multiplyByMonomial = function (degree /*int*/, coefficient /*int*/) {
  57589. if (degree < 0) {
  57590. throw new _IllegalArgumentException.default();
  57591. }
  57592. if (coefficient === 0) {
  57593. return this.field.getZero();
  57594. }
  57595. var coefficients = this.coefficients;
  57596. var size = coefficients.length;
  57597. var product = new Int32Array(size + degree);
  57598. var field = this.field;
  57599. for (var i = 0; i < size; i++) {
  57600. product[i] = field.multiply(coefficients[i], coefficient);
  57601. }
  57602. return new GenericGFPoly(field, product);
  57603. };
  57604. GenericGFPoly.prototype.divide = function (other) {
  57605. if (!this.field.equals(other.field)) {
  57606. throw new _IllegalArgumentException.default('GenericGFPolys do not have same GenericGF field');
  57607. }
  57608. if (other.isZero()) {
  57609. throw new _IllegalArgumentException.default('Divide by 0');
  57610. }
  57611. var field = this.field;
  57612. var quotient = field.getZero();
  57613. var remainder = this;
  57614. var denominatorLeadingTerm = other.getCoefficient(other.getDegree());
  57615. var inverseDenominatorLeadingTerm = field.inverse(denominatorLeadingTerm);
  57616. while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {
  57617. var degreeDifference = remainder.getDegree() - other.getDegree();
  57618. var scale = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);
  57619. var term = other.multiplyByMonomial(degreeDifference, scale);
  57620. var iterationQuotient = field.buildMonomial(degreeDifference, scale);
  57621. quotient = quotient.addOrSubtract(iterationQuotient);
  57622. remainder = remainder.addOrSubtract(term);
  57623. }
  57624. return [quotient, remainder];
  57625. };
  57626. /*@Override*/
  57627. GenericGFPoly.prototype.toString = function () {
  57628. var result = '';
  57629. for (var degree = this.getDegree(); degree >= 0; degree--) {
  57630. var coefficient = this.getCoefficient(degree);
  57631. if (coefficient !== 0) {
  57632. if (coefficient < 0) {
  57633. result += ' - ';
  57634. coefficient = -coefficient;
  57635. } else {
  57636. if (result.length > 0) {
  57637. result += ' + ';
  57638. }
  57639. }
  57640. if (degree === 0 || coefficient !== 1) {
  57641. var alphaPower = this.field.log(coefficient);
  57642. if (alphaPower === 0) {
  57643. result += '1';
  57644. } else if (alphaPower === 1) {
  57645. result += 'a';
  57646. } else {
  57647. result += 'a^';
  57648. result += alphaPower;
  57649. }
  57650. }
  57651. if (degree !== 0) {
  57652. if (degree === 1) {
  57653. result += 'x';
  57654. } else {
  57655. result += 'x^';
  57656. result += degree;
  57657. }
  57658. }
  57659. }
  57660. }
  57661. return result;
  57662. };
  57663. return GenericGFPoly;
  57664. }();
  57665. var _default = GenericGFPoly;
  57666. exports.default = _default;
  57667. /***/ }),
  57668. /* 340 */
  57669. /*!********************************************************************************************************!*\
  57670. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/AbstractGenericGF.js ***!
  57671. \********************************************************************************************************/
  57672. /*! no static exports found */
  57673. /***/ (function(module, exports, __webpack_require__) {
  57674. "use strict";
  57675. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  57676. Object.defineProperty(exports, "__esModule", {
  57677. value: true
  57678. });
  57679. exports.default = void 0;
  57680. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  57681. /*
  57682. * Copyright 2007 ZXing authors
  57683. *
  57684. * Licensed under the Apache License, Version 2.0 (the "License");
  57685. * you may not use this file except in compliance with the License.
  57686. * You may obtain a copy of the License at
  57687. *
  57688. * http://www.apache.org/licenses/LICENSE-2.0
  57689. *
  57690. * Unless required by applicable law or agreed to in writing, software
  57691. * distributed under the License is distributed on an "AS IS" BASIS,
  57692. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  57693. * See the License for the specific language governing permissions and
  57694. * limitations under the License.
  57695. */
  57696. /**
  57697. * <p>This class contains utility methods for performing mathematical operations over
  57698. * the Galois Fields. Operations use a given primitive polynomial in calculations.</p>
  57699. *
  57700. * <p>Throughout this package, elements of the GF are represented as an {@code int}
  57701. * for convenience and speed (but at the cost of memory).
  57702. * </p>
  57703. *
  57704. * @author Sean Owen
  57705. * @author David Olivier
  57706. */
  57707. var AbstractGenericGF = /** @class */function () {
  57708. function AbstractGenericGF() {}
  57709. /**
  57710. * @return 2 to the power of a in GF(size)
  57711. */
  57712. AbstractGenericGF.prototype.exp = function (a) {
  57713. return this.expTable[a];
  57714. };
  57715. /**
  57716. * @return base 2 log of a in GF(size)
  57717. */
  57718. AbstractGenericGF.prototype.log = function (a /*int*/) {
  57719. if (a === 0) {
  57720. throw new _IllegalArgumentException.default();
  57721. }
  57722. return this.logTable[a];
  57723. };
  57724. /**
  57725. * Implements both addition and subtraction -- they are the same in GF(size).
  57726. *
  57727. * @return sum/difference of a and b
  57728. */
  57729. AbstractGenericGF.addOrSubtract = function (a /*int*/, b /*int*/) {
  57730. return a ^ b;
  57731. };
  57732. return AbstractGenericGF;
  57733. }();
  57734. var _default = AbstractGenericGF;
  57735. exports.default = _default;
  57736. /***/ }),
  57737. /* 341 */
  57738. /*!***************************************************************************************!*\
  57739. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ArithmeticException.js ***!
  57740. \***************************************************************************************/
  57741. /*! no static exports found */
  57742. /***/ (function(module, exports, __webpack_require__) {
  57743. "use strict";
  57744. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  57745. Object.defineProperty(exports, "__esModule", {
  57746. value: true
  57747. });
  57748. exports.default = void 0;
  57749. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  57750. var __extends = void 0 && (void 0).__extends || function () {
  57751. var _extendStatics = function extendStatics(d, b) {
  57752. _extendStatics = Object.setPrototypeOf || {
  57753. __proto__: []
  57754. } instanceof Array && function (d, b) {
  57755. d.__proto__ = b;
  57756. } || function (d, b) {
  57757. for (var p in b) {
  57758. if (b.hasOwnProperty(p)) d[p] = b[p];
  57759. }
  57760. };
  57761. return _extendStatics(d, b);
  57762. };
  57763. return function (d, b) {
  57764. _extendStatics(d, b);
  57765. function __() {
  57766. this.constructor = d;
  57767. }
  57768. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  57769. };
  57770. }();
  57771. /**
  57772. * Custom Error class of type Exception.
  57773. */
  57774. var ArithmeticException = /** @class */function (_super) {
  57775. __extends(ArithmeticException, _super);
  57776. function ArithmeticException() {
  57777. return _super !== null && _super.apply(this, arguments) || this;
  57778. }
  57779. ArithmeticException.kind = 'ArithmeticException';
  57780. return ArithmeticException;
  57781. }(_Exception.default);
  57782. var _default = ArithmeticException;
  57783. exports.default = _default;
  57784. /***/ }),
  57785. /* 342 */
  57786. /*!*********************************************************************************************************!*\
  57787. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/ReedSolomonDecoder.js ***!
  57788. \*********************************************************************************************************/
  57789. /*! no static exports found */
  57790. /***/ (function(module, exports, __webpack_require__) {
  57791. "use strict";
  57792. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  57793. Object.defineProperty(exports, "__esModule", {
  57794. value: true
  57795. });
  57796. exports.default = void 0;
  57797. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ./GenericGF */ 338));
  57798. var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./GenericGFPoly */ 339));
  57799. var _ReedSolomonException = _interopRequireDefault(__webpack_require__(/*! ../../ReedSolomonException */ 343));
  57800. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalStateException */ 344));
  57801. /*
  57802. * Copyright 2007 ZXing authors
  57803. *
  57804. * Licensed under the Apache License, Version 2.0 (the "License");
  57805. * you may not use this file except in compliance with the License.
  57806. * You may obtain a copy of the License at
  57807. *
  57808. * http://www.apache.org/licenses/LICENSE-2.0
  57809. *
  57810. * Unless required by applicable law or agreed to in writing, software
  57811. * distributed under the License is distributed on an "AS IS" BASIS,
  57812. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  57813. * See the License for the specific language governing permissions and
  57814. * limitations under the License.
  57815. */
  57816. /*namespace com.google.zxing.common.reedsolomon {*/
  57817. /**
  57818. * <p>Implements Reed-Solomon decoding, as the name implies.</p>
  57819. *
  57820. * <p>The algorithm will not be explained here, but the following references were helpful
  57821. * in creating this implementation:</p>
  57822. *
  57823. * <ul>
  57824. * <li>Bruce Maggs.
  57825. * <a href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/pscico-guyb/realworld/www/rs_decode.ps">
  57826. * "Decoding Reed-Solomon Codes"</a> (see discussion of Forney's Formula)</li>
  57827. * <li>J.I. Hall. <a href="www.mth.msu.edu/~jhall/classes/codenotes/GRS.pdf">
  57828. * "Chapter 5. Generalized Reed-Solomon Codes"</a>
  57829. * (see discussion of Euclidean algorithm)</li>
  57830. * </ul>
  57831. *
  57832. * <p>Much credit is due to William Rucklidge since portions of this code are an indirect
  57833. * port of his C++ Reed-Solomon implementation.</p>
  57834. *
  57835. * @author Sean Owen
  57836. * @author William Rucklidge
  57837. * @author sanfordsquires
  57838. */
  57839. var ReedSolomonDecoder = /** @class */function () {
  57840. function ReedSolomonDecoder(field) {
  57841. this.field = field;
  57842. }
  57843. /**
  57844. * <p>Decodes given set of received codewords, which include both data and error-correction
  57845. * codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
  57846. * in the input.</p>
  57847. *
  57848. * @param received data and error-correction codewords
  57849. * @param twoS number of error-correction codewords available
  57850. * @throws ReedSolomonException if decoding fails for any reason
  57851. */
  57852. ReedSolomonDecoder.prototype.decode = function (received, twoS /*int*/) {
  57853. var field = this.field;
  57854. var poly = new _GenericGFPoly.default(field, received);
  57855. var syndromeCoefficients = new Int32Array(twoS);
  57856. var noError = true;
  57857. for (var i = 0; i < twoS; i++) {
  57858. var evalResult = poly.evaluateAt(field.exp(i + field.getGeneratorBase()));
  57859. syndromeCoefficients[syndromeCoefficients.length - 1 - i] = evalResult;
  57860. if (evalResult !== 0) {
  57861. noError = false;
  57862. }
  57863. }
  57864. if (noError) {
  57865. return;
  57866. }
  57867. var syndrome = new _GenericGFPoly.default(field, syndromeCoefficients);
  57868. var sigmaOmega = this.runEuclideanAlgorithm(field.buildMonomial(twoS, 1), syndrome, twoS);
  57869. var sigma = sigmaOmega[0];
  57870. var omega = sigmaOmega[1];
  57871. var errorLocations = this.findErrorLocations(sigma);
  57872. var errorMagnitudes = this.findErrorMagnitudes(omega, errorLocations);
  57873. for (var i = 0; i < errorLocations.length; i++) {
  57874. var position = received.length - 1 - field.log(errorLocations[i]);
  57875. if (position < 0) {
  57876. throw new _ReedSolomonException.default('Bad error location');
  57877. }
  57878. received[position] = _GenericGF.default.addOrSubtract(received[position], errorMagnitudes[i]);
  57879. }
  57880. };
  57881. ReedSolomonDecoder.prototype.runEuclideanAlgorithm = function (a, b, R /*int*/) {
  57882. // Assume a's degree is >= b's
  57883. if (a.getDegree() < b.getDegree()) {
  57884. var temp = a;
  57885. a = b;
  57886. b = temp;
  57887. }
  57888. var field = this.field;
  57889. var rLast = a;
  57890. var r = b;
  57891. var tLast = field.getZero();
  57892. var t = field.getOne();
  57893. // Run Euclidean algorithm until r's degree is less than R/2
  57894. while (r.getDegree() >= (R / 2 | 0)) {
  57895. var rLastLast = rLast;
  57896. var tLastLast = tLast;
  57897. rLast = r;
  57898. tLast = t;
  57899. // Divide rLastLast by rLast, with quotient in q and remainder in r
  57900. if (rLast.isZero()) {
  57901. // Oops, Euclidean algorithm already terminated?
  57902. throw new _ReedSolomonException.default('r_{i-1} was zero');
  57903. }
  57904. r = rLastLast;
  57905. var q = field.getZero();
  57906. var denominatorLeadingTerm = rLast.getCoefficient(rLast.getDegree());
  57907. var dltInverse = field.inverse(denominatorLeadingTerm);
  57908. while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {
  57909. var degreeDiff = r.getDegree() - rLast.getDegree();
  57910. var scale = field.multiply(r.getCoefficient(r.getDegree()), dltInverse);
  57911. q = q.addOrSubtract(field.buildMonomial(degreeDiff, scale));
  57912. r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));
  57913. }
  57914. t = q.multiply(tLast).addOrSubtract(tLastLast);
  57915. if (r.getDegree() >= rLast.getDegree()) {
  57916. throw new _IllegalStateException.default('Division algorithm failed to reduce polynomial?');
  57917. }
  57918. }
  57919. var sigmaTildeAtZero = t.getCoefficient(0);
  57920. if (sigmaTildeAtZero === 0) {
  57921. throw new _ReedSolomonException.default('sigmaTilde(0) was zero');
  57922. }
  57923. var inverse = field.inverse(sigmaTildeAtZero);
  57924. var sigma = t.multiplyScalar(inverse);
  57925. var omega = r.multiplyScalar(inverse);
  57926. return [sigma, omega];
  57927. };
  57928. ReedSolomonDecoder.prototype.findErrorLocations = function (errorLocator) {
  57929. // This is a direct application of Chien's search
  57930. var numErrors = errorLocator.getDegree();
  57931. if (numErrors === 1) {
  57932. // shortcut
  57933. return Int32Array.from([errorLocator.getCoefficient(1)]);
  57934. }
  57935. var result = new Int32Array(numErrors);
  57936. var e = 0;
  57937. var field = this.field;
  57938. for (var i = 1; i < field.getSize() && e < numErrors; i++) {
  57939. if (errorLocator.evaluateAt(i) === 0) {
  57940. result[e] = field.inverse(i);
  57941. e++;
  57942. }
  57943. }
  57944. if (e !== numErrors) {
  57945. throw new _ReedSolomonException.default('Error locator degree does not match number of roots');
  57946. }
  57947. return result;
  57948. };
  57949. ReedSolomonDecoder.prototype.findErrorMagnitudes = function (errorEvaluator, errorLocations) {
  57950. // This is directly applying Forney's Formula
  57951. var s = errorLocations.length;
  57952. var result = new Int32Array(s);
  57953. var field = this.field;
  57954. for (var i = 0; i < s; i++) {
  57955. var xiInverse = field.inverse(errorLocations[i]);
  57956. var denominator = 1;
  57957. for (var j = 0; j < s; j++) {
  57958. if (i !== j) {
  57959. // denominator = field.multiply(denominator,
  57960. // GenericGF.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse)))
  57961. // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug.
  57962. // Below is a funny-looking workaround from Steven Parkes
  57963. var term = field.multiply(errorLocations[j], xiInverse);
  57964. var termPlus1 = (term & 0x1) === 0 ? term | 1 : term & ~1;
  57965. denominator = field.multiply(denominator, termPlus1);
  57966. }
  57967. }
  57968. result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse), field.inverse(denominator));
  57969. if (field.getGeneratorBase() !== 0) {
  57970. result[i] = field.multiply(result[i], xiInverse);
  57971. }
  57972. }
  57973. return result;
  57974. };
  57975. return ReedSolomonDecoder;
  57976. }();
  57977. var _default = ReedSolomonDecoder;
  57978. exports.default = _default;
  57979. /***/ }),
  57980. /* 343 */
  57981. /*!****************************************************************************************!*\
  57982. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ReedSolomonException.js ***!
  57983. \****************************************************************************************/
  57984. /*! no static exports found */
  57985. /***/ (function(module, exports, __webpack_require__) {
  57986. "use strict";
  57987. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  57988. Object.defineProperty(exports, "__esModule", {
  57989. value: true
  57990. });
  57991. exports.default = void 0;
  57992. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  57993. var __extends = void 0 && (void 0).__extends || function () {
  57994. var _extendStatics = function extendStatics(d, b) {
  57995. _extendStatics = Object.setPrototypeOf || {
  57996. __proto__: []
  57997. } instanceof Array && function (d, b) {
  57998. d.__proto__ = b;
  57999. } || function (d, b) {
  58000. for (var p in b) {
  58001. if (b.hasOwnProperty(p)) d[p] = b[p];
  58002. }
  58003. };
  58004. return _extendStatics(d, b);
  58005. };
  58006. return function (d, b) {
  58007. _extendStatics(d, b);
  58008. function __() {
  58009. this.constructor = d;
  58010. }
  58011. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  58012. };
  58013. }();
  58014. /**
  58015. * Custom Error class of type Exception.
  58016. */
  58017. var ReedSolomonException = /** @class */function (_super) {
  58018. __extends(ReedSolomonException, _super);
  58019. function ReedSolomonException() {
  58020. return _super !== null && _super.apply(this, arguments) || this;
  58021. }
  58022. ReedSolomonException.kind = 'ReedSolomonException';
  58023. return ReedSolomonException;
  58024. }(_Exception.default);
  58025. var _default = ReedSolomonException;
  58026. exports.default = _default;
  58027. /***/ }),
  58028. /* 344 */
  58029. /*!*****************************************************************************************!*\
  58030. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/IllegalStateException.js ***!
  58031. \*****************************************************************************************/
  58032. /*! no static exports found */
  58033. /***/ (function(module, exports, __webpack_require__) {
  58034. "use strict";
  58035. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  58036. Object.defineProperty(exports, "__esModule", {
  58037. value: true
  58038. });
  58039. exports.default = void 0;
  58040. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  58041. var __extends = void 0 && (void 0).__extends || function () {
  58042. var _extendStatics = function extendStatics(d, b) {
  58043. _extendStatics = Object.setPrototypeOf || {
  58044. __proto__: []
  58045. } instanceof Array && function (d, b) {
  58046. d.__proto__ = b;
  58047. } || function (d, b) {
  58048. for (var p in b) {
  58049. if (b.hasOwnProperty(p)) d[p] = b[p];
  58050. }
  58051. };
  58052. return _extendStatics(d, b);
  58053. };
  58054. return function (d, b) {
  58055. _extendStatics(d, b);
  58056. function __() {
  58057. this.constructor = d;
  58058. }
  58059. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  58060. };
  58061. }();
  58062. /**
  58063. * Custom Error class of type Exception.
  58064. */
  58065. var IllegalStateException = /** @class */function (_super) {
  58066. __extends(IllegalStateException, _super);
  58067. function IllegalStateException() {
  58068. return _super !== null && _super.apply(this, arguments) || this;
  58069. }
  58070. IllegalStateException.kind = 'IllegalStateException';
  58071. return IllegalStateException;
  58072. }(_Exception.default);
  58073. var _default = IllegalStateException;
  58074. exports.default = _default;
  58075. /***/ }),
  58076. /* 345 */
  58077. /*!*******************************************************************************************!*\
  58078. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/detector/Detector.js ***!
  58079. \*******************************************************************************************/
  58080. /*! no static exports found */
  58081. /***/ (function(module, exports, __webpack_require__) {
  58082. "use strict";
  58083. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  58084. Object.defineProperty(exports, "__esModule", {
  58085. value: true
  58086. });
  58087. exports.default = exports.Point = void 0;
  58088. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  58089. var _AztecDetectorResult = _interopRequireDefault(__webpack_require__(/*! ../AztecDetectorResult */ 349));
  58090. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
  58091. var _WhiteRectangleDetector = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/WhiteRectangleDetector */ 351));
  58092. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
  58093. var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
  58094. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  58095. var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ../../common/GridSamplerInstance */ 352));
  58096. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  58097. /*
  58098. * Copyright 2010 ZXing authors
  58099. *
  58100. * Licensed under the Apache License, Version 2.0 (the "License");
  58101. * you may not use this file except in compliance with the License.
  58102. * You may obtain a copy of the License at
  58103. *
  58104. * http://www.apache.org/licenses/LICENSE-2.0
  58105. *
  58106. * Unless required by applicable law or agreed to in writing, software
  58107. * distributed under the License is distributed on an "AS IS" BASIS,
  58108. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  58109. * See the License for the specific language governing permissions and
  58110. * limitations under the License.
  58111. */
  58112. var Point = /** @class */function () {
  58113. function Point(x, y) {
  58114. this.x = x;
  58115. this.y = y;
  58116. }
  58117. Point.prototype.toResultPoint = function () {
  58118. return new _ResultPoint.default(this.getX(), this.getY());
  58119. };
  58120. Point.prototype.getX = function () {
  58121. return this.x;
  58122. };
  58123. Point.prototype.getY = function () {
  58124. return this.y;
  58125. };
  58126. return Point;
  58127. }();
  58128. exports.Point = Point;
  58129. /**
  58130. * Encapsulates logic that can detect an Aztec Code in an image, even if the Aztec Code
  58131. * is rotated or skewed, or partially obscured.
  58132. *
  58133. * @author David Olivier
  58134. * @author Frank Yellin
  58135. */
  58136. var Detector = /** @class */function () {
  58137. function Detector(image) {
  58138. this.EXPECTED_CORNER_BITS = new Int32Array([0xee0, 0x1dc, 0x83b, 0x707]);
  58139. this.image = image;
  58140. }
  58141. Detector.prototype.detect = function () {
  58142. return this.detectMirror(false);
  58143. };
  58144. /**
  58145. * Detects an Aztec Code in an image.
  58146. *
  58147. * @param isMirror if true, image is a mirror-image of original
  58148. * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
  58149. * @throws NotFoundException if no Aztec Code can be found
  58150. */
  58151. Detector.prototype.detectMirror = function (isMirror) {
  58152. // 1. Get the center of the aztec matrix
  58153. var pCenter = this.getMatrixCenter();
  58154. // 2. Get the center points of the four diagonal points just outside the bull's eye
  58155. // [topRight, bottomRight, bottomLeft, topLeft]
  58156. var bullsEyeCorners = this.getBullsEyeCorners(pCenter);
  58157. if (isMirror) {
  58158. var temp = bullsEyeCorners[0];
  58159. bullsEyeCorners[0] = bullsEyeCorners[2];
  58160. bullsEyeCorners[2] = temp;
  58161. }
  58162. // 3. Get the size of the matrix and other parameters from the bull's eye
  58163. this.extractParameters(bullsEyeCorners);
  58164. // 4. Sample the grid
  58165. var bits = this.sampleGrid(this.image, bullsEyeCorners[this.shift % 4], bullsEyeCorners[(this.shift + 1) % 4], bullsEyeCorners[(this.shift + 2) % 4], bullsEyeCorners[(this.shift + 3) % 4]);
  58166. // 5. Get the corners of the matrix.
  58167. var corners = this.getMatrixCornerPoints(bullsEyeCorners);
  58168. return new _AztecDetectorResult.default(bits, corners, this.compact, this.nbDataBlocks, this.nbLayers);
  58169. };
  58170. /**
  58171. * Extracts the number of data layers and data blocks from the layer around the bull's eye.
  58172. *
  58173. * @param bullsEyeCorners the array of bull's eye corners
  58174. * @throws NotFoundException in case of too many errors or invalid parameters
  58175. */
  58176. Detector.prototype.extractParameters = function (bullsEyeCorners) {
  58177. if (!this.isValidPoint(bullsEyeCorners[0]) || !this.isValidPoint(bullsEyeCorners[1]) || !this.isValidPoint(bullsEyeCorners[2]) || !this.isValidPoint(bullsEyeCorners[3])) {
  58178. throw new _NotFoundException.default();
  58179. }
  58180. var length = 2 * this.nbCenterLayers;
  58181. // Get the bits around the bull's eye
  58182. var sides = new Int32Array([this.sampleLine(bullsEyeCorners[0], bullsEyeCorners[1], length), this.sampleLine(bullsEyeCorners[1], bullsEyeCorners[2], length), this.sampleLine(bullsEyeCorners[2], bullsEyeCorners[3], length), this.sampleLine(bullsEyeCorners[3], bullsEyeCorners[0], length) // Top
  58183. ]);
  58184. // bullsEyeCorners[shift] is the corner of the bulls'eye that has three
  58185. // orientation marks.
  58186. // sides[shift] is the row/column that goes from the corner with three
  58187. // orientation marks to the corner with two.
  58188. this.shift = this.getRotation(sides, length);
  58189. // Flatten the parameter bits into a single 28- or 40-bit long
  58190. var parameterData = 0;
  58191. for (var i = 0; i < 4; i++) {
  58192. var side = sides[(this.shift + i) % 4];
  58193. if (this.compact) {
  58194. // Each side of the form ..XXXXXXX. where Xs are parameter data
  58195. parameterData <<= 7;
  58196. parameterData += side >> 1 & 0x7F;
  58197. } else {
  58198. // Each side of the form ..XXXXX.XXXXX. where Xs are parameter data
  58199. parameterData <<= 10;
  58200. parameterData += (side >> 2 & 0x1f << 5) + (side >> 1 & 0x1F);
  58201. }
  58202. }
  58203. // Corrects parameter data using RS. Returns just the data portion
  58204. // without the error correction.
  58205. var correctedData = this.getCorrectedParameterData(parameterData, this.compact);
  58206. if (this.compact) {
  58207. // 8 bits: 2 bits layers and 6 bits data blocks
  58208. this.nbLayers = (correctedData >> 6) + 1;
  58209. this.nbDataBlocks = (correctedData & 0x3F) + 1;
  58210. } else {
  58211. // 16 bits: 5 bits layers and 11 bits data blocks
  58212. this.nbLayers = (correctedData >> 11) + 1;
  58213. this.nbDataBlocks = (correctedData & 0x7FF) + 1;
  58214. }
  58215. };
  58216. Detector.prototype.getRotation = function (sides, length) {
  58217. // In a normal pattern, we expect to See
  58218. // ** .* D A
  58219. // * *
  58220. //
  58221. // . *
  58222. // .. .. C B
  58223. //
  58224. // Grab the 3 bits from each of the sides the form the locator pattern and concatenate
  58225. // into a 12-bit integer. Start with the bit at A
  58226. var cornerBits = 0;
  58227. sides.forEach(function (side, idx, arr) {
  58228. // XX......X where X's are orientation marks
  58229. var t = (side >> length - 2 << 1) + (side & 1);
  58230. cornerBits = (cornerBits << 3) + t;
  58231. });
  58232. // for (var side in sides) {
  58233. // // XX......X where X's are orientation marks
  58234. // var t = ((side >> (length - 2)) << 1) + (side & 1);
  58235. // cornerBits = (cornerBits << 3) + t;
  58236. // }
  58237. // Mov the bottom bit to the top, so that the three bits of the locator pattern at A are
  58238. // together. cornerBits is now:
  58239. // 3 orientation bits at A || 3 orientation bits at B || ... || 3 orientation bits at D
  58240. cornerBits = ((cornerBits & 1) << 11) + (cornerBits >> 1);
  58241. // The result shift indicates which element of BullsEyeCorners[] goes into the top-left
  58242. // corner. Since the four rotation values have a Hamming distance of 8, we
  58243. // can easily tolerate two errors.
  58244. for (var shift = 0; shift < 4; shift++) {
  58245. if (_Integer.default.bitCount(cornerBits ^ this.EXPECTED_CORNER_BITS[shift]) <= 2) {
  58246. return shift;
  58247. }
  58248. }
  58249. throw new _NotFoundException.default();
  58250. };
  58251. /**
  58252. * Corrects the parameter bits using Reed-Solomon algorithm.
  58253. *
  58254. * @param parameterData parameter bits
  58255. * @param compact true if this is a compact Aztec code
  58256. * @throws NotFoundException if the array contains too many errors
  58257. */
  58258. Detector.prototype.getCorrectedParameterData = function (parameterData, compact) {
  58259. var numCodewords;
  58260. var numDataCodewords;
  58261. if (compact) {
  58262. numCodewords = 7;
  58263. numDataCodewords = 2;
  58264. } else {
  58265. numCodewords = 10;
  58266. numDataCodewords = 4;
  58267. }
  58268. var numECCodewords = numCodewords - numDataCodewords;
  58269. var parameterWords = new Int32Array(numCodewords);
  58270. for (var i = numCodewords - 1; i >= 0; --i) {
  58271. parameterWords[i] = parameterData & 0xF;
  58272. parameterData >>= 4;
  58273. }
  58274. try {
  58275. var rsDecoder = new _ReedSolomonDecoder.default(_GenericGF.default.AZTEC_PARAM);
  58276. rsDecoder.decode(parameterWords, numECCodewords);
  58277. } catch (ignored) {
  58278. throw new _NotFoundException.default();
  58279. }
  58280. // Toss the error correction. Just return the data as an integer
  58281. var result = 0;
  58282. for (var i = 0; i < numDataCodewords; i++) {
  58283. result = (result << 4) + parameterWords[i];
  58284. }
  58285. return result;
  58286. };
  58287. /**
  58288. * Finds the corners of a bull-eye centered on the passed point.
  58289. * This returns the centers of the diagonal points just outside the bull's eye
  58290. * Returns [topRight, bottomRight, bottomLeft, topLeft]
  58291. *
  58292. * @param pCenter Center point
  58293. * @return The corners of the bull-eye
  58294. * @throws NotFoundException If no valid bull-eye can be found
  58295. */
  58296. Detector.prototype.getBullsEyeCorners = function (pCenter) {
  58297. var pina = pCenter;
  58298. var pinb = pCenter;
  58299. var pinc = pCenter;
  58300. var pind = pCenter;
  58301. var color = true;
  58302. for (this.nbCenterLayers = 1; this.nbCenterLayers < 9; this.nbCenterLayers++) {
  58303. var pouta = this.getFirstDifferent(pina, color, 1, -1);
  58304. var poutb = this.getFirstDifferent(pinb, color, 1, 1);
  58305. var poutc = this.getFirstDifferent(pinc, color, -1, 1);
  58306. var poutd = this.getFirstDifferent(pind, color, -1, -1);
  58307. // d a
  58308. //
  58309. // c b
  58310. if (this.nbCenterLayers > 2) {
  58311. var q = this.distancePoint(poutd, pouta) * this.nbCenterLayers / (this.distancePoint(pind, pina) * (this.nbCenterLayers + 2));
  58312. if (q < 0.75 || q > 1.25 || !this.isWhiteOrBlackRectangle(pouta, poutb, poutc, poutd)) {
  58313. break;
  58314. }
  58315. }
  58316. pina = pouta;
  58317. pinb = poutb;
  58318. pinc = poutc;
  58319. pind = poutd;
  58320. color = !color;
  58321. }
  58322. if (this.nbCenterLayers !== 5 && this.nbCenterLayers !== 7) {
  58323. throw new _NotFoundException.default();
  58324. }
  58325. this.compact = this.nbCenterLayers === 5;
  58326. // Expand the square by .5 pixel in each direction so that we're on the border
  58327. // between the white square and the black square
  58328. var pinax = new _ResultPoint.default(pina.getX() + 0.5, pina.getY() - 0.5);
  58329. var pinbx = new _ResultPoint.default(pinb.getX() + 0.5, pinb.getY() + 0.5);
  58330. var pincx = new _ResultPoint.default(pinc.getX() - 0.5, pinc.getY() + 0.5);
  58331. var pindx = new _ResultPoint.default(pind.getX() - 0.5, pind.getY() - 0.5);
  58332. // Expand the square so that its corners are the centers of the points
  58333. // just outside the bull's eye.
  58334. return this.expandSquare([pinax, pinbx, pincx, pindx], 2 * this.nbCenterLayers - 3, 2 * this.nbCenterLayers);
  58335. };
  58336. /**
  58337. * Finds a candidate center point of an Aztec code from an image
  58338. *
  58339. * @return the center point
  58340. */
  58341. Detector.prototype.getMatrixCenter = function () {
  58342. var pointA;
  58343. var pointB;
  58344. var pointC;
  58345. var pointD;
  58346. // Get a white rectangle that can be the border of the matrix in center bull's eye or
  58347. try {
  58348. var cornerPoints = new _WhiteRectangleDetector.default(this.image).detect();
  58349. pointA = cornerPoints[0];
  58350. pointB = cornerPoints[1];
  58351. pointC = cornerPoints[2];
  58352. pointD = cornerPoints[3];
  58353. } catch (e) {
  58354. // This exception can be in case the initial rectangle is white
  58355. // In that case, surely in the bull's eye, we try to expand the rectangle.
  58356. var cx_1 = this.image.getWidth() / 2;
  58357. var cy_1 = this.image.getHeight() / 2;
  58358. pointA = this.getFirstDifferent(new Point(cx_1 + 7, cy_1 - 7), false, 1, -1).toResultPoint();
  58359. pointB = this.getFirstDifferent(new Point(cx_1 + 7, cy_1 + 7), false, 1, 1).toResultPoint();
  58360. pointC = this.getFirstDifferent(new Point(cx_1 - 7, cy_1 + 7), false, -1, 1).toResultPoint();
  58361. pointD = this.getFirstDifferent(new Point(cx_1 - 7, cy_1 - 7), false, -1, -1).toResultPoint();
  58362. }
  58363. // Compute the center of the rectangle
  58364. var cx = _MathUtils.default.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);
  58365. var cy = _MathUtils.default.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);
  58366. // Redetermine the white rectangle starting from previously computed center.
  58367. // This will ensure that we end up with a white rectangle in center bull's eye
  58368. // in order to compute a more accurate center.
  58369. try {
  58370. var cornerPoints = new _WhiteRectangleDetector.default(this.image, 15, cx, cy).detect();
  58371. pointA = cornerPoints[0];
  58372. pointB = cornerPoints[1];
  58373. pointC = cornerPoints[2];
  58374. pointD = cornerPoints[3];
  58375. } catch (e) {
  58376. // This exception can be in case the initial rectangle is white
  58377. // In that case we try to expand the rectangle.
  58378. pointA = this.getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();
  58379. pointB = this.getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();
  58380. pointC = this.getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();
  58381. pointD = this.getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();
  58382. }
  58383. // Recompute the center of the rectangle
  58384. cx = _MathUtils.default.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);
  58385. cy = _MathUtils.default.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);
  58386. return new Point(cx, cy);
  58387. };
  58388. /**
  58389. * Gets the Aztec code corners from the bull's eye corners and the parameters.
  58390. *
  58391. * @param bullsEyeCorners the array of bull's eye corners
  58392. * @return the array of aztec code corners
  58393. */
  58394. Detector.prototype.getMatrixCornerPoints = function (bullsEyeCorners) {
  58395. return this.expandSquare(bullsEyeCorners, 2 * this.nbCenterLayers, this.getDimension());
  58396. };
  58397. /**
  58398. * Creates a BitMatrix by sampling the provided image.
  58399. * topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the
  58400. * diagonal just outside the bull's eye.
  58401. */
  58402. Detector.prototype.sampleGrid = function (image, topLeft, topRight, bottomRight, bottomLeft) {
  58403. var sampler = _GridSamplerInstance.default.getInstance();
  58404. var dimension = this.getDimension();
  58405. var low = dimension / 2 - this.nbCenterLayers;
  58406. var high = dimension / 2 + this.nbCenterLayers;
  58407. return sampler.sampleGrid(image, dimension, dimension, low, low,
  58408. // topleft
  58409. high, low,
  58410. // topright
  58411. high, high,
  58412. // bottomright
  58413. low, high,
  58414. // bottomleft
  58415. topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRight.getX(), bottomRight.getY(), bottomLeft.getX(), bottomLeft.getY());
  58416. };
  58417. /**
  58418. * Samples a line.
  58419. *
  58420. * @param p1 start point (inclusive)
  58421. * @param p2 end point (exclusive)
  58422. * @param size number of bits
  58423. * @return the array of bits as an int (first bit is high-order bit of result)
  58424. */
  58425. Detector.prototype.sampleLine = function (p1, p2, size) {
  58426. var result = 0;
  58427. var d = this.distanceResultPoint(p1, p2);
  58428. var moduleSize = d / size;
  58429. var px = p1.getX();
  58430. var py = p1.getY();
  58431. var dx = moduleSize * (p2.getX() - p1.getX()) / d;
  58432. var dy = moduleSize * (p2.getY() - p1.getY()) / d;
  58433. for (var i = 0; i < size; i++) {
  58434. if (this.image.get(_MathUtils.default.round(px + i * dx), _MathUtils.default.round(py + i * dy))) {
  58435. result |= 1 << size - i - 1;
  58436. }
  58437. }
  58438. return result;
  58439. };
  58440. /**
  58441. * @return true if the border of the rectangle passed in parameter is compound of white points only
  58442. * or black points only
  58443. */
  58444. Detector.prototype.isWhiteOrBlackRectangle = function (p1, p2, p3, p4) {
  58445. var corr = 3;
  58446. p1 = new Point(p1.getX() - corr, p1.getY() + corr);
  58447. p2 = new Point(p2.getX() - corr, p2.getY() - corr);
  58448. p3 = new Point(p3.getX() + corr, p3.getY() - corr);
  58449. p4 = new Point(p4.getX() + corr, p4.getY() + corr);
  58450. var cInit = this.getColor(p4, p1);
  58451. if (cInit === 0) {
  58452. return false;
  58453. }
  58454. var c = this.getColor(p1, p2);
  58455. if (c !== cInit) {
  58456. return false;
  58457. }
  58458. c = this.getColor(p2, p3);
  58459. if (c !== cInit) {
  58460. return false;
  58461. }
  58462. c = this.getColor(p3, p4);
  58463. return c === cInit;
  58464. };
  58465. /**
  58466. * Gets the color of a segment
  58467. *
  58468. * @return 1 if segment more than 90% black, -1 if segment is more than 90% white, 0 else
  58469. */
  58470. Detector.prototype.getColor = function (p1, p2) {
  58471. var d = this.distancePoint(p1, p2);
  58472. var dx = (p2.getX() - p1.getX()) / d;
  58473. var dy = (p2.getY() - p1.getY()) / d;
  58474. var error = 0;
  58475. var px = p1.getX();
  58476. var py = p1.getY();
  58477. var colorModel = this.image.get(p1.getX(), p1.getY());
  58478. var iMax = Math.ceil(d);
  58479. for (var i = 0; i < iMax; i++) {
  58480. px += dx;
  58481. py += dy;
  58482. if (this.image.get(_MathUtils.default.round(px), _MathUtils.default.round(py)) !== colorModel) {
  58483. error++;
  58484. }
  58485. }
  58486. var errRatio = error / d;
  58487. if (errRatio > 0.1 && errRatio < 0.9) {
  58488. return 0;
  58489. }
  58490. return errRatio <= 0.1 === colorModel ? 1 : -1;
  58491. };
  58492. /**
  58493. * Gets the coordinate of the first point with a different color in the given direction
  58494. */
  58495. Detector.prototype.getFirstDifferent = function (init, color, dx, dy) {
  58496. var x = init.getX() + dx;
  58497. var y = init.getY() + dy;
  58498. while (this.isValid(x, y) && this.image.get(x, y) === color) {
  58499. x += dx;
  58500. y += dy;
  58501. }
  58502. x -= dx;
  58503. y -= dy;
  58504. while (this.isValid(x, y) && this.image.get(x, y) === color) {
  58505. x += dx;
  58506. }
  58507. x -= dx;
  58508. while (this.isValid(x, y) && this.image.get(x, y) === color) {
  58509. y += dy;
  58510. }
  58511. y -= dy;
  58512. return new Point(x, y);
  58513. };
  58514. /**
  58515. * Expand the square represented by the corner points by pushing out equally in all directions
  58516. *
  58517. * @param cornerPoints the corners of the square, which has the bull's eye at its center
  58518. * @param oldSide the original length of the side of the square in the target bit matrix
  58519. * @param newSide the new length of the size of the square in the target bit matrix
  58520. * @return the corners of the expanded square
  58521. */
  58522. Detector.prototype.expandSquare = function (cornerPoints, oldSide, newSide) {
  58523. var ratio = newSide / (2.0 * oldSide);
  58524. var dx = cornerPoints[0].getX() - cornerPoints[2].getX();
  58525. var dy = cornerPoints[0].getY() - cornerPoints[2].getY();
  58526. var centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0;
  58527. var centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0;
  58528. var result0 = new _ResultPoint.default(centerx + ratio * dx, centery + ratio * dy);
  58529. var result2 = new _ResultPoint.default(centerx - ratio * dx, centery - ratio * dy);
  58530. dx = cornerPoints[1].getX() - cornerPoints[3].getX();
  58531. dy = cornerPoints[1].getY() - cornerPoints[3].getY();
  58532. centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0;
  58533. centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0;
  58534. var result1 = new _ResultPoint.default(centerx + ratio * dx, centery + ratio * dy);
  58535. var result3 = new _ResultPoint.default(centerx - ratio * dx, centery - ratio * dy);
  58536. var results = [result0, result1, result2, result3];
  58537. return results;
  58538. };
  58539. Detector.prototype.isValid = function (x, y) {
  58540. return x >= 0 && x < this.image.getWidth() && y > 0 && y < this.image.getHeight();
  58541. };
  58542. Detector.prototype.isValidPoint = function (point) {
  58543. var x = _MathUtils.default.round(point.getX());
  58544. var y = _MathUtils.default.round(point.getY());
  58545. return this.isValid(x, y);
  58546. };
  58547. Detector.prototype.distancePoint = function (a, b) {
  58548. return _MathUtils.default.distance(a.getX(), a.getY(), b.getX(), b.getY());
  58549. };
  58550. Detector.prototype.distanceResultPoint = function (a, b) {
  58551. return _MathUtils.default.distance(a.getX(), a.getY(), b.getX(), b.getY());
  58552. };
  58553. Detector.prototype.getDimension = function () {
  58554. if (this.compact) {
  58555. return 4 * this.nbLayers + 11;
  58556. }
  58557. if (this.nbLayers <= 4) {
  58558. return 4 * this.nbLayers + 15;
  58559. }
  58560. return 4 * this.nbLayers + 2 * (_Integer.default.truncDivision(this.nbLayers - 4, 8) + 1) + 15;
  58561. };
  58562. return Detector;
  58563. }();
  58564. var _default = Detector;
  58565. exports.default = _default;
  58566. /***/ }),
  58567. /* 346 */
  58568. /*!*******************************************************************************!*\
  58569. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ResultPoint.js ***!
  58570. \*******************************************************************************/
  58571. /*! no static exports found */
  58572. /***/ (function(module, exports, __webpack_require__) {
  58573. "use strict";
  58574. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  58575. Object.defineProperty(exports, "__esModule", {
  58576. value: true
  58577. });
  58578. exports.default = void 0;
  58579. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ./common/detector/MathUtils */ 347));
  58580. var _Float = _interopRequireDefault(__webpack_require__(/*! ./util/Float */ 348));
  58581. /*
  58582. * Copyright 2007 ZXing authors
  58583. *
  58584. * Licensed under the Apache License, Version 2.0 (the "License");
  58585. * you may not use this file except in compliance with the License.
  58586. * You may obtain a copy of the License at
  58587. *
  58588. * http://www.apache.org/licenses/LICENSE-2.0
  58589. *
  58590. * Unless required by applicable law or agreed to in writing, software
  58591. * distributed under the License is distributed on an "AS IS" BASIS,
  58592. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  58593. * See the License for the specific language governing permissions and
  58594. * limitations under the License.
  58595. */
  58596. /*namespace com.google.zxing {*/
  58597. /**
  58598. * <p>Encapsulates a point of interest in an image containing a barcode. Typically, this
  58599. * would be the location of a finder pattern or the corner of the barcode, for example.</p>
  58600. *
  58601. * @author Sean Owen
  58602. */
  58603. var ResultPoint = /** @class */function () {
  58604. function ResultPoint(x, y) {
  58605. this.x = x;
  58606. this.y = y;
  58607. }
  58608. ResultPoint.prototype.getX = function () {
  58609. return this.x;
  58610. };
  58611. ResultPoint.prototype.getY = function () {
  58612. return this.y;
  58613. };
  58614. /*@Override*/
  58615. ResultPoint.prototype.equals = function (other) {
  58616. if (other instanceof ResultPoint) {
  58617. var otherPoint = other;
  58618. return this.x === otherPoint.x && this.y === otherPoint.y;
  58619. }
  58620. return false;
  58621. };
  58622. /*@Override*/
  58623. ResultPoint.prototype.hashCode = function () {
  58624. return 31 * _Float.default.floatToIntBits(this.x) + _Float.default.floatToIntBits(this.y);
  58625. };
  58626. /*@Override*/
  58627. ResultPoint.prototype.toString = function () {
  58628. return '(' + this.x + ',' + this.y + ')';
  58629. };
  58630. /**
  58631. * Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
  58632. * and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
  58633. *
  58634. * @param patterns array of three {@code ResultPoint} to order
  58635. */
  58636. ResultPoint.orderBestPatterns = function (patterns) {
  58637. // Find distances between pattern centers
  58638. var zeroOneDistance = this.distance(patterns[0], patterns[1]);
  58639. var oneTwoDistance = this.distance(patterns[1], patterns[2]);
  58640. var zeroTwoDistance = this.distance(patterns[0], patterns[2]);
  58641. var pointA;
  58642. var pointB;
  58643. var pointC;
  58644. // Assume one closest to other two is B; A and C will just be guesses at first
  58645. if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {
  58646. pointB = patterns[0];
  58647. pointA = patterns[1];
  58648. pointC = patterns[2];
  58649. } else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {
  58650. pointB = patterns[1];
  58651. pointA = patterns[0];
  58652. pointC = patterns[2];
  58653. } else {
  58654. pointB = patterns[2];
  58655. pointA = patterns[0];
  58656. pointC = patterns[1];
  58657. }
  58658. // Use cross product to figure out whether A and C are correct or flipped.
  58659. // This asks whether BC x BA has a positive z component, which is the arrangement
  58660. // we want for A, B, C. If it's negative, then we've got it flipped around and
  58661. // should swap A and C.
  58662. if (this.crossProductZ(pointA, pointB, pointC) < 0.0) {
  58663. var temp = pointA;
  58664. pointA = pointC;
  58665. pointC = temp;
  58666. }
  58667. patterns[0] = pointA;
  58668. patterns[1] = pointB;
  58669. patterns[2] = pointC;
  58670. };
  58671. /**
  58672. * @param pattern1 first pattern
  58673. * @param pattern2 second pattern
  58674. * @return distance between two points
  58675. */
  58676. ResultPoint.distance = function (pattern1, pattern2) {
  58677. return _MathUtils.default.distance(pattern1.x, pattern1.y, pattern2.x, pattern2.y);
  58678. };
  58679. /**
  58680. * Returns the z component of the cross product between vectors BC and BA.
  58681. */
  58682. ResultPoint.crossProductZ = function (pointA, pointB, pointC) {
  58683. var bX = pointB.x;
  58684. var bY = pointB.y;
  58685. return (pointC.x - bX) * (pointA.y - bY) - (pointC.y - bY) * (pointA.x - bX);
  58686. };
  58687. return ResultPoint;
  58688. }();
  58689. var _default = ResultPoint;
  58690. exports.default = _default;
  58691. /***/ }),
  58692. /* 347 */
  58693. /*!*********************************************************************************************!*\
  58694. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/detector/MathUtils.js ***!
  58695. \*********************************************************************************************/
  58696. /*! no static exports found */
  58697. /***/ (function(module, exports, __webpack_require__) {
  58698. "use strict";
  58699. Object.defineProperty(exports, "__esModule", {
  58700. value: true
  58701. });
  58702. exports.default = void 0;
  58703. /*
  58704. * Copyright 2012 ZXing authors
  58705. *
  58706. * Licensed under the Apache License, Version 2.0 (the "License");
  58707. * you may not use this file except in compliance with the License.
  58708. * You may obtain a copy of the License at
  58709. *
  58710. * http://www.apache.org/licenses/LICENSE-2.0
  58711. *
  58712. * Unless required by applicable law or agreed to in writing, software
  58713. * distributed under the License is distributed on an "AS IS" BASIS,
  58714. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  58715. * See the License for the specific language governing permissions and
  58716. * limitations under the License.
  58717. */
  58718. /*namespace com.google.zxing.common.detector {*/
  58719. /**
  58720. * General math-related and numeric utility functions.
  58721. */
  58722. var MathUtils = /** @class */function () {
  58723. function MathUtils() {}
  58724. /**
  58725. * Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its
  58726. * argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut
  58727. * differ slightly from {@link Math#round(float)} in that half rounds down for negative
  58728. * values. -2.5 rounds to -3, not -2. For purposes here it makes no difference.
  58729. *
  58730. * @param d real value to round
  58731. * @return nearest {@code int}
  58732. */
  58733. MathUtils.round = function (d /*float*/) {
  58734. if (isNaN(d)) return 0;
  58735. if (d <= Number.MIN_SAFE_INTEGER) return Number.MIN_SAFE_INTEGER;
  58736. if (d >= Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;
  58737. return (/*(int) */d + (d < 0.0 ? -0.5 : 0.5) | 0
  58738. );
  58739. };
  58740. // TYPESCRIPTPORT: maybe remove round method and call directly Math.round, it looks like it doesn't make sense for js
  58741. /**
  58742. * @param aX point A x coordinate
  58743. * @param aY point A y coordinate
  58744. * @param bX point B x coordinate
  58745. * @param bY point B y coordinate
  58746. * @return Euclidean distance between points A and B
  58747. */
  58748. MathUtils.distance = function (aX /*float|int*/, aY /*float|int*/, bX /*float|int*/, bY /*float|int*/) {
  58749. var xDiff = aX - bX;
  58750. var yDiff = aY - bY;
  58751. return (/*(float) */Math.sqrt(xDiff * xDiff + yDiff * yDiff)
  58752. );
  58753. };
  58754. /**
  58755. * @param aX point A x coordinate
  58756. * @param aY point A y coordinate
  58757. * @param bX point B x coordinate
  58758. * @param bY point B y coordinate
  58759. * @return Euclidean distance between points A and B
  58760. */
  58761. // public static distance(aX: number /*int*/, aY: number /*int*/, bX: number /*int*/, bY: number /*int*/): float {
  58762. // const xDiff = aX - bX
  58763. // const yDiff = aY - bY
  58764. // return (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff);
  58765. // }
  58766. /**
  58767. * @param array values to sum
  58768. * @return sum of values in array
  58769. */
  58770. MathUtils.sum = function (array) {
  58771. var count = 0;
  58772. for (var i = 0, length_1 = array.length; i !== length_1; i++) {
  58773. var a = array[i];
  58774. count += a;
  58775. }
  58776. return count;
  58777. };
  58778. return MathUtils;
  58779. }();
  58780. var _default = MathUtils;
  58781. exports.default = _default;
  58782. /***/ }),
  58783. /* 348 */
  58784. /*!******************************************************************************!*\
  58785. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Float.js ***!
  58786. \******************************************************************************/
  58787. /*! no static exports found */
  58788. /***/ (function(module, exports, __webpack_require__) {
  58789. "use strict";
  58790. Object.defineProperty(exports, "__esModule", {
  58791. value: true
  58792. });
  58793. exports.default = void 0;
  58794. /**
  58795. * Ponyfill for Java's Float class.
  58796. */
  58797. var Float = /** @class */function () {
  58798. function Float() {}
  58799. /**
  58800. * SincTS has no difference between int and float, there's all numbers,
  58801. * this is used only to polyfill Java code.
  58802. */
  58803. Float.floatToIntBits = function (f) {
  58804. return f;
  58805. };
  58806. /**
  58807. * The float max value in JS is the number max value.
  58808. */
  58809. Float.MAX_VALUE = Number.MAX_SAFE_INTEGER;
  58810. return Float;
  58811. }();
  58812. var _default = Float;
  58813. exports.default = _default;
  58814. /***/ }),
  58815. /* 349 */
  58816. /*!*********************************************************************************************!*\
  58817. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/AztecDetectorResult.js ***!
  58818. \*********************************************************************************************/
  58819. /*! no static exports found */
  58820. /***/ (function(module, exports, __webpack_require__) {
  58821. "use strict";
  58822. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  58823. Object.defineProperty(exports, "__esModule", {
  58824. value: true
  58825. });
  58826. exports.default = void 0;
  58827. var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ../common/DetectorResult */ 350));
  58828. /*
  58829. * Copyright 2010 ZXing authors
  58830. *
  58831. * Licensed under the Apache License, Version 2.0 (the "License");
  58832. * you may not use this file except in compliance with the License.
  58833. * You may obtain a copy of the License at
  58834. *
  58835. * http://www.apache.org/licenses/LICENSE-2.0
  58836. *
  58837. * Unless required by applicable law or agreed to in writing, software
  58838. * distributed under the License is distributed on an "AS IS" BASIS,
  58839. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  58840. * See the License for the specific language governing permissions and
  58841. * limitations under the License.
  58842. */
  58843. var __extends = void 0 && (void 0).__extends || function () {
  58844. var _extendStatics = function extendStatics(d, b) {
  58845. _extendStatics = Object.setPrototypeOf || {
  58846. __proto__: []
  58847. } instanceof Array && function (d, b) {
  58848. d.__proto__ = b;
  58849. } || function (d, b) {
  58850. for (var p in b) {
  58851. if (b.hasOwnProperty(p)) d[p] = b[p];
  58852. }
  58853. };
  58854. return _extendStatics(d, b);
  58855. };
  58856. return function (d, b) {
  58857. _extendStatics(d, b);
  58858. function __() {
  58859. this.constructor = d;
  58860. }
  58861. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  58862. };
  58863. }();
  58864. /**
  58865. * <p>Extends {@link DetectorResult} with more information specific to the Aztec format,
  58866. * like the number of layers and whether it's compact.</p>
  58867. *
  58868. * @author Sean Owen
  58869. */
  58870. var AztecDetectorResult = /** @class */function (_super) {
  58871. __extends(AztecDetectorResult, _super);
  58872. function AztecDetectorResult(bits, points, compact, nbDatablocks, nbLayers) {
  58873. var _this = _super.call(this, bits, points) || this;
  58874. _this.compact = compact;
  58875. _this.nbDatablocks = nbDatablocks;
  58876. _this.nbLayers = nbLayers;
  58877. return _this;
  58878. }
  58879. AztecDetectorResult.prototype.getNbLayers = function () {
  58880. return this.nbLayers;
  58881. };
  58882. AztecDetectorResult.prototype.getNbDatablocks = function () {
  58883. return this.nbDatablocks;
  58884. };
  58885. AztecDetectorResult.prototype.isCompact = function () {
  58886. return this.compact;
  58887. };
  58888. return AztecDetectorResult;
  58889. }(_DetectorResult.default);
  58890. var _default = AztecDetectorResult;
  58891. exports.default = _default;
  58892. /***/ }),
  58893. /* 350 */
  58894. /*!*****************************************************************************************!*\
  58895. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/DetectorResult.js ***!
  58896. \*****************************************************************************************/
  58897. /*! no static exports found */
  58898. /***/ (function(module, exports, __webpack_require__) {
  58899. "use strict";
  58900. Object.defineProperty(exports, "__esModule", {
  58901. value: true
  58902. });
  58903. exports.default = void 0;
  58904. /*
  58905. * Copyright 2007 ZXing authors
  58906. *
  58907. * Licensed under the Apache License, Version 2.0 (the "License");
  58908. * you may not use this file except in compliance with the License.
  58909. * You may obtain a copy of the License at
  58910. *
  58911. * http://www.apache.org/licenses/LICENSE-2.0
  58912. *
  58913. * Unless required by applicable law or agreed to in writing, software
  58914. * distributed under the License is distributed on an "AS IS" BASIS,
  58915. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  58916. * See the License for the specific language governing permissions and
  58917. * limitations under the License.
  58918. */
  58919. /**
  58920. * <p>Encapsulates the result of detecting a barcode in an image. This includes the raw
  58921. * matrix of black/white pixels corresponding to the barcode, and possibly points of interest
  58922. * in the image, like the location of finder patterns or corners of the barcode in the image.</p>
  58923. *
  58924. * @author Sean Owen
  58925. */
  58926. var DetectorResult = /** @class */function () {
  58927. function DetectorResult(bits, points) {
  58928. this.bits = bits;
  58929. this.points = points;
  58930. }
  58931. DetectorResult.prototype.getBits = function () {
  58932. return this.bits;
  58933. };
  58934. DetectorResult.prototype.getPoints = function () {
  58935. return this.points;
  58936. };
  58937. return DetectorResult;
  58938. }();
  58939. var _default = DetectorResult;
  58940. exports.default = _default;
  58941. /***/ }),
  58942. /* 351 */
  58943. /*!**********************************************************************************************************!*\
  58944. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/detector/WhiteRectangleDetector.js ***!
  58945. \**********************************************************************************************************/
  58946. /*! no static exports found */
  58947. /***/ (function(module, exports, __webpack_require__) {
  58948. "use strict";
  58949. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  58950. Object.defineProperty(exports, "__esModule", {
  58951. value: true
  58952. });
  58953. exports.default = void 0;
  58954. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  58955. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ./MathUtils */ 347));
  58956. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  58957. /*
  58958. * Copyright 2010 ZXing authors
  58959. *
  58960. * Licensed under the Apache License, Version 2.0 (the "License");
  58961. * you may not use this file except in compliance with the License.
  58962. * You may obtain a copy of the License at
  58963. *
  58964. * http://www.apache.org/licenses/LICENSE-2.0
  58965. *
  58966. * Unless required by applicable law or agreed to in writing, software
  58967. * distributed under the License is distributed on an "AS IS" BASIS,
  58968. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  58969. * See the License for the specific language governing permissions and
  58970. * limitations under the License.
  58971. */
  58972. /*namespace com.google.zxing.common.detector {*/
  58973. /**
  58974. * <p>
  58975. * Detects a candidate barcode-like rectangular region within an image. It
  58976. * starts around the center of the image, increases the size of the candidate
  58977. * region until it finds a white rectangular region. By keeping track of the
  58978. * last black points it encountered, it determines the corners of the barcode.
  58979. * </p>
  58980. *
  58981. * @author David Olivier
  58982. */
  58983. var WhiteRectangleDetector = /** @class */function () {
  58984. // public constructor(private image: BitMatrix) /*throws NotFoundException*/ {
  58985. // this(image, INIT_SIZE, image.getWidth() / 2, image.getHeight() / 2)
  58986. // }
  58987. /**
  58988. * @param image barcode image to find a rectangle in
  58989. * @param initSize initial size of search area around center
  58990. * @param x x position of search center
  58991. * @param y y position of search center
  58992. * @throws NotFoundException if image is too small to accommodate {@code initSize}
  58993. */
  58994. function WhiteRectangleDetector(image, initSize /*int*/, x /*int*/, y /*int*/) {
  58995. this.image = image;
  58996. this.height = image.getHeight();
  58997. this.width = image.getWidth();
  58998. if (undefined === initSize || null === initSize) {
  58999. initSize = WhiteRectangleDetector.INIT_SIZE;
  59000. }
  59001. if (undefined === x || null === x) {
  59002. x = image.getWidth() / 2 | 0;
  59003. }
  59004. if (undefined === y || null === y) {
  59005. y = image.getHeight() / 2 | 0;
  59006. }
  59007. var halfsize = initSize / 2 | 0;
  59008. this.leftInit = x - halfsize;
  59009. this.rightInit = x + halfsize;
  59010. this.upInit = y - halfsize;
  59011. this.downInit = y + halfsize;
  59012. if (this.upInit < 0 || this.leftInit < 0 || this.downInit >= this.height || this.rightInit >= this.width) {
  59013. throw new _NotFoundException.default();
  59014. }
  59015. }
  59016. /**
  59017. * <p>
  59018. * Detects a candidate barcode-like rectangular region within an image. It
  59019. * starts around the center of the image, increases the size of the candidate
  59020. * region until it finds a white rectangular region.
  59021. * </p>
  59022. *
  59023. * @return {@link ResultPoint}[] describing the corners of the rectangular
  59024. * region. The first and last points are opposed on the diagonal, as
  59025. * are the second and third. The first point will be the topmost
  59026. * point and the last, the bottommost. The second point will be
  59027. * leftmost and the third, the rightmost
  59028. * @throws NotFoundException if no Data Matrix Code can be found
  59029. */
  59030. WhiteRectangleDetector.prototype.detect = function () {
  59031. var left = this.leftInit;
  59032. var right = this.rightInit;
  59033. var up = this.upInit;
  59034. var down = this.downInit;
  59035. var sizeExceeded = false;
  59036. var aBlackPointFoundOnBorder = true;
  59037. var atLeastOneBlackPointFoundOnBorder = false;
  59038. var atLeastOneBlackPointFoundOnRight = false;
  59039. var atLeastOneBlackPointFoundOnBottom = false;
  59040. var atLeastOneBlackPointFoundOnLeft = false;
  59041. var atLeastOneBlackPointFoundOnTop = false;
  59042. var width = this.width;
  59043. var height = this.height;
  59044. while (aBlackPointFoundOnBorder) {
  59045. aBlackPointFoundOnBorder = false;
  59046. // .....
  59047. // . |
  59048. // .....
  59049. var rightBorderNotWhite = true;
  59050. while ((rightBorderNotWhite || !atLeastOneBlackPointFoundOnRight) && right < width) {
  59051. rightBorderNotWhite = this.containsBlackPoint(up, down, right, false);
  59052. if (rightBorderNotWhite) {
  59053. right++;
  59054. aBlackPointFoundOnBorder = true;
  59055. atLeastOneBlackPointFoundOnRight = true;
  59056. } else if (!atLeastOneBlackPointFoundOnRight) {
  59057. right++;
  59058. }
  59059. }
  59060. if (right >= width) {
  59061. sizeExceeded = true;
  59062. break;
  59063. }
  59064. // .....
  59065. // . .
  59066. // .___.
  59067. var bottomBorderNotWhite = true;
  59068. while ((bottomBorderNotWhite || !atLeastOneBlackPointFoundOnBottom) && down < height) {
  59069. bottomBorderNotWhite = this.containsBlackPoint(left, right, down, true);
  59070. if (bottomBorderNotWhite) {
  59071. down++;
  59072. aBlackPointFoundOnBorder = true;
  59073. atLeastOneBlackPointFoundOnBottom = true;
  59074. } else if (!atLeastOneBlackPointFoundOnBottom) {
  59075. down++;
  59076. }
  59077. }
  59078. if (down >= height) {
  59079. sizeExceeded = true;
  59080. break;
  59081. }
  59082. // .....
  59083. // | .
  59084. // .....
  59085. var leftBorderNotWhite = true;
  59086. while ((leftBorderNotWhite || !atLeastOneBlackPointFoundOnLeft) && left >= 0) {
  59087. leftBorderNotWhite = this.containsBlackPoint(up, down, left, false);
  59088. if (leftBorderNotWhite) {
  59089. left--;
  59090. aBlackPointFoundOnBorder = true;
  59091. atLeastOneBlackPointFoundOnLeft = true;
  59092. } else if (!atLeastOneBlackPointFoundOnLeft) {
  59093. left--;
  59094. }
  59095. }
  59096. if (left < 0) {
  59097. sizeExceeded = true;
  59098. break;
  59099. }
  59100. // .___.
  59101. // . .
  59102. // .....
  59103. var topBorderNotWhite = true;
  59104. while ((topBorderNotWhite || !atLeastOneBlackPointFoundOnTop) && up >= 0) {
  59105. topBorderNotWhite = this.containsBlackPoint(left, right, up, true);
  59106. if (topBorderNotWhite) {
  59107. up--;
  59108. aBlackPointFoundOnBorder = true;
  59109. atLeastOneBlackPointFoundOnTop = true;
  59110. } else if (!atLeastOneBlackPointFoundOnTop) {
  59111. up--;
  59112. }
  59113. }
  59114. if (up < 0) {
  59115. sizeExceeded = true;
  59116. break;
  59117. }
  59118. if (aBlackPointFoundOnBorder) {
  59119. atLeastOneBlackPointFoundOnBorder = true;
  59120. }
  59121. }
  59122. if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {
  59123. var maxSize = right - left;
  59124. var z = null;
  59125. for (var i = 1; z === null && i < maxSize; i++) {
  59126. z = this.getBlackPointOnSegment(left, down - i, left + i, down);
  59127. }
  59128. if (z == null) {
  59129. throw new _NotFoundException.default();
  59130. }
  59131. var t = null;
  59132. // go down right
  59133. for (var i = 1; t === null && i < maxSize; i++) {
  59134. t = this.getBlackPointOnSegment(left, up + i, left + i, up);
  59135. }
  59136. if (t == null) {
  59137. throw new _NotFoundException.default();
  59138. }
  59139. var x = null;
  59140. // go down left
  59141. for (var i = 1; x === null && i < maxSize; i++) {
  59142. x = this.getBlackPointOnSegment(right, up + i, right - i, up);
  59143. }
  59144. if (x == null) {
  59145. throw new _NotFoundException.default();
  59146. }
  59147. var y = null;
  59148. // go up left
  59149. for (var i = 1; y === null && i < maxSize; i++) {
  59150. y = this.getBlackPointOnSegment(right, down - i, right - i, down);
  59151. }
  59152. if (y == null) {
  59153. throw new _NotFoundException.default();
  59154. }
  59155. return this.centerEdges(y, z, x, t);
  59156. } else {
  59157. throw new _NotFoundException.default();
  59158. }
  59159. };
  59160. WhiteRectangleDetector.prototype.getBlackPointOnSegment = function (aX /*float*/, aY /*float*/, bX /*float*/, bY /*float*/) {
  59161. var dist = _MathUtils.default.round(_MathUtils.default.distance(aX, aY, bX, bY));
  59162. var xStep = (bX - aX) / dist;
  59163. var yStep = (bY - aY) / dist;
  59164. var image = this.image;
  59165. for (var i = 0; i < dist; i++) {
  59166. var x = _MathUtils.default.round(aX + i * xStep);
  59167. var y = _MathUtils.default.round(aY + i * yStep);
  59168. if (image.get(x, y)) {
  59169. return new _ResultPoint.default(x, y);
  59170. }
  59171. }
  59172. return null;
  59173. };
  59174. /**
  59175. * recenters the points of a constant distance towards the center
  59176. *
  59177. * @param y bottom most point
  59178. * @param z left most point
  59179. * @param x right most point
  59180. * @param t top most point
  59181. * @return {@link ResultPoint}[] describing the corners of the rectangular
  59182. * region. The first and last points are opposed on the diagonal, as
  59183. * are the second and third. The first point will be the topmost
  59184. * point and the last, the bottommost. The second point will be
  59185. * leftmost and the third, the rightmost
  59186. */
  59187. WhiteRectangleDetector.prototype.centerEdges = function (y, z, x, t) {
  59188. //
  59189. // t t
  59190. // z x
  59191. // x OR z
  59192. // y y
  59193. //
  59194. var yi = y.getX();
  59195. var yj = y.getY();
  59196. var zi = z.getX();
  59197. var zj = z.getY();
  59198. var xi = x.getX();
  59199. var xj = x.getY();
  59200. var ti = t.getX();
  59201. var tj = t.getY();
  59202. var CORR = WhiteRectangleDetector.CORR;
  59203. if (yi < this.width / 2.0) {
  59204. return [new _ResultPoint.default(ti - CORR, tj + CORR), new _ResultPoint.default(zi + CORR, zj + CORR), new _ResultPoint.default(xi - CORR, xj - CORR), new _ResultPoint.default(yi + CORR, yj - CORR)];
  59205. } else {
  59206. return [new _ResultPoint.default(ti + CORR, tj + CORR), new _ResultPoint.default(zi + CORR, zj - CORR), new _ResultPoint.default(xi - CORR, xj + CORR), new _ResultPoint.default(yi - CORR, yj - CORR)];
  59207. }
  59208. };
  59209. /**
  59210. * Determines whether a segment contains a black point
  59211. *
  59212. * @param a min value of the scanned coordinate
  59213. * @param b max value of the scanned coordinate
  59214. * @param fixed value of fixed coordinate
  59215. * @param horizontal set to true if scan must be horizontal, false if vertical
  59216. * @return true if a black point has been found, else false.
  59217. */
  59218. WhiteRectangleDetector.prototype.containsBlackPoint = function (a /*int*/, b /*int*/, fixed /*int*/, horizontal) {
  59219. var image = this.image;
  59220. if (horizontal) {
  59221. for (var x = a; x <= b; x++) {
  59222. if (image.get(x, fixed)) {
  59223. return true;
  59224. }
  59225. }
  59226. } else {
  59227. for (var y = a; y <= b; y++) {
  59228. if (image.get(fixed, y)) {
  59229. return true;
  59230. }
  59231. }
  59232. }
  59233. return false;
  59234. };
  59235. WhiteRectangleDetector.INIT_SIZE = 10;
  59236. WhiteRectangleDetector.CORR = 1;
  59237. return WhiteRectangleDetector;
  59238. }();
  59239. var _default = WhiteRectangleDetector;
  59240. exports.default = _default;
  59241. /***/ }),
  59242. /* 352 */
  59243. /*!**********************************************************************************************!*\
  59244. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/GridSamplerInstance.js ***!
  59245. \**********************************************************************************************/
  59246. /*! no static exports found */
  59247. /***/ (function(module, exports, __webpack_require__) {
  59248. "use strict";
  59249. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  59250. Object.defineProperty(exports, "__esModule", {
  59251. value: true
  59252. });
  59253. exports.default = void 0;
  59254. var _DefaultGridSampler = _interopRequireDefault(__webpack_require__(/*! ./DefaultGridSampler */ 353));
  59255. var GridSamplerInstance = /** @class */function () {
  59256. function GridSamplerInstance() {}
  59257. /**
  59258. * Sets the implementation of GridSampler used by the library. One global
  59259. * instance is stored, which may sound problematic. But, the implementation provided
  59260. * ought to be appropriate for the entire platform, and all uses of this library
  59261. * in the whole lifetime of the JVM. For instance, an Android activity can swap in
  59262. * an implementation that takes advantage of native platform libraries.
  59263. *
  59264. * @param newGridSampler The platform-specific object to install.
  59265. */
  59266. GridSamplerInstance.setGridSampler = function (newGridSampler) {
  59267. GridSamplerInstance.gridSampler = newGridSampler;
  59268. };
  59269. /**
  59270. * @return the current implementation of GridSampler
  59271. */
  59272. GridSamplerInstance.getInstance = function () {
  59273. return GridSamplerInstance.gridSampler;
  59274. };
  59275. GridSamplerInstance.gridSampler = new _DefaultGridSampler.default();
  59276. return GridSamplerInstance;
  59277. }();
  59278. var _default = GridSamplerInstance;
  59279. exports.default = _default;
  59280. /***/ }),
  59281. /* 353 */
  59282. /*!*********************************************************************************************!*\
  59283. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/DefaultGridSampler.js ***!
  59284. \*********************************************************************************************/
  59285. /*! no static exports found */
  59286. /***/ (function(module, exports, __webpack_require__) {
  59287. "use strict";
  59288. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  59289. Object.defineProperty(exports, "__esModule", {
  59290. value: true
  59291. });
  59292. exports.default = void 0;
  59293. var _GridSampler = _interopRequireDefault(__webpack_require__(/*! ./GridSampler */ 354));
  59294. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ./BitMatrix */ 319));
  59295. var _PerspectiveTransform = _interopRequireDefault(__webpack_require__(/*! ./PerspectiveTransform */ 355));
  59296. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  59297. /*
  59298. * Copyright 2007 ZXing authors
  59299. *
  59300. * Licensed under the Apache License, Version 2.0 (the "License");
  59301. * you may not use this file except in compliance with the License.
  59302. * You may obtain a copy of the License at
  59303. *
  59304. * http://www.apache.org/licenses/LICENSE-2.0
  59305. *
  59306. * Unless required by applicable law or agreed to in writing, software
  59307. * distributed under the License is distributed on an "AS IS" BASIS,
  59308. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  59309. * See the License for the specific language governing permissions and
  59310. * limitations under the License.
  59311. */
  59312. var __extends = void 0 && (void 0).__extends || function () {
  59313. var _extendStatics = function extendStatics(d, b) {
  59314. _extendStatics = Object.setPrototypeOf || {
  59315. __proto__: []
  59316. } instanceof Array && function (d, b) {
  59317. d.__proto__ = b;
  59318. } || function (d, b) {
  59319. for (var p in b) {
  59320. if (b.hasOwnProperty(p)) d[p] = b[p];
  59321. }
  59322. };
  59323. return _extendStatics(d, b);
  59324. };
  59325. return function (d, b) {
  59326. _extendStatics(d, b);
  59327. function __() {
  59328. this.constructor = d;
  59329. }
  59330. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  59331. };
  59332. }();
  59333. /*namespace com.google.zxing.common {*/
  59334. /**
  59335. * @author Sean Owen
  59336. */
  59337. var DefaultGridSampler = /** @class */function (_super) {
  59338. __extends(DefaultGridSampler, _super);
  59339. function DefaultGridSampler() {
  59340. return _super !== null && _super.apply(this, arguments) || this;
  59341. }
  59342. /*@Override*/
  59343. DefaultGridSampler.prototype.sampleGrid = function (image, dimensionX /*int*/, dimensionY /*int*/, p1ToX /*float*/, p1ToY /*float*/, p2ToX /*float*/, p2ToY /*float*/, p3ToX /*float*/, p3ToY /*float*/, p4ToX /*float*/, p4ToY /*float*/, p1FromX /*float*/, p1FromY /*float*/, p2FromX /*float*/, p2FromY /*float*/, p3FromX /*float*/, p3FromY /*float*/, p4FromX /*float*/, p4FromY /*float*/) {
  59344. var transform = _PerspectiveTransform.default.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);
  59345. return this.sampleGridWithTransform(image, dimensionX, dimensionY, transform);
  59346. };
  59347. /*@Override*/
  59348. DefaultGridSampler.prototype.sampleGridWithTransform = function (image, dimensionX /*int*/, dimensionY /*int*/, transform) {
  59349. if (dimensionX <= 0 || dimensionY <= 0) {
  59350. throw new _NotFoundException.default();
  59351. }
  59352. var bits = new _BitMatrix.default(dimensionX, dimensionY);
  59353. var points = new Float32Array(2 * dimensionX);
  59354. for (var y = 0; y < dimensionY; y++) {
  59355. var max = points.length;
  59356. var iValue = y + 0.5;
  59357. for (var x = 0; x < max; x += 2) {
  59358. points[x] = x / 2 + 0.5;
  59359. points[x + 1] = iValue;
  59360. }
  59361. transform.transformPoints(points);
  59362. // Quick check to see if points transformed to something inside the image
  59363. // sufficient to check the endpoints
  59364. _GridSampler.default.checkAndNudgePoints(image, points);
  59365. try {
  59366. for (var x = 0; x < max; x += 2) {
  59367. if (image.get(Math.floor(points[x]), Math.floor(points[x + 1]))) {
  59368. // Black(-ish) pixel
  59369. bits.set(x / 2, y);
  59370. }
  59371. }
  59372. } catch (aioobe /*: ArrayIndexOutOfBoundsException*/) {
  59373. // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
  59374. // transform gets "twisted" such that it maps a straight line of points to a set of points
  59375. // whose endpoints are in bounds, but others are not. There is probably some mathematical
  59376. // way to detect this about the transformation that I don't know yet.
  59377. // This results in an ugly runtime exception despite our clever checks above -- can't have
  59378. // that. We could check each point's coordinates but that feels duplicative. We settle for
  59379. // catching and wrapping ArrayIndexOutOfBoundsException.
  59380. throw new _NotFoundException.default();
  59381. }
  59382. }
  59383. return bits;
  59384. };
  59385. return DefaultGridSampler;
  59386. }(_GridSampler.default);
  59387. var _default = DefaultGridSampler;
  59388. exports.default = _default;
  59389. /***/ }),
  59390. /* 354 */
  59391. /*!**************************************************************************************!*\
  59392. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/GridSampler.js ***!
  59393. \**************************************************************************************/
  59394. /*! no static exports found */
  59395. /***/ (function(module, exports, __webpack_require__) {
  59396. "use strict";
  59397. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  59398. Object.defineProperty(exports, "__esModule", {
  59399. value: true
  59400. });
  59401. exports.default = void 0;
  59402. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  59403. /*
  59404. * Copyright 2007 ZXing authors
  59405. *
  59406. * Licensed under the Apache License, Version 2.0 (the "License");
  59407. * you may not use this file except in compliance with the License.
  59408. * You may obtain a copy of the License at
  59409. *
  59410. * http://www.apache.org/licenses/LICENSE-2.0
  59411. *
  59412. * Unless required by applicable law or agreed to in writing, software
  59413. * distributed under the License is distributed on an "AS IS" BASIS,
  59414. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  59415. * See the License for the specific language governing permissions and
  59416. * limitations under the License.
  59417. */
  59418. /**
  59419. * Implementations of this class can, given locations of finder patterns for a QR code in an
  59420. * image, sample the right points in the image to reconstruct the QR code, accounting for
  59421. * perspective distortion. It is abstracted since it is relatively expensive and should be allowed
  59422. * to take advantage of platform-specific optimized implementations, like Sun's Java Advanced
  59423. * Imaging library, but which may not be available in other environments such as J2ME, and vice
  59424. * versa.
  59425. *
  59426. * The implementation used can be controlled by calling {@link #setGridSampler(GridSampler)}
  59427. * with an instance of a class which implements this interface.
  59428. *
  59429. * @author Sean Owen
  59430. */
  59431. var GridSampler = /** @class */function () {
  59432. function GridSampler() {}
  59433. /**
  59434. * <p>Checks a set of points that have been transformed to sample points on an image against
  59435. * the image's dimensions to see if the point are even within the image.</p>
  59436. *
  59437. * <p>This method will actually "nudge" the endpoints back onto the image if they are found to be
  59438. * barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder
  59439. * patterns in an image where the QR Code runs all the way to the image border.</p>
  59440. *
  59441. * <p>For efficiency, the method will check points from either end of the line until one is found
  59442. * to be within the image. Because the set of points are assumed to be linear, this is valid.</p>
  59443. *
  59444. * @param image image into which the points should map
  59445. * @param points actual points in x1,y1,...,xn,yn form
  59446. * @throws NotFoundException if an endpoint is lies outside the image boundaries
  59447. */
  59448. GridSampler.checkAndNudgePoints = function (image, points) {
  59449. var width = image.getWidth();
  59450. var height = image.getHeight();
  59451. // Check and nudge points from start until we see some that are OK:
  59452. var nudged = true;
  59453. for (var offset = 0; offset < points.length && nudged; offset += 2) {
  59454. var x = Math.floor(points[offset]);
  59455. var y = Math.floor(points[offset + 1]);
  59456. if (x < -1 || x > width || y < -1 || y > height) {
  59457. throw new _NotFoundException.default();
  59458. }
  59459. nudged = false;
  59460. if (x === -1) {
  59461. points[offset] = 0.0;
  59462. nudged = true;
  59463. } else if (x === width) {
  59464. points[offset] = width - 1;
  59465. nudged = true;
  59466. }
  59467. if (y === -1) {
  59468. points[offset + 1] = 0.0;
  59469. nudged = true;
  59470. } else if (y === height) {
  59471. points[offset + 1] = height - 1;
  59472. nudged = true;
  59473. }
  59474. }
  59475. // Check and nudge points from end:
  59476. nudged = true;
  59477. for (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2) {
  59478. var x = Math.floor(points[offset]);
  59479. var y = Math.floor(points[offset + 1]);
  59480. if (x < -1 || x > width || y < -1 || y > height) {
  59481. throw new _NotFoundException.default();
  59482. }
  59483. nudged = false;
  59484. if (x === -1) {
  59485. points[offset] = 0.0;
  59486. nudged = true;
  59487. } else if (x === width) {
  59488. points[offset] = width - 1;
  59489. nudged = true;
  59490. }
  59491. if (y === -1) {
  59492. points[offset + 1] = 0.0;
  59493. nudged = true;
  59494. } else if (y === height) {
  59495. points[offset + 1] = height - 1;
  59496. nudged = true;
  59497. }
  59498. }
  59499. };
  59500. return GridSampler;
  59501. }();
  59502. var _default = GridSampler;
  59503. exports.default = _default;
  59504. /***/ }),
  59505. /* 355 */
  59506. /*!***********************************************************************************************!*\
  59507. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/PerspectiveTransform.js ***!
  59508. \***********************************************************************************************/
  59509. /*! no static exports found */
  59510. /***/ (function(module, exports, __webpack_require__) {
  59511. "use strict";
  59512. Object.defineProperty(exports, "__esModule", {
  59513. value: true
  59514. });
  59515. exports.default = void 0;
  59516. /*
  59517. * Copyright 2007 ZXing authors
  59518. *
  59519. * Licensed under the Apache License, Version 2.0 (the "License");
  59520. * you may not use this file except in compliance with the License.
  59521. * You may obtain a copy of the License at
  59522. *
  59523. * http://www.apache.org/licenses/LICENSE-2.0
  59524. *
  59525. * Unless required by applicable law or agreed to in writing, software
  59526. * distributed under the License is distributed on an "AS IS" BASIS,
  59527. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  59528. * See the License for the specific language governing permissions and
  59529. * limitations under the License.
  59530. */
  59531. /*namespace com.google.zxing.common {*/
  59532. /**
  59533. * <p>This class implements a perspective transform in two dimensions. Given four source and four
  59534. * destination points, it will compute the transformation implied between them. The code is based
  59535. * directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.</p>
  59536. *
  59537. * @author Sean Owen
  59538. */
  59539. var PerspectiveTransform = /** @class */function () {
  59540. function PerspectiveTransform(a11 /*float*/, a21 /*float*/, a31 /*float*/, a12 /*float*/, a22 /*float*/, a32 /*float*/, a13 /*float*/, a23 /*float*/, a33 /*float*/) {
  59541. this.a11 = a11;
  59542. this.a21 = a21;
  59543. this.a31 = a31;
  59544. this.a12 = a12;
  59545. this.a22 = a22;
  59546. this.a32 = a32;
  59547. this.a13 = a13;
  59548. this.a23 = a23;
  59549. this.a33 = a33;
  59550. }
  59551. PerspectiveTransform.quadrilateralToQuadrilateral = function (x0 /*float*/, y0 /*float*/, x1 /*float*/, y1 /*float*/, x2 /*float*/, y2 /*float*/, x3 /*float*/, y3 /*float*/, x0p /*float*/, y0p /*float*/, x1p /*float*/, y1p /*float*/, x2p /*float*/, y2p /*float*/, x3p /*float*/, y3p /*float*/) {
  59552. var qToS = PerspectiveTransform.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);
  59553. var sToQ = PerspectiveTransform.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);
  59554. return sToQ.times(qToS);
  59555. };
  59556. PerspectiveTransform.prototype.transformPoints = function (points) {
  59557. var max = points.length;
  59558. var a11 = this.a11;
  59559. var a12 = this.a12;
  59560. var a13 = this.a13;
  59561. var a21 = this.a21;
  59562. var a22 = this.a22;
  59563. var a23 = this.a23;
  59564. var a31 = this.a31;
  59565. var a32 = this.a32;
  59566. var a33 = this.a33;
  59567. for (var i = 0; i < max; i += 2) {
  59568. var x = points[i];
  59569. var y = points[i + 1];
  59570. var denominator = a13 * x + a23 * y + a33;
  59571. points[i] = (a11 * x + a21 * y + a31) / denominator;
  59572. points[i + 1] = (a12 * x + a22 * y + a32) / denominator;
  59573. }
  59574. };
  59575. PerspectiveTransform.prototype.transformPointsWithValues = function (xValues, yValues) {
  59576. var a11 = this.a11;
  59577. var a12 = this.a12;
  59578. var a13 = this.a13;
  59579. var a21 = this.a21;
  59580. var a22 = this.a22;
  59581. var a23 = this.a23;
  59582. var a31 = this.a31;
  59583. var a32 = this.a32;
  59584. var a33 = this.a33;
  59585. var n = xValues.length;
  59586. for (var i = 0; i < n; i++) {
  59587. var x = xValues[i];
  59588. var y = yValues[i];
  59589. var denominator = a13 * x + a23 * y + a33;
  59590. xValues[i] = (a11 * x + a21 * y + a31) / denominator;
  59591. yValues[i] = (a12 * x + a22 * y + a32) / denominator;
  59592. }
  59593. };
  59594. PerspectiveTransform.squareToQuadrilateral = function (x0 /*float*/, y0 /*float*/, x1 /*float*/, y1 /*float*/, x2 /*float*/, y2 /*float*/, x3 /*float*/, y3 /*float*/) {
  59595. var dx3 = x0 - x1 + x2 - x3;
  59596. var dy3 = y0 - y1 + y2 - y3;
  59597. if (dx3 === 0.0 && dy3 === 0.0) {
  59598. // Affine
  59599. return new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);
  59600. } else {
  59601. var dx1 = x1 - x2;
  59602. var dx2 = x3 - x2;
  59603. var dy1 = y1 - y2;
  59604. var dy2 = y3 - y2;
  59605. var denominator = dx1 * dy2 - dx2 * dy1;
  59606. var a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
  59607. var a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
  59608. return new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);
  59609. }
  59610. };
  59611. PerspectiveTransform.quadrilateralToSquare = function (x0 /*float*/, y0 /*float*/, x1 /*float*/, y1 /*float*/, x2 /*float*/, y2 /*float*/, x3 /*float*/, y3 /*float*/) {
  59612. // Here, the adjoint serves as the inverse:
  59613. return PerspectiveTransform.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();
  59614. };
  59615. PerspectiveTransform.prototype.buildAdjoint = function () {
  59616. // Adjoint is the transpose of the cofactor matrix:
  59617. return new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);
  59618. };
  59619. PerspectiveTransform.prototype.times = function (other) {
  59620. return new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 + this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);
  59621. };
  59622. return PerspectiveTransform;
  59623. }();
  59624. var _default = PerspectiveTransform;
  59625. exports.default = _default;
  59626. /***/ }),
  59627. /* 356 */
  59628. /*!*******************************************************************************************!*\
  59629. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserBarcodeReader.js ***!
  59630. \*******************************************************************************************/
  59631. /*! no static exports found */
  59632. /***/ (function(module, exports, __webpack_require__) {
  59633. "use strict";
  59634. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  59635. Object.defineProperty(exports, "__esModule", {
  59636. value: true
  59637. });
  59638. exports.BrowserBarcodeReader = void 0;
  59639. var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
  59640. var _MultiFormatOneDReader = _interopRequireDefault(__webpack_require__(/*! ../core/oned/MultiFormatOneDReader */ 357));
  59641. var __extends = void 0 && (void 0).__extends || function () {
  59642. var _extendStatics = function extendStatics(d, b) {
  59643. _extendStatics = Object.setPrototypeOf || {
  59644. __proto__: []
  59645. } instanceof Array && function (d, b) {
  59646. d.__proto__ = b;
  59647. } || function (d, b) {
  59648. for (var p in b) {
  59649. if (b.hasOwnProperty(p)) d[p] = b[p];
  59650. }
  59651. };
  59652. return _extendStatics(d, b);
  59653. };
  59654. return function (d, b) {
  59655. _extendStatics(d, b);
  59656. function __() {
  59657. this.constructor = d;
  59658. }
  59659. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  59660. };
  59661. }();
  59662. /**
  59663. * @deprecated Moving to @zxing/browser
  59664. *
  59665. * Barcode reader reader to use from browser.
  59666. */
  59667. var BrowserBarcodeReader = /** @class */function (_super) {
  59668. __extends(BrowserBarcodeReader, _super);
  59669. /**
  59670. * Creates an instance of BrowserBarcodeReader.
  59671. * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
  59672. * @param {Map<DecodeHintType, any>} hints
  59673. */
  59674. function BrowserBarcodeReader(timeBetweenScansMillis, hints) {
  59675. if (timeBetweenScansMillis === void 0) {
  59676. timeBetweenScansMillis = 500;
  59677. }
  59678. return _super.call(this, new _MultiFormatOneDReader.default(hints), timeBetweenScansMillis, hints) || this;
  59679. }
  59680. return BrowserBarcodeReader;
  59681. }(_BrowserCodeReader.BrowserCodeReader);
  59682. exports.BrowserBarcodeReader = BrowserBarcodeReader;
  59683. /***/ }),
  59684. /* 357 */
  59685. /*!**********************************************************************************************!*\
  59686. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/MultiFormatOneDReader.js ***!
  59687. \**********************************************************************************************/
  59688. /*! no static exports found */
  59689. /***/ (function(module, exports, __webpack_require__) {
  59690. "use strict";
  59691. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  59692. Object.defineProperty(exports, "__esModule", {
  59693. value: true
  59694. });
  59695. exports.default = void 0;
  59696. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  59697. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  59698. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  59699. var _Code128Reader = _interopRequireDefault(__webpack_require__(/*! ./Code128Reader */ 358));
  59700. var _Code39Reader = _interopRequireDefault(__webpack_require__(/*! ./Code39Reader */ 360));
  59701. var _Code93Reader = _interopRequireDefault(__webpack_require__(/*! ./Code93Reader */ 361));
  59702. var _ITFReader = _interopRequireDefault(__webpack_require__(/*! ./ITFReader */ 362));
  59703. var _MultiFormatUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./MultiFormatUPCEANReader */ 363));
  59704. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  59705. var _CodaBarReader = _interopRequireDefault(__webpack_require__(/*! ./CodaBarReader */ 373));
  59706. var _RSSExpandedReader = _interopRequireDefault(__webpack_require__(/*! ./rss/expanded/RSSExpandedReader */ 374));
  59707. var _RSS14Reader = _interopRequireDefault(__webpack_require__(/*! ./rss/RSS14Reader */ 401));
  59708. /*
  59709. * Copyright 2008 ZXing authors
  59710. *
  59711. * Licensed under the Apache License, Version 2.0 (the "License");
  59712. * you may not use this file except in compliance with the License.
  59713. * You may obtain a copy of the License at
  59714. *
  59715. * http://www.apache.org/licenses/LICENSE-2.0
  59716. *
  59717. * Unless required by applicable law or agreed to in writing, software
  59718. * distributed under the License is distributed on an "AS IS" BASIS,
  59719. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  59720. * See the License for the specific language governing permissions and
  59721. * limitations under the License.
  59722. */
  59723. var __extends = void 0 && (void 0).__extends || function () {
  59724. var _extendStatics = function extendStatics(d, b) {
  59725. _extendStatics = Object.setPrototypeOf || {
  59726. __proto__: []
  59727. } instanceof Array && function (d, b) {
  59728. d.__proto__ = b;
  59729. } || function (d, b) {
  59730. for (var p in b) {
  59731. if (b.hasOwnProperty(p)) d[p] = b[p];
  59732. }
  59733. };
  59734. return _extendStatics(d, b);
  59735. };
  59736. return function (d, b) {
  59737. _extendStatics(d, b);
  59738. function __() {
  59739. this.constructor = d;
  59740. }
  59741. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  59742. };
  59743. }();
  59744. /*namespace com.google.zxing.oned {*/
  59745. /**
  59746. * @author Daniel Switkin <dswitkin@google.com>
  59747. * @author Sean Owen
  59748. */
  59749. var MultiFormatOneDReader = /** @class */function (_super) {
  59750. __extends(MultiFormatOneDReader, _super);
  59751. function MultiFormatOneDReader(hints) {
  59752. var _this = _super.call(this) || this;
  59753. _this.readers = [];
  59754. var possibleFormats = !hints ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
  59755. var useCode39CheckDigit = hints && hints.get(_DecodeHintType.default.ASSUME_CODE_39_CHECK_DIGIT) !== undefined;
  59756. var useCode39ExtendedMode = hints && hints.get(_DecodeHintType.default.ENABLE_CODE_39_EXTENDED_MODE) !== undefined;
  59757. if (possibleFormats) {
  59758. if (possibleFormats.includes(_BarcodeFormat.default.EAN_13) || possibleFormats.includes(_BarcodeFormat.default.UPC_A) || possibleFormats.includes(_BarcodeFormat.default.EAN_8) || possibleFormats.includes(_BarcodeFormat.default.UPC_E)) {
  59759. _this.readers.push(new _MultiFormatUPCEANReader.default(hints));
  59760. }
  59761. if (possibleFormats.includes(_BarcodeFormat.default.CODE_39)) {
  59762. _this.readers.push(new _Code39Reader.default(useCode39CheckDigit, useCode39ExtendedMode));
  59763. }
  59764. if (possibleFormats.includes(_BarcodeFormat.default.CODE_93)) {
  59765. _this.readers.push(new _Code93Reader.default());
  59766. }
  59767. if (possibleFormats.includes(_BarcodeFormat.default.CODE_128)) {
  59768. _this.readers.push(new _Code128Reader.default());
  59769. }
  59770. if (possibleFormats.includes(_BarcodeFormat.default.ITF)) {
  59771. _this.readers.push(new _ITFReader.default());
  59772. }
  59773. if (possibleFormats.includes(_BarcodeFormat.default.CODABAR)) {
  59774. _this.readers.push(new _CodaBarReader.default());
  59775. }
  59776. if (possibleFormats.includes(_BarcodeFormat.default.RSS_14)) {
  59777. _this.readers.push(new _RSS14Reader.default());
  59778. }
  59779. if (possibleFormats.includes(_BarcodeFormat.default.RSS_EXPANDED)) {
  59780. console.warn('RSS Expanded reader IS NOT ready for production yet! use at your own risk.');
  59781. _this.readers.push(new _RSSExpandedReader.default());
  59782. }
  59783. }
  59784. if (_this.readers.length === 0) {
  59785. _this.readers.push(new _MultiFormatUPCEANReader.default(hints));
  59786. _this.readers.push(new _Code39Reader.default());
  59787. // this.readers.push(new CodaBarReader());
  59788. _this.readers.push(new _Code93Reader.default());
  59789. _this.readers.push(new _MultiFormatUPCEANReader.default(hints));
  59790. _this.readers.push(new _Code128Reader.default());
  59791. _this.readers.push(new _ITFReader.default());
  59792. _this.readers.push(new _RSS14Reader.default());
  59793. // this.readers.push(new RSSExpandedReader());
  59794. }
  59795. return _this;
  59796. }
  59797. // @Override
  59798. MultiFormatOneDReader.prototype.decodeRow = function (rowNumber, row, hints) {
  59799. for (var i = 0; i < this.readers.length; i++) {
  59800. try {
  59801. return this.readers[i].decodeRow(rowNumber, row, hints);
  59802. } catch (re) {
  59803. // continue
  59804. }
  59805. }
  59806. throw new _NotFoundException.default();
  59807. };
  59808. // @Override
  59809. MultiFormatOneDReader.prototype.reset = function () {
  59810. this.readers.forEach(function (reader) {
  59811. return reader.reset();
  59812. });
  59813. };
  59814. return MultiFormatOneDReader;
  59815. }(_OneDReader.default);
  59816. var _default = MultiFormatOneDReader;
  59817. exports.default = _default;
  59818. /***/ }),
  59819. /* 358 */
  59820. /*!**************************************************************************************!*\
  59821. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/Code128Reader.js ***!
  59822. \**************************************************************************************/
  59823. /*! no static exports found */
  59824. /***/ (function(module, exports, __webpack_require__) {
  59825. "use strict";
  59826. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  59827. Object.defineProperty(exports, "__esModule", {
  59828. value: true
  59829. });
  59830. exports.default = void 0;
  59831. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  59832. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
  59833. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  59834. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  59835. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  59836. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  59837. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  59838. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  59839. /*
  59840. * Copyright 2008 ZXing authors
  59841. *
  59842. * Licensed under the Apache License, Version 2.0 (the "License");
  59843. * you may not use this file except in compliance with the License.
  59844. * You may obtain a copy of the License at
  59845. *
  59846. * http://www.apache.org/licenses/LICENSE-2.0
  59847. *
  59848. * Unless required by applicable law or agreed to in writing, software
  59849. * distributed under the License is distributed on an "AS IS" BASIS,
  59850. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  59851. * See the License for the specific language governing permissions and
  59852. * limitations under the License.
  59853. */
  59854. var __extends = void 0 && (void 0).__extends || function () {
  59855. var _extendStatics = function extendStatics(d, b) {
  59856. _extendStatics = Object.setPrototypeOf || {
  59857. __proto__: []
  59858. } instanceof Array && function (d, b) {
  59859. d.__proto__ = b;
  59860. } || function (d, b) {
  59861. for (var p in b) {
  59862. if (b.hasOwnProperty(p)) d[p] = b[p];
  59863. }
  59864. };
  59865. return _extendStatics(d, b);
  59866. };
  59867. return function (d, b) {
  59868. _extendStatics(d, b);
  59869. function __() {
  59870. this.constructor = d;
  59871. }
  59872. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  59873. };
  59874. }();
  59875. /*namespace com.google.zxing.oned {*/
  59876. /**
  59877. * <p>Decodes Code 128 barcodes.</p>
  59878. *
  59879. * @author Sean Owen
  59880. */
  59881. var Code128Reader = /** @class */function (_super) {
  59882. __extends(Code128Reader, _super);
  59883. function Code128Reader() {
  59884. return _super !== null && _super.apply(this, arguments) || this;
  59885. }
  59886. Code128Reader.findStartPattern = function (row) {
  59887. var width = row.getSize();
  59888. var rowOffset = row.getNextSet(0);
  59889. var counterPosition = 0;
  59890. var counters = Int32Array.from([0, 0, 0, 0, 0, 0]);
  59891. var patternStart = rowOffset;
  59892. var isWhite = false;
  59893. var patternLength = 6;
  59894. for (var i = rowOffset; i < width; i++) {
  59895. if (row.get(i) !== isWhite) {
  59896. counters[counterPosition]++;
  59897. } else {
  59898. if (counterPosition === patternLength - 1) {
  59899. var bestVariance = Code128Reader.MAX_AVG_VARIANCE;
  59900. var bestMatch = -1;
  59901. for (var startCode = Code128Reader.CODE_START_A; startCode <= Code128Reader.CODE_START_C; startCode++) {
  59902. var variance = _OneDReader.default.patternMatchVariance(counters, Code128Reader.CODE_PATTERNS[startCode], Code128Reader.MAX_INDIVIDUAL_VARIANCE);
  59903. if (variance < bestVariance) {
  59904. bestVariance = variance;
  59905. bestMatch = startCode;
  59906. }
  59907. }
  59908. // Look for whitespace before start pattern, >= 50% of width of start pattern
  59909. if (bestMatch >= 0 && row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
  59910. return Int32Array.from([patternStart, i, bestMatch]);
  59911. }
  59912. patternStart += counters[0] + counters[1];
  59913. counters = counters.slice(2, counters.length);
  59914. counters[counterPosition - 1] = 0;
  59915. counters[counterPosition] = 0;
  59916. counterPosition--;
  59917. } else {
  59918. counterPosition++;
  59919. }
  59920. counters[counterPosition] = 1;
  59921. isWhite = !isWhite;
  59922. }
  59923. }
  59924. throw new _NotFoundException.default();
  59925. };
  59926. Code128Reader.decodeCode = function (row, counters, rowOffset) {
  59927. _OneDReader.default.recordPattern(row, rowOffset, counters);
  59928. var bestVariance = Code128Reader.MAX_AVG_VARIANCE; // worst variance we'll accept
  59929. var bestMatch = -1;
  59930. for (var d = 0; d < Code128Reader.CODE_PATTERNS.length; d++) {
  59931. var pattern = Code128Reader.CODE_PATTERNS[d];
  59932. var variance = this.patternMatchVariance(counters, pattern, Code128Reader.MAX_INDIVIDUAL_VARIANCE);
  59933. if (variance < bestVariance) {
  59934. bestVariance = variance;
  59935. bestMatch = d;
  59936. }
  59937. }
  59938. // TODO We're overlooking the fact that the STOP pattern has 7 values, not 6.
  59939. if (bestMatch >= 0) {
  59940. return bestMatch;
  59941. } else {
  59942. throw new _NotFoundException.default();
  59943. }
  59944. };
  59945. Code128Reader.prototype.decodeRow = function (rowNumber, row, hints) {
  59946. var convertFNC1 = hints && hints.get(_DecodeHintType.default.ASSUME_GS1) === true;
  59947. var startPatternInfo = Code128Reader.findStartPattern(row);
  59948. var startCode = startPatternInfo[2];
  59949. var currentRawCodesIndex = 0;
  59950. var rawCodes = new Uint8Array(20);
  59951. rawCodes[currentRawCodesIndex++] = startCode;
  59952. var codeSet;
  59953. switch (startCode) {
  59954. case Code128Reader.CODE_START_A:
  59955. codeSet = Code128Reader.CODE_CODE_A;
  59956. break;
  59957. case Code128Reader.CODE_START_B:
  59958. codeSet = Code128Reader.CODE_CODE_B;
  59959. break;
  59960. case Code128Reader.CODE_START_C:
  59961. codeSet = Code128Reader.CODE_CODE_C;
  59962. break;
  59963. default:
  59964. throw new _FormatException.default();
  59965. }
  59966. var done = false;
  59967. var isNextShifted = false;
  59968. var result = '';
  59969. var lastStart = startPatternInfo[0];
  59970. var nextStart = startPatternInfo[1];
  59971. var counters = Int32Array.from([0, 0, 0, 0, 0, 0]);
  59972. var lastCode = 0;
  59973. var code = 0;
  59974. var checksumTotal = startCode;
  59975. var multiplier = 0;
  59976. var lastCharacterWasPrintable = true;
  59977. var upperMode = false;
  59978. var shiftUpperMode = false;
  59979. while (!done) {
  59980. var unshift = isNextShifted;
  59981. isNextShifted = false;
  59982. // Save off last code
  59983. lastCode = code;
  59984. // Decode another code from image
  59985. code = Code128Reader.decodeCode(row, counters, nextStart);
  59986. rawCodes[currentRawCodesIndex++] = code;
  59987. // Remember whether the last code was printable or not (excluding CODE_STOP)
  59988. if (code !== Code128Reader.CODE_STOP) {
  59989. lastCharacterWasPrintable = true;
  59990. }
  59991. // Add to checksum computation (if not CODE_STOP of course)
  59992. if (code !== Code128Reader.CODE_STOP) {
  59993. multiplier++;
  59994. checksumTotal += multiplier * code;
  59995. }
  59996. // Advance to where the next code will to start
  59997. lastStart = nextStart;
  59998. nextStart += counters.reduce(function (previous, current) {
  59999. return previous + current;
  60000. }, 0);
  60001. // Take care of illegal start codes
  60002. switch (code) {
  60003. case Code128Reader.CODE_START_A:
  60004. case Code128Reader.CODE_START_B:
  60005. case Code128Reader.CODE_START_C:
  60006. throw new _FormatException.default();
  60007. }
  60008. switch (codeSet) {
  60009. case Code128Reader.CODE_CODE_A:
  60010. if (code < 64) {
  60011. if (shiftUpperMode === upperMode) {
  60012. result += String.fromCharCode(' '.charCodeAt(0) + code);
  60013. } else {
  60014. result += String.fromCharCode(' '.charCodeAt(0) + code + 128);
  60015. }
  60016. shiftUpperMode = false;
  60017. } else if (code < 96) {
  60018. if (shiftUpperMode === upperMode) {
  60019. result += String.fromCharCode(code - 64);
  60020. } else {
  60021. result += String.fromCharCode(code + 64);
  60022. }
  60023. shiftUpperMode = false;
  60024. } else {
  60025. // Don't let CODE_STOP, which always appears, affect whether whether we think the last
  60026. // code was printable or not.
  60027. if (code !== Code128Reader.CODE_STOP) {
  60028. lastCharacterWasPrintable = false;
  60029. }
  60030. switch (code) {
  60031. case Code128Reader.CODE_FNC_1:
  60032. if (convertFNC1) {
  60033. if (result.length === 0) {
  60034. // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
  60035. // is FNC1 then this is GS1-128. We add the symbology identifier.
  60036. result += ']C1';
  60037. } else {
  60038. // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
  60039. result += String.fromCharCode(29);
  60040. }
  60041. }
  60042. break;
  60043. case Code128Reader.CODE_FNC_2:
  60044. case Code128Reader.CODE_FNC_3:
  60045. // do nothing?
  60046. break;
  60047. case Code128Reader.CODE_FNC_4_A:
  60048. if (!upperMode && shiftUpperMode) {
  60049. upperMode = true;
  60050. shiftUpperMode = false;
  60051. } else if (upperMode && shiftUpperMode) {
  60052. upperMode = false;
  60053. shiftUpperMode = false;
  60054. } else {
  60055. shiftUpperMode = true;
  60056. }
  60057. break;
  60058. case Code128Reader.CODE_SHIFT:
  60059. isNextShifted = true;
  60060. codeSet = Code128Reader.CODE_CODE_B;
  60061. break;
  60062. case Code128Reader.CODE_CODE_B:
  60063. codeSet = Code128Reader.CODE_CODE_B;
  60064. break;
  60065. case Code128Reader.CODE_CODE_C:
  60066. codeSet = Code128Reader.CODE_CODE_C;
  60067. break;
  60068. case Code128Reader.CODE_STOP:
  60069. done = true;
  60070. break;
  60071. }
  60072. }
  60073. break;
  60074. case Code128Reader.CODE_CODE_B:
  60075. if (code < 96) {
  60076. if (shiftUpperMode === upperMode) {
  60077. result += String.fromCharCode(' '.charCodeAt(0) + code);
  60078. } else {
  60079. result += String.fromCharCode(' '.charCodeAt(0) + code + 128);
  60080. }
  60081. shiftUpperMode = false;
  60082. } else {
  60083. if (code !== Code128Reader.CODE_STOP) {
  60084. lastCharacterWasPrintable = false;
  60085. }
  60086. switch (code) {
  60087. case Code128Reader.CODE_FNC_1:
  60088. if (convertFNC1) {
  60089. if (result.length === 0) {
  60090. // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
  60091. // is FNC1 then this is GS1-128. We add the symbology identifier.
  60092. result += ']C1';
  60093. } else {
  60094. // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
  60095. result += String.fromCharCode(29);
  60096. }
  60097. }
  60098. break;
  60099. case Code128Reader.CODE_FNC_2:
  60100. case Code128Reader.CODE_FNC_3:
  60101. // do nothing?
  60102. break;
  60103. case Code128Reader.CODE_FNC_4_B:
  60104. if (!upperMode && shiftUpperMode) {
  60105. upperMode = true;
  60106. shiftUpperMode = false;
  60107. } else if (upperMode && shiftUpperMode) {
  60108. upperMode = false;
  60109. shiftUpperMode = false;
  60110. } else {
  60111. shiftUpperMode = true;
  60112. }
  60113. break;
  60114. case Code128Reader.CODE_SHIFT:
  60115. isNextShifted = true;
  60116. codeSet = Code128Reader.CODE_CODE_A;
  60117. break;
  60118. case Code128Reader.CODE_CODE_A:
  60119. codeSet = Code128Reader.CODE_CODE_A;
  60120. break;
  60121. case Code128Reader.CODE_CODE_C:
  60122. codeSet = Code128Reader.CODE_CODE_C;
  60123. break;
  60124. case Code128Reader.CODE_STOP:
  60125. done = true;
  60126. break;
  60127. }
  60128. }
  60129. break;
  60130. case Code128Reader.CODE_CODE_C:
  60131. if (code < 100) {
  60132. if (code < 10) {
  60133. result += '0';
  60134. }
  60135. result += code;
  60136. } else {
  60137. if (code !== Code128Reader.CODE_STOP) {
  60138. lastCharacterWasPrintable = false;
  60139. }
  60140. switch (code) {
  60141. case Code128Reader.CODE_FNC_1:
  60142. if (convertFNC1) {
  60143. if (result.length === 0) {
  60144. // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
  60145. // is FNC1 then this is GS1-128. We add the symbology identifier.
  60146. result += ']C1';
  60147. } else {
  60148. // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
  60149. result += String.fromCharCode(29);
  60150. }
  60151. }
  60152. break;
  60153. case Code128Reader.CODE_CODE_A:
  60154. codeSet = Code128Reader.CODE_CODE_A;
  60155. break;
  60156. case Code128Reader.CODE_CODE_B:
  60157. codeSet = Code128Reader.CODE_CODE_B;
  60158. break;
  60159. case Code128Reader.CODE_STOP:
  60160. done = true;
  60161. break;
  60162. }
  60163. }
  60164. break;
  60165. }
  60166. // Unshift back to another code set if we were shifted
  60167. if (unshift) {
  60168. codeSet = codeSet === Code128Reader.CODE_CODE_A ? Code128Reader.CODE_CODE_B : Code128Reader.CODE_CODE_A;
  60169. }
  60170. }
  60171. var lastPatternSize = nextStart - lastStart;
  60172. // Check for ample whitespace following pattern, but, to do this we first need to remember that
  60173. // we fudged decoding CODE_STOP since it actually has 7 bars, not 6. There is a black bar left
  60174. // to read off. Would be slightly better to properly read. Here we just skip it:
  60175. nextStart = row.getNextUnset(nextStart);
  60176. if (!row.isRange(nextStart, Math.min(row.getSize(), nextStart + (nextStart - lastStart) / 2), false)) {
  60177. throw new _NotFoundException.default();
  60178. }
  60179. // Pull out from sum the value of the penultimate check code
  60180. checksumTotal -= multiplier * lastCode;
  60181. // lastCode is the checksum then:
  60182. if (checksumTotal % 103 !== lastCode) {
  60183. throw new _ChecksumException.default();
  60184. }
  60185. // Need to pull out the check digits from string
  60186. var resultLength = result.length;
  60187. if (resultLength === 0) {
  60188. // false positive
  60189. throw new _NotFoundException.default();
  60190. }
  60191. // Only bother if the result had at least one character, and if the checksum digit happened to
  60192. // be a printable character. If it was just interpreted as a control code, nothing to remove.
  60193. if (resultLength > 0 && lastCharacterWasPrintable) {
  60194. if (codeSet === Code128Reader.CODE_CODE_C) {
  60195. result = result.substring(0, resultLength - 2);
  60196. } else {
  60197. result = result.substring(0, resultLength - 1);
  60198. }
  60199. }
  60200. var left = (startPatternInfo[1] + startPatternInfo[0]) / 2.0;
  60201. var right = lastStart + lastPatternSize / 2.0;
  60202. var rawCodesSize = rawCodes.length;
  60203. var rawBytes = new Uint8Array(rawCodesSize);
  60204. for (var i = 0; i < rawCodesSize; i++) {
  60205. rawBytes[i] = rawCodes[i];
  60206. }
  60207. var points = [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)];
  60208. return new _Result.default(result, rawBytes, 0, points, _BarcodeFormat.default.CODE_128, new Date().getTime());
  60209. };
  60210. Code128Reader.CODE_PATTERNS = [Int32Array.from([2, 1, 2, 2, 2, 2]), Int32Array.from([2, 2, 2, 1, 2, 2]), Int32Array.from([2, 2, 2, 2, 2, 1]), Int32Array.from([1, 2, 1, 2, 2, 3]), Int32Array.from([1, 2, 1, 3, 2, 2]), Int32Array.from([1, 3, 1, 2, 2, 2]), Int32Array.from([1, 2, 2, 2, 1, 3]), Int32Array.from([1, 2, 2, 3, 1, 2]), Int32Array.from([1, 3, 2, 2, 1, 2]), Int32Array.from([2, 2, 1, 2, 1, 3]), Int32Array.from([2, 2, 1, 3, 1, 2]), Int32Array.from([2, 3, 1, 2, 1, 2]), Int32Array.from([1, 1, 2, 2, 3, 2]), Int32Array.from([1, 2, 2, 1, 3, 2]), Int32Array.from([1, 2, 2, 2, 3, 1]), Int32Array.from([1, 1, 3, 2, 2, 2]), Int32Array.from([1, 2, 3, 1, 2, 2]), Int32Array.from([1, 2, 3, 2, 2, 1]), Int32Array.from([2, 2, 3, 2, 1, 1]), Int32Array.from([2, 2, 1, 1, 3, 2]), Int32Array.from([2, 2, 1, 2, 3, 1]), Int32Array.from([2, 1, 3, 2, 1, 2]), Int32Array.from([2, 2, 3, 1, 1, 2]), Int32Array.from([3, 1, 2, 1, 3, 1]), Int32Array.from([3, 1, 1, 2, 2, 2]), Int32Array.from([3, 2, 1, 1, 2, 2]), Int32Array.from([3, 2, 1, 2, 2, 1]), Int32Array.from([3, 1, 2, 2, 1, 2]), Int32Array.from([3, 2, 2, 1, 1, 2]), Int32Array.from([3, 2, 2, 2, 1, 1]), Int32Array.from([2, 1, 2, 1, 2, 3]), Int32Array.from([2, 1, 2, 3, 2, 1]), Int32Array.from([2, 3, 2, 1, 2, 1]), Int32Array.from([1, 1, 1, 3, 2, 3]), Int32Array.from([1, 3, 1, 1, 2, 3]), Int32Array.from([1, 3, 1, 3, 2, 1]), Int32Array.from([1, 1, 2, 3, 1, 3]), Int32Array.from([1, 3, 2, 1, 1, 3]), Int32Array.from([1, 3, 2, 3, 1, 1]), Int32Array.from([2, 1, 1, 3, 1, 3]), Int32Array.from([2, 3, 1, 1, 1, 3]), Int32Array.from([2, 3, 1, 3, 1, 1]), Int32Array.from([1, 1, 2, 1, 3, 3]), Int32Array.from([1, 1, 2, 3, 3, 1]), Int32Array.from([1, 3, 2, 1, 3, 1]), Int32Array.from([1, 1, 3, 1, 2, 3]), Int32Array.from([1, 1, 3, 3, 2, 1]), Int32Array.from([1, 3, 3, 1, 2, 1]), Int32Array.from([3, 1, 3, 1, 2, 1]), Int32Array.from([2, 1, 1, 3, 3, 1]), Int32Array.from([2, 3, 1, 1, 3, 1]), Int32Array.from([2, 1, 3, 1, 1, 3]), Int32Array.from([2, 1, 3, 3, 1, 1]), Int32Array.from([2, 1, 3, 1, 3, 1]), Int32Array.from([3, 1, 1, 1, 2, 3]), Int32Array.from([3, 1, 1, 3, 2, 1]), Int32Array.from([3, 3, 1, 1, 2, 1]), Int32Array.from([3, 1, 2, 1, 1, 3]), Int32Array.from([3, 1, 2, 3, 1, 1]), Int32Array.from([3, 3, 2, 1, 1, 1]), Int32Array.from([3, 1, 4, 1, 1, 1]), Int32Array.from([2, 2, 1, 4, 1, 1]), Int32Array.from([4, 3, 1, 1, 1, 1]), Int32Array.from([1, 1, 1, 2, 2, 4]), Int32Array.from([1, 1, 1, 4, 2, 2]), Int32Array.from([1, 2, 1, 1, 2, 4]), Int32Array.from([1, 2, 1, 4, 2, 1]), Int32Array.from([1, 4, 1, 1, 2, 2]), Int32Array.from([1, 4, 1, 2, 2, 1]), Int32Array.from([1, 1, 2, 2, 1, 4]), Int32Array.from([1, 1, 2, 4, 1, 2]), Int32Array.from([1, 2, 2, 1, 1, 4]), Int32Array.from([1, 2, 2, 4, 1, 1]), Int32Array.from([1, 4, 2, 1, 1, 2]), Int32Array.from([1, 4, 2, 2, 1, 1]), Int32Array.from([2, 4, 1, 2, 1, 1]), Int32Array.from([2, 2, 1, 1, 1, 4]), Int32Array.from([4, 1, 3, 1, 1, 1]), Int32Array.from([2, 4, 1, 1, 1, 2]), Int32Array.from([1, 3, 4, 1, 1, 1]), Int32Array.from([1, 1, 1, 2, 4, 2]), Int32Array.from([1, 2, 1, 1, 4, 2]), Int32Array.from([1, 2, 1, 2, 4, 1]), Int32Array.from([1, 1, 4, 2, 1, 2]), Int32Array.from([1, 2, 4, 1, 1, 2]), Int32Array.from([1, 2, 4, 2, 1, 1]), Int32Array.from([4, 1, 1, 2, 1, 2]), Int32Array.from([4, 2, 1, 1, 1, 2]), Int32Array.from([4, 2, 1, 2, 1, 1]), Int32Array.from([2, 1, 2, 1, 4, 1]), Int32Array.from([2, 1, 4, 1, 2, 1]), Int32Array.from([4, 1, 2, 1, 2, 1]), Int32Array.from([1, 1, 1, 1, 4, 3]), Int32Array.from([1, 1, 1, 3, 4, 1]), Int32Array.from([1, 3, 1, 1, 4, 1]), Int32Array.from([1, 1, 4, 1, 1, 3]), Int32Array.from([1, 1, 4, 3, 1, 1]), Int32Array.from([4, 1, 1, 1, 1, 3]), Int32Array.from([4, 1, 1, 3, 1, 1]), Int32Array.from([1, 1, 3, 1, 4, 1]), Int32Array.from([1, 1, 4, 1, 3, 1]), Int32Array.from([3, 1, 1, 1, 4, 1]), Int32Array.from([4, 1, 1, 1, 3, 1]), Int32Array.from([2, 1, 1, 4, 1, 2]), Int32Array.from([2, 1, 1, 2, 1, 4]), Int32Array.from([2, 1, 1, 2, 3, 2]), Int32Array.from([2, 3, 3, 1, 1, 1, 2])];
  60211. Code128Reader.MAX_AVG_VARIANCE = 0.25;
  60212. Code128Reader.MAX_INDIVIDUAL_VARIANCE = 0.7;
  60213. Code128Reader.CODE_SHIFT = 98;
  60214. Code128Reader.CODE_CODE_C = 99;
  60215. Code128Reader.CODE_CODE_B = 100;
  60216. Code128Reader.CODE_CODE_A = 101;
  60217. Code128Reader.CODE_FNC_1 = 102;
  60218. Code128Reader.CODE_FNC_2 = 97;
  60219. Code128Reader.CODE_FNC_3 = 96;
  60220. Code128Reader.CODE_FNC_4_A = 101;
  60221. Code128Reader.CODE_FNC_4_B = 100;
  60222. Code128Reader.CODE_START_A = 103;
  60223. Code128Reader.CODE_START_B = 104;
  60224. Code128Reader.CODE_START_C = 105;
  60225. Code128Reader.CODE_STOP = 106;
  60226. return Code128Reader;
  60227. }(_OneDReader.default);
  60228. var _default = Code128Reader;
  60229. exports.default = _default;
  60230. /***/ }),
  60231. /* 359 */
  60232. /*!***********************************************************************************!*\
  60233. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/OneDReader.js ***!
  60234. \***********************************************************************************/
  60235. /*! no static exports found */
  60236. /***/ (function(module, exports, __webpack_require__) {
  60237. "use strict";
  60238. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  60239. Object.defineProperty(exports, "__esModule", {
  60240. value: true
  60241. });
  60242. exports.default = void 0;
  60243. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  60244. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../common/BitArray */ 313));
  60245. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  60246. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  60247. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  60248. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  60249. /*
  60250. * Copyright 2008 ZXing authors
  60251. *
  60252. * Licensed under the Apache License, Version 2.0 (the "License");
  60253. * you may not use this file except in compliance with the License.
  60254. * You may obtain a copy of the License at
  60255. *
  60256. * http://www.apache.org/licenses/LICENSE-2.0
  60257. *
  60258. * Unless required by applicable law or agreed to in writing, software
  60259. * distributed under the License is distributed on an "AS IS" BASIS,
  60260. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  60261. * See the License for the specific language governing permissions and
  60262. * limitations under the License.
  60263. */
  60264. /**
  60265. * Encapsulates functionality and implementation that is common to all families
  60266. * of one-dimensional barcodes.
  60267. *
  60268. * @author dswitkin@google.com (Daniel Switkin)
  60269. * @author Sean Owen
  60270. */
  60271. var OneDReader = /** @class */function () {
  60272. function OneDReader() {}
  60273. /*
  60274. @Override
  60275. public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
  60276. return decode(image, null);
  60277. }
  60278. */
  60279. // Note that we don't try rotation without the try harder flag, even if rotation was supported.
  60280. // @Override
  60281. OneDReader.prototype.decode = function (image, hints) {
  60282. try {
  60283. return this.doDecode(image, hints);
  60284. } catch (nfe) {
  60285. var tryHarder = hints && hints.get(_DecodeHintType.default.TRY_HARDER) === true;
  60286. if (tryHarder && image.isRotateSupported()) {
  60287. var rotatedImage = image.rotateCounterClockwise();
  60288. var result = this.doDecode(rotatedImage, hints);
  60289. // Record that we found it rotated 90 degrees CCW / 270 degrees CW
  60290. var metadata = result.getResultMetadata();
  60291. var orientation_1 = 270;
  60292. if (metadata !== null && metadata.get(_ResultMetadataType.default.ORIENTATION) === true) {
  60293. // But if we found it reversed in doDecode(), add in that result here:
  60294. orientation_1 = orientation_1 + metadata.get(_ResultMetadataType.default.ORIENTATION) % 360;
  60295. }
  60296. result.putMetadata(_ResultMetadataType.default.ORIENTATION, orientation_1);
  60297. // Update result points
  60298. var points = result.getResultPoints();
  60299. if (points !== null) {
  60300. var height = rotatedImage.getHeight();
  60301. for (var i = 0; i < points.length; i++) {
  60302. points[i] = new _ResultPoint.default(height - points[i].getY() - 1, points[i].getX());
  60303. }
  60304. }
  60305. return result;
  60306. } else {
  60307. throw new _NotFoundException.default();
  60308. }
  60309. }
  60310. };
  60311. // @Override
  60312. OneDReader.prototype.reset = function () {
  60313. // do nothing
  60314. };
  60315. /**
  60316. * We're going to examine rows from the middle outward, searching alternately above and below the
  60317. * middle, and farther out each time. rowStep is the number of rows between each successive
  60318. * attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then
  60319. * middle + rowStep, then middle - (2 * rowStep), etc.
  60320. * rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily
  60321. * decided that moving up and down by about 1/16 of the image is pretty good; we try more of the
  60322. * image if "trying harder".
  60323. *
  60324. * @param image The image to decode
  60325. * @param hints Any hints that were requested
  60326. * @return The contents of the decoded barcode
  60327. * @throws NotFoundException Any spontaneous errors which occur
  60328. */
  60329. OneDReader.prototype.doDecode = function (image, hints) {
  60330. var width = image.getWidth();
  60331. var height = image.getHeight();
  60332. var row = new _BitArray.default(width);
  60333. var tryHarder = hints && hints.get(_DecodeHintType.default.TRY_HARDER) === true;
  60334. var rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
  60335. var maxLines;
  60336. if (tryHarder) {
  60337. maxLines = height; // Look at the whole image, not just the center
  60338. } else {
  60339. maxLines = 15; // 15 rows spaced 1/32 apart is roughly the middle half of the image
  60340. }
  60341. var middle = Math.trunc(height / 2);
  60342. for (var x = 0; x < maxLines; x++) {
  60343. // Scanning from the middle out. Determine which row we're looking at next:
  60344. var rowStepsAboveOrBelow = Math.trunc((x + 1) / 2);
  60345. var isAbove = (x & 0x01) === 0; // i.e. is x even?
  60346. var rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
  60347. if (rowNumber < 0 || rowNumber >= height) {
  60348. // Oops, if we run off the top or bottom, stop
  60349. break;
  60350. }
  60351. // Estimate black point for this row and load it:
  60352. try {
  60353. row = image.getBlackRow(rowNumber, row);
  60354. } catch (ignored) {
  60355. continue;
  60356. }
  60357. var _loop_1 = function _loop_1(attempt) {
  60358. if (attempt === 1) {
  60359. // trying again?
  60360. row.reverse(); // reverse the row and continue
  60361. // This means we will only ever draw result points *once* in the life of this method
  60362. // since we want to avoid drawing the wrong points after flipping the row, and,
  60363. // don't want to clutter with noise from every single row scan -- just the scans
  60364. // that start on the center line.
  60365. if (hints && hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK) === true) {
  60366. var newHints_1 = new Map();
  60367. hints.forEach(function (hint, key) {
  60368. return newHints_1.set(key, hint);
  60369. });
  60370. newHints_1.delete(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
  60371. hints = newHints_1;
  60372. }
  60373. }
  60374. try {
  60375. // Look for a barcode
  60376. var result = this_1.decodeRow(rowNumber, row, hints);
  60377. // We found our barcode
  60378. if (attempt === 1) {
  60379. // But it was upside down, so note that
  60380. result.putMetadata(_ResultMetadataType.default.ORIENTATION, 180);
  60381. // And remember to flip the result points horizontally.
  60382. var points = result.getResultPoints();
  60383. if (points !== null) {
  60384. points[0] = new _ResultPoint.default(width - points[0].getX() - 1, points[0].getY());
  60385. points[1] = new _ResultPoint.default(width - points[1].getX() - 1, points[1].getY());
  60386. }
  60387. }
  60388. return {
  60389. value: result
  60390. };
  60391. } catch (re) {
  60392. // continue -- just couldn't decode this row
  60393. }
  60394. };
  60395. var this_1 = this;
  60396. // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
  60397. // handle decoding upside down barcodes.
  60398. for (var attempt = 0; attempt < 2; attempt++) {
  60399. var state_1 = _loop_1(attempt);
  60400. if ((0, _typeof2.default)(state_1) === "object") return state_1.value;
  60401. }
  60402. }
  60403. throw new _NotFoundException.default();
  60404. };
  60405. /**
  60406. * Records the size of successive runs of white and black pixels in a row, starting at a given point.
  60407. * The values are recorded in the given array, and the number of runs recorded is equal to the size
  60408. * of the array. If the row starts on a white pixel at the given start point, then the first count
  60409. * recorded is the run of white pixels starting from that point; likewise it is the count of a run
  60410. * of black pixels if the row begin on a black pixels at that point.
  60411. *
  60412. * @param row row to count from
  60413. * @param start offset into row to start at
  60414. * @param counters array into which to record counts
  60415. * @throws NotFoundException if counters cannot be filled entirely from row before running out
  60416. * of pixels
  60417. */
  60418. OneDReader.recordPattern = function (row, start, counters) {
  60419. var numCounters = counters.length;
  60420. for (var index = 0; index < numCounters; index++) {
  60421. counters[index] = 0;
  60422. }
  60423. var end = row.getSize();
  60424. if (start >= end) {
  60425. throw new _NotFoundException.default();
  60426. }
  60427. var isWhite = !row.get(start);
  60428. var counterPosition = 0;
  60429. var i = start;
  60430. while (i < end) {
  60431. if (row.get(i) !== isWhite) {
  60432. counters[counterPosition]++;
  60433. } else {
  60434. if (++counterPosition === numCounters) {
  60435. break;
  60436. } else {
  60437. counters[counterPosition] = 1;
  60438. isWhite = !isWhite;
  60439. }
  60440. }
  60441. i++;
  60442. }
  60443. // If we read fully the last section of pixels and filled up our counters -- or filled
  60444. // the last counter but ran off the side of the image, OK. Otherwise, a problem.
  60445. if (!(counterPosition === numCounters || counterPosition === numCounters - 1 && i === end)) {
  60446. throw new _NotFoundException.default();
  60447. }
  60448. };
  60449. OneDReader.recordPatternInReverse = function (row, start, counters) {
  60450. // This could be more efficient I guess
  60451. var numTransitionsLeft = counters.length;
  60452. var last = row.get(start);
  60453. while (start > 0 && numTransitionsLeft >= 0) {
  60454. if (row.get(--start) !== last) {
  60455. numTransitionsLeft--;
  60456. last = !last;
  60457. }
  60458. }
  60459. if (numTransitionsLeft >= 0) {
  60460. throw new _NotFoundException.default();
  60461. }
  60462. OneDReader.recordPattern(row, start + 1, counters);
  60463. };
  60464. /**
  60465. * Determines how closely a set of observed counts of runs of black/white values matches a given
  60466. * target pattern. This is reported as the ratio of the total variance from the expected pattern
  60467. * proportions across all pattern elements, to the length of the pattern.
  60468. *
  60469. * @param counters observed counters
  60470. * @param pattern expected pattern
  60471. * @param maxIndividualVariance The most any counter can differ before we give up
  60472. * @return ratio of total variance between counters and pattern compared to total pattern size
  60473. */
  60474. OneDReader.patternMatchVariance = function (counters, pattern, maxIndividualVariance) {
  60475. var numCounters = counters.length;
  60476. var total = 0;
  60477. var patternLength = 0;
  60478. for (var i = 0; i < numCounters; i++) {
  60479. total += counters[i];
  60480. patternLength += pattern[i];
  60481. }
  60482. if (total < patternLength) {
  60483. // If we don't even have one pixel per unit of bar width, assume this is too small
  60484. // to reliably match, so fail:
  60485. return Number.POSITIVE_INFINITY;
  60486. }
  60487. var unitBarWidth = total / patternLength;
  60488. maxIndividualVariance *= unitBarWidth;
  60489. var totalVariance = 0.0;
  60490. for (var x = 0; x < numCounters; x++) {
  60491. var counter = counters[x];
  60492. var scaledPattern = pattern[x] * unitBarWidth;
  60493. var variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
  60494. if (variance > maxIndividualVariance) {
  60495. return Number.POSITIVE_INFINITY;
  60496. }
  60497. totalVariance += variance;
  60498. }
  60499. return totalVariance / total;
  60500. };
  60501. return OneDReader;
  60502. }();
  60503. var _default = OneDReader;
  60504. exports.default = _default;
  60505. /***/ }),
  60506. /* 360 */
  60507. /*!*************************************************************************************!*\
  60508. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/Code39Reader.js ***!
  60509. \*************************************************************************************/
  60510. /*! no static exports found */
  60511. /***/ (function(module, exports, __webpack_require__) {
  60512. "use strict";
  60513. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  60514. Object.defineProperty(exports, "__esModule", {
  60515. value: true
  60516. });
  60517. exports.default = void 0;
  60518. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  60519. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
  60520. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  60521. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  60522. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  60523. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  60524. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  60525. /*
  60526. * Copyright 2008 ZXing authors
  60527. *
  60528. * Licensed under the Apache License, Version 2.0 (the "License");
  60529. * you may not use this file except in compliance with the License.
  60530. * You may obtain a copy of the License at
  60531. *
  60532. * http://www.apache.org/licenses/LICENSE-2.0
  60533. *
  60534. * Unless required by applicable law or agreed to in writing, software
  60535. * distributed under the License is distributed on an "AS IS" BASIS,
  60536. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  60537. * See the License for the specific language governing permissions and
  60538. * limitations under the License.
  60539. */
  60540. var __extends = void 0 && (void 0).__extends || function () {
  60541. var _extendStatics = function extendStatics(d, b) {
  60542. _extendStatics = Object.setPrototypeOf || {
  60543. __proto__: []
  60544. } instanceof Array && function (d, b) {
  60545. d.__proto__ = b;
  60546. } || function (d, b) {
  60547. for (var p in b) {
  60548. if (b.hasOwnProperty(p)) d[p] = b[p];
  60549. }
  60550. };
  60551. return _extendStatics(d, b);
  60552. };
  60553. return function (d, b) {
  60554. _extendStatics(d, b);
  60555. function __() {
  60556. this.constructor = d;
  60557. }
  60558. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  60559. };
  60560. }();
  60561. var __values = void 0 && (void 0).__values || function (o) {
  60562. var s = typeof Symbol === "function" && Symbol.iterator,
  60563. m = s && o[s],
  60564. i = 0;
  60565. if (m) return m.call(o);
  60566. if (o && typeof o.length === "number") return {
  60567. next: function next() {
  60568. if (o && i >= o.length) o = void 0;
  60569. return {
  60570. value: o && o[i++],
  60571. done: !o
  60572. };
  60573. }
  60574. };
  60575. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  60576. };
  60577. /*namespace com.google.zxing.oned {*/
  60578. /**
  60579. * <p>Decodes Code 39 barcodes. Supports "Full ASCII Code 39" if USE_CODE_39_EXTENDED_MODE is set.</p>
  60580. *
  60581. * @author Sean Owen
  60582. * @see Code93Reader
  60583. */
  60584. var Code39Reader = /** @class */function (_super) {
  60585. __extends(Code39Reader, _super);
  60586. /**
  60587. * Creates a reader that assumes all encoded data is data, and does not treat the final
  60588. * character as a check digit. It will not decoded "extended Code 39" sequences.
  60589. */
  60590. // public Code39Reader() {
  60591. // this(false);
  60592. // }
  60593. /**
  60594. * Creates a reader that can be configured to check the last character as a check digit.
  60595. * It will not decoded "extended Code 39" sequences.
  60596. *
  60597. * @param usingCheckDigit if true, treat the last data character as a check digit, not
  60598. * data, and verify that the checksum passes.
  60599. */
  60600. // public Code39Reader(boolean usingCheckDigit) {
  60601. // this(usingCheckDigit, false);
  60602. // }
  60603. /**
  60604. * Creates a reader that can be configured to check the last character as a check digit,
  60605. * or optionally attempt to decode "extended Code 39" sequences that are used to encode
  60606. * the full ASCII character set.
  60607. *
  60608. * @param usingCheckDigit if true, treat the last data character as a check digit, not
  60609. * data, and verify that the checksum passes.
  60610. * @param extendedMode if true, will attempt to decode extended Code 39 sequences in the
  60611. * text.
  60612. */
  60613. function Code39Reader(usingCheckDigit, extendedMode) {
  60614. if (usingCheckDigit === void 0) {
  60615. usingCheckDigit = false;
  60616. }
  60617. if (extendedMode === void 0) {
  60618. extendedMode = false;
  60619. }
  60620. var _this = _super.call(this) || this;
  60621. _this.usingCheckDigit = usingCheckDigit;
  60622. _this.extendedMode = extendedMode;
  60623. _this.decodeRowResult = '';
  60624. _this.counters = new Int32Array(9);
  60625. return _this;
  60626. }
  60627. Code39Reader.prototype.decodeRow = function (rowNumber, row, hints) {
  60628. var e_1, _a, e_2, _b;
  60629. var theCounters = this.counters;
  60630. theCounters.fill(0);
  60631. this.decodeRowResult = '';
  60632. var start = Code39Reader.findAsteriskPattern(row, theCounters);
  60633. // Read off white space
  60634. var nextStart = row.getNextSet(start[1]);
  60635. var end = row.getSize();
  60636. var decodedChar;
  60637. var lastStart;
  60638. do {
  60639. Code39Reader.recordPattern(row, nextStart, theCounters);
  60640. var pattern = Code39Reader.toNarrowWidePattern(theCounters);
  60641. if (pattern < 0) {
  60642. throw new _NotFoundException.default();
  60643. }
  60644. decodedChar = Code39Reader.patternToChar(pattern);
  60645. this.decodeRowResult += decodedChar;
  60646. lastStart = nextStart;
  60647. try {
  60648. for (var theCounters_1 = (e_1 = void 0, __values(theCounters)), theCounters_1_1 = theCounters_1.next(); !theCounters_1_1.done; theCounters_1_1 = theCounters_1.next()) {
  60649. var counter = theCounters_1_1.value;
  60650. nextStart += counter;
  60651. }
  60652. } catch (e_1_1) {
  60653. e_1 = {
  60654. error: e_1_1
  60655. };
  60656. } finally {
  60657. try {
  60658. if (theCounters_1_1 && !theCounters_1_1.done && (_a = theCounters_1.return)) _a.call(theCounters_1);
  60659. } finally {
  60660. if (e_1) throw e_1.error;
  60661. }
  60662. }
  60663. // Read off white space
  60664. nextStart = row.getNextSet(nextStart);
  60665. } while (decodedChar !== '*');
  60666. this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 1); // remove asterisk
  60667. // Look for whitespace after pattern:
  60668. var lastPatternSize = 0;
  60669. try {
  60670. for (var theCounters_2 = __values(theCounters), theCounters_2_1 = theCounters_2.next(); !theCounters_2_1.done; theCounters_2_1 = theCounters_2.next()) {
  60671. var counter = theCounters_2_1.value;
  60672. lastPatternSize += counter;
  60673. }
  60674. } catch (e_2_1) {
  60675. e_2 = {
  60676. error: e_2_1
  60677. };
  60678. } finally {
  60679. try {
  60680. if (theCounters_2_1 && !theCounters_2_1.done && (_b = theCounters_2.return)) _b.call(theCounters_2);
  60681. } finally {
  60682. if (e_2) throw e_2.error;
  60683. }
  60684. }
  60685. var whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
  60686. // If 50% of last pattern size, following last pattern, is not whitespace, fail
  60687. // (but if it's whitespace to the very end of the image, that's OK)
  60688. if (nextStart !== end && whiteSpaceAfterEnd * 2 < lastPatternSize) {
  60689. throw new _NotFoundException.default();
  60690. }
  60691. if (this.usingCheckDigit) {
  60692. var max = this.decodeRowResult.length - 1;
  60693. var total = 0;
  60694. for (var i = 0; i < max; i++) {
  60695. total += Code39Reader.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(i));
  60696. }
  60697. if (this.decodeRowResult.charAt(max) !== Code39Reader.ALPHABET_STRING.charAt(total % 43)) {
  60698. throw new _ChecksumException.default();
  60699. }
  60700. this.decodeRowResult = this.decodeRowResult.substring(0, max);
  60701. }
  60702. if (this.decodeRowResult.length === 0) {
  60703. // false positive
  60704. throw new _NotFoundException.default();
  60705. }
  60706. var resultString;
  60707. if (this.extendedMode) {
  60708. resultString = Code39Reader.decodeExtended(this.decodeRowResult);
  60709. } else {
  60710. resultString = this.decodeRowResult;
  60711. }
  60712. var left = (start[1] + start[0]) / 2.0;
  60713. var right = lastStart + lastPatternSize / 2.0;
  60714. return new _Result.default(resultString, null, 0, [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)], _BarcodeFormat.default.CODE_39, new Date().getTime());
  60715. };
  60716. Code39Reader.findAsteriskPattern = function (row, counters) {
  60717. var width = row.getSize();
  60718. var rowOffset = row.getNextSet(0);
  60719. var counterPosition = 0;
  60720. var patternStart = rowOffset;
  60721. var isWhite = false;
  60722. var patternLength = counters.length;
  60723. for (var i = rowOffset; i < width; i++) {
  60724. if (row.get(i) !== isWhite) {
  60725. counters[counterPosition]++;
  60726. } else {
  60727. if (counterPosition === patternLength - 1) {
  60728. // Look for whitespace before start pattern, >= 50% of width of start pattern
  60729. if (this.toNarrowWidePattern(counters) === Code39Reader.ASTERISK_ENCODING && row.isRange(Math.max(0, patternStart - Math.floor((i - patternStart) / 2)), patternStart, false)) {
  60730. return [patternStart, i];
  60731. }
  60732. patternStart += counters[0] + counters[1];
  60733. counters.copyWithin(0, 2, 2 + counterPosition - 1);
  60734. counters[counterPosition - 1] = 0;
  60735. counters[counterPosition] = 0;
  60736. counterPosition--;
  60737. } else {
  60738. counterPosition++;
  60739. }
  60740. counters[counterPosition] = 1;
  60741. isWhite = !isWhite;
  60742. }
  60743. }
  60744. throw new _NotFoundException.default();
  60745. };
  60746. // For efficiency, returns -1 on failure. Not throwing here saved as many as 700 exceptions
  60747. // per image when using some of our blackbox images.
  60748. Code39Reader.toNarrowWidePattern = function (counters) {
  60749. var e_3, _a;
  60750. var numCounters = counters.length;
  60751. var maxNarrowCounter = 0;
  60752. var wideCounters;
  60753. do {
  60754. var minCounter = 0x7fffffff;
  60755. try {
  60756. for (var counters_1 = (e_3 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  60757. var counter = counters_1_1.value;
  60758. if (counter < minCounter && counter > maxNarrowCounter) {
  60759. minCounter = counter;
  60760. }
  60761. }
  60762. } catch (e_3_1) {
  60763. e_3 = {
  60764. error: e_3_1
  60765. };
  60766. } finally {
  60767. try {
  60768. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  60769. } finally {
  60770. if (e_3) throw e_3.error;
  60771. }
  60772. }
  60773. maxNarrowCounter = minCounter;
  60774. wideCounters = 0;
  60775. var totalWideCountersWidth = 0;
  60776. var pattern = 0;
  60777. for (var i = 0; i < numCounters; i++) {
  60778. var counter = counters[i];
  60779. if (counter > maxNarrowCounter) {
  60780. pattern |= 1 << numCounters - 1 - i;
  60781. wideCounters++;
  60782. totalWideCountersWidth += counter;
  60783. }
  60784. }
  60785. if (wideCounters === 3) {
  60786. // Found 3 wide counters, but are they close enough in width?
  60787. // We can perform a cheap, conservative check to see if any individual
  60788. // counter is more than 1.5 times the average:
  60789. for (var i = 0; i < numCounters && wideCounters > 0; i++) {
  60790. var counter = counters[i];
  60791. if (counter > maxNarrowCounter) {
  60792. wideCounters--;
  60793. // totalWideCountersWidth = 3 * average, so this checks if counter >= 3/2 * average
  60794. if (counter * 2 >= totalWideCountersWidth) {
  60795. return -1;
  60796. }
  60797. }
  60798. }
  60799. return pattern;
  60800. }
  60801. } while (wideCounters > 3);
  60802. return -1;
  60803. };
  60804. Code39Reader.patternToChar = function (pattern) {
  60805. for (var i = 0; i < Code39Reader.CHARACTER_ENCODINGS.length; i++) {
  60806. if (Code39Reader.CHARACTER_ENCODINGS[i] === pattern) {
  60807. return Code39Reader.ALPHABET_STRING.charAt(i);
  60808. }
  60809. }
  60810. if (pattern === Code39Reader.ASTERISK_ENCODING) {
  60811. return '*';
  60812. }
  60813. throw new _NotFoundException.default();
  60814. };
  60815. Code39Reader.decodeExtended = function (encoded) {
  60816. var length = encoded.length;
  60817. var decoded = '';
  60818. for (var i = 0; i < length; i++) {
  60819. var c = encoded.charAt(i);
  60820. if (c === '+' || c === '$' || c === '%' || c === '/') {
  60821. var next = encoded.charAt(i + 1);
  60822. var decodedChar = '\0';
  60823. switch (c) {
  60824. case '+':
  60825. // +A to +Z map to a to z
  60826. if (next >= 'A' && next <= 'Z') {
  60827. decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);
  60828. } else {
  60829. throw new _FormatException.default();
  60830. }
  60831. break;
  60832. case '$':
  60833. // $A to $Z map to control codes SH to SB
  60834. if (next >= 'A' && next <= 'Z') {
  60835. decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);
  60836. } else {
  60837. throw new _FormatException.default();
  60838. }
  60839. break;
  60840. case '%':
  60841. // %A to %E map to control codes ESC to US
  60842. if (next >= 'A' && next <= 'E') {
  60843. decodedChar = String.fromCharCode(next.charCodeAt(0) - 38);
  60844. } else if (next >= 'F' && next <= 'J') {
  60845. decodedChar = String.fromCharCode(next.charCodeAt(0) - 11);
  60846. } else if (next >= 'K' && next <= 'O') {
  60847. decodedChar = String.fromCharCode(next.charCodeAt(0) + 16);
  60848. } else if (next >= 'P' && next <= 'T') {
  60849. decodedChar = String.fromCharCode(next.charCodeAt(0) + 43);
  60850. } else if (next === 'U') {
  60851. decodedChar = '\0';
  60852. } else if (next === 'V') {
  60853. decodedChar = '@';
  60854. } else if (next === 'W') {
  60855. decodedChar = '`';
  60856. } else if (next === 'X' || next === 'Y' || next === 'Z') {
  60857. decodedChar = '\x7f';
  60858. } else {
  60859. throw new _FormatException.default();
  60860. }
  60861. break;
  60862. case '/':
  60863. // /A to /O map to ! to , and /Z maps to :
  60864. if (next >= 'A' && next <= 'O') {
  60865. decodedChar = String.fromCharCode(next.charCodeAt(0) - 32);
  60866. } else if (next === 'Z') {
  60867. decodedChar = ':';
  60868. } else {
  60869. throw new _FormatException.default();
  60870. }
  60871. break;
  60872. }
  60873. decoded += decodedChar;
  60874. // bump up i again since we read two characters
  60875. i++;
  60876. } else {
  60877. decoded += c;
  60878. }
  60879. }
  60880. return decoded;
  60881. };
  60882. Code39Reader.ALPHABET_STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%';
  60883. /**
  60884. * These represent the encodings of characters, as patterns of wide and narrow bars.
  60885. * The 9 least-significant bits of each int correspond to the pattern of wide and narrow,
  60886. * with 1s representing "wide" and 0s representing narrow.
  60887. */
  60888. Code39Reader.CHARACTER_ENCODINGS = [0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x0A8, 0x0A2, 0x08A, 0x02A // /-%
  60889. ];
  60890. Code39Reader.ASTERISK_ENCODING = 0x094;
  60891. return Code39Reader;
  60892. }(_OneDReader.default);
  60893. var _default = Code39Reader;
  60894. exports.default = _default;
  60895. /***/ }),
  60896. /* 361 */
  60897. /*!*************************************************************************************!*\
  60898. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/Code93Reader.js ***!
  60899. \*************************************************************************************/
  60900. /*! no static exports found */
  60901. /***/ (function(module, exports, __webpack_require__) {
  60902. "use strict";
  60903. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  60904. Object.defineProperty(exports, "__esModule", {
  60905. value: true
  60906. });
  60907. exports.default = void 0;
  60908. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  60909. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
  60910. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  60911. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  60912. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  60913. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  60914. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  60915. /*
  60916. * Copyright 2010 ZXing authors
  60917. *
  60918. * Licensed under the Apache License, Version 2.0 (the "License");
  60919. * you may not use this file except in compliance with the License.
  60920. * You may obtain a copy of the License at
  60921. *
  60922. * http://www.apache.org/licenses/LICENSE-2.0
  60923. *
  60924. * Unless required by applicable law or agreed to in writing, software
  60925. * distributed under the License is distributed on an "AS IS" BASIS,
  60926. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  60927. * See the License for the specific language governing permissions and
  60928. * limitations under the License.
  60929. */
  60930. var __extends = void 0 && (void 0).__extends || function () {
  60931. var _extendStatics = function extendStatics(d, b) {
  60932. _extendStatics = Object.setPrototypeOf || {
  60933. __proto__: []
  60934. } instanceof Array && function (d, b) {
  60935. d.__proto__ = b;
  60936. } || function (d, b) {
  60937. for (var p in b) {
  60938. if (b.hasOwnProperty(p)) d[p] = b[p];
  60939. }
  60940. };
  60941. return _extendStatics(d, b);
  60942. };
  60943. return function (d, b) {
  60944. _extendStatics(d, b);
  60945. function __() {
  60946. this.constructor = d;
  60947. }
  60948. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  60949. };
  60950. }();
  60951. var __values = void 0 && (void 0).__values || function (o) {
  60952. var s = typeof Symbol === "function" && Symbol.iterator,
  60953. m = s && o[s],
  60954. i = 0;
  60955. if (m) return m.call(o);
  60956. if (o && typeof o.length === "number") return {
  60957. next: function next() {
  60958. if (o && i >= o.length) o = void 0;
  60959. return {
  60960. value: o && o[i++],
  60961. done: !o
  60962. };
  60963. }
  60964. };
  60965. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  60966. };
  60967. /*namespace com.google.zxing.oned {*/
  60968. /**
  60969. * <p>Decodes Code 93 barcodes.</p>
  60970. *
  60971. * @author Sean Owen
  60972. * @see Code39Reader
  60973. */
  60974. var Code93Reader = /** @class */function (_super) {
  60975. __extends(Code93Reader, _super);
  60976. //public Code93Reader() {
  60977. // decodeRowResult = new StringBuilder(20);
  60978. // counters = new int[6];
  60979. //}
  60980. function Code93Reader() {
  60981. var _this = _super.call(this) || this;
  60982. _this.decodeRowResult = '';
  60983. _this.counters = new Int32Array(6);
  60984. return _this;
  60985. }
  60986. Code93Reader.prototype.decodeRow = function (rowNumber, row, hints) {
  60987. var e_1, _a, e_2, _b;
  60988. var start = this.findAsteriskPattern(row);
  60989. // Read off white space
  60990. var nextStart = row.getNextSet(start[1]);
  60991. var end = row.getSize();
  60992. var theCounters = this.counters;
  60993. theCounters.fill(0);
  60994. this.decodeRowResult = '';
  60995. var decodedChar;
  60996. var lastStart;
  60997. do {
  60998. Code93Reader.recordPattern(row, nextStart, theCounters);
  60999. var pattern = this.toPattern(theCounters);
  61000. if (pattern < 0) {
  61001. throw new _NotFoundException.default();
  61002. }
  61003. decodedChar = this.patternToChar(pattern);
  61004. this.decodeRowResult += decodedChar;
  61005. lastStart = nextStart;
  61006. try {
  61007. for (var theCounters_1 = (e_1 = void 0, __values(theCounters)), theCounters_1_1 = theCounters_1.next(); !theCounters_1_1.done; theCounters_1_1 = theCounters_1.next()) {
  61008. var counter = theCounters_1_1.value;
  61009. nextStart += counter;
  61010. }
  61011. } catch (e_1_1) {
  61012. e_1 = {
  61013. error: e_1_1
  61014. };
  61015. } finally {
  61016. try {
  61017. if (theCounters_1_1 && !theCounters_1_1.done && (_a = theCounters_1.return)) _a.call(theCounters_1);
  61018. } finally {
  61019. if (e_1) throw e_1.error;
  61020. }
  61021. }
  61022. // Read off white space
  61023. nextStart = row.getNextSet(nextStart);
  61024. } while (decodedChar !== '*');
  61025. this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 1); // remove asterisk
  61026. var lastPatternSize = 0;
  61027. try {
  61028. for (var theCounters_2 = __values(theCounters), theCounters_2_1 = theCounters_2.next(); !theCounters_2_1.done; theCounters_2_1 = theCounters_2.next()) {
  61029. var counter = theCounters_2_1.value;
  61030. lastPatternSize += counter;
  61031. }
  61032. } catch (e_2_1) {
  61033. e_2 = {
  61034. error: e_2_1
  61035. };
  61036. } finally {
  61037. try {
  61038. if (theCounters_2_1 && !theCounters_2_1.done && (_b = theCounters_2.return)) _b.call(theCounters_2);
  61039. } finally {
  61040. if (e_2) throw e_2.error;
  61041. }
  61042. }
  61043. // Should be at least one more black module
  61044. if (nextStart === end || !row.get(nextStart)) {
  61045. throw new _NotFoundException.default();
  61046. }
  61047. if (this.decodeRowResult.length < 2) {
  61048. // false positive -- need at least 2 checksum digits
  61049. throw new _NotFoundException.default();
  61050. }
  61051. this.checkChecksums(this.decodeRowResult);
  61052. // Remove checksum digits
  61053. this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 2);
  61054. var resultString = this.decodeExtended(this.decodeRowResult);
  61055. var left = (start[1] + start[0]) / 2.0;
  61056. var right = lastStart + lastPatternSize / 2.0;
  61057. return new _Result.default(resultString, null, 0, [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)], _BarcodeFormat.default.CODE_93, new Date().getTime());
  61058. };
  61059. Code93Reader.prototype.findAsteriskPattern = function (row) {
  61060. var width = row.getSize();
  61061. var rowOffset = row.getNextSet(0);
  61062. this.counters.fill(0);
  61063. var theCounters = this.counters;
  61064. var patternStart = rowOffset;
  61065. var isWhite = false;
  61066. var patternLength = theCounters.length;
  61067. var counterPosition = 0;
  61068. for (var i = rowOffset; i < width; i++) {
  61069. if (row.get(i) !== isWhite) {
  61070. theCounters[counterPosition]++;
  61071. } else {
  61072. if (counterPosition === patternLength - 1) {
  61073. if (this.toPattern(theCounters) === Code93Reader.ASTERISK_ENCODING) {
  61074. return new Int32Array([patternStart, i]);
  61075. }
  61076. patternStart += theCounters[0] + theCounters[1];
  61077. theCounters.copyWithin(0, 2, 2 + counterPosition - 1);
  61078. theCounters[counterPosition - 1] = 0;
  61079. theCounters[counterPosition] = 0;
  61080. counterPosition--;
  61081. } else {
  61082. counterPosition++;
  61083. }
  61084. theCounters[counterPosition] = 1;
  61085. isWhite = !isWhite;
  61086. }
  61087. }
  61088. throw new _NotFoundException.default();
  61089. };
  61090. Code93Reader.prototype.toPattern = function (counters) {
  61091. var e_3, _a;
  61092. var sum = 0;
  61093. try {
  61094. for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  61095. var counter = counters_1_1.value;
  61096. sum += counter;
  61097. }
  61098. } catch (e_3_1) {
  61099. e_3 = {
  61100. error: e_3_1
  61101. };
  61102. } finally {
  61103. try {
  61104. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  61105. } finally {
  61106. if (e_3) throw e_3.error;
  61107. }
  61108. }
  61109. var pattern = 0;
  61110. var max = counters.length;
  61111. for (var i = 0; i < max; i++) {
  61112. var scaled = Math.round(counters[i] * 9.0 / sum);
  61113. if (scaled < 1 || scaled > 4) {
  61114. return -1;
  61115. }
  61116. if ((i & 0x01) === 0) {
  61117. for (var j = 0; j < scaled; j++) {
  61118. pattern = pattern << 1 | 0x01;
  61119. }
  61120. } else {
  61121. pattern <<= scaled;
  61122. }
  61123. }
  61124. return pattern;
  61125. };
  61126. Code93Reader.prototype.patternToChar = function (pattern) {
  61127. for (var i = 0; i < Code93Reader.CHARACTER_ENCODINGS.length; i++) {
  61128. if (Code93Reader.CHARACTER_ENCODINGS[i] === pattern) {
  61129. return Code93Reader.ALPHABET_STRING.charAt(i);
  61130. }
  61131. }
  61132. throw new _NotFoundException.default();
  61133. };
  61134. Code93Reader.prototype.decodeExtended = function (encoded) {
  61135. var length = encoded.length;
  61136. var decoded = '';
  61137. for (var i = 0; i < length; i++) {
  61138. var c = encoded.charAt(i);
  61139. if (c >= 'a' && c <= 'd') {
  61140. if (i >= length - 1) {
  61141. throw new _FormatException.default();
  61142. }
  61143. var next = encoded.charAt(i + 1);
  61144. var decodedChar = '\0';
  61145. switch (c) {
  61146. case 'd':
  61147. // +A to +Z map to a to z
  61148. if (next >= 'A' && next <= 'Z') {
  61149. decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);
  61150. } else {
  61151. throw new _FormatException.default();
  61152. }
  61153. break;
  61154. case 'a':
  61155. // $A to $Z map to control codes SH to SB
  61156. if (next >= 'A' && next <= 'Z') {
  61157. decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);
  61158. } else {
  61159. throw new _FormatException.default();
  61160. }
  61161. break;
  61162. case 'b':
  61163. if (next >= 'A' && next <= 'E') {
  61164. // %A to %E map to control codes ESC to USep
  61165. decodedChar = String.fromCharCode(next.charCodeAt(0) - 38);
  61166. } else if (next >= 'F' && next <= 'J') {
  61167. // %F to %J map to ; < = > ?
  61168. decodedChar = String.fromCharCode(next.charCodeAt(0) - 11);
  61169. } else if (next >= 'K' && next <= 'O') {
  61170. // %K to %O map to [ \ ] ^ _
  61171. decodedChar = String.fromCharCode(next.charCodeAt(0) + 16);
  61172. } else if (next >= 'P' && next <= 'T') {
  61173. // %P to %T map to { | } ~ DEL
  61174. decodedChar = String.fromCharCode(next.charCodeAt(0) + 43);
  61175. } else if (next === 'U') {
  61176. // %U map to NUL
  61177. decodedChar = '\0';
  61178. } else if (next === 'V') {
  61179. // %V map to @
  61180. decodedChar = '@';
  61181. } else if (next === 'W') {
  61182. // %W map to `
  61183. decodedChar = '`';
  61184. } else if (next >= 'X' && next <= 'Z') {
  61185. // %X to %Z all map to DEL (127)
  61186. decodedChar = String.fromCharCode(127);
  61187. } else {
  61188. throw new _FormatException.default();
  61189. }
  61190. break;
  61191. case 'c':
  61192. // /A to /O map to ! to , and /Z maps to :
  61193. if (next >= 'A' && next <= 'O') {
  61194. decodedChar = String.fromCharCode(next.charCodeAt(0) - 32);
  61195. } else if (next === 'Z') {
  61196. decodedChar = ':';
  61197. } else {
  61198. throw new _FormatException.default();
  61199. }
  61200. break;
  61201. }
  61202. decoded += decodedChar;
  61203. // bump up i again since we read two characters
  61204. i++;
  61205. } else {
  61206. decoded += c;
  61207. }
  61208. }
  61209. return decoded;
  61210. };
  61211. Code93Reader.prototype.checkChecksums = function (result) {
  61212. var length = result.length;
  61213. this.checkOneChecksum(result, length - 2, 20);
  61214. this.checkOneChecksum(result, length - 1, 15);
  61215. };
  61216. Code93Reader.prototype.checkOneChecksum = function (result, checkPosition, weightMax) {
  61217. var weight = 1;
  61218. var total = 0;
  61219. for (var i = checkPosition - 1; i >= 0; i--) {
  61220. total += weight * Code93Reader.ALPHABET_STRING.indexOf(result.charAt(i));
  61221. if (++weight > weightMax) {
  61222. weight = 1;
  61223. }
  61224. }
  61225. if (result.charAt(checkPosition) !== Code93Reader.ALPHABET_STRING[total % 47]) {
  61226. throw new _ChecksumException.default();
  61227. }
  61228. };
  61229. // Note that 'abcd' are dummy characters in place of control characters.
  61230. Code93Reader.ALPHABET_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
  61231. /**
  61232. * These represent the encodings of characters, as patterns of wide and narrow bars.
  61233. * The 9 least-significant bits of each int correspond to the pattern of wide and narrow.
  61234. */
  61235. Code93Reader.CHARACTER_ENCODINGS = [0x114, 0x148, 0x144, 0x142, 0x128, 0x124, 0x122, 0x150, 0x112, 0x10A, 0x1A8, 0x1A4, 0x1A2, 0x194, 0x192, 0x18A, 0x168, 0x164, 0x162, 0x134, 0x11A, 0x158, 0x14C, 0x146, 0x12C, 0x116, 0x1B4, 0x1B2, 0x1AC, 0x1A6, 0x196, 0x19A, 0x16C, 0x166, 0x136, 0x13A, 0x12E, 0x1D4, 0x1D2, 0x1CA, 0x16E, 0x176, 0x1AE, 0x126, 0x1DA, 0x1D6, 0x132, 0x15E];
  61236. Code93Reader.ASTERISK_ENCODING = Code93Reader.CHARACTER_ENCODINGS[47];
  61237. return Code93Reader;
  61238. }(_OneDReader.default);
  61239. var _default = Code93Reader;
  61240. exports.default = _default;
  61241. /***/ }),
  61242. /* 362 */
  61243. /*!**********************************************************************************!*\
  61244. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/ITFReader.js ***!
  61245. \**********************************************************************************/
  61246. /*! no static exports found */
  61247. /***/ (function(module, exports, __webpack_require__) {
  61248. "use strict";
  61249. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  61250. Object.defineProperty(exports, "__esModule", {
  61251. value: true
  61252. });
  61253. exports.default = void 0;
  61254. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  61255. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  61256. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  61257. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  61258. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  61259. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  61260. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
  61261. var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
  61262. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  61263. /*
  61264. * Copyright 2008 ZXing authors
  61265. *
  61266. * Licensed under the Apache License, Version 2.0 (the "License");
  61267. * you may not use this file except in compliance with the License.
  61268. * You may obtain a copy of the License at
  61269. *
  61270. * http://www.apache.org/licenses/LICENSE-2.0
  61271. *
  61272. * Unless required by applicable law or agreed to in writing, software
  61273. * distributed under the License is distributed on an "AS IS" BASIS,
  61274. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61275. * See the License for the specific language governing permissions and
  61276. * limitations under the License.
  61277. */
  61278. var __extends = void 0 && (void 0).__extends || function () {
  61279. var _extendStatics = function extendStatics(d, b) {
  61280. _extendStatics = Object.setPrototypeOf || {
  61281. __proto__: []
  61282. } instanceof Array && function (d, b) {
  61283. d.__proto__ = b;
  61284. } || function (d, b) {
  61285. for (var p in b) {
  61286. if (b.hasOwnProperty(p)) d[p] = b[p];
  61287. }
  61288. };
  61289. return _extendStatics(d, b);
  61290. };
  61291. return function (d, b) {
  61292. _extendStatics(d, b);
  61293. function __() {
  61294. this.constructor = d;
  61295. }
  61296. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  61297. };
  61298. }();
  61299. var __values = void 0 && (void 0).__values || function (o) {
  61300. var s = typeof Symbol === "function" && Symbol.iterator,
  61301. m = s && o[s],
  61302. i = 0;
  61303. if (m) return m.call(o);
  61304. if (o && typeof o.length === "number") return {
  61305. next: function next() {
  61306. if (o && i >= o.length) o = void 0;
  61307. return {
  61308. value: o && o[i++],
  61309. done: !o
  61310. };
  61311. }
  61312. };
  61313. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  61314. };
  61315. /*namespace com.google.zxing.oned {*/
  61316. /**
  61317. * <p>Decodes ITF barcodes.</p>
  61318. *
  61319. * @author Tjieco
  61320. */
  61321. var ITFReader = /** @class */function (_super) {
  61322. __extends(ITFReader, _super);
  61323. function ITFReader() {
  61324. // private static W = 3; // Pixel width of a 3x wide line
  61325. // private static w = 2; // Pixel width of a 2x wide line
  61326. // private static N = 1; // Pixed width of a narrow line
  61327. var _this = _super !== null && _super.apply(this, arguments) || this;
  61328. // Stores the actual narrow line width of the image being decoded.
  61329. _this.narrowLineWidth = -1;
  61330. return _this;
  61331. }
  61332. // See ITFWriter.PATTERNS
  61333. /*
  61334. /!**
  61335. * Patterns of Wide / Narrow lines to indicate each digit
  61336. *!/
  61337. */
  61338. ITFReader.prototype.decodeRow = function (rowNumber, row, hints) {
  61339. var e_1, _a;
  61340. // Find out where the Middle section (payload) starts & ends
  61341. var startRange = this.decodeStart(row);
  61342. var endRange = this.decodeEnd(row);
  61343. var result = new _StringBuilder.default();
  61344. ITFReader.decodeMiddle(row, startRange[1], endRange[0], result);
  61345. var resultString = result.toString();
  61346. var allowedLengths = null;
  61347. if (hints != null) {
  61348. allowedLengths = hints.get(_DecodeHintType.default.ALLOWED_LENGTHS);
  61349. }
  61350. if (allowedLengths == null) {
  61351. allowedLengths = ITFReader.DEFAULT_ALLOWED_LENGTHS;
  61352. }
  61353. // To avoid false positives with 2D barcodes (and other patterns), make
  61354. // an assumption that the decoded string must be a 'standard' length if it's short
  61355. var length = resultString.length;
  61356. var lengthOK = false;
  61357. var maxAllowedLength = 0;
  61358. try {
  61359. for (var allowedLengths_1 = __values(allowedLengths), allowedLengths_1_1 = allowedLengths_1.next(); !allowedLengths_1_1.done; allowedLengths_1_1 = allowedLengths_1.next()) {
  61360. var value = allowedLengths_1_1.value;
  61361. if (length === value) {
  61362. lengthOK = true;
  61363. break;
  61364. }
  61365. if (value > maxAllowedLength) {
  61366. maxAllowedLength = value;
  61367. }
  61368. }
  61369. } catch (e_1_1) {
  61370. e_1 = {
  61371. error: e_1_1
  61372. };
  61373. } finally {
  61374. try {
  61375. if (allowedLengths_1_1 && !allowedLengths_1_1.done && (_a = allowedLengths_1.return)) _a.call(allowedLengths_1);
  61376. } finally {
  61377. if (e_1) throw e_1.error;
  61378. }
  61379. }
  61380. if (!lengthOK && length > maxAllowedLength) {
  61381. lengthOK = true;
  61382. }
  61383. if (!lengthOK) {
  61384. throw new _FormatException.default();
  61385. }
  61386. var points = [new _ResultPoint.default(startRange[1], rowNumber), new _ResultPoint.default(endRange[0], rowNumber)];
  61387. var resultReturn = new _Result.default(resultString, null,
  61388. // no natural byte representation for these barcodes
  61389. 0, points, _BarcodeFormat.default.ITF, new Date().getTime());
  61390. return resultReturn;
  61391. };
  61392. /*
  61393. /!**
  61394. * @param row row of black/white values to search
  61395. * @param payloadStart offset of start pattern
  61396. * @param resultString {@link StringBuilder} to append decoded chars to
  61397. * @throws NotFoundException if decoding could not complete successfully
  61398. *!/*/
  61399. ITFReader.decodeMiddle = function (row, payloadStart, payloadEnd, resultString) {
  61400. // Digits are interleaved in pairs - 5 black lines for one digit, and the
  61401. // 5
  61402. // interleaved white lines for the second digit.
  61403. // Therefore, need to scan 10 lines and then
  61404. // split these into two arrays
  61405. var counterDigitPair = new Int32Array(10); // 10
  61406. var counterBlack = new Int32Array(5); // 5
  61407. var counterWhite = new Int32Array(5); // 5
  61408. counterDigitPair.fill(0);
  61409. counterBlack.fill(0);
  61410. counterWhite.fill(0);
  61411. while (payloadStart < payloadEnd) {
  61412. // Get 10 runs of black/white.
  61413. _OneDReader.default.recordPattern(row, payloadStart, counterDigitPair);
  61414. // Split them into each array
  61415. for (var k = 0; k < 5; k++) {
  61416. var twoK = 2 * k;
  61417. counterBlack[k] = counterDigitPair[twoK];
  61418. counterWhite[k] = counterDigitPair[twoK + 1];
  61419. }
  61420. var bestMatch = ITFReader.decodeDigit(counterBlack);
  61421. resultString.append(bestMatch.toString());
  61422. bestMatch = this.decodeDigit(counterWhite);
  61423. resultString.append(bestMatch.toString());
  61424. counterDigitPair.forEach(function (counterDigit) {
  61425. payloadStart += counterDigit;
  61426. });
  61427. }
  61428. };
  61429. /*/!**
  61430. * Identify where the start of the middle / payload section starts.
  61431. *
  61432. * @param row row of black/white values to search
  61433. * @return Array, containing index of start of 'start block' and end of
  61434. * 'start block'
  61435. *!/*/
  61436. ITFReader.prototype.decodeStart = function (row) {
  61437. var endStart = ITFReader.skipWhiteSpace(row);
  61438. var startPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.START_PATTERN);
  61439. // Determine the width of a narrow line in pixels. We can do this by
  61440. // getting the width of the start pattern and dividing by 4 because its
  61441. // made up of 4 narrow lines.
  61442. this.narrowLineWidth = (startPattern[1] - startPattern[0]) / 4;
  61443. this.validateQuietZone(row, startPattern[0]);
  61444. return startPattern;
  61445. };
  61446. /*/!**
  61447. * The start & end patterns must be pre/post fixed by a quiet zone. This
  61448. * zone must be at least 10 times the width of a narrow line. Scan back until
  61449. * we either get to the start of the barcode or match the necessary number of
  61450. * quiet zone pixels.
  61451. *
  61452. * Note: Its assumed the row is reversed when using this method to find
  61453. * quiet zone after the end pattern.
  61454. *
  61455. * ref: http://www.barcode-1.net/i25code.html
  61456. *
  61457. * @param row bit array representing the scanned barcode.
  61458. * @param startPattern index into row of the start or end pattern.
  61459. * @throws NotFoundException if the quiet zone cannot be found
  61460. *!/*/
  61461. ITFReader.prototype.validateQuietZone = function (row, startPattern) {
  61462. var quietCount = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone
  61463. // if there are not so many pixel at all let's try as many as possible
  61464. quietCount = quietCount < startPattern ? quietCount : startPattern;
  61465. for (var i = startPattern - 1; quietCount > 0 && i >= 0; i--) {
  61466. if (row.get(i)) {
  61467. break;
  61468. }
  61469. quietCount--;
  61470. }
  61471. if (quietCount !== 0) {
  61472. // Unable to find the necessary number of quiet zone pixels.
  61473. throw new _NotFoundException.default();
  61474. }
  61475. };
  61476. /*
  61477. /!**
  61478. * Skip all whitespace until we get to the first black line.
  61479. *
  61480. * @param row row of black/white values to search
  61481. * @return index of the first black line.
  61482. * @throws NotFoundException Throws exception if no black lines are found in the row
  61483. *!/*/
  61484. ITFReader.skipWhiteSpace = function (row) {
  61485. var width = row.getSize();
  61486. var endStart = row.getNextSet(0);
  61487. if (endStart === width) {
  61488. throw new _NotFoundException.default();
  61489. }
  61490. return endStart;
  61491. };
  61492. /*/!**
  61493. * Identify where the end of the middle / payload section ends.
  61494. *
  61495. * @param row row of black/white values to search
  61496. * @return Array, containing index of start of 'end block' and end of 'end
  61497. * block'
  61498. *!/*/
  61499. ITFReader.prototype.decodeEnd = function (row) {
  61500. // For convenience, reverse the row and then
  61501. // search from 'the start' for the end block
  61502. row.reverse();
  61503. try {
  61504. var endStart = ITFReader.skipWhiteSpace(row);
  61505. var endPattern = void 0;
  61506. try {
  61507. endPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.END_PATTERN_REVERSED[0]);
  61508. } catch (error) {
  61509. if (error instanceof _NotFoundException.default) {
  61510. endPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.END_PATTERN_REVERSED[1]);
  61511. }
  61512. }
  61513. // The start & end patterns must be pre/post fixed by a quiet zone. This
  61514. // zone must be at least 10 times the width of a narrow line.
  61515. // ref: http://www.barcode-1.net/i25code.html
  61516. this.validateQuietZone(row, endPattern[0]);
  61517. // Now recalculate the indices of where the 'endblock' starts & stops to
  61518. // accommodate
  61519. // the reversed nature of the search
  61520. var temp = endPattern[0];
  61521. endPattern[0] = row.getSize() - endPattern[1];
  61522. endPattern[1] = row.getSize() - temp;
  61523. return endPattern;
  61524. } finally {
  61525. // Put the row back the right way.
  61526. row.reverse();
  61527. }
  61528. };
  61529. /*
  61530. /!**
  61531. * @param row row of black/white values to search
  61532. * @param rowOffset position to start search
  61533. * @param pattern pattern of counts of number of black and white pixels that are
  61534. * being searched for as a pattern
  61535. * @return start/end horizontal offset of guard pattern, as an array of two
  61536. * ints
  61537. * @throws NotFoundException if pattern is not found
  61538. *!/*/
  61539. ITFReader.findGuardPattern = function (row, rowOffset, pattern) {
  61540. var patternLength = pattern.length;
  61541. var counters = new Int32Array(patternLength);
  61542. var width = row.getSize();
  61543. var isWhite = false;
  61544. var counterPosition = 0;
  61545. var patternStart = rowOffset;
  61546. counters.fill(0);
  61547. for (var x = rowOffset; x < width; x++) {
  61548. if (row.get(x) !== isWhite) {
  61549. counters[counterPosition]++;
  61550. } else {
  61551. if (counterPosition === patternLength - 1) {
  61552. if (_OneDReader.default.patternMatchVariance(counters, pattern, ITFReader.MAX_INDIVIDUAL_VARIANCE) < ITFReader.MAX_AVG_VARIANCE) {
  61553. return [patternStart, x];
  61554. }
  61555. patternStart += counters[0] + counters[1];
  61556. _System.default.arraycopy(counters, 2, counters, 0, counterPosition - 1);
  61557. counters[counterPosition - 1] = 0;
  61558. counters[counterPosition] = 0;
  61559. counterPosition--;
  61560. } else {
  61561. counterPosition++;
  61562. }
  61563. counters[counterPosition] = 1;
  61564. isWhite = !isWhite;
  61565. }
  61566. }
  61567. throw new _NotFoundException.default();
  61568. };
  61569. /*/!**
  61570. * Attempts to decode a sequence of ITF black/white lines into single
  61571. * digit.
  61572. *
  61573. * @param counters the counts of runs of observed black/white/black/... values
  61574. * @return The decoded digit
  61575. * @throws NotFoundException if digit cannot be decoded
  61576. *!/*/
  61577. ITFReader.decodeDigit = function (counters) {
  61578. var bestVariance = ITFReader.MAX_AVG_VARIANCE; // worst variance we'll accept
  61579. var bestMatch = -1;
  61580. var max = ITFReader.PATTERNS.length;
  61581. for (var i = 0; i < max; i++) {
  61582. var pattern = ITFReader.PATTERNS[i];
  61583. var variance = _OneDReader.default.patternMatchVariance(counters, pattern, ITFReader.MAX_INDIVIDUAL_VARIANCE);
  61584. if (variance < bestVariance) {
  61585. bestVariance = variance;
  61586. bestMatch = i;
  61587. } else if (variance === bestVariance) {
  61588. // if we find a second 'best match' with the same variance, we can not reliably report to have a suitable match
  61589. bestMatch = -1;
  61590. }
  61591. }
  61592. if (bestMatch >= 0) {
  61593. return bestMatch % 10;
  61594. } else {
  61595. throw new _NotFoundException.default();
  61596. }
  61597. };
  61598. ITFReader.PATTERNS = [Int32Array.from([1, 1, 2, 2, 1]), Int32Array.from([2, 1, 1, 1, 2]), Int32Array.from([1, 2, 1, 1, 2]), Int32Array.from([2, 2, 1, 1, 1]), Int32Array.from([1, 1, 2, 1, 2]), Int32Array.from([2, 1, 2, 1, 1]), Int32Array.from([1, 2, 2, 1, 1]), Int32Array.from([1, 1, 1, 2, 2]), Int32Array.from([2, 1, 1, 2, 1]), Int32Array.from([1, 2, 1, 2, 1]), Int32Array.from([1, 1, 3, 3, 1]), Int32Array.from([3, 1, 1, 1, 3]), Int32Array.from([1, 3, 1, 1, 3]), Int32Array.from([3, 3, 1, 1, 1]), Int32Array.from([1, 1, 3, 1, 3]), Int32Array.from([3, 1, 3, 1, 1]), Int32Array.from([1, 3, 3, 1, 1]), Int32Array.from([1, 1, 1, 3, 3]), Int32Array.from([3, 1, 1, 3, 1]), Int32Array.from([1, 3, 1, 3, 1]) // 9
  61599. ];
  61600. ITFReader.MAX_AVG_VARIANCE = 0.38;
  61601. ITFReader.MAX_INDIVIDUAL_VARIANCE = 0.5;
  61602. /* /!** Valid ITF lengths. Anything longer than the largest value is also allowed. *!/*/
  61603. ITFReader.DEFAULT_ALLOWED_LENGTHS = [6, 8, 10, 12, 14];
  61604. /*/!**
  61605. * Start/end guard pattern.
  61606. *
  61607. * Note: The end pattern is reversed because the row is reversed before
  61608. * searching for the END_PATTERN
  61609. *!/*/
  61610. ITFReader.START_PATTERN = Int32Array.from([1, 1, 1, 1]);
  61611. ITFReader.END_PATTERN_REVERSED = [Int32Array.from([1, 1, 2]), Int32Array.from([1, 1, 3]) // 3x
  61612. ];
  61613. return ITFReader;
  61614. }(_OneDReader.default);
  61615. var _default = ITFReader;
  61616. exports.default = _default;
  61617. /***/ }),
  61618. /* 363 */
  61619. /*!************************************************************************************************!*\
  61620. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/MultiFormatUPCEANReader.js ***!
  61621. \************************************************************************************************/
  61622. /*! no static exports found */
  61623. /***/ (function(module, exports, __webpack_require__) {
  61624. "use strict";
  61625. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  61626. Object.defineProperty(exports, "__esModule", {
  61627. value: true
  61628. });
  61629. exports.default = void 0;
  61630. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  61631. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  61632. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  61633. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  61634. var _EAN13Reader = _interopRequireDefault(__webpack_require__(/*! ./EAN13Reader */ 364));
  61635. var _EAN8Reader = _interopRequireDefault(__webpack_require__(/*! ./EAN8Reader */ 370));
  61636. var _UPCAReader = _interopRequireDefault(__webpack_require__(/*! ./UPCAReader */ 371));
  61637. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  61638. var _UPCEReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEReader */ 372));
  61639. /*
  61640. * Copyright 2008 ZXing authors
  61641. *
  61642. * Licensed under the Apache License, Version 2.0 (the "License");
  61643. * you may not use this file except in compliance with the License.
  61644. * You may obtain a copy of the License at
  61645. *
  61646. * http://www.apache.org/licenses/LICENSE-2.0
  61647. *
  61648. * Unless required by applicable law or agreed to in writing, software
  61649. * distributed under the License is distributed on an "AS IS" BASIS,
  61650. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61651. * See the License for the specific language governing permissions and
  61652. * limitations under the License.
  61653. */
  61654. var __extends = void 0 && (void 0).__extends || function () {
  61655. var _extendStatics = function extendStatics(d, b) {
  61656. _extendStatics = Object.setPrototypeOf || {
  61657. __proto__: []
  61658. } instanceof Array && function (d, b) {
  61659. d.__proto__ = b;
  61660. } || function (d, b) {
  61661. for (var p in b) {
  61662. if (b.hasOwnProperty(p)) d[p] = b[p];
  61663. }
  61664. };
  61665. return _extendStatics(d, b);
  61666. };
  61667. return function (d, b) {
  61668. _extendStatics(d, b);
  61669. function __() {
  61670. this.constructor = d;
  61671. }
  61672. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  61673. };
  61674. }();
  61675. var __values = void 0 && (void 0).__values || function (o) {
  61676. var s = typeof Symbol === "function" && Symbol.iterator,
  61677. m = s && o[s],
  61678. i = 0;
  61679. if (m) return m.call(o);
  61680. if (o && typeof o.length === "number") return {
  61681. next: function next() {
  61682. if (o && i >= o.length) o = void 0;
  61683. return {
  61684. value: o && o[i++],
  61685. done: !o
  61686. };
  61687. }
  61688. };
  61689. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  61690. };
  61691. /**
  61692. * <p>A reader that can read all available UPC/EAN formats. If a caller wants to try to
  61693. * read all such formats, it is most efficient to use this implementation rather than invoke
  61694. * individual readers.</p>
  61695. *
  61696. * @author Sean Owen
  61697. */
  61698. var MultiFormatUPCEANReader = /** @class */function (_super) {
  61699. __extends(MultiFormatUPCEANReader, _super);
  61700. function MultiFormatUPCEANReader(hints) {
  61701. var _this = _super.call(this) || this;
  61702. var possibleFormats = hints == null ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
  61703. var readers = [];
  61704. if (possibleFormats != null) {
  61705. if (possibleFormats.indexOf(_BarcodeFormat.default.EAN_13) > -1) {
  61706. readers.push(new _EAN13Reader.default());
  61707. }
  61708. if (possibleFormats.indexOf(_BarcodeFormat.default.UPC_A) > -1) {
  61709. readers.push(new _UPCAReader.default());
  61710. }
  61711. if (possibleFormats.indexOf(_BarcodeFormat.default.EAN_8) > -1) {
  61712. readers.push(new _EAN8Reader.default());
  61713. }
  61714. if (possibleFormats.indexOf(_BarcodeFormat.default.UPC_E) > -1) {
  61715. readers.push(new _UPCEReader.default());
  61716. }
  61717. }
  61718. if (readers.length === 0) {
  61719. readers.push(new _EAN13Reader.default());
  61720. readers.push(new _UPCAReader.default());
  61721. readers.push(new _EAN8Reader.default());
  61722. readers.push(new _UPCEReader.default());
  61723. }
  61724. _this.readers = readers;
  61725. return _this;
  61726. }
  61727. MultiFormatUPCEANReader.prototype.decodeRow = function (rowNumber, row, hints) {
  61728. var e_1, _a;
  61729. try {
  61730. for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
  61731. var reader = _c.value;
  61732. try {
  61733. // const result: Result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
  61734. var result = reader.decodeRow(rowNumber, row, hints);
  61735. // Special case: a 12-digit code encoded in UPC-A is identical to a "0"
  61736. // followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
  61737. // UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
  61738. // Individually these are correct and their readers will both read such a code
  61739. // and correctly call it EAN-13, or UPC-A, respectively.
  61740. //
  61741. // In this case, if we've been looking for both types, we'd like to call it
  61742. // a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
  61743. // UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
  61744. // result if appropriate.
  61745. //
  61746. // But, don't return UPC-A if UPC-A was not a requested format!
  61747. var ean13MayBeUPCA = result.getBarcodeFormat() === _BarcodeFormat.default.EAN_13 && result.getText().charAt(0) === '0';
  61748. // @SuppressWarnings("unchecked")
  61749. var possibleFormats = hints == null ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
  61750. var canReturnUPCA = possibleFormats == null || possibleFormats.includes(_BarcodeFormat.default.UPC_A);
  61751. if (ean13MayBeUPCA && canReturnUPCA) {
  61752. var rawBytes = result.getRawBytes();
  61753. // Transfer the metadata across
  61754. var resultUPCA = new _Result.default(result.getText().substring(1), rawBytes, rawBytes ? rawBytes.length : null, result.getResultPoints(), _BarcodeFormat.default.UPC_A);
  61755. resultUPCA.putAllMetadata(result.getResultMetadata());
  61756. return resultUPCA;
  61757. }
  61758. return result;
  61759. } catch (err) {
  61760. // continue;
  61761. }
  61762. }
  61763. } catch (e_1_1) {
  61764. e_1 = {
  61765. error: e_1_1
  61766. };
  61767. } finally {
  61768. try {
  61769. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  61770. } finally {
  61771. if (e_1) throw e_1.error;
  61772. }
  61773. }
  61774. throw new _NotFoundException.default();
  61775. };
  61776. MultiFormatUPCEANReader.prototype.reset = function () {
  61777. var e_2, _a;
  61778. try {
  61779. for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
  61780. var reader = _c.value;
  61781. reader.reset();
  61782. }
  61783. } catch (e_2_1) {
  61784. e_2 = {
  61785. error: e_2_1
  61786. };
  61787. } finally {
  61788. try {
  61789. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  61790. } finally {
  61791. if (e_2) throw e_2.error;
  61792. }
  61793. }
  61794. };
  61795. return MultiFormatUPCEANReader;
  61796. }(_OneDReader.default);
  61797. var _default = MultiFormatUPCEANReader;
  61798. exports.default = _default;
  61799. /***/ }),
  61800. /* 364 */
  61801. /*!************************************************************************************!*\
  61802. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/EAN13Reader.js ***!
  61803. \************************************************************************************/
  61804. /*! no static exports found */
  61805. /***/ (function(module, exports, __webpack_require__) {
  61806. "use strict";
  61807. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  61808. Object.defineProperty(exports, "__esModule", {
  61809. value: true
  61810. });
  61811. exports.default = void 0;
  61812. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  61813. var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
  61814. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  61815. /*
  61816. * Copyright 2008 ZXing authors
  61817. *
  61818. * Licensed under the Apache License, Version 2.0 (the "License");
  61819. * you may not use this file except in compliance with the License.
  61820. * You may obtain a copy of the License at
  61821. *
  61822. * http://www.apache.org/licenses/LICENSE-2.0
  61823. *
  61824. * Unless required by applicable law or agreed to in writing, software
  61825. * distributed under the License is distributed on an "AS IS" BASIS,
  61826. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61827. * See the License for the specific language governing permissions and
  61828. * limitations under the License.
  61829. */
  61830. var __extends = void 0 && (void 0).__extends || function () {
  61831. var _extendStatics = function extendStatics(d, b) {
  61832. _extendStatics = Object.setPrototypeOf || {
  61833. __proto__: []
  61834. } instanceof Array && function (d, b) {
  61835. d.__proto__ = b;
  61836. } || function (d, b) {
  61837. for (var p in b) {
  61838. if (b.hasOwnProperty(p)) d[p] = b[p];
  61839. }
  61840. };
  61841. return _extendStatics(d, b);
  61842. };
  61843. return function (d, b) {
  61844. _extendStatics(d, b);
  61845. function __() {
  61846. this.constructor = d;
  61847. }
  61848. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  61849. };
  61850. }();
  61851. var __values = void 0 && (void 0).__values || function (o) {
  61852. var s = typeof Symbol === "function" && Symbol.iterator,
  61853. m = s && o[s],
  61854. i = 0;
  61855. if (m) return m.call(o);
  61856. if (o && typeof o.length === "number") return {
  61857. next: function next() {
  61858. if (o && i >= o.length) o = void 0;
  61859. return {
  61860. value: o && o[i++],
  61861. done: !o
  61862. };
  61863. }
  61864. };
  61865. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  61866. };
  61867. /**
  61868. * <p>Implements decoding of the EAN-13 format.</p>
  61869. *
  61870. * @author dswitkin@google.com (Daniel Switkin)
  61871. * @author Sean Owen
  61872. * @author alasdair@google.com (Alasdair Mackintosh)
  61873. */
  61874. var EAN13Reader = /** @class */function (_super) {
  61875. __extends(EAN13Reader, _super);
  61876. function EAN13Reader() {
  61877. var _this = _super.call(this) || this;
  61878. _this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
  61879. return _this;
  61880. }
  61881. EAN13Reader.prototype.decodeMiddle = function (row, startRange, resultString) {
  61882. var e_1, _a, e_2, _b;
  61883. var counters = this.decodeMiddleCounters;
  61884. counters[0] = 0;
  61885. counters[1] = 0;
  61886. counters[2] = 0;
  61887. counters[3] = 0;
  61888. var end = row.getSize();
  61889. var rowOffset = startRange[1];
  61890. var lgPatternFound = 0;
  61891. for (var x = 0; x < 6 && rowOffset < end; x++) {
  61892. var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_AND_G_PATTERNS);
  61893. resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
  61894. try {
  61895. for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  61896. var counter = counters_1_1.value;
  61897. rowOffset += counter;
  61898. }
  61899. } catch (e_1_1) {
  61900. e_1 = {
  61901. error: e_1_1
  61902. };
  61903. } finally {
  61904. try {
  61905. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  61906. } finally {
  61907. if (e_1) throw e_1.error;
  61908. }
  61909. }
  61910. if (bestMatch >= 10) {
  61911. lgPatternFound |= 1 << 5 - x;
  61912. }
  61913. }
  61914. resultString = EAN13Reader.determineFirstDigit(resultString, lgPatternFound);
  61915. var middleRange = _UPCEANReader.default.findGuardPattern(row, rowOffset, true, _UPCEANReader.default.MIDDLE_PATTERN, new Int32Array(_UPCEANReader.default.MIDDLE_PATTERN.length).fill(0));
  61916. rowOffset = middleRange[1];
  61917. for (var x = 0; x < 6 && rowOffset < end; x++) {
  61918. var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_PATTERNS);
  61919. resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch);
  61920. try {
  61921. for (var counters_2 = (e_2 = void 0, __values(counters)), counters_2_1 = counters_2.next(); !counters_2_1.done; counters_2_1 = counters_2.next()) {
  61922. var counter = counters_2_1.value;
  61923. rowOffset += counter;
  61924. }
  61925. } catch (e_2_1) {
  61926. e_2 = {
  61927. error: e_2_1
  61928. };
  61929. } finally {
  61930. try {
  61931. if (counters_2_1 && !counters_2_1.done && (_b = counters_2.return)) _b.call(counters_2);
  61932. } finally {
  61933. if (e_2) throw e_2.error;
  61934. }
  61935. }
  61936. }
  61937. return {
  61938. rowOffset: rowOffset,
  61939. resultString: resultString
  61940. };
  61941. };
  61942. EAN13Reader.prototype.getBarcodeFormat = function () {
  61943. return _BarcodeFormat.default.EAN_13;
  61944. };
  61945. EAN13Reader.determineFirstDigit = function (resultString, lgPatternFound) {
  61946. for (var d = 0; d < 10; d++) {
  61947. if (lgPatternFound === this.FIRST_DIGIT_ENCODINGS[d]) {
  61948. resultString = String.fromCharCode('0'.charCodeAt(0) + d) + resultString;
  61949. return resultString;
  61950. }
  61951. }
  61952. throw new _NotFoundException.default();
  61953. };
  61954. EAN13Reader.FIRST_DIGIT_ENCODINGS = [0x00, 0x0B, 0x0D, 0xE, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A];
  61955. return EAN13Reader;
  61956. }(_UPCEANReader.default);
  61957. var _default = EAN13Reader;
  61958. exports.default = _default;
  61959. /***/ }),
  61960. /* 365 */
  61961. /*!*************************************************************************************!*\
  61962. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANReader.js ***!
  61963. \*************************************************************************************/
  61964. /*! no static exports found */
  61965. /***/ (function(module, exports, __webpack_require__) {
  61966. "use strict";
  61967. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  61968. Object.defineProperty(exports, "__esModule", {
  61969. value: true
  61970. });
  61971. exports.default = void 0;
  61972. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  61973. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  61974. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  61975. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  61976. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  61977. var _UPCEANExtensionSupport = _interopRequireDefault(__webpack_require__(/*! ./UPCEANExtensionSupport */ 366));
  61978. var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
  61979. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  61980. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  61981. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
  61982. /*
  61983. * Copyright 2008 ZXing authors
  61984. *
  61985. * Licensed under the Apache License, Version 2.0 (the "License");
  61986. * you may not use this file except in compliance with the License.
  61987. * You may obtain a copy of the License at
  61988. *
  61989. * http://www.apache.org/licenses/LICENSE-2.0
  61990. *
  61991. * Unless required by applicable law or agreed to in writing, software
  61992. * distributed under the License is distributed on an "AS IS" BASIS,
  61993. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  61994. * See the License for the specific language governing permissions and
  61995. * limitations under the License.
  61996. */
  61997. var __extends = void 0 && (void 0).__extends || function () {
  61998. var _extendStatics = function extendStatics(d, b) {
  61999. _extendStatics = Object.setPrototypeOf || {
  62000. __proto__: []
  62001. } instanceof Array && function (d, b) {
  62002. d.__proto__ = b;
  62003. } || function (d, b) {
  62004. for (var p in b) {
  62005. if (b.hasOwnProperty(p)) d[p] = b[p];
  62006. }
  62007. };
  62008. return _extendStatics(d, b);
  62009. };
  62010. return function (d, b) {
  62011. _extendStatics(d, b);
  62012. function __() {
  62013. this.constructor = d;
  62014. }
  62015. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  62016. };
  62017. }();
  62018. /**
  62019. * <p>Encapsulates functionality and implementation that is common to UPC and EAN families
  62020. * of one-dimensional barcodes.</p>
  62021. *
  62022. * @author dswitkin@google.com (Daniel Switkin)
  62023. * @author Sean Owen
  62024. * @author alasdair@google.com (Alasdair Mackintosh)
  62025. */
  62026. var UPCEANReader = /** @class */function (_super) {
  62027. __extends(UPCEANReader, _super);
  62028. function UPCEANReader() {
  62029. var _this = _super.call(this) || this;
  62030. _this.decodeRowStringBuffer = '';
  62031. UPCEANReader.L_AND_G_PATTERNS = UPCEANReader.L_PATTERNS.map(function (arr) {
  62032. return Int32Array.from(arr);
  62033. });
  62034. for (var i = 10; i < 20; i++) {
  62035. var widths = UPCEANReader.L_PATTERNS[i - 10];
  62036. var reversedWidths = new Int32Array(widths.length);
  62037. for (var j = 0; j < widths.length; j++) {
  62038. reversedWidths[j] = widths[widths.length - j - 1];
  62039. }
  62040. UPCEANReader.L_AND_G_PATTERNS[i] = reversedWidths;
  62041. }
  62042. return _this;
  62043. }
  62044. UPCEANReader.prototype.decodeRow = function (rowNumber, row, hints) {
  62045. var startGuardRange = UPCEANReader.findStartGuardPattern(row);
  62046. var resultPointCallback = hints == null ? null : hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
  62047. if (resultPointCallback != null) {
  62048. var resultPoint_1 = new _ResultPoint.default((startGuardRange[0] + startGuardRange[1]) / 2.0, rowNumber);
  62049. resultPointCallback.foundPossibleResultPoint(resultPoint_1);
  62050. }
  62051. var budello = this.decodeMiddle(row, startGuardRange, this.decodeRowStringBuffer);
  62052. var endStart = budello.rowOffset;
  62053. var result = budello.resultString;
  62054. if (resultPointCallback != null) {
  62055. var resultPoint_2 = new _ResultPoint.default(endStart, rowNumber);
  62056. resultPointCallback.foundPossibleResultPoint(resultPoint_2);
  62057. }
  62058. var endRange = UPCEANReader.decodeEnd(row, endStart);
  62059. if (resultPointCallback != null) {
  62060. var resultPoint_3 = new _ResultPoint.default((endRange[0] + endRange[1]) / 2.0, rowNumber);
  62061. resultPointCallback.foundPossibleResultPoint(resultPoint_3);
  62062. }
  62063. // Make sure there is a quiet zone at least as big as the end pattern after the barcode. The
  62064. // spec might want more whitespace, but in practice this is the maximum we can count on.
  62065. var end = endRange[1];
  62066. var quietEnd = end + (end - endRange[0]);
  62067. if (quietEnd >= row.getSize() || !row.isRange(end, quietEnd, false)) {
  62068. throw new _NotFoundException.default();
  62069. }
  62070. var resultString = result.toString();
  62071. // UPC/EAN should never be less than 8 chars anyway
  62072. if (resultString.length < 8) {
  62073. throw new _FormatException.default();
  62074. }
  62075. if (!UPCEANReader.checkChecksum(resultString)) {
  62076. throw new _ChecksumException.default();
  62077. }
  62078. var left = (startGuardRange[1] + startGuardRange[0]) / 2.0;
  62079. var right = (endRange[1] + endRange[0]) / 2.0;
  62080. var format = this.getBarcodeFormat();
  62081. var resultPoint = [new _ResultPoint.default(left, rowNumber), new _ResultPoint.default(right, rowNumber)];
  62082. var decodeResult = new _Result.default(resultString, null, 0, resultPoint, format, new Date().getTime());
  62083. var extensionLength = 0;
  62084. try {
  62085. var extensionResult = _UPCEANExtensionSupport.default.decodeRow(rowNumber, row, endRange[1]);
  62086. decodeResult.putMetadata(_ResultMetadataType.default.UPC_EAN_EXTENSION, extensionResult.getText());
  62087. decodeResult.putAllMetadata(extensionResult.getResultMetadata());
  62088. decodeResult.addResultPoints(extensionResult.getResultPoints());
  62089. extensionLength = extensionResult.getText().length;
  62090. } catch (err) {}
  62091. var allowedExtensions = hints == null ? null : hints.get(_DecodeHintType.default.ALLOWED_EAN_EXTENSIONS);
  62092. if (allowedExtensions != null) {
  62093. var valid = false;
  62094. for (var length_1 in allowedExtensions) {
  62095. if (extensionLength.toString() === length_1) {
  62096. // check me
  62097. valid = true;
  62098. break;
  62099. }
  62100. }
  62101. if (!valid) {
  62102. throw new _NotFoundException.default();
  62103. }
  62104. }
  62105. if (format === _BarcodeFormat.default.EAN_13 || format === _BarcodeFormat.default.UPC_A) {
  62106. // let countryID = eanManSupport.lookupContryIdentifier(resultString); todo
  62107. // if (countryID != null) {
  62108. // decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
  62109. // }
  62110. }
  62111. return decodeResult;
  62112. };
  62113. UPCEANReader.checkChecksum = function (s) {
  62114. return UPCEANReader.checkStandardUPCEANChecksum(s);
  62115. };
  62116. UPCEANReader.checkStandardUPCEANChecksum = function (s) {
  62117. var length = s.length;
  62118. if (length === 0) return false;
  62119. var check = parseInt(s.charAt(length - 1), 10);
  62120. return UPCEANReader.getStandardUPCEANChecksum(s.substring(0, length - 1)) === check;
  62121. };
  62122. UPCEANReader.getStandardUPCEANChecksum = function (s) {
  62123. var length = s.length;
  62124. var sum = 0;
  62125. for (var i = length - 1; i >= 0; i -= 2) {
  62126. var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  62127. if (digit < 0 || digit > 9) {
  62128. throw new _FormatException.default();
  62129. }
  62130. sum += digit;
  62131. }
  62132. sum *= 3;
  62133. for (var i = length - 2; i >= 0; i -= 2) {
  62134. var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  62135. if (digit < 0 || digit > 9) {
  62136. throw new _FormatException.default();
  62137. }
  62138. sum += digit;
  62139. }
  62140. return (1000 - sum) % 10;
  62141. };
  62142. UPCEANReader.decodeEnd = function (row, endStart) {
  62143. return UPCEANReader.findGuardPattern(row, endStart, false, UPCEANReader.START_END_PATTERN, new Int32Array(UPCEANReader.START_END_PATTERN.length).fill(0));
  62144. };
  62145. return UPCEANReader;
  62146. }(_AbstractUPCEANReader.default);
  62147. var _default = UPCEANReader;
  62148. exports.default = _default;
  62149. /***/ }),
  62150. /* 366 */
  62151. /*!***********************************************************************************************!*\
  62152. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANExtensionSupport.js ***!
  62153. \***********************************************************************************************/
  62154. /*! no static exports found */
  62155. /***/ (function(module, exports, __webpack_require__) {
  62156. "use strict";
  62157. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62158. Object.defineProperty(exports, "__esModule", {
  62159. value: true
  62160. });
  62161. exports.default = void 0;
  62162. var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
  62163. var _UPCEANExtension5Support = _interopRequireDefault(__webpack_require__(/*! ./UPCEANExtension5Support */ 368));
  62164. var _UPCEANExtension2Support = _interopRequireDefault(__webpack_require__(/*! ./UPCEANExtension2Support */ 369));
  62165. /*
  62166. * Copyright (C) 2010 ZXing authors
  62167. *
  62168. * Licensed under the Apache License, Version 2.0 (the "License");
  62169. * you may not use this file except in compliance with the License.
  62170. * You may obtain a copy of the License at
  62171. *
  62172. * http://www.apache.org/licenses/LICENSE-2.0
  62173. *
  62174. * Unless required by applicable law or agreed to in writing, software
  62175. * distributed under the License is distributed on an "AS IS" BASIS,
  62176. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  62177. * See the License for the specific language governing permissions and
  62178. * limitations under the License.
  62179. */
  62180. var UPCEANExtensionSupport = /** @class */function () {
  62181. function UPCEANExtensionSupport() {}
  62182. UPCEANExtensionSupport.decodeRow = function (rowNumber, row, rowOffset) {
  62183. var extensionStartRange = _AbstractUPCEANReader.default.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));
  62184. try {
  62185. // return null;
  62186. var fiveSupport = new _UPCEANExtension5Support.default();
  62187. return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);
  62188. } catch (err) {
  62189. // return null;
  62190. var twoSupport = new _UPCEANExtension2Support.default();
  62191. return twoSupport.decodeRow(rowNumber, row, extensionStartRange);
  62192. }
  62193. };
  62194. UPCEANExtensionSupport.EXTENSION_START_PATTERN = Int32Array.from([1, 1, 2]);
  62195. return UPCEANExtensionSupport;
  62196. }();
  62197. var _default = UPCEANExtensionSupport;
  62198. exports.default = _default;
  62199. /***/ }),
  62200. /* 367 */
  62201. /*!*********************************************************************************************!*\
  62202. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/AbstractUPCEANReader.js ***!
  62203. \*********************************************************************************************/
  62204. /*! no static exports found */
  62205. /***/ (function(module, exports, __webpack_require__) {
  62206. "use strict";
  62207. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62208. Object.defineProperty(exports, "__esModule", {
  62209. value: true
  62210. });
  62211. exports.default = void 0;
  62212. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  62213. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  62214. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  62215. /*
  62216. * Copyright 2008 ZXing authors
  62217. *
  62218. * Licensed under the Apache License, Version 2.0 (the "License");
  62219. * you may not use this file except in compliance with the License.
  62220. * You may obtain a copy of the License at
  62221. *
  62222. * http://www.apache.org/licenses/LICENSE-2.0
  62223. *
  62224. * Unless required by applicable law or agreed to in writing, software
  62225. * distributed under the License is distributed on an "AS IS" BASIS,
  62226. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  62227. * See the License for the specific language governing permissions and
  62228. * limitations under the License.
  62229. */
  62230. var __extends = void 0 && (void 0).__extends || function () {
  62231. var _extendStatics = function extendStatics(d, b) {
  62232. _extendStatics = Object.setPrototypeOf || {
  62233. __proto__: []
  62234. } instanceof Array && function (d, b) {
  62235. d.__proto__ = b;
  62236. } || function (d, b) {
  62237. for (var p in b) {
  62238. if (b.hasOwnProperty(p)) d[p] = b[p];
  62239. }
  62240. };
  62241. return _extendStatics(d, b);
  62242. };
  62243. return function (d, b) {
  62244. _extendStatics(d, b);
  62245. function __() {
  62246. this.constructor = d;
  62247. }
  62248. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  62249. };
  62250. }();
  62251. /**
  62252. * <p>Encapsulates functionality and implementation that is common to UPC and EAN families
  62253. * of one-dimensional barcodes.</p>
  62254. *
  62255. * @author dswitkin@google.com (Daniel Switkin)
  62256. * @author Sean Owen
  62257. * @author alasdair@google.com (Alasdair Mackintosh)
  62258. */
  62259. var AbstractUPCEANReader = /** @class */function (_super) {
  62260. __extends(AbstractUPCEANReader, _super);
  62261. function AbstractUPCEANReader() {
  62262. var _this = _super !== null && _super.apply(this, arguments) || this;
  62263. _this.decodeRowStringBuffer = '';
  62264. return _this;
  62265. }
  62266. // private final UPCEANExtensionSupport extensionReader;
  62267. // private final EANManufacturerOrgSupport eanManSupport;
  62268. /*
  62269. protected UPCEANReader() {
  62270. decodeRowStringBuffer = new StringBuilder(20);
  62271. extensionReader = new UPCEANExtensionSupport();
  62272. eanManSupport = new EANManufacturerOrgSupport();
  62273. }
  62274. */
  62275. AbstractUPCEANReader.findStartGuardPattern = function (row) {
  62276. var foundStart = false;
  62277. var startRange;
  62278. var nextStart = 0;
  62279. var counters = Int32Array.from([0, 0, 0]);
  62280. while (!foundStart) {
  62281. counters = Int32Array.from([0, 0, 0]);
  62282. startRange = AbstractUPCEANReader.findGuardPattern(row, nextStart, false, this.START_END_PATTERN, counters);
  62283. var start = startRange[0];
  62284. nextStart = startRange[1];
  62285. var quietStart = start - (nextStart - start);
  62286. if (quietStart >= 0) {
  62287. foundStart = row.isRange(quietStart, start, false);
  62288. }
  62289. }
  62290. return startRange;
  62291. };
  62292. AbstractUPCEANReader.checkChecksum = function (s) {
  62293. return AbstractUPCEANReader.checkStandardUPCEANChecksum(s);
  62294. };
  62295. AbstractUPCEANReader.checkStandardUPCEANChecksum = function (s) {
  62296. var length = s.length;
  62297. if (length === 0) return false;
  62298. var check = parseInt(s.charAt(length - 1), 10);
  62299. return AbstractUPCEANReader.getStandardUPCEANChecksum(s.substring(0, length - 1)) === check;
  62300. };
  62301. AbstractUPCEANReader.getStandardUPCEANChecksum = function (s) {
  62302. var length = s.length;
  62303. var sum = 0;
  62304. for (var i = length - 1; i >= 0; i -= 2) {
  62305. var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  62306. if (digit < 0 || digit > 9) {
  62307. throw new _FormatException.default();
  62308. }
  62309. sum += digit;
  62310. }
  62311. sum *= 3;
  62312. for (var i = length - 2; i >= 0; i -= 2) {
  62313. var digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  62314. if (digit < 0 || digit > 9) {
  62315. throw new _FormatException.default();
  62316. }
  62317. sum += digit;
  62318. }
  62319. return (1000 - sum) % 10;
  62320. };
  62321. AbstractUPCEANReader.decodeEnd = function (row, endStart) {
  62322. return AbstractUPCEANReader.findGuardPattern(row, endStart, false, AbstractUPCEANReader.START_END_PATTERN, new Int32Array(AbstractUPCEANReader.START_END_PATTERN.length).fill(0));
  62323. };
  62324. /**
  62325. * @throws NotFoundException
  62326. */
  62327. AbstractUPCEANReader.findGuardPatternWithoutCounters = function (row, rowOffset, whiteFirst, pattern) {
  62328. return this.findGuardPattern(row, rowOffset, whiteFirst, pattern, new Int32Array(pattern.length));
  62329. };
  62330. /**
  62331. * @param row row of black/white values to search
  62332. * @param rowOffset position to start search
  62333. * @param whiteFirst if true, indicates that the pattern specifies white/black/white/...
  62334. * pixel counts, otherwise, it is interpreted as black/white/black/...
  62335. * @param pattern pattern of counts of number of black and white pixels that are being
  62336. * searched for as a pattern
  62337. * @param counters array of counters, as long as pattern, to re-use
  62338. * @return start/end horizontal offset of guard pattern, as an array of two ints
  62339. * @throws NotFoundException if pattern is not found
  62340. */
  62341. AbstractUPCEANReader.findGuardPattern = function (row, rowOffset, whiteFirst, pattern, counters) {
  62342. var width = row.getSize();
  62343. rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
  62344. var counterPosition = 0;
  62345. var patternStart = rowOffset;
  62346. var patternLength = pattern.length;
  62347. var isWhite = whiteFirst;
  62348. for (var x = rowOffset; x < width; x++) {
  62349. if (row.get(x) !== isWhite) {
  62350. counters[counterPosition]++;
  62351. } else {
  62352. if (counterPosition === patternLength - 1) {
  62353. if (_OneDReader.default.patternMatchVariance(counters, pattern, AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE) < AbstractUPCEANReader.MAX_AVG_VARIANCE) {
  62354. return Int32Array.from([patternStart, x]);
  62355. }
  62356. patternStart += counters[0] + counters[1];
  62357. var slice = counters.slice(2, counters.length);
  62358. for (var i = 0; i < counterPosition - 1; i++) {
  62359. counters[i] = slice[i];
  62360. }
  62361. counters[counterPosition - 1] = 0;
  62362. counters[counterPosition] = 0;
  62363. counterPosition--;
  62364. } else {
  62365. counterPosition++;
  62366. }
  62367. counters[counterPosition] = 1;
  62368. isWhite = !isWhite;
  62369. }
  62370. }
  62371. throw new _NotFoundException.default();
  62372. };
  62373. AbstractUPCEANReader.decodeDigit = function (row, counters, rowOffset, patterns) {
  62374. this.recordPattern(row, rowOffset, counters);
  62375. var bestVariance = this.MAX_AVG_VARIANCE;
  62376. var bestMatch = -1;
  62377. var max = patterns.length;
  62378. for (var i = 0; i < max; i++) {
  62379. var pattern = patterns[i];
  62380. var variance = _OneDReader.default.patternMatchVariance(counters, pattern, AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE);
  62381. if (variance < bestVariance) {
  62382. bestVariance = variance;
  62383. bestMatch = i;
  62384. }
  62385. }
  62386. if (bestMatch >= 0) {
  62387. return bestMatch;
  62388. } else {
  62389. throw new _NotFoundException.default();
  62390. }
  62391. };
  62392. // These two values are critical for determining how permissive the decoding will be.
  62393. // We've arrived at these values through a lot of trial and error. Setting them any higher
  62394. // lets false positives creep in quickly.
  62395. AbstractUPCEANReader.MAX_AVG_VARIANCE = 0.48;
  62396. AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE = 0.7;
  62397. /**
  62398. * Start/end guard pattern.
  62399. */
  62400. AbstractUPCEANReader.START_END_PATTERN = Int32Array.from([1, 1, 1]);
  62401. /**
  62402. * Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
  62403. */
  62404. AbstractUPCEANReader.MIDDLE_PATTERN = Int32Array.from([1, 1, 1, 1, 1]);
  62405. /**
  62406. * end guard pattern.
  62407. */
  62408. AbstractUPCEANReader.END_PATTERN = Int32Array.from([1, 1, 1, 1, 1, 1]);
  62409. /**
  62410. * "Odd", or "L" patterns used to encode UPC/EAN digits.
  62411. */
  62412. AbstractUPCEANReader.L_PATTERNS = [Int32Array.from([3, 2, 1, 1]), Int32Array.from([2, 2, 2, 1]), Int32Array.from([2, 1, 2, 2]), Int32Array.from([1, 4, 1, 1]), Int32Array.from([1, 1, 3, 2]), Int32Array.from([1, 2, 3, 1]), Int32Array.from([1, 1, 1, 4]), Int32Array.from([1, 3, 1, 2]), Int32Array.from([1, 2, 1, 3]), Int32Array.from([3, 1, 1, 2])];
  62413. return AbstractUPCEANReader;
  62414. }(_OneDReader.default);
  62415. var _default = AbstractUPCEANReader;
  62416. exports.default = _default;
  62417. /***/ }),
  62418. /* 368 */
  62419. /*!************************************************************************************************!*\
  62420. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANExtension5Support.js ***!
  62421. \************************************************************************************************/
  62422. /*! no static exports found */
  62423. /***/ (function(module, exports, __webpack_require__) {
  62424. "use strict";
  62425. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62426. Object.defineProperty(exports, "__esModule", {
  62427. value: true
  62428. });
  62429. exports.default = void 0;
  62430. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  62431. var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
  62432. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  62433. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  62434. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  62435. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  62436. /*
  62437. * Copyright (C) 2010 ZXing authors
  62438. *
  62439. * Licensed under the Apache License, Version 2.0 (the "License");
  62440. * you may not use this file except in compliance with the License.
  62441. * You may obtain a copy of the License at
  62442. *
  62443. * http://www.apache.org/licenses/LICENSE-2.0
  62444. *
  62445. * Unless required by applicable law or agreed to in writing, software
  62446. * distributed under the License is distributed on an "AS IS" BASIS,
  62447. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  62448. * See the License for the specific language governing permissions and
  62449. * limitations under the License.
  62450. */
  62451. var __values = void 0 && (void 0).__values || function (o) {
  62452. var s = typeof Symbol === "function" && Symbol.iterator,
  62453. m = s && o[s],
  62454. i = 0;
  62455. if (m) return m.call(o);
  62456. if (o && typeof o.length === "number") return {
  62457. next: function next() {
  62458. if (o && i >= o.length) o = void 0;
  62459. return {
  62460. value: o && o[i++],
  62461. done: !o
  62462. };
  62463. }
  62464. };
  62465. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  62466. };
  62467. /**
  62468. * @see UPCEANExtension2Support
  62469. */
  62470. var UPCEANExtension5Support = /** @class */function () {
  62471. function UPCEANExtension5Support() {
  62472. this.CHECK_DIGIT_ENCODINGS = [0x18, 0x14, 0x12, 0x11, 0x0C, 0x06, 0x03, 0x0A, 0x09, 0x05];
  62473. this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
  62474. this.decodeRowStringBuffer = '';
  62475. }
  62476. UPCEANExtension5Support.prototype.decodeRow = function (rowNumber, row, extensionStartRange) {
  62477. var result = this.decodeRowStringBuffer;
  62478. var end = this.decodeMiddle(row, extensionStartRange, result);
  62479. var resultString = result.toString();
  62480. var extensionData = UPCEANExtension5Support.parseExtensionString(resultString);
  62481. var resultPoints = [new _ResultPoint.default((extensionStartRange[0] + extensionStartRange[1]) / 2.0, rowNumber), new _ResultPoint.default(end, rowNumber)];
  62482. var extensionResult = new _Result.default(resultString, null, 0, resultPoints, _BarcodeFormat.default.UPC_EAN_EXTENSION, new Date().getTime());
  62483. if (extensionData != null) {
  62484. extensionResult.putAllMetadata(extensionData);
  62485. }
  62486. return extensionResult;
  62487. };
  62488. UPCEANExtension5Support.prototype.decodeMiddle = function (row, startRange, resultString) {
  62489. var e_1, _a;
  62490. var counters = this.decodeMiddleCounters;
  62491. counters[0] = 0;
  62492. counters[1] = 0;
  62493. counters[2] = 0;
  62494. counters[3] = 0;
  62495. var end = row.getSize();
  62496. var rowOffset = startRange[1];
  62497. var lgPatternFound = 0;
  62498. for (var x = 0; x < 5 && rowOffset < end; x++) {
  62499. var bestMatch = _AbstractUPCEANReader.default.decodeDigit(row, counters, rowOffset, _AbstractUPCEANReader.default.L_AND_G_PATTERNS);
  62500. resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
  62501. try {
  62502. for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  62503. var counter = counters_1_1.value;
  62504. rowOffset += counter;
  62505. }
  62506. } catch (e_1_1) {
  62507. e_1 = {
  62508. error: e_1_1
  62509. };
  62510. } finally {
  62511. try {
  62512. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  62513. } finally {
  62514. if (e_1) throw e_1.error;
  62515. }
  62516. }
  62517. if (bestMatch >= 10) {
  62518. lgPatternFound |= 1 << 4 - x;
  62519. }
  62520. if (x !== 4) {
  62521. // Read off separator if not last
  62522. rowOffset = row.getNextSet(rowOffset);
  62523. rowOffset = row.getNextUnset(rowOffset);
  62524. }
  62525. }
  62526. if (resultString.length !== 5) {
  62527. throw new _NotFoundException.default();
  62528. }
  62529. var checkDigit = this.determineCheckDigit(lgPatternFound);
  62530. if (UPCEANExtension5Support.extensionChecksum(resultString.toString()) !== checkDigit) {
  62531. throw new _NotFoundException.default();
  62532. }
  62533. return rowOffset;
  62534. };
  62535. UPCEANExtension5Support.extensionChecksum = function (s) {
  62536. var length = s.length;
  62537. var sum = 0;
  62538. for (var i = length - 2; i >= 0; i -= 2) {
  62539. sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  62540. }
  62541. sum *= 3;
  62542. for (var i = length - 1; i >= 0; i -= 2) {
  62543. sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  62544. }
  62545. sum *= 3;
  62546. return sum % 10;
  62547. };
  62548. UPCEANExtension5Support.prototype.determineCheckDigit = function (lgPatternFound) {
  62549. for (var d = 0; d < 10; d++) {
  62550. if (lgPatternFound === this.CHECK_DIGIT_ENCODINGS[d]) {
  62551. return d;
  62552. }
  62553. }
  62554. throw new _NotFoundException.default();
  62555. };
  62556. UPCEANExtension5Support.parseExtensionString = function (raw) {
  62557. if (raw.length !== 5) {
  62558. return null;
  62559. }
  62560. var value = UPCEANExtension5Support.parseExtension5String(raw);
  62561. if (value == null) {
  62562. return null;
  62563. }
  62564. return new Map([[_ResultMetadataType.default.SUGGESTED_PRICE, value]]);
  62565. };
  62566. UPCEANExtension5Support.parseExtension5String = function (raw) {
  62567. var currency;
  62568. switch (raw.charAt(0)) {
  62569. case '0':
  62570. currency = '£';
  62571. break;
  62572. case '5':
  62573. currency = '$';
  62574. break;
  62575. case '9':
  62576. // Reference: http://www.jollytech.com
  62577. switch (raw) {
  62578. case '90000':
  62579. // No suggested retail price
  62580. return null;
  62581. case '99991':
  62582. // Complementary
  62583. return '0.00';
  62584. case '99990':
  62585. return 'Used';
  62586. }
  62587. // Otherwise... unknown currency?
  62588. currency = '';
  62589. break;
  62590. default:
  62591. currency = '';
  62592. break;
  62593. }
  62594. var rawAmount = parseInt(raw.substring(1));
  62595. var unitsString = (rawAmount / 100).toString();
  62596. var hundredths = rawAmount % 100;
  62597. var hundredthsString = hundredths < 10 ? '0' + hundredths : hundredths.toString(); // fixme
  62598. return currency + unitsString + '.' + hundredthsString;
  62599. };
  62600. return UPCEANExtension5Support;
  62601. }();
  62602. var _default = UPCEANExtension5Support;
  62603. exports.default = _default;
  62604. /***/ }),
  62605. /* 369 */
  62606. /*!************************************************************************************************!*\
  62607. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEANExtension2Support.js ***!
  62608. \************************************************************************************************/
  62609. /*! no static exports found */
  62610. /***/ (function(module, exports, __webpack_require__) {
  62611. "use strict";
  62612. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62613. Object.defineProperty(exports, "__esModule", {
  62614. value: true
  62615. });
  62616. exports.default = void 0;
  62617. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  62618. var _AbstractUPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractUPCEANReader */ 367));
  62619. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  62620. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  62621. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  62622. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  62623. /*
  62624. * Copyright (C) 2012 ZXing authors
  62625. *
  62626. * Licensed under the Apache License, Version 2.0 (the "License");
  62627. * you may not use this file except in compliance with the License.
  62628. * You may obtain a copy of the License at
  62629. *
  62630. * http://www.apache.org/licenses/LICENSE-2.0
  62631. *
  62632. * Unless required by applicable law or agreed to in writing, software
  62633. * distributed under the License is distributed on an "AS IS" BASIS,
  62634. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  62635. * See the License for the specific language governing permissions and
  62636. * limitations under the License.
  62637. */
  62638. var __values = void 0 && (void 0).__values || function (o) {
  62639. var s = typeof Symbol === "function" && Symbol.iterator,
  62640. m = s && o[s],
  62641. i = 0;
  62642. if (m) return m.call(o);
  62643. if (o && typeof o.length === "number") return {
  62644. next: function next() {
  62645. if (o && i >= o.length) o = void 0;
  62646. return {
  62647. value: o && o[i++],
  62648. done: !o
  62649. };
  62650. }
  62651. };
  62652. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  62653. };
  62654. /**
  62655. * @see UPCEANExtension5Support
  62656. */
  62657. var UPCEANExtension2Support = /** @class */function () {
  62658. function UPCEANExtension2Support() {
  62659. this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
  62660. this.decodeRowStringBuffer = '';
  62661. }
  62662. UPCEANExtension2Support.prototype.decodeRow = function (rowNumber, row, extensionStartRange) {
  62663. var result = this.decodeRowStringBuffer;
  62664. var end = this.decodeMiddle(row, extensionStartRange, result);
  62665. var resultString = result.toString();
  62666. var extensionData = UPCEANExtension2Support.parseExtensionString(resultString);
  62667. var resultPoints = [new _ResultPoint.default((extensionStartRange[0] + extensionStartRange[1]) / 2.0, rowNumber), new _ResultPoint.default(end, rowNumber)];
  62668. var extensionResult = new _Result.default(resultString, null, 0, resultPoints, _BarcodeFormat.default.UPC_EAN_EXTENSION, new Date().getTime());
  62669. if (extensionData != null) {
  62670. extensionResult.putAllMetadata(extensionData);
  62671. }
  62672. return extensionResult;
  62673. };
  62674. UPCEANExtension2Support.prototype.decodeMiddle = function (row, startRange, resultString) {
  62675. var e_1, _a;
  62676. var counters = this.decodeMiddleCounters;
  62677. counters[0] = 0;
  62678. counters[1] = 0;
  62679. counters[2] = 0;
  62680. counters[3] = 0;
  62681. var end = row.getSize();
  62682. var rowOffset = startRange[1];
  62683. var checkParity = 0;
  62684. for (var x = 0; x < 2 && rowOffset < end; x++) {
  62685. var bestMatch = _AbstractUPCEANReader.default.decodeDigit(row, counters, rowOffset, _AbstractUPCEANReader.default.L_AND_G_PATTERNS);
  62686. resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
  62687. try {
  62688. for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  62689. var counter = counters_1_1.value;
  62690. rowOffset += counter;
  62691. }
  62692. } catch (e_1_1) {
  62693. e_1 = {
  62694. error: e_1_1
  62695. };
  62696. } finally {
  62697. try {
  62698. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  62699. } finally {
  62700. if (e_1) throw e_1.error;
  62701. }
  62702. }
  62703. if (bestMatch >= 10) {
  62704. checkParity |= 1 << 1 - x;
  62705. }
  62706. if (x !== 1) {
  62707. // Read off separator if not last
  62708. rowOffset = row.getNextSet(rowOffset);
  62709. rowOffset = row.getNextUnset(rowOffset);
  62710. }
  62711. }
  62712. if (resultString.length !== 2) {
  62713. throw new _NotFoundException.default();
  62714. }
  62715. if (parseInt(resultString.toString()) % 4 !== checkParity) {
  62716. throw new _NotFoundException.default();
  62717. }
  62718. return rowOffset;
  62719. };
  62720. UPCEANExtension2Support.parseExtensionString = function (raw) {
  62721. if (raw.length !== 2) {
  62722. return null;
  62723. }
  62724. return new Map([[_ResultMetadataType.default.ISSUE_NUMBER, parseInt(raw)]]);
  62725. };
  62726. return UPCEANExtension2Support;
  62727. }();
  62728. var _default = UPCEANExtension2Support;
  62729. exports.default = _default;
  62730. /***/ }),
  62731. /* 370 */
  62732. /*!***********************************************************************************!*\
  62733. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/EAN8Reader.js ***!
  62734. \***********************************************************************************/
  62735. /*! no static exports found */
  62736. /***/ (function(module, exports, __webpack_require__) {
  62737. "use strict";
  62738. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62739. Object.defineProperty(exports, "__esModule", {
  62740. value: true
  62741. });
  62742. exports.default = void 0;
  62743. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  62744. var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
  62745. /*
  62746. * Copyright 2008 ZXing authors
  62747. *
  62748. * Licensed under the Apache License, Version 2.0 (the "License");
  62749. * you may not use this file except in compliance with the License.
  62750. * You may obtain a copy of the License at
  62751. *
  62752. * http://www.apache.org/licenses/LICENSE-2.0
  62753. *
  62754. * Unless required by applicable law or agreed to in writing, software
  62755. * distributed under the License is distributed on an "AS IS" BASIS,
  62756. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  62757. * See the License for the specific language governing permissions and
  62758. * limitations under the License.
  62759. */
  62760. var __extends = void 0 && (void 0).__extends || function () {
  62761. var _extendStatics = function extendStatics(d, b) {
  62762. _extendStatics = Object.setPrototypeOf || {
  62763. __proto__: []
  62764. } instanceof Array && function (d, b) {
  62765. d.__proto__ = b;
  62766. } || function (d, b) {
  62767. for (var p in b) {
  62768. if (b.hasOwnProperty(p)) d[p] = b[p];
  62769. }
  62770. };
  62771. return _extendStatics(d, b);
  62772. };
  62773. return function (d, b) {
  62774. _extendStatics(d, b);
  62775. function __() {
  62776. this.constructor = d;
  62777. }
  62778. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  62779. };
  62780. }();
  62781. var __values = void 0 && (void 0).__values || function (o) {
  62782. var s = typeof Symbol === "function" && Symbol.iterator,
  62783. m = s && o[s],
  62784. i = 0;
  62785. if (m) return m.call(o);
  62786. if (o && typeof o.length === "number") return {
  62787. next: function next() {
  62788. if (o && i >= o.length) o = void 0;
  62789. return {
  62790. value: o && o[i++],
  62791. done: !o
  62792. };
  62793. }
  62794. };
  62795. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  62796. };
  62797. /**
  62798. * <p>Implements decoding of the EAN-8 format.</p>
  62799. *
  62800. * @author Sean Owen
  62801. */
  62802. var EAN8Reader = /** @class */function (_super) {
  62803. __extends(EAN8Reader, _super);
  62804. function EAN8Reader() {
  62805. var _this = _super.call(this) || this;
  62806. _this.decodeMiddleCounters = Int32Array.from([0, 0, 0, 0]);
  62807. return _this;
  62808. }
  62809. EAN8Reader.prototype.decodeMiddle = function (row, startRange, resultString) {
  62810. var e_1, _a, e_2, _b;
  62811. var counters = this.decodeMiddleCounters;
  62812. counters[0] = 0;
  62813. counters[1] = 0;
  62814. counters[2] = 0;
  62815. counters[3] = 0;
  62816. var end = row.getSize();
  62817. var rowOffset = startRange[1];
  62818. for (var x = 0; x < 4 && rowOffset < end; x++) {
  62819. var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_PATTERNS);
  62820. resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch);
  62821. try {
  62822. for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  62823. var counter = counters_1_1.value;
  62824. rowOffset += counter;
  62825. }
  62826. } catch (e_1_1) {
  62827. e_1 = {
  62828. error: e_1_1
  62829. };
  62830. } finally {
  62831. try {
  62832. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  62833. } finally {
  62834. if (e_1) throw e_1.error;
  62835. }
  62836. }
  62837. }
  62838. var middleRange = _UPCEANReader.default.findGuardPattern(row, rowOffset, true, _UPCEANReader.default.MIDDLE_PATTERN, new Int32Array(_UPCEANReader.default.MIDDLE_PATTERN.length).fill(0));
  62839. rowOffset = middleRange[1];
  62840. for (var x = 0; x < 4 && rowOffset < end; x++) {
  62841. var bestMatch = _UPCEANReader.default.decodeDigit(row, counters, rowOffset, _UPCEANReader.default.L_PATTERNS);
  62842. resultString += String.fromCharCode('0'.charCodeAt(0) + bestMatch);
  62843. try {
  62844. for (var counters_2 = (e_2 = void 0, __values(counters)), counters_2_1 = counters_2.next(); !counters_2_1.done; counters_2_1 = counters_2.next()) {
  62845. var counter = counters_2_1.value;
  62846. rowOffset += counter;
  62847. }
  62848. } catch (e_2_1) {
  62849. e_2 = {
  62850. error: e_2_1
  62851. };
  62852. } finally {
  62853. try {
  62854. if (counters_2_1 && !counters_2_1.done && (_b = counters_2.return)) _b.call(counters_2);
  62855. } finally {
  62856. if (e_2) throw e_2.error;
  62857. }
  62858. }
  62859. }
  62860. return {
  62861. rowOffset: rowOffset,
  62862. resultString: resultString
  62863. };
  62864. };
  62865. EAN8Reader.prototype.getBarcodeFormat = function () {
  62866. return _BarcodeFormat.default.EAN_8;
  62867. };
  62868. return EAN8Reader;
  62869. }(_UPCEANReader.default);
  62870. var _default = EAN8Reader;
  62871. exports.default = _default;
  62872. /***/ }),
  62873. /* 371 */
  62874. /*!***********************************************************************************!*\
  62875. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCAReader.js ***!
  62876. \***********************************************************************************/
  62877. /*! no static exports found */
  62878. /***/ (function(module, exports, __webpack_require__) {
  62879. "use strict";
  62880. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62881. Object.defineProperty(exports, "__esModule", {
  62882. value: true
  62883. });
  62884. exports.default = void 0;
  62885. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  62886. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  62887. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  62888. var _EAN13Reader = _interopRequireDefault(__webpack_require__(/*! ./EAN13Reader */ 364));
  62889. var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
  62890. /*
  62891. * Copyright 2008 ZXing authors
  62892. *
  62893. * Licensed under the Apache License, Version 2.0 (the "License");
  62894. * you may not use this file except in compliance with the License.
  62895. * You may obtain a copy of the License at
  62896. *
  62897. * http://www.apache.org/licenses/LICENSE-2.0
  62898. *
  62899. * Unless required by applicable law or agreed to in writing, software
  62900. * distributed under the License is distributed on an "AS IS" BASIS,
  62901. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  62902. * See the License for the specific language governing permissions and
  62903. * limitations under the License.
  62904. */
  62905. var __extends = void 0 && (void 0).__extends || function () {
  62906. var _extendStatics = function extendStatics(d, b) {
  62907. _extendStatics = Object.setPrototypeOf || {
  62908. __proto__: []
  62909. } instanceof Array && function (d, b) {
  62910. d.__proto__ = b;
  62911. } || function (d, b) {
  62912. for (var p in b) {
  62913. if (b.hasOwnProperty(p)) d[p] = b[p];
  62914. }
  62915. };
  62916. return _extendStatics(d, b);
  62917. };
  62918. return function (d, b) {
  62919. _extendStatics(d, b);
  62920. function __() {
  62921. this.constructor = d;
  62922. }
  62923. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  62924. };
  62925. }();
  62926. /*namespace com.google.zxing.oned {*/
  62927. /**
  62928. * Encapsulates functionality and implementation that is common to all families
  62929. * of one-dimensional barcodes.
  62930. *
  62931. * @author dswitkin@google.com (Daniel Switkin)
  62932. * @author Sean Owen
  62933. * @author sam2332 (Sam Rudloff)
  62934. *
  62935. * @source https://github.com/zxing/zxing/blob/3c96923276dd5785d58eb970b6ba3f80d36a9505/core/src/main/java/com/google/zxing/oned/UPCAReader.java
  62936. *
  62937. * @experimental
  62938. */
  62939. var UPCAReader = /** @class */function (_super) {
  62940. __extends(UPCAReader, _super);
  62941. function UPCAReader() {
  62942. var _this = _super !== null && _super.apply(this, arguments) || this;
  62943. _this.ean13Reader = new _EAN13Reader.default();
  62944. return _this;
  62945. }
  62946. // @Override
  62947. UPCAReader.prototype.getBarcodeFormat = function () {
  62948. return _BarcodeFormat.default.UPC_A;
  62949. };
  62950. // Note that we don't try rotation without the try harder flag, even if rotation was supported.
  62951. // @Override
  62952. UPCAReader.prototype.decode = function (image, hints) {
  62953. return this.maybeReturnResult(this.ean13Reader.decode(image));
  62954. };
  62955. // @Override
  62956. UPCAReader.prototype.decodeRow = function (rowNumber, row, hints) {
  62957. return this.maybeReturnResult(this.ean13Reader.decodeRow(rowNumber, row, hints));
  62958. };
  62959. // @Override
  62960. UPCAReader.prototype.decodeMiddle = function (row, startRange, resultString) {
  62961. return this.ean13Reader.decodeMiddle(row, startRange, resultString);
  62962. };
  62963. UPCAReader.prototype.maybeReturnResult = function (result) {
  62964. var text = result.getText();
  62965. if (text.charAt(0) === '0') {
  62966. var upcaResult = new _Result.default(text.substring(1), null, null, result.getResultPoints(), _BarcodeFormat.default.UPC_A);
  62967. if (result.getResultMetadata() != null) {
  62968. upcaResult.putAllMetadata(result.getResultMetadata());
  62969. }
  62970. return upcaResult;
  62971. } else {
  62972. throw new _NotFoundException.default();
  62973. }
  62974. };
  62975. UPCAReader.prototype.reset = function () {
  62976. this.ean13Reader.reset();
  62977. };
  62978. return UPCAReader;
  62979. }(_UPCEANReader.default);
  62980. var _default = UPCAReader;
  62981. exports.default = _default;
  62982. /***/ }),
  62983. /* 372 */
  62984. /*!***********************************************************************************!*\
  62985. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/UPCEReader.js ***!
  62986. \***********************************************************************************/
  62987. /*! no static exports found */
  62988. /***/ (function(module, exports, __webpack_require__) {
  62989. "use strict";
  62990. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  62991. Object.defineProperty(exports, "__esModule", {
  62992. value: true
  62993. });
  62994. exports.default = void 0;
  62995. var _UPCEANReader = _interopRequireDefault(__webpack_require__(/*! ./UPCEANReader */ 365));
  62996. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
  62997. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  62998. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  62999. /*
  63000. * Copyright 2008 ZXing authors
  63001. *
  63002. * Licensed under the Apache License, Version 2.0 (the "License");
  63003. * you may not use this file except in compliance with the License.
  63004. * You may obtain a copy of the License at
  63005. *
  63006. * http://www.apache.org/licenses/LICENSE-2.0
  63007. *
  63008. * Unless required by applicable law or agreed to in writing, software
  63009. * distributed under the License is distributed on an "AS IS" BASIS,
  63010. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  63011. * See the License for the specific language governing permissions and
  63012. * limitations under the License.
  63013. */
  63014. var __extends = void 0 && (void 0).__extends || function () {
  63015. var _extendStatics = function extendStatics(d, b) {
  63016. _extendStatics = Object.setPrototypeOf || {
  63017. __proto__: []
  63018. } instanceof Array && function (d, b) {
  63019. d.__proto__ = b;
  63020. } || function (d, b) {
  63021. for (var p in b) {
  63022. if (b.hasOwnProperty(p)) d[p] = b[p];
  63023. }
  63024. };
  63025. return _extendStatics(d, b);
  63026. };
  63027. return function (d, b) {
  63028. _extendStatics(d, b);
  63029. function __() {
  63030. this.constructor = d;
  63031. }
  63032. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  63033. };
  63034. }();
  63035. var __values = void 0 && (void 0).__values || function (o) {
  63036. var s = typeof Symbol === "function" && Symbol.iterator,
  63037. m = s && o[s],
  63038. i = 0;
  63039. if (m) return m.call(o);
  63040. if (o && typeof o.length === "number") return {
  63041. next: function next() {
  63042. if (o && i >= o.length) o = void 0;
  63043. return {
  63044. value: o && o[i++],
  63045. done: !o
  63046. };
  63047. }
  63048. };
  63049. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  63050. };
  63051. // package com.google.zxing.oned;
  63052. // import com.google.zxing.BarcodeFormat;
  63053. // import com.google.zxing.FormatException;
  63054. // import com.google.zxing.NotFoundException;
  63055. // import com.google.zxing.common.BitArray;
  63056. /**
  63057. * <p>Implements decoding of the UPC-E format.</p>
  63058. * <p><a href="http://www.barcodeisland.com/upce.phtml">This</a> is a great reference for
  63059. * UPC-E information.</p>
  63060. *
  63061. * @author Sean Owen
  63062. *
  63063. * @source https://github.com/zxing/zxing/blob/3c96923276dd5785d58eb970b6ba3f80d36a9505/core/src/main/java/com/google/zxing/oned/UPCEReader.java
  63064. *
  63065. * @experimental
  63066. */
  63067. var UPCEReader = /** @class */function (_super) {
  63068. __extends(UPCEReader, _super);
  63069. function UPCEReader() {
  63070. var _this = _super.call(this) || this;
  63071. _this.decodeMiddleCounters = new Int32Array(4);
  63072. return _this;
  63073. }
  63074. /**
  63075. * @throws NotFoundException
  63076. */
  63077. // @Override
  63078. UPCEReader.prototype.decodeMiddle = function (row, startRange, result) {
  63079. var e_1, _a;
  63080. var counters = this.decodeMiddleCounters.map(function (x) {
  63081. return x;
  63082. });
  63083. counters[0] = 0;
  63084. counters[1] = 0;
  63085. counters[2] = 0;
  63086. counters[3] = 0;
  63087. var end = row.getSize();
  63088. var rowOffset = startRange[1];
  63089. var lgPatternFound = 0;
  63090. for (var x = 0; x < 6 && rowOffset < end; x++) {
  63091. var bestMatch = UPCEReader.decodeDigit(row, counters, rowOffset, UPCEReader.L_AND_G_PATTERNS);
  63092. result += String.fromCharCode('0'.charCodeAt(0) + bestMatch % 10);
  63093. try {
  63094. for (var counters_1 = (e_1 = void 0, __values(counters)), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  63095. var counter = counters_1_1.value;
  63096. rowOffset += counter;
  63097. }
  63098. } catch (e_1_1) {
  63099. e_1 = {
  63100. error: e_1_1
  63101. };
  63102. } finally {
  63103. try {
  63104. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  63105. } finally {
  63106. if (e_1) throw e_1.error;
  63107. }
  63108. }
  63109. if (bestMatch >= 10) {
  63110. lgPatternFound |= 1 << 5 - x;
  63111. }
  63112. }
  63113. UPCEReader.determineNumSysAndCheckDigit(new _StringBuilder.default(result), lgPatternFound);
  63114. return rowOffset;
  63115. };
  63116. /**
  63117. * @throws NotFoundException
  63118. */
  63119. // @Override
  63120. UPCEReader.prototype.decodeEnd = function (row, endStart) {
  63121. return UPCEReader.findGuardPatternWithoutCounters(row, endStart, true, UPCEReader.MIDDLE_END_PATTERN);
  63122. };
  63123. /**
  63124. * @throws FormatException
  63125. */
  63126. // @Override
  63127. UPCEReader.prototype.checkChecksum = function (s) {
  63128. return _UPCEANReader.default.checkChecksum(UPCEReader.convertUPCEtoUPCA(s));
  63129. };
  63130. /**
  63131. * @throws NotFoundException
  63132. */
  63133. UPCEReader.determineNumSysAndCheckDigit = function (resultString, lgPatternFound) {
  63134. for (var numSys = 0; numSys <= 1; numSys++) {
  63135. for (var d = 0; d < 10; d++) {
  63136. if (lgPatternFound === this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[numSys][d]) {
  63137. resultString.insert(0, /*(char)*/'0' + numSys);
  63138. resultString.append( /*(char)*/'0' + d);
  63139. return;
  63140. }
  63141. }
  63142. }
  63143. throw _NotFoundException.default.getNotFoundInstance();
  63144. };
  63145. // @Override
  63146. UPCEReader.prototype.getBarcodeFormat = function () {
  63147. return _BarcodeFormat.default.UPC_E;
  63148. };
  63149. /**
  63150. * Expands a UPC-E value back into its full, equivalent UPC-A code value.
  63151. *
  63152. * @param upce UPC-E code as string of digits
  63153. * @return equivalent UPC-A code as string of digits
  63154. */
  63155. UPCEReader.convertUPCEtoUPCA = function (upce) {
  63156. // the following line is equivalent to upce.getChars(1, 7, upceChars, 0);
  63157. var upceChars = upce.slice(1, 7).split('').map(function (x) {
  63158. return x.charCodeAt(0);
  63159. });
  63160. var result = new _StringBuilder.default( /*12*/);
  63161. result.append(upce.charAt(0));
  63162. var lastChar = upceChars[5];
  63163. switch (lastChar) {
  63164. case 0:
  63165. case 1:
  63166. case 2:
  63167. result.appendChars(upceChars, 0, 2);
  63168. result.append(lastChar);
  63169. result.append('0000');
  63170. result.appendChars(upceChars, 2, 3);
  63171. break;
  63172. case 3:
  63173. result.appendChars(upceChars, 0, 3);
  63174. result.append('00000');
  63175. result.appendChars(upceChars, 3, 2);
  63176. break;
  63177. case 4:
  63178. result.appendChars(upceChars, 0, 4);
  63179. result.append('00000');
  63180. result.append(upceChars[4]);
  63181. break;
  63182. default:
  63183. result.appendChars(upceChars, 0, 5);
  63184. result.append('0000');
  63185. result.append(lastChar);
  63186. break;
  63187. }
  63188. // Only append check digit in conversion if supplied
  63189. if (upce.length >= 8) {
  63190. result.append(upce.charAt(7));
  63191. }
  63192. return result.toString();
  63193. };
  63194. /**
  63195. * The pattern that marks the middle, and end, of a UPC-E pattern.
  63196. * There is no "second half" to a UPC-E barcode.
  63197. */
  63198. UPCEReader.MIDDLE_END_PATTERN = Int32Array.from([1, 1, 1, 1, 1, 1]);
  63199. // For an UPC-E barcode, the final digit is represented by the parities used
  63200. // to encode the middle six digits, according to the table below.
  63201. //
  63202. // Parity of next 6 digits
  63203. // Digit 0 1 2 3 4 5
  63204. // 0 Even Even Even Odd Odd Odd
  63205. // 1 Even Even Odd Even Odd Odd
  63206. // 2 Even Even Odd Odd Even Odd
  63207. // 3 Even Even Odd Odd Odd Even
  63208. // 4 Even Odd Even Even Odd Odd
  63209. // 5 Even Odd Odd Even Even Odd
  63210. // 6 Even Odd Odd Odd Even Even
  63211. // 7 Even Odd Even Odd Even Odd
  63212. // 8 Even Odd Even Odd Odd Even
  63213. // 9 Even Odd Odd Even Odd Even
  63214. //
  63215. // The encoding is represented by the following array, which is a bit pattern
  63216. // using Odd = 0 and Even = 1. For example, 5 is represented by:
  63217. //
  63218. // Odd Even Even Odd Odd Even
  63219. // in binary:
  63220. // 0 1 1 0 0 1 == 0x19
  63221. //
  63222. /**
  63223. * See {@link #L_AND_G_PATTERNS}; these values similarly represent patterns of
  63224. * even-odd parity encodings of digits that imply both the number system (0 or 1)
  63225. * used, and the check digit.
  63226. */
  63227. UPCEReader.NUMSYS_AND_CHECK_DIGIT_PATTERNS = [Int32Array.from([0x38, 0x34, 0x32, 0x31, 0x2C, 0x26, 0x23, 0x2A, 0x29, 0x25]), Int32Array.from([0x07, 0x0B, 0x0D, 0x0E, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1])];
  63228. return UPCEReader;
  63229. }(_UPCEANReader.default);
  63230. var _default = UPCEReader;
  63231. exports.default = _default;
  63232. /***/ }),
  63233. /* 373 */
  63234. /*!**************************************************************************************!*\
  63235. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/CodaBarReader.js ***!
  63236. \**************************************************************************************/
  63237. /*! no static exports found */
  63238. /***/ (function(module, exports, __webpack_require__) {
  63239. "use strict";
  63240. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  63241. Object.defineProperty(exports, "__esModule", {
  63242. value: true
  63243. });
  63244. exports.default = void 0;
  63245. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  63246. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  63247. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ./OneDReader */ 359));
  63248. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  63249. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../ResultPoint */ 346));
  63250. /*
  63251. * Copyright 2008 ZXing authors
  63252. *
  63253. * Licensed under the Apache License, Version 2.0 (the "License");
  63254. * you may not use this file except in compliance with the License.
  63255. * You may obtain a copy of the License at
  63256. *
  63257. * http://www.apache.org/licenses/LICENSE-2.0
  63258. *
  63259. * Unless required by applicable law or agreed to in writing, software
  63260. * distributed under the License is distributed on an "AS IS" BASIS,
  63261. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  63262. * See the License for the specific language governing permissions and
  63263. * limitations under the License.
  63264. */
  63265. var __extends = void 0 && (void 0).__extends || function () {
  63266. var _extendStatics = function extendStatics(d, b) {
  63267. _extendStatics = Object.setPrototypeOf || {
  63268. __proto__: []
  63269. } instanceof Array && function (d, b) {
  63270. d.__proto__ = b;
  63271. } || function (d, b) {
  63272. for (var p in b) {
  63273. if (b.hasOwnProperty(p)) d[p] = b[p];
  63274. }
  63275. };
  63276. return _extendStatics(d, b);
  63277. };
  63278. return function (d, b) {
  63279. _extendStatics(d, b);
  63280. function __() {
  63281. this.constructor = d;
  63282. }
  63283. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  63284. };
  63285. }();
  63286. /*namespace com.google.zxing.oned {*/
  63287. /**
  63288. * <p>Decodes CodaBar barcodes. </p>
  63289. *
  63290. * @author Evan @dodobelieve
  63291. * @see CodaBarReader
  63292. */
  63293. var CodaBarReader = /** @class */function (_super) {
  63294. __extends(CodaBarReader, _super);
  63295. function CodaBarReader() {
  63296. var _this = _super !== null && _super.apply(this, arguments) || this;
  63297. _this.CODA_BAR_CHAR_SET = {
  63298. nnnnnww: '0',
  63299. nnnnwwn: '1',
  63300. nnnwnnw: '2',
  63301. wwnnnnn: '3',
  63302. nnwnnwn: '4',
  63303. wnnnnwn: '5',
  63304. nwnnnnw: '6',
  63305. nwnnwnn: '7',
  63306. nwwnnnn: '8',
  63307. wnnwnnn: '9',
  63308. nnnwwnn: '-',
  63309. nnwwnnn: '$',
  63310. wnnnwnw: ':',
  63311. wnwnnnw: '/',
  63312. wnwnwnn: '.',
  63313. nnwwwww: '+',
  63314. nnwwnwn: 'A',
  63315. nwnwnnw: 'B',
  63316. nnnwnww: 'C',
  63317. nnnwwwn: 'D'
  63318. };
  63319. return _this;
  63320. }
  63321. CodaBarReader.prototype.decodeRow = function (rowNumber, row, hints) {
  63322. var validRowData = this.getValidRowData(row);
  63323. if (!validRowData) throw new _NotFoundException.default();
  63324. var retStr = this.codaBarDecodeRow(validRowData.row);
  63325. if (!retStr) throw new _NotFoundException.default();
  63326. return new _Result.default(retStr, null, 0, [new _ResultPoint.default(validRowData.left, rowNumber), new _ResultPoint.default(validRowData.right, rowNumber)], _BarcodeFormat.default.CODABAR, new Date().getTime());
  63327. };
  63328. /**
  63329. * converts bit array to valid data array(lengths of black bits and white bits)
  63330. * @param row bit array to convert
  63331. */
  63332. CodaBarReader.prototype.getValidRowData = function (row) {
  63333. var booleanArr = row.toArray();
  63334. var startIndex = booleanArr.indexOf(true);
  63335. if (startIndex === -1) return null;
  63336. var lastIndex = booleanArr.lastIndexOf(true);
  63337. if (lastIndex <= startIndex) return null;
  63338. booleanArr = booleanArr.slice(startIndex, lastIndex + 1);
  63339. var result = [];
  63340. var lastBit = booleanArr[0];
  63341. var bitLength = 1;
  63342. for (var i = 1; i < booleanArr.length; i++) {
  63343. if (booleanArr[i] === lastBit) {
  63344. bitLength++;
  63345. } else {
  63346. lastBit = booleanArr[i];
  63347. result.push(bitLength);
  63348. bitLength = 1;
  63349. }
  63350. }
  63351. result.push(bitLength);
  63352. // CodaBar code data valid
  63353. if (result.length < 23 && (result.length + 1) % 8 !== 0) return null;
  63354. return {
  63355. row: result,
  63356. left: startIndex,
  63357. right: lastIndex
  63358. };
  63359. };
  63360. /**
  63361. * decode codabar code
  63362. * @param row row to cecode
  63363. */
  63364. CodaBarReader.prototype.codaBarDecodeRow = function (row) {
  63365. var code = [];
  63366. var barThreshold = Math.ceil(row.reduce(function (pre, item) {
  63367. return (pre + item) / 2;
  63368. }, 0));
  63369. // Read one encoded character at a time.
  63370. while (row.length > 0) {
  63371. var seg = row.splice(0, 8).splice(0, 7);
  63372. var key = seg.map(function (len) {
  63373. return len < barThreshold ? 'n' : 'w';
  63374. }).join('');
  63375. if (this.CODA_BAR_CHAR_SET[key] === undefined) return null;
  63376. code.push(this.CODA_BAR_CHAR_SET[key]);
  63377. }
  63378. var strCode = code.join('');
  63379. if (this.validCodaBarString(strCode)) return strCode;
  63380. return null;
  63381. };
  63382. /**
  63383. * check if the string is a CodaBar string
  63384. * @param src string to determine
  63385. */
  63386. CodaBarReader.prototype.validCodaBarString = function (src) {
  63387. var reg = /^[A-D].{1,}[A-D]$/;
  63388. return reg.test(src);
  63389. };
  63390. return CodaBarReader;
  63391. }(_OneDReader.default);
  63392. var _default = CodaBarReader;
  63393. exports.default = _default;
  63394. /***/ }),
  63395. /* 374 */
  63396. /*!*******************************************************************************************************!*\
  63397. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/RSSExpandedReader.js ***!
  63398. \*******************************************************************************************************/
  63399. /*! no static exports found */
  63400. /***/ (function(module, exports, __webpack_require__) {
  63401. "use strict";
  63402. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  63403. Object.defineProperty(exports, "__esModule", {
  63404. value: true
  63405. });
  63406. exports.default = void 0;
  63407. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../../../BarcodeFormat */ 334));
  63408. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../../common/detector/MathUtils */ 347));
  63409. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../NotFoundException */ 327));
  63410. var _Result = _interopRequireDefault(__webpack_require__(/*! ../../../Result */ 333));
  63411. var _System = _interopRequireDefault(__webpack_require__(/*! ../../../util/System */ 315));
  63412. var _AbstractRSSReader = _interopRequireDefault(__webpack_require__(/*! ../../rss/AbstractRSSReader */ 375));
  63413. var _DataCharacter = _interopRequireDefault(__webpack_require__(/*! ../../rss/DataCharacter */ 376));
  63414. var _FinderPattern = _interopRequireDefault(__webpack_require__(/*! ../../rss/FinderPattern */ 377));
  63415. var _RSSUtils = _interopRequireDefault(__webpack_require__(/*! ../../rss/RSSUtils */ 378));
  63416. var _BitArrayBuilder = _interopRequireDefault(__webpack_require__(/*! ./BitArrayBuilder */ 379));
  63417. var _AbstractExpandedDecoderComplement = __webpack_require__(/*! ./decoders/AbstractExpandedDecoderComplement */ 380);
  63418. var _ExpandedPair = _interopRequireDefault(__webpack_require__(/*! ./ExpandedPair */ 399));
  63419. var _ExpandedRow = _interopRequireDefault(__webpack_require__(/*! ./ExpandedRow */ 400));
  63420. var __extends = void 0 && (void 0).__extends || function () {
  63421. var _extendStatics = function extendStatics(d, b) {
  63422. _extendStatics = Object.setPrototypeOf || {
  63423. __proto__: []
  63424. } instanceof Array && function (d, b) {
  63425. d.__proto__ = b;
  63426. } || function (d, b) {
  63427. for (var p in b) {
  63428. if (b.hasOwnProperty(p)) d[p] = b[p];
  63429. }
  63430. };
  63431. return _extendStatics(d, b);
  63432. };
  63433. return function (d, b) {
  63434. _extendStatics(d, b);
  63435. function __() {
  63436. this.constructor = d;
  63437. }
  63438. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  63439. };
  63440. }();
  63441. var __values = void 0 && (void 0).__values || function (o) {
  63442. var s = typeof Symbol === "function" && Symbol.iterator,
  63443. m = s && o[s],
  63444. i = 0;
  63445. if (m) return m.call(o);
  63446. if (o && typeof o.length === "number") return {
  63447. next: function next() {
  63448. if (o && i >= o.length) o = void 0;
  63449. return {
  63450. value: o && o[i++],
  63451. done: !o
  63452. };
  63453. }
  63454. };
  63455. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  63456. };
  63457. // import java.util.ArrayList;
  63458. // import java.util.Iterator;
  63459. // import java.util.List;
  63460. // import java.util.Map;
  63461. // import java.util.Collections;
  63462. /** @experimental */
  63463. var RSSExpandedReader = /** @class */function (_super) {
  63464. __extends(RSSExpandedReader, _super);
  63465. function RSSExpandedReader() {
  63466. var _this = _super !== null && _super.apply(this, arguments) || this;
  63467. _this.pairs = new Array(RSSExpandedReader.MAX_PAIRS);
  63468. _this.rows = new Array();
  63469. _this.startEnd = [2];
  63470. return _this;
  63471. }
  63472. RSSExpandedReader.prototype.decodeRow = function (rowNumber, row, hints) {
  63473. // Rows can start with even pattern in case in prev rows there where odd number of patters.
  63474. // So lets try twice
  63475. // this.pairs.clear();
  63476. this.pairs.length = 0;
  63477. this.startFromEven = false;
  63478. try {
  63479. return RSSExpandedReader.constructResult(this.decodeRow2pairs(rowNumber, row));
  63480. } catch (e) {
  63481. // OK
  63482. // console.log(e);
  63483. }
  63484. this.pairs.length = 0;
  63485. this.startFromEven = true;
  63486. return RSSExpandedReader.constructResult(this.decodeRow2pairs(rowNumber, row));
  63487. };
  63488. RSSExpandedReader.prototype.reset = function () {
  63489. this.pairs.length = 0;
  63490. this.rows.length = 0;
  63491. };
  63492. // Not private for testing
  63493. RSSExpandedReader.prototype.decodeRow2pairs = function (rowNumber, row) {
  63494. var done = false;
  63495. while (!done) {
  63496. try {
  63497. this.pairs.push(this.retrieveNextPair(row, this.pairs, rowNumber));
  63498. } catch (error) {
  63499. if (error instanceof _NotFoundException.default) {
  63500. if (!this.pairs.length) {
  63501. throw new _NotFoundException.default();
  63502. }
  63503. // exit this loop when retrieveNextPair() fails and throws
  63504. done = true;
  63505. }
  63506. }
  63507. }
  63508. // TODO: verify sequence of finder patterns as in checkPairSequence()
  63509. if (this.checkChecksum()) {
  63510. return this.pairs;
  63511. }
  63512. var tryStackedDecode;
  63513. if (this.rows.length) {
  63514. tryStackedDecode = true;
  63515. } else {
  63516. tryStackedDecode = false;
  63517. }
  63518. // let tryStackedDecode = !this.rows.isEmpty();
  63519. this.storeRow(rowNumber, false); // TODO: deal with reversed rows
  63520. if (tryStackedDecode) {
  63521. // When the image is 180-rotated, then rows are sorted in wrong direction.
  63522. // Try twice with both the directions.
  63523. var ps = this.checkRowsBoolean(false);
  63524. if (ps != null) {
  63525. return ps;
  63526. }
  63527. ps = this.checkRowsBoolean(true);
  63528. if (ps != null) {
  63529. return ps;
  63530. }
  63531. }
  63532. throw new _NotFoundException.default();
  63533. };
  63534. // Need to Verify
  63535. RSSExpandedReader.prototype.checkRowsBoolean = function (reverse) {
  63536. // Limit number of rows we are checking
  63537. // We use recursive algorithm with pure complexity and don't want it to take forever
  63538. // Stacked barcode can have up to 11 rows, so 25 seems reasonable enough
  63539. if (this.rows.length > 25) {
  63540. this.rows.length = 0; // We will never have a chance to get result, so clear it
  63541. return null;
  63542. }
  63543. this.pairs.length = 0;
  63544. if (reverse) {
  63545. this.rows = this.rows.reverse();
  63546. // Collections.reverse(this.rows);
  63547. }
  63548. var ps = null;
  63549. try {
  63550. ps = this.checkRows(new Array(), 0);
  63551. } catch (e) {
  63552. // OK
  63553. console.log(e);
  63554. }
  63555. if (reverse) {
  63556. this.rows = this.rows.reverse();
  63557. // Collections.reverse(this.rows);
  63558. }
  63559. return ps;
  63560. };
  63561. // Try to construct a valid rows sequence
  63562. // Recursion is used to implement backtracking
  63563. RSSExpandedReader.prototype.checkRows = function (collectedRows, currentRow) {
  63564. var e_1, _a;
  63565. for (var i = currentRow; i < this.rows.length; i++) {
  63566. var row = this.rows[i];
  63567. this.pairs.length = 0;
  63568. try {
  63569. for (var collectedRows_1 = (e_1 = void 0, __values(collectedRows)), collectedRows_1_1 = collectedRows_1.next(); !collectedRows_1_1.done; collectedRows_1_1 = collectedRows_1.next()) {
  63570. var collectedRow = collectedRows_1_1.value;
  63571. this.pairs.push(collectedRow.getPairs());
  63572. }
  63573. } catch (e_1_1) {
  63574. e_1 = {
  63575. error: e_1_1
  63576. };
  63577. } finally {
  63578. try {
  63579. if (collectedRows_1_1 && !collectedRows_1_1.done && (_a = collectedRows_1.return)) _a.call(collectedRows_1);
  63580. } finally {
  63581. if (e_1) throw e_1.error;
  63582. }
  63583. }
  63584. this.pairs.push(row.getPairs());
  63585. if (!RSSExpandedReader.isValidSequence(this.pairs)) {
  63586. continue;
  63587. }
  63588. if (this.checkChecksum()) {
  63589. return this.pairs;
  63590. }
  63591. var rs = new Array(collectedRows);
  63592. rs.push(row);
  63593. try {
  63594. // Recursion: try to add more rows
  63595. return this.checkRows(rs, i + 1);
  63596. } catch (e) {
  63597. // We failed, try the next candidate
  63598. console.log(e);
  63599. }
  63600. }
  63601. throw new _NotFoundException.default();
  63602. };
  63603. // Whether the pairs form a valid find pattern sequence,
  63604. // either complete or a prefix
  63605. RSSExpandedReader.isValidSequence = function (pairs) {
  63606. var e_2, _a;
  63607. try {
  63608. for (var _b = __values(RSSExpandedReader.FINDER_PATTERN_SEQUENCES), _c = _b.next(); !_c.done; _c = _b.next()) {
  63609. var sequence = _c.value;
  63610. if (pairs.length > sequence.length) {
  63611. continue;
  63612. }
  63613. var stop_1 = true;
  63614. for (var j = 0; j < pairs.length; j++) {
  63615. if (pairs[j].getFinderPattern().getValue() !== sequence[j]) {
  63616. stop_1 = false;
  63617. break;
  63618. }
  63619. }
  63620. if (stop_1) {
  63621. return true;
  63622. }
  63623. }
  63624. } catch (e_2_1) {
  63625. e_2 = {
  63626. error: e_2_1
  63627. };
  63628. } finally {
  63629. try {
  63630. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  63631. } finally {
  63632. if (e_2) throw e_2.error;
  63633. }
  63634. }
  63635. return false;
  63636. };
  63637. RSSExpandedReader.prototype.storeRow = function (rowNumber, wasReversed) {
  63638. // Discard if duplicate above or below; otherwise insert in order by row number.
  63639. var insertPos = 0;
  63640. var prevIsSame = false;
  63641. var nextIsSame = false;
  63642. while (insertPos < this.rows.length) {
  63643. var erow = this.rows[insertPos];
  63644. if (erow.getRowNumber() > rowNumber) {
  63645. nextIsSame = erow.isEquivalent(this.pairs);
  63646. break;
  63647. }
  63648. prevIsSame = erow.isEquivalent(this.pairs);
  63649. insertPos++;
  63650. }
  63651. if (nextIsSame || prevIsSame) {
  63652. return;
  63653. }
  63654. // When the row was partially decoded (e.g. 2 pairs found instead of 3),
  63655. // it will prevent us from detecting the barcode.
  63656. // Try to merge partial rows
  63657. // Check whether the row is part of an allready detected row
  63658. if (RSSExpandedReader.isPartialRow(this.pairs, this.rows)) {
  63659. return;
  63660. }
  63661. this.rows.push(insertPos, new _ExpandedRow.default(this.pairs, rowNumber, wasReversed));
  63662. this.removePartialRows(this.pairs, this.rows);
  63663. };
  63664. // Remove all the rows that contains only specified pairs
  63665. RSSExpandedReader.prototype.removePartialRows = function (pairs, rows) {
  63666. var e_3, _a, e_4, _b, e_5, _c;
  63667. try {
  63668. // for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
  63669. // ExpandedRow r = iterator.next();
  63670. // if (r.getPairs().size() == pairs.size()) {
  63671. // continue;
  63672. // }
  63673. // boolean allFound = true;
  63674. // for (ExpandedPair p : r.getPairs()) {
  63675. // boolean found = false;
  63676. // for (ExpandedPair pp : pairs) {
  63677. // if (p.equals(pp)) {
  63678. // found = true;
  63679. // break;
  63680. // }
  63681. // }
  63682. // if (!found) {
  63683. // allFound = false;
  63684. // break;
  63685. // }
  63686. // }
  63687. // if (allFound) {
  63688. // // 'pairs' contains all the pairs from the row 'r'
  63689. // iterator.remove();
  63690. // }
  63691. // }
  63692. for (var rows_1 = __values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
  63693. var row = rows_1_1.value;
  63694. if (row.getPairs().length === pairs.length) {
  63695. continue;
  63696. }
  63697. var allFound = true;
  63698. try {
  63699. for (var _d = (e_4 = void 0, __values(row.getPairs())), _e = _d.next(); !_e.done; _e = _d.next()) {
  63700. var p = _e.value;
  63701. var found = false;
  63702. try {
  63703. for (var pairs_1 = (e_5 = void 0, __values(pairs)), pairs_1_1 = pairs_1.next(); !pairs_1_1.done; pairs_1_1 = pairs_1.next()) {
  63704. var pp = pairs_1_1.value;
  63705. if (_ExpandedPair.default.equals(p, pp)) {
  63706. found = true;
  63707. break;
  63708. }
  63709. }
  63710. } catch (e_5_1) {
  63711. e_5 = {
  63712. error: e_5_1
  63713. };
  63714. } finally {
  63715. try {
  63716. if (pairs_1_1 && !pairs_1_1.done && (_c = pairs_1.return)) _c.call(pairs_1);
  63717. } finally {
  63718. if (e_5) throw e_5.error;
  63719. }
  63720. }
  63721. if (!found) {
  63722. allFound = false;
  63723. }
  63724. }
  63725. } catch (e_4_1) {
  63726. e_4 = {
  63727. error: e_4_1
  63728. };
  63729. } finally {
  63730. try {
  63731. if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
  63732. } finally {
  63733. if (e_4) throw e_4.error;
  63734. }
  63735. }
  63736. }
  63737. } catch (e_3_1) {
  63738. e_3 = {
  63739. error: e_3_1
  63740. };
  63741. } finally {
  63742. try {
  63743. if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
  63744. } finally {
  63745. if (e_3) throw e_3.error;
  63746. }
  63747. }
  63748. };
  63749. // Returns true when one of the rows already contains all the pairs
  63750. RSSExpandedReader.isPartialRow = function (pairs, rows) {
  63751. var e_6, _a, e_7, _b, e_8, _c;
  63752. try {
  63753. for (var rows_2 = __values(rows), rows_2_1 = rows_2.next(); !rows_2_1.done; rows_2_1 = rows_2.next()) {
  63754. var r = rows_2_1.value;
  63755. var allFound = true;
  63756. try {
  63757. for (var pairs_2 = (e_7 = void 0, __values(pairs)), pairs_2_1 = pairs_2.next(); !pairs_2_1.done; pairs_2_1 = pairs_2.next()) {
  63758. var p = pairs_2_1.value;
  63759. var found = false;
  63760. try {
  63761. for (var _d = (e_8 = void 0, __values(r.getPairs())), _e = _d.next(); !_e.done; _e = _d.next()) {
  63762. var pp = _e.value;
  63763. if (p.equals(pp)) {
  63764. found = true;
  63765. break;
  63766. }
  63767. }
  63768. } catch (e_8_1) {
  63769. e_8 = {
  63770. error: e_8_1
  63771. };
  63772. } finally {
  63773. try {
  63774. if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
  63775. } finally {
  63776. if (e_8) throw e_8.error;
  63777. }
  63778. }
  63779. if (!found) {
  63780. allFound = false;
  63781. break;
  63782. }
  63783. }
  63784. } catch (e_7_1) {
  63785. e_7 = {
  63786. error: e_7_1
  63787. };
  63788. } finally {
  63789. try {
  63790. if (pairs_2_1 && !pairs_2_1.done && (_b = pairs_2.return)) _b.call(pairs_2);
  63791. } finally {
  63792. if (e_7) throw e_7.error;
  63793. }
  63794. }
  63795. if (allFound) {
  63796. // the row 'r' contain all the pairs from 'pairs'
  63797. return true;
  63798. }
  63799. }
  63800. } catch (e_6_1) {
  63801. e_6 = {
  63802. error: e_6_1
  63803. };
  63804. } finally {
  63805. try {
  63806. if (rows_2_1 && !rows_2_1.done && (_a = rows_2.return)) _a.call(rows_2);
  63807. } finally {
  63808. if (e_6) throw e_6.error;
  63809. }
  63810. }
  63811. return false;
  63812. };
  63813. // Only used for unit testing
  63814. RSSExpandedReader.prototype.getRows = function () {
  63815. return this.rows;
  63816. };
  63817. // Not private for unit testing
  63818. RSSExpandedReader.constructResult = function (pairs) {
  63819. var binary = _BitArrayBuilder.default.buildBitArray(pairs);
  63820. var decoder = (0, _AbstractExpandedDecoderComplement.createDecoder)(binary);
  63821. var resultingString = decoder.parseInformation();
  63822. var firstPoints = pairs[0].getFinderPattern().getResultPoints();
  63823. var lastPoints = pairs[pairs.length - 1].getFinderPattern().getResultPoints();
  63824. var points = [firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]];
  63825. return new _Result.default(resultingString, null, null, points, _BarcodeFormat.default.RSS_EXPANDED, null);
  63826. };
  63827. RSSExpandedReader.prototype.checkChecksum = function () {
  63828. var firstPair = this.pairs.get(0);
  63829. var checkCharacter = firstPair.getLeftChar();
  63830. var firstCharacter = firstPair.getRightChar();
  63831. if (firstCharacter === null) {
  63832. return false;
  63833. }
  63834. var checksum = firstCharacter.getChecksumPortion();
  63835. var s = 2;
  63836. for (var i = 1; i < this.pairs.size(); ++i) {
  63837. var currentPair = this.pairs.get(i);
  63838. checksum += currentPair.getLeftChar().getChecksumPortion();
  63839. s++;
  63840. var currentRightChar = currentPair.getRightChar();
  63841. if (currentRightChar != null) {
  63842. checksum += currentRightChar.getChecksumPortion();
  63843. s++;
  63844. }
  63845. }
  63846. checksum %= 211;
  63847. var checkCharacterValue = 211 * (s - 4) + checksum;
  63848. return checkCharacterValue === checkCharacter.getValue();
  63849. };
  63850. RSSExpandedReader.getNextSecondBar = function (row, initialPos) {
  63851. var currentPos;
  63852. if (row.get(initialPos)) {
  63853. currentPos = row.getNextUnset(initialPos);
  63854. currentPos = row.getNextSet(currentPos);
  63855. } else {
  63856. currentPos = row.getNextSet(initialPos);
  63857. currentPos = row.getNextUnset(currentPos);
  63858. }
  63859. return currentPos;
  63860. };
  63861. // not private for testing
  63862. RSSExpandedReader.prototype.retrieveNextPair = function (row, previousPairs, rowNumber) {
  63863. var isOddPattern = previousPairs.length % 2 === 0;
  63864. if (this.startFromEven) {
  63865. isOddPattern = !isOddPattern;
  63866. }
  63867. var pattern;
  63868. var keepFinding = true;
  63869. var forcedOffset = -1;
  63870. do {
  63871. this.findNextPair(row, previousPairs, forcedOffset);
  63872. pattern = this.parseFoundFinderPattern(row, rowNumber, isOddPattern);
  63873. if (pattern === null) {
  63874. forcedOffset = RSSExpandedReader.getNextSecondBar(row, this.startEnd[0]);
  63875. } else {
  63876. keepFinding = false;
  63877. }
  63878. } while (keepFinding);
  63879. // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  63880. // boolean mayBeLast = checkPairSequence(previousPairs, pattern);
  63881. var leftChar = this.decodeDataCharacter(row, pattern, isOddPattern, true);
  63882. if (!this.isEmptyPair(previousPairs) && previousPairs[previousPairs.length - 1].mustBeLast()) {
  63883. throw new _NotFoundException.default();
  63884. }
  63885. var rightChar;
  63886. try {
  63887. rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  63888. } catch (e) {
  63889. rightChar = null;
  63890. console.log(e);
  63891. }
  63892. return new _ExpandedPair.default(leftChar, rightChar, pattern, true);
  63893. };
  63894. RSSExpandedReader.prototype.isEmptyPair = function (pairs) {
  63895. if (pairs.length === 0) {
  63896. return true;
  63897. }
  63898. return false;
  63899. };
  63900. RSSExpandedReader.prototype.findNextPair = function (row, previousPairs, forcedOffset) {
  63901. var counters = this.getDecodeFinderCounters();
  63902. counters[0] = 0;
  63903. counters[1] = 0;
  63904. counters[2] = 0;
  63905. counters[3] = 0;
  63906. var width = row.getSize();
  63907. var rowOffset;
  63908. if (forcedOffset >= 0) {
  63909. rowOffset = forcedOffset;
  63910. } else if (this.isEmptyPair(previousPairs)) {
  63911. rowOffset = 0;
  63912. } else {
  63913. var lastPair = previousPairs[previousPairs.length - 1];
  63914. rowOffset = lastPair.getFinderPattern().getStartEnd()[1];
  63915. }
  63916. var searchingEvenPair = previousPairs.length % 2 !== 0;
  63917. if (this.startFromEven) {
  63918. searchingEvenPair = !searchingEvenPair;
  63919. }
  63920. var isWhite = false;
  63921. while (rowOffset < width) {
  63922. isWhite = !row.get(rowOffset);
  63923. if (!isWhite) {
  63924. break;
  63925. }
  63926. rowOffset++;
  63927. }
  63928. var counterPosition = 0;
  63929. var patternStart = rowOffset;
  63930. for (var x = rowOffset; x < width; x++) {
  63931. if (row.get(x) !== isWhite) {
  63932. counters[counterPosition]++;
  63933. } else {
  63934. if (counterPosition === 3) {
  63935. if (searchingEvenPair) {
  63936. RSSExpandedReader.reverseCounters(counters);
  63937. }
  63938. if (RSSExpandedReader.isFinderPattern(counters)) {
  63939. this.startEnd[0] = patternStart;
  63940. this.startEnd[1] = x;
  63941. return;
  63942. }
  63943. if (searchingEvenPair) {
  63944. RSSExpandedReader.reverseCounters(counters);
  63945. }
  63946. patternStart += counters[0] + counters[1];
  63947. counters[0] = counters[2];
  63948. counters[1] = counters[3];
  63949. counters[2] = 0;
  63950. counters[3] = 0;
  63951. counterPosition--;
  63952. } else {
  63953. counterPosition++;
  63954. }
  63955. counters[counterPosition] = 1;
  63956. isWhite = !isWhite;
  63957. }
  63958. }
  63959. throw new _NotFoundException.default();
  63960. };
  63961. RSSExpandedReader.reverseCounters = function (counters) {
  63962. var length = counters.length;
  63963. for (var i = 0; i < length / 2; ++i) {
  63964. var tmp = counters[i];
  63965. counters[i] = counters[length - i - 1];
  63966. counters[length - i - 1] = tmp;
  63967. }
  63968. };
  63969. RSSExpandedReader.prototype.parseFoundFinderPattern = function (row, rowNumber, oddPattern) {
  63970. // Actually we found elements 2-5.
  63971. var firstCounter;
  63972. var start;
  63973. var end;
  63974. if (oddPattern) {
  63975. // If pattern number is odd, we need to locate element 1 *before* the current block.
  63976. var firstElementStart = this.startEnd[0] - 1;
  63977. // Locate element 1
  63978. while (firstElementStart >= 0 && !row.get(firstElementStart)) {
  63979. firstElementStart--;
  63980. }
  63981. firstElementStart++;
  63982. firstCounter = this.startEnd[0] - firstElementStart;
  63983. start = firstElementStart;
  63984. end = this.startEnd[1];
  63985. } else {
  63986. // If pattern number is even, the pattern is reversed, so we need to locate element 1 *after* the current block.
  63987. start = this.startEnd[0];
  63988. end = row.getNextUnset(this.startEnd[1] + 1);
  63989. firstCounter = end - this.startEnd[1];
  63990. }
  63991. // Make 'counters' hold 1-4
  63992. var counters = this.getDecodeFinderCounters();
  63993. _System.default.arraycopy(counters, 0, counters, 1, counters.length - 1);
  63994. counters[0] = firstCounter;
  63995. var value;
  63996. try {
  63997. value = this.parseFinderValue(counters, RSSExpandedReader.FINDER_PATTERNS);
  63998. } catch (e) {
  63999. return null;
  64000. }
  64001. // return new FinderPattern(value, new int[] { start, end }, start, end, rowNumber});
  64002. return new _FinderPattern.default(value, [start, end], start, end, rowNumber);
  64003. };
  64004. RSSExpandedReader.prototype.decodeDataCharacter = function (row, pattern, isOddPattern, leftChar) {
  64005. var counters = this.getDataCharacterCounters();
  64006. for (var x = 0; x < counters.length; x++) {
  64007. counters[x] = 0;
  64008. }
  64009. if (leftChar) {
  64010. RSSExpandedReader.recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
  64011. } else {
  64012. RSSExpandedReader.recordPattern(row, pattern.getStartEnd()[1], counters);
  64013. // reverse it
  64014. for (var i = 0, j = counters.length - 1; i < j; i++, j--) {
  64015. var temp = counters[i];
  64016. counters[i] = counters[j];
  64017. counters[j] = temp;
  64018. }
  64019. } // counters[] has the pixels of the module
  64020. var numModules = 17; // left and right data characters have all the same length
  64021. var elementWidth = _MathUtils.default.sum(new Int32Array(counters)) / numModules;
  64022. // Sanity check: element width for pattern and the character should match
  64023. var expectedElementWidth = (pattern.getStartEnd()[1] - pattern.getStartEnd()[0]) / 15.0;
  64024. if (Math.abs(elementWidth - expectedElementWidth) / expectedElementWidth > 0.3) {
  64025. throw new _NotFoundException.default();
  64026. }
  64027. var oddCounts = this.getOddCounts();
  64028. var evenCounts = this.getEvenCounts();
  64029. var oddRoundingErrors = this.getOddRoundingErrors();
  64030. var evenRoundingErrors = this.getEvenRoundingErrors();
  64031. for (var i = 0; i < counters.length; i++) {
  64032. var value_1 = 1.0 * counters[i] / elementWidth;
  64033. var count = value_1 + 0.5; // Round
  64034. if (count < 1) {
  64035. if (value_1 < 0.3) {
  64036. throw new _NotFoundException.default();
  64037. }
  64038. count = 1;
  64039. } else if (count > 8) {
  64040. if (value_1 > 8.7) {
  64041. throw new _NotFoundException.default();
  64042. }
  64043. count = 8;
  64044. }
  64045. var offset = i / 2;
  64046. if ((i & 0x01) === 0) {
  64047. oddCounts[offset] = count;
  64048. oddRoundingErrors[offset] = value_1 - count;
  64049. } else {
  64050. evenCounts[offset] = count;
  64051. evenRoundingErrors[offset] = value_1 - count;
  64052. }
  64053. }
  64054. this.adjustOddEvenCounts(numModules);
  64055. var weightRowNumber = 4 * pattern.getValue() + (isOddPattern ? 0 : 2) + (leftChar ? 0 : 1) - 1;
  64056. var oddSum = 0;
  64057. var oddChecksumPortion = 0;
  64058. for (var i = oddCounts.length - 1; i >= 0; i--) {
  64059. if (RSSExpandedReader.isNotA1left(pattern, isOddPattern, leftChar)) {
  64060. var weight = RSSExpandedReader.WEIGHTS[weightRowNumber][2 * i];
  64061. oddChecksumPortion += oddCounts[i] * weight;
  64062. }
  64063. oddSum += oddCounts[i];
  64064. }
  64065. var evenChecksumPortion = 0;
  64066. // int evenSum = 0;
  64067. for (var i = evenCounts.length - 1; i >= 0; i--) {
  64068. if (RSSExpandedReader.isNotA1left(pattern, isOddPattern, leftChar)) {
  64069. var weight = RSSExpandedReader.WEIGHTS[weightRowNumber][2 * i + 1];
  64070. evenChecksumPortion += evenCounts[i] * weight;
  64071. }
  64072. // evenSum += evenCounts[i];
  64073. }
  64074. var checksumPortion = oddChecksumPortion + evenChecksumPortion;
  64075. if ((oddSum & 0x01) !== 0 || oddSum > 13 || oddSum < 4) {
  64076. throw new _NotFoundException.default();
  64077. }
  64078. var group = (13 - oddSum) / 2;
  64079. var oddWidest = RSSExpandedReader.SYMBOL_WIDEST[group];
  64080. var evenWidest = 9 - oddWidest;
  64081. var vOdd = _RSSUtils.default.getRSSvalue(oddCounts, oddWidest, true);
  64082. var vEven = _RSSUtils.default.getRSSvalue(evenCounts, evenWidest, false);
  64083. var tEven = RSSExpandedReader.EVEN_TOTAL_SUBSET[group];
  64084. var gSum = RSSExpandedReader.GSUM[group];
  64085. var value = vOdd * tEven + vEven + gSum;
  64086. return new _DataCharacter.default(value, checksumPortion);
  64087. };
  64088. RSSExpandedReader.isNotA1left = function (pattern, isOddPattern, leftChar) {
  64089. // A1: pattern.getValue is 0 (A), and it's an oddPattern, and it is a left char
  64090. return !(pattern.getValue() === 0 && isOddPattern && leftChar);
  64091. };
  64092. RSSExpandedReader.prototype.adjustOddEvenCounts = function (numModules) {
  64093. var oddSum = _MathUtils.default.sum(new Int32Array(this.getOddCounts()));
  64094. var evenSum = _MathUtils.default.sum(new Int32Array(this.getEvenCounts()));
  64095. var incrementOdd = false;
  64096. var decrementOdd = false;
  64097. if (oddSum > 13) {
  64098. decrementOdd = true;
  64099. } else if (oddSum < 4) {
  64100. incrementOdd = true;
  64101. }
  64102. var incrementEven = false;
  64103. var decrementEven = false;
  64104. if (evenSum > 13) {
  64105. decrementEven = true;
  64106. } else if (evenSum < 4) {
  64107. incrementEven = true;
  64108. }
  64109. var mismatch = oddSum + evenSum - numModules;
  64110. var oddParityBad = (oddSum & 0x01) === 1;
  64111. var evenParityBad = (evenSum & 0x01) === 0;
  64112. if (mismatch === 1) {
  64113. if (oddParityBad) {
  64114. if (evenParityBad) {
  64115. throw new _NotFoundException.default();
  64116. }
  64117. decrementOdd = true;
  64118. } else {
  64119. if (!evenParityBad) {
  64120. throw new _NotFoundException.default();
  64121. }
  64122. decrementEven = true;
  64123. }
  64124. } else if (mismatch === -1) {
  64125. if (oddParityBad) {
  64126. if (evenParityBad) {
  64127. throw new _NotFoundException.default();
  64128. }
  64129. incrementOdd = true;
  64130. } else {
  64131. if (!evenParityBad) {
  64132. throw new _NotFoundException.default();
  64133. }
  64134. incrementEven = true;
  64135. }
  64136. } else if (mismatch === 0) {
  64137. if (oddParityBad) {
  64138. if (!evenParityBad) {
  64139. throw new _NotFoundException.default();
  64140. }
  64141. // Both bad
  64142. if (oddSum < evenSum) {
  64143. incrementOdd = true;
  64144. decrementEven = true;
  64145. } else {
  64146. decrementOdd = true;
  64147. incrementEven = true;
  64148. }
  64149. } else {
  64150. if (evenParityBad) {
  64151. throw new _NotFoundException.default();
  64152. }
  64153. // Nothing to do!
  64154. }
  64155. } else {
  64156. throw new _NotFoundException.default();
  64157. }
  64158. if (incrementOdd) {
  64159. if (decrementOdd) {
  64160. throw new _NotFoundException.default();
  64161. }
  64162. RSSExpandedReader.increment(this.getOddCounts(), this.getOddRoundingErrors());
  64163. }
  64164. if (decrementOdd) {
  64165. RSSExpandedReader.decrement(this.getOddCounts(), this.getOddRoundingErrors());
  64166. }
  64167. if (incrementEven) {
  64168. if (decrementEven) {
  64169. throw new _NotFoundException.default();
  64170. }
  64171. RSSExpandedReader.increment(this.getEvenCounts(), this.getOddRoundingErrors());
  64172. }
  64173. if (decrementEven) {
  64174. RSSExpandedReader.decrement(this.getEvenCounts(), this.getEvenRoundingErrors());
  64175. }
  64176. };
  64177. RSSExpandedReader.SYMBOL_WIDEST = [7, 5, 4, 3, 1];
  64178. RSSExpandedReader.EVEN_TOTAL_SUBSET = [4, 20, 52, 104, 204];
  64179. RSSExpandedReader.GSUM = [0, 348, 1388, 2948, 3988];
  64180. RSSExpandedReader.FINDER_PATTERNS = [Int32Array.from([1, 8, 4, 1]), Int32Array.from([3, 6, 4, 1]), Int32Array.from([3, 4, 6, 1]), Int32Array.from([3, 2, 8, 1]), Int32Array.from([2, 6, 5, 1]), Int32Array.from([2, 2, 9, 1])];
  64181. RSSExpandedReader.WEIGHTS = [[1, 3, 9, 27, 81, 32, 96, 77], [20, 60, 180, 118, 143, 7, 21, 63], [189, 145, 13, 39, 117, 140, 209, 205], [193, 157, 49, 147, 19, 57, 171, 91], [62, 186, 136, 197, 169, 85, 44, 132], [185, 133, 188, 142, 4, 12, 36, 108], [113, 128, 173, 97, 80, 29, 87, 50], [150, 28, 84, 41, 123, 158, 52, 156], [46, 138, 203, 187, 139, 206, 196, 166], [76, 17, 51, 153, 37, 111, 122, 155], [43, 129, 176, 106, 107, 110, 119, 146], [16, 48, 144, 10, 30, 90, 59, 177], [109, 116, 137, 200, 178, 112, 125, 164], [70, 210, 208, 202, 184, 130, 179, 115], [134, 191, 151, 31, 93, 68, 204, 190], [148, 22, 66, 198, 172, 94, 71, 2], [6, 18, 54, 162, 64, 192, 154, 40], [120, 149, 25, 75, 14, 42, 126, 167], [79, 26, 78, 23, 69, 207, 199, 175], [103, 98, 83, 38, 114, 131, 182, 124], [161, 61, 183, 127, 170, 88, 53, 159], [55, 165, 73, 8, 24, 72, 5, 15], [45, 135, 194, 160, 58, 174, 100, 89]];
  64182. RSSExpandedReader.FINDER_PAT_A = 0;
  64183. RSSExpandedReader.FINDER_PAT_B = 1;
  64184. RSSExpandedReader.FINDER_PAT_C = 2;
  64185. RSSExpandedReader.FINDER_PAT_D = 3;
  64186. RSSExpandedReader.FINDER_PAT_E = 4;
  64187. RSSExpandedReader.FINDER_PAT_F = 5;
  64188. RSSExpandedReader.FINDER_PATTERN_SEQUENCES = [[RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_C], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_F], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_E], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F], [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F]];
  64189. RSSExpandedReader.MAX_PAIRS = 11;
  64190. return RSSExpandedReader;
  64191. }(_AbstractRSSReader.default);
  64192. var _default = RSSExpandedReader;
  64193. exports.default = _default;
  64194. /***/ }),
  64195. /* 375 */
  64196. /*!**********************************************************************************************!*\
  64197. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/AbstractRSSReader.js ***!
  64198. \**********************************************************************************************/
  64199. /*! no static exports found */
  64200. /***/ (function(module, exports, __webpack_require__) {
  64201. "use strict";
  64202. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  64203. Object.defineProperty(exports, "__esModule", {
  64204. value: true
  64205. });
  64206. exports.default = void 0;
  64207. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
  64208. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  64209. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ../OneDReader */ 359));
  64210. var __extends = void 0 && (void 0).__extends || function () {
  64211. var _extendStatics = function extendStatics(d, b) {
  64212. _extendStatics = Object.setPrototypeOf || {
  64213. __proto__: []
  64214. } instanceof Array && function (d, b) {
  64215. d.__proto__ = b;
  64216. } || function (d, b) {
  64217. for (var p in b) {
  64218. if (b.hasOwnProperty(p)) d[p] = b[p];
  64219. }
  64220. };
  64221. return _extendStatics(d, b);
  64222. };
  64223. return function (d, b) {
  64224. _extendStatics(d, b);
  64225. function __() {
  64226. this.constructor = d;
  64227. }
  64228. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  64229. };
  64230. }();
  64231. var __values = void 0 && (void 0).__values || function (o) {
  64232. var s = typeof Symbol === "function" && Symbol.iterator,
  64233. m = s && o[s],
  64234. i = 0;
  64235. if (m) return m.call(o);
  64236. if (o && typeof o.length === "number") return {
  64237. next: function next() {
  64238. if (o && i >= o.length) o = void 0;
  64239. return {
  64240. value: o && o[i++],
  64241. done: !o
  64242. };
  64243. }
  64244. };
  64245. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  64246. };
  64247. // import Integer from '../../util/Integer';
  64248. // import Float from '../../util/Float';
  64249. var AbstractRSSReader = /** @class */function (_super) {
  64250. __extends(AbstractRSSReader, _super);
  64251. function AbstractRSSReader() {
  64252. var _this = _super.call(this) || this;
  64253. _this.decodeFinderCounters = new Int32Array(4);
  64254. _this.dataCharacterCounters = new Int32Array(8);
  64255. _this.oddRoundingErrors = new Array(4);
  64256. _this.evenRoundingErrors = new Array(4);
  64257. _this.oddCounts = new Array(_this.dataCharacterCounters.length / 2);
  64258. _this.evenCounts = new Array(_this.dataCharacterCounters.length / 2);
  64259. return _this;
  64260. }
  64261. AbstractRSSReader.prototype.getDecodeFinderCounters = function () {
  64262. return this.decodeFinderCounters;
  64263. };
  64264. AbstractRSSReader.prototype.getDataCharacterCounters = function () {
  64265. return this.dataCharacterCounters;
  64266. };
  64267. AbstractRSSReader.prototype.getOddRoundingErrors = function () {
  64268. return this.oddRoundingErrors;
  64269. };
  64270. AbstractRSSReader.prototype.getEvenRoundingErrors = function () {
  64271. return this.evenRoundingErrors;
  64272. };
  64273. AbstractRSSReader.prototype.getOddCounts = function () {
  64274. return this.oddCounts;
  64275. };
  64276. AbstractRSSReader.prototype.getEvenCounts = function () {
  64277. return this.evenCounts;
  64278. };
  64279. AbstractRSSReader.prototype.parseFinderValue = function (counters, finderPatterns) {
  64280. for (var value = 0; value < finderPatterns.length; value++) {
  64281. if (_OneDReader.default.patternMatchVariance(counters, finderPatterns[value], AbstractRSSReader.MAX_INDIVIDUAL_VARIANCE) < AbstractRSSReader.MAX_AVG_VARIANCE) {
  64282. return value;
  64283. }
  64284. }
  64285. throw new _NotFoundException.default();
  64286. };
  64287. /**
  64288. * @param array values to sum
  64289. * @return sum of values
  64290. * @deprecated call {@link MathUtils#sum(int[])}
  64291. */
  64292. AbstractRSSReader.count = function (array) {
  64293. return _MathUtils.default.sum(new Int32Array(array));
  64294. };
  64295. AbstractRSSReader.increment = function (array, errors) {
  64296. var index = 0;
  64297. var biggestError = errors[0];
  64298. for (var i = 1; i < array.length; i++) {
  64299. if (errors[i] > biggestError) {
  64300. biggestError = errors[i];
  64301. index = i;
  64302. }
  64303. }
  64304. array[index]++;
  64305. };
  64306. AbstractRSSReader.decrement = function (array, errors) {
  64307. var index = 0;
  64308. var biggestError = errors[0];
  64309. for (var i = 1; i < array.length; i++) {
  64310. if (errors[i] < biggestError) {
  64311. biggestError = errors[i];
  64312. index = i;
  64313. }
  64314. }
  64315. array[index]--;
  64316. };
  64317. AbstractRSSReader.isFinderPattern = function (counters) {
  64318. var e_1, _a;
  64319. var firstTwoSum = counters[0] + counters[1];
  64320. var sum = firstTwoSum + counters[2] + counters[3];
  64321. var ratio = firstTwoSum / sum;
  64322. if (ratio >= AbstractRSSReader.MIN_FINDER_PATTERN_RATIO && ratio <= AbstractRSSReader.MAX_FINDER_PATTERN_RATIO) {
  64323. // passes ratio test in spec, but see if the counts are unreasonable
  64324. var minCounter = Number.MAX_SAFE_INTEGER;
  64325. var maxCounter = Number.MIN_SAFE_INTEGER;
  64326. try {
  64327. for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
  64328. var counter = counters_1_1.value;
  64329. if (counter > maxCounter) {
  64330. maxCounter = counter;
  64331. }
  64332. if (counter < minCounter) {
  64333. minCounter = counter;
  64334. }
  64335. }
  64336. } catch (e_1_1) {
  64337. e_1 = {
  64338. error: e_1_1
  64339. };
  64340. } finally {
  64341. try {
  64342. if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
  64343. } finally {
  64344. if (e_1) throw e_1.error;
  64345. }
  64346. }
  64347. return maxCounter < 10 * minCounter;
  64348. }
  64349. return false;
  64350. };
  64351. AbstractRSSReader.MAX_AVG_VARIANCE = 0.2;
  64352. AbstractRSSReader.MAX_INDIVIDUAL_VARIANCE = 0.45;
  64353. AbstractRSSReader.MIN_FINDER_PATTERN_RATIO = 9.5 / 12.0;
  64354. AbstractRSSReader.MAX_FINDER_PATTERN_RATIO = 12.5 / 14.0;
  64355. return AbstractRSSReader;
  64356. }(_OneDReader.default);
  64357. var _default = AbstractRSSReader;
  64358. exports.default = _default;
  64359. /***/ }),
  64360. /* 376 */
  64361. /*!******************************************************************************************!*\
  64362. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/DataCharacter.js ***!
  64363. \******************************************************************************************/
  64364. /*! no static exports found */
  64365. /***/ (function(module, exports, __webpack_require__) {
  64366. "use strict";
  64367. Object.defineProperty(exports, "__esModule", {
  64368. value: true
  64369. });
  64370. exports.default = void 0;
  64371. var DataCharacter = /** @class */function () {
  64372. function DataCharacter(value, checksumPortion) {
  64373. this.value = value;
  64374. this.checksumPortion = checksumPortion;
  64375. }
  64376. DataCharacter.prototype.getValue = function () {
  64377. return this.value;
  64378. };
  64379. DataCharacter.prototype.getChecksumPortion = function () {
  64380. return this.checksumPortion;
  64381. };
  64382. DataCharacter.prototype.toString = function () {
  64383. return this.value + '(' + this.checksumPortion + ')';
  64384. };
  64385. DataCharacter.prototype.equals = function (o) {
  64386. if (!(o instanceof DataCharacter)) {
  64387. return false;
  64388. }
  64389. var that = o;
  64390. return this.value === that.value && this.checksumPortion === that.checksumPortion;
  64391. };
  64392. DataCharacter.prototype.hashCode = function () {
  64393. return this.value ^ this.checksumPortion;
  64394. };
  64395. return DataCharacter;
  64396. }();
  64397. var _default = DataCharacter;
  64398. exports.default = _default;
  64399. /***/ }),
  64400. /* 377 */
  64401. /*!******************************************************************************************!*\
  64402. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/FinderPattern.js ***!
  64403. \******************************************************************************************/
  64404. /*! no static exports found */
  64405. /***/ (function(module, exports, __webpack_require__) {
  64406. "use strict";
  64407. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  64408. Object.defineProperty(exports, "__esModule", {
  64409. value: true
  64410. });
  64411. exports.default = void 0;
  64412. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  64413. var FinderPattern = /** @class */function () {
  64414. function FinderPattern(value, startEnd, start, end, rowNumber) {
  64415. this.value = value;
  64416. this.startEnd = startEnd;
  64417. this.value = value;
  64418. this.startEnd = startEnd;
  64419. this.resultPoints = new Array();
  64420. this.resultPoints.push(new _ResultPoint.default(start, rowNumber));
  64421. this.resultPoints.push(new _ResultPoint.default(end, rowNumber));
  64422. }
  64423. FinderPattern.prototype.getValue = function () {
  64424. return this.value;
  64425. };
  64426. FinderPattern.prototype.getStartEnd = function () {
  64427. return this.startEnd;
  64428. };
  64429. FinderPattern.prototype.getResultPoints = function () {
  64430. return this.resultPoints;
  64431. };
  64432. FinderPattern.prototype.equals = function (o) {
  64433. if (!(o instanceof FinderPattern)) {
  64434. return false;
  64435. }
  64436. var that = o;
  64437. return this.value === that.value;
  64438. };
  64439. FinderPattern.prototype.hashCode = function () {
  64440. return this.value;
  64441. };
  64442. return FinderPattern;
  64443. }();
  64444. var _default = FinderPattern;
  64445. exports.default = _default;
  64446. /***/ }),
  64447. /* 378 */
  64448. /*!*************************************************************************************!*\
  64449. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/RSSUtils.js ***!
  64450. \*************************************************************************************/
  64451. /*! no static exports found */
  64452. /***/ (function(module, exports, __webpack_require__) {
  64453. "use strict";
  64454. Object.defineProperty(exports, "__esModule", {
  64455. value: true
  64456. });
  64457. exports.default = void 0;
  64458. var __values = void 0 && (void 0).__values || function (o) {
  64459. var s = typeof Symbol === "function" && Symbol.iterator,
  64460. m = s && o[s],
  64461. i = 0;
  64462. if (m) return m.call(o);
  64463. if (o && typeof o.length === "number") return {
  64464. next: function next() {
  64465. if (o && i >= o.length) o = void 0;
  64466. return {
  64467. value: o && o[i++],
  64468. done: !o
  64469. };
  64470. }
  64471. };
  64472. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  64473. };
  64474. /**
  64475. * RSS util functions.
  64476. */
  64477. var RSSUtils = /** @class */function () {
  64478. function RSSUtils() {}
  64479. RSSUtils.getRSSvalue = function (widths, maxWidth, noNarrow) {
  64480. var e_1, _a;
  64481. var n = 0;
  64482. try {
  64483. for (var widths_1 = __values(widths), widths_1_1 = widths_1.next(); !widths_1_1.done; widths_1_1 = widths_1.next()) {
  64484. var width = widths_1_1.value;
  64485. n += width;
  64486. }
  64487. } catch (e_1_1) {
  64488. e_1 = {
  64489. error: e_1_1
  64490. };
  64491. } finally {
  64492. try {
  64493. if (widths_1_1 && !widths_1_1.done && (_a = widths_1.return)) _a.call(widths_1);
  64494. } finally {
  64495. if (e_1) throw e_1.error;
  64496. }
  64497. }
  64498. var val = 0;
  64499. var narrowMask = 0;
  64500. var elements = widths.length;
  64501. for (var bar = 0; bar < elements - 1; bar++) {
  64502. var elmWidth = void 0;
  64503. for (elmWidth = 1, narrowMask |= 1 << bar; elmWidth < widths[bar]; elmWidth++, narrowMask &= ~(1 << bar)) {
  64504. var subVal = RSSUtils.combins(n - elmWidth - 1, elements - bar - 2);
  64505. if (noNarrow && narrowMask === 0 && n - elmWidth - (elements - bar - 1) >= elements - bar - 1) {
  64506. subVal -= RSSUtils.combins(n - elmWidth - (elements - bar), elements - bar - 2);
  64507. }
  64508. if (elements - bar - 1 > 1) {
  64509. var lessVal = 0;
  64510. for (var mxwElement = n - elmWidth - (elements - bar - 2); mxwElement > maxWidth; mxwElement--) {
  64511. lessVal += RSSUtils.combins(n - elmWidth - mxwElement - 1, elements - bar - 3);
  64512. }
  64513. subVal -= lessVal * (elements - 1 - bar);
  64514. } else if (n - elmWidth > maxWidth) {
  64515. subVal--;
  64516. }
  64517. val += subVal;
  64518. }
  64519. n -= elmWidth;
  64520. }
  64521. return val;
  64522. };
  64523. RSSUtils.combins = function (n, r) {
  64524. var maxDenom;
  64525. var minDenom;
  64526. if (n - r > r) {
  64527. minDenom = r;
  64528. maxDenom = n - r;
  64529. } else {
  64530. minDenom = n - r;
  64531. maxDenom = r;
  64532. }
  64533. var val = 1;
  64534. var j = 1;
  64535. for (var i = n; i > maxDenom; i--) {
  64536. val *= i;
  64537. if (j <= minDenom) {
  64538. val /= j;
  64539. j++;
  64540. }
  64541. }
  64542. while (j <= minDenom) {
  64543. val /= j;
  64544. j++;
  64545. }
  64546. return val;
  64547. };
  64548. return RSSUtils;
  64549. }();
  64550. var _default = RSSUtils;
  64551. exports.default = _default;
  64552. /***/ }),
  64553. /* 379 */
  64554. /*!*****************************************************************************************************!*\
  64555. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/BitArrayBuilder.js ***!
  64556. \*****************************************************************************************************/
  64557. /*! no static exports found */
  64558. /***/ (function(module, exports, __webpack_require__) {
  64559. "use strict";
  64560. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  64561. Object.defineProperty(exports, "__esModule", {
  64562. value: true
  64563. });
  64564. exports.default = void 0;
  64565. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../../common/BitArray */ 313));
  64566. var BitArrayBuilder = /** @class */function () {
  64567. function BitArrayBuilder() {}
  64568. BitArrayBuilder.buildBitArray = function (pairs) {
  64569. var charNumber = pairs.length * 2 - 1;
  64570. if (pairs[pairs.length - 1].getRightChar() == null) {
  64571. charNumber -= 1;
  64572. }
  64573. var size = 12 * charNumber;
  64574. var binary = new _BitArray.default(size);
  64575. var accPos = 0;
  64576. var firstPair = pairs[0];
  64577. var firstValue = firstPair.getRightChar().getValue();
  64578. for (var i = 11; i >= 0; --i) {
  64579. if ((firstValue & 1 << i) !== 0) {
  64580. binary.set(accPos);
  64581. }
  64582. accPos++;
  64583. }
  64584. for (var i = 1; i < pairs.length; ++i) {
  64585. var currentPair = pairs[i];
  64586. var leftValue = currentPair.getLeftChar().getValue();
  64587. for (var j = 11; j >= 0; --j) {
  64588. if ((leftValue & 1 << j) !== 0) {
  64589. binary.set(accPos);
  64590. }
  64591. accPos++;
  64592. }
  64593. if (currentPair.getRightChar() !== null) {
  64594. var rightValue = currentPair.getRightChar().getValue();
  64595. for (var j = 11; j >= 0; --j) {
  64596. if ((rightValue & 1 << j) !== 0) {
  64597. binary.set(accPos);
  64598. }
  64599. accPos++;
  64600. }
  64601. }
  64602. }
  64603. return binary;
  64604. };
  64605. return BitArrayBuilder;
  64606. }();
  64607. var _default = BitArrayBuilder;
  64608. exports.default = _default;
  64609. /***/ }),
  64610. /* 380 */
  64611. /*!********************************************************************************************************************************!*\
  64612. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AbstractExpandedDecoderComplement.js ***!
  64613. \********************************************************************************************************************************/
  64614. /*! no static exports found */
  64615. /***/ (function(module, exports, __webpack_require__) {
  64616. "use strict";
  64617. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  64618. Object.defineProperty(exports, "__esModule", {
  64619. value: true
  64620. });
  64621. exports.createDecoder = createDecoder;
  64622. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../../../IllegalStateException */ 344));
  64623. var _GeneralAppIdDecoder = _interopRequireDefault(__webpack_require__(/*! ./GeneralAppIdDecoder */ 381));
  64624. var _AI01AndOtherAIs = _interopRequireDefault(__webpack_require__(/*! ./AI01AndOtherAIs */ 388));
  64625. var _AnyAIDecoder = _interopRequireDefault(__webpack_require__(/*! ./AnyAIDecoder */ 391));
  64626. var _AI013103decoder = _interopRequireDefault(__webpack_require__(/*! ./AI013103decoder */ 392));
  64627. var _AI01320xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01320xDecoder */ 395));
  64628. var _AI01392xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01392xDecoder */ 396));
  64629. var _AI01393xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01393xDecoder */ 397));
  64630. var _AI013x0x1xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI013x0x1xDecoder */ 398));
  64631. function createDecoder(information) {
  64632. try {
  64633. if (information.get(1)) {
  64634. return new _AI01AndOtherAIs.default(information);
  64635. }
  64636. if (!information.get(2)) {
  64637. return new _AnyAIDecoder.default(information);
  64638. }
  64639. var fourBitEncodationMethod = _GeneralAppIdDecoder.default.extractNumericValueFromBitArray(information, 1, 4);
  64640. switch (fourBitEncodationMethod) {
  64641. case 4:
  64642. return new _AI013103decoder.default(information);
  64643. case 5:
  64644. return new _AI01320xDecoder.default(information);
  64645. }
  64646. var fiveBitEncodationMethod = _GeneralAppIdDecoder.default.extractNumericValueFromBitArray(information, 1, 5);
  64647. switch (fiveBitEncodationMethod) {
  64648. case 12:
  64649. return new _AI01392xDecoder.default(information);
  64650. case 13:
  64651. return new _AI01393xDecoder.default(information);
  64652. }
  64653. var sevenBitEncodationMethod = _GeneralAppIdDecoder.default.extractNumericValueFromBitArray(information, 1, 7);
  64654. switch (sevenBitEncodationMethod) {
  64655. case 56:
  64656. return new _AI013x0x1xDecoder.default(information, '310', '11');
  64657. case 57:
  64658. return new _AI013x0x1xDecoder.default(information, '320', '11');
  64659. case 58:
  64660. return new _AI013x0x1xDecoder.default(information, '310', '13');
  64661. case 59:
  64662. return new _AI013x0x1xDecoder.default(information, '320', '13');
  64663. case 60:
  64664. return new _AI013x0x1xDecoder.default(information, '310', '15');
  64665. case 61:
  64666. return new _AI013x0x1xDecoder.default(information, '320', '15');
  64667. case 62:
  64668. return new _AI013x0x1xDecoder.default(information, '310', '17');
  64669. case 63:
  64670. return new _AI013x0x1xDecoder.default(information, '320', '17');
  64671. }
  64672. } catch (e) {
  64673. console.log(e);
  64674. throw new _IllegalStateException.default('unknown decoder: ' + information);
  64675. }
  64676. }
  64677. /***/ }),
  64678. /* 381 */
  64679. /*!******************************************************************************************************************!*\
  64680. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.js ***!
  64681. \******************************************************************************************************************/
  64682. /*! no static exports found */
  64683. /***/ (function(module, exports, __webpack_require__) {
  64684. "use strict";
  64685. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  64686. Object.defineProperty(exports, "__esModule", {
  64687. value: true
  64688. });
  64689. exports.default = void 0;
  64690. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../../../FormatException */ 324));
  64691. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../../../IllegalStateException */ 344));
  64692. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  64693. var _BlockParsedResult = _interopRequireDefault(__webpack_require__(/*! ./BlockParsedResult */ 382));
  64694. var _DecodedChar = _interopRequireDefault(__webpack_require__(/*! ./DecodedChar */ 383));
  64695. var _DecodedInformation = _interopRequireDefault(__webpack_require__(/*! ./DecodedInformation */ 385));
  64696. var _DecodedNumeric = _interopRequireDefault(__webpack_require__(/*! ./DecodedNumeric */ 386));
  64697. var _FieldParser = _interopRequireDefault(__webpack_require__(/*! ./FieldParser */ 387));
  64698. var GeneralAppIdDecoder = /** @class */function () {
  64699. function GeneralAppIdDecoder(information) {
  64700. this.buffer = new _StringBuilder.default();
  64701. this.information = information;
  64702. }
  64703. GeneralAppIdDecoder.prototype.decodeAllCodes = function (buff, initialPosition) {
  64704. var currentPosition = initialPosition;
  64705. var remaining = null;
  64706. do {
  64707. var info = this.decodeGeneralPurposeField(currentPosition, remaining);
  64708. var parsedFields = _FieldParser.default.parseFieldsInGeneralPurpose(info.getNewString());
  64709. if (parsedFields != null) {
  64710. buff.append(parsedFields);
  64711. }
  64712. if (info.isRemaining()) {
  64713. remaining = '' + info.getRemainingValue();
  64714. } else {
  64715. remaining = null;
  64716. }
  64717. if (currentPosition === info.getNewPosition()) {
  64718. // No step forward!
  64719. break;
  64720. }
  64721. currentPosition = info.getNewPosition();
  64722. } while (true);
  64723. return buff.toString();
  64724. };
  64725. GeneralAppIdDecoder.prototype.isStillNumeric = function (pos) {
  64726. // It's numeric if it still has 7 positions
  64727. // and one of the first 4 bits is "1".
  64728. if (pos + 7 > this.information.getSize()) {
  64729. return pos + 4 <= this.information.getSize();
  64730. }
  64731. for (var i = pos; i < pos + 3; ++i) {
  64732. if (this.information.get(i)) {
  64733. return true;
  64734. }
  64735. }
  64736. return this.information.get(pos + 3);
  64737. };
  64738. GeneralAppIdDecoder.prototype.decodeNumeric = function (pos) {
  64739. if (pos + 7 > this.information.getSize()) {
  64740. var numeric_1 = this.extractNumericValueFromBitArray(pos, 4);
  64741. if (numeric_1 === 0) {
  64742. return new _DecodedNumeric.default(this.information.getSize(), _DecodedNumeric.default.FNC1, _DecodedNumeric.default.FNC1);
  64743. }
  64744. return new _DecodedNumeric.default(this.information.getSize(), numeric_1 - 1, _DecodedNumeric.default.FNC1);
  64745. }
  64746. var numeric = this.extractNumericValueFromBitArray(pos, 7);
  64747. var digit1 = (numeric - 8) / 11;
  64748. var digit2 = (numeric - 8) % 11;
  64749. return new _DecodedNumeric.default(pos + 7, digit1, digit2);
  64750. };
  64751. GeneralAppIdDecoder.prototype.extractNumericValueFromBitArray = function (pos, bits) {
  64752. return GeneralAppIdDecoder.extractNumericValueFromBitArray(this.information, pos, bits);
  64753. };
  64754. GeneralAppIdDecoder.extractNumericValueFromBitArray = function (information, pos, bits) {
  64755. var value = 0;
  64756. for (var i = 0; i < bits; ++i) {
  64757. if (information.get(pos + i)) {
  64758. value |= 1 << bits - i - 1;
  64759. }
  64760. }
  64761. return value;
  64762. };
  64763. GeneralAppIdDecoder.prototype.decodeGeneralPurposeField = function (pos, remaining) {
  64764. // this.buffer.setLength(0);
  64765. this.buffer.setLengthToZero();
  64766. if (remaining != null) {
  64767. this.buffer.append(remaining);
  64768. }
  64769. this.current.setPosition(pos);
  64770. var lastDecoded = this.parseBlocks();
  64771. if (lastDecoded != null && lastDecoded.isRemaining()) {
  64772. return new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString(), lastDecoded.getRemainingValue());
  64773. }
  64774. return new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
  64775. };
  64776. GeneralAppIdDecoder.prototype.parseBlocks = function () {
  64777. var isFinished;
  64778. var result;
  64779. do {
  64780. var initialPosition = this.current.getPosition();
  64781. if (this.current.isAlpha()) {
  64782. result = this.parseAlphaBlock();
  64783. isFinished = result.isFinished();
  64784. } else if (this.current.isIsoIec646()) {
  64785. result = this.parseIsoIec646Block();
  64786. isFinished = result.isFinished();
  64787. } else {
  64788. // it must be numeric
  64789. result = this.parseNumericBlock();
  64790. isFinished = result.isFinished();
  64791. }
  64792. var positionChanged = initialPosition !== this.current.getPosition();
  64793. if (!positionChanged && !isFinished) {
  64794. break;
  64795. }
  64796. } while (!isFinished);
  64797. return result.getDecodedInformation();
  64798. };
  64799. GeneralAppIdDecoder.prototype.parseNumericBlock = function () {
  64800. while (this.isStillNumeric(this.current.getPosition())) {
  64801. var numeric = this.decodeNumeric(this.current.getPosition());
  64802. this.current.setPosition(numeric.getNewPosition());
  64803. if (numeric.isFirstDigitFNC1()) {
  64804. var information = void 0;
  64805. if (numeric.isSecondDigitFNC1()) {
  64806. information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
  64807. } else {
  64808. information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString(), numeric.getSecondDigit());
  64809. }
  64810. return new _BlockParsedResult.default(true, information);
  64811. }
  64812. this.buffer.append(numeric.getFirstDigit());
  64813. if (numeric.isSecondDigitFNC1()) {
  64814. var information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
  64815. return new _BlockParsedResult.default(true, information);
  64816. }
  64817. this.buffer.append(numeric.getSecondDigit());
  64818. }
  64819. if (this.isNumericToAlphaNumericLatch(this.current.getPosition())) {
  64820. this.current.setAlpha();
  64821. this.current.incrementPosition(4);
  64822. }
  64823. return new _BlockParsedResult.default(false);
  64824. };
  64825. GeneralAppIdDecoder.prototype.parseIsoIec646Block = function () {
  64826. while (this.isStillIsoIec646(this.current.getPosition())) {
  64827. var iso = this.decodeIsoIec646(this.current.getPosition());
  64828. this.current.setPosition(iso.getNewPosition());
  64829. if (iso.isFNC1()) {
  64830. var information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
  64831. return new _BlockParsedResult.default(true, information);
  64832. }
  64833. this.buffer.append(iso.getValue());
  64834. }
  64835. if (this.isAlphaOr646ToNumericLatch(this.current.getPosition())) {
  64836. this.current.incrementPosition(3);
  64837. this.current.setNumeric();
  64838. } else if (this.isAlphaTo646ToAlphaLatch(this.current.getPosition())) {
  64839. if (this.current.getPosition() + 5 < this.information.getSize()) {
  64840. this.current.incrementPosition(5);
  64841. } else {
  64842. this.current.setPosition(this.information.getSize());
  64843. }
  64844. this.current.setAlpha();
  64845. }
  64846. return new _BlockParsedResult.default(false);
  64847. };
  64848. GeneralAppIdDecoder.prototype.parseAlphaBlock = function () {
  64849. while (this.isStillAlpha(this.current.getPosition())) {
  64850. var alpha = this.decodeAlphanumeric(this.current.getPosition());
  64851. this.current.setPosition(alpha.getNewPosition());
  64852. if (alpha.isFNC1()) {
  64853. var information = new _DecodedInformation.default(this.current.getPosition(), this.buffer.toString());
  64854. return new _BlockParsedResult.default(true, information); // end of the char block
  64855. }
  64856. this.buffer.append(alpha.getValue());
  64857. }
  64858. if (this.isAlphaOr646ToNumericLatch(this.current.getPosition())) {
  64859. this.current.incrementPosition(3);
  64860. this.current.setNumeric();
  64861. } else if (this.isAlphaTo646ToAlphaLatch(this.current.getPosition())) {
  64862. if (this.current.getPosition() + 5 < this.information.getSize()) {
  64863. this.current.incrementPosition(5);
  64864. } else {
  64865. this.current.setPosition(this.information.getSize());
  64866. }
  64867. this.current.setIsoIec646();
  64868. }
  64869. return new _BlockParsedResult.default(false);
  64870. };
  64871. GeneralAppIdDecoder.prototype.isStillIsoIec646 = function (pos) {
  64872. if (pos + 5 > this.information.getSize()) {
  64873. return false;
  64874. }
  64875. var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
  64876. if (fiveBitValue >= 5 && fiveBitValue < 16) {
  64877. return true;
  64878. }
  64879. if (pos + 7 > this.information.getSize()) {
  64880. return false;
  64881. }
  64882. var sevenBitValue = this.extractNumericValueFromBitArray(pos, 7);
  64883. if (sevenBitValue >= 64 && sevenBitValue < 116) {
  64884. return true;
  64885. }
  64886. if (pos + 8 > this.information.getSize()) {
  64887. return false;
  64888. }
  64889. var eightBitValue = this.extractNumericValueFromBitArray(pos, 8);
  64890. return eightBitValue >= 232 && eightBitValue < 253;
  64891. };
  64892. GeneralAppIdDecoder.prototype.decodeIsoIec646 = function (pos) {
  64893. var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
  64894. if (fiveBitValue === 15) {
  64895. return new _DecodedChar.default(pos + 5, _DecodedChar.default.FNC1);
  64896. }
  64897. if (fiveBitValue >= 5 && fiveBitValue < 15) {
  64898. return new _DecodedChar.default(pos + 5, '0' + (fiveBitValue - 5));
  64899. }
  64900. var sevenBitValue = this.extractNumericValueFromBitArray(pos, 7);
  64901. if (sevenBitValue >= 64 && sevenBitValue < 90) {
  64902. return new _DecodedChar.default(pos + 7, '' + (sevenBitValue + 1));
  64903. }
  64904. if (sevenBitValue >= 90 && sevenBitValue < 116) {
  64905. return new _DecodedChar.default(pos + 7, '' + (sevenBitValue + 7));
  64906. }
  64907. var eightBitValue = this.extractNumericValueFromBitArray(pos, 8);
  64908. var c;
  64909. switch (eightBitValue) {
  64910. case 232:
  64911. c = '!';
  64912. break;
  64913. case 233:
  64914. c = '"';
  64915. break;
  64916. case 234:
  64917. c = '%';
  64918. break;
  64919. case 235:
  64920. c = '&';
  64921. break;
  64922. case 236:
  64923. c = '\'';
  64924. break;
  64925. case 237:
  64926. c = '(';
  64927. break;
  64928. case 238:
  64929. c = ')';
  64930. break;
  64931. case 239:
  64932. c = '*';
  64933. break;
  64934. case 240:
  64935. c = '+';
  64936. break;
  64937. case 241:
  64938. c = ',';
  64939. break;
  64940. case 242:
  64941. c = '-';
  64942. break;
  64943. case 243:
  64944. c = '.';
  64945. break;
  64946. case 244:
  64947. c = '/';
  64948. break;
  64949. case 245:
  64950. c = ':';
  64951. break;
  64952. case 246:
  64953. c = ';';
  64954. break;
  64955. case 247:
  64956. c = '<';
  64957. break;
  64958. case 248:
  64959. c = '=';
  64960. break;
  64961. case 249:
  64962. c = '>';
  64963. break;
  64964. case 250:
  64965. c = '?';
  64966. break;
  64967. case 251:
  64968. c = '_';
  64969. break;
  64970. case 252:
  64971. c = ' ';
  64972. break;
  64973. default:
  64974. throw new _FormatException.default();
  64975. }
  64976. return new _DecodedChar.default(pos + 8, c);
  64977. };
  64978. GeneralAppIdDecoder.prototype.isStillAlpha = function (pos) {
  64979. if (pos + 5 > this.information.getSize()) {
  64980. return false;
  64981. }
  64982. // We now check if it's a valid 5-bit value (0..9 and FNC1)
  64983. var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
  64984. if (fiveBitValue >= 5 && fiveBitValue < 16) {
  64985. return true;
  64986. }
  64987. if (pos + 6 > this.information.getSize()) {
  64988. return false;
  64989. }
  64990. var sixBitValue = this.extractNumericValueFromBitArray(pos, 6);
  64991. return sixBitValue >= 16 && sixBitValue < 63; // 63 not included
  64992. };
  64993. GeneralAppIdDecoder.prototype.decodeAlphanumeric = function (pos) {
  64994. var fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
  64995. if (fiveBitValue === 15) {
  64996. return new _DecodedChar.default(pos + 5, _DecodedChar.default.FNC1);
  64997. }
  64998. if (fiveBitValue >= 5 && fiveBitValue < 15) {
  64999. return new _DecodedChar.default(pos + 5, '0' + (fiveBitValue - 5));
  65000. }
  65001. var sixBitValue = this.extractNumericValueFromBitArray(pos, 6);
  65002. if (sixBitValue >= 32 && sixBitValue < 58) {
  65003. return new _DecodedChar.default(pos + 6, '' + (sixBitValue + 33));
  65004. }
  65005. var c;
  65006. switch (sixBitValue) {
  65007. case 58:
  65008. c = '*';
  65009. break;
  65010. case 59:
  65011. c = ',';
  65012. break;
  65013. case 60:
  65014. c = '-';
  65015. break;
  65016. case 61:
  65017. c = '.';
  65018. break;
  65019. case 62:
  65020. c = '/';
  65021. break;
  65022. default:
  65023. throw new _IllegalStateException.default('Decoding invalid alphanumeric value: ' + sixBitValue);
  65024. }
  65025. return new _DecodedChar.default(pos + 6, c);
  65026. };
  65027. GeneralAppIdDecoder.prototype.isAlphaTo646ToAlphaLatch = function (pos) {
  65028. if (pos + 1 > this.information.getSize()) {
  65029. return false;
  65030. }
  65031. for (var i = 0; i < 5 && i + pos < this.information.getSize(); ++i) {
  65032. if (i === 2) {
  65033. if (!this.information.get(pos + 2)) {
  65034. return false;
  65035. }
  65036. } else if (this.information.get(pos + i)) {
  65037. return false;
  65038. }
  65039. }
  65040. return true;
  65041. };
  65042. GeneralAppIdDecoder.prototype.isAlphaOr646ToNumericLatch = function (pos) {
  65043. // Next is alphanumeric if there are 3 positions and they are all zeros
  65044. if (pos + 3 > this.information.getSize()) {
  65045. return false;
  65046. }
  65047. for (var i = pos; i < pos + 3; ++i) {
  65048. if (this.information.get(i)) {
  65049. return false;
  65050. }
  65051. }
  65052. return true;
  65053. };
  65054. GeneralAppIdDecoder.prototype.isNumericToAlphaNumericLatch = function (pos) {
  65055. // Next is alphanumeric if there are 4 positions and they are all zeros, or
  65056. // if there is a subset of this just before the end of the symbol
  65057. if (pos + 1 > this.information.getSize()) {
  65058. return false;
  65059. }
  65060. for (var i = 0; i < 4 && i + pos < this.information.getSize(); ++i) {
  65061. if (this.information.get(pos + i)) {
  65062. return false;
  65063. }
  65064. }
  65065. return true;
  65066. };
  65067. return GeneralAppIdDecoder;
  65068. }();
  65069. var _default = GeneralAppIdDecoder;
  65070. exports.default = _default;
  65071. /***/ }),
  65072. /* 382 */
  65073. /*!****************************************************************************************************************!*\
  65074. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/BlockParsedResult.js ***!
  65075. \****************************************************************************************************************/
  65076. /*! no static exports found */
  65077. /***/ (function(module, exports, __webpack_require__) {
  65078. "use strict";
  65079. Object.defineProperty(exports, "__esModule", {
  65080. value: true
  65081. });
  65082. exports.default = void 0;
  65083. var BlockParsedResult = /** @class */function () {
  65084. function BlockParsedResult(finished, decodedInformation) {
  65085. if (decodedInformation) {
  65086. this.decodedInformation = null;
  65087. } else {
  65088. this.finished = finished;
  65089. this.decodedInformation = decodedInformation;
  65090. }
  65091. }
  65092. BlockParsedResult.prototype.getDecodedInformation = function () {
  65093. return this.decodedInformation;
  65094. };
  65095. BlockParsedResult.prototype.isFinished = function () {
  65096. return this.finished;
  65097. };
  65098. return BlockParsedResult;
  65099. }();
  65100. var _default = BlockParsedResult;
  65101. exports.default = _default;
  65102. /***/ }),
  65103. /* 383 */
  65104. /*!**********************************************************************************************************!*\
  65105. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedChar.js ***!
  65106. \**********************************************************************************************************/
  65107. /*! no static exports found */
  65108. /***/ (function(module, exports, __webpack_require__) {
  65109. "use strict";
  65110. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65111. Object.defineProperty(exports, "__esModule", {
  65112. value: true
  65113. });
  65114. exports.default = void 0;
  65115. var _DecodedObject = _interopRequireDefault(__webpack_require__(/*! ./DecodedObject */ 384));
  65116. var __extends = void 0 && (void 0).__extends || function () {
  65117. var _extendStatics = function extendStatics(d, b) {
  65118. _extendStatics = Object.setPrototypeOf || {
  65119. __proto__: []
  65120. } instanceof Array && function (d, b) {
  65121. d.__proto__ = b;
  65122. } || function (d, b) {
  65123. for (var p in b) {
  65124. if (b.hasOwnProperty(p)) d[p] = b[p];
  65125. }
  65126. };
  65127. return _extendStatics(d, b);
  65128. };
  65129. return function (d, b) {
  65130. _extendStatics(d, b);
  65131. function __() {
  65132. this.constructor = d;
  65133. }
  65134. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65135. };
  65136. }();
  65137. var DecodedChar = /** @class */function (_super) {
  65138. __extends(DecodedChar, _super);
  65139. function DecodedChar(newPosition, value) {
  65140. var _this = _super.call(this, newPosition) || this;
  65141. _this.value = value;
  65142. return _this;
  65143. }
  65144. DecodedChar.prototype.getValue = function () {
  65145. return this.value;
  65146. };
  65147. DecodedChar.prototype.isFNC1 = function () {
  65148. return this.value === DecodedChar.FNC1;
  65149. };
  65150. DecodedChar.FNC1 = '$';
  65151. return DecodedChar;
  65152. }(_DecodedObject.default);
  65153. var _default = DecodedChar;
  65154. exports.default = _default;
  65155. /***/ }),
  65156. /* 384 */
  65157. /*!************************************************************************************************************!*\
  65158. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedObject.js ***!
  65159. \************************************************************************************************************/
  65160. /*! no static exports found */
  65161. /***/ (function(module, exports, __webpack_require__) {
  65162. "use strict";
  65163. Object.defineProperty(exports, "__esModule", {
  65164. value: true
  65165. });
  65166. exports.default = void 0;
  65167. var DecodedObject = /** @class */function () {
  65168. function DecodedObject(newPosition) {
  65169. this.newPosition = newPosition;
  65170. }
  65171. DecodedObject.prototype.getNewPosition = function () {
  65172. return this.newPosition;
  65173. };
  65174. return DecodedObject;
  65175. }();
  65176. var _default = DecodedObject;
  65177. exports.default = _default;
  65178. /***/ }),
  65179. /* 385 */
  65180. /*!*****************************************************************************************************************!*\
  65181. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedInformation.js ***!
  65182. \*****************************************************************************************************************/
  65183. /*! no static exports found */
  65184. /***/ (function(module, exports, __webpack_require__) {
  65185. "use strict";
  65186. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65187. Object.defineProperty(exports, "__esModule", {
  65188. value: true
  65189. });
  65190. exports.default = void 0;
  65191. var _DecodedObject = _interopRequireDefault(__webpack_require__(/*! ./DecodedObject */ 384));
  65192. var __extends = void 0 && (void 0).__extends || function () {
  65193. var _extendStatics = function extendStatics(d, b) {
  65194. _extendStatics = Object.setPrototypeOf || {
  65195. __proto__: []
  65196. } instanceof Array && function (d, b) {
  65197. d.__proto__ = b;
  65198. } || function (d, b) {
  65199. for (var p in b) {
  65200. if (b.hasOwnProperty(p)) d[p] = b[p];
  65201. }
  65202. };
  65203. return _extendStatics(d, b);
  65204. };
  65205. return function (d, b) {
  65206. _extendStatics(d, b);
  65207. function __() {
  65208. this.constructor = d;
  65209. }
  65210. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65211. };
  65212. }();
  65213. var DecodedInformation = /** @class */function (_super) {
  65214. __extends(DecodedInformation, _super);
  65215. function DecodedInformation(newPosition, newString, remainingValue) {
  65216. var _this = _super.call(this, newPosition) || this;
  65217. if (remainingValue) {
  65218. _this.remaining = true;
  65219. _this.remainingValue = _this.remainingValue;
  65220. } else {
  65221. _this.remaining = false;
  65222. _this.remainingValue = 0;
  65223. }
  65224. _this.newString = newString;
  65225. return _this;
  65226. }
  65227. DecodedInformation.prototype.getNewString = function () {
  65228. return this.newString;
  65229. };
  65230. DecodedInformation.prototype.isRemaining = function () {
  65231. return this.remaining;
  65232. };
  65233. DecodedInformation.prototype.getRemainingValue = function () {
  65234. return this.remainingValue;
  65235. };
  65236. return DecodedInformation;
  65237. }(_DecodedObject.default);
  65238. var _default = DecodedInformation;
  65239. exports.default = _default;
  65240. /***/ }),
  65241. /* 386 */
  65242. /*!*************************************************************************************************************!*\
  65243. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/DecodedNumeric.js ***!
  65244. \*************************************************************************************************************/
  65245. /*! no static exports found */
  65246. /***/ (function(module, exports, __webpack_require__) {
  65247. "use strict";
  65248. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65249. Object.defineProperty(exports, "__esModule", {
  65250. value: true
  65251. });
  65252. exports.default = void 0;
  65253. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../../../FormatException */ 324));
  65254. var _DecodedObject = _interopRequireDefault(__webpack_require__(/*! ./DecodedObject */ 384));
  65255. var __extends = void 0 && (void 0).__extends || function () {
  65256. var _extendStatics = function extendStatics(d, b) {
  65257. _extendStatics = Object.setPrototypeOf || {
  65258. __proto__: []
  65259. } instanceof Array && function (d, b) {
  65260. d.__proto__ = b;
  65261. } || function (d, b) {
  65262. for (var p in b) {
  65263. if (b.hasOwnProperty(p)) d[p] = b[p];
  65264. }
  65265. };
  65266. return _extendStatics(d, b);
  65267. };
  65268. return function (d, b) {
  65269. _extendStatics(d, b);
  65270. function __() {
  65271. this.constructor = d;
  65272. }
  65273. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65274. };
  65275. }();
  65276. var DecodedNumeric = /** @class */function (_super) {
  65277. __extends(DecodedNumeric, _super);
  65278. function DecodedNumeric(newPosition, firstDigit, secondDigit) {
  65279. var _this = _super.call(this, newPosition) || this;
  65280. if (firstDigit < 0 || firstDigit > 10 || secondDigit < 0 || secondDigit > 10) {
  65281. throw new _FormatException.default();
  65282. }
  65283. _this.firstDigit = firstDigit;
  65284. _this.secondDigit = secondDigit;
  65285. return _this;
  65286. }
  65287. DecodedNumeric.prototype.getFirstDigit = function () {
  65288. return this.firstDigit;
  65289. };
  65290. DecodedNumeric.prototype.getSecondDigit = function () {
  65291. return this.secondDigit;
  65292. };
  65293. DecodedNumeric.prototype.getValue = function () {
  65294. return this.firstDigit * 10 + this.secondDigit;
  65295. };
  65296. DecodedNumeric.prototype.isFirstDigitFNC1 = function () {
  65297. return this.firstDigit === DecodedNumeric.FNC1;
  65298. };
  65299. DecodedNumeric.prototype.isSecondDigitFNC1 = function () {
  65300. return this.secondDigit === DecodedNumeric.FNC1;
  65301. };
  65302. DecodedNumeric.prototype.isAnyFNC1 = function () {
  65303. return this.firstDigit === DecodedNumeric.FNC1 || this.secondDigit === DecodedNumeric.FNC1;
  65304. };
  65305. DecodedNumeric.FNC1 = 10;
  65306. return DecodedNumeric;
  65307. }(_DecodedObject.default);
  65308. var _default = DecodedNumeric;
  65309. exports.default = _default;
  65310. /***/ }),
  65311. /* 387 */
  65312. /*!**********************************************************************************************************!*\
  65313. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/FieldParser.js ***!
  65314. \**********************************************************************************************************/
  65315. /*! no static exports found */
  65316. /***/ (function(module, exports, __webpack_require__) {
  65317. "use strict";
  65318. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65319. Object.defineProperty(exports, "__esModule", {
  65320. value: true
  65321. });
  65322. exports.default = void 0;
  65323. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
  65324. var __values = void 0 && (void 0).__values || function (o) {
  65325. var s = typeof Symbol === "function" && Symbol.iterator,
  65326. m = s && o[s],
  65327. i = 0;
  65328. if (m) return m.call(o);
  65329. if (o && typeof o.length === "number") return {
  65330. next: function next() {
  65331. if (o && i >= o.length) o = void 0;
  65332. return {
  65333. value: o && o[i++],
  65334. done: !o
  65335. };
  65336. }
  65337. };
  65338. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  65339. };
  65340. var FieldParser = /** @class */function () {
  65341. function FieldParser() {}
  65342. FieldParser.parseFieldsInGeneralPurpose = function (rawInformation) {
  65343. var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
  65344. if (!rawInformation) {
  65345. return null;
  65346. }
  65347. // Processing 2-digit AIs
  65348. if (rawInformation.length < 2) {
  65349. throw new _NotFoundException.default();
  65350. }
  65351. var firstTwoDigits = rawInformation.substring(0, 2);
  65352. try {
  65353. for (var _e = __values(FieldParser.TWO_DIGIT_DATA_LENGTH), _f = _e.next(); !_f.done; _f = _e.next()) {
  65354. var dataLength = _f.value;
  65355. if (dataLength[0] === firstTwoDigits) {
  65356. if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
  65357. return FieldParser.processVariableAI(2, dataLength[2], rawInformation);
  65358. }
  65359. return FieldParser.processFixedAI(2, dataLength[1], rawInformation);
  65360. }
  65361. }
  65362. } catch (e_1_1) {
  65363. e_1 = {
  65364. error: e_1_1
  65365. };
  65366. } finally {
  65367. try {
  65368. if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
  65369. } finally {
  65370. if (e_1) throw e_1.error;
  65371. }
  65372. }
  65373. if (rawInformation.length < 3) {
  65374. throw new _NotFoundException.default();
  65375. }
  65376. var firstThreeDigits = rawInformation.substring(0, 3);
  65377. try {
  65378. for (var _g = __values(FieldParser.THREE_DIGIT_DATA_LENGTH), _h = _g.next(); !_h.done; _h = _g.next()) {
  65379. var dataLength = _h.value;
  65380. if (dataLength[0] === firstThreeDigits) {
  65381. if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
  65382. return FieldParser.processVariableAI(3, dataLength[2], rawInformation);
  65383. }
  65384. return FieldParser.processFixedAI(3, dataLength[1], rawInformation);
  65385. }
  65386. }
  65387. } catch (e_2_1) {
  65388. e_2 = {
  65389. error: e_2_1
  65390. };
  65391. } finally {
  65392. try {
  65393. if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
  65394. } finally {
  65395. if (e_2) throw e_2.error;
  65396. }
  65397. }
  65398. try {
  65399. for (var _j = __values(FieldParser.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH), _k = _j.next(); !_k.done; _k = _j.next()) {
  65400. var dataLength = _k.value;
  65401. if (dataLength[0] === firstThreeDigits) {
  65402. if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
  65403. return FieldParser.processVariableAI(4, dataLength[2], rawInformation);
  65404. }
  65405. return FieldParser.processFixedAI(4, dataLength[1], rawInformation);
  65406. }
  65407. }
  65408. } catch (e_3_1) {
  65409. e_3 = {
  65410. error: e_3_1
  65411. };
  65412. } finally {
  65413. try {
  65414. if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
  65415. } finally {
  65416. if (e_3) throw e_3.error;
  65417. }
  65418. }
  65419. if (rawInformation.length < 4) {
  65420. throw new _NotFoundException.default();
  65421. }
  65422. var firstFourDigits = rawInformation.substring(0, 4);
  65423. try {
  65424. for (var _l = __values(FieldParser.FOUR_DIGIT_DATA_LENGTH), _m = _l.next(); !_m.done; _m = _l.next()) {
  65425. var dataLength = _m.value;
  65426. if (dataLength[0] === firstFourDigits) {
  65427. if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {
  65428. return FieldParser.processVariableAI(4, dataLength[2], rawInformation);
  65429. }
  65430. return FieldParser.processFixedAI(4, dataLength[1], rawInformation);
  65431. }
  65432. }
  65433. } catch (e_4_1) {
  65434. e_4 = {
  65435. error: e_4_1
  65436. };
  65437. } finally {
  65438. try {
  65439. if (_m && !_m.done && (_d = _l.return)) _d.call(_l);
  65440. } finally {
  65441. if (e_4) throw e_4.error;
  65442. }
  65443. }
  65444. throw new _NotFoundException.default();
  65445. };
  65446. FieldParser.processFixedAI = function (aiSize, fieldSize, rawInformation) {
  65447. if (rawInformation.length < aiSize) {
  65448. throw new _NotFoundException.default();
  65449. }
  65450. var ai = rawInformation.substring(0, aiSize);
  65451. if (rawInformation.length < aiSize + fieldSize) {
  65452. throw new _NotFoundException.default();
  65453. }
  65454. var field = rawInformation.substring(aiSize, aiSize + fieldSize);
  65455. var remaining = rawInformation.substring(aiSize + fieldSize);
  65456. var result = '(' + ai + ')' + field;
  65457. var parsedAI = FieldParser.parseFieldsInGeneralPurpose(remaining);
  65458. return parsedAI == null ? result : result + parsedAI;
  65459. };
  65460. FieldParser.processVariableAI = function (aiSize, variableFieldSize, rawInformation) {
  65461. var ai = rawInformation.substring(0, aiSize);
  65462. var maxSize;
  65463. if (rawInformation.length < aiSize + variableFieldSize) {
  65464. maxSize = rawInformation.length;
  65465. } else {
  65466. maxSize = aiSize + variableFieldSize;
  65467. }
  65468. var field = rawInformation.substring(aiSize, maxSize);
  65469. var remaining = rawInformation.substring(maxSize);
  65470. var result = '(' + ai + ')' + field;
  65471. var parsedAI = FieldParser.parseFieldsInGeneralPurpose(remaining);
  65472. return parsedAI == null ? result : result + parsedAI;
  65473. };
  65474. FieldParser.VARIABLE_LENGTH = [];
  65475. FieldParser.TWO_DIGIT_DATA_LENGTH = [['00', 18], ['01', 14], ['02', 14], ['10', FieldParser.VARIABLE_LENGTH, 20], ['11', 6], ['12', 6], ['13', 6], ['15', 6], ['17', 6], ['20', 2], ['21', FieldParser.VARIABLE_LENGTH, 20], ['22', FieldParser.VARIABLE_LENGTH, 29], ['30', FieldParser.VARIABLE_LENGTH, 8], ['37', FieldParser.VARIABLE_LENGTH, 8],
  65476. // internal company codes
  65477. ['90', FieldParser.VARIABLE_LENGTH, 30], ['91', FieldParser.VARIABLE_LENGTH, 30], ['92', FieldParser.VARIABLE_LENGTH, 30], ['93', FieldParser.VARIABLE_LENGTH, 30], ['94', FieldParser.VARIABLE_LENGTH, 30], ['95', FieldParser.VARIABLE_LENGTH, 30], ['96', FieldParser.VARIABLE_LENGTH, 30], ['97', FieldParser.VARIABLE_LENGTH, 3], ['98', FieldParser.VARIABLE_LENGTH, 30], ['99', FieldParser.VARIABLE_LENGTH, 30]];
  65478. FieldParser.THREE_DIGIT_DATA_LENGTH = [
  65479. // Same format as above
  65480. ['240', FieldParser.VARIABLE_LENGTH, 30], ['241', FieldParser.VARIABLE_LENGTH, 30], ['242', FieldParser.VARIABLE_LENGTH, 6], ['250', FieldParser.VARIABLE_LENGTH, 30], ['251', FieldParser.VARIABLE_LENGTH, 30], ['253', FieldParser.VARIABLE_LENGTH, 17], ['254', FieldParser.VARIABLE_LENGTH, 20], ['400', FieldParser.VARIABLE_LENGTH, 30], ['401', FieldParser.VARIABLE_LENGTH, 30], ['402', 17], ['403', FieldParser.VARIABLE_LENGTH, 30], ['410', 13], ['411', 13], ['412', 13], ['413', 13], ['414', 13], ['420', FieldParser.VARIABLE_LENGTH, 20], ['421', FieldParser.VARIABLE_LENGTH, 15], ['422', 3], ['423', FieldParser.VARIABLE_LENGTH, 15], ['424', 3], ['425', 3], ['426', 3]];
  65481. FieldParser.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH = [
  65482. // Same format as above
  65483. ['310', 6], ['311', 6], ['312', 6], ['313', 6], ['314', 6], ['315', 6], ['316', 6], ['320', 6], ['321', 6], ['322', 6], ['323', 6], ['324', 6], ['325', 6], ['326', 6], ['327', 6], ['328', 6], ['329', 6], ['330', 6], ['331', 6], ['332', 6], ['333', 6], ['334', 6], ['335', 6], ['336', 6], ['340', 6], ['341', 6], ['342', 6], ['343', 6], ['344', 6], ['345', 6], ['346', 6], ['347', 6], ['348', 6], ['349', 6], ['350', 6], ['351', 6], ['352', 6], ['353', 6], ['354', 6], ['355', 6], ['356', 6], ['357', 6], ['360', 6], ['361', 6], ['362', 6], ['363', 6], ['364', 6], ['365', 6], ['366', 6], ['367', 6], ['368', 6], ['369', 6], ['390', FieldParser.VARIABLE_LENGTH, 15], ['391', FieldParser.VARIABLE_LENGTH, 18], ['392', FieldParser.VARIABLE_LENGTH, 15], ['393', FieldParser.VARIABLE_LENGTH, 18], ['703', FieldParser.VARIABLE_LENGTH, 30]];
  65484. FieldParser.FOUR_DIGIT_DATA_LENGTH = [
  65485. // Same format as above
  65486. ['7001', 13], ['7002', FieldParser.VARIABLE_LENGTH, 30], ['7003', 10], ['8001', 14], ['8002', FieldParser.VARIABLE_LENGTH, 20], ['8003', FieldParser.VARIABLE_LENGTH, 30], ['8004', FieldParser.VARIABLE_LENGTH, 30], ['8005', 6], ['8006', 18], ['8007', FieldParser.VARIABLE_LENGTH, 30], ['8008', FieldParser.VARIABLE_LENGTH, 12], ['8018', 18], ['8020', FieldParser.VARIABLE_LENGTH, 25], ['8100', 6], ['8101', 10], ['8102', 2], ['8110', FieldParser.VARIABLE_LENGTH, 70], ['8200', FieldParser.VARIABLE_LENGTH, 70]];
  65487. return FieldParser;
  65488. }();
  65489. var _default = FieldParser;
  65490. exports.default = _default;
  65491. /***/ }),
  65492. /* 388 */
  65493. /*!**************************************************************************************************************!*\
  65494. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01AndOtherAIs.js ***!
  65495. \**************************************************************************************************************/
  65496. /*! no static exports found */
  65497. /***/ (function(module, exports, __webpack_require__) {
  65498. "use strict";
  65499. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65500. Object.defineProperty(exports, "__esModule", {
  65501. value: true
  65502. });
  65503. exports.default = void 0;
  65504. var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
  65505. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  65506. var __extends = void 0 && (void 0).__extends || function () {
  65507. var _extendStatics = function extendStatics(d, b) {
  65508. _extendStatics = Object.setPrototypeOf || {
  65509. __proto__: []
  65510. } instanceof Array && function (d, b) {
  65511. d.__proto__ = b;
  65512. } || function (d, b) {
  65513. for (var p in b) {
  65514. if (b.hasOwnProperty(p)) d[p] = b[p];
  65515. }
  65516. };
  65517. return _extendStatics(d, b);
  65518. };
  65519. return function (d, b) {
  65520. _extendStatics(d, b);
  65521. function __() {
  65522. this.constructor = d;
  65523. }
  65524. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65525. };
  65526. }();
  65527. var AI01AndOtherAIs = /** @class */function (_super) {
  65528. __extends(AI01AndOtherAIs, _super);
  65529. // the second one is the encodation method, and the other two are for the variable length
  65530. function AI01AndOtherAIs(information) {
  65531. return _super.call(this, information) || this;
  65532. }
  65533. AI01AndOtherAIs.prototype.parseInformation = function () {
  65534. var buff = new _StringBuilder.default();
  65535. buff.append('(01)');
  65536. var initialGtinPosition = buff.length();
  65537. var firstGtinDigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01AndOtherAIs.HEADER_SIZE, 4);
  65538. buff.append(firstGtinDigit);
  65539. this.encodeCompressedGtinWithoutAI(buff, AI01AndOtherAIs.HEADER_SIZE + 4, initialGtinPosition);
  65540. return this.getGeneralDecoder().decodeAllCodes(buff, AI01AndOtherAIs.HEADER_SIZE + 44);
  65541. };
  65542. AI01AndOtherAIs.HEADER_SIZE = 1 + 1 + 2; // first bit encodes the linkage flag,
  65543. return AI01AndOtherAIs;
  65544. }(_AI01decoder.default);
  65545. var _default = AI01AndOtherAIs;
  65546. exports.default = _default;
  65547. /***/ }),
  65548. /* 389 */
  65549. /*!**********************************************************************************************************!*\
  65550. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01decoder.js ***!
  65551. \**********************************************************************************************************/
  65552. /*! no static exports found */
  65553. /***/ (function(module, exports, __webpack_require__) {
  65554. "use strict";
  65555. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65556. Object.defineProperty(exports, "__esModule", {
  65557. value: true
  65558. });
  65559. exports.default = void 0;
  65560. var _AbstractExpandedDecoder = _interopRequireDefault(__webpack_require__(/*! ./AbstractExpandedDecoder */ 390));
  65561. var __extends = void 0 && (void 0).__extends || function () {
  65562. var _extendStatics = function extendStatics(d, b) {
  65563. _extendStatics = Object.setPrototypeOf || {
  65564. __proto__: []
  65565. } instanceof Array && function (d, b) {
  65566. d.__proto__ = b;
  65567. } || function (d, b) {
  65568. for (var p in b) {
  65569. if (b.hasOwnProperty(p)) d[p] = b[p];
  65570. }
  65571. };
  65572. return _extendStatics(d, b);
  65573. };
  65574. return function (d, b) {
  65575. _extendStatics(d, b);
  65576. function __() {
  65577. this.constructor = d;
  65578. }
  65579. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65580. };
  65581. }();
  65582. var AI01decoder = /** @class */function (_super) {
  65583. __extends(AI01decoder, _super);
  65584. function AI01decoder(information) {
  65585. return _super.call(this, information) || this;
  65586. }
  65587. AI01decoder.prototype.encodeCompressedGtin = function (buf, currentPos) {
  65588. buf.append('(01)');
  65589. var initialPosition = buf.length();
  65590. buf.append('9');
  65591. this.encodeCompressedGtinWithoutAI(buf, currentPos, initialPosition);
  65592. };
  65593. AI01decoder.prototype.encodeCompressedGtinWithoutAI = function (buf, currentPos, initialBufferPosition) {
  65594. for (var i = 0; i < 4; ++i) {
  65595. var currentBlock = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos + 10 * i, 10);
  65596. if (currentBlock / 100 === 0) {
  65597. buf.append('0');
  65598. }
  65599. if (currentBlock / 10 === 0) {
  65600. buf.append('0');
  65601. }
  65602. buf.append(currentBlock);
  65603. }
  65604. AI01decoder.appendCheckDigit(buf, initialBufferPosition);
  65605. };
  65606. AI01decoder.appendCheckDigit = function (buf, currentPos) {
  65607. var checkDigit = 0;
  65608. for (var i = 0; i < 13; i++) {
  65609. // let digit = buf.charAt(i + currentPos) - '0';
  65610. // To be checked
  65611. var digit = buf.charAt(i + currentPos).charCodeAt(0) - '0'.charCodeAt(0);
  65612. checkDigit += (i & 0x01) === 0 ? 3 * digit : digit;
  65613. }
  65614. checkDigit = 10 - checkDigit % 10;
  65615. if (checkDigit === 10) {
  65616. checkDigit = 0;
  65617. }
  65618. buf.append(checkDigit);
  65619. };
  65620. AI01decoder.GTIN_SIZE = 40;
  65621. return AI01decoder;
  65622. }(_AbstractExpandedDecoder.default);
  65623. var _default = AI01decoder;
  65624. exports.default = _default;
  65625. /***/ }),
  65626. /* 390 */
  65627. /*!**********************************************************************************************************************!*\
  65628. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AbstractExpandedDecoder.js ***!
  65629. \**********************************************************************************************************************/
  65630. /*! no static exports found */
  65631. /***/ (function(module, exports, __webpack_require__) {
  65632. "use strict";
  65633. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65634. Object.defineProperty(exports, "__esModule", {
  65635. value: true
  65636. });
  65637. exports.default = void 0;
  65638. var _GeneralAppIdDecoder = _interopRequireDefault(__webpack_require__(/*! ./GeneralAppIdDecoder */ 381));
  65639. var AbstractExpandedDecoder = /** @class */function () {
  65640. function AbstractExpandedDecoder(information) {
  65641. this.information = information;
  65642. this.generalDecoder = new _GeneralAppIdDecoder.default(information);
  65643. }
  65644. AbstractExpandedDecoder.prototype.getInformation = function () {
  65645. return this.information;
  65646. };
  65647. AbstractExpandedDecoder.prototype.getGeneralDecoder = function () {
  65648. return this.generalDecoder;
  65649. };
  65650. return AbstractExpandedDecoder;
  65651. }();
  65652. var _default = AbstractExpandedDecoder;
  65653. exports.default = _default;
  65654. /***/ }),
  65655. /* 391 */
  65656. /*!***********************************************************************************************************!*\
  65657. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AnyAIDecoder.js ***!
  65658. \***********************************************************************************************************/
  65659. /*! no static exports found */
  65660. /***/ (function(module, exports, __webpack_require__) {
  65661. "use strict";
  65662. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65663. Object.defineProperty(exports, "__esModule", {
  65664. value: true
  65665. });
  65666. exports.default = void 0;
  65667. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  65668. var _AbstractExpandedDecoder = _interopRequireDefault(__webpack_require__(/*! ./AbstractExpandedDecoder */ 390));
  65669. var __extends = void 0 && (void 0).__extends || function () {
  65670. var _extendStatics = function extendStatics(d, b) {
  65671. _extendStatics = Object.setPrototypeOf || {
  65672. __proto__: []
  65673. } instanceof Array && function (d, b) {
  65674. d.__proto__ = b;
  65675. } || function (d, b) {
  65676. for (var p in b) {
  65677. if (b.hasOwnProperty(p)) d[p] = b[p];
  65678. }
  65679. };
  65680. return _extendStatics(d, b);
  65681. };
  65682. return function (d, b) {
  65683. _extendStatics(d, b);
  65684. function __() {
  65685. this.constructor = d;
  65686. }
  65687. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65688. };
  65689. }();
  65690. var AnyAIDecoder = /** @class */function (_super) {
  65691. __extends(AnyAIDecoder, _super);
  65692. function AnyAIDecoder(information) {
  65693. return _super.call(this, information) || this;
  65694. }
  65695. AnyAIDecoder.prototype.parseInformation = function () {
  65696. var buf = new _StringBuilder.default();
  65697. return this.getGeneralDecoder().decodeAllCodes(buf, AnyAIDecoder.HEADER_SIZE);
  65698. };
  65699. AnyAIDecoder.HEADER_SIZE = 2 + 1 + 2;
  65700. return AnyAIDecoder;
  65701. }(_AbstractExpandedDecoder.default);
  65702. var _default = AnyAIDecoder;
  65703. exports.default = _default;
  65704. /***/ }),
  65705. /* 392 */
  65706. /*!**************************************************************************************************************!*\
  65707. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI013103decoder.js ***!
  65708. \**************************************************************************************************************/
  65709. /*! no static exports found */
  65710. /***/ (function(module, exports, __webpack_require__) {
  65711. "use strict";
  65712. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65713. Object.defineProperty(exports, "__esModule", {
  65714. value: true
  65715. });
  65716. exports.default = void 0;
  65717. var _AI013x0xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI013x0xDecoder */ 393));
  65718. var __extends = void 0 && (void 0).__extends || function () {
  65719. var _extendStatics = function extendStatics(d, b) {
  65720. _extendStatics = Object.setPrototypeOf || {
  65721. __proto__: []
  65722. } instanceof Array && function (d, b) {
  65723. d.__proto__ = b;
  65724. } || function (d, b) {
  65725. for (var p in b) {
  65726. if (b.hasOwnProperty(p)) d[p] = b[p];
  65727. }
  65728. };
  65729. return _extendStatics(d, b);
  65730. };
  65731. return function (d, b) {
  65732. _extendStatics(d, b);
  65733. function __() {
  65734. this.constructor = d;
  65735. }
  65736. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65737. };
  65738. }();
  65739. var AI013103decoder = /** @class */function (_super) {
  65740. __extends(AI013103decoder, _super);
  65741. function AI013103decoder(information) {
  65742. return _super.call(this, information) || this;
  65743. }
  65744. AI013103decoder.prototype.addWeightCode = function (buf, weight) {
  65745. buf.append('(3103)');
  65746. };
  65747. AI013103decoder.prototype.checkWeight = function (weight) {
  65748. return weight;
  65749. };
  65750. return AI013103decoder;
  65751. }(_AI013x0xDecoder.default);
  65752. var _default = AI013103decoder;
  65753. exports.default = _default;
  65754. /***/ }),
  65755. /* 393 */
  65756. /*!**************************************************************************************************************!*\
  65757. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI013x0xDecoder.js ***!
  65758. \**************************************************************************************************************/
  65759. /*! no static exports found */
  65760. /***/ (function(module, exports, __webpack_require__) {
  65761. "use strict";
  65762. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65763. Object.defineProperty(exports, "__esModule", {
  65764. value: true
  65765. });
  65766. exports.default = void 0;
  65767. var _AI01weightDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01weightDecoder */ 394));
  65768. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  65769. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
  65770. var __extends = void 0 && (void 0).__extends || function () {
  65771. var _extendStatics = function extendStatics(d, b) {
  65772. _extendStatics = Object.setPrototypeOf || {
  65773. __proto__: []
  65774. } instanceof Array && function (d, b) {
  65775. d.__proto__ = b;
  65776. } || function (d, b) {
  65777. for (var p in b) {
  65778. if (b.hasOwnProperty(p)) d[p] = b[p];
  65779. }
  65780. };
  65781. return _extendStatics(d, b);
  65782. };
  65783. return function (d, b) {
  65784. _extendStatics(d, b);
  65785. function __() {
  65786. this.constructor = d;
  65787. }
  65788. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65789. };
  65790. }();
  65791. var AI013x0xDecoder = /** @class */function (_super) {
  65792. __extends(AI013x0xDecoder, _super);
  65793. function AI013x0xDecoder(information) {
  65794. return _super.call(this, information) || this;
  65795. }
  65796. AI013x0xDecoder.prototype.parseInformation = function () {
  65797. if (this.getInformation().getSize() !== AI013x0xDecoder.HEADER_SIZE + _AI01weightDecoder.default.GTIN_SIZE + AI013x0xDecoder.WEIGHT_SIZE) {
  65798. throw new _NotFoundException.default();
  65799. }
  65800. var buf = new _StringBuilder.default();
  65801. this.encodeCompressedGtin(buf, AI013x0xDecoder.HEADER_SIZE);
  65802. this.encodeCompressedWeight(buf, AI013x0xDecoder.HEADER_SIZE + _AI01weightDecoder.default.GTIN_SIZE, AI013x0xDecoder.WEIGHT_SIZE);
  65803. return buf.toString();
  65804. };
  65805. AI013x0xDecoder.HEADER_SIZE = 4 + 1;
  65806. AI013x0xDecoder.WEIGHT_SIZE = 15;
  65807. return AI013x0xDecoder;
  65808. }(_AI01weightDecoder.default);
  65809. var _default = AI013x0xDecoder;
  65810. exports.default = _default;
  65811. /***/ }),
  65812. /* 394 */
  65813. /*!****************************************************************************************************************!*\
  65814. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01weightDecoder.js ***!
  65815. \****************************************************************************************************************/
  65816. /*! no static exports found */
  65817. /***/ (function(module, exports, __webpack_require__) {
  65818. "use strict";
  65819. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65820. Object.defineProperty(exports, "__esModule", {
  65821. value: true
  65822. });
  65823. exports.default = void 0;
  65824. var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
  65825. var __extends = void 0 && (void 0).__extends || function () {
  65826. var _extendStatics = function extendStatics(d, b) {
  65827. _extendStatics = Object.setPrototypeOf || {
  65828. __proto__: []
  65829. } instanceof Array && function (d, b) {
  65830. d.__proto__ = b;
  65831. } || function (d, b) {
  65832. for (var p in b) {
  65833. if (b.hasOwnProperty(p)) d[p] = b[p];
  65834. }
  65835. };
  65836. return _extendStatics(d, b);
  65837. };
  65838. return function (d, b) {
  65839. _extendStatics(d, b);
  65840. function __() {
  65841. this.constructor = d;
  65842. }
  65843. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65844. };
  65845. }();
  65846. var AI01weightDecoder = /** @class */function (_super) {
  65847. __extends(AI01weightDecoder, _super);
  65848. function AI01weightDecoder(information) {
  65849. return _super.call(this, information) || this;
  65850. }
  65851. AI01weightDecoder.prototype.encodeCompressedWeight = function (buf, currentPos, weightSize) {
  65852. var originalWeightNumeric = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos, weightSize);
  65853. this.addWeightCode(buf, originalWeightNumeric);
  65854. var weightNumeric = this.checkWeight(originalWeightNumeric);
  65855. var currentDivisor = 100000;
  65856. for (var i = 0; i < 5; ++i) {
  65857. if (weightNumeric / currentDivisor === 0) {
  65858. buf.append('0');
  65859. }
  65860. currentDivisor /= 10;
  65861. }
  65862. buf.append(weightNumeric);
  65863. };
  65864. return AI01weightDecoder;
  65865. }(_AI01decoder.default);
  65866. var _default = AI01weightDecoder;
  65867. exports.default = _default;
  65868. /***/ }),
  65869. /* 395 */
  65870. /*!**************************************************************************************************************!*\
  65871. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01320xDecoder.js ***!
  65872. \**************************************************************************************************************/
  65873. /*! no static exports found */
  65874. /***/ (function(module, exports, __webpack_require__) {
  65875. "use strict";
  65876. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65877. Object.defineProperty(exports, "__esModule", {
  65878. value: true
  65879. });
  65880. exports.default = void 0;
  65881. var _AI013x0xDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI013x0xDecoder */ 393));
  65882. var __extends = void 0 && (void 0).__extends || function () {
  65883. var _extendStatics = function extendStatics(d, b) {
  65884. _extendStatics = Object.setPrototypeOf || {
  65885. __proto__: []
  65886. } instanceof Array && function (d, b) {
  65887. d.__proto__ = b;
  65888. } || function (d, b) {
  65889. for (var p in b) {
  65890. if (b.hasOwnProperty(p)) d[p] = b[p];
  65891. }
  65892. };
  65893. return _extendStatics(d, b);
  65894. };
  65895. return function (d, b) {
  65896. _extendStatics(d, b);
  65897. function __() {
  65898. this.constructor = d;
  65899. }
  65900. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65901. };
  65902. }();
  65903. var AI01320xDecoder = /** @class */function (_super) {
  65904. __extends(AI01320xDecoder, _super);
  65905. function AI01320xDecoder(information) {
  65906. return _super.call(this, information) || this;
  65907. }
  65908. AI01320xDecoder.prototype.addWeightCode = function (buf, weight) {
  65909. if (weight < 10000) {
  65910. buf.append('(3202)');
  65911. } else {
  65912. buf.append('(3203)');
  65913. }
  65914. };
  65915. AI01320xDecoder.prototype.checkWeight = function (weight) {
  65916. if (weight < 10000) {
  65917. return weight;
  65918. }
  65919. return weight - 10000;
  65920. };
  65921. return AI01320xDecoder;
  65922. }(_AI013x0xDecoder.default);
  65923. var _default = AI01320xDecoder;
  65924. exports.default = _default;
  65925. /***/ }),
  65926. /* 396 */
  65927. /*!**************************************************************************************************************!*\
  65928. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01392xDecoder.js ***!
  65929. \**************************************************************************************************************/
  65930. /*! no static exports found */
  65931. /***/ (function(module, exports, __webpack_require__) {
  65932. "use strict";
  65933. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65934. Object.defineProperty(exports, "__esModule", {
  65935. value: true
  65936. });
  65937. exports.default = void 0;
  65938. var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
  65939. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
  65940. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  65941. var __extends = void 0 && (void 0).__extends || function () {
  65942. var _extendStatics = function extendStatics(d, b) {
  65943. _extendStatics = Object.setPrototypeOf || {
  65944. __proto__: []
  65945. } instanceof Array && function (d, b) {
  65946. d.__proto__ = b;
  65947. } || function (d, b) {
  65948. for (var p in b) {
  65949. if (b.hasOwnProperty(p)) d[p] = b[p];
  65950. }
  65951. };
  65952. return _extendStatics(d, b);
  65953. };
  65954. return function (d, b) {
  65955. _extendStatics(d, b);
  65956. function __() {
  65957. this.constructor = d;
  65958. }
  65959. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  65960. };
  65961. }();
  65962. var AI01392xDecoder = /** @class */function (_super) {
  65963. __extends(AI01392xDecoder, _super);
  65964. function AI01392xDecoder(information) {
  65965. return _super.call(this, information) || this;
  65966. }
  65967. AI01392xDecoder.prototype.parseInformation = function () {
  65968. if (this.getInformation().getSize() < AI01392xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE) {
  65969. throw new _NotFoundException.default();
  65970. }
  65971. var buf = new _StringBuilder.default();
  65972. this.encodeCompressedGtin(buf, AI01392xDecoder.HEADER_SIZE);
  65973. var lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01392xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE, AI01392xDecoder.LAST_DIGIT_SIZE);
  65974. buf.append('(392');
  65975. buf.append(lastAIdigit);
  65976. buf.append(')');
  65977. var decodedInformation = this.getGeneralDecoder().decodeGeneralPurposeField(AI01392xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE + AI01392xDecoder.LAST_DIGIT_SIZE, null);
  65978. buf.append(decodedInformation.getNewString());
  65979. return buf.toString();
  65980. };
  65981. AI01392xDecoder.HEADER_SIZE = 5 + 1 + 2;
  65982. AI01392xDecoder.LAST_DIGIT_SIZE = 2;
  65983. return AI01392xDecoder;
  65984. }(_AI01decoder.default);
  65985. var _default = AI01392xDecoder;
  65986. exports.default = _default;
  65987. /***/ }),
  65988. /* 397 */
  65989. /*!**************************************************************************************************************!*\
  65990. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI01393xDecoder.js ***!
  65991. \**************************************************************************************************************/
  65992. /*! no static exports found */
  65993. /***/ (function(module, exports, __webpack_require__) {
  65994. "use strict";
  65995. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  65996. Object.defineProperty(exports, "__esModule", {
  65997. value: true
  65998. });
  65999. exports.default = void 0;
  66000. var _AI01decoder = _interopRequireDefault(__webpack_require__(/*! ./AI01decoder */ 389));
  66001. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
  66002. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  66003. var __extends = void 0 && (void 0).__extends || function () {
  66004. var _extendStatics = function extendStatics(d, b) {
  66005. _extendStatics = Object.setPrototypeOf || {
  66006. __proto__: []
  66007. } instanceof Array && function (d, b) {
  66008. d.__proto__ = b;
  66009. } || function (d, b) {
  66010. for (var p in b) {
  66011. if (b.hasOwnProperty(p)) d[p] = b[p];
  66012. }
  66013. };
  66014. return _extendStatics(d, b);
  66015. };
  66016. return function (d, b) {
  66017. _extendStatics(d, b);
  66018. function __() {
  66019. this.constructor = d;
  66020. }
  66021. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  66022. };
  66023. }();
  66024. var AI01393xDecoder = /** @class */function (_super) {
  66025. __extends(AI01393xDecoder, _super);
  66026. function AI01393xDecoder(information) {
  66027. return _super.call(this, information) || this;
  66028. }
  66029. AI01393xDecoder.prototype.parseInformation = function () {
  66030. if (this.getInformation().getSize() < AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE) {
  66031. throw new _NotFoundException.default();
  66032. }
  66033. var buf = new _StringBuilder.default();
  66034. this.encodeCompressedGtin(buf, AI01393xDecoder.HEADER_SIZE);
  66035. var lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE, AI01393xDecoder.LAST_DIGIT_SIZE);
  66036. buf.append('(393');
  66037. buf.append(lastAIdigit);
  66038. buf.append(')');
  66039. var firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE + AI01393xDecoder.LAST_DIGIT_SIZE, AI01393xDecoder.FIRST_THREE_DIGITS_SIZE);
  66040. if (firstThreeDigits / 100 === 0) {
  66041. buf.append('0');
  66042. }
  66043. if (firstThreeDigits / 10 === 0) {
  66044. buf.append('0');
  66045. }
  66046. buf.append(firstThreeDigits);
  66047. var generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField(AI01393xDecoder.HEADER_SIZE + _AI01decoder.default.GTIN_SIZE + AI01393xDecoder.LAST_DIGIT_SIZE + AI01393xDecoder.FIRST_THREE_DIGITS_SIZE, null);
  66048. buf.append(generalInformation.getNewString());
  66049. return buf.toString();
  66050. };
  66051. AI01393xDecoder.HEADER_SIZE = 5 + 1 + 2;
  66052. AI01393xDecoder.LAST_DIGIT_SIZE = 2;
  66053. AI01393xDecoder.FIRST_THREE_DIGITS_SIZE = 10;
  66054. return AI01393xDecoder;
  66055. }(_AI01decoder.default);
  66056. var _default = AI01393xDecoder;
  66057. exports.default = _default;
  66058. /***/ }),
  66059. /* 398 */
  66060. /*!****************************************************************************************************************!*\
  66061. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/decoders/AI013x0x1xDecoder.js ***!
  66062. \****************************************************************************************************************/
  66063. /*! no static exports found */
  66064. /***/ (function(module, exports, __webpack_require__) {
  66065. "use strict";
  66066. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  66067. Object.defineProperty(exports, "__esModule", {
  66068. value: true
  66069. });
  66070. exports.default = void 0;
  66071. var _AI01weightDecoder = _interopRequireDefault(__webpack_require__(/*! ./AI01weightDecoder */ 394));
  66072. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../../../NotFoundException */ 327));
  66073. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../../util/StringBuilder */ 320));
  66074. var __extends = void 0 && (void 0).__extends || function () {
  66075. var _extendStatics = function extendStatics(d, b) {
  66076. _extendStatics = Object.setPrototypeOf || {
  66077. __proto__: []
  66078. } instanceof Array && function (d, b) {
  66079. d.__proto__ = b;
  66080. } || function (d, b) {
  66081. for (var p in b) {
  66082. if (b.hasOwnProperty(p)) d[p] = b[p];
  66083. }
  66084. };
  66085. return _extendStatics(d, b);
  66086. };
  66087. return function (d, b) {
  66088. _extendStatics(d, b);
  66089. function __() {
  66090. this.constructor = d;
  66091. }
  66092. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  66093. };
  66094. }();
  66095. var AI013x0x1xDecoder = /** @class */function (_super) {
  66096. __extends(AI013x0x1xDecoder, _super);
  66097. function AI013x0x1xDecoder(information, firstAIdigits, dateCode) {
  66098. var _this = _super.call(this, information) || this;
  66099. _this.dateCode = dateCode;
  66100. _this.firstAIdigits = firstAIdigits;
  66101. return _this;
  66102. }
  66103. AI013x0x1xDecoder.prototype.parseInformation = function () {
  66104. if (this.getInformation().getSize() !== AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE + AI013x0x1xDecoder.WEIGHT_SIZE + AI013x0x1xDecoder.DATE_SIZE) {
  66105. throw new _NotFoundException.default();
  66106. }
  66107. var buf = new _StringBuilder.default();
  66108. this.encodeCompressedGtin(buf, AI013x0x1xDecoder.HEADER_SIZE);
  66109. this.encodeCompressedWeight(buf, AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE, AI013x0x1xDecoder.WEIGHT_SIZE);
  66110. this.encodeCompressedDate(buf, AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE + AI013x0x1xDecoder.WEIGHT_SIZE);
  66111. return buf.toString();
  66112. };
  66113. AI013x0x1xDecoder.prototype.encodeCompressedDate = function (buf, currentPos) {
  66114. var numericDate = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos, AI013x0x1xDecoder.DATE_SIZE);
  66115. if (numericDate === 38400) {
  66116. return;
  66117. }
  66118. buf.append('(');
  66119. buf.append(this.dateCode);
  66120. buf.append(')');
  66121. var day = numericDate % 32;
  66122. numericDate /= 32;
  66123. var month = numericDate % 12 + 1;
  66124. numericDate /= 12;
  66125. var year = numericDate;
  66126. if (year / 10 === 0) {
  66127. buf.append('0');
  66128. }
  66129. buf.append(year);
  66130. if (month / 10 === 0) {
  66131. buf.append('0');
  66132. }
  66133. buf.append(month);
  66134. if (day / 10 === 0) {
  66135. buf.append('0');
  66136. }
  66137. buf.append(day);
  66138. };
  66139. AI013x0x1xDecoder.prototype.addWeightCode = function (buf, weight) {
  66140. buf.append('(');
  66141. buf.append(this.firstAIdigits);
  66142. buf.append(weight / 100000);
  66143. buf.append(')');
  66144. };
  66145. AI013x0x1xDecoder.prototype.checkWeight = function (weight) {
  66146. return weight % 100000;
  66147. };
  66148. AI013x0x1xDecoder.HEADER_SIZE = 7 + 1;
  66149. AI013x0x1xDecoder.WEIGHT_SIZE = 20;
  66150. AI013x0x1xDecoder.DATE_SIZE = 16;
  66151. return AI013x0x1xDecoder;
  66152. }(_AI01weightDecoder.default);
  66153. var _default = AI013x0x1xDecoder;
  66154. exports.default = _default;
  66155. /***/ }),
  66156. /* 399 */
  66157. /*!**************************************************************************************************!*\
  66158. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/ExpandedPair.js ***!
  66159. \**************************************************************************************************/
  66160. /*! no static exports found */
  66161. /***/ (function(module, exports, __webpack_require__) {
  66162. "use strict";
  66163. Object.defineProperty(exports, "__esModule", {
  66164. value: true
  66165. });
  66166. exports.default = void 0;
  66167. var ExpandedPair = /** @class */function () {
  66168. function ExpandedPair(leftChar, rightChar, finderPatter, mayBeLast) {
  66169. this.leftchar = leftChar;
  66170. this.rightchar = rightChar;
  66171. this.finderpattern = finderPatter;
  66172. this.maybeLast = mayBeLast;
  66173. }
  66174. ExpandedPair.prototype.mayBeLast = function () {
  66175. return this.maybeLast;
  66176. };
  66177. ExpandedPair.prototype.getLeftChar = function () {
  66178. return this.leftchar;
  66179. };
  66180. ExpandedPair.prototype.getRightChar = function () {
  66181. return this.rightchar;
  66182. };
  66183. ExpandedPair.prototype.getFinderPattern = function () {
  66184. return this.finderpattern;
  66185. };
  66186. ExpandedPair.prototype.mustBeLast = function () {
  66187. return this.rightchar == null;
  66188. };
  66189. ExpandedPair.prototype.toString = function () {
  66190. return '[ ' + this.leftchar + ', ' + this.rightchar + ' : ' + (this.finderpattern == null ? 'null' : this.finderpattern.getValue()) + ' ]';
  66191. };
  66192. ExpandedPair.equals = function (o1, o2) {
  66193. if (!(o1 instanceof ExpandedPair)) {
  66194. return false;
  66195. }
  66196. return ExpandedPair.equalsOrNull(o1.leftchar, o2.leftchar) && ExpandedPair.equalsOrNull(o1.rightchar, o2.rightchar) && ExpandedPair.equalsOrNull(o1.finderpattern, o2.finderpattern);
  66197. };
  66198. ExpandedPair.equalsOrNull = function (o1, o2) {
  66199. return o1 === null ? o2 === null : ExpandedPair.equals(o1, o2);
  66200. };
  66201. ExpandedPair.prototype.hashCode = function () {
  66202. // return ExpandedPair.hashNotNull(leftChar) ^ hashNotNull(rightChar) ^ hashNotNull(finderPattern);
  66203. var value = this.leftchar.getValue() ^ this.rightchar.getValue() ^ this.finderpattern.getValue();
  66204. return value;
  66205. };
  66206. return ExpandedPair;
  66207. }();
  66208. var _default = ExpandedPair;
  66209. exports.default = _default;
  66210. /***/ }),
  66211. /* 400 */
  66212. /*!*************************************************************************************************!*\
  66213. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/expanded/ExpandedRow.js ***!
  66214. \*************************************************************************************************/
  66215. /*! no static exports found */
  66216. /***/ (function(module, exports, __webpack_require__) {
  66217. "use strict";
  66218. Object.defineProperty(exports, "__esModule", {
  66219. value: true
  66220. });
  66221. exports.default = void 0;
  66222. var ExpandedRow = /** @class */function () {
  66223. function ExpandedRow(pairs, rowNumber, wasReversed) {
  66224. this.pairs = pairs;
  66225. this.rowNumber = rowNumber;
  66226. this.wasReversed = wasReversed;
  66227. }
  66228. ExpandedRow.prototype.getPairs = function () {
  66229. return this.pairs;
  66230. };
  66231. ExpandedRow.prototype.getRowNumber = function () {
  66232. return this.rowNumber;
  66233. };
  66234. ExpandedRow.prototype.isReversed = function () {
  66235. return this.wasReversed;
  66236. };
  66237. // check implementation
  66238. ExpandedRow.prototype.isEquivalent = function (otherPairs) {
  66239. return this.checkEqualitity(this, otherPairs);
  66240. };
  66241. // @Override
  66242. ExpandedRow.prototype.toString = function () {
  66243. return '{ ' + this.pairs + ' }';
  66244. };
  66245. /**
  66246. * Two rows are equal if they contain the same pairs in the same order.
  66247. */
  66248. // @Override
  66249. // check implementation
  66250. ExpandedRow.prototype.equals = function (o1, o2) {
  66251. if (!(o1 instanceof ExpandedRow)) {
  66252. return false;
  66253. }
  66254. return this.checkEqualitity(o1, o2) && o1.wasReversed === o2.wasReversed;
  66255. };
  66256. ExpandedRow.prototype.checkEqualitity = function (pair1, pair2) {
  66257. if (!pair1 || !pair2) return;
  66258. var result;
  66259. pair1.forEach(function (e1, i) {
  66260. pair2.forEach(function (e2) {
  66261. if (e1.getLeftChar().getValue() === e2.getLeftChar().getValue() && e1.getRightChar().getValue() === e2.getRightChar().getValue() && e1.getFinderPatter().getValue() === e2.getFinderPatter().getValue()) {
  66262. result = true;
  66263. }
  66264. });
  66265. });
  66266. return result;
  66267. };
  66268. return ExpandedRow;
  66269. }();
  66270. var _default = ExpandedRow;
  66271. exports.default = _default;
  66272. /***/ }),
  66273. /* 401 */
  66274. /*!****************************************************************************************!*\
  66275. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/RSS14Reader.js ***!
  66276. \****************************************************************************************/
  66277. /*! no static exports found */
  66278. /***/ (function(module, exports, __webpack_require__) {
  66279. "use strict";
  66280. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  66281. Object.defineProperty(exports, "__esModule", {
  66282. value: true
  66283. });
  66284. exports.default = void 0;
  66285. var _AbstractRSSReader = _interopRequireDefault(__webpack_require__(/*! ./AbstractRSSReader */ 375));
  66286. var _Pair = _interopRequireDefault(__webpack_require__(/*! ./Pair */ 402));
  66287. var _Result = _interopRequireDefault(__webpack_require__(/*! ../../Result */ 333));
  66288. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../DecodeHintType */ 322));
  66289. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  66290. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  66291. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../../BarcodeFormat */ 334));
  66292. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  66293. var _FinderPattern = _interopRequireDefault(__webpack_require__(/*! ./FinderPattern */ 377));
  66294. var _DataCharacter = _interopRequireDefault(__webpack_require__(/*! ./DataCharacter */ 376));
  66295. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
  66296. var _RSSUtils = _interopRequireDefault(__webpack_require__(/*! ./RSSUtils */ 378));
  66297. var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
  66298. var _OneDReader = _interopRequireDefault(__webpack_require__(/*! ../OneDReader */ 359));
  66299. var __extends = void 0 && (void 0).__extends || function () {
  66300. var _extendStatics = function extendStatics(d, b) {
  66301. _extendStatics = Object.setPrototypeOf || {
  66302. __proto__: []
  66303. } instanceof Array && function (d, b) {
  66304. d.__proto__ = b;
  66305. } || function (d, b) {
  66306. for (var p in b) {
  66307. if (b.hasOwnProperty(p)) d[p] = b[p];
  66308. }
  66309. };
  66310. return _extendStatics(d, b);
  66311. };
  66312. return function (d, b) {
  66313. _extendStatics(d, b);
  66314. function __() {
  66315. this.constructor = d;
  66316. }
  66317. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  66318. };
  66319. }();
  66320. var __values = void 0 && (void 0).__values || function (o) {
  66321. var s = typeof Symbol === "function" && Symbol.iterator,
  66322. m = s && o[s],
  66323. i = 0;
  66324. if (m) return m.call(o);
  66325. if (o && typeof o.length === "number") return {
  66326. next: function next() {
  66327. if (o && i >= o.length) o = void 0;
  66328. return {
  66329. value: o && o[i++],
  66330. done: !o
  66331. };
  66332. }
  66333. };
  66334. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  66335. };
  66336. var RSS14Reader = /** @class */function (_super) {
  66337. __extends(RSS14Reader, _super);
  66338. function RSS14Reader() {
  66339. var _this = _super !== null && _super.apply(this, arguments) || this;
  66340. _this.possibleLeftPairs = [];
  66341. _this.possibleRightPairs = [];
  66342. return _this;
  66343. }
  66344. RSS14Reader.prototype.decodeRow = function (rowNumber, row, hints) {
  66345. var e_1, _a, e_2, _b;
  66346. var leftPair = this.decodePair(row, false, rowNumber, hints);
  66347. RSS14Reader.addOrTally(this.possibleLeftPairs, leftPair);
  66348. row.reverse();
  66349. var rightPair = this.decodePair(row, true, rowNumber, hints);
  66350. RSS14Reader.addOrTally(this.possibleRightPairs, rightPair);
  66351. row.reverse();
  66352. try {
  66353. for (var _c = __values(this.possibleLeftPairs), _d = _c.next(); !_d.done; _d = _c.next()) {
  66354. var left = _d.value;
  66355. if (left.getCount() > 1) {
  66356. try {
  66357. for (var _e = (e_2 = void 0, __values(this.possibleRightPairs)), _f = _e.next(); !_f.done; _f = _e.next()) {
  66358. var right = _f.value;
  66359. if (right.getCount() > 1 && RSS14Reader.checkChecksum(left, right)) {
  66360. return RSS14Reader.constructResult(left, right);
  66361. }
  66362. }
  66363. } catch (e_2_1) {
  66364. e_2 = {
  66365. error: e_2_1
  66366. };
  66367. } finally {
  66368. try {
  66369. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  66370. } finally {
  66371. if (e_2) throw e_2.error;
  66372. }
  66373. }
  66374. }
  66375. }
  66376. } catch (e_1_1) {
  66377. e_1 = {
  66378. error: e_1_1
  66379. };
  66380. } finally {
  66381. try {
  66382. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  66383. } finally {
  66384. if (e_1) throw e_1.error;
  66385. }
  66386. }
  66387. throw new _NotFoundException.default();
  66388. };
  66389. RSS14Reader.addOrTally = function (possiblePairs, pair) {
  66390. var e_3, _a;
  66391. if (pair == null) {
  66392. return;
  66393. }
  66394. var found = false;
  66395. try {
  66396. for (var possiblePairs_1 = __values(possiblePairs), possiblePairs_1_1 = possiblePairs_1.next(); !possiblePairs_1_1.done; possiblePairs_1_1 = possiblePairs_1.next()) {
  66397. var other = possiblePairs_1_1.value;
  66398. if (other.getValue() === pair.getValue()) {
  66399. other.incrementCount();
  66400. found = true;
  66401. break;
  66402. }
  66403. }
  66404. } catch (e_3_1) {
  66405. e_3 = {
  66406. error: e_3_1
  66407. };
  66408. } finally {
  66409. try {
  66410. if (possiblePairs_1_1 && !possiblePairs_1_1.done && (_a = possiblePairs_1.return)) _a.call(possiblePairs_1);
  66411. } finally {
  66412. if (e_3) throw e_3.error;
  66413. }
  66414. }
  66415. if (!found) {
  66416. possiblePairs.push(pair);
  66417. }
  66418. };
  66419. RSS14Reader.prototype.reset = function () {
  66420. this.possibleLeftPairs.length = 0;
  66421. this.possibleRightPairs.length = 0;
  66422. };
  66423. RSS14Reader.constructResult = function (leftPair, rightPair) {
  66424. var symbolValue = 4537077 * leftPair.getValue() + rightPair.getValue();
  66425. var text = new String(symbolValue).toString();
  66426. var buffer = new _StringBuilder.default();
  66427. for (var i = 13 - text.length; i > 0; i--) {
  66428. buffer.append('0');
  66429. }
  66430. buffer.append(text);
  66431. var checkDigit = 0;
  66432. for (var i = 0; i < 13; i++) {
  66433. var digit = buffer.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
  66434. checkDigit += (i & 0x01) === 0 ? 3 * digit : digit;
  66435. }
  66436. checkDigit = 10 - checkDigit % 10;
  66437. if (checkDigit === 10) {
  66438. checkDigit = 0;
  66439. }
  66440. buffer.append(checkDigit.toString());
  66441. var leftPoints = leftPair.getFinderPattern().getResultPoints();
  66442. var rightPoints = rightPair.getFinderPattern().getResultPoints();
  66443. return new _Result.default(buffer.toString(), null, 0, [leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1]], _BarcodeFormat.default.RSS_14, new Date().getTime());
  66444. };
  66445. RSS14Reader.checkChecksum = function (leftPair, rightPair) {
  66446. var checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksumPortion()) % 79;
  66447. var targetCheckValue = 9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern().getValue();
  66448. if (targetCheckValue > 72) {
  66449. targetCheckValue--;
  66450. }
  66451. if (targetCheckValue > 8) {
  66452. targetCheckValue--;
  66453. }
  66454. return checkValue === targetCheckValue;
  66455. };
  66456. RSS14Reader.prototype.decodePair = function (row, right, rowNumber, hints) {
  66457. try {
  66458. var startEnd = this.findFinderPattern(row, right);
  66459. var pattern = this.parseFoundFinderPattern(row, rowNumber, right, startEnd);
  66460. var resultPointCallback = hints == null ? null : hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
  66461. if (resultPointCallback != null) {
  66462. var center = (startEnd[0] + startEnd[1]) / 2.0;
  66463. if (right) {
  66464. // row is actually reversed
  66465. center = row.getSize() - 1 - center;
  66466. }
  66467. resultPointCallback.foundPossibleResultPoint(new _ResultPoint.default(center, rowNumber));
  66468. }
  66469. var outside = this.decodeDataCharacter(row, pattern, true);
  66470. var inside = this.decodeDataCharacter(row, pattern, false);
  66471. return new _Pair.default(1597 * outside.getValue() + inside.getValue(), outside.getChecksumPortion() + 4 * inside.getChecksumPortion(), pattern);
  66472. } catch (err) {
  66473. return null;
  66474. }
  66475. };
  66476. RSS14Reader.prototype.decodeDataCharacter = function (row, pattern, outsideChar) {
  66477. var counters = this.getDataCharacterCounters();
  66478. for (var x = 0; x < counters.length; x++) {
  66479. counters[x] = 0;
  66480. }
  66481. if (outsideChar) {
  66482. _OneDReader.default.recordPatternInReverse(row, pattern.getStartEnd()[0], counters);
  66483. } else {
  66484. _OneDReader.default.recordPattern(row, pattern.getStartEnd()[1] + 1, counters);
  66485. // reverse it
  66486. for (var i = 0, j = counters.length - 1; i < j; i++, j--) {
  66487. var temp = counters[i];
  66488. counters[i] = counters[j];
  66489. counters[j] = temp;
  66490. }
  66491. }
  66492. var numModules = outsideChar ? 16 : 15;
  66493. var elementWidth = _MathUtils.default.sum(new Int32Array(counters)) / numModules;
  66494. var oddCounts = this.getOddCounts();
  66495. var evenCounts = this.getEvenCounts();
  66496. var oddRoundingErrors = this.getOddRoundingErrors();
  66497. var evenRoundingErrors = this.getEvenRoundingErrors();
  66498. for (var i = 0; i < counters.length; i++) {
  66499. var value = counters[i] / elementWidth;
  66500. var count = Math.floor(value + 0.5);
  66501. if (count < 1) {
  66502. count = 1;
  66503. } else if (count > 8) {
  66504. count = 8;
  66505. }
  66506. var offset = Math.floor(i / 2);
  66507. if ((i & 0x01) === 0) {
  66508. oddCounts[offset] = count;
  66509. oddRoundingErrors[offset] = value - count;
  66510. } else {
  66511. evenCounts[offset] = count;
  66512. evenRoundingErrors[offset] = value - count;
  66513. }
  66514. }
  66515. this.adjustOddEvenCounts(outsideChar, numModules);
  66516. var oddSum = 0;
  66517. var oddChecksumPortion = 0;
  66518. for (var i = oddCounts.length - 1; i >= 0; i--) {
  66519. oddChecksumPortion *= 9;
  66520. oddChecksumPortion += oddCounts[i];
  66521. oddSum += oddCounts[i];
  66522. }
  66523. var evenChecksumPortion = 0;
  66524. var evenSum = 0;
  66525. for (var i = evenCounts.length - 1; i >= 0; i--) {
  66526. evenChecksumPortion *= 9;
  66527. evenChecksumPortion += evenCounts[i];
  66528. evenSum += evenCounts[i];
  66529. }
  66530. var checksumPortion = oddChecksumPortion + 3 * evenChecksumPortion;
  66531. if (outsideChar) {
  66532. if ((oddSum & 0x01) !== 0 || oddSum > 12 || oddSum < 4) {
  66533. throw new _NotFoundException.default();
  66534. }
  66535. var group = (12 - oddSum) / 2;
  66536. var oddWidest = RSS14Reader.OUTSIDE_ODD_WIDEST[group];
  66537. var evenWidest = 9 - oddWidest;
  66538. var vOdd = _RSSUtils.default.getRSSvalue(oddCounts, oddWidest, false);
  66539. var vEven = _RSSUtils.default.getRSSvalue(evenCounts, evenWidest, true);
  66540. var tEven = RSS14Reader.OUTSIDE_EVEN_TOTAL_SUBSET[group];
  66541. var gSum = RSS14Reader.OUTSIDE_GSUM[group];
  66542. return new _DataCharacter.default(vOdd * tEven + vEven + gSum, checksumPortion);
  66543. } else {
  66544. if ((evenSum & 0x01) !== 0 || evenSum > 10 || evenSum < 4) {
  66545. throw new _NotFoundException.default();
  66546. }
  66547. var group = (10 - evenSum) / 2;
  66548. var oddWidest = RSS14Reader.INSIDE_ODD_WIDEST[group];
  66549. var evenWidest = 9 - oddWidest;
  66550. var vOdd = _RSSUtils.default.getRSSvalue(oddCounts, oddWidest, true);
  66551. var vEven = _RSSUtils.default.getRSSvalue(evenCounts, evenWidest, false);
  66552. var tOdd = RSS14Reader.INSIDE_ODD_TOTAL_SUBSET[group];
  66553. var gSum = RSS14Reader.INSIDE_GSUM[group];
  66554. return new _DataCharacter.default(vEven * tOdd + vOdd + gSum, checksumPortion);
  66555. }
  66556. };
  66557. RSS14Reader.prototype.findFinderPattern = function (row, rightFinderPattern) {
  66558. var counters = this.getDecodeFinderCounters();
  66559. counters[0] = 0;
  66560. counters[1] = 0;
  66561. counters[2] = 0;
  66562. counters[3] = 0;
  66563. var width = row.getSize();
  66564. var isWhite = false;
  66565. var rowOffset = 0;
  66566. while (rowOffset < width) {
  66567. isWhite = !row.get(rowOffset);
  66568. if (rightFinderPattern === isWhite) {
  66569. // Will encounter white first when searching for right finder pattern
  66570. break;
  66571. }
  66572. rowOffset++;
  66573. }
  66574. var counterPosition = 0;
  66575. var patternStart = rowOffset;
  66576. for (var x = rowOffset; x < width; x++) {
  66577. if (row.get(x) !== isWhite) {
  66578. counters[counterPosition]++;
  66579. } else {
  66580. if (counterPosition === 3) {
  66581. if (_AbstractRSSReader.default.isFinderPattern(counters)) {
  66582. return [patternStart, x];
  66583. }
  66584. patternStart += counters[0] + counters[1];
  66585. counters[0] = counters[2];
  66586. counters[1] = counters[3];
  66587. counters[2] = 0;
  66588. counters[3] = 0;
  66589. counterPosition--;
  66590. } else {
  66591. counterPosition++;
  66592. }
  66593. counters[counterPosition] = 1;
  66594. isWhite = !isWhite;
  66595. }
  66596. }
  66597. throw new _NotFoundException.default();
  66598. };
  66599. RSS14Reader.prototype.parseFoundFinderPattern = function (row, rowNumber, right, startEnd) {
  66600. // Actually we found elements 2-5
  66601. var firstIsBlack = row.get(startEnd[0]);
  66602. var firstElementStart = startEnd[0] - 1;
  66603. // Locate element 1
  66604. while (firstElementStart >= 0 && firstIsBlack !== row.get(firstElementStart)) {
  66605. firstElementStart--;
  66606. }
  66607. firstElementStart++;
  66608. var firstCounter = startEnd[0] - firstElementStart;
  66609. // Make 'counters' hold 1-4
  66610. var counters = this.getDecodeFinderCounters();
  66611. var copy = new Int32Array(counters.length);
  66612. _System.default.arraycopy(counters, 0, copy, 1, counters.length - 1);
  66613. copy[0] = firstCounter;
  66614. var value = this.parseFinderValue(copy, RSS14Reader.FINDER_PATTERNS);
  66615. var start = firstElementStart;
  66616. var end = startEnd[1];
  66617. if (right) {
  66618. // row is actually reversed
  66619. start = row.getSize() - 1 - start;
  66620. end = row.getSize() - 1 - end;
  66621. }
  66622. return new _FinderPattern.default(value, [firstElementStart, startEnd[1]], start, end, rowNumber);
  66623. };
  66624. RSS14Reader.prototype.adjustOddEvenCounts = function (outsideChar, numModules) {
  66625. var oddSum = _MathUtils.default.sum(new Int32Array(this.getOddCounts()));
  66626. var evenSum = _MathUtils.default.sum(new Int32Array(this.getEvenCounts()));
  66627. var incrementOdd = false;
  66628. var decrementOdd = false;
  66629. var incrementEven = false;
  66630. var decrementEven = false;
  66631. if (outsideChar) {
  66632. if (oddSum > 12) {
  66633. decrementOdd = true;
  66634. } else if (oddSum < 4) {
  66635. incrementOdd = true;
  66636. }
  66637. if (evenSum > 12) {
  66638. decrementEven = true;
  66639. } else if (evenSum < 4) {
  66640. incrementEven = true;
  66641. }
  66642. } else {
  66643. if (oddSum > 11) {
  66644. decrementOdd = true;
  66645. } else if (oddSum < 5) {
  66646. incrementOdd = true;
  66647. }
  66648. if (evenSum > 10) {
  66649. decrementEven = true;
  66650. } else if (evenSum < 4) {
  66651. incrementEven = true;
  66652. }
  66653. }
  66654. var mismatch = oddSum + evenSum - numModules;
  66655. var oddParityBad = (oddSum & 0x01) === (outsideChar ? 1 : 0);
  66656. var evenParityBad = (evenSum & 0x01) === 1;
  66657. if (mismatch === 1) {
  66658. if (oddParityBad) {
  66659. if (evenParityBad) {
  66660. throw new _NotFoundException.default();
  66661. }
  66662. decrementOdd = true;
  66663. } else {
  66664. if (!evenParityBad) {
  66665. throw new _NotFoundException.default();
  66666. }
  66667. decrementEven = true;
  66668. }
  66669. } else if (mismatch === -1) {
  66670. if (oddParityBad) {
  66671. if (evenParityBad) {
  66672. throw new _NotFoundException.default();
  66673. }
  66674. incrementOdd = true;
  66675. } else {
  66676. if (!evenParityBad) {
  66677. throw new _NotFoundException.default();
  66678. }
  66679. incrementEven = true;
  66680. }
  66681. } else if (mismatch === 0) {
  66682. if (oddParityBad) {
  66683. if (!evenParityBad) {
  66684. throw new _NotFoundException.default();
  66685. }
  66686. // Both bad
  66687. if (oddSum < evenSum) {
  66688. incrementOdd = true;
  66689. decrementEven = true;
  66690. } else {
  66691. decrementOdd = true;
  66692. incrementEven = true;
  66693. }
  66694. } else {
  66695. if (evenParityBad) {
  66696. throw new _NotFoundException.default();
  66697. }
  66698. // Nothing to do!
  66699. }
  66700. } else {
  66701. throw new _NotFoundException.default();
  66702. }
  66703. if (incrementOdd) {
  66704. if (decrementOdd) {
  66705. throw new _NotFoundException.default();
  66706. }
  66707. _AbstractRSSReader.default.increment(this.getOddCounts(), this.getOddRoundingErrors());
  66708. }
  66709. if (decrementOdd) {
  66710. _AbstractRSSReader.default.decrement(this.getOddCounts(), this.getOddRoundingErrors());
  66711. }
  66712. if (incrementEven) {
  66713. if (decrementEven) {
  66714. throw new _NotFoundException.default();
  66715. }
  66716. _AbstractRSSReader.default.increment(this.getEvenCounts(), this.getOddRoundingErrors());
  66717. }
  66718. if (decrementEven) {
  66719. _AbstractRSSReader.default.decrement(this.getEvenCounts(), this.getEvenRoundingErrors());
  66720. }
  66721. };
  66722. RSS14Reader.OUTSIDE_EVEN_TOTAL_SUBSET = [1, 10, 34, 70, 126];
  66723. RSS14Reader.INSIDE_ODD_TOTAL_SUBSET = [4, 20, 48, 81];
  66724. RSS14Reader.OUTSIDE_GSUM = [0, 161, 961, 2015, 2715];
  66725. RSS14Reader.INSIDE_GSUM = [0, 336, 1036, 1516];
  66726. RSS14Reader.OUTSIDE_ODD_WIDEST = [8, 6, 4, 3, 1];
  66727. RSS14Reader.INSIDE_ODD_WIDEST = [2, 4, 6, 8];
  66728. RSS14Reader.FINDER_PATTERNS = [Int32Array.from([3, 8, 2, 1]), Int32Array.from([3, 5, 5, 1]), Int32Array.from([3, 3, 7, 1]), Int32Array.from([3, 1, 9, 1]), Int32Array.from([2, 7, 4, 1]), Int32Array.from([2, 5, 6, 1]), Int32Array.from([2, 3, 8, 1]), Int32Array.from([1, 5, 7, 1]), Int32Array.from([1, 3, 9, 1])];
  66729. return RSS14Reader;
  66730. }(_AbstractRSSReader.default);
  66731. var _default = RSS14Reader;
  66732. exports.default = _default;
  66733. /***/ }),
  66734. /* 402 */
  66735. /*!*********************************************************************************!*\
  66736. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/oned/rss/Pair.js ***!
  66737. \*********************************************************************************/
  66738. /*! no static exports found */
  66739. /***/ (function(module, exports, __webpack_require__) {
  66740. "use strict";
  66741. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  66742. Object.defineProperty(exports, "__esModule", {
  66743. value: true
  66744. });
  66745. exports.default = void 0;
  66746. var _DataCharacter = _interopRequireDefault(__webpack_require__(/*! ./DataCharacter */ 376));
  66747. var __extends = void 0 && (void 0).__extends || function () {
  66748. var _extendStatics = function extendStatics(d, b) {
  66749. _extendStatics = Object.setPrototypeOf || {
  66750. __proto__: []
  66751. } instanceof Array && function (d, b) {
  66752. d.__proto__ = b;
  66753. } || function (d, b) {
  66754. for (var p in b) {
  66755. if (b.hasOwnProperty(p)) d[p] = b[p];
  66756. }
  66757. };
  66758. return _extendStatics(d, b);
  66759. };
  66760. return function (d, b) {
  66761. _extendStatics(d, b);
  66762. function __() {
  66763. this.constructor = d;
  66764. }
  66765. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  66766. };
  66767. }();
  66768. var Pair = /** @class */function (_super) {
  66769. __extends(Pair, _super);
  66770. function Pair(value, checksumPortion, finderPattern) {
  66771. var _this = _super.call(this, value, checksumPortion) || this;
  66772. _this.count = 0;
  66773. _this.finderPattern = finderPattern;
  66774. return _this;
  66775. }
  66776. Pair.prototype.getFinderPattern = function () {
  66777. return this.finderPattern;
  66778. };
  66779. Pair.prototype.getCount = function () {
  66780. return this.count;
  66781. };
  66782. Pair.prototype.incrementCount = function () {
  66783. this.count++;
  66784. };
  66785. return Pair;
  66786. }(_DataCharacter.default);
  66787. var _default = Pair;
  66788. exports.default = _default;
  66789. /***/ }),
  66790. /* 403 */
  66791. /*!**************************************************************************************************!*\
  66792. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserDatamatrixCodeReader.js ***!
  66793. \**************************************************************************************************/
  66794. /*! no static exports found */
  66795. /***/ (function(module, exports, __webpack_require__) {
  66796. "use strict";
  66797. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  66798. Object.defineProperty(exports, "__esModule", {
  66799. value: true
  66800. });
  66801. exports.BrowserDatamatrixCodeReader = void 0;
  66802. var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
  66803. var _DataMatrixReader = _interopRequireDefault(__webpack_require__(/*! ../core/datamatrix/DataMatrixReader */ 404));
  66804. var __extends = void 0 && (void 0).__extends || function () {
  66805. var _extendStatics = function extendStatics(d, b) {
  66806. _extendStatics = Object.setPrototypeOf || {
  66807. __proto__: []
  66808. } instanceof Array && function (d, b) {
  66809. d.__proto__ = b;
  66810. } || function (d, b) {
  66811. for (var p in b) {
  66812. if (b.hasOwnProperty(p)) d[p] = b[p];
  66813. }
  66814. };
  66815. return _extendStatics(d, b);
  66816. };
  66817. return function (d, b) {
  66818. _extendStatics(d, b);
  66819. function __() {
  66820. this.constructor = d;
  66821. }
  66822. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  66823. };
  66824. }();
  66825. /**
  66826. * @deprecated Moving to @zxing/browser
  66827. *
  66828. * QR Code reader to use from browser.
  66829. */
  66830. var BrowserDatamatrixCodeReader = /** @class */function (_super) {
  66831. __extends(BrowserDatamatrixCodeReader, _super);
  66832. /**
  66833. * Creates an instance of BrowserQRCodeReader.
  66834. * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
  66835. */
  66836. function BrowserDatamatrixCodeReader(timeBetweenScansMillis) {
  66837. if (timeBetweenScansMillis === void 0) {
  66838. timeBetweenScansMillis = 500;
  66839. }
  66840. return _super.call(this, new _DataMatrixReader.default(), timeBetweenScansMillis) || this;
  66841. }
  66842. return BrowserDatamatrixCodeReader;
  66843. }(_BrowserCodeReader.BrowserCodeReader);
  66844. exports.BrowserDatamatrixCodeReader = BrowserDatamatrixCodeReader;
  66845. /***/ }),
  66846. /* 404 */
  66847. /*!***********************************************************************************************!*\
  66848. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/DataMatrixReader.js ***!
  66849. \***********************************************************************************************/
  66850. /*! no static exports found */
  66851. /***/ (function(module, exports, __webpack_require__) {
  66852. "use strict";
  66853. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  66854. Object.defineProperty(exports, "__esModule", {
  66855. value: true
  66856. });
  66857. exports.default = void 0;
  66858. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  66859. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
  66860. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  66861. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  66862. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  66863. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  66864. var _System = _interopRequireDefault(__webpack_require__(/*! ../util/System */ 315));
  66865. var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/Decoder */ 405));
  66866. var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 411));
  66867. /*
  66868. * Copyright 2007 ZXing authors
  66869. *
  66870. * Licensed under the Apache License, Version 2.0 (the "License");
  66871. * you may not use this file except in compliance with the License.
  66872. * You may obtain a copy of the License at
  66873. *
  66874. * http://www.apache.org/licenses/LICENSE-2.0
  66875. *
  66876. * Unless required by applicable law or agreed to in writing, software
  66877. * distributed under the License is distributed on an "AS IS" BASIS,
  66878. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  66879. * See the License for the specific language governing permissions and
  66880. * limitations under the License.
  66881. */
  66882. /**
  66883. * This implementation can detect and decode Data Matrix codes in an image.
  66884. *
  66885. * @author bbrown@google.com (Brian Brown)
  66886. */
  66887. var DataMatrixReader = /** @class */function () {
  66888. function DataMatrixReader() {
  66889. this.decoder = new _Decoder.default();
  66890. }
  66891. /**
  66892. * Locates and decodes a Data Matrix code in an image.
  66893. *
  66894. * @return a String representing the content encoded by the Data Matrix code
  66895. * @throws NotFoundException if a Data Matrix code cannot be found
  66896. * @throws FormatException if a Data Matrix code cannot be decoded
  66897. * @throws ChecksumException if error correction fails
  66898. */
  66899. // @Override
  66900. // public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
  66901. // return decode(image, null);
  66902. // }
  66903. // @Override
  66904. DataMatrixReader.prototype.decode = function (image, hints) {
  66905. if (hints === void 0) {
  66906. hints = null;
  66907. }
  66908. var decoderResult;
  66909. var points;
  66910. if (hints != null && hints.has(_DecodeHintType.default.PURE_BARCODE)) {
  66911. var bits = DataMatrixReader.extractPureBits(image.getBlackMatrix());
  66912. decoderResult = this.decoder.decode(bits);
  66913. points = DataMatrixReader.NO_POINTS;
  66914. } else {
  66915. var detectorResult = new _Detector.default(image.getBlackMatrix()).detect();
  66916. decoderResult = this.decoder.decode(detectorResult.getBits());
  66917. points = detectorResult.getPoints();
  66918. }
  66919. var rawBytes = decoderResult.getRawBytes();
  66920. var result = new _Result.default(decoderResult.getText(), rawBytes, 8 * rawBytes.length, points, _BarcodeFormat.default.DATA_MATRIX, _System.default.currentTimeMillis());
  66921. var byteSegments = decoderResult.getByteSegments();
  66922. if (byteSegments != null) {
  66923. result.putMetadata(_ResultMetadataType.default.BYTE_SEGMENTS, byteSegments);
  66924. }
  66925. var ecLevel = decoderResult.getECLevel();
  66926. if (ecLevel != null) {
  66927. result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, ecLevel);
  66928. }
  66929. return result;
  66930. };
  66931. // @Override
  66932. DataMatrixReader.prototype.reset = function () {
  66933. // do nothing
  66934. };
  66935. /**
  66936. * This method detects a code in a "pure" image -- that is, pure monochrome image
  66937. * which contains only an unrotated, unskewed, image of a code, with some white border
  66938. * around it. This is a specialized method that works exceptionally fast in this special
  66939. * case.
  66940. *
  66941. * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)
  66942. */
  66943. DataMatrixReader.extractPureBits = function (image) {
  66944. var leftTopBlack = image.getTopLeftOnBit();
  66945. var rightBottomBlack = image.getBottomRightOnBit();
  66946. if (leftTopBlack == null || rightBottomBlack == null) {
  66947. throw new _NotFoundException.default();
  66948. }
  66949. var moduleSize = this.moduleSize(leftTopBlack, image);
  66950. var top = leftTopBlack[1];
  66951. var bottom = rightBottomBlack[1];
  66952. var left = leftTopBlack[0];
  66953. var right = rightBottomBlack[0];
  66954. var matrixWidth = (right - left + 1) / moduleSize;
  66955. var matrixHeight = (bottom - top + 1) / moduleSize;
  66956. if (matrixWidth <= 0 || matrixHeight <= 0) {
  66957. throw new _NotFoundException.default();
  66958. }
  66959. // Push in the "border" by half the module width so that we start
  66960. // sampling in the middle of the module. Just in case the image is a
  66961. // little off, this will help recover.
  66962. var nudge = moduleSize / 2;
  66963. top += nudge;
  66964. left += nudge;
  66965. // Now just read off the bits
  66966. var bits = new _BitMatrix.default(matrixWidth, matrixHeight);
  66967. for (var y = 0; y < matrixHeight; y++) {
  66968. var iOffset = top + y * moduleSize;
  66969. for (var x = 0; x < matrixWidth; x++) {
  66970. if (image.get(left + x * moduleSize, iOffset)) {
  66971. bits.set(x, y);
  66972. }
  66973. }
  66974. }
  66975. return bits;
  66976. };
  66977. DataMatrixReader.moduleSize = function (leftTopBlack, image) {
  66978. var width = image.getWidth();
  66979. var x = leftTopBlack[0];
  66980. var y = leftTopBlack[1];
  66981. while (x < width && image.get(x, y)) {
  66982. x++;
  66983. }
  66984. if (x === width) {
  66985. throw new _NotFoundException.default();
  66986. }
  66987. var moduleSize = x - leftTopBlack[0];
  66988. if (moduleSize === 0) {
  66989. throw new _NotFoundException.default();
  66990. }
  66991. return moduleSize;
  66992. };
  66993. DataMatrixReader.NO_POINTS = [];
  66994. return DataMatrixReader;
  66995. }();
  66996. var _default = DataMatrixReader;
  66997. exports.default = _default;
  66998. /***/ }),
  66999. /* 405 */
  67000. /*!**********************************************************************************************!*\
  67001. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/Decoder.js ***!
  67002. \**********************************************************************************************/
  67003. /*! no static exports found */
  67004. /***/ (function(module, exports, __webpack_require__) {
  67005. "use strict";
  67006. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  67007. Object.defineProperty(exports, "__esModule", {
  67008. value: true
  67009. });
  67010. exports.default = void 0;
  67011. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../ChecksumException */ 309));
  67012. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
  67013. var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
  67014. var _BitMatrixParser = _interopRequireDefault(__webpack_require__(/*! ./BitMatrixParser */ 406));
  67015. var _DataBlock = _interopRequireDefault(__webpack_require__(/*! ./DataBlock */ 408));
  67016. var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./DecodedBitStreamParser */ 409));
  67017. var __values = void 0 && (void 0).__values || function (o) {
  67018. var s = typeof Symbol === "function" && Symbol.iterator,
  67019. m = s && o[s],
  67020. i = 0;
  67021. if (m) return m.call(o);
  67022. if (o && typeof o.length === "number") return {
  67023. next: function next() {
  67024. if (o && i >= o.length) o = void 0;
  67025. return {
  67026. value: o && o[i++],
  67027. done: !o
  67028. };
  67029. }
  67030. };
  67031. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  67032. };
  67033. /*
  67034. * Copyright 2007 ZXing authors
  67035. *
  67036. * Licensed under the Apache License, Version 2.0 (the "License");
  67037. * you may not use this file except in compliance with the License.
  67038. * You may obtain a copy of the License at
  67039. *
  67040. * http://www.apache.org/licenses/LICENSE-2.0
  67041. *
  67042. * Unless required by applicable law or agreed to in writing, software
  67043. * distributed under the License is distributed on an "AS IS" BASIS,
  67044. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  67045. * See the License for the specific language governing permissions and
  67046. * limitations under the License.
  67047. */
  67048. /**
  67049. * <p>The main class which implements Data Matrix Code decoding -- as opposed to locating and extracting
  67050. * the Data Matrix Code from an image.</p>
  67051. *
  67052. * @author bbrown@google.com (Brian Brown)
  67053. */
  67054. var Decoder = /** @class */function () {
  67055. function Decoder() {
  67056. this.rsDecoder = new _ReedSolomonDecoder.default(_GenericGF.default.DATA_MATRIX_FIELD_256);
  67057. }
  67058. /**
  67059. * <p>Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or "true" is taken
  67060. * to mean a black module.</p>
  67061. *
  67062. * @param bits booleans representing white/black Data Matrix Code modules
  67063. * @return text and bytes encoded within the Data Matrix Code
  67064. * @throws FormatException if the Data Matrix Code cannot be decoded
  67065. * @throws ChecksumException if error correction fails
  67066. */
  67067. Decoder.prototype.decode = function (bits) {
  67068. var e_1, _a;
  67069. // Construct a parser and read version, error-correction level
  67070. var parser = new _BitMatrixParser.default(bits);
  67071. var version = parser.getVersion();
  67072. // Read codewords
  67073. var codewords = parser.readCodewords();
  67074. // Separate into data blocks
  67075. var dataBlocks = _DataBlock.default.getDataBlocks(codewords, version);
  67076. // Count total number of data bytes
  67077. var totalBytes = 0;
  67078. try {
  67079. for (var dataBlocks_1 = __values(dataBlocks), dataBlocks_1_1 = dataBlocks_1.next(); !dataBlocks_1_1.done; dataBlocks_1_1 = dataBlocks_1.next()) {
  67080. var db = dataBlocks_1_1.value;
  67081. totalBytes += db.getNumDataCodewords();
  67082. }
  67083. } catch (e_1_1) {
  67084. e_1 = {
  67085. error: e_1_1
  67086. };
  67087. } finally {
  67088. try {
  67089. if (dataBlocks_1_1 && !dataBlocks_1_1.done && (_a = dataBlocks_1.return)) _a.call(dataBlocks_1);
  67090. } finally {
  67091. if (e_1) throw e_1.error;
  67092. }
  67093. }
  67094. var resultBytes = new Uint8Array(totalBytes);
  67095. var dataBlocksCount = dataBlocks.length;
  67096. // Error-correct and copy data blocks together into a stream of bytes
  67097. for (var j = 0; j < dataBlocksCount; j++) {
  67098. var dataBlock = dataBlocks[j];
  67099. var codewordBytes = dataBlock.getCodewords();
  67100. var numDataCodewords = dataBlock.getNumDataCodewords();
  67101. this.correctErrors(codewordBytes, numDataCodewords);
  67102. for (var i = 0; i < numDataCodewords; i++) {
  67103. // De-interlace data blocks.
  67104. resultBytes[i * dataBlocksCount + j] = codewordBytes[i];
  67105. }
  67106. }
  67107. // Decode the contents of that stream of bytes
  67108. return _DecodedBitStreamParser.default.decode(resultBytes);
  67109. };
  67110. /**
  67111. * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
  67112. * correct the errors in-place using Reed-Solomon error correction.</p>
  67113. *
  67114. * @param codewordBytes data and error correction codewords
  67115. * @param numDataCodewords number of codewords that are data bytes
  67116. * @throws ChecksumException if error correction fails
  67117. */
  67118. Decoder.prototype.correctErrors = function (codewordBytes, numDataCodewords) {
  67119. // const numCodewords = codewordBytes.length;
  67120. // First read into an array of ints
  67121. var codewordsInts = new Int32Array(codewordBytes);
  67122. // for (let i = 0; i < numCodewords; i++) {
  67123. // codewordsInts[i] = codewordBytes[i] & 0xFF;
  67124. // }
  67125. try {
  67126. this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);
  67127. } catch (ignored /* ReedSolomonException */) {
  67128. throw new _ChecksumException.default();
  67129. }
  67130. // Copy back into array of bytes -- only need to worry about the bytes that were data
  67131. // We don't care about errors in the error-correction codewords
  67132. for (var i = 0; i < numDataCodewords; i++) {
  67133. codewordBytes[i] = codewordsInts[i];
  67134. }
  67135. };
  67136. return Decoder;
  67137. }();
  67138. var _default = Decoder;
  67139. exports.default = _default;
  67140. /***/ }),
  67141. /* 406 */
  67142. /*!******************************************************************************************************!*\
  67143. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/BitMatrixParser.js ***!
  67144. \******************************************************************************************************/
  67145. /*! no static exports found */
  67146. /***/ (function(module, exports, __webpack_require__) {
  67147. "use strict";
  67148. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  67149. Object.defineProperty(exports, "__esModule", {
  67150. value: true
  67151. });
  67152. exports.default = void 0;
  67153. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
  67154. var _Version = _interopRequireDefault(__webpack_require__(/*! ./Version */ 407));
  67155. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  67156. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  67157. /*
  67158. * Copyright 2007 ZXing authors
  67159. *
  67160. * Licensed under the Apache License, Version 2.0 (the "License");
  67161. * you may not use this file except in compliance with the License.
  67162. * You may obtain a copy of the License at
  67163. *
  67164. * http://www.apache.org/licenses/LICENSE-2.0
  67165. *
  67166. * Unless required by applicable law or agreed to in writing, software
  67167. * distributed under the License is distributed on an "AS IS" BASIS,
  67168. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  67169. * See the License for the specific language governing permissions and
  67170. * limitations under the License.
  67171. */
  67172. /**
  67173. * @author bbrown@google.com (Brian Brown)
  67174. */
  67175. var BitMatrixParser = /** @class */function () {
  67176. /**
  67177. * @param bitMatrix {@link BitMatrix} to parse
  67178. * @throws FormatException if dimension is < 8 or > 144 or not 0 mod 2
  67179. */
  67180. function BitMatrixParser(bitMatrix) {
  67181. var dimension = bitMatrix.getHeight();
  67182. if (dimension < 8 || dimension > 144 || (dimension & 0x01) !== 0) {
  67183. throw new _FormatException.default();
  67184. }
  67185. this.version = BitMatrixParser.readVersion(bitMatrix);
  67186. this.mappingBitMatrix = this.extractDataRegion(bitMatrix);
  67187. this.readMappingMatrix = new _BitMatrix.default(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight());
  67188. }
  67189. BitMatrixParser.prototype.getVersion = function () {
  67190. return this.version;
  67191. };
  67192. /**
  67193. * <p>Creates the version object based on the dimension of the original bit matrix from
  67194. * the datamatrix code.</p>
  67195. *
  67196. * <p>See ISO 16022:2006 Table 7 - ECC 200 symbol attributes</p>
  67197. *
  67198. * @param bitMatrix Original {@link BitMatrix} including alignment patterns
  67199. * @return {@link Version} encapsulating the Data Matrix Code's "version"
  67200. * @throws FormatException if the dimensions of the mapping matrix are not valid
  67201. * Data Matrix dimensions.
  67202. */
  67203. BitMatrixParser.readVersion = function (bitMatrix) {
  67204. var numRows = bitMatrix.getHeight();
  67205. var numColumns = bitMatrix.getWidth();
  67206. return _Version.default.getVersionForDimensions(numRows, numColumns);
  67207. };
  67208. /**
  67209. * <p>Reads the bits in the {@link BitMatrix} representing the mapping matrix (No alignment patterns)
  67210. * in the correct order in order to reconstitute the codewords bytes contained within the
  67211. * Data Matrix Code.</p>
  67212. *
  67213. * @return bytes encoded within the Data Matrix Code
  67214. * @throws FormatException if the exact number of bytes expected is not read
  67215. */
  67216. BitMatrixParser.prototype.readCodewords = function () {
  67217. var result = new Int8Array(this.version.getTotalCodewords());
  67218. var resultOffset = 0;
  67219. var row = 4;
  67220. var column = 0;
  67221. var numRows = this.mappingBitMatrix.getHeight();
  67222. var numColumns = this.mappingBitMatrix.getWidth();
  67223. var corner1Read = false;
  67224. var corner2Read = false;
  67225. var corner3Read = false;
  67226. var corner4Read = false;
  67227. // Read all of the codewords
  67228. do {
  67229. // Check the four corner cases
  67230. if (row === numRows && column === 0 && !corner1Read) {
  67231. result[resultOffset++] = this.readCorner1(numRows, numColumns) & 0xff;
  67232. row -= 2;
  67233. column += 2;
  67234. corner1Read = true;
  67235. } else if (row === numRows - 2 && column === 0 && (numColumns & 0x03) !== 0 && !corner2Read) {
  67236. result[resultOffset++] = this.readCorner2(numRows, numColumns) & 0xff;
  67237. row -= 2;
  67238. column += 2;
  67239. corner2Read = true;
  67240. } else if (row === numRows + 4 && column === 2 && (numColumns & 0x07) === 0 && !corner3Read) {
  67241. result[resultOffset++] = this.readCorner3(numRows, numColumns) & 0xff;
  67242. row -= 2;
  67243. column += 2;
  67244. corner3Read = true;
  67245. } else if (row === numRows - 2 && column === 0 && (numColumns & 0x07) === 4 && !corner4Read) {
  67246. result[resultOffset++] = this.readCorner4(numRows, numColumns) & 0xff;
  67247. row -= 2;
  67248. column += 2;
  67249. corner4Read = true;
  67250. } else {
  67251. // Sweep upward diagonally to the right
  67252. do {
  67253. if (row < numRows && column >= 0 && !this.readMappingMatrix.get(column, row)) {
  67254. result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
  67255. }
  67256. row -= 2;
  67257. column += 2;
  67258. } while (row >= 0 && column < numColumns);
  67259. row += 1;
  67260. column += 3;
  67261. // Sweep downward diagonally to the left
  67262. do {
  67263. if (row >= 0 && column < numColumns && !this.readMappingMatrix.get(column, row)) {
  67264. result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;
  67265. }
  67266. row += 2;
  67267. column -= 2;
  67268. } while (row < numRows && column >= 0);
  67269. row += 3;
  67270. column += 1;
  67271. }
  67272. } while (row < numRows || column < numColumns);
  67273. if (resultOffset !== this.version.getTotalCodewords()) {
  67274. throw new _FormatException.default();
  67275. }
  67276. return result;
  67277. };
  67278. /**
  67279. * <p>Reads a bit of the mapping matrix accounting for boundary wrapping.</p>
  67280. *
  67281. * @param row Row to read in the mapping matrix
  67282. * @param column Column to read in the mapping matrix
  67283. * @param numRows Number of rows in the mapping matrix
  67284. * @param numColumns Number of columns in the mapping matrix
  67285. * @return value of the given bit in the mapping matrix
  67286. */
  67287. BitMatrixParser.prototype.readModule = function (row, column, numRows, numColumns) {
  67288. // Adjust the row and column indices based on boundary wrapping
  67289. if (row < 0) {
  67290. row += numRows;
  67291. column += 4 - (numRows + 4 & 0x07);
  67292. }
  67293. if (column < 0) {
  67294. column += numColumns;
  67295. row += 4 - (numColumns + 4 & 0x07);
  67296. }
  67297. this.readMappingMatrix.set(column, row);
  67298. return this.mappingBitMatrix.get(column, row);
  67299. };
  67300. /**
  67301. * <p>Reads the 8 bits of the standard Utah-shaped pattern.</p>
  67302. *
  67303. * <p>See ISO 16022:2006, 5.8.1 Figure 6</p>
  67304. *
  67305. * @param row Current row in the mapping matrix, anchored at the 8th bit (LSB) of the pattern
  67306. * @param column Current column in the mapping matrix, anchored at the 8th bit (LSB) of the pattern
  67307. * @param numRows Number of rows in the mapping matrix
  67308. * @param numColumns Number of columns in the mapping matrix
  67309. * @return byte from the utah shape
  67310. */
  67311. BitMatrixParser.prototype.readUtah = function (row, column, numRows, numColumns) {
  67312. var currentByte = 0;
  67313. if (this.readModule(row - 2, column - 2, numRows, numColumns)) {
  67314. currentByte |= 1;
  67315. }
  67316. currentByte <<= 1;
  67317. if (this.readModule(row - 2, column - 1, numRows, numColumns)) {
  67318. currentByte |= 1;
  67319. }
  67320. currentByte <<= 1;
  67321. if (this.readModule(row - 1, column - 2, numRows, numColumns)) {
  67322. currentByte |= 1;
  67323. }
  67324. currentByte <<= 1;
  67325. if (this.readModule(row - 1, column - 1, numRows, numColumns)) {
  67326. currentByte |= 1;
  67327. }
  67328. currentByte <<= 1;
  67329. if (this.readModule(row - 1, column, numRows, numColumns)) {
  67330. currentByte |= 1;
  67331. }
  67332. currentByte <<= 1;
  67333. if (this.readModule(row, column - 2, numRows, numColumns)) {
  67334. currentByte |= 1;
  67335. }
  67336. currentByte <<= 1;
  67337. if (this.readModule(row, column - 1, numRows, numColumns)) {
  67338. currentByte |= 1;
  67339. }
  67340. currentByte <<= 1;
  67341. if (this.readModule(row, column, numRows, numColumns)) {
  67342. currentByte |= 1;
  67343. }
  67344. return currentByte;
  67345. };
  67346. /**
  67347. * <p>Reads the 8 bits of the special corner condition 1.</p>
  67348. *
  67349. * <p>See ISO 16022:2006, Figure F.3</p>
  67350. *
  67351. * @param numRows Number of rows in the mapping matrix
  67352. * @param numColumns Number of columns in the mapping matrix
  67353. * @return byte from the Corner condition 1
  67354. */
  67355. BitMatrixParser.prototype.readCorner1 = function (numRows, numColumns) {
  67356. var currentByte = 0;
  67357. if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
  67358. currentByte |= 1;
  67359. }
  67360. currentByte <<= 1;
  67361. if (this.readModule(numRows - 1, 1, numRows, numColumns)) {
  67362. currentByte |= 1;
  67363. }
  67364. currentByte <<= 1;
  67365. if (this.readModule(numRows - 1, 2, numRows, numColumns)) {
  67366. currentByte |= 1;
  67367. }
  67368. currentByte <<= 1;
  67369. if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
  67370. currentByte |= 1;
  67371. }
  67372. currentByte <<= 1;
  67373. if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
  67374. currentByte |= 1;
  67375. }
  67376. currentByte <<= 1;
  67377. if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
  67378. currentByte |= 1;
  67379. }
  67380. currentByte <<= 1;
  67381. if (this.readModule(2, numColumns - 1, numRows, numColumns)) {
  67382. currentByte |= 1;
  67383. }
  67384. currentByte <<= 1;
  67385. if (this.readModule(3, numColumns - 1, numRows, numColumns)) {
  67386. currentByte |= 1;
  67387. }
  67388. return currentByte;
  67389. };
  67390. /**
  67391. * <p>Reads the 8 bits of the special corner condition 2.</p>
  67392. *
  67393. * <p>See ISO 16022:2006, Figure F.4</p>
  67394. *
  67395. * @param numRows Number of rows in the mapping matrix
  67396. * @param numColumns Number of columns in the mapping matrix
  67397. * @return byte from the Corner condition 2
  67398. */
  67399. BitMatrixParser.prototype.readCorner2 = function (numRows, numColumns) {
  67400. var currentByte = 0;
  67401. if (this.readModule(numRows - 3, 0, numRows, numColumns)) {
  67402. currentByte |= 1;
  67403. }
  67404. currentByte <<= 1;
  67405. if (this.readModule(numRows - 2, 0, numRows, numColumns)) {
  67406. currentByte |= 1;
  67407. }
  67408. currentByte <<= 1;
  67409. if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
  67410. currentByte |= 1;
  67411. }
  67412. currentByte <<= 1;
  67413. if (this.readModule(0, numColumns - 4, numRows, numColumns)) {
  67414. currentByte |= 1;
  67415. }
  67416. currentByte <<= 1;
  67417. if (this.readModule(0, numColumns - 3, numRows, numColumns)) {
  67418. currentByte |= 1;
  67419. }
  67420. currentByte <<= 1;
  67421. if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
  67422. currentByte |= 1;
  67423. }
  67424. currentByte <<= 1;
  67425. if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
  67426. currentByte |= 1;
  67427. }
  67428. currentByte <<= 1;
  67429. if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
  67430. currentByte |= 1;
  67431. }
  67432. return currentByte;
  67433. };
  67434. /**
  67435. * <p>Reads the 8 bits of the special corner condition 3.</p>
  67436. *
  67437. * <p>See ISO 16022:2006, Figure F.5</p>
  67438. *
  67439. * @param numRows Number of rows in the mapping matrix
  67440. * @param numColumns Number of columns in the mapping matrix
  67441. * @return byte from the Corner condition 3
  67442. */
  67443. BitMatrixParser.prototype.readCorner3 = function (numRows, numColumns) {
  67444. var currentByte = 0;
  67445. if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
  67446. currentByte |= 1;
  67447. }
  67448. currentByte <<= 1;
  67449. if (this.readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
  67450. currentByte |= 1;
  67451. }
  67452. currentByte <<= 1;
  67453. if (this.readModule(0, numColumns - 3, numRows, numColumns)) {
  67454. currentByte |= 1;
  67455. }
  67456. currentByte <<= 1;
  67457. if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
  67458. currentByte |= 1;
  67459. }
  67460. currentByte <<= 1;
  67461. if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
  67462. currentByte |= 1;
  67463. }
  67464. currentByte <<= 1;
  67465. if (this.readModule(1, numColumns - 3, numRows, numColumns)) {
  67466. currentByte |= 1;
  67467. }
  67468. currentByte <<= 1;
  67469. if (this.readModule(1, numColumns - 2, numRows, numColumns)) {
  67470. currentByte |= 1;
  67471. }
  67472. currentByte <<= 1;
  67473. if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
  67474. currentByte |= 1;
  67475. }
  67476. return currentByte;
  67477. };
  67478. /**
  67479. * <p>Reads the 8 bits of the special corner condition 4.</p>
  67480. *
  67481. * <p>See ISO 16022:2006, Figure F.6</p>
  67482. *
  67483. * @param numRows Number of rows in the mapping matrix
  67484. * @param numColumns Number of columns in the mapping matrix
  67485. * @return byte from the Corner condition 4
  67486. */
  67487. BitMatrixParser.prototype.readCorner4 = function (numRows, numColumns) {
  67488. var currentByte = 0;
  67489. if (this.readModule(numRows - 3, 0, numRows, numColumns)) {
  67490. currentByte |= 1;
  67491. }
  67492. currentByte <<= 1;
  67493. if (this.readModule(numRows - 2, 0, numRows, numColumns)) {
  67494. currentByte |= 1;
  67495. }
  67496. currentByte <<= 1;
  67497. if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
  67498. currentByte |= 1;
  67499. }
  67500. currentByte <<= 1;
  67501. if (this.readModule(0, numColumns - 2, numRows, numColumns)) {
  67502. currentByte |= 1;
  67503. }
  67504. currentByte <<= 1;
  67505. if (this.readModule(0, numColumns - 1, numRows, numColumns)) {
  67506. currentByte |= 1;
  67507. }
  67508. currentByte <<= 1;
  67509. if (this.readModule(1, numColumns - 1, numRows, numColumns)) {
  67510. currentByte |= 1;
  67511. }
  67512. currentByte <<= 1;
  67513. if (this.readModule(2, numColumns - 1, numRows, numColumns)) {
  67514. currentByte |= 1;
  67515. }
  67516. currentByte <<= 1;
  67517. if (this.readModule(3, numColumns - 1, numRows, numColumns)) {
  67518. currentByte |= 1;
  67519. }
  67520. return currentByte;
  67521. };
  67522. /**
  67523. * <p>Extracts the data region from a {@link BitMatrix} that contains
  67524. * alignment patterns.</p>
  67525. *
  67526. * @param bitMatrix Original {@link BitMatrix} with alignment patterns
  67527. * @return BitMatrix that has the alignment patterns removed
  67528. */
  67529. BitMatrixParser.prototype.extractDataRegion = function (bitMatrix) {
  67530. var symbolSizeRows = this.version.getSymbolSizeRows();
  67531. var symbolSizeColumns = this.version.getSymbolSizeColumns();
  67532. if (bitMatrix.getHeight() !== symbolSizeRows) {
  67533. throw new _IllegalArgumentException.default('Dimension of bitMatrix must match the version size');
  67534. }
  67535. var dataRegionSizeRows = this.version.getDataRegionSizeRows();
  67536. var dataRegionSizeColumns = this.version.getDataRegionSizeColumns();
  67537. var numDataRegionsRow = symbolSizeRows / dataRegionSizeRows | 0;
  67538. var numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns | 0;
  67539. var sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;
  67540. var sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;
  67541. var bitMatrixWithoutAlignment = new _BitMatrix.default(sizeDataRegionColumn, sizeDataRegionRow);
  67542. for (var dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) {
  67543. var dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;
  67544. for (var dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn) {
  67545. var dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;
  67546. for (var i = 0; i < dataRegionSizeRows; ++i) {
  67547. var readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;
  67548. var writeRowOffset = dataRegionRowOffset + i;
  67549. for (var j = 0; j < dataRegionSizeColumns; ++j) {
  67550. var readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;
  67551. if (bitMatrix.get(readColumnOffset, readRowOffset)) {
  67552. var writeColumnOffset = dataRegionColumnOffset + j;
  67553. bitMatrixWithoutAlignment.set(writeColumnOffset, writeRowOffset);
  67554. }
  67555. }
  67556. }
  67557. }
  67558. }
  67559. return bitMatrixWithoutAlignment;
  67560. };
  67561. return BitMatrixParser;
  67562. }();
  67563. var _default = BitMatrixParser;
  67564. exports.default = _default;
  67565. /***/ }),
  67566. /* 407 */
  67567. /*!**********************************************************************************************!*\
  67568. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/Version.js ***!
  67569. \**********************************************************************************************/
  67570. /*! no static exports found */
  67571. /***/ (function(module, exports, __webpack_require__) {
  67572. "use strict";
  67573. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  67574. Object.defineProperty(exports, "__esModule", {
  67575. value: true
  67576. });
  67577. exports.default = exports.ECBlocks = exports.ECB = void 0;
  67578. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  67579. var __values = void 0 && (void 0).__values || function (o) {
  67580. var s = typeof Symbol === "function" && Symbol.iterator,
  67581. m = s && o[s],
  67582. i = 0;
  67583. if (m) return m.call(o);
  67584. if (o && typeof o.length === "number") return {
  67585. next: function next() {
  67586. if (o && i >= o.length) o = void 0;
  67587. return {
  67588. value: o && o[i++],
  67589. done: !o
  67590. };
  67591. }
  67592. };
  67593. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  67594. };
  67595. /*
  67596. * Copyright 2007 ZXing authors
  67597. *
  67598. * Licensed under the Apache License, Version 2.0 (the "License");
  67599. * you may not use this file except in compliance with the License.
  67600. * You may obtain a copy of the License at
  67601. *
  67602. * http://www.apache.org/licenses/LICENSE-2.0
  67603. *
  67604. * Unless required by applicable law or agreed to in writing, software
  67605. * distributed under the License is distributed on an "AS IS" BASIS,
  67606. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  67607. * See the License for the specific language governing permissions and
  67608. * limitations under the License.
  67609. */
  67610. /**
  67611. * <p>Encapsulates a set of error-correction blocks in one symbol version. Most versions will
  67612. * use blocks of differing sizes within one version, so, this encapsulates the parameters for
  67613. * each set of blocks. It also holds the number of error-correction codewords per block since it
  67614. * will be the same across all blocks within one version.</p>
  67615. */
  67616. var ECBlocks = /** @class */function () {
  67617. function ECBlocks(ecCodewords, ecBlocks1, ecBlocks2) {
  67618. this.ecCodewords = ecCodewords;
  67619. this.ecBlocks = [ecBlocks1];
  67620. ecBlocks2 && this.ecBlocks.push(ecBlocks2);
  67621. }
  67622. ECBlocks.prototype.getECCodewords = function () {
  67623. return this.ecCodewords;
  67624. };
  67625. ECBlocks.prototype.getECBlocks = function () {
  67626. return this.ecBlocks;
  67627. };
  67628. return ECBlocks;
  67629. }();
  67630. exports.ECBlocks = ECBlocks;
  67631. /**
  67632. * <p>Encapsulates the parameters for one error-correction block in one symbol version.
  67633. * This includes the number of data codewords, and the number of times a block with these
  67634. * parameters is used consecutively in the Data Matrix code version's format.</p>
  67635. */
  67636. var ECB = /** @class */function () {
  67637. function ECB(count, dataCodewords) {
  67638. this.count = count;
  67639. this.dataCodewords = dataCodewords;
  67640. }
  67641. ECB.prototype.getCount = function () {
  67642. return this.count;
  67643. };
  67644. ECB.prototype.getDataCodewords = function () {
  67645. return this.dataCodewords;
  67646. };
  67647. return ECB;
  67648. }();
  67649. exports.ECB = ECB;
  67650. /**
  67651. * The Version object encapsulates attributes about a particular
  67652. * size Data Matrix Code.
  67653. *
  67654. * @author bbrown@google.com (Brian Brown)
  67655. */
  67656. var Version = /** @class */function () {
  67657. function Version(versionNumber, symbolSizeRows, symbolSizeColumns, dataRegionSizeRows, dataRegionSizeColumns, ecBlocks) {
  67658. var e_1, _a;
  67659. this.versionNumber = versionNumber;
  67660. this.symbolSizeRows = symbolSizeRows;
  67661. this.symbolSizeColumns = symbolSizeColumns;
  67662. this.dataRegionSizeRows = dataRegionSizeRows;
  67663. this.dataRegionSizeColumns = dataRegionSizeColumns;
  67664. this.ecBlocks = ecBlocks;
  67665. // Calculate the total number of codewords
  67666. var total = 0;
  67667. var ecCodewords = ecBlocks.getECCodewords();
  67668. var ecbArray = ecBlocks.getECBlocks();
  67669. try {
  67670. for (var ecbArray_1 = __values(ecbArray), ecbArray_1_1 = ecbArray_1.next(); !ecbArray_1_1.done; ecbArray_1_1 = ecbArray_1.next()) {
  67671. var ecBlock = ecbArray_1_1.value;
  67672. total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
  67673. }
  67674. } catch (e_1_1) {
  67675. e_1 = {
  67676. error: e_1_1
  67677. };
  67678. } finally {
  67679. try {
  67680. if (ecbArray_1_1 && !ecbArray_1_1.done && (_a = ecbArray_1.return)) _a.call(ecbArray_1);
  67681. } finally {
  67682. if (e_1) throw e_1.error;
  67683. }
  67684. }
  67685. this.totalCodewords = total;
  67686. }
  67687. Version.prototype.getVersionNumber = function () {
  67688. return this.versionNumber;
  67689. };
  67690. Version.prototype.getSymbolSizeRows = function () {
  67691. return this.symbolSizeRows;
  67692. };
  67693. Version.prototype.getSymbolSizeColumns = function () {
  67694. return this.symbolSizeColumns;
  67695. };
  67696. Version.prototype.getDataRegionSizeRows = function () {
  67697. return this.dataRegionSizeRows;
  67698. };
  67699. Version.prototype.getDataRegionSizeColumns = function () {
  67700. return this.dataRegionSizeColumns;
  67701. };
  67702. Version.prototype.getTotalCodewords = function () {
  67703. return this.totalCodewords;
  67704. };
  67705. Version.prototype.getECBlocks = function () {
  67706. return this.ecBlocks;
  67707. };
  67708. /**
  67709. * <p>Deduces version information from Data Matrix dimensions.</p>
  67710. *
  67711. * @param numRows Number of rows in modules
  67712. * @param numColumns Number of columns in modules
  67713. * @return Version for a Data Matrix Code of those dimensions
  67714. * @throws FormatException if dimensions do correspond to a valid Data Matrix size
  67715. */
  67716. Version.getVersionForDimensions = function (numRows, numColumns) {
  67717. var e_2, _a;
  67718. if ((numRows & 0x01) !== 0 || (numColumns & 0x01) !== 0) {
  67719. throw new _FormatException.default();
  67720. }
  67721. try {
  67722. for (var _b = __values(Version.VERSIONS), _c = _b.next(); !_c.done; _c = _b.next()) {
  67723. var version = _c.value;
  67724. if (version.symbolSizeRows === numRows && version.symbolSizeColumns === numColumns) {
  67725. return version;
  67726. }
  67727. }
  67728. } catch (e_2_1) {
  67729. e_2 = {
  67730. error: e_2_1
  67731. };
  67732. } finally {
  67733. try {
  67734. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  67735. } finally {
  67736. if (e_2) throw e_2.error;
  67737. }
  67738. }
  67739. throw new _FormatException.default();
  67740. };
  67741. // @Override
  67742. Version.prototype.toString = function () {
  67743. return '' + this.versionNumber;
  67744. };
  67745. /**
  67746. * See ISO 16022:2006 5.5.1 Table 7
  67747. */
  67748. Version.buildVersions = function () {
  67749. return [new Version(1, 10, 10, 8, 8, new ECBlocks(5, new ECB(1, 3))), new Version(2, 12, 12, 10, 10, new ECBlocks(7, new ECB(1, 5))), new Version(3, 14, 14, 12, 12, new ECBlocks(10, new ECB(1, 8))), new Version(4, 16, 16, 14, 14, new ECBlocks(12, new ECB(1, 12))), new Version(5, 18, 18, 16, 16, new ECBlocks(14, new ECB(1, 18))), new Version(6, 20, 20, 18, 18, new ECBlocks(18, new ECB(1, 22))), new Version(7, 22, 22, 20, 20, new ECBlocks(20, new ECB(1, 30))), new Version(8, 24, 24, 22, 22, new ECBlocks(24, new ECB(1, 36))), new Version(9, 26, 26, 24, 24, new ECBlocks(28, new ECB(1, 44))), new Version(10, 32, 32, 14, 14, new ECBlocks(36, new ECB(1, 62))), new Version(11, 36, 36, 16, 16, new ECBlocks(42, new ECB(1, 86))), new Version(12, 40, 40, 18, 18, new ECBlocks(48, new ECB(1, 114))), new Version(13, 44, 44, 20, 20, new ECBlocks(56, new ECB(1, 144))), new Version(14, 48, 48, 22, 22, new ECBlocks(68, new ECB(1, 174))), new Version(15, 52, 52, 24, 24, new ECBlocks(42, new ECB(2, 102))), new Version(16, 64, 64, 14, 14, new ECBlocks(56, new ECB(2, 140))), new Version(17, 72, 72, 16, 16, new ECBlocks(36, new ECB(4, 92))), new Version(18, 80, 80, 18, 18, new ECBlocks(48, new ECB(4, 114))), new Version(19, 88, 88, 20, 20, new ECBlocks(56, new ECB(4, 144))), new Version(20, 96, 96, 22, 22, new ECBlocks(68, new ECB(4, 174))), new Version(21, 104, 104, 24, 24, new ECBlocks(56, new ECB(6, 136))), new Version(22, 120, 120, 18, 18, new ECBlocks(68, new ECB(6, 175))), new Version(23, 132, 132, 20, 20, new ECBlocks(62, new ECB(8, 163))), new Version(24, 144, 144, 22, 22, new ECBlocks(62, new ECB(8, 156), new ECB(2, 155))), new Version(25, 8, 18, 6, 16, new ECBlocks(7, new ECB(1, 5))), new Version(26, 8, 32, 6, 14, new ECBlocks(11, new ECB(1, 10))), new Version(27, 12, 26, 10, 24, new ECBlocks(14, new ECB(1, 16))), new Version(28, 12, 36, 10, 16, new ECBlocks(18, new ECB(1, 22))), new Version(29, 16, 36, 14, 16, new ECBlocks(24, new ECB(1, 32))), new Version(30, 16, 48, 14, 22, new ECBlocks(28, new ECB(1, 49)))];
  67750. };
  67751. Version.VERSIONS = Version.buildVersions();
  67752. return Version;
  67753. }();
  67754. var _default = Version;
  67755. exports.default = _default;
  67756. /***/ }),
  67757. /* 408 */
  67758. /*!************************************************************************************************!*\
  67759. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/DataBlock.js ***!
  67760. \************************************************************************************************/
  67761. /*! no static exports found */
  67762. /***/ (function(module, exports, __webpack_require__) {
  67763. "use strict";
  67764. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  67765. Object.defineProperty(exports, "__esModule", {
  67766. value: true
  67767. });
  67768. exports.default = void 0;
  67769. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  67770. var __values = void 0 && (void 0).__values || function (o) {
  67771. var s = typeof Symbol === "function" && Symbol.iterator,
  67772. m = s && o[s],
  67773. i = 0;
  67774. if (m) return m.call(o);
  67775. if (o && typeof o.length === "number") return {
  67776. next: function next() {
  67777. if (o && i >= o.length) o = void 0;
  67778. return {
  67779. value: o && o[i++],
  67780. done: !o
  67781. };
  67782. }
  67783. };
  67784. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  67785. };
  67786. /*
  67787. * Copyright 2008 ZXing authors
  67788. *
  67789. * Licensed under the Apache License, Version 2.0 (the "License");
  67790. * you may not use this file except in compliance with the License.
  67791. * You may obtain a copy of the License at
  67792. *
  67793. * http://www.apache.org/licenses/LICENSE-2.0
  67794. *
  67795. * Unless required by applicable law or agreed to in writing, software
  67796. * distributed under the License is distributed on an "AS IS" BASIS,
  67797. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  67798. * See the License for the specific language governing permissions and
  67799. * limitations under the License.
  67800. */
  67801. /**
  67802. * <p>Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into
  67803. * multiple blocks, each of which is a unit of data and error-correction codewords. Each
  67804. * is represented by an instance of this class.</p>
  67805. *
  67806. * @author bbrown@google.com (Brian Brown)
  67807. */
  67808. var DataBlock = /** @class */function () {
  67809. function DataBlock(numDataCodewords, codewords) {
  67810. this.numDataCodewords = numDataCodewords;
  67811. this.codewords = codewords;
  67812. }
  67813. /**
  67814. * <p>When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them.
  67815. * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This
  67816. * method will separate the data into original blocks.</p>
  67817. *
  67818. * @param rawCodewords bytes as read directly from the Data Matrix Code
  67819. * @param version version of the Data Matrix Code
  67820. * @return DataBlocks containing original bytes, "de-interleaved" from representation in the
  67821. * Data Matrix Code
  67822. */
  67823. DataBlock.getDataBlocks = function (rawCodewords, version) {
  67824. var e_1, _a, e_2, _b;
  67825. // Figure out the number and size of data blocks used by this version
  67826. var ecBlocks = version.getECBlocks();
  67827. // First count the total number of data blocks
  67828. var totalBlocks = 0;
  67829. var ecBlockArray = ecBlocks.getECBlocks();
  67830. try {
  67831. for (var ecBlockArray_1 = __values(ecBlockArray), ecBlockArray_1_1 = ecBlockArray_1.next(); !ecBlockArray_1_1.done; ecBlockArray_1_1 = ecBlockArray_1.next()) {
  67832. var ecBlock = ecBlockArray_1_1.value;
  67833. totalBlocks += ecBlock.getCount();
  67834. }
  67835. } catch (e_1_1) {
  67836. e_1 = {
  67837. error: e_1_1
  67838. };
  67839. } finally {
  67840. try {
  67841. if (ecBlockArray_1_1 && !ecBlockArray_1_1.done && (_a = ecBlockArray_1.return)) _a.call(ecBlockArray_1);
  67842. } finally {
  67843. if (e_1) throw e_1.error;
  67844. }
  67845. }
  67846. // Now establish DataBlocks of the appropriate size and number of data codewords
  67847. var result = new Array(totalBlocks);
  67848. var numResultBlocks = 0;
  67849. try {
  67850. for (var ecBlockArray_2 = __values(ecBlockArray), ecBlockArray_2_1 = ecBlockArray_2.next(); !ecBlockArray_2_1.done; ecBlockArray_2_1 = ecBlockArray_2.next()) {
  67851. var ecBlock = ecBlockArray_2_1.value;
  67852. for (var i = 0; i < ecBlock.getCount(); i++) {
  67853. var numDataCodewords = ecBlock.getDataCodewords();
  67854. var numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
  67855. result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
  67856. }
  67857. }
  67858. } catch (e_2_1) {
  67859. e_2 = {
  67860. error: e_2_1
  67861. };
  67862. } finally {
  67863. try {
  67864. if (ecBlockArray_2_1 && !ecBlockArray_2_1.done && (_b = ecBlockArray_2.return)) _b.call(ecBlockArray_2);
  67865. } finally {
  67866. if (e_2) throw e_2.error;
  67867. }
  67868. }
  67869. // All blocks have the same amount of data, except that the last n
  67870. // (where n may be 0) have 1 less byte. Figure out where these start.
  67871. // TODO(bbrown): There is only one case where there is a difference for Data Matrix for size 144
  67872. var longerBlocksTotalCodewords = result[0].codewords.length;
  67873. // int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;
  67874. var longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks.getECCodewords();
  67875. var shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
  67876. // The last elements of result may be 1 element shorter for 144 matrix
  67877. // first fill out as many elements as all of them have minus 1
  67878. var rawCodewordsOffset = 0;
  67879. for (var i = 0; i < shorterBlocksNumDataCodewords; i++) {
  67880. for (var j = 0; j < numResultBlocks; j++) {
  67881. result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
  67882. }
  67883. }
  67884. // Fill out the last data block in the longer ones
  67885. var specialVersion = version.getVersionNumber() === 24;
  67886. var numLongerBlocks = specialVersion ? 8 : numResultBlocks;
  67887. for (var j = 0; j < numLongerBlocks; j++) {
  67888. result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++];
  67889. }
  67890. // Now add in error correction blocks
  67891. var max = result[0].codewords.length;
  67892. for (var i = longerBlocksNumDataCodewords; i < max; i++) {
  67893. for (var j = 0; j < numResultBlocks; j++) {
  67894. var jOffset = specialVersion ? (j + 8) % numResultBlocks : j;
  67895. var iOffset = specialVersion && jOffset > 7 ? i - 1 : i;
  67896. result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
  67897. }
  67898. }
  67899. if (rawCodewordsOffset !== rawCodewords.length) {
  67900. throw new _IllegalArgumentException.default();
  67901. }
  67902. return result;
  67903. };
  67904. DataBlock.prototype.getNumDataCodewords = function () {
  67905. return this.numDataCodewords;
  67906. };
  67907. DataBlock.prototype.getCodewords = function () {
  67908. return this.codewords;
  67909. };
  67910. return DataBlock;
  67911. }();
  67912. var _default = DataBlock;
  67913. exports.default = _default;
  67914. /***/ }),
  67915. /* 409 */
  67916. /*!*************************************************************************************************************!*\
  67917. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/decoder/DecodedBitStreamParser.js ***!
  67918. \*************************************************************************************************************/
  67919. /*! no static exports found */
  67920. /***/ (function(module, exports, __webpack_require__) {
  67921. "use strict";
  67922. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  67923. Object.defineProperty(exports, "__esModule", {
  67924. value: true
  67925. });
  67926. exports.default = void 0;
  67927. var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
  67928. var _BitSource = _interopRequireDefault(__webpack_require__(/*! ../../common/BitSource */ 410));
  67929. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  67930. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
  67931. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  67932. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  67933. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalStateException */ 344));
  67934. /*
  67935. * Copyright 2008 ZXing authors
  67936. *
  67937. * Licensed under the Apache License, Version 2.0 (the "License");
  67938. * you may not use this file except in compliance with the License.
  67939. * You may obtain a copy of the License at
  67940. *
  67941. * http://www.apache.org/licenses/LICENSE-2.0
  67942. *
  67943. * Unless required by applicable law or agreed to in writing, software
  67944. * distributed under the License is distributed on an "AS IS" BASIS,
  67945. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  67946. * See the License for the specific language governing permissions and
  67947. * limitations under the License.
  67948. */
  67949. var Mode;
  67950. (function (Mode) {
  67951. Mode[Mode["PAD_ENCODE"] = 0] = "PAD_ENCODE";
  67952. Mode[Mode["ASCII_ENCODE"] = 1] = "ASCII_ENCODE";
  67953. Mode[Mode["C40_ENCODE"] = 2] = "C40_ENCODE";
  67954. Mode[Mode["TEXT_ENCODE"] = 3] = "TEXT_ENCODE";
  67955. Mode[Mode["ANSIX12_ENCODE"] = 4] = "ANSIX12_ENCODE";
  67956. Mode[Mode["EDIFACT_ENCODE"] = 5] = "EDIFACT_ENCODE";
  67957. Mode[Mode["BASE256_ENCODE"] = 6] = "BASE256_ENCODE";
  67958. })(Mode || (Mode = {}));
  67959. /**
  67960. * <p>Data Matrix Codes can encode text as bits in one of several modes, and can use multiple modes
  67961. * in one Data Matrix Code. This class decodes the bits back into text.</p>
  67962. *
  67963. * <p>See ISO 16022:2006, 5.2.1 - 5.2.9.2</p>
  67964. *
  67965. * @author bbrown@google.com (Brian Brown)
  67966. * @author Sean Owen
  67967. */
  67968. var DecodedBitStreamParser = /** @class */function () {
  67969. function DecodedBitStreamParser() {}
  67970. DecodedBitStreamParser.decode = function (bytes) {
  67971. var bits = new _BitSource.default(bytes);
  67972. var result = new _StringBuilder.default();
  67973. var resultTrailer = new _StringBuilder.default();
  67974. var byteSegments = new Array();
  67975. var mode = Mode.ASCII_ENCODE;
  67976. do {
  67977. if (mode === Mode.ASCII_ENCODE) {
  67978. mode = this.decodeAsciiSegment(bits, result, resultTrailer);
  67979. } else {
  67980. switch (mode) {
  67981. case Mode.C40_ENCODE:
  67982. this.decodeC40Segment(bits, result);
  67983. break;
  67984. case Mode.TEXT_ENCODE:
  67985. this.decodeTextSegment(bits, result);
  67986. break;
  67987. case Mode.ANSIX12_ENCODE:
  67988. this.decodeAnsiX12Segment(bits, result);
  67989. break;
  67990. case Mode.EDIFACT_ENCODE:
  67991. this.decodeEdifactSegment(bits, result);
  67992. break;
  67993. case Mode.BASE256_ENCODE:
  67994. this.decodeBase256Segment(bits, result, byteSegments);
  67995. break;
  67996. default:
  67997. throw new _FormatException.default();
  67998. }
  67999. mode = Mode.ASCII_ENCODE;
  68000. }
  68001. } while (mode !== Mode.PAD_ENCODE && bits.available() > 0);
  68002. if (resultTrailer.length() > 0) {
  68003. result.append(resultTrailer.toString());
  68004. }
  68005. return new _DecoderResult.default(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, null);
  68006. };
  68007. /**
  68008. * See ISO 16022:2006, 5.2.3 and Annex C, Table C.2
  68009. */
  68010. DecodedBitStreamParser.decodeAsciiSegment = function (bits, result, resultTrailer) {
  68011. var upperShift = false;
  68012. do {
  68013. var oneByte = bits.readBits(8);
  68014. if (oneByte === 0) {
  68015. throw new _FormatException.default();
  68016. } else if (oneByte <= 128) {
  68017. // ASCII data (ASCII value + 1)
  68018. if (upperShift) {
  68019. oneByte += 128;
  68020. // upperShift = false;
  68021. }
  68022. result.append(String.fromCharCode(oneByte - 1));
  68023. return Mode.ASCII_ENCODE;
  68024. } else if (oneByte === 129) {
  68025. // Pad
  68026. return Mode.PAD_ENCODE;
  68027. } else if (oneByte <= 229) {
  68028. // 2-digit data 00-99 (Numeric Value + 130)
  68029. var value = oneByte - 130;
  68030. if (value < 10) {
  68031. // pad with '0' for single digit values
  68032. result.append('0');
  68033. }
  68034. result.append('' + value);
  68035. } else {
  68036. switch (oneByte) {
  68037. case 230:
  68038. // Latch to C40 encodation
  68039. return Mode.C40_ENCODE;
  68040. case 231:
  68041. // Latch to Base 256 encodation
  68042. return Mode.BASE256_ENCODE;
  68043. case 232:
  68044. // FNC1
  68045. result.append(String.fromCharCode(29)); // translate as ASCII 29
  68046. break;
  68047. case 233: // Structured Append
  68048. case 234:
  68049. // Reader Programming
  68050. // Ignore these symbols for now
  68051. // throw ReaderException.getInstance();
  68052. break;
  68053. case 235:
  68054. // Upper Shift (shift to Extended ASCII)
  68055. upperShift = true;
  68056. break;
  68057. case 236:
  68058. // 05 Macro
  68059. result.append("[)>\x1E05\x1D");
  68060. resultTrailer.insert(0, "\x1E\x04");
  68061. break;
  68062. case 237:
  68063. // 06 Macro
  68064. result.append("[)>\x1E06\x1D");
  68065. resultTrailer.insert(0, "\x1E\x04");
  68066. break;
  68067. case 238:
  68068. // Latch to ANSI X12 encodation
  68069. return Mode.ANSIX12_ENCODE;
  68070. case 239:
  68071. // Latch to Text encodation
  68072. return Mode.TEXT_ENCODE;
  68073. case 240:
  68074. // Latch to EDIFACT encodation
  68075. return Mode.EDIFACT_ENCODE;
  68076. case 241:
  68077. // ECI Character
  68078. // TODO(bbrown): I think we need to support ECI
  68079. // throw ReaderException.getInstance();
  68080. // Ignore this symbol for now
  68081. break;
  68082. default:
  68083. // Not to be used in ASCII encodation
  68084. // but work around encoders that end with 254, latch back to ASCII
  68085. if (oneByte !== 254 || bits.available() !== 0) {
  68086. throw new _FormatException.default();
  68087. }
  68088. break;
  68089. }
  68090. }
  68091. } while (bits.available() > 0);
  68092. return Mode.ASCII_ENCODE;
  68093. };
  68094. /**
  68095. * See ISO 16022:2006, 5.2.5 and Annex C, Table C.1
  68096. */
  68097. DecodedBitStreamParser.decodeC40Segment = function (bits, result) {
  68098. // Three C40 values are encoded in a 16-bit value as
  68099. // (1600 * C1) + (40 * C2) + C3 + 1
  68100. // TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time
  68101. var upperShift = false;
  68102. var cValues = [];
  68103. var shift = 0;
  68104. do {
  68105. // If there is only one byte left then it will be encoded as ASCII
  68106. if (bits.available() === 8) {
  68107. return;
  68108. }
  68109. var firstByte = bits.readBits(8);
  68110. if (firstByte === 254) {
  68111. // Unlatch codeword
  68112. return;
  68113. }
  68114. this.parseTwoBytes(firstByte, bits.readBits(8), cValues);
  68115. for (var i = 0; i < 3; i++) {
  68116. var cValue = cValues[i];
  68117. switch (shift) {
  68118. case 0:
  68119. if (cValue < 3) {
  68120. shift = cValue + 1;
  68121. } else if (cValue < this.C40_BASIC_SET_CHARS.length) {
  68122. var c40char = this.C40_BASIC_SET_CHARS[cValue];
  68123. if (upperShift) {
  68124. result.append(String.fromCharCode(c40char.charCodeAt(0) + 128));
  68125. upperShift = false;
  68126. } else {
  68127. result.append(c40char);
  68128. }
  68129. } else {
  68130. throw new _FormatException.default();
  68131. }
  68132. break;
  68133. case 1:
  68134. if (upperShift) {
  68135. result.append(String.fromCharCode(cValue + 128));
  68136. upperShift = false;
  68137. } else {
  68138. result.append(String.fromCharCode(cValue));
  68139. }
  68140. shift = 0;
  68141. break;
  68142. case 2:
  68143. if (cValue < this.C40_SHIFT2_SET_CHARS.length) {
  68144. var c40char = this.C40_SHIFT2_SET_CHARS[cValue];
  68145. if (upperShift) {
  68146. result.append(String.fromCharCode(c40char.charCodeAt(0) + 128));
  68147. upperShift = false;
  68148. } else {
  68149. result.append(c40char);
  68150. }
  68151. } else {
  68152. switch (cValue) {
  68153. case 27:
  68154. // FNC1
  68155. result.append(String.fromCharCode(29)); // translate as ASCII 29
  68156. break;
  68157. case 30:
  68158. // Upper Shift
  68159. upperShift = true;
  68160. break;
  68161. default:
  68162. throw new _FormatException.default();
  68163. }
  68164. }
  68165. shift = 0;
  68166. break;
  68167. case 3:
  68168. if (upperShift) {
  68169. result.append(String.fromCharCode(cValue + 224));
  68170. upperShift = false;
  68171. } else {
  68172. result.append(String.fromCharCode(cValue + 96));
  68173. }
  68174. shift = 0;
  68175. break;
  68176. default:
  68177. throw new _FormatException.default();
  68178. }
  68179. }
  68180. } while (bits.available() > 0);
  68181. };
  68182. /**
  68183. * See ISO 16022:2006, 5.2.6 and Annex C, Table C.2
  68184. */
  68185. DecodedBitStreamParser.decodeTextSegment = function (bits, result) {
  68186. // Three Text values are encoded in a 16-bit value as
  68187. // (1600 * C1) + (40 * C2) + C3 + 1
  68188. // TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time
  68189. var upperShift = false;
  68190. var cValues = [];
  68191. var shift = 0;
  68192. do {
  68193. // If there is only one byte left then it will be encoded as ASCII
  68194. if (bits.available() === 8) {
  68195. return;
  68196. }
  68197. var firstByte = bits.readBits(8);
  68198. if (firstByte === 254) {
  68199. // Unlatch codeword
  68200. return;
  68201. }
  68202. this.parseTwoBytes(firstByte, bits.readBits(8), cValues);
  68203. for (var i = 0; i < 3; i++) {
  68204. var cValue = cValues[i];
  68205. switch (shift) {
  68206. case 0:
  68207. if (cValue < 3) {
  68208. shift = cValue + 1;
  68209. } else if (cValue < this.TEXT_BASIC_SET_CHARS.length) {
  68210. var textChar = this.TEXT_BASIC_SET_CHARS[cValue];
  68211. if (upperShift) {
  68212. result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));
  68213. upperShift = false;
  68214. } else {
  68215. result.append(textChar);
  68216. }
  68217. } else {
  68218. throw new _FormatException.default();
  68219. }
  68220. break;
  68221. case 1:
  68222. if (upperShift) {
  68223. result.append(String.fromCharCode(cValue + 128));
  68224. upperShift = false;
  68225. } else {
  68226. result.append(String.fromCharCode(cValue));
  68227. }
  68228. shift = 0;
  68229. break;
  68230. case 2:
  68231. // Shift 2 for Text is the same encoding as C40
  68232. if (cValue < this.TEXT_SHIFT2_SET_CHARS.length) {
  68233. var textChar = this.TEXT_SHIFT2_SET_CHARS[cValue];
  68234. if (upperShift) {
  68235. result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));
  68236. upperShift = false;
  68237. } else {
  68238. result.append(textChar);
  68239. }
  68240. } else {
  68241. switch (cValue) {
  68242. case 27:
  68243. // FNC1
  68244. result.append(String.fromCharCode(29)); // translate as ASCII 29
  68245. break;
  68246. case 30:
  68247. // Upper Shift
  68248. upperShift = true;
  68249. break;
  68250. default:
  68251. throw new _FormatException.default();
  68252. }
  68253. }
  68254. shift = 0;
  68255. break;
  68256. case 3:
  68257. if (cValue < this.TEXT_SHIFT3_SET_CHARS.length) {
  68258. var textChar = this.TEXT_SHIFT3_SET_CHARS[cValue];
  68259. if (upperShift) {
  68260. result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));
  68261. upperShift = false;
  68262. } else {
  68263. result.append(textChar);
  68264. }
  68265. shift = 0;
  68266. } else {
  68267. throw new _FormatException.default();
  68268. }
  68269. break;
  68270. default:
  68271. throw new _FormatException.default();
  68272. }
  68273. }
  68274. } while (bits.available() > 0);
  68275. };
  68276. /**
  68277. * See ISO 16022:2006, 5.2.7
  68278. */
  68279. DecodedBitStreamParser.decodeAnsiX12Segment = function (bits, result) {
  68280. // Three ANSI X12 values are encoded in a 16-bit value as
  68281. // (1600 * C1) + (40 * C2) + C3 + 1
  68282. var cValues = [];
  68283. do {
  68284. // If there is only one byte left then it will be encoded as ASCII
  68285. if (bits.available() === 8) {
  68286. return;
  68287. }
  68288. var firstByte = bits.readBits(8);
  68289. if (firstByte === 254) {
  68290. // Unlatch codeword
  68291. return;
  68292. }
  68293. this.parseTwoBytes(firstByte, bits.readBits(8), cValues);
  68294. for (var i = 0; i < 3; i++) {
  68295. var cValue = cValues[i];
  68296. switch (cValue) {
  68297. case 0:
  68298. // X12 segment terminator <CR>
  68299. result.append('\r');
  68300. break;
  68301. case 1:
  68302. // X12 segment separator *
  68303. result.append('*');
  68304. break;
  68305. case 2:
  68306. // X12 sub-element separator >
  68307. result.append('>');
  68308. break;
  68309. case 3:
  68310. // space
  68311. result.append(' ');
  68312. break;
  68313. default:
  68314. if (cValue < 14) {
  68315. // 0 - 9
  68316. result.append(String.fromCharCode(cValue + 44));
  68317. } else if (cValue < 40) {
  68318. // A - Z
  68319. result.append(String.fromCharCode(cValue + 51));
  68320. } else {
  68321. throw new _FormatException.default();
  68322. }
  68323. break;
  68324. }
  68325. }
  68326. } while (bits.available() > 0);
  68327. };
  68328. DecodedBitStreamParser.parseTwoBytes = function (firstByte, secondByte, result) {
  68329. var fullBitValue = (firstByte << 8) + secondByte - 1;
  68330. var temp = Math.floor(fullBitValue / 1600);
  68331. result[0] = temp;
  68332. fullBitValue -= temp * 1600;
  68333. temp = Math.floor(fullBitValue / 40);
  68334. result[1] = temp;
  68335. result[2] = fullBitValue - temp * 40;
  68336. };
  68337. /**
  68338. * See ISO 16022:2006, 5.2.8 and Annex C Table C.3
  68339. */
  68340. DecodedBitStreamParser.decodeEdifactSegment = function (bits, result) {
  68341. do {
  68342. // If there is only two or less bytes left then it will be encoded as ASCII
  68343. if (bits.available() <= 16) {
  68344. return;
  68345. }
  68346. for (var i = 0; i < 4; i++) {
  68347. var edifactValue = bits.readBits(6);
  68348. // Check for the unlatch character
  68349. if (edifactValue === 0x1F) {
  68350. // 011111
  68351. // Read rest of byte, which should be 0, and stop
  68352. var bitsLeft = 8 - bits.getBitOffset();
  68353. if (bitsLeft !== 8) {
  68354. bits.readBits(bitsLeft);
  68355. }
  68356. return;
  68357. }
  68358. if ((edifactValue & 0x20) === 0) {
  68359. // no 1 in the leading (6th) bit
  68360. edifactValue |= 0x40; // Add a leading 01 to the 6 bit binary value
  68361. }
  68362. result.append(String.fromCharCode(edifactValue));
  68363. }
  68364. } while (bits.available() > 0);
  68365. };
  68366. /**
  68367. * See ISO 16022:2006, 5.2.9 and Annex B, B.2
  68368. */
  68369. DecodedBitStreamParser.decodeBase256Segment = function (bits, result, byteSegments) {
  68370. // Figure out how long the Base 256 Segment is.
  68371. var codewordPosition = 1 + bits.getByteOffset(); // position is 1-indexed
  68372. var d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);
  68373. var count;
  68374. if (d1 === 0) {
  68375. // Read the remainder of the symbol
  68376. count = bits.available() / 8 | 0;
  68377. } else if (d1 < 250) {
  68378. count = d1;
  68379. } else {
  68380. count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
  68381. }
  68382. // We're seeing NegativeArraySizeException errors from users.
  68383. if (count < 0) {
  68384. throw new _FormatException.default();
  68385. }
  68386. var bytes = new Uint8Array(count);
  68387. for (var i = 0; i < count; i++) {
  68388. // Have seen this particular error in the wild, such as at
  68389. // http://www.bcgen.com/demo/IDAutomationStreamingDataMatrix.aspx?MODE=3&D=Fred&PFMT=3&PT=F&X=0.3&O=0&LM=0.2
  68390. if (bits.available() < 8) {
  68391. throw new _FormatException.default();
  68392. }
  68393. bytes[i] = this.unrandomize255State(bits.readBits(8), codewordPosition++);
  68394. }
  68395. byteSegments.push(bytes);
  68396. try {
  68397. result.append(_StringEncoding.default.decode(bytes, _StringUtils.default.ISO88591));
  68398. } catch (uee) {
  68399. throw new _IllegalStateException.default('Platform does not support required encoding: ' + uee.message);
  68400. }
  68401. };
  68402. /**
  68403. * See ISO 16022:2006, Annex B, B.2
  68404. */
  68405. DecodedBitStreamParser.unrandomize255State = function (randomizedBase256Codeword, base256CodewordPosition) {
  68406. var pseudoRandomNumber = 149 * base256CodewordPosition % 255 + 1;
  68407. var tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
  68408. return tempVariable >= 0 ? tempVariable : tempVariable + 256;
  68409. };
  68410. /**
  68411. * See ISO 16022:2006, Annex C Table C.1
  68412. * The C40 Basic Character Set (*'s used for placeholders for the shift values)
  68413. */
  68414. DecodedBitStreamParser.C40_BASIC_SET_CHARS = ['*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
  68415. DecodedBitStreamParser.C40_SHIFT2_SET_CHARS = ['!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_'];
  68416. /**
  68417. * See ISO 16022:2006, Annex C Table C.2
  68418. * The Text Basic Character Set (*'s used for placeholders for the shift values)
  68419. */
  68420. DecodedBitStreamParser.TEXT_BASIC_SET_CHARS = ['*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
  68421. // Shift 2 for Text is the same encoding as C40
  68422. DecodedBitStreamParser.TEXT_SHIFT2_SET_CHARS = DecodedBitStreamParser.C40_SHIFT2_SET_CHARS;
  68423. DecodedBitStreamParser.TEXT_SHIFT3_SET_CHARS = ['`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', String.fromCharCode(127)];
  68424. return DecodedBitStreamParser;
  68425. }();
  68426. var _default = DecodedBitStreamParser;
  68427. exports.default = _default;
  68428. /***/ }),
  68429. /* 410 */
  68430. /*!************************************************************************************!*\
  68431. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/BitSource.js ***!
  68432. \************************************************************************************/
  68433. /*! no static exports found */
  68434. /***/ (function(module, exports, __webpack_require__) {
  68435. "use strict";
  68436. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  68437. Object.defineProperty(exports, "__esModule", {
  68438. value: true
  68439. });
  68440. exports.default = void 0;
  68441. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  68442. /*
  68443. * Copyright 2007 ZXing authors
  68444. *
  68445. * Licensed under the Apache License, Version 2.0 (the "License");
  68446. * you may not use this file except in compliance with the License.
  68447. * You may obtain a copy of the License at
  68448. *
  68449. * http://www.apache.org/licenses/LICENSE-2.0
  68450. *
  68451. * Unless required by applicable law or agreed to in writing, software
  68452. * distributed under the License is distributed on an "AS IS" BASIS,
  68453. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  68454. * See the License for the specific language governing permissions and
  68455. * limitations under the License.
  68456. */
  68457. /*namespace com.google.zxing.common {*/
  68458. /**
  68459. * <p>This provides an easy abstraction to read bits at a time from a sequence of bytes, where the
  68460. * number of bits read is not often a multiple of 8.</p>
  68461. *
  68462. * <p>This class is thread-safe but not reentrant -- unless the caller modifies the bytes array
  68463. * it passed in, in which case all bets are off.</p>
  68464. *
  68465. * @author Sean Owen
  68466. */
  68467. var BitSource = /** @class */function () {
  68468. /**
  68469. * @param bytes bytes from which this will read bits. Bits will be read from the first byte first.
  68470. * Bits are read within a byte from most-significant to least-significant bit.
  68471. */
  68472. function BitSource(bytes) {
  68473. this.bytes = bytes;
  68474. this.byteOffset = 0;
  68475. this.bitOffset = 0;
  68476. }
  68477. /**
  68478. * @return index of next bit in current byte which would be read by the next call to {@link #readBits(int)}.
  68479. */
  68480. BitSource.prototype.getBitOffset = function () {
  68481. return this.bitOffset;
  68482. };
  68483. /**
  68484. * @return index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}.
  68485. */
  68486. BitSource.prototype.getByteOffset = function () {
  68487. return this.byteOffset;
  68488. };
  68489. /**
  68490. * @param numBits number of bits to read
  68491. * @return int representing the bits read. The bits will appear as the least-significant
  68492. * bits of the int
  68493. * @throws IllegalArgumentException if numBits isn't in [1,32] or more than is available
  68494. */
  68495. BitSource.prototype.readBits = function (numBits /*int*/) {
  68496. if (numBits < 1 || numBits > 32 || numBits > this.available()) {
  68497. throw new _IllegalArgumentException.default('' + numBits);
  68498. }
  68499. var result = 0;
  68500. var bitOffset = this.bitOffset;
  68501. var byteOffset = this.byteOffset;
  68502. var bytes = this.bytes;
  68503. // First, read remainder from current byte
  68504. if (bitOffset > 0) {
  68505. var bitsLeft = 8 - bitOffset;
  68506. var toRead = numBits < bitsLeft ? numBits : bitsLeft;
  68507. var bitsToNotRead = bitsLeft - toRead;
  68508. var mask = 0xFF >> 8 - toRead << bitsToNotRead;
  68509. result = (bytes[byteOffset] & mask) >> bitsToNotRead;
  68510. numBits -= toRead;
  68511. bitOffset += toRead;
  68512. if (bitOffset === 8) {
  68513. bitOffset = 0;
  68514. byteOffset++;
  68515. }
  68516. }
  68517. // Next read whole bytes
  68518. if (numBits > 0) {
  68519. while (numBits >= 8) {
  68520. result = result << 8 | bytes[byteOffset] & 0xFF;
  68521. byteOffset++;
  68522. numBits -= 8;
  68523. }
  68524. // Finally read a partial byte
  68525. if (numBits > 0) {
  68526. var bitsToNotRead = 8 - numBits;
  68527. var mask = 0xFF >> bitsToNotRead << bitsToNotRead;
  68528. result = result << numBits | (bytes[byteOffset] & mask) >> bitsToNotRead;
  68529. bitOffset += numBits;
  68530. }
  68531. }
  68532. this.bitOffset = bitOffset;
  68533. this.byteOffset = byteOffset;
  68534. return result;
  68535. };
  68536. /**
  68537. * @return number of bits that can be read successfully
  68538. */
  68539. BitSource.prototype.available = function () {
  68540. return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;
  68541. };
  68542. return BitSource;
  68543. }();
  68544. var _default = BitSource;
  68545. exports.default = _default;
  68546. /***/ }),
  68547. /* 411 */
  68548. /*!************************************************************************************************!*\
  68549. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/detector/Detector.js ***!
  68550. \************************************************************************************************/
  68551. /*! no static exports found */
  68552. /***/ (function(module, exports, __webpack_require__) {
  68553. "use strict";
  68554. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  68555. Object.defineProperty(exports, "__esModule", {
  68556. value: true
  68557. });
  68558. exports.default = void 0;
  68559. var _WhiteRectangleDetector = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/WhiteRectangleDetector */ 351));
  68560. var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DetectorResult */ 350));
  68561. var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ../../common/GridSamplerInstance */ 352));
  68562. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  68563. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  68564. /*
  68565. * Copyright 2008 ZXing authors
  68566. *
  68567. * Licensed under the Apache License, Version 2.0 (the "License");
  68568. * you may not use this file except in compliance with the License.
  68569. * You may obtain a copy of the License at
  68570. *
  68571. * http://www.apache.org/licenses/LICENSE-2.0
  68572. *
  68573. * Unless required by applicable law or agreed to in writing, software
  68574. * distributed under the License is distributed on an "AS IS" BASIS,
  68575. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  68576. * See the License for the specific language governing permissions and
  68577. * limitations under the License.
  68578. */
  68579. /**
  68580. * <p>Encapsulates logic that can detect a Data Matrix Code in an image, even if the Data Matrix Code
  68581. * is rotated or skewed, or partially obscured.</p>
  68582. *
  68583. * @author Sean Owen
  68584. */
  68585. var Detector = /** @class */function () {
  68586. function Detector(image) {
  68587. this.image = image;
  68588. this.rectangleDetector = new _WhiteRectangleDetector.default(this.image);
  68589. }
  68590. /**
  68591. * <p>Detects a Data Matrix Code in an image.</p>
  68592. *
  68593. * @return {@link DetectorResult} encapsulating results of detecting a Data Matrix Code
  68594. * @throws NotFoundException if no Data Matrix Code can be found
  68595. */
  68596. Detector.prototype.detect = function () {
  68597. var cornerPoints = this.rectangleDetector.detect();
  68598. var points = this.detectSolid1(cornerPoints);
  68599. points = this.detectSolid2(points);
  68600. points[3] = this.correctTopRight(points);
  68601. if (!points[3]) {
  68602. throw new _NotFoundException.default();
  68603. }
  68604. points = this.shiftToModuleCenter(points);
  68605. var topLeft = points[0];
  68606. var bottomLeft = points[1];
  68607. var bottomRight = points[2];
  68608. var topRight = points[3];
  68609. var dimensionTop = this.transitionsBetween(topLeft, topRight) + 1;
  68610. var dimensionRight = this.transitionsBetween(bottomRight, topRight) + 1;
  68611. if ((dimensionTop & 0x01) === 1) {
  68612. dimensionTop += 1;
  68613. }
  68614. if ((dimensionRight & 0x01) === 1) {
  68615. dimensionRight += 1;
  68616. }
  68617. if (4 * dimensionTop < 7 * dimensionRight && 4 * dimensionRight < 7 * dimensionTop) {
  68618. // The matrix is square
  68619. dimensionTop = dimensionRight = Math.max(dimensionTop, dimensionRight);
  68620. }
  68621. var bits = Detector.sampleGrid(this.image, topLeft, bottomLeft, bottomRight, topRight, dimensionTop, dimensionRight);
  68622. return new _DetectorResult.default(bits, [topLeft, bottomLeft, bottomRight, topRight]);
  68623. };
  68624. Detector.shiftPoint = function (point, to, div) {
  68625. var x = (to.getX() - point.getX()) / (div + 1);
  68626. var y = (to.getY() - point.getY()) / (div + 1);
  68627. return new _ResultPoint.default(point.getX() + x, point.getY() + y);
  68628. };
  68629. Detector.moveAway = function (point, fromX, fromY) {
  68630. var x = point.getX();
  68631. var y = point.getY();
  68632. if (x < fromX) {
  68633. x -= 1;
  68634. } else {
  68635. x += 1;
  68636. }
  68637. if (y < fromY) {
  68638. y -= 1;
  68639. } else {
  68640. y += 1;
  68641. }
  68642. return new _ResultPoint.default(x, y);
  68643. };
  68644. /**
  68645. * Detect a solid side which has minimum transition.
  68646. */
  68647. Detector.prototype.detectSolid1 = function (cornerPoints) {
  68648. // 0 2
  68649. // 1 3
  68650. var pointA = cornerPoints[0];
  68651. var pointB = cornerPoints[1];
  68652. var pointC = cornerPoints[3];
  68653. var pointD = cornerPoints[2];
  68654. var trAB = this.transitionsBetween(pointA, pointB);
  68655. var trBC = this.transitionsBetween(pointB, pointC);
  68656. var trCD = this.transitionsBetween(pointC, pointD);
  68657. var trDA = this.transitionsBetween(pointD, pointA);
  68658. // 0..3
  68659. // : :
  68660. // 1--2
  68661. var min = trAB;
  68662. var points = [pointD, pointA, pointB, pointC];
  68663. if (min > trBC) {
  68664. min = trBC;
  68665. points[0] = pointA;
  68666. points[1] = pointB;
  68667. points[2] = pointC;
  68668. points[3] = pointD;
  68669. }
  68670. if (min > trCD) {
  68671. min = trCD;
  68672. points[0] = pointB;
  68673. points[1] = pointC;
  68674. points[2] = pointD;
  68675. points[3] = pointA;
  68676. }
  68677. if (min > trDA) {
  68678. points[0] = pointC;
  68679. points[1] = pointD;
  68680. points[2] = pointA;
  68681. points[3] = pointB;
  68682. }
  68683. return points;
  68684. };
  68685. /**
  68686. * Detect a second solid side next to first solid side.
  68687. */
  68688. Detector.prototype.detectSolid2 = function (points) {
  68689. // A..D
  68690. // : :
  68691. // B--C
  68692. var pointA = points[0];
  68693. var pointB = points[1];
  68694. var pointC = points[2];
  68695. var pointD = points[3];
  68696. // Transition detection on the edge is not stable.
  68697. // To safely detect, shift the points to the module center.
  68698. var tr = this.transitionsBetween(pointA, pointD);
  68699. var pointBs = Detector.shiftPoint(pointB, pointC, (tr + 1) * 4);
  68700. var pointCs = Detector.shiftPoint(pointC, pointB, (tr + 1) * 4);
  68701. var trBA = this.transitionsBetween(pointBs, pointA);
  68702. var trCD = this.transitionsBetween(pointCs, pointD);
  68703. // 0..3
  68704. // | :
  68705. // 1--2
  68706. if (trBA < trCD) {
  68707. // solid sides: A-B-C
  68708. points[0] = pointA;
  68709. points[1] = pointB;
  68710. points[2] = pointC;
  68711. points[3] = pointD;
  68712. } else {
  68713. // solid sides: B-C-D
  68714. points[0] = pointB;
  68715. points[1] = pointC;
  68716. points[2] = pointD;
  68717. points[3] = pointA;
  68718. }
  68719. return points;
  68720. };
  68721. /**
  68722. * Calculates the corner position of the white top right module.
  68723. */
  68724. Detector.prototype.correctTopRight = function (points) {
  68725. // A..D
  68726. // | :
  68727. // B--C
  68728. var pointA = points[0];
  68729. var pointB = points[1];
  68730. var pointC = points[2];
  68731. var pointD = points[3];
  68732. // shift points for safe transition detection.
  68733. var trTop = this.transitionsBetween(pointA, pointD);
  68734. var trRight = this.transitionsBetween(pointB, pointD);
  68735. var pointAs = Detector.shiftPoint(pointA, pointB, (trRight + 1) * 4);
  68736. var pointCs = Detector.shiftPoint(pointC, pointB, (trTop + 1) * 4);
  68737. trTop = this.transitionsBetween(pointAs, pointD);
  68738. trRight = this.transitionsBetween(pointCs, pointD);
  68739. var candidate1 = new _ResultPoint.default(pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1), pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));
  68740. var candidate2 = new _ResultPoint.default(pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1), pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));
  68741. if (!this.isValid(candidate1)) {
  68742. if (this.isValid(candidate2)) {
  68743. return candidate2;
  68744. }
  68745. return null;
  68746. }
  68747. if (!this.isValid(candidate2)) {
  68748. return candidate1;
  68749. }
  68750. var sumc1 = this.transitionsBetween(pointAs, candidate1) + this.transitionsBetween(pointCs, candidate1);
  68751. var sumc2 = this.transitionsBetween(pointAs, candidate2) + this.transitionsBetween(pointCs, candidate2);
  68752. if (sumc1 > sumc2) {
  68753. return candidate1;
  68754. } else {
  68755. return candidate2;
  68756. }
  68757. };
  68758. /**
  68759. * Shift the edge points to the module center.
  68760. */
  68761. Detector.prototype.shiftToModuleCenter = function (points) {
  68762. // A..D
  68763. // | :
  68764. // B--C
  68765. var pointA = points[0];
  68766. var pointB = points[1];
  68767. var pointC = points[2];
  68768. var pointD = points[3];
  68769. // calculate pseudo dimensions
  68770. var dimH = this.transitionsBetween(pointA, pointD) + 1;
  68771. var dimV = this.transitionsBetween(pointC, pointD) + 1;
  68772. // shift points for safe dimension detection
  68773. var pointAs = Detector.shiftPoint(pointA, pointB, dimV * 4);
  68774. var pointCs = Detector.shiftPoint(pointC, pointB, dimH * 4);
  68775. // calculate more precise dimensions
  68776. dimH = this.transitionsBetween(pointAs, pointD) + 1;
  68777. dimV = this.transitionsBetween(pointCs, pointD) + 1;
  68778. if ((dimH & 0x01) === 1) {
  68779. dimH += 1;
  68780. }
  68781. if ((dimV & 0x01) === 1) {
  68782. dimV += 1;
  68783. }
  68784. // WhiteRectangleDetector returns points inside of the rectangle.
  68785. // I want points on the edges.
  68786. var centerX = (pointA.getX() + pointB.getX() + pointC.getX() + pointD.getX()) / 4;
  68787. var centerY = (pointA.getY() + pointB.getY() + pointC.getY() + pointD.getY()) / 4;
  68788. pointA = Detector.moveAway(pointA, centerX, centerY);
  68789. pointB = Detector.moveAway(pointB, centerX, centerY);
  68790. pointC = Detector.moveAway(pointC, centerX, centerY);
  68791. pointD = Detector.moveAway(pointD, centerX, centerY);
  68792. var pointBs;
  68793. var pointDs;
  68794. // shift points to the center of each modules
  68795. pointAs = Detector.shiftPoint(pointA, pointB, dimV * 4);
  68796. pointAs = Detector.shiftPoint(pointAs, pointD, dimH * 4);
  68797. pointBs = Detector.shiftPoint(pointB, pointA, dimV * 4);
  68798. pointBs = Detector.shiftPoint(pointBs, pointC, dimH * 4);
  68799. pointCs = Detector.shiftPoint(pointC, pointD, dimV * 4);
  68800. pointCs = Detector.shiftPoint(pointCs, pointB, dimH * 4);
  68801. pointDs = Detector.shiftPoint(pointD, pointC, dimV * 4);
  68802. pointDs = Detector.shiftPoint(pointDs, pointA, dimH * 4);
  68803. return [pointAs, pointBs, pointCs, pointDs];
  68804. };
  68805. Detector.prototype.isValid = function (p) {
  68806. return p.getX() >= 0 && p.getX() < this.image.getWidth() && p.getY() > 0 && p.getY() < this.image.getHeight();
  68807. };
  68808. Detector.sampleGrid = function (image, topLeft, bottomLeft, bottomRight, topRight, dimensionX, dimensionY) {
  68809. var sampler = _GridSamplerInstance.default.getInstance();
  68810. return sampler.sampleGrid(image, dimensionX, dimensionY, 0.5, 0.5, dimensionX - 0.5, 0.5, dimensionX - 0.5, dimensionY - 0.5, 0.5, dimensionY - 0.5, topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRight.getX(), bottomRight.getY(), bottomLeft.getX(), bottomLeft.getY());
  68811. };
  68812. /**
  68813. * Counts the number of black/white transitions between two points, using something like Bresenham's algorithm.
  68814. */
  68815. Detector.prototype.transitionsBetween = function (from, to) {
  68816. // See QR Code Detector, sizeOfBlackWhiteBlackRun()
  68817. var fromX = Math.trunc(from.getX());
  68818. var fromY = Math.trunc(from.getY());
  68819. var toX = Math.trunc(to.getX());
  68820. var toY = Math.trunc(to.getY());
  68821. var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
  68822. if (steep) {
  68823. var temp = fromX;
  68824. fromX = fromY;
  68825. fromY = temp;
  68826. temp = toX;
  68827. toX = toY;
  68828. toY = temp;
  68829. }
  68830. var dx = Math.abs(toX - fromX);
  68831. var dy = Math.abs(toY - fromY);
  68832. var error = -dx / 2;
  68833. var ystep = fromY < toY ? 1 : -1;
  68834. var xstep = fromX < toX ? 1 : -1;
  68835. var transitions = 0;
  68836. var inBlack = this.image.get(steep ? fromY : fromX, steep ? fromX : fromY);
  68837. for (var x = fromX, y = fromY; x !== toX; x += xstep) {
  68838. var isBlack = this.image.get(steep ? y : x, steep ? x : y);
  68839. if (isBlack !== inBlack) {
  68840. transitions++;
  68841. inBlack = isBlack;
  68842. }
  68843. error += dy;
  68844. if (error > 0) {
  68845. if (y === toY) {
  68846. break;
  68847. }
  68848. y += ystep;
  68849. error -= dx;
  68850. }
  68851. }
  68852. return transitions;
  68853. };
  68854. return Detector;
  68855. }();
  68856. var _default = Detector;
  68857. exports.default = _default;
  68858. /***/ }),
  68859. /* 412 */
  68860. /*!***********************************************************************************************!*\
  68861. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserMultiFormatReader.js ***!
  68862. \***********************************************************************************************/
  68863. /*! no static exports found */
  68864. /***/ (function(module, exports, __webpack_require__) {
  68865. "use strict";
  68866. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  68867. Object.defineProperty(exports, "__esModule", {
  68868. value: true
  68869. });
  68870. exports.BrowserMultiFormatReader = void 0;
  68871. var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
  68872. var _MultiFormatReader = _interopRequireDefault(__webpack_require__(/*! ../core/MultiFormatReader */ 413));
  68873. var __extends = void 0 && (void 0).__extends || function () {
  68874. var _extendStatics = function extendStatics(d, b) {
  68875. _extendStatics = Object.setPrototypeOf || {
  68876. __proto__: []
  68877. } instanceof Array && function (d, b) {
  68878. d.__proto__ = b;
  68879. } || function (d, b) {
  68880. for (var p in b) {
  68881. if (b.hasOwnProperty(p)) d[p] = b[p];
  68882. }
  68883. };
  68884. return _extendStatics(d, b);
  68885. };
  68886. return function (d, b) {
  68887. _extendStatics(d, b);
  68888. function __() {
  68889. this.constructor = d;
  68890. }
  68891. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  68892. };
  68893. }();
  68894. var BrowserMultiFormatReader = /** @class */function (_super) {
  68895. __extends(BrowserMultiFormatReader, _super);
  68896. function BrowserMultiFormatReader(hints, timeBetweenScansMillis) {
  68897. if (hints === void 0) {
  68898. hints = null;
  68899. }
  68900. if (timeBetweenScansMillis === void 0) {
  68901. timeBetweenScansMillis = 500;
  68902. }
  68903. var _this = this;
  68904. var reader = new _MultiFormatReader.default();
  68905. reader.setHints(hints);
  68906. _this = _super.call(this, reader, timeBetweenScansMillis) || this;
  68907. return _this;
  68908. }
  68909. /**
  68910. * Overwrite decodeBitmap to call decodeWithState, which will pay
  68911. * attention to the hints set in the constructor function
  68912. */
  68913. BrowserMultiFormatReader.prototype.decodeBitmap = function (binaryBitmap) {
  68914. return this.reader.decodeWithState(binaryBitmap);
  68915. };
  68916. return BrowserMultiFormatReader;
  68917. }(_BrowserCodeReader.BrowserCodeReader);
  68918. exports.BrowserMultiFormatReader = BrowserMultiFormatReader;
  68919. /***/ }),
  68920. /* 413 */
  68921. /*!*************************************************************************************!*\
  68922. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/MultiFormatReader.js ***!
  68923. \*************************************************************************************/
  68924. /*! no static exports found */
  68925. /***/ (function(module, exports, __webpack_require__) {
  68926. "use strict";
  68927. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  68928. Object.defineProperty(exports, "__esModule", {
  68929. value: true
  68930. });
  68931. exports.default = void 0;
  68932. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ./DecodeHintType */ 322));
  68933. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ./BarcodeFormat */ 334));
  68934. var _QRCodeReader = _interopRequireDefault(__webpack_require__(/*! ./qrcode/QRCodeReader */ 414));
  68935. var _AztecReader = _interopRequireDefault(__webpack_require__(/*! ./aztec/AztecReader */ 332));
  68936. var _MultiFormatOneDReader = _interopRequireDefault(__webpack_require__(/*! ./oned/MultiFormatOneDReader */ 357));
  68937. var _DataMatrixReader = _interopRequireDefault(__webpack_require__(/*! ./datamatrix/DataMatrixReader */ 404));
  68938. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ./NotFoundException */ 327));
  68939. var _PDF417Reader = _interopRequireDefault(__webpack_require__(/*! ./pdf417/PDF417Reader */ 433));
  68940. var _ReaderException = _interopRequireDefault(__webpack_require__(/*! ./ReaderException */ 458));
  68941. /*
  68942. * Copyright 2009 ZXing authors
  68943. *
  68944. * Licensed under the Apache License, Version 2.0 (the "License");
  68945. * you may not use this file except in compliance with the License.
  68946. * You may obtain a copy of the License at
  68947. *
  68948. * http://www.apache.org/licenses/LICENSE-2.0
  68949. *
  68950. * Unless required by applicable law or agreed to in writing, software
  68951. * distributed under the License is distributed on an "AS IS" BASIS,
  68952. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  68953. * See the License for the specific language governing permissions and
  68954. * limitations under the License.
  68955. */
  68956. var __values = void 0 && (void 0).__values || function (o) {
  68957. var s = typeof Symbol === "function" && Symbol.iterator,
  68958. m = s && o[s],
  68959. i = 0;
  68960. if (m) return m.call(o);
  68961. if (o && typeof o.length === "number") return {
  68962. next: function next() {
  68963. if (o && i >= o.length) o = void 0;
  68964. return {
  68965. value: o && o[i++],
  68966. done: !o
  68967. };
  68968. }
  68969. };
  68970. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  68971. };
  68972. /*namespace com.google.zxing {*/
  68973. /**
  68974. * MultiFormatReader is a convenience class and the main entry point into the library for most uses.
  68975. * By default it attempts to decode all barcode formats that the library supports. Optionally, you
  68976. * can provide a hints object to request different behavior, for example only decoding QR codes.
  68977. *
  68978. * @author Sean Owen
  68979. * @author dswitkin@google.com (Daniel Switkin)
  68980. */
  68981. var MultiFormatReader = /** @class */function () {
  68982. function MultiFormatReader() {}
  68983. /**
  68984. * This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it
  68985. * passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly.
  68986. * Use setHints() followed by decodeWithState() for continuous scan applications.
  68987. *
  68988. * @param image The pixel data to decode
  68989. * @return The contents of the image
  68990. *
  68991. * @throws NotFoundException Any errors which occurred
  68992. */
  68993. /*@Override*/
  68994. // public decode(image: BinaryBitmap): Result {
  68995. // setHints(null)
  68996. // return decodeInternal(image)
  68997. // }
  68998. /**
  68999. * Decode an image using the hints provided. Does not honor existing state.
  69000. *
  69001. * @param image The pixel data to decode
  69002. * @param hints The hints to use, clearing the previous state.
  69003. * @return The contents of the image
  69004. *
  69005. * @throws NotFoundException Any errors which occurred
  69006. */
  69007. /*@Override*/
  69008. MultiFormatReader.prototype.decode = function (image, hints) {
  69009. this.setHints(hints);
  69010. return this.decodeInternal(image);
  69011. };
  69012. /**
  69013. * Decode an image using the state set up by calling setHints() previously. Continuous scan
  69014. * clients will get a <b>large</b> speed increase by using this instead of decode().
  69015. *
  69016. * @param image The pixel data to decode
  69017. * @return The contents of the image
  69018. *
  69019. * @throws NotFoundException Any errors which occurred
  69020. */
  69021. MultiFormatReader.prototype.decodeWithState = function (image) {
  69022. // Make sure to set up the default state so we don't crash
  69023. if (this.readers === null || this.readers === undefined) {
  69024. this.setHints(null);
  69025. }
  69026. return this.decodeInternal(image);
  69027. };
  69028. /**
  69029. * This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls
  69030. * to decodeWithState(image) can reuse the same set of readers without reallocating memory. This
  69031. * is important for performance in continuous scan clients.
  69032. *
  69033. * @param hints The set of hints to use for subsequent calls to decode(image)
  69034. */
  69035. MultiFormatReader.prototype.setHints = function (hints) {
  69036. this.hints = hints;
  69037. var tryHarder = hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.TRY_HARDER);
  69038. /*@SuppressWarnings("unchecked")*/
  69039. var formats = hints === null || hints === undefined ? null : hints.get(_DecodeHintType.default.POSSIBLE_FORMATS);
  69040. var readers = new Array();
  69041. if (formats !== null && formats !== undefined) {
  69042. var addOneDReader = formats.some(function (f) {
  69043. return f === _BarcodeFormat.default.UPC_A || f === _BarcodeFormat.default.UPC_E || f === _BarcodeFormat.default.EAN_13 || f === _BarcodeFormat.default.EAN_8 || f === _BarcodeFormat.default.CODABAR || f === _BarcodeFormat.default.CODE_39 || f === _BarcodeFormat.default.CODE_93 || f === _BarcodeFormat.default.CODE_128 || f === _BarcodeFormat.default.ITF || f === _BarcodeFormat.default.RSS_14 || f === _BarcodeFormat.default.RSS_EXPANDED;
  69044. });
  69045. // Put 1D readers upfront in "normal" mode
  69046. // TYPESCRIPTPORT: TODO: uncomment below as they are ported
  69047. if (addOneDReader && !tryHarder) {
  69048. readers.push(new _MultiFormatOneDReader.default(hints));
  69049. }
  69050. if (formats.includes(_BarcodeFormat.default.QR_CODE)) {
  69051. readers.push(new _QRCodeReader.default());
  69052. }
  69053. if (formats.includes(_BarcodeFormat.default.DATA_MATRIX)) {
  69054. readers.push(new _DataMatrixReader.default());
  69055. }
  69056. if (formats.includes(_BarcodeFormat.default.AZTEC)) {
  69057. readers.push(new _AztecReader.default());
  69058. }
  69059. if (formats.includes(_BarcodeFormat.default.PDF_417)) {
  69060. readers.push(new _PDF417Reader.default());
  69061. }
  69062. // if (formats.includes(BarcodeFormat.MAXICODE)) {
  69063. // readers.push(new MaxiCodeReader())
  69064. // }
  69065. // At end in "try harder" mode
  69066. if (addOneDReader && tryHarder) {
  69067. readers.push(new _MultiFormatOneDReader.default(hints));
  69068. }
  69069. }
  69070. if (readers.length === 0) {
  69071. if (!tryHarder) {
  69072. readers.push(new _MultiFormatOneDReader.default(hints));
  69073. }
  69074. readers.push(new _QRCodeReader.default());
  69075. readers.push(new _DataMatrixReader.default());
  69076. readers.push(new _AztecReader.default());
  69077. readers.push(new _PDF417Reader.default());
  69078. // readers.push(new MaxiCodeReader())
  69079. if (tryHarder) {
  69080. readers.push(new _MultiFormatOneDReader.default(hints));
  69081. }
  69082. }
  69083. this.readers = readers; // .toArray(new Reader[readers.size()])
  69084. };
  69085. /*@Override*/
  69086. MultiFormatReader.prototype.reset = function () {
  69087. var e_1, _a;
  69088. if (this.readers !== null) {
  69089. try {
  69090. for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
  69091. var reader = _c.value;
  69092. reader.reset();
  69093. }
  69094. } catch (e_1_1) {
  69095. e_1 = {
  69096. error: e_1_1
  69097. };
  69098. } finally {
  69099. try {
  69100. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  69101. } finally {
  69102. if (e_1) throw e_1.error;
  69103. }
  69104. }
  69105. }
  69106. };
  69107. /**
  69108. * @throws NotFoundException
  69109. */
  69110. MultiFormatReader.prototype.decodeInternal = function (image) {
  69111. var e_2, _a;
  69112. if (this.readers === null) {
  69113. throw new _ReaderException.default('No readers where selected, nothing can be read.');
  69114. }
  69115. try {
  69116. for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
  69117. var reader = _c.value;
  69118. // Trying to decode with ${reader} reader.
  69119. try {
  69120. return reader.decode(image, this.hints);
  69121. } catch (ex) {
  69122. if (ex instanceof _ReaderException.default) {
  69123. continue;
  69124. }
  69125. // Bad Exception.
  69126. }
  69127. }
  69128. } catch (e_2_1) {
  69129. e_2 = {
  69130. error: e_2_1
  69131. };
  69132. } finally {
  69133. try {
  69134. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  69135. } finally {
  69136. if (e_2) throw e_2.error;
  69137. }
  69138. }
  69139. throw new _NotFoundException.default('No MultiFormat Readers were able to detect the code.');
  69140. };
  69141. return MultiFormatReader;
  69142. }();
  69143. var _default = MultiFormatReader;
  69144. exports.default = _default;
  69145. /***/ }),
  69146. /* 414 */
  69147. /*!***************************************************************************************!*\
  69148. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/QRCodeReader.js ***!
  69149. \***************************************************************************************/
  69150. /*! no static exports found */
  69151. /***/ (function(module, exports, __webpack_require__) {
  69152. "use strict";
  69153. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  69154. Object.defineProperty(exports, "__esModule", {
  69155. value: true
  69156. });
  69157. exports.default = void 0;
  69158. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  69159. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
  69160. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../DecodeHintType */ 322));
  69161. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  69162. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  69163. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  69164. var _Decoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/Decoder */ 415));
  69165. var _QRCodeDecoderMetaData = _interopRequireDefault(__webpack_require__(/*! ./decoder/QRCodeDecoderMetaData */ 426));
  69166. var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 427));
  69167. /*
  69168. * Copyright 2007 ZXing authors
  69169. *
  69170. * Licensed under the Apache License, Version 2.0 (the "License");
  69171. * you may not use this file except in compliance with the License.
  69172. * You may obtain a copy of the License at
  69173. *
  69174. * http://www.apache.org/licenses/LICENSE-2.0
  69175. *
  69176. * Unless required by applicable law or agreed to in writing, software
  69177. * distributed under the License is distributed on an "AS IS" BASIS,
  69178. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  69179. * See the License for the specific language governing permissions and
  69180. * limitations under the License.
  69181. */
  69182. /*namespace com.google.zxing.qrcode {*/
  69183. // import DetectorResult from '../common/DetectorResult';
  69184. /*import java.util.List;*/
  69185. /*import java.util.Map;*/
  69186. /**
  69187. * This implementation can detect and decode QR Codes in an image.
  69188. *
  69189. * @author Sean Owen
  69190. */
  69191. var QRCodeReader = /** @class */function () {
  69192. function QRCodeReader() {
  69193. this.decoder = new _Decoder.default();
  69194. }
  69195. QRCodeReader.prototype.getDecoder = function () {
  69196. return this.decoder;
  69197. };
  69198. /**
  69199. * Locates and decodes a QR code in an image.
  69200. *
  69201. * @return a representing: string the content encoded by the QR code
  69202. * @throws NotFoundException if a QR code cannot be found
  69203. * @throws FormatException if a QR code cannot be decoded
  69204. * @throws ChecksumException if error correction fails
  69205. */
  69206. /*@Override*/
  69207. // public decode(image: BinaryBitmap): Result /*throws NotFoundException, ChecksumException, FormatException */ {
  69208. // return this.decode(image, null)
  69209. // }
  69210. /*@Override*/
  69211. QRCodeReader.prototype.decode = function (image, hints) {
  69212. var decoderResult;
  69213. var points;
  69214. if (hints !== undefined && hints !== null && undefined !== hints.get(_DecodeHintType.default.PURE_BARCODE)) {
  69215. var bits = QRCodeReader.extractPureBits(image.getBlackMatrix());
  69216. decoderResult = this.decoder.decodeBitMatrix(bits, hints);
  69217. points = QRCodeReader.NO_POINTS;
  69218. } else {
  69219. var detectorResult = new _Detector.default(image.getBlackMatrix()).detect(hints);
  69220. decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints);
  69221. points = detectorResult.getPoints();
  69222. }
  69223. // If the code was mirrored: swap the bottom-left and the top-right points.
  69224. if (decoderResult.getOther() instanceof _QRCodeDecoderMetaData.default) {
  69225. decoderResult.getOther().applyMirroredCorrection(points);
  69226. }
  69227. var result = new _Result.default(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, _BarcodeFormat.default.QR_CODE, undefined);
  69228. var byteSegments = decoderResult.getByteSegments();
  69229. if (byteSegments !== null) {
  69230. result.putMetadata(_ResultMetadataType.default.BYTE_SEGMENTS, byteSegments);
  69231. }
  69232. var ecLevel = decoderResult.getECLevel();
  69233. if (ecLevel !== null) {
  69234. result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, ecLevel);
  69235. }
  69236. if (decoderResult.hasStructuredAppend()) {
  69237. result.putMetadata(_ResultMetadataType.default.STRUCTURED_APPEND_SEQUENCE, decoderResult.getStructuredAppendSequenceNumber());
  69238. result.putMetadata(_ResultMetadataType.default.STRUCTURED_APPEND_PARITY, decoderResult.getStructuredAppendParity());
  69239. }
  69240. return result;
  69241. };
  69242. /*@Override*/
  69243. QRCodeReader.prototype.reset = function () {
  69244. // do nothing
  69245. };
  69246. /**
  69247. * This method detects a code in a "pure" image -- that is, pure monochrome image
  69248. * which contains only an unrotated, unskewed, image of a code, with some white border
  69249. * around it. This is a specialized method that works exceptionally fast in this special
  69250. * case.
  69251. *
  69252. * @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix)
  69253. */
  69254. QRCodeReader.extractPureBits = function (image) {
  69255. var leftTopBlack = image.getTopLeftOnBit();
  69256. var rightBottomBlack = image.getBottomRightOnBit();
  69257. if (leftTopBlack === null || rightBottomBlack === null) {
  69258. throw new _NotFoundException.default();
  69259. }
  69260. var moduleSize = this.moduleSize(leftTopBlack, image);
  69261. var top = leftTopBlack[1];
  69262. var bottom = rightBottomBlack[1];
  69263. var left = leftTopBlack[0];
  69264. var right = rightBottomBlack[0];
  69265. // Sanity check!
  69266. if (left >= right || top >= bottom) {
  69267. throw new _NotFoundException.default();
  69268. }
  69269. if (bottom - top !== right - left) {
  69270. // Special case, where bottom-right module wasn't black so we found something else in the last row
  69271. // Assume it's a square, so use height as the width
  69272. right = left + (bottom - top);
  69273. if (right >= image.getWidth()) {
  69274. // Abort if that would not make sense -- off image
  69275. throw new _NotFoundException.default();
  69276. }
  69277. }
  69278. var matrixWidth = Math.round((right - left + 1) / moduleSize);
  69279. var matrixHeight = Math.round((bottom - top + 1) / moduleSize);
  69280. if (matrixWidth <= 0 || matrixHeight <= 0) {
  69281. throw new _NotFoundException.default();
  69282. }
  69283. if (matrixHeight !== matrixWidth) {
  69284. // Only possibly decode square regions
  69285. throw new _NotFoundException.default();
  69286. }
  69287. // Push in the "border" by half the module width so that we start
  69288. // sampling in the middle of the module. Just in case the image is a
  69289. // little off, this will help recover.
  69290. var nudge = /*(int) */Math.floor(moduleSize / 2.0);
  69291. top += nudge;
  69292. left += nudge;
  69293. // But careful that this does not sample off the edge
  69294. // "right" is the farthest-right valid pixel location -- right+1 is not necessarily
  69295. // This is positive by how much the inner x loop below would be too large
  69296. var nudgedTooFarRight = left + /*(int) */Math.floor((matrixWidth - 1) * moduleSize) - right;
  69297. if (nudgedTooFarRight > 0) {
  69298. if (nudgedTooFarRight > nudge) {
  69299. // Neither way fits; abort
  69300. throw new _NotFoundException.default();
  69301. }
  69302. left -= nudgedTooFarRight;
  69303. }
  69304. // See logic above
  69305. var nudgedTooFarDown = top + /*(int) */Math.floor((matrixHeight - 1) * moduleSize) - bottom;
  69306. if (nudgedTooFarDown > 0) {
  69307. if (nudgedTooFarDown > nudge) {
  69308. // Neither way fits; abort
  69309. throw new _NotFoundException.default();
  69310. }
  69311. top -= nudgedTooFarDown;
  69312. }
  69313. // Now just read off the bits
  69314. var bits = new _BitMatrix.default(matrixWidth, matrixHeight);
  69315. for (var y = 0; y < matrixHeight; y++) {
  69316. var iOffset = top + /*(int) */Math.floor(y * moduleSize);
  69317. for (var x = 0; x < matrixWidth; x++) {
  69318. if (image.get(left + /*(int) */Math.floor(x * moduleSize), iOffset)) {
  69319. bits.set(x, y);
  69320. }
  69321. }
  69322. }
  69323. return bits;
  69324. };
  69325. QRCodeReader.moduleSize = function (leftTopBlack, image) {
  69326. var height = image.getHeight();
  69327. var width = image.getWidth();
  69328. var x = leftTopBlack[0];
  69329. var y = leftTopBlack[1];
  69330. var inBlack = true;
  69331. var transitions = 0;
  69332. while (x < width && y < height) {
  69333. if (inBlack !== image.get(x, y)) {
  69334. if (++transitions === 5) {
  69335. break;
  69336. }
  69337. inBlack = !inBlack;
  69338. }
  69339. x++;
  69340. y++;
  69341. }
  69342. if (x === width || y === height) {
  69343. throw new _NotFoundException.default();
  69344. }
  69345. return (x - leftTopBlack[0]) / 7.0;
  69346. };
  69347. QRCodeReader.NO_POINTS = new Array();
  69348. return QRCodeReader;
  69349. }();
  69350. var _default = QRCodeReader;
  69351. exports.default = _default;
  69352. /***/ }),
  69353. /* 415 */
  69354. /*!******************************************************************************************!*\
  69355. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/Decoder.js ***!
  69356. \******************************************************************************************/
  69357. /*! no static exports found */
  69358. /***/ (function(module, exports, __webpack_require__) {
  69359. "use strict";
  69360. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  69361. Object.defineProperty(exports, "__esModule", {
  69362. value: true
  69363. });
  69364. exports.default = void 0;
  69365. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../ChecksumException */ 309));
  69366. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
  69367. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
  69368. var _ReedSolomonDecoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonDecoder */ 342));
  69369. var _BitMatrixParser = _interopRequireDefault(__webpack_require__(/*! ./BitMatrixParser */ 416));
  69370. var _DataBlock = _interopRequireDefault(__webpack_require__(/*! ./DataBlock */ 423));
  69371. var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./DecodedBitStreamParser */ 424));
  69372. var _QRCodeDecoderMetaData = _interopRequireDefault(__webpack_require__(/*! ./QRCodeDecoderMetaData */ 426));
  69373. /*
  69374. * Copyright 2007 ZXing authors
  69375. *
  69376. * Licensed under the Apache License, Version 2.0 (the "License");
  69377. * you may not use this file except in compliance with the License.
  69378. * You may obtain a copy of the License at
  69379. *
  69380. * http://www.apache.org/licenses/LICENSE-2.0
  69381. *
  69382. * Unless required by applicable law or agreed to in writing, software
  69383. * distributed under the License is distributed on an "AS IS" BASIS,
  69384. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  69385. * See the License for the specific language governing permissions and
  69386. * limitations under the License.
  69387. */
  69388. var __values = void 0 && (void 0).__values || function (o) {
  69389. var s = typeof Symbol === "function" && Symbol.iterator,
  69390. m = s && o[s],
  69391. i = 0;
  69392. if (m) return m.call(o);
  69393. if (o && typeof o.length === "number") return {
  69394. next: function next() {
  69395. if (o && i >= o.length) o = void 0;
  69396. return {
  69397. value: o && o[i++],
  69398. done: !o
  69399. };
  69400. }
  69401. };
  69402. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  69403. };
  69404. /*namespace com.google.zxing.qrcode.decoder {*/
  69405. /*import java.util.Map;*/
  69406. /**
  69407. * <p>The main class which implements QR Code decoding -- as opposed to locating and extracting
  69408. * the QR Code from an image.</p>
  69409. *
  69410. * @author Sean Owen
  69411. */
  69412. var Decoder = /** @class */function () {
  69413. function Decoder() {
  69414. this.rsDecoder = new _ReedSolomonDecoder.default(_GenericGF.default.QR_CODE_FIELD_256);
  69415. }
  69416. // public decode(image: boolean[][]): DecoderResult /*throws ChecksumException, FormatException*/ {
  69417. // return decode(image, null)
  69418. // }
  69419. /**
  69420. * <p>Convenience method that can decode a QR Code represented as a 2D array of booleans.
  69421. * "true" is taken to mean a black module.</p>
  69422. *
  69423. * @param image booleans representing white/black QR Code modules
  69424. * @param hints decoding hints that should be used to influence decoding
  69425. * @return text and bytes encoded within the QR Code
  69426. * @throws FormatException if the QR Code cannot be decoded
  69427. * @throws ChecksumException if error correction fails
  69428. */
  69429. Decoder.prototype.decodeBooleanArray = function (image, hints) {
  69430. return this.decodeBitMatrix(_BitMatrix.default.parseFromBooleanArray(image), hints);
  69431. };
  69432. // public decodeBitMatrix(bits: BitMatrix): DecoderResult /*throws ChecksumException, FormatException*/ {
  69433. // return decode(bits, null)
  69434. // }
  69435. /**
  69436. * <p>Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.</p>
  69437. *
  69438. * @param bits booleans representing white/black QR Code modules
  69439. * @param hints decoding hints that should be used to influence decoding
  69440. * @return text and bytes encoded within the QR Code
  69441. * @throws FormatException if the QR Code cannot be decoded
  69442. * @throws ChecksumException if error correction fails
  69443. */
  69444. Decoder.prototype.decodeBitMatrix = function (bits, hints) {
  69445. // Construct a parser and read version, error-correction level
  69446. var parser = new _BitMatrixParser.default(bits);
  69447. var ex = null;
  69448. try {
  69449. return this.decodeBitMatrixParser(parser, hints);
  69450. } catch (e /*: FormatException, ChecksumException*/) {
  69451. ex = e;
  69452. }
  69453. try {
  69454. // Revert the bit matrix
  69455. parser.remask();
  69456. // Will be attempting a mirrored reading of the version and format info.
  69457. parser.setMirror(true);
  69458. // Preemptively read the version.
  69459. parser.readVersion();
  69460. // Preemptively read the format information.
  69461. parser.readFormatInformation();
  69462. /*
  69463. * Since we're here, this means we have successfully detected some kind
  69464. * of version and format information when mirrored. This is a good sign,
  69465. * that the QR code may be mirrored, and we should try once more with a
  69466. * mirrored content.
  69467. */
  69468. // Prepare for a mirrored reading.
  69469. parser.mirror();
  69470. var result = this.decodeBitMatrixParser(parser, hints);
  69471. // Success! Notify the caller that the code was mirrored.
  69472. result.setOther(new _QRCodeDecoderMetaData.default(true));
  69473. return result;
  69474. } catch (e /*FormatException | ChecksumException*/) {
  69475. // Throw the exception from the original reading
  69476. if (ex !== null) {
  69477. throw ex;
  69478. }
  69479. throw e;
  69480. }
  69481. };
  69482. Decoder.prototype.decodeBitMatrixParser = function (parser, hints) {
  69483. var e_1, _a, e_2, _b;
  69484. var version = parser.readVersion();
  69485. var ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();
  69486. // Read codewords
  69487. var codewords = parser.readCodewords();
  69488. // Separate into data blocks
  69489. var dataBlocks = _DataBlock.default.getDataBlocks(codewords, version, ecLevel);
  69490. // Count total number of data bytes
  69491. var totalBytes = 0;
  69492. try {
  69493. for (var dataBlocks_1 = __values(dataBlocks), dataBlocks_1_1 = dataBlocks_1.next(); !dataBlocks_1_1.done; dataBlocks_1_1 = dataBlocks_1.next()) {
  69494. var dataBlock = dataBlocks_1_1.value;
  69495. totalBytes += dataBlock.getNumDataCodewords();
  69496. }
  69497. } catch (e_1_1) {
  69498. e_1 = {
  69499. error: e_1_1
  69500. };
  69501. } finally {
  69502. try {
  69503. if (dataBlocks_1_1 && !dataBlocks_1_1.done && (_a = dataBlocks_1.return)) _a.call(dataBlocks_1);
  69504. } finally {
  69505. if (e_1) throw e_1.error;
  69506. }
  69507. }
  69508. var resultBytes = new Uint8Array(totalBytes);
  69509. var resultOffset = 0;
  69510. try {
  69511. // Error-correct and copy data blocks together into a stream of bytes
  69512. for (var dataBlocks_2 = __values(dataBlocks), dataBlocks_2_1 = dataBlocks_2.next(); !dataBlocks_2_1.done; dataBlocks_2_1 = dataBlocks_2.next()) {
  69513. var dataBlock = dataBlocks_2_1.value;
  69514. var codewordBytes = dataBlock.getCodewords();
  69515. var numDataCodewords = dataBlock.getNumDataCodewords();
  69516. this.correctErrors(codewordBytes, numDataCodewords);
  69517. for (var i = 0; i < numDataCodewords; i++) {
  69518. resultBytes[resultOffset++] = codewordBytes[i];
  69519. }
  69520. }
  69521. } catch (e_2_1) {
  69522. e_2 = {
  69523. error: e_2_1
  69524. };
  69525. } finally {
  69526. try {
  69527. if (dataBlocks_2_1 && !dataBlocks_2_1.done && (_b = dataBlocks_2.return)) _b.call(dataBlocks_2);
  69528. } finally {
  69529. if (e_2) throw e_2.error;
  69530. }
  69531. }
  69532. // Decode the contents of that stream of bytes
  69533. return _DecodedBitStreamParser.default.decode(resultBytes, version, ecLevel, hints);
  69534. };
  69535. /**
  69536. * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
  69537. * correct the errors in-place using Reed-Solomon error correction.</p>
  69538. *
  69539. * @param codewordBytes data and error correction codewords
  69540. * @param numDataCodewords number of codewords that are data bytes
  69541. * @throws ChecksumException if error correction fails
  69542. */
  69543. Decoder.prototype.correctErrors = function (codewordBytes, numDataCodewords /*int*/) {
  69544. // const numCodewords = codewordBytes.length;
  69545. // First read into an array of ints
  69546. var codewordsInts = new Int32Array(codewordBytes);
  69547. // TYPESCRIPTPORT: not realy necessary to transform to ints? could redesign everything to work with unsigned bytes?
  69548. // const codewordsInts = new Int32Array(numCodewords)
  69549. // for (let i = 0; i < numCodewords; i++) {
  69550. // codewordsInts[i] = codewordBytes[i] & 0xFF
  69551. // }
  69552. try {
  69553. this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);
  69554. } catch (ignored /*: ReedSolomonException*/) {
  69555. throw new _ChecksumException.default();
  69556. }
  69557. // Copy back into array of bytes -- only need to worry about the bytes that were data
  69558. // We don't care about errors in the error-correction codewords
  69559. for (var i = 0; i < numDataCodewords; i++) {
  69560. codewordBytes[i] = /*(byte) */codewordsInts[i];
  69561. }
  69562. };
  69563. return Decoder;
  69564. }();
  69565. var _default = Decoder;
  69566. exports.default = _default;
  69567. /***/ }),
  69568. /* 416 */
  69569. /*!**************************************************************************************************!*\
  69570. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/BitMatrixParser.js ***!
  69571. \**************************************************************************************************/
  69572. /*! no static exports found */
  69573. /***/ (function(module, exports, __webpack_require__) {
  69574. "use strict";
  69575. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  69576. Object.defineProperty(exports, "__esModule", {
  69577. value: true
  69578. });
  69579. exports.default = void 0;
  69580. var _Version = _interopRequireDefault(__webpack_require__(/*! ./Version */ 417));
  69581. var _FormatInformation = _interopRequireDefault(__webpack_require__(/*! ./FormatInformation */ 418));
  69582. var _DataMask = _interopRequireDefault(__webpack_require__(/*! ./DataMask */ 422));
  69583. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  69584. /*
  69585. * Copyright 2007 ZXing authors
  69586. *
  69587. * Licensed under the Apache License, Version 2.0 (the "License");
  69588. * you may not use this file except in compliance with the License.
  69589. * You may obtain a copy of the License at
  69590. *
  69591. * http://www.apache.org/licenses/LICENSE-2.0
  69592. *
  69593. * Unless required by applicable law or agreed to in writing, software
  69594. * distributed under the License is distributed on an "AS IS" BASIS,
  69595. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  69596. * See the License for the specific language governing permissions and
  69597. * limitations under the License.
  69598. */
  69599. /**
  69600. * @author Sean Owen
  69601. */
  69602. var BitMatrixParser = /** @class */function () {
  69603. /**
  69604. * @param bitMatrix {@link BitMatrix} to parse
  69605. * @throws FormatException if dimension is not >= 21 and 1 mod 4
  69606. */
  69607. function BitMatrixParser(bitMatrix) {
  69608. var dimension = bitMatrix.getHeight();
  69609. if (dimension < 21 || (dimension & 0x03) !== 1) {
  69610. throw new _FormatException.default();
  69611. }
  69612. this.bitMatrix = bitMatrix;
  69613. }
  69614. /**
  69615. * <p>Reads format information from one of its two locations within the QR Code.</p>
  69616. *
  69617. * @return {@link FormatInformation} encapsulating the QR Code's format info
  69618. * @throws FormatException if both format information locations cannot be parsed as
  69619. * the valid encoding of format information
  69620. */
  69621. BitMatrixParser.prototype.readFormatInformation = function () {
  69622. if (this.parsedFormatInfo !== null && this.parsedFormatInfo !== undefined) {
  69623. return this.parsedFormatInfo;
  69624. }
  69625. // Read top-left format info bits
  69626. var formatInfoBits1 = 0;
  69627. for (var i = 0; i < 6; i++) {
  69628. formatInfoBits1 = this.copyBit(i, 8, formatInfoBits1);
  69629. }
  69630. // .. and skip a bit in the timing pattern ...
  69631. formatInfoBits1 = this.copyBit(7, 8, formatInfoBits1);
  69632. formatInfoBits1 = this.copyBit(8, 8, formatInfoBits1);
  69633. formatInfoBits1 = this.copyBit(8, 7, formatInfoBits1);
  69634. // .. and skip a bit in the timing pattern ...
  69635. for (var j = 5; j >= 0; j--) {
  69636. formatInfoBits1 = this.copyBit(8, j, formatInfoBits1);
  69637. }
  69638. // Read the top-right/bottom-left pattern too
  69639. var dimension = this.bitMatrix.getHeight();
  69640. var formatInfoBits2 = 0;
  69641. var jMin = dimension - 7;
  69642. for (var j = dimension - 1; j >= jMin; j--) {
  69643. formatInfoBits2 = this.copyBit(8, j, formatInfoBits2);
  69644. }
  69645. for (var i = dimension - 8; i < dimension; i++) {
  69646. formatInfoBits2 = this.copyBit(i, 8, formatInfoBits2);
  69647. }
  69648. this.parsedFormatInfo = _FormatInformation.default.decodeFormatInformation(formatInfoBits1, formatInfoBits2);
  69649. if (this.parsedFormatInfo !== null) {
  69650. return this.parsedFormatInfo;
  69651. }
  69652. throw new _FormatException.default();
  69653. };
  69654. /**
  69655. * <p>Reads version information from one of its two locations within the QR Code.</p>
  69656. *
  69657. * @return {@link Version} encapsulating the QR Code's version
  69658. * @throws FormatException if both version information locations cannot be parsed as
  69659. * the valid encoding of version information
  69660. */
  69661. BitMatrixParser.prototype.readVersion = function () {
  69662. if (this.parsedVersion !== null && this.parsedVersion !== undefined) {
  69663. return this.parsedVersion;
  69664. }
  69665. var dimension = this.bitMatrix.getHeight();
  69666. var provisionalVersion = Math.floor((dimension - 17) / 4);
  69667. if (provisionalVersion <= 6) {
  69668. return _Version.default.getVersionForNumber(provisionalVersion);
  69669. }
  69670. // Read top-right version info: 3 wide by 6 tall
  69671. var versionBits = 0;
  69672. var ijMin = dimension - 11;
  69673. for (var j = 5; j >= 0; j--) {
  69674. for (var i = dimension - 9; i >= ijMin; i--) {
  69675. versionBits = this.copyBit(i, j, versionBits);
  69676. }
  69677. }
  69678. var theParsedVersion = _Version.default.decodeVersionInformation(versionBits);
  69679. if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
  69680. this.parsedVersion = theParsedVersion;
  69681. return theParsedVersion;
  69682. }
  69683. // Hmm, failed. Try bottom left: 6 wide by 3 tall
  69684. versionBits = 0;
  69685. for (var i = 5; i >= 0; i--) {
  69686. for (var j = dimension - 9; j >= ijMin; j--) {
  69687. versionBits = this.copyBit(i, j, versionBits);
  69688. }
  69689. }
  69690. theParsedVersion = _Version.default.decodeVersionInformation(versionBits);
  69691. if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {
  69692. this.parsedVersion = theParsedVersion;
  69693. return theParsedVersion;
  69694. }
  69695. throw new _FormatException.default();
  69696. };
  69697. BitMatrixParser.prototype.copyBit = function (i /*int*/, j /*int*/, versionBits /*int*/) {
  69698. var bit = this.isMirror ? this.bitMatrix.get(j, i) : this.bitMatrix.get(i, j);
  69699. return bit ? versionBits << 1 | 0x1 : versionBits << 1;
  69700. };
  69701. /**
  69702. * <p>Reads the bits in the {@link BitMatrix} representing the finder pattern in the
  69703. * correct order in order to reconstruct the codewords bytes contained within the
  69704. * QR Code.</p>
  69705. *
  69706. * @return bytes encoded within the QR Code
  69707. * @throws FormatException if the exact number of bytes expected is not read
  69708. */
  69709. BitMatrixParser.prototype.readCodewords = function () {
  69710. var formatInfo = this.readFormatInformation();
  69711. var version = this.readVersion();
  69712. // Get the data mask for the format used in this QR Code. This will exclude
  69713. // some bits from reading as we wind through the bit matrix.
  69714. var dataMask = _DataMask.default.values.get(formatInfo.getDataMask());
  69715. var dimension = this.bitMatrix.getHeight();
  69716. dataMask.unmaskBitMatrix(this.bitMatrix, dimension);
  69717. var functionPattern = version.buildFunctionPattern();
  69718. var readingUp = true;
  69719. var result = new Uint8Array(version.getTotalCodewords());
  69720. var resultOffset = 0;
  69721. var currentByte = 0;
  69722. var bitsRead = 0;
  69723. // Read columns in pairs, from right to left
  69724. for (var j = dimension - 1; j > 0; j -= 2) {
  69725. if (j === 6) {
  69726. // Skip whole column with vertical alignment pattern
  69727. // saves time and makes the other code proceed more cleanly
  69728. j--;
  69729. }
  69730. // Read alternatingly from bottom to top then top to bottom
  69731. for (var count = 0; count < dimension; count++) {
  69732. var i = readingUp ? dimension - 1 - count : count;
  69733. for (var col = 0; col < 2; col++) {
  69734. // Ignore bits covered by the function pattern
  69735. if (!functionPattern.get(j - col, i)) {
  69736. // Read a bit
  69737. bitsRead++;
  69738. currentByte <<= 1;
  69739. if (this.bitMatrix.get(j - col, i)) {
  69740. currentByte |= 1;
  69741. }
  69742. // If we've made a whole byte, save it off
  69743. if (bitsRead === 8) {
  69744. result[resultOffset++] = /*(byte) */currentByte;
  69745. bitsRead = 0;
  69746. currentByte = 0;
  69747. }
  69748. }
  69749. }
  69750. }
  69751. readingUp = !readingUp; // readingUp ^= true; // readingUp = !readingUp; // switch directions
  69752. }
  69753. if (resultOffset !== version.getTotalCodewords()) {
  69754. throw new _FormatException.default();
  69755. }
  69756. return result;
  69757. };
  69758. /**
  69759. * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.
  69760. */
  69761. BitMatrixParser.prototype.remask = function () {
  69762. if (this.parsedFormatInfo === null) {
  69763. return; // We have no format information, and have no data mask
  69764. }
  69765. var dataMask = _DataMask.default.values.get(this.parsedFormatInfo.getDataMask());
  69766. var dimension = this.bitMatrix.getHeight();
  69767. dataMask.unmaskBitMatrix(this.bitMatrix, dimension);
  69768. };
  69769. /**
  69770. * Prepare the parser for a mirrored operation.
  69771. * This flag has effect only on the {@link #readFormatInformation()} and the
  69772. * {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the
  69773. * {@link #mirror()} method should be called.
  69774. *
  69775. * @param mirror Whether to read version and format information mirrored.
  69776. */
  69777. BitMatrixParser.prototype.setMirror = function (isMirror) {
  69778. this.parsedVersion = null;
  69779. this.parsedFormatInfo = null;
  69780. this.isMirror = isMirror;
  69781. };
  69782. /** Mirror the bit matrix in order to attempt a second reading. */
  69783. BitMatrixParser.prototype.mirror = function () {
  69784. var bitMatrix = this.bitMatrix;
  69785. for (var x = 0, width = bitMatrix.getWidth(); x < width; x++) {
  69786. for (var y = x + 1, height = bitMatrix.getHeight(); y < height; y++) {
  69787. if (bitMatrix.get(x, y) !== bitMatrix.get(y, x)) {
  69788. bitMatrix.flip(y, x);
  69789. bitMatrix.flip(x, y);
  69790. }
  69791. }
  69792. }
  69793. };
  69794. return BitMatrixParser;
  69795. }();
  69796. var _default = BitMatrixParser;
  69797. exports.default = _default;
  69798. /***/ }),
  69799. /* 417 */
  69800. /*!******************************************************************************************!*\
  69801. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/Version.js ***!
  69802. \******************************************************************************************/
  69803. /*! no static exports found */
  69804. /***/ (function(module, exports, __webpack_require__) {
  69805. "use strict";
  69806. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  69807. Object.defineProperty(exports, "__esModule", {
  69808. value: true
  69809. });
  69810. exports.default = void 0;
  69811. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
  69812. var _FormatInformation = _interopRequireDefault(__webpack_require__(/*! ./FormatInformation */ 418));
  69813. var _ECBlocks = _interopRequireDefault(__webpack_require__(/*! ./ECBlocks */ 420));
  69814. var _ECB = _interopRequireDefault(__webpack_require__(/*! ./ECB */ 421));
  69815. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  69816. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  69817. /*
  69818. * Copyright 2007 ZXing authors
  69819. *
  69820. * Licensed under the Apache License, Version 2.0 (the "License");
  69821. * you may not use this file except in compliance with the License.
  69822. * You may obtain a copy of the License at
  69823. *
  69824. * http://www.apache.org/licenses/LICENSE-2.0
  69825. *
  69826. * Unless required by applicable law or agreed to in writing, software
  69827. * distributed under the License is distributed on an "AS IS" BASIS,
  69828. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  69829. * See the License for the specific language governing permissions and
  69830. * limitations under the License.
  69831. */
  69832. var __values = void 0 && (void 0).__values || function (o) {
  69833. var s = typeof Symbol === "function" && Symbol.iterator,
  69834. m = s && o[s],
  69835. i = 0;
  69836. if (m) return m.call(o);
  69837. if (o && typeof o.length === "number") return {
  69838. next: function next() {
  69839. if (o && i >= o.length) o = void 0;
  69840. return {
  69841. value: o && o[i++],
  69842. done: !o
  69843. };
  69844. }
  69845. };
  69846. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  69847. };
  69848. /*namespace com.google.zxing.qrcode.decoder {*/
  69849. /**
  69850. * See ISO 18004:2006 Annex D
  69851. *
  69852. * @author Sean Owen
  69853. */
  69854. var Version = /** @class */function () {
  69855. function Version(versionNumber /*int*/, alignmentPatternCenters) {
  69856. var e_1, _a;
  69857. var ecBlocks = [];
  69858. for (var _i = 2; _i < arguments.length; _i++) {
  69859. ecBlocks[_i - 2] = arguments[_i];
  69860. }
  69861. this.versionNumber = versionNumber;
  69862. this.alignmentPatternCenters = alignmentPatternCenters;
  69863. this.ecBlocks = ecBlocks;
  69864. var total = 0;
  69865. var ecCodewords = ecBlocks[0].getECCodewordsPerBlock();
  69866. var ecbArray = ecBlocks[0].getECBlocks();
  69867. try {
  69868. for (var ecbArray_1 = __values(ecbArray), ecbArray_1_1 = ecbArray_1.next(); !ecbArray_1_1.done; ecbArray_1_1 = ecbArray_1.next()) {
  69869. var ecBlock = ecbArray_1_1.value;
  69870. total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
  69871. }
  69872. } catch (e_1_1) {
  69873. e_1 = {
  69874. error: e_1_1
  69875. };
  69876. } finally {
  69877. try {
  69878. if (ecbArray_1_1 && !ecbArray_1_1.done && (_a = ecbArray_1.return)) _a.call(ecbArray_1);
  69879. } finally {
  69880. if (e_1) throw e_1.error;
  69881. }
  69882. }
  69883. this.totalCodewords = total;
  69884. }
  69885. Version.prototype.getVersionNumber = function () {
  69886. return this.versionNumber;
  69887. };
  69888. Version.prototype.getAlignmentPatternCenters = function () {
  69889. return this.alignmentPatternCenters;
  69890. };
  69891. Version.prototype.getTotalCodewords = function () {
  69892. return this.totalCodewords;
  69893. };
  69894. Version.prototype.getDimensionForVersion = function () {
  69895. return 17 + 4 * this.versionNumber;
  69896. };
  69897. Version.prototype.getECBlocksForLevel = function (ecLevel) {
  69898. return this.ecBlocks[ecLevel.getValue()];
  69899. // TYPESCRIPTPORT: original was using ordinal, and using the order of levels as defined in ErrorCorrectionLevel enum (LMQH)
  69900. // I will use the direct value from ErrorCorrectionLevelValues enum which in typescript goes to a number
  69901. };
  69902. /**
  69903. * <p>Deduces version information purely from QR Code dimensions.</p>
  69904. *
  69905. * @param dimension dimension in modules
  69906. * @return Version for a QR Code of that dimension
  69907. * @throws FormatException if dimension is not 1 mod 4
  69908. */
  69909. Version.getProvisionalVersionForDimension = function (dimension /*int*/) {
  69910. if (dimension % 4 !== 1) {
  69911. throw new _FormatException.default();
  69912. }
  69913. try {
  69914. return this.getVersionForNumber((dimension - 17) / 4);
  69915. } catch (ignored /*: IllegalArgumentException*/) {
  69916. throw new _FormatException.default();
  69917. }
  69918. };
  69919. Version.getVersionForNumber = function (versionNumber /*int*/) {
  69920. if (versionNumber < 1 || versionNumber > 40) {
  69921. throw new _IllegalArgumentException.default();
  69922. }
  69923. return Version.VERSIONS[versionNumber - 1];
  69924. };
  69925. Version.decodeVersionInformation = function (versionBits /*int*/) {
  69926. var bestDifference = Number.MAX_SAFE_INTEGER;
  69927. var bestVersion = 0;
  69928. for (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++) {
  69929. var targetVersion = Version.VERSION_DECODE_INFO[i];
  69930. // Do the version info bits match exactly? done.
  69931. if (targetVersion === versionBits) {
  69932. return Version.getVersionForNumber(i + 7);
  69933. }
  69934. // Otherwise see if this is the closest to a real version info bit string
  69935. // we have seen so far
  69936. var bitsDifference = _FormatInformation.default.numBitsDiffering(versionBits, targetVersion);
  69937. if (bitsDifference < bestDifference) {
  69938. bestVersion = i + 7;
  69939. bestDifference = bitsDifference;
  69940. }
  69941. }
  69942. // We can tolerate up to 3 bits of error since no two version info codewords will
  69943. // differ in less than 8 bits.
  69944. if (bestDifference <= 3) {
  69945. return Version.getVersionForNumber(bestVersion);
  69946. }
  69947. // If we didn't find a close enough match, fail
  69948. return null;
  69949. };
  69950. /**
  69951. * See ISO 18004:2006 Annex E
  69952. */
  69953. Version.prototype.buildFunctionPattern = function () {
  69954. var dimension = this.getDimensionForVersion();
  69955. var bitMatrix = new _BitMatrix.default(dimension);
  69956. // Top left finder pattern + separator + format
  69957. bitMatrix.setRegion(0, 0, 9, 9);
  69958. // Top right finder pattern + separator + format
  69959. bitMatrix.setRegion(dimension - 8, 0, 8, 9);
  69960. // Bottom left finder pattern + separator + format
  69961. bitMatrix.setRegion(0, dimension - 8, 9, 8);
  69962. // Alignment patterns
  69963. var max = this.alignmentPatternCenters.length;
  69964. for (var x = 0; x < max; x++) {
  69965. var i = this.alignmentPatternCenters[x] - 2;
  69966. for (var y = 0; y < max; y++) {
  69967. if (x === 0 && (y === 0 || y === max - 1) || x === max - 1 && y === 0) {
  69968. // No alignment patterns near the three finder patterns
  69969. continue;
  69970. }
  69971. bitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);
  69972. }
  69973. }
  69974. // Vertical timing pattern
  69975. bitMatrix.setRegion(6, 9, 1, dimension - 17);
  69976. // Horizontal timing pattern
  69977. bitMatrix.setRegion(9, 6, dimension - 17, 1);
  69978. if (this.versionNumber > 6) {
  69979. // Version info, top right
  69980. bitMatrix.setRegion(dimension - 11, 0, 3, 6);
  69981. // Version info, bottom left
  69982. bitMatrix.setRegion(0, dimension - 11, 6, 3);
  69983. }
  69984. return bitMatrix;
  69985. };
  69986. /*@Override*/
  69987. Version.prototype.toString = function () {
  69988. return '' + this.versionNumber;
  69989. };
  69990. /**
  69991. * See ISO 18004:2006 Annex D.
  69992. * Element i represents the raw version bits that specify version i + 7
  69993. */
  69994. Version.VERSION_DECODE_INFO = Int32Array.from([0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69]);
  69995. /**
  69996. * See ISO 18004:2006 6.5.1 Table 9
  69997. */
  69998. Version.VERSIONS = [new Version(1, new Int32Array(0), new _ECBlocks.default(7, new _ECB.default(1, 19)), new _ECBlocks.default(10, new _ECB.default(1, 16)), new _ECBlocks.default(13, new _ECB.default(1, 13)), new _ECBlocks.default(17, new _ECB.default(1, 9))), new Version(2, Int32Array.from([6, 18]), new _ECBlocks.default(10, new _ECB.default(1, 34)), new _ECBlocks.default(16, new _ECB.default(1, 28)), new _ECBlocks.default(22, new _ECB.default(1, 22)), new _ECBlocks.default(28, new _ECB.default(1, 16))), new Version(3, Int32Array.from([6, 22]), new _ECBlocks.default(15, new _ECB.default(1, 55)), new _ECBlocks.default(26, new _ECB.default(1, 44)), new _ECBlocks.default(18, new _ECB.default(2, 17)), new _ECBlocks.default(22, new _ECB.default(2, 13))), new Version(4, Int32Array.from([6, 26]), new _ECBlocks.default(20, new _ECB.default(1, 80)), new _ECBlocks.default(18, new _ECB.default(2, 32)), new _ECBlocks.default(26, new _ECB.default(2, 24)), new _ECBlocks.default(16, new _ECB.default(4, 9))), new Version(5, Int32Array.from([6, 30]), new _ECBlocks.default(26, new _ECB.default(1, 108)), new _ECBlocks.default(24, new _ECB.default(2, 43)), new _ECBlocks.default(18, new _ECB.default(2, 15), new _ECB.default(2, 16)), new _ECBlocks.default(22, new _ECB.default(2, 11), new _ECB.default(2, 12))), new Version(6, Int32Array.from([6, 34]), new _ECBlocks.default(18, new _ECB.default(2, 68)), new _ECBlocks.default(16, new _ECB.default(4, 27)), new _ECBlocks.default(24, new _ECB.default(4, 19)), new _ECBlocks.default(28, new _ECB.default(4, 15))), new Version(7, Int32Array.from([6, 22, 38]), new _ECBlocks.default(20, new _ECB.default(2, 78)), new _ECBlocks.default(18, new _ECB.default(4, 31)), new _ECBlocks.default(18, new _ECB.default(2, 14), new _ECB.default(4, 15)), new _ECBlocks.default(26, new _ECB.default(4, 13), new _ECB.default(1, 14))), new Version(8, Int32Array.from([6, 24, 42]), new _ECBlocks.default(24, new _ECB.default(2, 97)), new _ECBlocks.default(22, new _ECB.default(2, 38), new _ECB.default(2, 39)), new _ECBlocks.default(22, new _ECB.default(4, 18), new _ECB.default(2, 19)), new _ECBlocks.default(26, new _ECB.default(4, 14), new _ECB.default(2, 15))), new Version(9, Int32Array.from([6, 26, 46]), new _ECBlocks.default(30, new _ECB.default(2, 116)), new _ECBlocks.default(22, new _ECB.default(3, 36), new _ECB.default(2, 37)), new _ECBlocks.default(20, new _ECB.default(4, 16), new _ECB.default(4, 17)), new _ECBlocks.default(24, new _ECB.default(4, 12), new _ECB.default(4, 13))), new Version(10, Int32Array.from([6, 28, 50]), new _ECBlocks.default(18, new _ECB.default(2, 68), new _ECB.default(2, 69)), new _ECBlocks.default(26, new _ECB.default(4, 43), new _ECB.default(1, 44)), new _ECBlocks.default(24, new _ECB.default(6, 19), new _ECB.default(2, 20)), new _ECBlocks.default(28, new _ECB.default(6, 15), new _ECB.default(2, 16))), new Version(11, Int32Array.from([6, 30, 54]), new _ECBlocks.default(20, new _ECB.default(4, 81)), new _ECBlocks.default(30, new _ECB.default(1, 50), new _ECB.default(4, 51)), new _ECBlocks.default(28, new _ECB.default(4, 22), new _ECB.default(4, 23)), new _ECBlocks.default(24, new _ECB.default(3, 12), new _ECB.default(8, 13))), new Version(12, Int32Array.from([6, 32, 58]), new _ECBlocks.default(24, new _ECB.default(2, 92), new _ECB.default(2, 93)), new _ECBlocks.default(22, new _ECB.default(6, 36), new _ECB.default(2, 37)), new _ECBlocks.default(26, new _ECB.default(4, 20), new _ECB.default(6, 21)), new _ECBlocks.default(28, new _ECB.default(7, 14), new _ECB.default(4, 15))), new Version(13, Int32Array.from([6, 34, 62]), new _ECBlocks.default(26, new _ECB.default(4, 107)), new _ECBlocks.default(22, new _ECB.default(8, 37), new _ECB.default(1, 38)), new _ECBlocks.default(24, new _ECB.default(8, 20), new _ECB.default(4, 21)), new _ECBlocks.default(22, new _ECB.default(12, 11), new _ECB.default(4, 12))), new Version(14, Int32Array.from([6, 26, 46, 66]), new _ECBlocks.default(30, new _ECB.default(3, 115), new _ECB.default(1, 116)), new _ECBlocks.default(24, new _ECB.default(4, 40), new _ECB.default(5, 41)), new _ECBlocks.default(20, new _ECB.default(11, 16), new _ECB.default(5, 17)), new _ECBlocks.default(24, new _ECB.default(11, 12), new _ECB.default(5, 13))), new Version(15, Int32Array.from([6, 26, 48, 70]), new _ECBlocks.default(22, new _ECB.default(5, 87), new _ECB.default(1, 88)), new _ECBlocks.default(24, new _ECB.default(5, 41), new _ECB.default(5, 42)), new _ECBlocks.default(30, new _ECB.default(5, 24), new _ECB.default(7, 25)), new _ECBlocks.default(24, new _ECB.default(11, 12), new _ECB.default(7, 13))), new Version(16, Int32Array.from([6, 26, 50, 74]), new _ECBlocks.default(24, new _ECB.default(5, 98), new _ECB.default(1, 99)), new _ECBlocks.default(28, new _ECB.default(7, 45), new _ECB.default(3, 46)), new _ECBlocks.default(24, new _ECB.default(15, 19), new _ECB.default(2, 20)), new _ECBlocks.default(30, new _ECB.default(3, 15), new _ECB.default(13, 16))), new Version(17, Int32Array.from([6, 30, 54, 78]), new _ECBlocks.default(28, new _ECB.default(1, 107), new _ECB.default(5, 108)), new _ECBlocks.default(28, new _ECB.default(10, 46), new _ECB.default(1, 47)), new _ECBlocks.default(28, new _ECB.default(1, 22), new _ECB.default(15, 23)), new _ECBlocks.default(28, new _ECB.default(2, 14), new _ECB.default(17, 15))), new Version(18, Int32Array.from([6, 30, 56, 82]), new _ECBlocks.default(30, new _ECB.default(5, 120), new _ECB.default(1, 121)), new _ECBlocks.default(26, new _ECB.default(9, 43), new _ECB.default(4, 44)), new _ECBlocks.default(28, new _ECB.default(17, 22), new _ECB.default(1, 23)), new _ECBlocks.default(28, new _ECB.default(2, 14), new _ECB.default(19, 15))), new Version(19, Int32Array.from([6, 30, 58, 86]), new _ECBlocks.default(28, new _ECB.default(3, 113), new _ECB.default(4, 114)), new _ECBlocks.default(26, new _ECB.default(3, 44), new _ECB.default(11, 45)), new _ECBlocks.default(26, new _ECB.default(17, 21), new _ECB.default(4, 22)), new _ECBlocks.default(26, new _ECB.default(9, 13), new _ECB.default(16, 14))), new Version(20, Int32Array.from([6, 34, 62, 90]), new _ECBlocks.default(28, new _ECB.default(3, 107), new _ECB.default(5, 108)), new _ECBlocks.default(26, new _ECB.default(3, 41), new _ECB.default(13, 42)), new _ECBlocks.default(30, new _ECB.default(15, 24), new _ECB.default(5, 25)), new _ECBlocks.default(28, new _ECB.default(15, 15), new _ECB.default(10, 16))), new Version(21, Int32Array.from([6, 28, 50, 72, 94]), new _ECBlocks.default(28, new _ECB.default(4, 116), new _ECB.default(4, 117)), new _ECBlocks.default(26, new _ECB.default(17, 42)), new _ECBlocks.default(28, new _ECB.default(17, 22), new _ECB.default(6, 23)), new _ECBlocks.default(30, new _ECB.default(19, 16), new _ECB.default(6, 17))), new Version(22, Int32Array.from([6, 26, 50, 74, 98]), new _ECBlocks.default(28, new _ECB.default(2, 111), new _ECB.default(7, 112)), new _ECBlocks.default(28, new _ECB.default(17, 46)), new _ECBlocks.default(30, new _ECB.default(7, 24), new _ECB.default(16, 25)), new _ECBlocks.default(24, new _ECB.default(34, 13))), new Version(23, Int32Array.from([6, 30, 54, 78, 102]), new _ECBlocks.default(30, new _ECB.default(4, 121), new _ECB.default(5, 122)), new _ECBlocks.default(28, new _ECB.default(4, 47), new _ECB.default(14, 48)), new _ECBlocks.default(30, new _ECB.default(11, 24), new _ECB.default(14, 25)), new _ECBlocks.default(30, new _ECB.default(16, 15), new _ECB.default(14, 16))), new Version(24, Int32Array.from([6, 28, 54, 80, 106]), new _ECBlocks.default(30, new _ECB.default(6, 117), new _ECB.default(4, 118)), new _ECBlocks.default(28, new _ECB.default(6, 45), new _ECB.default(14, 46)), new _ECBlocks.default(30, new _ECB.default(11, 24), new _ECB.default(16, 25)), new _ECBlocks.default(30, new _ECB.default(30, 16), new _ECB.default(2, 17))), new Version(25, Int32Array.from([6, 32, 58, 84, 110]), new _ECBlocks.default(26, new _ECB.default(8, 106), new _ECB.default(4, 107)), new _ECBlocks.default(28, new _ECB.default(8, 47), new _ECB.default(13, 48)), new _ECBlocks.default(30, new _ECB.default(7, 24), new _ECB.default(22, 25)), new _ECBlocks.default(30, new _ECB.default(22, 15), new _ECB.default(13, 16))), new Version(26, Int32Array.from([6, 30, 58, 86, 114]), new _ECBlocks.default(28, new _ECB.default(10, 114), new _ECB.default(2, 115)), new _ECBlocks.default(28, new _ECB.default(19, 46), new _ECB.default(4, 47)), new _ECBlocks.default(28, new _ECB.default(28, 22), new _ECB.default(6, 23)), new _ECBlocks.default(30, new _ECB.default(33, 16), new _ECB.default(4, 17))), new Version(27, Int32Array.from([6, 34, 62, 90, 118]), new _ECBlocks.default(30, new _ECB.default(8, 122), new _ECB.default(4, 123)), new _ECBlocks.default(28, new _ECB.default(22, 45), new _ECB.default(3, 46)), new _ECBlocks.default(30, new _ECB.default(8, 23), new _ECB.default(26, 24)), new _ECBlocks.default(30, new _ECB.default(12, 15), new _ECB.default(28, 16))), new Version(28, Int32Array.from([6, 26, 50, 74, 98, 122]), new _ECBlocks.default(30, new _ECB.default(3, 117), new _ECB.default(10, 118)), new _ECBlocks.default(28, new _ECB.default(3, 45), new _ECB.default(23, 46)), new _ECBlocks.default(30, new _ECB.default(4, 24), new _ECB.default(31, 25)), new _ECBlocks.default(30, new _ECB.default(11, 15), new _ECB.default(31, 16))), new Version(29, Int32Array.from([6, 30, 54, 78, 102, 126]), new _ECBlocks.default(30, new _ECB.default(7, 116), new _ECB.default(7, 117)), new _ECBlocks.default(28, new _ECB.default(21, 45), new _ECB.default(7, 46)), new _ECBlocks.default(30, new _ECB.default(1, 23), new _ECB.default(37, 24)), new _ECBlocks.default(30, new _ECB.default(19, 15), new _ECB.default(26, 16))), new Version(30, Int32Array.from([6, 26, 52, 78, 104, 130]), new _ECBlocks.default(30, new _ECB.default(5, 115), new _ECB.default(10, 116)), new _ECBlocks.default(28, new _ECB.default(19, 47), new _ECB.default(10, 48)), new _ECBlocks.default(30, new _ECB.default(15, 24), new _ECB.default(25, 25)), new _ECBlocks.default(30, new _ECB.default(23, 15), new _ECB.default(25, 16))), new Version(31, Int32Array.from([6, 30, 56, 82, 108, 134]), new _ECBlocks.default(30, new _ECB.default(13, 115), new _ECB.default(3, 116)), new _ECBlocks.default(28, new _ECB.default(2, 46), new _ECB.default(29, 47)), new _ECBlocks.default(30, new _ECB.default(42, 24), new _ECB.default(1, 25)), new _ECBlocks.default(30, new _ECB.default(23, 15), new _ECB.default(28, 16))), new Version(32, Int32Array.from([6, 34, 60, 86, 112, 138]), new _ECBlocks.default(30, new _ECB.default(17, 115)), new _ECBlocks.default(28, new _ECB.default(10, 46), new _ECB.default(23, 47)), new _ECBlocks.default(30, new _ECB.default(10, 24), new _ECB.default(35, 25)), new _ECBlocks.default(30, new _ECB.default(19, 15), new _ECB.default(35, 16))), new Version(33, Int32Array.from([6, 30, 58, 86, 114, 142]), new _ECBlocks.default(30, new _ECB.default(17, 115), new _ECB.default(1, 116)), new _ECBlocks.default(28, new _ECB.default(14, 46), new _ECB.default(21, 47)), new _ECBlocks.default(30, new _ECB.default(29, 24), new _ECB.default(19, 25)), new _ECBlocks.default(30, new _ECB.default(11, 15), new _ECB.default(46, 16))), new Version(34, Int32Array.from([6, 34, 62, 90, 118, 146]), new _ECBlocks.default(30, new _ECB.default(13, 115), new _ECB.default(6, 116)), new _ECBlocks.default(28, new _ECB.default(14, 46), new _ECB.default(23, 47)), new _ECBlocks.default(30, new _ECB.default(44, 24), new _ECB.default(7, 25)), new _ECBlocks.default(30, new _ECB.default(59, 16), new _ECB.default(1, 17))), new Version(35, Int32Array.from([6, 30, 54, 78, 102, 126, 150]), new _ECBlocks.default(30, new _ECB.default(12, 121), new _ECB.default(7, 122)), new _ECBlocks.default(28, new _ECB.default(12, 47), new _ECB.default(26, 48)), new _ECBlocks.default(30, new _ECB.default(39, 24), new _ECB.default(14, 25)), new _ECBlocks.default(30, new _ECB.default(22, 15), new _ECB.default(41, 16))), new Version(36, Int32Array.from([6, 24, 50, 76, 102, 128, 154]), new _ECBlocks.default(30, new _ECB.default(6, 121), new _ECB.default(14, 122)), new _ECBlocks.default(28, new _ECB.default(6, 47), new _ECB.default(34, 48)), new _ECBlocks.default(30, new _ECB.default(46, 24), new _ECB.default(10, 25)), new _ECBlocks.default(30, new _ECB.default(2, 15), new _ECB.default(64, 16))), new Version(37, Int32Array.from([6, 28, 54, 80, 106, 132, 158]), new _ECBlocks.default(30, new _ECB.default(17, 122), new _ECB.default(4, 123)), new _ECBlocks.default(28, new _ECB.default(29, 46), new _ECB.default(14, 47)), new _ECBlocks.default(30, new _ECB.default(49, 24), new _ECB.default(10, 25)), new _ECBlocks.default(30, new _ECB.default(24, 15), new _ECB.default(46, 16))), new Version(38, Int32Array.from([6, 32, 58, 84, 110, 136, 162]), new _ECBlocks.default(30, new _ECB.default(4, 122), new _ECB.default(18, 123)), new _ECBlocks.default(28, new _ECB.default(13, 46), new _ECB.default(32, 47)), new _ECBlocks.default(30, new _ECB.default(48, 24), new _ECB.default(14, 25)), new _ECBlocks.default(30, new _ECB.default(42, 15), new _ECB.default(32, 16))), new Version(39, Int32Array.from([6, 26, 54, 82, 110, 138, 166]), new _ECBlocks.default(30, new _ECB.default(20, 117), new _ECB.default(4, 118)), new _ECBlocks.default(28, new _ECB.default(40, 47), new _ECB.default(7, 48)), new _ECBlocks.default(30, new _ECB.default(43, 24), new _ECB.default(22, 25)), new _ECBlocks.default(30, new _ECB.default(10, 15), new _ECB.default(67, 16))), new Version(40, Int32Array.from([6, 30, 58, 86, 114, 142, 170]), new _ECBlocks.default(30, new _ECB.default(19, 118), new _ECB.default(6, 119)), new _ECBlocks.default(28, new _ECB.default(18, 47), new _ECB.default(31, 48)), new _ECBlocks.default(30, new _ECB.default(34, 24), new _ECB.default(34, 25)), new _ECBlocks.default(30, new _ECB.default(20, 15), new _ECB.default(61, 16)))];
  69999. return Version;
  70000. }();
  70001. var _default = Version;
  70002. exports.default = _default;
  70003. /***/ }),
  70004. /* 418 */
  70005. /*!****************************************************************************************************!*\
  70006. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/FormatInformation.js ***!
  70007. \****************************************************************************************************/
  70008. /*! no static exports found */
  70009. /***/ (function(module, exports, __webpack_require__) {
  70010. "use strict";
  70011. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  70012. Object.defineProperty(exports, "__esModule", {
  70013. value: true
  70014. });
  70015. exports.default = void 0;
  70016. var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ./ErrorCorrectionLevel */ 419));
  70017. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  70018. /*
  70019. * Copyright 2007 ZXing authors
  70020. *
  70021. * Licensed under the Apache License, Version 2.0 (the "License");
  70022. * you may not use this file except in compliance with the License.
  70023. * You may obtain a copy of the License at
  70024. *
  70025. * http://www.apache.org/licenses/LICENSE-2.0
  70026. *
  70027. * Unless required by applicable law or agreed to in writing, software
  70028. * distributed under the License is distributed on an "AS IS" BASIS,
  70029. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70030. * See the License for the specific language governing permissions and
  70031. * limitations under the License.
  70032. */
  70033. var __values = void 0 && (void 0).__values || function (o) {
  70034. var s = typeof Symbol === "function" && Symbol.iterator,
  70035. m = s && o[s],
  70036. i = 0;
  70037. if (m) return m.call(o);
  70038. if (o && typeof o.length === "number") return {
  70039. next: function next() {
  70040. if (o && i >= o.length) o = void 0;
  70041. return {
  70042. value: o && o[i++],
  70043. done: !o
  70044. };
  70045. }
  70046. };
  70047. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  70048. };
  70049. /*namespace com.google.zxing.qrcode.decoder {*/
  70050. /**
  70051. * <p>Encapsulates a QR Code's format information, including the data mask used and
  70052. * error correction level.</p>
  70053. *
  70054. * @author Sean Owen
  70055. * @see DataMask
  70056. * @see ErrorCorrectionLevel
  70057. */
  70058. var FormatInformation = /** @class */function () {
  70059. function FormatInformation(formatInfo /*int*/) {
  70060. // Bits 3,4
  70061. this.errorCorrectionLevel = _ErrorCorrectionLevel.default.forBits(formatInfo >> 3 & 0x03);
  70062. // Bottom 3 bits
  70063. this.dataMask = /*(byte) */formatInfo & 0x07;
  70064. }
  70065. FormatInformation.numBitsDiffering = function (a /*int*/, b /*int*/) {
  70066. return _Integer.default.bitCount(a ^ b);
  70067. };
  70068. /**
  70069. * @param maskedFormatInfo1 format info indicator, with mask still applied
  70070. * @param maskedFormatInfo2 second copy of same info; both are checked at the same time
  70071. * to establish best match
  70072. * @return information about the format it specifies, or {@code null}
  70073. * if doesn't seem to match any known pattern
  70074. */
  70075. FormatInformation.decodeFormatInformation = function (maskedFormatInfo1 /*int*/, maskedFormatInfo2 /*int*/) {
  70076. var formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2);
  70077. if (formatInfo !== null) {
  70078. return formatInfo;
  70079. }
  70080. // Should return null, but, some QR codes apparently
  70081. // do not mask this info. Try again by actually masking the pattern
  70082. // first
  70083. return FormatInformation.doDecodeFormatInformation(maskedFormatInfo1 ^ FormatInformation.FORMAT_INFO_MASK_QR, maskedFormatInfo2 ^ FormatInformation.FORMAT_INFO_MASK_QR);
  70084. };
  70085. FormatInformation.doDecodeFormatInformation = function (maskedFormatInfo1 /*int*/, maskedFormatInfo2 /*int*/) {
  70086. var e_1, _a;
  70087. // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
  70088. var bestDifference = Number.MAX_SAFE_INTEGER;
  70089. var bestFormatInfo = 0;
  70090. try {
  70091. for (var _b = __values(FormatInformation.FORMAT_INFO_DECODE_LOOKUP), _c = _b.next(); !_c.done; _c = _b.next()) {
  70092. var decodeInfo = _c.value;
  70093. var targetInfo = decodeInfo[0];
  70094. if (targetInfo === maskedFormatInfo1 || targetInfo === maskedFormatInfo2) {
  70095. // Found an exact match
  70096. return new FormatInformation(decodeInfo[1]);
  70097. }
  70098. var bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo1, targetInfo);
  70099. if (bitsDifference < bestDifference) {
  70100. bestFormatInfo = decodeInfo[1];
  70101. bestDifference = bitsDifference;
  70102. }
  70103. if (maskedFormatInfo1 !== maskedFormatInfo2) {
  70104. // also try the other option
  70105. bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo2, targetInfo);
  70106. if (bitsDifference < bestDifference) {
  70107. bestFormatInfo = decodeInfo[1];
  70108. bestDifference = bitsDifference;
  70109. }
  70110. }
  70111. }
  70112. } catch (e_1_1) {
  70113. e_1 = {
  70114. error: e_1_1
  70115. };
  70116. } finally {
  70117. try {
  70118. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  70119. } finally {
  70120. if (e_1) throw e_1.error;
  70121. }
  70122. }
  70123. // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits
  70124. // differing means we found a match
  70125. if (bestDifference <= 3) {
  70126. return new FormatInformation(bestFormatInfo);
  70127. }
  70128. return null;
  70129. };
  70130. FormatInformation.prototype.getErrorCorrectionLevel = function () {
  70131. return this.errorCorrectionLevel;
  70132. };
  70133. FormatInformation.prototype.getDataMask = function () {
  70134. return this.dataMask;
  70135. };
  70136. /*@Override*/
  70137. FormatInformation.prototype.hashCode = function () {
  70138. return this.errorCorrectionLevel.getBits() << 3 | this.dataMask;
  70139. };
  70140. /*@Override*/
  70141. FormatInformation.prototype.equals = function (o) {
  70142. if (!(o instanceof FormatInformation)) {
  70143. return false;
  70144. }
  70145. var other = o;
  70146. return this.errorCorrectionLevel === other.errorCorrectionLevel && this.dataMask === other.dataMask;
  70147. };
  70148. FormatInformation.FORMAT_INFO_MASK_QR = 0x5412;
  70149. /**
  70150. * See ISO 18004:2006, Annex C, Table C.1
  70151. */
  70152. FormatInformation.FORMAT_INFO_DECODE_LOOKUP = [Int32Array.from([0x5412, 0x00]), Int32Array.from([0x5125, 0x01]), Int32Array.from([0x5E7C, 0x02]), Int32Array.from([0x5B4B, 0x03]), Int32Array.from([0x45F9, 0x04]), Int32Array.from([0x40CE, 0x05]), Int32Array.from([0x4F97, 0x06]), Int32Array.from([0x4AA0, 0x07]), Int32Array.from([0x77C4, 0x08]), Int32Array.from([0x72F3, 0x09]), Int32Array.from([0x7DAA, 0x0A]), Int32Array.from([0x789D, 0x0B]), Int32Array.from([0x662F, 0x0C]), Int32Array.from([0x6318, 0x0D]), Int32Array.from([0x6C41, 0x0E]), Int32Array.from([0x6976, 0x0F]), Int32Array.from([0x1689, 0x10]), Int32Array.from([0x13BE, 0x11]), Int32Array.from([0x1CE7, 0x12]), Int32Array.from([0x19D0, 0x13]), Int32Array.from([0x0762, 0x14]), Int32Array.from([0x0255, 0x15]), Int32Array.from([0x0D0C, 0x16]), Int32Array.from([0x083B, 0x17]), Int32Array.from([0x355F, 0x18]), Int32Array.from([0x3068, 0x19]), Int32Array.from([0x3F31, 0x1A]), Int32Array.from([0x3A06, 0x1B]), Int32Array.from([0x24B4, 0x1C]), Int32Array.from([0x2183, 0x1D]), Int32Array.from([0x2EDA, 0x1E]), Int32Array.from([0x2BED, 0x1F])];
  70153. return FormatInformation;
  70154. }();
  70155. var _default = FormatInformation;
  70156. exports.default = _default;
  70157. /***/ }),
  70158. /* 419 */
  70159. /*!*******************************************************************************************************!*\
  70160. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/ErrorCorrectionLevel.js ***!
  70161. \*******************************************************************************************************/
  70162. /*! no static exports found */
  70163. /***/ (function(module, exports, __webpack_require__) {
  70164. "use strict";
  70165. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  70166. Object.defineProperty(exports, "__esModule", {
  70167. value: true
  70168. });
  70169. exports.default = exports.ErrorCorrectionLevelValues = void 0;
  70170. var _ArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../ArgumentException */ 304));
  70171. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  70172. /*
  70173. * Copyright 2007 ZXing authors
  70174. *
  70175. * Licensed under the Apache License, Version 2.0 (the "License");
  70176. * you may not use this file except in compliance with the License.
  70177. * You may obtain a copy of the License at
  70178. *
  70179. * http://www.apache.org/licenses/LICENSE-2.0
  70180. *
  70181. * Unless required by applicable law or agreed to in writing, software
  70182. * distributed under the License is distributed on an "AS IS" BASIS,
  70183. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70184. * See the License for the specific language governing permissions and
  70185. * limitations under the License.
  70186. */
  70187. /*namespace com.google.zxing.qrcode.decoder {*/
  70188. var ErrorCorrectionLevelValues;
  70189. exports.ErrorCorrectionLevelValues = ErrorCorrectionLevelValues;
  70190. (function (ErrorCorrectionLevelValues) {
  70191. ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["L"] = 0] = "L";
  70192. ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["M"] = 1] = "M";
  70193. ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["Q"] = 2] = "Q";
  70194. ErrorCorrectionLevelValues[ErrorCorrectionLevelValues["H"] = 3] = "H";
  70195. })(ErrorCorrectionLevelValues || (exports.ErrorCorrectionLevelValues = ErrorCorrectionLevelValues = {}));
  70196. /**
  70197. * <p>See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels
  70198. * defined by the QR code standard.</p>
  70199. *
  70200. * @author Sean Owen
  70201. */
  70202. var ErrorCorrectionLevel = /** @class */function () {
  70203. function ErrorCorrectionLevel(value, stringValue, bits /*int*/) {
  70204. this.value = value;
  70205. this.stringValue = stringValue;
  70206. this.bits = bits;
  70207. ErrorCorrectionLevel.FOR_BITS.set(bits, this);
  70208. ErrorCorrectionLevel.FOR_VALUE.set(value, this);
  70209. }
  70210. ErrorCorrectionLevel.prototype.getValue = function () {
  70211. return this.value;
  70212. };
  70213. ErrorCorrectionLevel.prototype.getBits = function () {
  70214. return this.bits;
  70215. };
  70216. ErrorCorrectionLevel.fromString = function (s) {
  70217. switch (s) {
  70218. case 'L':
  70219. return ErrorCorrectionLevel.L;
  70220. case 'M':
  70221. return ErrorCorrectionLevel.M;
  70222. case 'Q':
  70223. return ErrorCorrectionLevel.Q;
  70224. case 'H':
  70225. return ErrorCorrectionLevel.H;
  70226. default:
  70227. throw new _ArgumentException.default(s + 'not available');
  70228. }
  70229. };
  70230. ErrorCorrectionLevel.prototype.toString = function () {
  70231. return this.stringValue;
  70232. };
  70233. ErrorCorrectionLevel.prototype.equals = function (o) {
  70234. if (!(o instanceof ErrorCorrectionLevel)) {
  70235. return false;
  70236. }
  70237. var other = o;
  70238. return this.value === other.value;
  70239. };
  70240. /**
  70241. * @param bits int containing the two bits encoding a QR Code's error correction level
  70242. * @return ErrorCorrectionLevel representing the encoded error correction level
  70243. */
  70244. ErrorCorrectionLevel.forBits = function (bits /*int*/) {
  70245. if (bits < 0 || bits >= ErrorCorrectionLevel.FOR_BITS.size) {
  70246. throw new _IllegalArgumentException.default();
  70247. }
  70248. return ErrorCorrectionLevel.FOR_BITS.get(bits);
  70249. };
  70250. ErrorCorrectionLevel.FOR_BITS = new Map();
  70251. ErrorCorrectionLevel.FOR_VALUE = new Map();
  70252. /** L = ~7% correction */
  70253. ErrorCorrectionLevel.L = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.L, 'L', 0x01);
  70254. /** M = ~15% correction */
  70255. ErrorCorrectionLevel.M = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.M, 'M', 0x00);
  70256. /** Q = ~25% correction */
  70257. ErrorCorrectionLevel.Q = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.Q, 'Q', 0x03);
  70258. /** H = ~30% correction */
  70259. ErrorCorrectionLevel.H = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.H, 'H', 0x02);
  70260. return ErrorCorrectionLevel;
  70261. }();
  70262. var _default = ErrorCorrectionLevel;
  70263. exports.default = _default;
  70264. /***/ }),
  70265. /* 420 */
  70266. /*!*******************************************************************************************!*\
  70267. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/ECBlocks.js ***!
  70268. \*******************************************************************************************/
  70269. /*! no static exports found */
  70270. /***/ (function(module, exports, __webpack_require__) {
  70271. "use strict";
  70272. Object.defineProperty(exports, "__esModule", {
  70273. value: true
  70274. });
  70275. exports.default = void 0;
  70276. var __values = void 0 && (void 0).__values || function (o) {
  70277. var s = typeof Symbol === "function" && Symbol.iterator,
  70278. m = s && o[s],
  70279. i = 0;
  70280. if (m) return m.call(o);
  70281. if (o && typeof o.length === "number") return {
  70282. next: function next() {
  70283. if (o && i >= o.length) o = void 0;
  70284. return {
  70285. value: o && o[i++],
  70286. done: !o
  70287. };
  70288. }
  70289. };
  70290. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  70291. };
  70292. /**
  70293. * <p>Encapsulates a set of error-correction blocks in one symbol version. Most versions will
  70294. * use blocks of differing sizes within one version, so, this encapsulates the parameters for
  70295. * each set of blocks. It also holds the number of error-correction codewords per block since it
  70296. * will be the same across all blocks within one version.</p>
  70297. */
  70298. var ECBlocks = /** @class */function () {
  70299. function ECBlocks(ecCodewordsPerBlock /*int*/) {
  70300. var ecBlocks = [];
  70301. for (var _i = 1; _i < arguments.length; _i++) {
  70302. ecBlocks[_i - 1] = arguments[_i];
  70303. }
  70304. this.ecCodewordsPerBlock = ecCodewordsPerBlock;
  70305. this.ecBlocks = ecBlocks;
  70306. }
  70307. ECBlocks.prototype.getECCodewordsPerBlock = function () {
  70308. return this.ecCodewordsPerBlock;
  70309. };
  70310. ECBlocks.prototype.getNumBlocks = function () {
  70311. var e_1, _a;
  70312. var total = 0;
  70313. var ecBlocks = this.ecBlocks;
  70314. try {
  70315. for (var ecBlocks_1 = __values(ecBlocks), ecBlocks_1_1 = ecBlocks_1.next(); !ecBlocks_1_1.done; ecBlocks_1_1 = ecBlocks_1.next()) {
  70316. var ecBlock = ecBlocks_1_1.value;
  70317. total += ecBlock.getCount();
  70318. }
  70319. } catch (e_1_1) {
  70320. e_1 = {
  70321. error: e_1_1
  70322. };
  70323. } finally {
  70324. try {
  70325. if (ecBlocks_1_1 && !ecBlocks_1_1.done && (_a = ecBlocks_1.return)) _a.call(ecBlocks_1);
  70326. } finally {
  70327. if (e_1) throw e_1.error;
  70328. }
  70329. }
  70330. return total;
  70331. };
  70332. ECBlocks.prototype.getTotalECCodewords = function () {
  70333. return this.ecCodewordsPerBlock * this.getNumBlocks();
  70334. };
  70335. ECBlocks.prototype.getECBlocks = function () {
  70336. return this.ecBlocks;
  70337. };
  70338. return ECBlocks;
  70339. }();
  70340. var _default = ECBlocks;
  70341. exports.default = _default;
  70342. /***/ }),
  70343. /* 421 */
  70344. /*!**************************************************************************************!*\
  70345. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/ECB.js ***!
  70346. \**************************************************************************************/
  70347. /*! no static exports found */
  70348. /***/ (function(module, exports, __webpack_require__) {
  70349. "use strict";
  70350. Object.defineProperty(exports, "__esModule", {
  70351. value: true
  70352. });
  70353. exports.default = void 0;
  70354. /**
  70355. * <p>Encapsulates the parameters for one error-correction block in one symbol version.
  70356. * This includes the number of data codewords, and the number of times a block with these
  70357. * parameters is used consecutively in the QR code version's format.</p>
  70358. */
  70359. var ECB = /** @class */function () {
  70360. function ECB(count /*int*/, dataCodewords /*int*/) {
  70361. this.count = count;
  70362. this.dataCodewords = dataCodewords;
  70363. }
  70364. ECB.prototype.getCount = function () {
  70365. return this.count;
  70366. };
  70367. ECB.prototype.getDataCodewords = function () {
  70368. return this.dataCodewords;
  70369. };
  70370. return ECB;
  70371. }();
  70372. var _default = ECB;
  70373. exports.default = _default;
  70374. /***/ }),
  70375. /* 422 */
  70376. /*!*******************************************************************************************!*\
  70377. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/DataMask.js ***!
  70378. \*******************************************************************************************/
  70379. /*! no static exports found */
  70380. /***/ (function(module, exports, __webpack_require__) {
  70381. "use strict";
  70382. Object.defineProperty(exports, "__esModule", {
  70383. value: true
  70384. });
  70385. exports.default = exports.DataMaskValues = void 0;
  70386. /*
  70387. * Copyright 2007 ZXing authors
  70388. *
  70389. * Licensed under the Apache License, Version 2.0 (the "License");
  70390. * you may not use this file except in compliance with the License.
  70391. * You may obtain a copy of the License at
  70392. *
  70393. * http://www.apache.org/licenses/LICENSE-2.0
  70394. *
  70395. * Unless required by applicable law or agreed to in writing, software
  70396. * distributed under the License is distributed on an "AS IS" BASIS,
  70397. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70398. * See the License for the specific language governing permissions and
  70399. * limitations under the License.
  70400. */
  70401. var DataMaskValues;
  70402. exports.DataMaskValues = DataMaskValues;
  70403. (function (DataMaskValues) {
  70404. DataMaskValues[DataMaskValues["DATA_MASK_000"] = 0] = "DATA_MASK_000";
  70405. DataMaskValues[DataMaskValues["DATA_MASK_001"] = 1] = "DATA_MASK_001";
  70406. DataMaskValues[DataMaskValues["DATA_MASK_010"] = 2] = "DATA_MASK_010";
  70407. DataMaskValues[DataMaskValues["DATA_MASK_011"] = 3] = "DATA_MASK_011";
  70408. DataMaskValues[DataMaskValues["DATA_MASK_100"] = 4] = "DATA_MASK_100";
  70409. DataMaskValues[DataMaskValues["DATA_MASK_101"] = 5] = "DATA_MASK_101";
  70410. DataMaskValues[DataMaskValues["DATA_MASK_110"] = 6] = "DATA_MASK_110";
  70411. DataMaskValues[DataMaskValues["DATA_MASK_111"] = 7] = "DATA_MASK_111";
  70412. })(DataMaskValues || (exports.DataMaskValues = DataMaskValues = {}));
  70413. /**
  70414. * <p>Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations
  70415. * of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix,
  70416. * including areas used for finder patterns, timing patterns, etc. These areas should be unused
  70417. * after the point they are unmasked anyway.</p>
  70418. *
  70419. * <p>Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position
  70420. * and j is row position. In fact, as the text says, i is row position and j is column position.</p>
  70421. *
  70422. * @author Sean Owen
  70423. */
  70424. var DataMask = /** @class */function () {
  70425. // See ISO 18004:2006 6.8.1
  70426. function DataMask(value, isMasked) {
  70427. this.value = value;
  70428. this.isMasked = isMasked;
  70429. }
  70430. // End of enum constants.
  70431. /**
  70432. * <p>Implementations of this method reverse the data masking process applied to a QR Code and
  70433. * make its bits ready to read.</p>
  70434. *
  70435. * @param bits representation of QR Code bits
  70436. * @param dimension dimension of QR Code, represented by bits, being unmasked
  70437. */
  70438. DataMask.prototype.unmaskBitMatrix = function (bits, dimension /*int*/) {
  70439. for (var i = 0; i < dimension; i++) {
  70440. for (var j = 0; j < dimension; j++) {
  70441. if (this.isMasked(i, j)) {
  70442. bits.flip(j, i);
  70443. }
  70444. }
  70445. }
  70446. };
  70447. DataMask.values = new Map([
  70448. /**
  70449. * 000: mask bits for which (x + y) mod 2 == 0
  70450. */
  70451. [DataMaskValues.DATA_MASK_000, new DataMask(DataMaskValues.DATA_MASK_000, function (i /*int*/, j /*int*/) {
  70452. return (i + j & 0x01) === 0;
  70453. })],
  70454. /**
  70455. * 001: mask bits for which x mod 2 == 0
  70456. */
  70457. [DataMaskValues.DATA_MASK_001, new DataMask(DataMaskValues.DATA_MASK_001, function (i /*int*/, j /*int*/) {
  70458. return (i & 0x01) === 0;
  70459. })],
  70460. /**
  70461. * 010: mask bits for which y mod 3 == 0
  70462. */
  70463. [DataMaskValues.DATA_MASK_010, new DataMask(DataMaskValues.DATA_MASK_010, function (i /*int*/, j /*int*/) {
  70464. return j % 3 === 0;
  70465. })],
  70466. /**
  70467. * 011: mask bits for which (x + y) mod 3 == 0
  70468. */
  70469. [DataMaskValues.DATA_MASK_011, new DataMask(DataMaskValues.DATA_MASK_011, function (i /*int*/, j /*int*/) {
  70470. return (i + j) % 3 === 0;
  70471. })],
  70472. /**
  70473. * 100: mask bits for which (x/2 + y/3) mod 2 == 0
  70474. */
  70475. [DataMaskValues.DATA_MASK_100, new DataMask(DataMaskValues.DATA_MASK_100, function (i /*int*/, j /*int*/) {
  70476. return (Math.floor(i / 2) + Math.floor(j / 3) & 0x01) === 0;
  70477. })],
  70478. /**
  70479. * 101: mask bits for which xy mod 2 + xy mod 3 == 0
  70480. * equivalently, such that xy mod 6 == 0
  70481. */
  70482. [DataMaskValues.DATA_MASK_101, new DataMask(DataMaskValues.DATA_MASK_101, function (i /*int*/, j /*int*/) {
  70483. return i * j % 6 === 0;
  70484. })],
  70485. /**
  70486. * 110: mask bits for which (xy mod 2 + xy mod 3) mod 2 == 0
  70487. * equivalently, such that xy mod 6 < 3
  70488. */
  70489. [DataMaskValues.DATA_MASK_110, new DataMask(DataMaskValues.DATA_MASK_110, function (i /*int*/, j /*int*/) {
  70490. return i * j % 6 < 3;
  70491. })],
  70492. /**
  70493. * 111: mask bits for which ((x+y)mod 2 + xy mod 3) mod 2 == 0
  70494. * equivalently, such that (x + y + xy mod 3) mod 2 == 0
  70495. */
  70496. [DataMaskValues.DATA_MASK_111, new DataMask(DataMaskValues.DATA_MASK_111, function (i /*int*/, j /*int*/) {
  70497. return (i + j + i * j % 3 & 0x01) === 0;
  70498. })]]);
  70499. return DataMask;
  70500. }();
  70501. var _default = DataMask;
  70502. exports.default = _default;
  70503. /***/ }),
  70504. /* 423 */
  70505. /*!********************************************************************************************!*\
  70506. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/DataBlock.js ***!
  70507. \********************************************************************************************/
  70508. /*! no static exports found */
  70509. /***/ (function(module, exports, __webpack_require__) {
  70510. "use strict";
  70511. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  70512. Object.defineProperty(exports, "__esModule", {
  70513. value: true
  70514. });
  70515. exports.default = void 0;
  70516. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  70517. /*
  70518. * Copyright 2007 ZXing authors
  70519. *
  70520. * Licensed under the Apache License, Version 2.0 (the "License");
  70521. * you may not use this file except in compliance with the License.
  70522. * You may obtain a copy of the License at
  70523. *
  70524. * http://www.apache.org/licenses/LICENSE-2.0
  70525. *
  70526. * Unless required by applicable law or agreed to in writing, software
  70527. * distributed under the License is distributed on an "AS IS" BASIS,
  70528. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70529. * See the License for the specific language governing permissions and
  70530. * limitations under the License.
  70531. */
  70532. var __values = void 0 && (void 0).__values || function (o) {
  70533. var s = typeof Symbol === "function" && Symbol.iterator,
  70534. m = s && o[s],
  70535. i = 0;
  70536. if (m) return m.call(o);
  70537. if (o && typeof o.length === "number") return {
  70538. next: function next() {
  70539. if (o && i >= o.length) o = void 0;
  70540. return {
  70541. value: o && o[i++],
  70542. done: !o
  70543. };
  70544. }
  70545. };
  70546. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  70547. };
  70548. /**
  70549. * <p>Encapsulates a block of data within a QR Code. QR Codes may split their data into
  70550. * multiple blocks, each of which is a unit of data and error-correction codewords. Each
  70551. * is represented by an instance of this class.</p>
  70552. *
  70553. * @author Sean Owen
  70554. */
  70555. var DataBlock = /** @class */function () {
  70556. function DataBlock(numDataCodewords /*int*/, codewords) {
  70557. this.numDataCodewords = numDataCodewords;
  70558. this.codewords = codewords;
  70559. }
  70560. /**
  70561. * <p>When QR Codes use multiple data blocks, they are actually interleaved.
  70562. * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This
  70563. * method will separate the data into original blocks.</p>
  70564. *
  70565. * @param rawCodewords bytes as read directly from the QR Code
  70566. * @param version version of the QR Code
  70567. * @param ecLevel error-correction level of the QR Code
  70568. * @return DataBlocks containing original bytes, "de-interleaved" from representation in the
  70569. * QR Code
  70570. */
  70571. DataBlock.getDataBlocks = function (rawCodewords, version, ecLevel) {
  70572. var e_1, _a, e_2, _b;
  70573. if (rawCodewords.length !== version.getTotalCodewords()) {
  70574. throw new _IllegalArgumentException.default();
  70575. }
  70576. // Figure out the number and size of data blocks used by this version and
  70577. // error correction level
  70578. var ecBlocks = version.getECBlocksForLevel(ecLevel);
  70579. // First count the total number of data blocks
  70580. var totalBlocks = 0;
  70581. var ecBlockArray = ecBlocks.getECBlocks();
  70582. try {
  70583. for (var ecBlockArray_1 = __values(ecBlockArray), ecBlockArray_1_1 = ecBlockArray_1.next(); !ecBlockArray_1_1.done; ecBlockArray_1_1 = ecBlockArray_1.next()) {
  70584. var ecBlock = ecBlockArray_1_1.value;
  70585. totalBlocks += ecBlock.getCount();
  70586. }
  70587. } catch (e_1_1) {
  70588. e_1 = {
  70589. error: e_1_1
  70590. };
  70591. } finally {
  70592. try {
  70593. if (ecBlockArray_1_1 && !ecBlockArray_1_1.done && (_a = ecBlockArray_1.return)) _a.call(ecBlockArray_1);
  70594. } finally {
  70595. if (e_1) throw e_1.error;
  70596. }
  70597. }
  70598. // Now establish DataBlocks of the appropriate size and number of data codewords
  70599. var result = new Array(totalBlocks);
  70600. var numResultBlocks = 0;
  70601. try {
  70602. for (var ecBlockArray_2 = __values(ecBlockArray), ecBlockArray_2_1 = ecBlockArray_2.next(); !ecBlockArray_2_1.done; ecBlockArray_2_1 = ecBlockArray_2.next()) {
  70603. var ecBlock = ecBlockArray_2_1.value;
  70604. for (var i = 0; i < ecBlock.getCount(); i++) {
  70605. var numDataCodewords = ecBlock.getDataCodewords();
  70606. var numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
  70607. result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
  70608. }
  70609. }
  70610. } catch (e_2_1) {
  70611. e_2 = {
  70612. error: e_2_1
  70613. };
  70614. } finally {
  70615. try {
  70616. if (ecBlockArray_2_1 && !ecBlockArray_2_1.done && (_b = ecBlockArray_2.return)) _b.call(ecBlockArray_2);
  70617. } finally {
  70618. if (e_2) throw e_2.error;
  70619. }
  70620. }
  70621. // All blocks have the same amount of data, except that the last n
  70622. // (where n may be 0) have 1 more byte. Figure out where these start.
  70623. var shorterBlocksTotalCodewords = result[0].codewords.length;
  70624. var longerBlocksStartAt = result.length - 1;
  70625. // TYPESCRIPTPORT: check length is correct here
  70626. while (longerBlocksStartAt >= 0) {
  70627. var numCodewords = result[longerBlocksStartAt].codewords.length;
  70628. if (numCodewords === shorterBlocksTotalCodewords) {
  70629. break;
  70630. }
  70631. longerBlocksStartAt--;
  70632. }
  70633. longerBlocksStartAt++;
  70634. var shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.getECCodewordsPerBlock();
  70635. // The last elements of result may be 1 element longer
  70636. // first fill out as many elements as all of them have
  70637. var rawCodewordsOffset = 0;
  70638. for (var i = 0; i < shorterBlocksNumDataCodewords; i++) {
  70639. for (var j = 0; j < numResultBlocks; j++) {
  70640. result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
  70641. }
  70642. }
  70643. // Fill out the last data block in the longer ones
  70644. for (var j = longerBlocksStartAt; j < numResultBlocks; j++) {
  70645. result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
  70646. }
  70647. // Now add in error correction blocks
  70648. var max = result[0].codewords.length;
  70649. for (var i = shorterBlocksNumDataCodewords; i < max; i++) {
  70650. for (var j = 0; j < numResultBlocks; j++) {
  70651. var iOffset = j < longerBlocksStartAt ? i : i + 1;
  70652. result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
  70653. }
  70654. }
  70655. return result;
  70656. };
  70657. DataBlock.prototype.getNumDataCodewords = function () {
  70658. return this.numDataCodewords;
  70659. };
  70660. DataBlock.prototype.getCodewords = function () {
  70661. return this.codewords;
  70662. };
  70663. return DataBlock;
  70664. }();
  70665. var _default = DataBlock;
  70666. exports.default = _default;
  70667. /***/ }),
  70668. /* 424 */
  70669. /*!*********************************************************************************************************!*\
  70670. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/DecodedBitStreamParser.js ***!
  70671. \*********************************************************************************************************/
  70672. /*! no static exports found */
  70673. /***/ (function(module, exports, __webpack_require__) {
  70674. "use strict";
  70675. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  70676. Object.defineProperty(exports, "__esModule", {
  70677. value: true
  70678. });
  70679. exports.default = void 0;
  70680. var _BitSource = _interopRequireDefault(__webpack_require__(/*! ../../common/BitSource */ 410));
  70681. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../../common/CharacterSetECI */ 323));
  70682. var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
  70683. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  70684. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  70685. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  70686. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
  70687. var _Mode = _interopRequireDefault(__webpack_require__(/*! ./Mode */ 425));
  70688. /*
  70689. * Copyright 2007 ZXing authors
  70690. *
  70691. * Licensed under the Apache License, Version 2.0 (the "License");
  70692. * you may not use this file except in compliance with the License.
  70693. * You may obtain a copy of the License at
  70694. *
  70695. * http://www.apache.org/licenses/LICENSE-2.0
  70696. *
  70697. * Unless required by applicable law or agreed to in writing, software
  70698. * distributed under the License is distributed on an "AS IS" BASIS,
  70699. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70700. * See the License for the specific language governing permissions and
  70701. * limitations under the License.
  70702. */
  70703. /*namespace com.google.zxing.qrcode.decoder {*/
  70704. /*import java.io.UnsupportedEncodingException;*/
  70705. /*import java.util.ArrayList;*/
  70706. /*import java.util.Collection;*/
  70707. /*import java.util.List;*/
  70708. /*import java.util.Map;*/
  70709. /**
  70710. * <p>QR Codes can encode text as bits in one of several modes, and can use multiple modes
  70711. * in one QR Code. This class decodes the bits back into text.</p>
  70712. *
  70713. * <p>See ISO 18004:2006, 6.4.3 - 6.4.7</p>
  70714. *
  70715. * @author Sean Owen
  70716. */
  70717. var DecodedBitStreamParser = /** @class */function () {
  70718. function DecodedBitStreamParser() {}
  70719. DecodedBitStreamParser.decode = function (bytes, version, ecLevel, hints) {
  70720. var bits = new _BitSource.default(bytes);
  70721. var result = new _StringBuilder.default();
  70722. var byteSegments = new Array(); // 1
  70723. // TYPESCRIPTPORT: I do not use constructor with size 1 as in original Java means capacity and the array length is checked below
  70724. var symbolSequence = -1;
  70725. var parityData = -1;
  70726. try {
  70727. var currentCharacterSetECI = null;
  70728. var fc1InEffect = false;
  70729. var mode = void 0;
  70730. do {
  70731. // While still another segment to read...
  70732. if (bits.available() < 4) {
  70733. // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here
  70734. mode = _Mode.default.TERMINATOR;
  70735. } else {
  70736. var modeBits = bits.readBits(4);
  70737. mode = _Mode.default.forBits(modeBits); // mode is encoded by 4 bits
  70738. }
  70739. switch (mode) {
  70740. case _Mode.default.TERMINATOR:
  70741. break;
  70742. case _Mode.default.FNC1_FIRST_POSITION:
  70743. case _Mode.default.FNC1_SECOND_POSITION:
  70744. // We do little with FNC1 except alter the parsed result a bit according to the spec
  70745. fc1InEffect = true;
  70746. break;
  70747. case _Mode.default.STRUCTURED_APPEND:
  70748. if (bits.available() < 16) {
  70749. throw new _FormatException.default();
  70750. }
  70751. // sequence number and parity is added later to the result metadata
  70752. // Read next 8 bits (symbol sequence #) and 8 bits (data: parity), then continue
  70753. symbolSequence = bits.readBits(8);
  70754. parityData = bits.readBits(8);
  70755. break;
  70756. case _Mode.default.ECI:
  70757. // Count doesn't apply to ECI
  70758. var value = DecodedBitStreamParser.parseECIValue(bits);
  70759. currentCharacterSetECI = _CharacterSetECI.default.getCharacterSetECIByValue(value);
  70760. if (currentCharacterSetECI === null) {
  70761. throw new _FormatException.default();
  70762. }
  70763. break;
  70764. case _Mode.default.HANZI:
  70765. // First handle Hanzi mode which does not start with character count
  70766. // Chinese mode contains a sub set indicator right after mode indicator
  70767. var subset = bits.readBits(4);
  70768. var countHanzi = bits.readBits(mode.getCharacterCountBits(version));
  70769. if (subset === DecodedBitStreamParser.GB2312_SUBSET) {
  70770. DecodedBitStreamParser.decodeHanziSegment(bits, result, countHanzi);
  70771. }
  70772. break;
  70773. default:
  70774. // "Normal" QR code modes:
  70775. // How many characters will follow, encoded in this mode?
  70776. var count = bits.readBits(mode.getCharacterCountBits(version));
  70777. switch (mode) {
  70778. case _Mode.default.NUMERIC:
  70779. DecodedBitStreamParser.decodeNumericSegment(bits, result, count);
  70780. break;
  70781. case _Mode.default.ALPHANUMERIC:
  70782. DecodedBitStreamParser.decodeAlphanumericSegment(bits, result, count, fc1InEffect);
  70783. break;
  70784. case _Mode.default.BYTE:
  70785. DecodedBitStreamParser.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);
  70786. break;
  70787. case _Mode.default.KANJI:
  70788. DecodedBitStreamParser.decodeKanjiSegment(bits, result, count);
  70789. break;
  70790. default:
  70791. throw new _FormatException.default();
  70792. }
  70793. break;
  70794. }
  70795. } while (mode !== _Mode.default.TERMINATOR);
  70796. } catch (iae /*: IllegalArgumentException*/) {
  70797. // from readBits() calls
  70798. throw new _FormatException.default();
  70799. }
  70800. return new _DecoderResult.default(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, ecLevel === null ? null : ecLevel.toString(), symbolSequence, parityData);
  70801. };
  70802. /**
  70803. * See specification GBT 18284-2000
  70804. */
  70805. DecodedBitStreamParser.decodeHanziSegment = function (bits, result, count /*int*/) {
  70806. // Don't crash trying to read more bits than we have available.
  70807. if (count * 13 > bits.available()) {
  70808. throw new _FormatException.default();
  70809. }
  70810. // Each character will require 2 bytes. Read the characters as 2-byte pairs
  70811. // and decode as GB2312 afterwards
  70812. var buffer = new Uint8Array(2 * count);
  70813. var offset = 0;
  70814. while (count > 0) {
  70815. // Each 13 bits encodes a 2-byte character
  70816. var twoBytes = bits.readBits(13);
  70817. var assembledTwoBytes = twoBytes / 0x060 << 8 & 0xFFFFFFFF | twoBytes % 0x060;
  70818. if (assembledTwoBytes < 0x003BF) {
  70819. // In the 0xA1A1 to 0xAAFE range
  70820. assembledTwoBytes += 0x0A1A1;
  70821. } else {
  70822. // In the 0xB0A1 to 0xFAFE range
  70823. assembledTwoBytes += 0x0A6A1;
  70824. }
  70825. buffer[offset] = /*(byte) */assembledTwoBytes >> 8 & 0xFF;
  70826. buffer[offset + 1] = /*(byte) */assembledTwoBytes & 0xFF;
  70827. offset += 2;
  70828. count--;
  70829. }
  70830. try {
  70831. result.append(_StringEncoding.default.decode(buffer, _StringUtils.default.GB2312));
  70832. // TYPESCRIPTPORT: TODO: implement GB2312 decode. StringView from MDN could be a starting point
  70833. } catch (ignored /*: UnsupportedEncodingException*/) {
  70834. throw new _FormatException.default(ignored);
  70835. }
  70836. };
  70837. DecodedBitStreamParser.decodeKanjiSegment = function (bits, result, count /*int*/) {
  70838. // Don't crash trying to read more bits than we have available.
  70839. if (count * 13 > bits.available()) {
  70840. throw new _FormatException.default();
  70841. }
  70842. // Each character will require 2 bytes. Read the characters as 2-byte pairs
  70843. // and decode as Shift_JIS afterwards
  70844. var buffer = new Uint8Array(2 * count);
  70845. var offset = 0;
  70846. while (count > 0) {
  70847. // Each 13 bits encodes a 2-byte character
  70848. var twoBytes = bits.readBits(13);
  70849. var assembledTwoBytes = twoBytes / 0x0C0 << 8 & 0xFFFFFFFF | twoBytes % 0x0C0;
  70850. if (assembledTwoBytes < 0x01F00) {
  70851. // In the 0x8140 to 0x9FFC range
  70852. assembledTwoBytes += 0x08140;
  70853. } else {
  70854. // In the 0xE040 to 0xEBBF range
  70855. assembledTwoBytes += 0x0C140;
  70856. }
  70857. buffer[offset] = /*(byte) */assembledTwoBytes >> 8;
  70858. buffer[offset + 1] = /*(byte) */assembledTwoBytes;
  70859. offset += 2;
  70860. count--;
  70861. }
  70862. // Shift_JIS may not be supported in some environments:
  70863. try {
  70864. result.append(_StringEncoding.default.decode(buffer, _StringUtils.default.SHIFT_JIS));
  70865. // TYPESCRIPTPORT: TODO: implement SHIFT_JIS decode. StringView from MDN could be a starting point
  70866. } catch (ignored /*: UnsupportedEncodingException*/) {
  70867. throw new _FormatException.default(ignored);
  70868. }
  70869. };
  70870. DecodedBitStreamParser.decodeByteSegment = function (bits, result, count /*int*/, currentCharacterSetECI, byteSegments, hints) {
  70871. // Don't crash trying to read more bits than we have available.
  70872. if (8 * count > bits.available()) {
  70873. throw new _FormatException.default();
  70874. }
  70875. var readBytes = new Uint8Array(count);
  70876. for (var i = 0; i < count; i++) {
  70877. readBytes[i] = /*(byte) */bits.readBits(8);
  70878. }
  70879. var encoding;
  70880. if (currentCharacterSetECI === null) {
  70881. // The spec isn't clear on this mode; see
  70882. // section 6.4.5: t does not say which encoding to assuming
  70883. // upon decoding. I have seen ISO-8859-1 used as well as
  70884. // Shift_JIS -- without anything like an ECI designator to
  70885. // give a hint.
  70886. encoding = _StringUtils.default.guessEncoding(readBytes, hints);
  70887. } else {
  70888. encoding = currentCharacterSetECI.getName();
  70889. }
  70890. try {
  70891. result.append(_StringEncoding.default.decode(readBytes, encoding));
  70892. } catch (ignored /*: UnsupportedEncodingException*/) {
  70893. throw new _FormatException.default(ignored);
  70894. }
  70895. byteSegments.push(readBytes);
  70896. };
  70897. DecodedBitStreamParser.toAlphaNumericChar = function (value /*int*/) {
  70898. if (value >= DecodedBitStreamParser.ALPHANUMERIC_CHARS.length) {
  70899. throw new _FormatException.default();
  70900. }
  70901. return DecodedBitStreamParser.ALPHANUMERIC_CHARS[value];
  70902. };
  70903. DecodedBitStreamParser.decodeAlphanumericSegment = function (bits, result, count /*int*/, fc1InEffect) {
  70904. // Read two characters at a time
  70905. var start = result.length();
  70906. while (count > 1) {
  70907. if (bits.available() < 11) {
  70908. throw new _FormatException.default();
  70909. }
  70910. var nextTwoCharsBits = bits.readBits(11);
  70911. result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));
  70912. result.append(DecodedBitStreamParser.toAlphaNumericChar(nextTwoCharsBits % 45));
  70913. count -= 2;
  70914. }
  70915. if (count === 1) {
  70916. // special case: one character left
  70917. if (bits.available() < 6) {
  70918. throw new _FormatException.default();
  70919. }
  70920. result.append(DecodedBitStreamParser.toAlphaNumericChar(bits.readBits(6)));
  70921. }
  70922. // See section 6.4.8.1, 6.4.8.2
  70923. if (fc1InEffect) {
  70924. // We need to massage the result a bit if in an FNC1 mode:
  70925. for (var i = start; i < result.length(); i++) {
  70926. if (result.charAt(i) === '%') {
  70927. if (i < result.length() - 1 && result.charAt(i + 1) === '%') {
  70928. // %% is rendered as %
  70929. result.deleteCharAt(i + 1);
  70930. } else {
  70931. // In alpha mode, % should be converted to FNC1 separator 0x1D
  70932. result.setCharAt(i, String.fromCharCode(0x1D));
  70933. }
  70934. }
  70935. }
  70936. }
  70937. };
  70938. DecodedBitStreamParser.decodeNumericSegment = function (bits, result, count /*int*/) {
  70939. // Read three digits at a time
  70940. while (count >= 3) {
  70941. // Each 10 bits encodes three digits
  70942. if (bits.available() < 10) {
  70943. throw new _FormatException.default();
  70944. }
  70945. var threeDigitsBits = bits.readBits(10);
  70946. if (threeDigitsBits >= 1000) {
  70947. throw new _FormatException.default();
  70948. }
  70949. result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));
  70950. result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));
  70951. result.append(DecodedBitStreamParser.toAlphaNumericChar(threeDigitsBits % 10));
  70952. count -= 3;
  70953. }
  70954. if (count === 2) {
  70955. // Two digits left over to read, encoded in 7 bits
  70956. if (bits.available() < 7) {
  70957. throw new _FormatException.default();
  70958. }
  70959. var twoDigitsBits = bits.readBits(7);
  70960. if (twoDigitsBits >= 100) {
  70961. throw new _FormatException.default();
  70962. }
  70963. result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));
  70964. result.append(DecodedBitStreamParser.toAlphaNumericChar(twoDigitsBits % 10));
  70965. } else if (count === 1) {
  70966. // One digit left over to read
  70967. if (bits.available() < 4) {
  70968. throw new _FormatException.default();
  70969. }
  70970. var digitBits = bits.readBits(4);
  70971. if (digitBits >= 10) {
  70972. throw new _FormatException.default();
  70973. }
  70974. result.append(DecodedBitStreamParser.toAlphaNumericChar(digitBits));
  70975. }
  70976. };
  70977. DecodedBitStreamParser.parseECIValue = function (bits) {
  70978. var firstByte = bits.readBits(8);
  70979. if ((firstByte & 0x80) === 0) {
  70980. // just one byte
  70981. return firstByte & 0x7F;
  70982. }
  70983. if ((firstByte & 0xC0) === 0x80) {
  70984. // two bytes
  70985. var secondByte = bits.readBits(8);
  70986. return (firstByte & 0x3F) << 8 & 0xFFFFFFFF | secondByte;
  70987. }
  70988. if ((firstByte & 0xE0) === 0xC0) {
  70989. // three bytes
  70990. var secondThirdBytes = bits.readBits(16);
  70991. return (firstByte & 0x1F) << 16 & 0xFFFFFFFF | secondThirdBytes;
  70992. }
  70993. throw new _FormatException.default();
  70994. };
  70995. /**
  70996. * See ISO 18004:2006, 6.4.4 Table 5
  70997. */
  70998. DecodedBitStreamParser.ALPHANUMERIC_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';
  70999. DecodedBitStreamParser.GB2312_SUBSET = 1;
  71000. return DecodedBitStreamParser;
  71001. }();
  71002. var _default = DecodedBitStreamParser; // function Uint8ArrayToString(a: Uint8Array): string {
  71003. // const CHUNK_SZ = 0x8000;
  71004. // const c = new StringBuilder();
  71005. // for (let i = 0, length = a.length; i < length; i += CHUNK_SZ) {
  71006. // c.append(String.fromCharCode.apply(null, a.subarray(i, i + CHUNK_SZ)));
  71007. // }
  71008. // return c.toString();
  71009. // }
  71010. exports.default = _default;
  71011. /***/ }),
  71012. /* 425 */
  71013. /*!***************************************************************************************!*\
  71014. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/Mode.js ***!
  71015. \***************************************************************************************/
  71016. /*! no static exports found */
  71017. /***/ (function(module, exports, __webpack_require__) {
  71018. "use strict";
  71019. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  71020. Object.defineProperty(exports, "__esModule", {
  71021. value: true
  71022. });
  71023. exports.default = exports.ModeValues = void 0;
  71024. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  71025. /*
  71026. * Copyright 2007 ZXing authors
  71027. *
  71028. * Licensed under the Apache License, Version 2.0 (the "License");
  71029. * you may not use this file except in compliance with the License.
  71030. * You may obtain a copy of the License at
  71031. *
  71032. * http://www.apache.org/licenses/LICENSE-2.0
  71033. *
  71034. * Unless required by applicable law or agreed to in writing, software
  71035. * distributed under the License is distributed on an "AS IS" BASIS,
  71036. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71037. * See the License for the specific language governing permissions and
  71038. * limitations under the License.
  71039. */
  71040. var ModeValues;
  71041. exports.ModeValues = ModeValues;
  71042. (function (ModeValues) {
  71043. ModeValues[ModeValues["TERMINATOR"] = 0] = "TERMINATOR";
  71044. ModeValues[ModeValues["NUMERIC"] = 1] = "NUMERIC";
  71045. ModeValues[ModeValues["ALPHANUMERIC"] = 2] = "ALPHANUMERIC";
  71046. ModeValues[ModeValues["STRUCTURED_APPEND"] = 3] = "STRUCTURED_APPEND";
  71047. ModeValues[ModeValues["BYTE"] = 4] = "BYTE";
  71048. ModeValues[ModeValues["ECI"] = 5] = "ECI";
  71049. ModeValues[ModeValues["KANJI"] = 6] = "KANJI";
  71050. ModeValues[ModeValues["FNC1_FIRST_POSITION"] = 7] = "FNC1_FIRST_POSITION";
  71051. ModeValues[ModeValues["FNC1_SECOND_POSITION"] = 8] = "FNC1_SECOND_POSITION";
  71052. /** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */
  71053. ModeValues[ModeValues["HANZI"] = 9] = "HANZI";
  71054. })(ModeValues || (exports.ModeValues = ModeValues = {}));
  71055. /**
  71056. * <p>See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which
  71057. * data can be encoded to bits in the QR code standard.</p>
  71058. *
  71059. * @author Sean Owen
  71060. */
  71061. var Mode = /** @class */function () {
  71062. function Mode(value, stringValue, characterCountBitsForVersions, bits /*int*/) {
  71063. this.value = value;
  71064. this.stringValue = stringValue;
  71065. this.characterCountBitsForVersions = characterCountBitsForVersions;
  71066. this.bits = bits;
  71067. Mode.FOR_BITS.set(bits, this);
  71068. Mode.FOR_VALUE.set(value, this);
  71069. }
  71070. /**
  71071. * @param bits four bits encoding a QR Code data mode
  71072. * @return Mode encoded by these bits
  71073. * @throws IllegalArgumentException if bits do not correspond to a known mode
  71074. */
  71075. Mode.forBits = function (bits /*int*/) {
  71076. var mode = Mode.FOR_BITS.get(bits);
  71077. if (undefined === mode) {
  71078. throw new _IllegalArgumentException.default();
  71079. }
  71080. return mode;
  71081. };
  71082. /**
  71083. * @param version version in question
  71084. * @return number of bits used, in this QR Code symbol {@link Version}, to encode the
  71085. * count of characters that will follow encoded in this Mode
  71086. */
  71087. Mode.prototype.getCharacterCountBits = function (version) {
  71088. var versionNumber = version.getVersionNumber();
  71089. var offset;
  71090. if (versionNumber <= 9) {
  71091. offset = 0;
  71092. } else if (versionNumber <= 26) {
  71093. offset = 1;
  71094. } else {
  71095. offset = 2;
  71096. }
  71097. return this.characterCountBitsForVersions[offset];
  71098. };
  71099. Mode.prototype.getValue = function () {
  71100. return this.value;
  71101. };
  71102. Mode.prototype.getBits = function () {
  71103. return this.bits;
  71104. };
  71105. Mode.prototype.equals = function (o) {
  71106. if (!(o instanceof Mode)) {
  71107. return false;
  71108. }
  71109. var other = o;
  71110. return this.value === other.value;
  71111. };
  71112. Mode.prototype.toString = function () {
  71113. return this.stringValue;
  71114. };
  71115. Mode.FOR_BITS = new Map();
  71116. Mode.FOR_VALUE = new Map();
  71117. Mode.TERMINATOR = new Mode(ModeValues.TERMINATOR, 'TERMINATOR', Int32Array.from([0, 0, 0]), 0x00); // Not really a mode...
  71118. Mode.NUMERIC = new Mode(ModeValues.NUMERIC, 'NUMERIC', Int32Array.from([10, 12, 14]), 0x01);
  71119. Mode.ALPHANUMERIC = new Mode(ModeValues.ALPHANUMERIC, 'ALPHANUMERIC', Int32Array.from([9, 11, 13]), 0x02);
  71120. Mode.STRUCTURED_APPEND = new Mode(ModeValues.STRUCTURED_APPEND, 'STRUCTURED_APPEND', Int32Array.from([0, 0, 0]), 0x03); // Not supported
  71121. Mode.BYTE = new Mode(ModeValues.BYTE, 'BYTE', Int32Array.from([8, 16, 16]), 0x04);
  71122. Mode.ECI = new Mode(ModeValues.ECI, 'ECI', Int32Array.from([0, 0, 0]), 0x07); // character counts don't apply
  71123. Mode.KANJI = new Mode(ModeValues.KANJI, 'KANJI', Int32Array.from([8, 10, 12]), 0x08);
  71124. Mode.FNC1_FIRST_POSITION = new Mode(ModeValues.FNC1_FIRST_POSITION, 'FNC1_FIRST_POSITION', Int32Array.from([0, 0, 0]), 0x05);
  71125. Mode.FNC1_SECOND_POSITION = new Mode(ModeValues.FNC1_SECOND_POSITION, 'FNC1_SECOND_POSITION', Int32Array.from([0, 0, 0]), 0x09);
  71126. /** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */
  71127. Mode.HANZI = new Mode(ModeValues.HANZI, 'HANZI', Int32Array.from([8, 10, 12]), 0x0D);
  71128. return Mode;
  71129. }();
  71130. var _default = Mode;
  71131. exports.default = _default;
  71132. /***/ }),
  71133. /* 426 */
  71134. /*!********************************************************************************************************!*\
  71135. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/decoder/QRCodeDecoderMetaData.js ***!
  71136. \********************************************************************************************************/
  71137. /*! no static exports found */
  71138. /***/ (function(module, exports, __webpack_require__) {
  71139. "use strict";
  71140. Object.defineProperty(exports, "__esModule", {
  71141. value: true
  71142. });
  71143. exports.default = void 0;
  71144. /*
  71145. * Copyright 2013 ZXing authors
  71146. *
  71147. * Licensed under the Apache License, Version 2.0 (the "License");
  71148. * you may not use this file except in compliance with the License.
  71149. * You may obtain a copy of the License at
  71150. *
  71151. * http://www.apache.org/licenses/LICENSE-2.0
  71152. *
  71153. * Unless required by applicable law or agreed to in writing, software
  71154. * distributed under the License is distributed on an "AS IS" BASIS,
  71155. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71156. * See the License for the specific language governing permissions and
  71157. * limitations under the License.
  71158. */
  71159. /**
  71160. * Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the
  71161. * decoding caller. Callers are expected to process this.
  71162. *
  71163. * @see com.google.zxing.common.DecoderResult#getOther()
  71164. */
  71165. var QRCodeDecoderMetaData = /** @class */function () {
  71166. function QRCodeDecoderMetaData(mirrored) {
  71167. this.mirrored = mirrored;
  71168. }
  71169. /**
  71170. * @return true if the QR Code was mirrored.
  71171. */
  71172. QRCodeDecoderMetaData.prototype.isMirrored = function () {
  71173. return this.mirrored;
  71174. };
  71175. /**
  71176. * Apply the result points' order correction due to mirroring.
  71177. *
  71178. * @param points Array of points to apply mirror correction to.
  71179. */
  71180. QRCodeDecoderMetaData.prototype.applyMirroredCorrection = function (points) {
  71181. if (!this.mirrored || points === null || points.length < 3) {
  71182. return;
  71183. }
  71184. var bottomLeft = points[0];
  71185. points[0] = points[2];
  71186. points[2] = bottomLeft;
  71187. // No need to 'fix' top-left and alignment pattern.
  71188. };
  71189. return QRCodeDecoderMetaData;
  71190. }();
  71191. var _default = QRCodeDecoderMetaData;
  71192. exports.default = _default;
  71193. /***/ }),
  71194. /* 427 */
  71195. /*!********************************************************************************************!*\
  71196. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/Detector.js ***!
  71197. \********************************************************************************************/
  71198. /*! no static exports found */
  71199. /***/ (function(module, exports, __webpack_require__) {
  71200. "use strict";
  71201. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  71202. Object.defineProperty(exports, "__esModule", {
  71203. value: true
  71204. });
  71205. exports.default = void 0;
  71206. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
  71207. var _DetectorResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DetectorResult */ 350));
  71208. var _GridSamplerInstance = _interopRequireDefault(__webpack_require__(/*! ../../common/GridSamplerInstance */ 352));
  71209. var _PerspectiveTransform = _interopRequireDefault(__webpack_require__(/*! ../../common/PerspectiveTransform */ 355));
  71210. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../DecodeHintType */ 322));
  71211. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  71212. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  71213. var _Version = _interopRequireDefault(__webpack_require__(/*! ../decoder/Version */ 417));
  71214. var _AlignmentPatternFinder = _interopRequireDefault(__webpack_require__(/*! ./AlignmentPatternFinder */ 428));
  71215. var _FinderPatternFinder = _interopRequireDefault(__webpack_require__(/*! ./FinderPatternFinder */ 430));
  71216. /*
  71217. * Copyright 2007 ZXing authors
  71218. *
  71219. * Licensed under the Apache License, Version 2.0 (the "License");
  71220. * you may not use this file except in compliance with the License.
  71221. * You may obtain a copy of the License at
  71222. *
  71223. * http://www.apache.org/licenses/LICENSE-2.0
  71224. *
  71225. * Unless required by applicable law or agreed to in writing, software
  71226. * distributed under the License is distributed on an "AS IS" BASIS,
  71227. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71228. * See the License for the specific language governing permissions and
  71229. * limitations under the License.
  71230. */
  71231. // import GridSampler from '../../common/GridSampler';
  71232. /*import java.util.Map;*/
  71233. /**
  71234. * <p>Encapsulates logic that can detect a QR Code in an image, even if the QR Code
  71235. * is rotated or skewed, or partially obscured.</p>
  71236. *
  71237. * @author Sean Owen
  71238. */
  71239. var Detector = /** @class */function () {
  71240. function Detector(image) {
  71241. this.image = image;
  71242. }
  71243. Detector.prototype.getImage = function () {
  71244. return this.image;
  71245. };
  71246. Detector.prototype.getResultPointCallback = function () {
  71247. return this.resultPointCallback;
  71248. };
  71249. /**
  71250. * <p>Detects a QR Code in an image.</p>
  71251. *
  71252. * @return {@link DetectorResult} encapsulating results of detecting a QR Code
  71253. * @throws NotFoundException if QR Code cannot be found
  71254. * @throws FormatException if a QR Code cannot be decoded
  71255. */
  71256. // public detect(): DetectorResult /*throws NotFoundException, FormatException*/ {
  71257. // return detect(null)
  71258. // }
  71259. /**
  71260. * <p>Detects a QR Code in an image.</p>
  71261. *
  71262. * @param hints optional hints to detector
  71263. * @return {@link DetectorResult} encapsulating results of detecting a QR Code
  71264. * @throws NotFoundException if QR Code cannot be found
  71265. * @throws FormatException if a QR Code cannot be decoded
  71266. */
  71267. Detector.prototype.detect = function (hints) {
  71268. this.resultPointCallback = hints === null || hints === undefined ? null : /*(ResultPointCallback) */hints.get(_DecodeHintType.default.NEED_RESULT_POINT_CALLBACK);
  71269. var finder = new _FinderPatternFinder.default(this.image, this.resultPointCallback);
  71270. var info = finder.find(hints);
  71271. return this.processFinderPatternInfo(info);
  71272. };
  71273. Detector.prototype.processFinderPatternInfo = function (info) {
  71274. var topLeft = info.getTopLeft();
  71275. var topRight = info.getTopRight();
  71276. var bottomLeft = info.getBottomLeft();
  71277. var moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);
  71278. if (moduleSize < 1.0) {
  71279. throw new _NotFoundException.default('No pattern found in proccess finder.');
  71280. }
  71281. var dimension = Detector.computeDimension(topLeft, topRight, bottomLeft, moduleSize);
  71282. var provisionalVersion = _Version.default.getProvisionalVersionForDimension(dimension);
  71283. var modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7;
  71284. var alignmentPattern = null;
  71285. // Anything above version 1 has an alignment pattern
  71286. if (provisionalVersion.getAlignmentPatternCenters().length > 0) {
  71287. // Guess where a "bottom right" finder pattern would have been
  71288. var bottomRightX = topRight.getX() - topLeft.getX() + bottomLeft.getX();
  71289. var bottomRightY = topRight.getY() - topLeft.getY() + bottomLeft.getY();
  71290. // Estimate that alignment pattern is closer by 3 modules
  71291. // from "bottom right" to known top left location
  71292. var correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;
  71293. var estAlignmentX = /*(int) */Math.floor(topLeft.getX() + correctionToTopLeft * (bottomRightX - topLeft.getX()));
  71294. var estAlignmentY = /*(int) */Math.floor(topLeft.getY() + correctionToTopLeft * (bottomRightY - topLeft.getY()));
  71295. // Kind of arbitrary -- expand search radius before giving up
  71296. for (var i = 4; i <= 16; i <<= 1) {
  71297. try {
  71298. alignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);
  71299. break;
  71300. } catch (re /*NotFoundException*/) {
  71301. if (!(re instanceof _NotFoundException.default)) {
  71302. throw re;
  71303. }
  71304. // try next round
  71305. }
  71306. }
  71307. // If we didn't find alignment pattern... well try anyway without it
  71308. }
  71309. var transform = Detector.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
  71310. var bits = Detector.sampleGrid(this.image, transform, dimension);
  71311. var points;
  71312. if (alignmentPattern === null) {
  71313. points = [bottomLeft, topLeft, topRight];
  71314. } else {
  71315. points = [bottomLeft, topLeft, topRight, alignmentPattern];
  71316. }
  71317. return new _DetectorResult.default(bits, points);
  71318. };
  71319. Detector.createTransform = function (topLeft, topRight, bottomLeft, alignmentPattern, dimension /*int*/) {
  71320. var dimMinusThree = dimension - 3.5;
  71321. var bottomRightX; /*float*/
  71322. var bottomRightY; /*float*/
  71323. var sourceBottomRightX; /*float*/
  71324. var sourceBottomRightY; /*float*/
  71325. if (alignmentPattern !== null) {
  71326. bottomRightX = alignmentPattern.getX();
  71327. bottomRightY = alignmentPattern.getY();
  71328. sourceBottomRightX = dimMinusThree - 3.0;
  71329. sourceBottomRightY = sourceBottomRightX;
  71330. } else {
  71331. // Don't have an alignment pattern, just make up the bottom-right point
  71332. bottomRightX = topRight.getX() - topLeft.getX() + bottomLeft.getX();
  71333. bottomRightY = topRight.getY() - topLeft.getY() + bottomLeft.getY();
  71334. sourceBottomRightX = dimMinusThree;
  71335. sourceBottomRightY = dimMinusThree;
  71336. }
  71337. return _PerspectiveTransform.default.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.getX(), topLeft.getY(), topRight.getX(), topRight.getY(), bottomRightX, bottomRightY, bottomLeft.getX(), bottomLeft.getY());
  71338. };
  71339. Detector.sampleGrid = function (image, transform, dimension /*int*/) {
  71340. var sampler = _GridSamplerInstance.default.getInstance();
  71341. return sampler.sampleGridWithTransform(image, dimension, dimension, transform);
  71342. };
  71343. /**
  71344. * <p>Computes the dimension (number of modules on a size) of the QR Code based on the position
  71345. * of the finder patterns and estimated module size.</p>
  71346. */
  71347. Detector.computeDimension = function (topLeft, topRight, bottomLeft, moduleSize /*float*/) {
  71348. var tltrCentersDimension = _MathUtils.default.round(_ResultPoint.default.distance(topLeft, topRight) / moduleSize);
  71349. var tlblCentersDimension = _MathUtils.default.round(_ResultPoint.default.distance(topLeft, bottomLeft) / moduleSize);
  71350. var dimension = Math.floor((tltrCentersDimension + tlblCentersDimension) / 2) + 7;
  71351. switch (dimension & 0x03) {
  71352. // mod 4
  71353. case 0:
  71354. dimension++;
  71355. break;
  71356. // 1? do nothing
  71357. case 2:
  71358. dimension--;
  71359. break;
  71360. case 3:
  71361. throw new _NotFoundException.default('Dimensions could be not found.');
  71362. }
  71363. return dimension;
  71364. };
  71365. /**
  71366. * <p>Computes an average estimated module size based on estimated derived from the positions
  71367. * of the three finder patterns.</p>
  71368. *
  71369. * @param topLeft detected top-left finder pattern center
  71370. * @param topRight detected top-right finder pattern center
  71371. * @param bottomLeft detected bottom-left finder pattern center
  71372. * @return estimated module size
  71373. */
  71374. Detector.prototype.calculateModuleSize = function (topLeft, topRight, bottomLeft) {
  71375. // Take the average
  71376. return (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;
  71377. };
  71378. /**
  71379. * <p>Estimates module size based on two finder patterns -- it uses
  71380. * {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
  71381. * width of each, measuring along the axis between their centers.</p>
  71382. */
  71383. Detector.prototype.calculateModuleSizeOneWay = function (pattern, otherPattern) {
  71384. var moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays( /*(int) */Math.floor(pattern.getX()), /*(int) */Math.floor(pattern.getY()), /*(int) */Math.floor(otherPattern.getX()), /*(int) */Math.floor(otherPattern.getY()));
  71385. var moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays( /*(int) */Math.floor(otherPattern.getX()), /*(int) */Math.floor(otherPattern.getY()), /*(int) */Math.floor(pattern.getX()), /*(int) */Math.floor(pattern.getY()));
  71386. if (isNaN(moduleSizeEst1)) {
  71387. return moduleSizeEst2 / 7.0;
  71388. }
  71389. if (isNaN(moduleSizeEst2)) {
  71390. return moduleSizeEst1 / 7.0;
  71391. }
  71392. // Average them, and divide by 7 since we've counted the width of 3 black modules,
  71393. // and 1 white and 1 black module on either side. Ergo, divide sum by 14.
  71394. return (moduleSizeEst1 + moduleSizeEst2) / 14.0;
  71395. };
  71396. /**
  71397. * See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of
  71398. * a finder pattern by looking for a black-white-black run from the center in the direction
  71399. * of another point (another finder pattern center), and in the opposite direction too.
  71400. */
  71401. Detector.prototype.sizeOfBlackWhiteBlackRunBothWays = function (fromX /*int*/, fromY /*int*/, toX /*int*/, toY /*int*/) {
  71402. var result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);
  71403. // Now count other way -- don't run off image though of course
  71404. var scale = 1.0;
  71405. var otherToX = fromX - (toX - fromX);
  71406. if (otherToX < 0) {
  71407. scale = fromX / ( /*(float) */fromX - otherToX);
  71408. otherToX = 0;
  71409. } else if (otherToX >= this.image.getWidth()) {
  71410. scale = (this.image.getWidth() - 1 - fromX) / ( /*(float) */otherToX - fromX);
  71411. otherToX = this.image.getWidth() - 1;
  71412. }
  71413. var otherToY = /*(int) */Math.floor(fromY - (toY - fromY) * scale);
  71414. scale = 1.0;
  71415. if (otherToY < 0) {
  71416. scale = fromY / ( /*(float) */fromY - otherToY);
  71417. otherToY = 0;
  71418. } else if (otherToY >= this.image.getHeight()) {
  71419. scale = (this.image.getHeight() - 1 - fromY) / ( /*(float) */otherToY - fromY);
  71420. otherToY = this.image.getHeight() - 1;
  71421. }
  71422. otherToX = /*(int) */Math.floor(fromX + (otherToX - fromX) * scale);
  71423. result += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
  71424. // Middle pixel is double-counted this way; subtract 1
  71425. return result - 1.0;
  71426. };
  71427. /**
  71428. * <p>This method traces a line from a point in the image, in the direction towards another point.
  71429. * It begins in a black region, and keeps going until it finds white, then black, then white again.
  71430. * It reports the distance from the start to this point.</p>
  71431. *
  71432. * <p>This is used when figuring out how wide a finder pattern is, when the finder pattern
  71433. * may be skewed or rotated.</p>
  71434. */
  71435. Detector.prototype.sizeOfBlackWhiteBlackRun = function (fromX /*int*/, fromY /*int*/, toX /*int*/, toY /*int*/) {
  71436. // Mild variant of Bresenham's algorithm
  71437. // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
  71438. var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
  71439. if (steep) {
  71440. var temp = fromX;
  71441. fromX = fromY;
  71442. fromY = temp;
  71443. temp = toX;
  71444. toX = toY;
  71445. toY = temp;
  71446. }
  71447. var dx = Math.abs(toX - fromX);
  71448. var dy = Math.abs(toY - fromY);
  71449. var error = -dx / 2;
  71450. var xstep = fromX < toX ? 1 : -1;
  71451. var ystep = fromY < toY ? 1 : -1;
  71452. // In black pixels, looking for white, first or second time.
  71453. var state = 0;
  71454. // Loop up until x == toX, but not beyond
  71455. var xLimit = toX + xstep;
  71456. for (var x = fromX, y = fromY; x !== xLimit; x += xstep) {
  71457. var realX = steep ? y : x;
  71458. var realY = steep ? x : y;
  71459. // Does current pixel mean we have moved white to black or vice versa?
  71460. // Scanning black in state 0,2 and white in state 1, so if we find the wrong
  71461. // color, advance to next state or end if we are in state 2 already
  71462. if (state === 1 === this.image.get(realX, realY)) {
  71463. if (state === 2) {
  71464. return _MathUtils.default.distance(x, y, fromX, fromY);
  71465. }
  71466. state++;
  71467. }
  71468. error += dy;
  71469. if (error > 0) {
  71470. if (y === toY) {
  71471. break;
  71472. }
  71473. y += ystep;
  71474. error -= dx;
  71475. }
  71476. }
  71477. // Found black-white-black; give the benefit of the doubt that the next pixel outside the image
  71478. // is "white" so this last point at (toX+xStep,toY) is the right ending. This is really a
  71479. // small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.
  71480. if (state === 2) {
  71481. return _MathUtils.default.distance(toX + xstep, toY, fromX, fromY);
  71482. }
  71483. // else we didn't find even black-white-black; no estimate is really possible
  71484. return NaN;
  71485. };
  71486. /**
  71487. * <p>Attempts to locate an alignment pattern in a limited region of the image, which is
  71488. * guessed to contain it. This method uses {@link AlignmentPattern}.</p>
  71489. *
  71490. * @param overallEstModuleSize estimated module size so far
  71491. * @param estAlignmentX x coordinate of center of area probably containing alignment pattern
  71492. * @param estAlignmentY y coordinate of above
  71493. * @param allowanceFactor number of pixels in all directions to search from the center
  71494. * @return {@link AlignmentPattern} if found, or null otherwise
  71495. * @throws NotFoundException if an unexpected error occurs during detection
  71496. */
  71497. Detector.prototype.findAlignmentInRegion = function (overallEstModuleSize /*float*/, estAlignmentX /*int*/, estAlignmentY /*int*/, allowanceFactor /*float*/) {
  71498. // Look for an alignment pattern (3 modules in size) around where it
  71499. // should be
  71500. var allowance = /*(int) */Math.floor(allowanceFactor * overallEstModuleSize);
  71501. var alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);
  71502. var alignmentAreaRightX = Math.min(this.image.getWidth() - 1, estAlignmentX + allowance);
  71503. if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) {
  71504. throw new _NotFoundException.default('Alignment top exceeds estimated module size.');
  71505. }
  71506. var alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);
  71507. var alignmentAreaBottomY = Math.min(this.image.getHeight() - 1, estAlignmentY + allowance);
  71508. if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) {
  71509. throw new _NotFoundException.default('Alignment bottom exceeds estimated module size.');
  71510. }
  71511. var alignmentFinder = new _AlignmentPatternFinder.default(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);
  71512. return alignmentFinder.find();
  71513. };
  71514. return Detector;
  71515. }();
  71516. var _default = Detector;
  71517. exports.default = _default;
  71518. /***/ }),
  71519. /* 428 */
  71520. /*!**********************************************************************************************************!*\
  71521. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/AlignmentPatternFinder.js ***!
  71522. \**********************************************************************************************************/
  71523. /*! no static exports found */
  71524. /***/ (function(module, exports, __webpack_require__) {
  71525. "use strict";
  71526. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  71527. Object.defineProperty(exports, "__esModule", {
  71528. value: true
  71529. });
  71530. exports.default = void 0;
  71531. var _AlignmentPattern = _interopRequireDefault(__webpack_require__(/*! ./AlignmentPattern */ 429));
  71532. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  71533. /*
  71534. * Copyright 2007 ZXing authors
  71535. *
  71536. * Licensed under the Apache License, Version 2.0 (the "License");
  71537. * you may not use this file except in compliance with the License.
  71538. * You may obtain a copy of the License at
  71539. *
  71540. * http://www.apache.org/licenses/LICENSE-2.0
  71541. *
  71542. * Unless required by applicable law or agreed to in writing, software
  71543. * distributed under the License is distributed on an "AS IS" BASIS,
  71544. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71545. * See the License for the specific language governing permissions and
  71546. * limitations under the License.
  71547. */
  71548. var __values = void 0 && (void 0).__values || function (o) {
  71549. var s = typeof Symbol === "function" && Symbol.iterator,
  71550. m = s && o[s],
  71551. i = 0;
  71552. if (m) return m.call(o);
  71553. if (o && typeof o.length === "number") return {
  71554. next: function next() {
  71555. if (o && i >= o.length) o = void 0;
  71556. return {
  71557. value: o && o[i++],
  71558. done: !o
  71559. };
  71560. }
  71561. };
  71562. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  71563. };
  71564. /*import java.util.ArrayList;*/
  71565. /*import java.util.List;*/
  71566. /**
  71567. * <p>This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder
  71568. * patterns but are smaller and appear at regular intervals throughout the image.</p>
  71569. *
  71570. * <p>At the moment this only looks for the bottom-right alignment pattern.</p>
  71571. *
  71572. * <p>This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied,
  71573. * pasted and stripped down here for maximum performance but does unfortunately duplicate
  71574. * some code.</p>
  71575. *
  71576. * <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.</p>
  71577. *
  71578. * @author Sean Owen
  71579. */
  71580. var AlignmentPatternFinder = /** @class */function () {
  71581. /**
  71582. * <p>Creates a finder that will look in a portion of the whole image.</p>
  71583. *
  71584. * @param image image to search
  71585. * @param startX left column from which to start searching
  71586. * @param startY top row from which to start searching
  71587. * @param width width of region to search
  71588. * @param height height of region to search
  71589. * @param moduleSize estimated module size so far
  71590. */
  71591. function AlignmentPatternFinder(image, startX /*int*/, startY /*int*/, width /*int*/, height /*int*/, moduleSize /*float*/, resultPointCallback) {
  71592. this.image = image;
  71593. this.startX = startX;
  71594. this.startY = startY;
  71595. this.width = width;
  71596. this.height = height;
  71597. this.moduleSize = moduleSize;
  71598. this.resultPointCallback = resultPointCallback;
  71599. this.possibleCenters = []; // new Array<any>(5))
  71600. // TYPESCRIPTPORT: array initialization without size as the length is checked below
  71601. this.crossCheckStateCount = new Int32Array(3);
  71602. }
  71603. /**
  71604. * <p>This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
  71605. * it's pretty performance-critical and so is written to be fast foremost.</p>
  71606. *
  71607. * @return {@link AlignmentPattern} if found
  71608. * @throws NotFoundException if not found
  71609. */
  71610. AlignmentPatternFinder.prototype.find = function () {
  71611. var startX = this.startX;
  71612. var height = this.height;
  71613. var width = this.width;
  71614. var maxJ = startX + width;
  71615. var middleI = this.startY + height / 2;
  71616. // We are looking for black/white/black modules in 1:1:1 ratio
  71617. // this tracks the number of black/white/black modules seen so far
  71618. var stateCount = new Int32Array(3);
  71619. var image = this.image;
  71620. for (var iGen = 0; iGen < height; iGen++) {
  71621. // Search from middle outwards
  71622. var i = middleI + ((iGen & 0x01) === 0 ? Math.floor((iGen + 1) / 2) : -Math.floor((iGen + 1) / 2));
  71623. stateCount[0] = 0;
  71624. stateCount[1] = 0;
  71625. stateCount[2] = 0;
  71626. var j = startX;
  71627. // Burn off leading white pixels before anything else; if we start in the middle of
  71628. // a white run, it doesn't make sense to count its length, since we don't know if the
  71629. // white run continued to the left of the start point
  71630. while (j < maxJ && !image.get(j, i)) {
  71631. j++;
  71632. }
  71633. var currentState = 0;
  71634. while (j < maxJ) {
  71635. if (image.get(j, i)) {
  71636. // Black pixel
  71637. if (currentState === 1) {
  71638. // Counting black pixels
  71639. stateCount[1]++;
  71640. } else {
  71641. // Counting white pixels
  71642. if (currentState === 2) {
  71643. // A winner?
  71644. if (this.foundPatternCross(stateCount)) {
  71645. // Yes
  71646. var confirmed = this.handlePossibleCenter(stateCount, i, j);
  71647. if (confirmed !== null) {
  71648. return confirmed;
  71649. }
  71650. }
  71651. stateCount[0] = stateCount[2];
  71652. stateCount[1] = 1;
  71653. stateCount[2] = 0;
  71654. currentState = 1;
  71655. } else {
  71656. stateCount[++currentState]++;
  71657. }
  71658. }
  71659. } else {
  71660. // White pixel
  71661. if (currentState === 1) {
  71662. // Counting black pixels
  71663. currentState++;
  71664. }
  71665. stateCount[currentState]++;
  71666. }
  71667. j++;
  71668. }
  71669. if (this.foundPatternCross(stateCount)) {
  71670. var confirmed = this.handlePossibleCenter(stateCount, i, maxJ);
  71671. if (confirmed !== null) {
  71672. return confirmed;
  71673. }
  71674. }
  71675. }
  71676. // Hmm, nothing we saw was observed and confirmed twice. If we had
  71677. // any guess at all, return it.
  71678. if (this.possibleCenters.length !== 0) {
  71679. return this.possibleCenters[0];
  71680. }
  71681. throw new _NotFoundException.default();
  71682. };
  71683. /**
  71684. * Given a count of black/white/black pixels just seen and an end position,
  71685. * figures the location of the center of this black/white/black run.
  71686. */
  71687. AlignmentPatternFinder.centerFromEnd = function (stateCount, end /*int*/) {
  71688. return end - stateCount[2] - stateCount[1] / 2.0;
  71689. };
  71690. /**
  71691. * @param stateCount count of black/white/black pixels just read
  71692. * @return true iff the proportions of the counts is close enough to the 1/1/1 ratios
  71693. * used by alignment patterns to be considered a match
  71694. */
  71695. AlignmentPatternFinder.prototype.foundPatternCross = function (stateCount) {
  71696. var moduleSize = this.moduleSize;
  71697. var maxVariance = moduleSize / 2.0;
  71698. for (var i = 0; i < 3; i++) {
  71699. if (Math.abs(moduleSize - stateCount[i]) >= maxVariance) {
  71700. return false;
  71701. }
  71702. }
  71703. return true;
  71704. };
  71705. /**
  71706. * <p>After a horizontal scan finds a potential alignment pattern, this method
  71707. * "cross-checks" by scanning down vertically through the center of the possible
  71708. * alignment pattern to see if the same proportion is detected.</p>
  71709. *
  71710. * @param startI row where an alignment pattern was detected
  71711. * @param centerJ center of the section that appears to cross an alignment pattern
  71712. * @param maxCount maximum reasonable number of modules that should be
  71713. * observed in any reading state, based on the results of the horizontal scan
  71714. * @return vertical center of alignment pattern, or {@link Float#NaN} if not found
  71715. */
  71716. AlignmentPatternFinder.prototype.crossCheckVertical = function (startI /*int*/, centerJ /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
  71717. var image = this.image;
  71718. var maxI = image.getHeight();
  71719. var stateCount = this.crossCheckStateCount;
  71720. stateCount[0] = 0;
  71721. stateCount[1] = 0;
  71722. stateCount[2] = 0;
  71723. // Start counting up from center
  71724. var i = startI;
  71725. while (i >= 0 && image.get(centerJ, i) && stateCount[1] <= maxCount) {
  71726. stateCount[1]++;
  71727. i--;
  71728. }
  71729. // If already too many modules in this state or ran off the edge:
  71730. if (i < 0 || stateCount[1] > maxCount) {
  71731. return NaN;
  71732. }
  71733. while (i >= 0 && !image.get(centerJ, i) && stateCount[0] <= maxCount) {
  71734. stateCount[0]++;
  71735. i--;
  71736. }
  71737. if (stateCount[0] > maxCount) {
  71738. return NaN;
  71739. }
  71740. // Now also count down from center
  71741. i = startI + 1;
  71742. while (i < maxI && image.get(centerJ, i) && stateCount[1] <= maxCount) {
  71743. stateCount[1]++;
  71744. i++;
  71745. }
  71746. if (i === maxI || stateCount[1] > maxCount) {
  71747. return NaN;
  71748. }
  71749. while (i < maxI && !image.get(centerJ, i) && stateCount[2] <= maxCount) {
  71750. stateCount[2]++;
  71751. i++;
  71752. }
  71753. if (stateCount[2] > maxCount) {
  71754. return NaN;
  71755. }
  71756. var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
  71757. if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
  71758. return NaN;
  71759. }
  71760. return this.foundPatternCross(stateCount) ? AlignmentPatternFinder.centerFromEnd(stateCount, i) : NaN;
  71761. };
  71762. /**
  71763. * <p>This is called when a horizontal scan finds a possible alignment pattern. It will
  71764. * cross check with a vertical scan, and if successful, will see if this pattern had been
  71765. * found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
  71766. * found the alignment pattern.</p>
  71767. *
  71768. * @param stateCount reading state module counts from horizontal scan
  71769. * @param i row where alignment pattern may be found
  71770. * @param j end of possible alignment pattern in row
  71771. * @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not
  71772. */
  71773. AlignmentPatternFinder.prototype.handlePossibleCenter = function (stateCount, i /*int*/, j /*int*/) {
  71774. var e_1, _a;
  71775. var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
  71776. var centerJ = AlignmentPatternFinder.centerFromEnd(stateCount, j);
  71777. var centerI = this.crossCheckVertical(i, /*(int) */centerJ, 2 * stateCount[1], stateCountTotal);
  71778. if (!isNaN(centerI)) {
  71779. var estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;
  71780. try {
  71781. for (var _b = __values(this.possibleCenters), _c = _b.next(); !_c.done; _c = _b.next()) {
  71782. var center = _c.value;
  71783. // Look for about the same center and module size:
  71784. if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
  71785. return center.combineEstimate(centerI, centerJ, estimatedModuleSize);
  71786. }
  71787. }
  71788. } catch (e_1_1) {
  71789. e_1 = {
  71790. error: e_1_1
  71791. };
  71792. } finally {
  71793. try {
  71794. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  71795. } finally {
  71796. if (e_1) throw e_1.error;
  71797. }
  71798. }
  71799. // Hadn't found this before; save it
  71800. var point = new _AlignmentPattern.default(centerJ, centerI, estimatedModuleSize);
  71801. this.possibleCenters.push(point);
  71802. if (this.resultPointCallback !== null && this.resultPointCallback !== undefined) {
  71803. this.resultPointCallback.foundPossibleResultPoint(point);
  71804. }
  71805. }
  71806. return null;
  71807. };
  71808. return AlignmentPatternFinder;
  71809. }();
  71810. var _default = AlignmentPatternFinder;
  71811. exports.default = _default;
  71812. /***/ }),
  71813. /* 429 */
  71814. /*!****************************************************************************************************!*\
  71815. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/AlignmentPattern.js ***!
  71816. \****************************************************************************************************/
  71817. /*! no static exports found */
  71818. /***/ (function(module, exports, __webpack_require__) {
  71819. "use strict";
  71820. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  71821. Object.defineProperty(exports, "__esModule", {
  71822. value: true
  71823. });
  71824. exports.default = void 0;
  71825. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  71826. /*
  71827. * Copyright 2007 ZXing authors
  71828. *
  71829. * Licensed under the Apache License, Version 2.0 (the "License");
  71830. * you may not use this file except in compliance with the License.
  71831. * You may obtain a copy of the License at
  71832. *
  71833. * http://www.apache.org/licenses/LICENSE-2.0
  71834. *
  71835. * Unless required by applicable law or agreed to in writing, software
  71836. * distributed under the License is distributed on an "AS IS" BASIS,
  71837. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71838. * See the License for the specific language governing permissions and
  71839. * limitations under the License.
  71840. */
  71841. var __extends = void 0 && (void 0).__extends || function () {
  71842. var _extendStatics = function extendStatics(d, b) {
  71843. _extendStatics = Object.setPrototypeOf || {
  71844. __proto__: []
  71845. } instanceof Array && function (d, b) {
  71846. d.__proto__ = b;
  71847. } || function (d, b) {
  71848. for (var p in b) {
  71849. if (b.hasOwnProperty(p)) d[p] = b[p];
  71850. }
  71851. };
  71852. return _extendStatics(d, b);
  71853. };
  71854. return function (d, b) {
  71855. _extendStatics(d, b);
  71856. function __() {
  71857. this.constructor = d;
  71858. }
  71859. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  71860. };
  71861. }();
  71862. /*namespace com.google.zxing.qrcode.detector {*/
  71863. /**
  71864. * <p>Encapsulates an alignment pattern, which are the smaller square patterns found in
  71865. * all but the simplest QR Codes.</p>
  71866. *
  71867. * @author Sean Owen
  71868. */
  71869. var AlignmentPattern = /** @class */function (_super) {
  71870. __extends(AlignmentPattern, _super);
  71871. function AlignmentPattern(posX /*float*/, posY /*float*/, estimatedModuleSize /*float*/) {
  71872. var _this = _super.call(this, posX, posY) || this;
  71873. _this.estimatedModuleSize = estimatedModuleSize;
  71874. return _this;
  71875. }
  71876. /**
  71877. * <p>Determines if this alignment pattern "about equals" an alignment pattern at the stated
  71878. * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
  71879. */
  71880. AlignmentPattern.prototype.aboutEquals = function (moduleSize /*float*/, i /*float*/, j /*float*/) {
  71881. if (Math.abs(i - this.getY()) <= moduleSize && Math.abs(j - this.getX()) <= moduleSize) {
  71882. var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);
  71883. return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize;
  71884. }
  71885. return false;
  71886. };
  71887. /**
  71888. * Combines this object's current estimate of a finder pattern position and module size
  71889. * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.
  71890. */
  71891. AlignmentPattern.prototype.combineEstimate = function (i /*float*/, j /*float*/, newModuleSize /*float*/) {
  71892. var combinedX = (this.getX() + j) / 2.0;
  71893. var combinedY = (this.getY() + i) / 2.0;
  71894. var combinedModuleSize = (this.estimatedModuleSize + newModuleSize) / 2.0;
  71895. return new AlignmentPattern(combinedX, combinedY, combinedModuleSize);
  71896. };
  71897. return AlignmentPattern;
  71898. }(_ResultPoint.default);
  71899. var _default = AlignmentPattern;
  71900. exports.default = _default;
  71901. /***/ }),
  71902. /* 430 */
  71903. /*!*******************************************************************************************************!*\
  71904. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/FinderPatternFinder.js ***!
  71905. \*******************************************************************************************************/
  71906. /*! no static exports found */
  71907. /***/ (function(module, exports, __webpack_require__) {
  71908. "use strict";
  71909. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  71910. Object.defineProperty(exports, "__esModule", {
  71911. value: true
  71912. });
  71913. exports.default = void 0;
  71914. var _DecodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../DecodeHintType */ 322));
  71915. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  71916. var _FinderPattern = _interopRequireDefault(__webpack_require__(/*! ./FinderPattern */ 431));
  71917. var _FinderPatternInfo = _interopRequireDefault(__webpack_require__(/*! ./FinderPatternInfo */ 432));
  71918. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  71919. /*
  71920. * Copyright 2007 ZXing authors
  71921. *
  71922. * Licensed under the Apache License, Version 2.0 (the "License");
  71923. * you may not use this file except in compliance with the License.
  71924. * You may obtain a copy of the License at
  71925. *
  71926. * http://www.apache.org/licenses/LICENSE-2.0
  71927. *
  71928. * Unless required by applicable law or agreed to in writing, software
  71929. * distributed under the License is distributed on an "AS IS" BASIS,
  71930. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  71931. * See the License for the specific language governing permissions and
  71932. * limitations under the License.
  71933. */
  71934. var __values = void 0 && (void 0).__values || function (o) {
  71935. var s = typeof Symbol === "function" && Symbol.iterator,
  71936. m = s && o[s],
  71937. i = 0;
  71938. if (m) return m.call(o);
  71939. if (o && typeof o.length === "number") return {
  71940. next: function next() {
  71941. if (o && i >= o.length) o = void 0;
  71942. return {
  71943. value: o && o[i++],
  71944. done: !o
  71945. };
  71946. }
  71947. };
  71948. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  71949. };
  71950. /*namespace com.google.zxing.qrcode.detector {*/
  71951. /*import java.io.Serializable;*/
  71952. /*import java.util.ArrayList;*/
  71953. /*import java.util.Collections;*/
  71954. /*import java.util.Comparator;*/
  71955. /*import java.util.List;*/
  71956. /*import java.util.Map;*/
  71957. /**
  71958. * <p>This class attempts to find finder patterns in a QR Code. Finder patterns are the square
  71959. * markers at three corners of a QR Code.</p>
  71960. *
  71961. * <p>This class is thread-safe but not reentrant. Each thread must allocate its own object.
  71962. *
  71963. * @author Sean Owen
  71964. */
  71965. var FinderPatternFinder = /** @class */function () {
  71966. /**
  71967. * <p>Creates a finder that will search the image for three finder patterns.</p>
  71968. *
  71969. * @param image image to search
  71970. */
  71971. // public constructor(image: BitMatrix) {
  71972. // this(image, null)
  71973. // }
  71974. function FinderPatternFinder(image, resultPointCallback) {
  71975. this.image = image;
  71976. this.resultPointCallback = resultPointCallback;
  71977. this.possibleCenters = [];
  71978. this.crossCheckStateCount = new Int32Array(5);
  71979. this.resultPointCallback = resultPointCallback;
  71980. }
  71981. FinderPatternFinder.prototype.getImage = function () {
  71982. return this.image;
  71983. };
  71984. FinderPatternFinder.prototype.getPossibleCenters = function () {
  71985. return this.possibleCenters;
  71986. };
  71987. FinderPatternFinder.prototype.find = function (hints) {
  71988. var tryHarder = hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.TRY_HARDER);
  71989. var pureBarcode = hints !== null && hints !== undefined && undefined !== hints.get(_DecodeHintType.default.PURE_BARCODE);
  71990. var image = this.image;
  71991. var maxI = image.getHeight();
  71992. var maxJ = image.getWidth();
  71993. // We are looking for black/white/black/white/black modules in
  71994. // 1:1:3:1:1 ratio; this tracks the number of such modules seen so far
  71995. // Let's assume that the maximum version QR Code we support takes up 1/4 the height of the
  71996. // image, and then account for the center being 3 modules in size. This gives the smallest
  71997. // number of pixels the center could be, so skip this often. When trying harder, look for all
  71998. // QR versions regardless of how dense they are.
  71999. var iSkip = Math.floor(3 * maxI / (4 * FinderPatternFinder.MAX_MODULES));
  72000. if (iSkip < FinderPatternFinder.MIN_SKIP || tryHarder) {
  72001. iSkip = FinderPatternFinder.MIN_SKIP;
  72002. }
  72003. var done = false;
  72004. var stateCount = new Int32Array(5);
  72005. for (var i = iSkip - 1; i < maxI && !done; i += iSkip) {
  72006. // Get a row of black/white values
  72007. stateCount[0] = 0;
  72008. stateCount[1] = 0;
  72009. stateCount[2] = 0;
  72010. stateCount[3] = 0;
  72011. stateCount[4] = 0;
  72012. var currentState = 0;
  72013. for (var j = 0; j < maxJ; j++) {
  72014. if (image.get(j, i)) {
  72015. // Black pixel
  72016. if ((currentState & 1) === 1) {
  72017. // Counting white pixels
  72018. currentState++;
  72019. }
  72020. stateCount[currentState]++;
  72021. } else {
  72022. // White pixel
  72023. if ((currentState & 1) === 0) {
  72024. // Counting black pixels
  72025. if (currentState === 4) {
  72026. // A winner?
  72027. if (FinderPatternFinder.foundPatternCross(stateCount)) {
  72028. // Yes
  72029. var confirmed = this.handlePossibleCenter(stateCount, i, j, pureBarcode);
  72030. if (confirmed === true) {
  72031. // Start examining every other line. Checking each line turned out to be too
  72032. // expensive and didn't improve performance.
  72033. iSkip = 2;
  72034. if (this.hasSkipped === true) {
  72035. done = this.haveMultiplyConfirmedCenters();
  72036. } else {
  72037. var rowSkip = this.findRowSkip();
  72038. if (rowSkip > stateCount[2]) {
  72039. // Skip rows between row of lower confirmed center
  72040. // and top of presumed third confirmed center
  72041. // but back up a bit to get a full chance of detecting
  72042. // it, entire width of center of finder pattern
  72043. // Skip by rowSkip, but back off by stateCount[2] (size of last center
  72044. // of pattern we saw) to be conservative, and also back off by iSkip which
  72045. // is about to be re-added
  72046. i += rowSkip - stateCount[2] - iSkip;
  72047. j = maxJ - 1;
  72048. }
  72049. }
  72050. } else {
  72051. stateCount[0] = stateCount[2];
  72052. stateCount[1] = stateCount[3];
  72053. stateCount[2] = stateCount[4];
  72054. stateCount[3] = 1;
  72055. stateCount[4] = 0;
  72056. currentState = 3;
  72057. continue;
  72058. }
  72059. // Clear state to start looking again
  72060. currentState = 0;
  72061. stateCount[0] = 0;
  72062. stateCount[1] = 0;
  72063. stateCount[2] = 0;
  72064. stateCount[3] = 0;
  72065. stateCount[4] = 0;
  72066. } else {
  72067. // No, shift counts back by two
  72068. stateCount[0] = stateCount[2];
  72069. stateCount[1] = stateCount[3];
  72070. stateCount[2] = stateCount[4];
  72071. stateCount[3] = 1;
  72072. stateCount[4] = 0;
  72073. currentState = 3;
  72074. }
  72075. } else {
  72076. stateCount[++currentState]++;
  72077. }
  72078. } else {
  72079. // Counting white pixels
  72080. stateCount[currentState]++;
  72081. }
  72082. }
  72083. }
  72084. if (FinderPatternFinder.foundPatternCross(stateCount)) {
  72085. var confirmed = this.handlePossibleCenter(stateCount, i, maxJ, pureBarcode);
  72086. if (confirmed === true) {
  72087. iSkip = stateCount[0];
  72088. if (this.hasSkipped) {
  72089. // Found a third one
  72090. done = this.haveMultiplyConfirmedCenters();
  72091. }
  72092. }
  72093. }
  72094. }
  72095. var patternInfo = this.selectBestPatterns();
  72096. _ResultPoint.default.orderBestPatterns(patternInfo);
  72097. return new _FinderPatternInfo.default(patternInfo);
  72098. };
  72099. /**
  72100. * Given a count of black/white/black/white/black pixels just seen and an end position,
  72101. * figures the location of the center of this run.
  72102. */
  72103. FinderPatternFinder.centerFromEnd = function (stateCount, end /*int*/) {
  72104. return end - stateCount[4] - stateCount[3] - stateCount[2] / 2.0;
  72105. };
  72106. /**
  72107. * @param stateCount count of black/white/black/white/black pixels just read
  72108. * @return true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios
  72109. * used by finder patterns to be considered a match
  72110. */
  72111. FinderPatternFinder.foundPatternCross = function (stateCount) {
  72112. var totalModuleSize = 0;
  72113. for (var i = 0; i < 5; i++) {
  72114. var count = stateCount[i];
  72115. if (count === 0) {
  72116. return false;
  72117. }
  72118. totalModuleSize += count;
  72119. }
  72120. if (totalModuleSize < 7) {
  72121. return false;
  72122. }
  72123. var moduleSize = totalModuleSize / 7.0;
  72124. var maxVariance = moduleSize / 2.0;
  72125. // Allow less than 50% variance from 1-1-3-1-1 proportions
  72126. return Math.abs(moduleSize - stateCount[0]) < maxVariance && Math.abs(moduleSize - stateCount[1]) < maxVariance && Math.abs(3.0 * moduleSize - stateCount[2]) < 3 * maxVariance && Math.abs(moduleSize - stateCount[3]) < maxVariance && Math.abs(moduleSize - stateCount[4]) < maxVariance;
  72127. };
  72128. FinderPatternFinder.prototype.getCrossCheckStateCount = function () {
  72129. var crossCheckStateCount = this.crossCheckStateCount;
  72130. crossCheckStateCount[0] = 0;
  72131. crossCheckStateCount[1] = 0;
  72132. crossCheckStateCount[2] = 0;
  72133. crossCheckStateCount[3] = 0;
  72134. crossCheckStateCount[4] = 0;
  72135. return crossCheckStateCount;
  72136. };
  72137. /**
  72138. * After a vertical and horizontal scan finds a potential finder pattern, this method
  72139. * "cross-cross-cross-checks" by scanning down diagonally through the center of the possible
  72140. * finder pattern to see if the same proportion is detected.
  72141. *
  72142. * @param startI row where a finder pattern was detected
  72143. * @param centerJ center of the section that appears to cross a finder pattern
  72144. * @param maxCount maximum reasonable number of modules that should be
  72145. * observed in any reading state, based on the results of the horizontal scan
  72146. * @param originalStateCountTotal The original state count total.
  72147. * @return true if proportions are withing expected limits
  72148. */
  72149. FinderPatternFinder.prototype.crossCheckDiagonal = function (startI /*int*/, centerJ /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
  72150. var stateCount = this.getCrossCheckStateCount();
  72151. // Start counting up, left from center finding black center mass
  72152. var i = 0;
  72153. var image = this.image;
  72154. while (startI >= i && centerJ >= i && image.get(centerJ - i, startI - i)) {
  72155. stateCount[2]++;
  72156. i++;
  72157. }
  72158. if (startI < i || centerJ < i) {
  72159. return false;
  72160. }
  72161. // Continue up, left finding white space
  72162. while (startI >= i && centerJ >= i && !image.get(centerJ - i, startI - i) && stateCount[1] <= maxCount) {
  72163. stateCount[1]++;
  72164. i++;
  72165. }
  72166. // If already too many modules in this state or ran off the edge:
  72167. if (startI < i || centerJ < i || stateCount[1] > maxCount) {
  72168. return false;
  72169. }
  72170. // Continue up, left finding black border
  72171. while (startI >= i && centerJ >= i && image.get(centerJ - i, startI - i) && stateCount[0] <= maxCount) {
  72172. stateCount[0]++;
  72173. i++;
  72174. }
  72175. if (stateCount[0] > maxCount) {
  72176. return false;
  72177. }
  72178. var maxI = image.getHeight();
  72179. var maxJ = image.getWidth();
  72180. // Now also count down, right from center
  72181. i = 1;
  72182. while (startI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, startI + i)) {
  72183. stateCount[2]++;
  72184. i++;
  72185. }
  72186. // Ran off the edge?
  72187. if (startI + i >= maxI || centerJ + i >= maxJ) {
  72188. return false;
  72189. }
  72190. while (startI + i < maxI && centerJ + i < maxJ && !image.get(centerJ + i, startI + i) && stateCount[3] < maxCount) {
  72191. stateCount[3]++;
  72192. i++;
  72193. }
  72194. if (startI + i >= maxI || centerJ + i >= maxJ || stateCount[3] >= maxCount) {
  72195. return false;
  72196. }
  72197. while (startI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, startI + i) && stateCount[4] < maxCount) {
  72198. stateCount[4]++;
  72199. i++;
  72200. }
  72201. if (stateCount[4] >= maxCount) {
  72202. return false;
  72203. }
  72204. // If we found a finder-pattern-like section, but its size is more than 100% different than
  72205. // the original, assume it's a false positive
  72206. var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
  72207. return Math.abs(stateCountTotal - originalStateCountTotal) < 2 * originalStateCountTotal && FinderPatternFinder.foundPatternCross(stateCount);
  72208. };
  72209. /**
  72210. * <p>After a horizontal scan finds a potential finder pattern, this method
  72211. * "cross-checks" by scanning down vertically through the center of the possible
  72212. * finder pattern to see if the same proportion is detected.</p>
  72213. *
  72214. * @param startI row where a finder pattern was detected
  72215. * @param centerJ center of the section that appears to cross a finder pattern
  72216. * @param maxCount maximum reasonable number of modules that should be
  72217. * observed in any reading state, based on the results of the horizontal scan
  72218. * @return vertical center of finder pattern, or {@link Float#NaN} if not found
  72219. */
  72220. FinderPatternFinder.prototype.crossCheckVertical = function (startI /*int*/, centerJ /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
  72221. var image = this.image;
  72222. var maxI = image.getHeight();
  72223. var stateCount = this.getCrossCheckStateCount();
  72224. // Start counting up from center
  72225. var i = startI;
  72226. while (i >= 0 && image.get(centerJ, i)) {
  72227. stateCount[2]++;
  72228. i--;
  72229. }
  72230. if (i < 0) {
  72231. return NaN;
  72232. }
  72233. while (i >= 0 && !image.get(centerJ, i) && stateCount[1] <= maxCount) {
  72234. stateCount[1]++;
  72235. i--;
  72236. }
  72237. // If already too many modules in this state or ran off the edge:
  72238. if (i < 0 || stateCount[1] > maxCount) {
  72239. return NaN;
  72240. }
  72241. while (i >= 0 && image.get(centerJ, i) && stateCount[0] <= maxCount) {
  72242. stateCount[0]++;
  72243. i--;
  72244. }
  72245. if (stateCount[0] > maxCount) {
  72246. return NaN;
  72247. }
  72248. // Now also count down from center
  72249. i = startI + 1;
  72250. while (i < maxI && image.get(centerJ, i)) {
  72251. stateCount[2]++;
  72252. i++;
  72253. }
  72254. if (i === maxI) {
  72255. return NaN;
  72256. }
  72257. while (i < maxI && !image.get(centerJ, i) && stateCount[3] < maxCount) {
  72258. stateCount[3]++;
  72259. i++;
  72260. }
  72261. if (i === maxI || stateCount[3] >= maxCount) {
  72262. return NaN;
  72263. }
  72264. while (i < maxI && image.get(centerJ, i) && stateCount[4] < maxCount) {
  72265. stateCount[4]++;
  72266. i++;
  72267. }
  72268. if (stateCount[4] >= maxCount) {
  72269. return NaN;
  72270. }
  72271. // If we found a finder-pattern-like section, but its size is more than 40% different than
  72272. // the original, assume it's a false positive
  72273. var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
  72274. if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
  72275. return NaN;
  72276. }
  72277. return FinderPatternFinder.foundPatternCross(stateCount) ? FinderPatternFinder.centerFromEnd(stateCount, i) : NaN;
  72278. };
  72279. /**
  72280. * <p>Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,
  72281. * except it reads horizontally instead of vertically. This is used to cross-cross
  72282. * check a vertical cross check and locate the real center of the alignment pattern.</p>
  72283. */
  72284. FinderPatternFinder.prototype.crossCheckHorizontal = function (startJ /*int*/, centerI /*int*/, maxCount /*int*/, originalStateCountTotal /*int*/) {
  72285. var image = this.image;
  72286. var maxJ = image.getWidth();
  72287. var stateCount = this.getCrossCheckStateCount();
  72288. var j = startJ;
  72289. while (j >= 0 && image.get(j, centerI)) {
  72290. stateCount[2]++;
  72291. j--;
  72292. }
  72293. if (j < 0) {
  72294. return NaN;
  72295. }
  72296. while (j >= 0 && !image.get(j, centerI) && stateCount[1] <= maxCount) {
  72297. stateCount[1]++;
  72298. j--;
  72299. }
  72300. if (j < 0 || stateCount[1] > maxCount) {
  72301. return NaN;
  72302. }
  72303. while (j >= 0 && image.get(j, centerI) && stateCount[0] <= maxCount) {
  72304. stateCount[0]++;
  72305. j--;
  72306. }
  72307. if (stateCount[0] > maxCount) {
  72308. return NaN;
  72309. }
  72310. j = startJ + 1;
  72311. while (j < maxJ && image.get(j, centerI)) {
  72312. stateCount[2]++;
  72313. j++;
  72314. }
  72315. if (j === maxJ) {
  72316. return NaN;
  72317. }
  72318. while (j < maxJ && !image.get(j, centerI) && stateCount[3] < maxCount) {
  72319. stateCount[3]++;
  72320. j++;
  72321. }
  72322. if (j === maxJ || stateCount[3] >= maxCount) {
  72323. return NaN;
  72324. }
  72325. while (j < maxJ && image.get(j, centerI) && stateCount[4] < maxCount) {
  72326. stateCount[4]++;
  72327. j++;
  72328. }
  72329. if (stateCount[4] >= maxCount) {
  72330. return NaN;
  72331. }
  72332. // If we found a finder-pattern-like section, but its size is significantly different than
  72333. // the original, assume it's a false positive
  72334. var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
  72335. if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {
  72336. return NaN;
  72337. }
  72338. return FinderPatternFinder.foundPatternCross(stateCount) ? FinderPatternFinder.centerFromEnd(stateCount, j) : NaN;
  72339. };
  72340. /**
  72341. * <p>This is called when a horizontal scan finds a possible alignment pattern. It will
  72342. * cross check with a vertical scan, and if successful, will, ah, cross-cross-check
  72343. * with another horizontal scan. This is needed primarily to locate the real horizontal
  72344. * center of the pattern in cases of extreme skew.
  72345. * And then we cross-cross-cross check with another diagonal scan.</p>
  72346. *
  72347. * <p>If that succeeds the finder pattern location is added to a list that tracks
  72348. * the number of times each location has been nearly-matched as a finder pattern.
  72349. * Each additional find is more evidence that the location is in fact a finder
  72350. * pattern center
  72351. *
  72352. * @param stateCount reading state module counts from horizontal scan
  72353. * @param i row where finder pattern may be found
  72354. * @param j end of possible finder pattern in row
  72355. * @param pureBarcode true if in "pure barcode" mode
  72356. * @return true if a finder pattern candidate was found this time
  72357. */
  72358. FinderPatternFinder.prototype.handlePossibleCenter = function (stateCount, i /*int*/, j /*int*/, pureBarcode) {
  72359. var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
  72360. var centerJ = FinderPatternFinder.centerFromEnd(stateCount, j);
  72361. var centerI = this.crossCheckVertical(i, /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal);
  72362. if (!isNaN(centerI)) {
  72363. // Re-cross check
  72364. centerJ = this.crossCheckHorizontal( /*(int) */Math.floor(centerJ), /*(int) */Math.floor(centerI), stateCount[2], stateCountTotal);
  72365. if (!isNaN(centerJ) && (!pureBarcode || this.crossCheckDiagonal( /*(int) */Math.floor(centerI), /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal))) {
  72366. var estimatedModuleSize = stateCountTotal / 7.0;
  72367. var found = false;
  72368. var possibleCenters = this.possibleCenters;
  72369. for (var index = 0, length_1 = possibleCenters.length; index < length_1; index++) {
  72370. var center = possibleCenters[index];
  72371. // Look for about the same center and module size:
  72372. if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
  72373. possibleCenters[index] = center.combineEstimate(centerI, centerJ, estimatedModuleSize);
  72374. found = true;
  72375. break;
  72376. }
  72377. }
  72378. if (!found) {
  72379. var point = new _FinderPattern.default(centerJ, centerI, estimatedModuleSize);
  72380. possibleCenters.push(point);
  72381. if (this.resultPointCallback !== null && this.resultPointCallback !== undefined) {
  72382. this.resultPointCallback.foundPossibleResultPoint(point);
  72383. }
  72384. }
  72385. return true;
  72386. }
  72387. }
  72388. return false;
  72389. };
  72390. /**
  72391. * @return number of rows we could safely skip during scanning, based on the first
  72392. * two finder patterns that have been located. In some cases their position will
  72393. * allow us to infer that the third pattern must lie below a certain point farther
  72394. * down in the image.
  72395. */
  72396. FinderPatternFinder.prototype.findRowSkip = function () {
  72397. var e_1, _a;
  72398. var max = this.possibleCenters.length;
  72399. if (max <= 1) {
  72400. return 0;
  72401. }
  72402. var firstConfirmedCenter = null;
  72403. try {
  72404. for (var _b = __values(this.possibleCenters), _c = _b.next(); !_c.done; _c = _b.next()) {
  72405. var center = _c.value;
  72406. if (center.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
  72407. if (firstConfirmedCenter == null) {
  72408. firstConfirmedCenter = center;
  72409. } else {
  72410. // We have two confirmed centers
  72411. // How far down can we skip before resuming looking for the next
  72412. // pattern? In the worst case, only the difference between the
  72413. // difference in the x / y coordinates of the two centers.
  72414. // This is the case where you find top left last.
  72415. this.hasSkipped = true;
  72416. return (/*(int) */Math.floor((Math.abs(firstConfirmedCenter.getX() - center.getX()) - Math.abs(firstConfirmedCenter.getY() - center.getY())) / 2)
  72417. );
  72418. }
  72419. }
  72420. }
  72421. } catch (e_1_1) {
  72422. e_1 = {
  72423. error: e_1_1
  72424. };
  72425. } finally {
  72426. try {
  72427. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  72428. } finally {
  72429. if (e_1) throw e_1.error;
  72430. }
  72431. }
  72432. return 0;
  72433. };
  72434. /**
  72435. * @return true iff we have found at least 3 finder patterns that have been detected
  72436. * at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the
  72437. * candidates is "pretty similar"
  72438. */
  72439. FinderPatternFinder.prototype.haveMultiplyConfirmedCenters = function () {
  72440. var e_2, _a, e_3, _b;
  72441. var confirmedCount = 0;
  72442. var totalModuleSize = 0.0;
  72443. var max = this.possibleCenters.length;
  72444. try {
  72445. for (var _c = __values(this.possibleCenters), _d = _c.next(); !_d.done; _d = _c.next()) {
  72446. var pattern = _d.value;
  72447. if (pattern.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
  72448. confirmedCount++;
  72449. totalModuleSize += pattern.getEstimatedModuleSize();
  72450. }
  72451. }
  72452. } catch (e_2_1) {
  72453. e_2 = {
  72454. error: e_2_1
  72455. };
  72456. } finally {
  72457. try {
  72458. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  72459. } finally {
  72460. if (e_2) throw e_2.error;
  72461. }
  72462. }
  72463. if (confirmedCount < 3) {
  72464. return false;
  72465. }
  72466. // OK, we have at least 3 confirmed centers, but, it's possible that one is a "false positive"
  72467. // and that we need to keep looking. We detect this by asking if the estimated module sizes
  72468. // vary too much. We arbitrarily say that when the total deviation from average exceeds
  72469. // 5% of the total module size estimates, it's too much.
  72470. var average = totalModuleSize / max;
  72471. var totalDeviation = 0.0;
  72472. try {
  72473. for (var _e = __values(this.possibleCenters), _f = _e.next(); !_f.done; _f = _e.next()) {
  72474. var pattern = _f.value;
  72475. totalDeviation += Math.abs(pattern.getEstimatedModuleSize() - average);
  72476. }
  72477. } catch (e_3_1) {
  72478. e_3 = {
  72479. error: e_3_1
  72480. };
  72481. } finally {
  72482. try {
  72483. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  72484. } finally {
  72485. if (e_3) throw e_3.error;
  72486. }
  72487. }
  72488. return totalDeviation <= 0.05 * totalModuleSize;
  72489. };
  72490. /**
  72491. * @return the 3 best {@link FinderPattern}s from our list of candidates. The "best" are
  72492. * those that have been detected at least {@link #CENTER_QUORUM} times, and whose module
  72493. * size differs from the average among those patterns the least
  72494. * @throws NotFoundException if 3 such finder patterns do not exist
  72495. */
  72496. FinderPatternFinder.prototype.selectBestPatterns = function () {
  72497. var e_4, _a, e_5, _b;
  72498. var startSize = this.possibleCenters.length;
  72499. if (startSize < 3) {
  72500. // Couldn't find enough finder patterns
  72501. throw new _NotFoundException.default();
  72502. }
  72503. var possibleCenters = this.possibleCenters;
  72504. var average;
  72505. // Filter outlier possibilities whose module size is too different
  72506. if (startSize > 3) {
  72507. // But we can only afford to do so if we have at least 4 possibilities to choose from
  72508. var totalModuleSize = 0.0;
  72509. var square = 0.0;
  72510. try {
  72511. for (var _c = __values(this.possibleCenters), _d = _c.next(); !_d.done; _d = _c.next()) {
  72512. var center = _d.value;
  72513. var size = center.getEstimatedModuleSize();
  72514. totalModuleSize += size;
  72515. square += size * size;
  72516. }
  72517. } catch (e_4_1) {
  72518. e_4 = {
  72519. error: e_4_1
  72520. };
  72521. } finally {
  72522. try {
  72523. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  72524. } finally {
  72525. if (e_4) throw e_4.error;
  72526. }
  72527. }
  72528. average = totalModuleSize / startSize;
  72529. var stdDev = Math.sqrt(square / startSize - average * average);
  72530. possibleCenters.sort(
  72531. /**
  72532. * <p>Orders by furthest from average</p>
  72533. */
  72534. // FurthestFromAverageComparator implements Comparator<FinderPattern>
  72535. function (center1, center2) {
  72536. var dA = Math.abs(center2.getEstimatedModuleSize() - average);
  72537. var dB = Math.abs(center1.getEstimatedModuleSize() - average);
  72538. return dA < dB ? -1 : dA > dB ? 1 : 0;
  72539. });
  72540. var limit = Math.max(0.2 * average, stdDev);
  72541. for (var i = 0; i < possibleCenters.length && possibleCenters.length > 3; i++) {
  72542. var pattern = possibleCenters[i];
  72543. if (Math.abs(pattern.getEstimatedModuleSize() - average) > limit) {
  72544. possibleCenters.splice(i, 1);
  72545. i--;
  72546. }
  72547. }
  72548. }
  72549. if (possibleCenters.length > 3) {
  72550. // Throw away all but those first size candidate points we found.
  72551. var totalModuleSize = 0.0;
  72552. try {
  72553. for (var possibleCenters_1 = __values(possibleCenters), possibleCenters_1_1 = possibleCenters_1.next(); !possibleCenters_1_1.done; possibleCenters_1_1 = possibleCenters_1.next()) {
  72554. var possibleCenter = possibleCenters_1_1.value;
  72555. totalModuleSize += possibleCenter.getEstimatedModuleSize();
  72556. }
  72557. } catch (e_5_1) {
  72558. e_5 = {
  72559. error: e_5_1
  72560. };
  72561. } finally {
  72562. try {
  72563. if (possibleCenters_1_1 && !possibleCenters_1_1.done && (_b = possibleCenters_1.return)) _b.call(possibleCenters_1);
  72564. } finally {
  72565. if (e_5) throw e_5.error;
  72566. }
  72567. }
  72568. average = totalModuleSize / possibleCenters.length;
  72569. possibleCenters.sort(
  72570. /**
  72571. * <p>Orders by {@link FinderPattern#getCount()}, descending.</p>
  72572. */
  72573. // CenterComparator implements Comparator<FinderPattern>
  72574. function (center1, center2) {
  72575. if (center2.getCount() === center1.getCount()) {
  72576. var dA = Math.abs(center2.getEstimatedModuleSize() - average);
  72577. var dB = Math.abs(center1.getEstimatedModuleSize() - average);
  72578. return dA < dB ? 1 : dA > dB ? -1 : 0;
  72579. } else {
  72580. return center2.getCount() - center1.getCount();
  72581. }
  72582. });
  72583. possibleCenters.splice(3); // this is not realy necessary as we only return first 3 anyway
  72584. }
  72585. return [possibleCenters[0], possibleCenters[1], possibleCenters[2]];
  72586. };
  72587. FinderPatternFinder.CENTER_QUORUM = 2;
  72588. FinderPatternFinder.MIN_SKIP = 3; // 1 pixel/module times 3 modules/center
  72589. FinderPatternFinder.MAX_MODULES = 57; // support up to version 10 for mobile clients
  72590. return FinderPatternFinder;
  72591. }();
  72592. var _default = FinderPatternFinder;
  72593. exports.default = _default;
  72594. /***/ }),
  72595. /* 431 */
  72596. /*!*************************************************************************************************!*\
  72597. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/FinderPattern.js ***!
  72598. \*************************************************************************************************/
  72599. /*! no static exports found */
  72600. /***/ (function(module, exports, __webpack_require__) {
  72601. "use strict";
  72602. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  72603. Object.defineProperty(exports, "__esModule", {
  72604. value: true
  72605. });
  72606. exports.default = void 0;
  72607. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  72608. /*
  72609. * Copyright 2007 ZXing authors
  72610. *
  72611. * Licensed under the Apache License, Version 2.0 (the "License");
  72612. * you may not use this file except in compliance with the License.
  72613. * You may obtain a copy of the License at
  72614. *
  72615. * http://www.apache.org/licenses/LICENSE-2.0
  72616. *
  72617. * Unless required by applicable law or agreed to in writing, software
  72618. * distributed under the License is distributed on an "AS IS" BASIS,
  72619. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  72620. * See the License for the specific language governing permissions and
  72621. * limitations under the License.
  72622. */
  72623. var __extends = void 0 && (void 0).__extends || function () {
  72624. var _extendStatics = function extendStatics(d, b) {
  72625. _extendStatics = Object.setPrototypeOf || {
  72626. __proto__: []
  72627. } instanceof Array && function (d, b) {
  72628. d.__proto__ = b;
  72629. } || function (d, b) {
  72630. for (var p in b) {
  72631. if (b.hasOwnProperty(p)) d[p] = b[p];
  72632. }
  72633. };
  72634. return _extendStatics(d, b);
  72635. };
  72636. return function (d, b) {
  72637. _extendStatics(d, b);
  72638. function __() {
  72639. this.constructor = d;
  72640. }
  72641. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  72642. };
  72643. }();
  72644. /*namespace com.google.zxing.qrcode.detector {*/
  72645. /**
  72646. * <p>Encapsulates a finder pattern, which are the three square patterns found in
  72647. * the corners of QR Codes. It also encapsulates a count of similar finder patterns,
  72648. * as a convenience to the finder's bookkeeping.</p>
  72649. *
  72650. * @author Sean Owen
  72651. */
  72652. var FinderPattern = /** @class */function (_super) {
  72653. __extends(FinderPattern, _super);
  72654. // FinderPattern(posX: number/*float*/, posY: number/*float*/, estimatedModuleSize: number/*float*/) {
  72655. // this(posX, posY, estimatedModuleSize, 1)
  72656. // }
  72657. function FinderPattern(posX /*float*/, posY /*float*/, estimatedModuleSize /*float*/, count /*int*/) {
  72658. var _this = _super.call(this, posX, posY) || this;
  72659. _this.estimatedModuleSize = estimatedModuleSize;
  72660. _this.count = count;
  72661. if (undefined === count) {
  72662. _this.count = 1;
  72663. }
  72664. return _this;
  72665. }
  72666. FinderPattern.prototype.getEstimatedModuleSize = function () {
  72667. return this.estimatedModuleSize;
  72668. };
  72669. FinderPattern.prototype.getCount = function () {
  72670. return this.count;
  72671. };
  72672. /*
  72673. void incrementCount() {
  72674. this.count++
  72675. }
  72676. */
  72677. /**
  72678. * <p>Determines if this finder pattern "about equals" a finder pattern at the stated
  72679. * position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
  72680. */
  72681. FinderPattern.prototype.aboutEquals = function (moduleSize /*float*/, i /*float*/, j /*float*/) {
  72682. if (Math.abs(i - this.getY()) <= moduleSize && Math.abs(j - this.getX()) <= moduleSize) {
  72683. var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);
  72684. return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize;
  72685. }
  72686. return false;
  72687. };
  72688. /**
  72689. * Combines this object's current estimate of a finder pattern position and module size
  72690. * with a new estimate. It returns a new {@code FinderPattern} containing a weighted average
  72691. * based on count.
  72692. */
  72693. FinderPattern.prototype.combineEstimate = function (i /*float*/, j /*float*/, newModuleSize /*float*/) {
  72694. var combinedCount = this.count + 1;
  72695. var combinedX = (this.count * this.getX() + j) / combinedCount;
  72696. var combinedY = (this.count * this.getY() + i) / combinedCount;
  72697. var combinedModuleSize = (this.count * this.estimatedModuleSize + newModuleSize) / combinedCount;
  72698. return new FinderPattern(combinedX, combinedY, combinedModuleSize, combinedCount);
  72699. };
  72700. return FinderPattern;
  72701. }(_ResultPoint.default);
  72702. var _default = FinderPattern;
  72703. exports.default = _default;
  72704. /***/ }),
  72705. /* 432 */
  72706. /*!*****************************************************************************************************!*\
  72707. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/detector/FinderPatternInfo.js ***!
  72708. \*****************************************************************************************************/
  72709. /*! no static exports found */
  72710. /***/ (function(module, exports, __webpack_require__) {
  72711. "use strict";
  72712. Object.defineProperty(exports, "__esModule", {
  72713. value: true
  72714. });
  72715. exports.default = void 0;
  72716. /*
  72717. * Copyright 2007 ZXing authors
  72718. *
  72719. * Licensed under the Apache License, Version 2.0 (the "License");
  72720. * you may not use this file except in compliance with the License.
  72721. * You may obtain a copy of the License at
  72722. *
  72723. * http://www.apache.org/licenses/LICENSE-2.0
  72724. *
  72725. * Unless required by applicable law or agreed to in writing, software
  72726. * distributed under the License is distributed on an "AS IS" BASIS,
  72727. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  72728. * See the License for the specific language governing permissions and
  72729. * limitations under the License.
  72730. */
  72731. /**
  72732. * <p>Encapsulates information about finder patterns in an image, including the location of
  72733. * the three finder patterns, and their estimated module size.</p>
  72734. *
  72735. * @author Sean Owen
  72736. */
  72737. var FinderPatternInfo = /** @class */function () {
  72738. function FinderPatternInfo(patternCenters) {
  72739. this.bottomLeft = patternCenters[0];
  72740. this.topLeft = patternCenters[1];
  72741. this.topRight = patternCenters[2];
  72742. }
  72743. FinderPatternInfo.prototype.getBottomLeft = function () {
  72744. return this.bottomLeft;
  72745. };
  72746. FinderPatternInfo.prototype.getTopLeft = function () {
  72747. return this.topLeft;
  72748. };
  72749. FinderPatternInfo.prototype.getTopRight = function () {
  72750. return this.topRight;
  72751. };
  72752. return FinderPatternInfo;
  72753. }();
  72754. var _default = FinderPatternInfo;
  72755. exports.default = _default;
  72756. /***/ }),
  72757. /* 433 */
  72758. /*!***************************************************************************************!*\
  72759. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/PDF417Reader.js ***!
  72760. \***************************************************************************************/
  72761. /*! no static exports found */
  72762. /***/ (function(module, exports, __webpack_require__) {
  72763. "use strict";
  72764. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  72765. Object.defineProperty(exports, "__esModule", {
  72766. value: true
  72767. });
  72768. exports.default = void 0;
  72769. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  72770. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../ChecksumException */ 309));
  72771. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../FormatException */ 324));
  72772. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../NotFoundException */ 327));
  72773. var _Result = _interopRequireDefault(__webpack_require__(/*! ../Result */ 333));
  72774. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ./PDF417Common */ 434));
  72775. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
  72776. var _ResultMetadataType = _interopRequireDefault(__webpack_require__(/*! ../ResultMetadataType */ 335));
  72777. var _Detector = _interopRequireDefault(__webpack_require__(/*! ./detector/Detector */ 435));
  72778. var _PDF417ScanningDecoder = _interopRequireDefault(__webpack_require__(/*! ./decoder/PDF417ScanningDecoder */ 437));
  72779. /*
  72780. * Copyright 2009 ZXing authors
  72781. *
  72782. * Licensed under the Apache License, Version 2.0 (the "License");
  72783. * you may not use this file except in compliance with the License.
  72784. * You may obtain a copy of the License at
  72785. *
  72786. * http://www.apache.org/licenses/LICENSE-2.0
  72787. *
  72788. * Unless required by applicable law or agreed to in writing, software
  72789. * distributed under the License is distributed on an "AS IS" BASIS,
  72790. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  72791. * See the License for the specific language governing permissions and
  72792. * limitations under the License.
  72793. */
  72794. var __values = void 0 && (void 0).__values || function (o) {
  72795. var s = typeof Symbol === "function" && Symbol.iterator,
  72796. m = s && o[s],
  72797. i = 0;
  72798. if (m) return m.call(o);
  72799. if (o && typeof o.length === "number") return {
  72800. next: function next() {
  72801. if (o && i >= o.length) o = void 0;
  72802. return {
  72803. value: o && o[i++],
  72804. done: !o
  72805. };
  72806. }
  72807. };
  72808. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  72809. };
  72810. // package com.google.zxing.pdf417;
  72811. // import com.google.zxing.BarcodeFormat;
  72812. // import java.util.ArrayList;
  72813. // import java.util.List;
  72814. // import java.util.Map;
  72815. /**
  72816. * This implementation can detect and decode PDF417 codes in an image.
  72817. *
  72818. * @author Guenther Grau
  72819. */
  72820. var PDF417Reader = /** @class */function () {
  72821. function PDF417Reader() {}
  72822. // private static /*final Result[]*/ EMPTY_RESULT_ARRAY: Result[] = new Result([0]);
  72823. /**
  72824. * Locates and decodes a PDF417 code in an image.
  72825. *
  72826. * @return a String representing the content encoded by the PDF417 code
  72827. * @throws NotFoundException if a PDF417 code cannot be found,
  72828. * @throws FormatException if a PDF417 cannot be decoded
  72829. * @throws ChecksumException
  72830. */
  72831. // @Override
  72832. PDF417Reader.prototype.decode = function (image, hints) {
  72833. if (hints === void 0) {
  72834. hints = null;
  72835. }
  72836. var result = PDF417Reader.decode(image, hints, false);
  72837. if (result == null || result.length === 0 || result[0] == null) {
  72838. throw _NotFoundException.default.getNotFoundInstance();
  72839. }
  72840. return result[0];
  72841. };
  72842. /**
  72843. *
  72844. * @param BinaryBitmap
  72845. * @param image
  72846. * @throws NotFoundException
  72847. */
  72848. // @Override
  72849. PDF417Reader.prototype.decodeMultiple = function (image, hints) {
  72850. if (hints === void 0) {
  72851. hints = null;
  72852. }
  72853. try {
  72854. return PDF417Reader.decode(image, hints, true);
  72855. } catch (ignored) {
  72856. if (ignored instanceof _FormatException.default || ignored instanceof _ChecksumException.default) {
  72857. throw _NotFoundException.default.getNotFoundInstance();
  72858. }
  72859. throw ignored;
  72860. }
  72861. };
  72862. /**
  72863. *
  72864. * @param image
  72865. * @param hints
  72866. * @param multiple
  72867. *
  72868. * @throws NotFoundException
  72869. * @throws FormatExceptionß
  72870. * @throws ChecksumException
  72871. */
  72872. PDF417Reader.decode = function (image, hints, multiple) {
  72873. var e_1, _a;
  72874. var results = new Array();
  72875. var detectorResult = _Detector.default.detectMultiple(image, hints, multiple);
  72876. try {
  72877. for (var _b = __values(detectorResult.getPoints()), _c = _b.next(); !_c.done; _c = _b.next()) {
  72878. var points = _c.value;
  72879. var decoderResult = _PDF417ScanningDecoder.default.decode(detectorResult.getBits(), points[4], points[5], points[6], points[7], PDF417Reader.getMinCodewordWidth(points), PDF417Reader.getMaxCodewordWidth(points));
  72880. var result = new _Result.default(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, _BarcodeFormat.default.PDF_417);
  72881. result.putMetadata(_ResultMetadataType.default.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
  72882. var pdf417ResultMetadata = decoderResult.getOther();
  72883. if (pdf417ResultMetadata != null) {
  72884. result.putMetadata(_ResultMetadataType.default.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
  72885. }
  72886. results.push(result);
  72887. }
  72888. } catch (e_1_1) {
  72889. e_1 = {
  72890. error: e_1_1
  72891. };
  72892. } finally {
  72893. try {
  72894. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  72895. } finally {
  72896. if (e_1) throw e_1.error;
  72897. }
  72898. }
  72899. return results.map(function (x) {
  72900. return x;
  72901. });
  72902. };
  72903. PDF417Reader.getMaxWidth = function (p1, p2) {
  72904. if (p1 == null || p2 == null) {
  72905. return 0;
  72906. }
  72907. return Math.trunc(Math.abs(p1.getX() - p2.getX()));
  72908. };
  72909. PDF417Reader.getMinWidth = function (p1, p2) {
  72910. if (p1 == null || p2 == null) {
  72911. return _Integer.default.MAX_VALUE;
  72912. }
  72913. return Math.trunc(Math.abs(p1.getX() - p2.getX()));
  72914. };
  72915. PDF417Reader.getMaxCodewordWidth = function (p) {
  72916. return Math.floor(Math.max(Math.max(PDF417Reader.getMaxWidth(p[0], p[4]), PDF417Reader.getMaxWidth(p[6], p[2]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN), Math.max(PDF417Reader.getMaxWidth(p[1], p[5]), PDF417Reader.getMaxWidth(p[7], p[3]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN)));
  72917. };
  72918. PDF417Reader.getMinCodewordWidth = function (p) {
  72919. return Math.floor(Math.min(Math.min(PDF417Reader.getMinWidth(p[0], p[4]), PDF417Reader.getMinWidth(p[6], p[2]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN), Math.min(PDF417Reader.getMinWidth(p[1], p[5]), PDF417Reader.getMinWidth(p[7], p[3]) * _PDF417Common.default.MODULES_IN_CODEWORD / _PDF417Common.default.MODULES_IN_STOP_PATTERN)));
  72920. };
  72921. // @Override
  72922. PDF417Reader.prototype.reset = function () {
  72923. // nothing needs to be reset
  72924. };
  72925. return PDF417Reader;
  72926. }();
  72927. var _default = PDF417Reader;
  72928. exports.default = _default;
  72929. /***/ }),
  72930. /* 434 */
  72931. /*!***************************************************************************************!*\
  72932. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/PDF417Common.js ***!
  72933. \***************************************************************************************/
  72934. /*! no static exports found */
  72935. /***/ (function(module, exports, __webpack_require__) {
  72936. "use strict";
  72937. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  72938. Object.defineProperty(exports, "__esModule", {
  72939. value: true
  72940. });
  72941. exports.default = void 0;
  72942. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../util/Arrays */ 314));
  72943. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../common/detector/MathUtils */ 347));
  72944. /*
  72945. * Copyright 2009 ZXing authors
  72946. *
  72947. * Licensed under the Apache License, Version 2.0 (the "License");
  72948. * you may not use this file except in compliance with the License.
  72949. * You may obtain a copy of the License at
  72950. *
  72951. * http://www.apache.org/licenses/LICENSE-2.0
  72952. *
  72953. * Unless required by applicable law or agreed to in writing, software
  72954. * distributed under the License is distributed on an "AS IS" BASIS,
  72955. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  72956. * See the License for the specific language governing permissions and
  72957. * limitations under the License.
  72958. */
  72959. // package com.google.zxing.pdf417;
  72960. var __values = void 0 && (void 0).__values || function (o) {
  72961. var s = typeof Symbol === "function" && Symbol.iterator,
  72962. m = s && o[s],
  72963. i = 0;
  72964. if (m) return m.call(o);
  72965. if (o && typeof o.length === "number") return {
  72966. next: function next() {
  72967. if (o && i >= o.length) o = void 0;
  72968. return {
  72969. value: o && o[i++],
  72970. done: !o
  72971. };
  72972. }
  72973. };
  72974. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  72975. };
  72976. // import java.util.Arrays;
  72977. /**
  72978. * @author SITA Lab (kevin.osullivan@sita.aero)
  72979. * @author Guenther Grau
  72980. */
  72981. var PDF417Common = /** @class */function () {
  72982. function PDF417Common() {}
  72983. PDF417Common.prototype.PDF417Common = function () {};
  72984. /**
  72985. * @param moduleBitCount values to sum
  72986. * @return sum of values
  72987. * @deprecated call {@link MathUtils#sum(int[])}
  72988. */
  72989. // @Deprecated
  72990. PDF417Common.getBitCountSum = function (moduleBitCount) {
  72991. return _MathUtils.default.sum(moduleBitCount);
  72992. };
  72993. PDF417Common.toIntArray = function (list) {
  72994. var e_1, _a;
  72995. if (list == null || !list.length) {
  72996. return PDF417Common.EMPTY_INT_ARRAY;
  72997. }
  72998. var result = new Int32Array(list.length);
  72999. var i = 0;
  73000. try {
  73001. for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
  73002. var integer = list_1_1.value;
  73003. result[i++] = integer;
  73004. }
  73005. } catch (e_1_1) {
  73006. e_1 = {
  73007. error: e_1_1
  73008. };
  73009. } finally {
  73010. try {
  73011. if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
  73012. } finally {
  73013. if (e_1) throw e_1.error;
  73014. }
  73015. }
  73016. return result;
  73017. };
  73018. /**
  73019. * @param symbol encoded symbol to translate to a codeword
  73020. * @return the codeword corresponding to the symbol.
  73021. */
  73022. PDF417Common.getCodeword = function (symbol /*int*/) {
  73023. var i = _Arrays.default.binarySearch(PDF417Common.SYMBOL_TABLE, symbol & 0x3FFFF);
  73024. if (i < 0) {
  73025. return -1;
  73026. }
  73027. return (PDF417Common.CODEWORD_TABLE[i] - 1) % PDF417Common.NUMBER_OF_CODEWORDS;
  73028. };
  73029. PDF417Common.NUMBER_OF_CODEWORDS = 929;
  73030. // Maximum Codewords (Data + Error).
  73031. PDF417Common.MAX_CODEWORDS_IN_BARCODE = PDF417Common.NUMBER_OF_CODEWORDS - 1;
  73032. PDF417Common.MIN_ROWS_IN_BARCODE = 3;
  73033. PDF417Common.MAX_ROWS_IN_BARCODE = 90;
  73034. // One left row indication column + max 30 data columns + one right row indicator column
  73035. // public static /*final*/ MAX_CODEWORDS_IN_ROW: /*int*/ number = 32;
  73036. PDF417Common.MODULES_IN_CODEWORD = 17;
  73037. PDF417Common.MODULES_IN_STOP_PATTERN = 18;
  73038. PDF417Common.BARS_IN_MODULE = 8;
  73039. PDF417Common.EMPTY_INT_ARRAY = new Int32Array([]);
  73040. /**
  73041. * The sorted table of all possible symbols. Extracted from the PDF417
  73042. * specification. The index of a symbol in this table corresponds to the
  73043. * index into the codeword table.
  73044. */
  73045. PDF417Common.SYMBOL_TABLE = Int32Array.from([0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x1035c, 0x10396, 0x103a6, 0x103ac, 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10466, 0x1046c, 0x1047a, 0x10482, 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10504, 0x10508, 0x10510, 0x1051e, 0x10520, 0x1053c, 0x10540, 0x10578, 0x10586, 0x1058c, 0x10598, 0x105b0, 0x105be, 0x105ce, 0x105dc, 0x105e2, 0x105e4, 0x105e8, 0x105f6, 0x1062e, 0x1064e, 0x1065c, 0x1068e, 0x1069c, 0x106b8, 0x106de, 0x106fa, 0x10716, 0x10726, 0x1072c, 0x10746, 0x1074c, 0x10758, 0x1076e, 0x10792, 0x10794, 0x107a2, 0x107a4, 0x107a8, 0x107b6, 0x10822, 0x10828, 0x10842, 0x10848, 0x10850, 0x1085e, 0x10866, 0x1086c, 0x1087a, 0x10882, 0x10884, 0x10890, 0x1089e, 0x108a0, 0x108bc, 0x108c6, 0x108cc, 0x108d8, 0x108ee, 0x108f2, 0x108f4, 0x10902, 0x10908, 0x1091e, 0x10920, 0x1093c, 0x10940, 0x10978, 0x10986, 0x10998, 0x109b0, 0x109be, 0x109ce, 0x109dc, 0x109e2, 0x109e4, 0x109e8, 0x109f6, 0x10a08, 0x10a10, 0x10a1e, 0x10a20, 0x10a3c, 0x10a40, 0x10a78, 0x10af0, 0x10b06, 0x10b0c, 0x10b18, 0x10b30, 0x10b3e, 0x10b60, 0x10b7c, 0x10b8e, 0x10b9c, 0x10bb8, 0x10bc2, 0x10bc4, 0x10bc8, 0x10bd0, 0x10bde, 0x10be6, 0x10bec, 0x10c2e, 0x10c4e, 0x10c5c, 0x10c62, 0x10c64, 0x10c68, 0x10c76, 0x10c8e, 0x10c9c, 0x10cb8, 0x10cc2, 0x10cc4, 0x10cc8, 0x10cd0, 0x10cde, 0x10ce6, 0x10cec, 0x10cfa, 0x10d0e, 0x10d1c, 0x10d38, 0x10d70, 0x10d7e, 0x10d82, 0x10d84, 0x10d88, 0x10d90, 0x10d9e, 0x10da0, 0x10dbc, 0x10dc6, 0x10dcc, 0x10dd8, 0x10dee, 0x10df2, 0x10df4, 0x10e16, 0x10e26, 0x10e2c, 0x10e46, 0x10e58, 0x10e6e, 0x10e86, 0x10e8c, 0x10e98, 0x10eb0, 0x10ebe, 0x10ece, 0x10edc, 0x10f0a, 0x10f12, 0x10f14, 0x10f22, 0x10f28, 0x10f36, 0x10f42, 0x10f44, 0x10f48, 0x10f50, 0x10f5e, 0x10f66, 0x10f6c, 0x10fb2, 0x10fb4, 0x11022, 0x11028, 0x11042, 0x11048, 0x11050, 0x1105e, 0x1107a, 0x11082, 0x11084, 0x11090, 0x1109e, 0x110a0, 0x110bc, 0x110c6, 0x110cc, 0x110d8, 0x110ee, 0x110f2, 0x110f4, 0x11102, 0x1111e, 0x11120, 0x1113c, 0x11140, 0x11178, 0x11186, 0x11198, 0x111b0, 0x111be, 0x111ce, 0x111dc, 0x111e2, 0x111e4, 0x111e8, 0x111f6, 0x11208, 0x1121e, 0x11220, 0x11278, 0x112f0, 0x1130c, 0x11330, 0x1133e, 0x11360, 0x1137c, 0x1138e, 0x1139c, 0x113b8, 0x113c2, 0x113c8, 0x113d0, 0x113de, 0x113e6, 0x113ec, 0x11408, 0x11410, 0x1141e, 0x11420, 0x1143c, 0x11440, 0x11478, 0x114f0, 0x115e0, 0x1160c, 0x11618, 0x11630, 0x1163e, 0x11660, 0x1167c, 0x116c0, 0x116f8, 0x1171c, 0x11738, 0x11770, 0x1177e, 0x11782, 0x11784, 0x11788, 0x11790, 0x1179e, 0x117a0, 0x117bc, 0x117c6, 0x117cc, 0x117d8, 0x117ee, 0x1182e, 0x11834, 0x1184e, 0x1185c, 0x11862, 0x11864, 0x11868, 0x11876, 0x1188e, 0x1189c, 0x118b8, 0x118c2, 0x118c8, 0x118d0, 0x118de, 0x118e6, 0x118ec, 0x118fa, 0x1190e, 0x1191c, 0x11938, 0x11970, 0x1197e, 0x11982, 0x11984, 0x11990, 0x1199e, 0x119a0, 0x119bc, 0x119c6, 0x119cc, 0x119d8, 0x119ee, 0x119f2, 0x119f4, 0x11a0e, 0x11a1c, 0x11a38, 0x11a70, 0x11a7e, 0x11ae0, 0x11afc, 0x11b08, 0x11b10, 0x11b1e, 0x11b20, 0x11b3c, 0x11b40, 0x11b78, 0x11b8c, 0x11b98, 0x11bb0, 0x11bbe, 0x11bce, 0x11bdc, 0x11be2, 0x11be4, 0x11be8, 0x11bf6, 0x11c16, 0x11c26, 0x11c2c, 0x11c46, 0x11c4c, 0x11c58, 0x11c6e, 0x11c86, 0x11c98, 0x11cb0, 0x11cbe, 0x11cce, 0x11cdc, 0x11ce2, 0x11ce4, 0x11ce8, 0x11cf6, 0x11d06, 0x11d0c, 0x11d18, 0x11d30, 0x11d3e, 0x11d60, 0x11d7c, 0x11d8e, 0x11d9c, 0x11db8, 0x11dc4, 0x11dc8, 0x11dd0, 0x11dde, 0x11de6, 0x11dec, 0x11dfa, 0x11e0a, 0x11e12, 0x11e14, 0x11e22, 0x11e24, 0x11e28, 0x11e36, 0x11e42, 0x11e44, 0x11e50, 0x11e5e, 0x11e66, 0x11e6c, 0x11e82, 0x11e84, 0x11e88, 0x11e90, 0x11e9e, 0x11ea0, 0x11ebc, 0x11ec6, 0x11ecc, 0x11ed8, 0x11eee, 0x11f1a, 0x11f2e, 0x11f32, 0x11f34, 0x11f4e, 0x11f5c, 0x11f62, 0x11f64, 0x11f68, 0x11f76, 0x12048, 0x1205e, 0x12082, 0x12084, 0x12090, 0x1209e, 0x120a0, 0x120bc, 0x120d8, 0x120f2, 0x120f4, 0x12108, 0x1211e, 0x12120, 0x1213c, 0x12140, 0x12178, 0x12186, 0x12198, 0x121b0, 0x121be, 0x121e2, 0x121e4, 0x121e8, 0x121f6, 0x12204, 0x12210, 0x1221e, 0x12220, 0x12278, 0x122f0, 0x12306, 0x1230c, 0x12330, 0x1233e, 0x12360, 0x1237c, 0x1238e, 0x1239c, 0x123b8, 0x123c2, 0x123c8, 0x123d0, 0x123e6, 0x123ec, 0x1241e, 0x12420, 0x1243c, 0x124f0, 0x125e0, 0x12618, 0x1263e, 0x12660, 0x1267c, 0x126c0, 0x126f8, 0x12738, 0x12770, 0x1277e, 0x12782, 0x12784, 0x12790, 0x1279e, 0x127a0, 0x127bc, 0x127c6, 0x127cc, 0x127d8, 0x127ee, 0x12820, 0x1283c, 0x12840, 0x12878, 0x128f0, 0x129e0, 0x12bc0, 0x12c18, 0x12c30, 0x12c3e, 0x12c60, 0x12c7c, 0x12cc0, 0x12cf8, 0x12df0, 0x12e1c, 0x12e38, 0x12e70, 0x12e7e, 0x12ee0, 0x12efc, 0x12f04, 0x12f08, 0x12f10, 0x12f20, 0x12f3c, 0x12f40, 0x12f78, 0x12f86, 0x12f8c, 0x12f98, 0x12fb0, 0x12fbe, 0x12fce, 0x12fdc, 0x1302e, 0x1304e, 0x1305c, 0x13062, 0x13068, 0x1308e, 0x1309c, 0x130b8, 0x130c2, 0x130c8, 0x130d0, 0x130de, 0x130ec, 0x130fa, 0x1310e, 0x13138, 0x13170, 0x1317e, 0x13182, 0x13184, 0x13190, 0x1319e, 0x131a0, 0x131bc, 0x131c6, 0x131cc, 0x131d8, 0x131f2, 0x131f4, 0x1320e, 0x1321c, 0x13270, 0x1327e, 0x132e0, 0x132fc, 0x13308, 0x1331e, 0x13320, 0x1333c, 0x13340, 0x13378, 0x13386, 0x13398, 0x133b0, 0x133be, 0x133ce, 0x133dc, 0x133e2, 0x133e4, 0x133e8, 0x133f6, 0x1340e, 0x1341c, 0x13438, 0x13470, 0x1347e, 0x134e0, 0x134fc, 0x135c0, 0x135f8, 0x13608, 0x13610, 0x1361e, 0x13620, 0x1363c, 0x13640, 0x13678, 0x136f0, 0x1370c, 0x13718, 0x13730, 0x1373e, 0x13760, 0x1377c, 0x1379c, 0x137b8, 0x137c2, 0x137c4, 0x137c8, 0x137d0, 0x137de, 0x137e6, 0x137ec, 0x13816, 0x13826, 0x1382c, 0x13846, 0x1384c, 0x13858, 0x1386e, 0x13874, 0x13886, 0x13898, 0x138b0, 0x138be, 0x138ce, 0x138dc, 0x138e2, 0x138e4, 0x138e8, 0x13906, 0x1390c, 0x13930, 0x1393e, 0x13960, 0x1397c, 0x1398e, 0x1399c, 0x139b8, 0x139c8, 0x139d0, 0x139de, 0x139e6, 0x139ec, 0x139fa, 0x13a06, 0x13a0c, 0x13a18, 0x13a30, 0x13a3e, 0x13a60, 0x13a7c, 0x13ac0, 0x13af8, 0x13b0e, 0x13b1c, 0x13b38, 0x13b70, 0x13b7e, 0x13b88, 0x13b90, 0x13b9e, 0x13ba0, 0x13bbc, 0x13bcc, 0x13bd8, 0x13bee, 0x13bf2, 0x13bf4, 0x13c12, 0x13c14, 0x13c22, 0x13c24, 0x13c28, 0x13c36, 0x13c42, 0x13c48, 0x13c50, 0x13c5e, 0x13c66, 0x13c6c, 0x13c82, 0x13c84, 0x13c90, 0x13c9e, 0x13ca0, 0x13cbc, 0x13cc6, 0x13ccc, 0x13cd8, 0x13cee, 0x13d02, 0x13d04, 0x13d08, 0x13d10, 0x13d1e, 0x13d20, 0x13d3c, 0x13d40, 0x13d78, 0x13d86, 0x13d8c, 0x13d98, 0x13db0, 0x13dbe, 0x13dce, 0x13ddc, 0x13de4, 0x13de8, 0x13df6, 0x13e1a, 0x13e2e, 0x13e32, 0x13e34, 0x13e4e, 0x13e5c, 0x13e62, 0x13e64, 0x13e68, 0x13e76, 0x13e8e, 0x13e9c, 0x13eb8, 0x13ec2, 0x13ec4, 0x13ec8, 0x13ed0, 0x13ede, 0x13ee6, 0x13eec, 0x13f26, 0x13f2c, 0x13f3a, 0x13f46, 0x13f4c, 0x13f58, 0x13f6e, 0x13f72, 0x13f74, 0x14082, 0x1409e, 0x140a0, 0x140bc, 0x14104, 0x14108, 0x14110, 0x1411e, 0x14120, 0x1413c, 0x14140, 0x14178, 0x1418c, 0x14198, 0x141b0, 0x141be, 0x141e2, 0x141e4, 0x141e8, 0x14208, 0x14210, 0x1421e, 0x14220, 0x1423c, 0x14240, 0x14278, 0x142f0, 0x14306, 0x1430c, 0x14318, 0x14330, 0x1433e, 0x14360, 0x1437c, 0x1438e, 0x143c2, 0x143c4, 0x143c8, 0x143d0, 0x143e6, 0x143ec, 0x14408, 0x14410, 0x1441e, 0x14420, 0x1443c, 0x14440, 0x14478, 0x144f0, 0x145e0, 0x1460c, 0x14618, 0x14630, 0x1463e, 0x14660, 0x1467c, 0x146c0, 0x146f8, 0x1471c, 0x14738, 0x14770, 0x1477e, 0x14782, 0x14784, 0x14788, 0x14790, 0x147a0, 0x147bc, 0x147c6, 0x147cc, 0x147d8, 0x147ee, 0x14810, 0x14820, 0x1483c, 0x14840, 0x14878, 0x148f0, 0x149e0, 0x14bc0, 0x14c30, 0x14c3e, 0x14c60, 0x14c7c, 0x14cc0, 0x14cf8, 0x14df0, 0x14e38, 0x14e70, 0x14e7e, 0x14ee0, 0x14efc, 0x14f04, 0x14f08, 0x14f10, 0x14f1e, 0x14f20, 0x14f3c, 0x14f40, 0x14f78, 0x14f86, 0x14f8c, 0x14f98, 0x14fb0, 0x14fce, 0x14fdc, 0x15020, 0x15040, 0x15078, 0x150f0, 0x151e0, 0x153c0, 0x15860, 0x1587c, 0x158c0, 0x158f8, 0x159f0, 0x15be0, 0x15c70, 0x15c7e, 0x15ce0, 0x15cfc, 0x15dc0, 0x15df8, 0x15e08, 0x15e10, 0x15e20, 0x15e40, 0x15e78, 0x15ef0, 0x15f0c, 0x15f18, 0x15f30, 0x15f60, 0x15f7c, 0x15f8e, 0x15f9c, 0x15fb8, 0x1604e, 0x1605c, 0x1608e, 0x1609c, 0x160b8, 0x160c2, 0x160c4, 0x160c8, 0x160de, 0x1610e, 0x1611c, 0x16138, 0x16170, 0x1617e, 0x16184, 0x16188, 0x16190, 0x1619e, 0x161a0, 0x161bc, 0x161c6, 0x161cc, 0x161d8, 0x161f2, 0x161f4, 0x1620e, 0x1621c, 0x16238, 0x16270, 0x1627e, 0x162e0, 0x162fc, 0x16304, 0x16308, 0x16310, 0x1631e, 0x16320, 0x1633c, 0x16340, 0x16378, 0x16386, 0x1638c, 0x16398, 0x163b0, 0x163be, 0x163ce, 0x163dc, 0x163e2, 0x163e4, 0x163e8, 0x163f6, 0x1640e, 0x1641c, 0x16438, 0x16470, 0x1647e, 0x164e0, 0x164fc, 0x165c0, 0x165f8, 0x16610, 0x1661e, 0x16620, 0x1663c, 0x16640, 0x16678, 0x166f0, 0x16718, 0x16730, 0x1673e, 0x16760, 0x1677c, 0x1678e, 0x1679c, 0x167b8, 0x167c2, 0x167c4, 0x167c8, 0x167d0, 0x167de, 0x167e6, 0x167ec, 0x1681c, 0x16838, 0x16870, 0x168e0, 0x168fc, 0x169c0, 0x169f8, 0x16bf0, 0x16c10, 0x16c1e, 0x16c20, 0x16c3c, 0x16c40, 0x16c78, 0x16cf0, 0x16de0, 0x16e18, 0x16e30, 0x16e3e, 0x16e60, 0x16e7c, 0x16ec0, 0x16ef8, 0x16f1c, 0x16f38, 0x16f70, 0x16f7e, 0x16f84, 0x16f88, 0x16f90, 0x16f9e, 0x16fa0, 0x16fbc, 0x16fc6, 0x16fcc, 0x16fd8, 0x17026, 0x1702c, 0x17046, 0x1704c, 0x17058, 0x1706e, 0x17086, 0x1708c, 0x17098, 0x170b0, 0x170be, 0x170ce, 0x170dc, 0x170e8, 0x17106, 0x1710c, 0x17118, 0x17130, 0x1713e, 0x17160, 0x1717c, 0x1718e, 0x1719c, 0x171b8, 0x171c2, 0x171c4, 0x171c8, 0x171d0, 0x171de, 0x171e6, 0x171ec, 0x171fa, 0x17206, 0x1720c, 0x17218, 0x17230, 0x1723e, 0x17260, 0x1727c, 0x172c0, 0x172f8, 0x1730e, 0x1731c, 0x17338, 0x17370, 0x1737e, 0x17388, 0x17390, 0x1739e, 0x173a0, 0x173bc, 0x173cc, 0x173d8, 0x173ee, 0x173f2, 0x173f4, 0x1740c, 0x17418, 0x17430, 0x1743e, 0x17460, 0x1747c, 0x174c0, 0x174f8, 0x175f0, 0x1760e, 0x1761c, 0x17638, 0x17670, 0x1767e, 0x176e0, 0x176fc, 0x17708, 0x17710, 0x1771e, 0x17720, 0x1773c, 0x17740, 0x17778, 0x17798, 0x177b0, 0x177be, 0x177dc, 0x177e2, 0x177e4, 0x177e8, 0x17822, 0x17824, 0x17828, 0x17836, 0x17842, 0x17844, 0x17848, 0x17850, 0x1785e, 0x17866, 0x1786c, 0x17882, 0x17884, 0x17888, 0x17890, 0x1789e, 0x178a0, 0x178bc, 0x178c6, 0x178cc, 0x178d8, 0x178ee, 0x178f2, 0x178f4, 0x17902, 0x17904, 0x17908, 0x17910, 0x1791e, 0x17920, 0x1793c, 0x17940, 0x17978, 0x17986, 0x1798c, 0x17998, 0x179b0, 0x179be, 0x179ce, 0x179dc, 0x179e2, 0x179e4, 0x179e8, 0x179f6, 0x17a04, 0x17a08, 0x17a10, 0x17a1e, 0x17a20, 0x17a3c, 0x17a40, 0x17a78, 0x17af0, 0x17b06, 0x17b0c, 0x17b18, 0x17b30, 0x17b3e, 0x17b60, 0x17b7c, 0x17b8e, 0x17b9c, 0x17bb8, 0x17bc4, 0x17bc8, 0x17bd0, 0x17bde, 0x17be6, 0x17bec, 0x17c2e, 0x17c32, 0x17c34, 0x17c4e, 0x17c5c, 0x17c62, 0x17c64, 0x17c68, 0x17c76, 0x17c8e, 0x17c9c, 0x17cb8, 0x17cc2, 0x17cc4, 0x17cc8, 0x17cd0, 0x17cde, 0x17ce6, 0x17cec, 0x17d0e, 0x17d1c, 0x17d38, 0x17d70, 0x17d82, 0x17d84, 0x17d88, 0x17d90, 0x17d9e, 0x17da0, 0x17dbc, 0x17dc6, 0x17dcc, 0x17dd8, 0x17dee, 0x17e26, 0x17e2c, 0x17e3a, 0x17e46, 0x17e4c, 0x17e58, 0x17e6e, 0x17e72, 0x17e74, 0x17e86, 0x17e8c, 0x17e98, 0x17eb0, 0x17ece, 0x17edc, 0x17ee2, 0x17ee4, 0x17ee8, 0x17ef6, 0x1813a, 0x18172, 0x18174, 0x18216, 0x18226, 0x1823a, 0x1824c, 0x18258, 0x1826e, 0x18272, 0x18274, 0x18298, 0x182be, 0x182e2, 0x182e4, 0x182e8, 0x182f6, 0x1835e, 0x1837a, 0x183ae, 0x183d6, 0x18416, 0x18426, 0x1842c, 0x1843a, 0x18446, 0x18458, 0x1846e, 0x18472, 0x18474, 0x18486, 0x184b0, 0x184be, 0x184ce, 0x184dc, 0x184e2, 0x184e4, 0x184e8, 0x184f6, 0x18506, 0x1850c, 0x18518, 0x18530, 0x1853e, 0x18560, 0x1857c, 0x1858e, 0x1859c, 0x185b8, 0x185c2, 0x185c4, 0x185c8, 0x185d0, 0x185de, 0x185e6, 0x185ec, 0x185fa, 0x18612, 0x18614, 0x18622, 0x18628, 0x18636, 0x18642, 0x18650, 0x1865e, 0x1867a, 0x18682, 0x18684, 0x18688, 0x18690, 0x1869e, 0x186a0, 0x186bc, 0x186c6, 0x186cc, 0x186d8, 0x186ee, 0x186f2, 0x186f4, 0x1872e, 0x1874e, 0x1875c, 0x18796, 0x187a6, 0x187ac, 0x187d2, 0x187d4, 0x18826, 0x1882c, 0x1883a, 0x18846, 0x1884c, 0x18858, 0x1886e, 0x18872, 0x18874, 0x18886, 0x18898, 0x188b0, 0x188be, 0x188ce, 0x188dc, 0x188e2, 0x188e4, 0x188e8, 0x188f6, 0x1890c, 0x18930, 0x1893e, 0x18960, 0x1897c, 0x1898e, 0x189b8, 0x189c2, 0x189c8, 0x189d0, 0x189de, 0x189e6, 0x189ec, 0x189fa, 0x18a18, 0x18a30, 0x18a3e, 0x18a60, 0x18a7c, 0x18ac0, 0x18af8, 0x18b1c, 0x18b38, 0x18b70, 0x18b7e, 0x18b82, 0x18b84, 0x18b88, 0x18b90, 0x18b9e, 0x18ba0, 0x18bbc, 0x18bc6, 0x18bcc, 0x18bd8, 0x18bee, 0x18bf2, 0x18bf4, 0x18c22, 0x18c24, 0x18c28, 0x18c36, 0x18c42, 0x18c48, 0x18c50, 0x18c5e, 0x18c66, 0x18c7a, 0x18c82, 0x18c84, 0x18c90, 0x18c9e, 0x18ca0, 0x18cbc, 0x18ccc, 0x18cf2, 0x18cf4, 0x18d04, 0x18d08, 0x18d10, 0x18d1e, 0x18d20, 0x18d3c, 0x18d40, 0x18d78, 0x18d86, 0x18d98, 0x18dce, 0x18de2, 0x18de4, 0x18de8, 0x18e2e, 0x18e32, 0x18e34, 0x18e4e, 0x18e5c, 0x18e62, 0x18e64, 0x18e68, 0x18e8e, 0x18e9c, 0x18eb8, 0x18ec2, 0x18ec4, 0x18ec8, 0x18ed0, 0x18efa, 0x18f16, 0x18f26, 0x18f2c, 0x18f46, 0x18f4c, 0x18f58, 0x18f6e, 0x18f8a, 0x18f92, 0x18f94, 0x18fa2, 0x18fa4, 0x18fa8, 0x18fb6, 0x1902c, 0x1903a, 0x19046, 0x1904c, 0x19058, 0x19072, 0x19074, 0x19086, 0x19098, 0x190b0, 0x190be, 0x190ce, 0x190dc, 0x190e2, 0x190e8, 0x190f6, 0x19106, 0x1910c, 0x19130, 0x1913e, 0x19160, 0x1917c, 0x1918e, 0x1919c, 0x191b8, 0x191c2, 0x191c8, 0x191d0, 0x191de, 0x191e6, 0x191ec, 0x191fa, 0x19218, 0x1923e, 0x19260, 0x1927c, 0x192c0, 0x192f8, 0x19338, 0x19370, 0x1937e, 0x19382, 0x19384, 0x19390, 0x1939e, 0x193a0, 0x193bc, 0x193c6, 0x193cc, 0x193d8, 0x193ee, 0x193f2, 0x193f4, 0x19430, 0x1943e, 0x19460, 0x1947c, 0x194c0, 0x194f8, 0x195f0, 0x19638, 0x19670, 0x1967e, 0x196e0, 0x196fc, 0x19702, 0x19704, 0x19708, 0x19710, 0x19720, 0x1973c, 0x19740, 0x19778, 0x19786, 0x1978c, 0x19798, 0x197b0, 0x197be, 0x197ce, 0x197dc, 0x197e2, 0x197e4, 0x197e8, 0x19822, 0x19824, 0x19842, 0x19848, 0x19850, 0x1985e, 0x19866, 0x1987a, 0x19882, 0x19884, 0x19890, 0x1989e, 0x198a0, 0x198bc, 0x198cc, 0x198f2, 0x198f4, 0x19902, 0x19908, 0x1991e, 0x19920, 0x1993c, 0x19940, 0x19978, 0x19986, 0x19998, 0x199ce, 0x199e2, 0x199e4, 0x199e8, 0x19a08, 0x19a10, 0x19a1e, 0x19a20, 0x19a3c, 0x19a40, 0x19a78, 0x19af0, 0x19b18, 0x19b3e, 0x19b60, 0x19b9c, 0x19bc2, 0x19bc4, 0x19bc8, 0x19bd0, 0x19be6, 0x19c2e, 0x19c34, 0x19c4e, 0x19c5c, 0x19c62, 0x19c64, 0x19c68, 0x19c8e, 0x19c9c, 0x19cb8, 0x19cc2, 0x19cc8, 0x19cd0, 0x19ce6, 0x19cfa, 0x19d0e, 0x19d1c, 0x19d38, 0x19d70, 0x19d7e, 0x19d82, 0x19d84, 0x19d88, 0x19d90, 0x19da0, 0x19dcc, 0x19df2, 0x19df4, 0x19e16, 0x19e26, 0x19e2c, 0x19e46, 0x19e4c, 0x19e58, 0x19e74, 0x19e86, 0x19e8c, 0x19e98, 0x19eb0, 0x19ebe, 0x19ece, 0x19ee2, 0x19ee4, 0x19ee8, 0x19f0a, 0x19f12, 0x19f14, 0x19f22, 0x19f24, 0x19f28, 0x19f42, 0x19f44, 0x19f48, 0x19f50, 0x19f5e, 0x19f6c, 0x19f9a, 0x19fae, 0x19fb2, 0x19fb4, 0x1a046, 0x1a04c, 0x1a072, 0x1a074, 0x1a086, 0x1a08c, 0x1a098, 0x1a0b0, 0x1a0be, 0x1a0e2, 0x1a0e4, 0x1a0e8, 0x1a0f6, 0x1a106, 0x1a10c, 0x1a118, 0x1a130, 0x1a13e, 0x1a160, 0x1a17c, 0x1a18e, 0x1a19c, 0x1a1b8, 0x1a1c2, 0x1a1c4, 0x1a1c8, 0x1a1d0, 0x1a1de, 0x1a1e6, 0x1a1ec, 0x1a218, 0x1a230, 0x1a23e, 0x1a260, 0x1a27c, 0x1a2c0, 0x1a2f8, 0x1a31c, 0x1a338, 0x1a370, 0x1a37e, 0x1a382, 0x1a384, 0x1a388, 0x1a390, 0x1a39e, 0x1a3a0, 0x1a3bc, 0x1a3c6, 0x1a3cc, 0x1a3d8, 0x1a3ee, 0x1a3f2, 0x1a3f4, 0x1a418, 0x1a430, 0x1a43e, 0x1a460, 0x1a47c, 0x1a4c0, 0x1a4f8, 0x1a5f0, 0x1a61c, 0x1a638, 0x1a670, 0x1a67e, 0x1a6e0, 0x1a6fc, 0x1a702, 0x1a704, 0x1a708, 0x1a710, 0x1a71e, 0x1a720, 0x1a73c, 0x1a740, 0x1a778, 0x1a786, 0x1a78c, 0x1a798, 0x1a7b0, 0x1a7be, 0x1a7ce, 0x1a7dc, 0x1a7e2, 0x1a7e4, 0x1a7e8, 0x1a830, 0x1a860, 0x1a87c, 0x1a8c0, 0x1a8f8, 0x1a9f0, 0x1abe0, 0x1ac70, 0x1ac7e, 0x1ace0, 0x1acfc, 0x1adc0, 0x1adf8, 0x1ae04, 0x1ae08, 0x1ae10, 0x1ae20, 0x1ae3c, 0x1ae40, 0x1ae78, 0x1aef0, 0x1af06, 0x1af0c, 0x1af18, 0x1af30, 0x1af3e, 0x1af60, 0x1af7c, 0x1af8e, 0x1af9c, 0x1afb8, 0x1afc4, 0x1afc8, 0x1afd0, 0x1afde, 0x1b042, 0x1b05e, 0x1b07a, 0x1b082, 0x1b084, 0x1b088, 0x1b090, 0x1b09e, 0x1b0a0, 0x1b0bc, 0x1b0cc, 0x1b0f2, 0x1b0f4, 0x1b102, 0x1b104, 0x1b108, 0x1b110, 0x1b11e, 0x1b120, 0x1b13c, 0x1b140, 0x1b178, 0x1b186, 0x1b198, 0x1b1ce, 0x1b1e2, 0x1b1e4, 0x1b1e8, 0x1b204, 0x1b208, 0x1b210, 0x1b21e, 0x1b220, 0x1b23c, 0x1b240, 0x1b278, 0x1b2f0, 0x1b30c, 0x1b33e, 0x1b360, 0x1b39c, 0x1b3c2, 0x1b3c4, 0x1b3c8, 0x1b3d0, 0x1b3e6, 0x1b410, 0x1b41e, 0x1b420, 0x1b43c, 0x1b440, 0x1b478, 0x1b4f0, 0x1b5e0, 0x1b618, 0x1b660, 0x1b67c, 0x1b6c0, 0x1b738, 0x1b782, 0x1b784, 0x1b788, 0x1b790, 0x1b79e, 0x1b7a0, 0x1b7cc, 0x1b82e, 0x1b84e, 0x1b85c, 0x1b88e, 0x1b89c, 0x1b8b8, 0x1b8c2, 0x1b8c4, 0x1b8c8, 0x1b8d0, 0x1b8e6, 0x1b8fa, 0x1b90e, 0x1b91c, 0x1b938, 0x1b970, 0x1b97e, 0x1b982, 0x1b984, 0x1b988, 0x1b990, 0x1b99e, 0x1b9a0, 0x1b9cc, 0x1b9f2, 0x1b9f4, 0x1ba0e, 0x1ba1c, 0x1ba38, 0x1ba70, 0x1ba7e, 0x1bae0, 0x1bafc, 0x1bb08, 0x1bb10, 0x1bb20, 0x1bb3c, 0x1bb40, 0x1bb98, 0x1bbce, 0x1bbe2, 0x1bbe4, 0x1bbe8, 0x1bc16, 0x1bc26, 0x1bc2c, 0x1bc46, 0x1bc4c, 0x1bc58, 0x1bc72, 0x1bc74, 0x1bc86, 0x1bc8c, 0x1bc98, 0x1bcb0, 0x1bcbe, 0x1bcce, 0x1bce2, 0x1bce4, 0x1bce8, 0x1bd06, 0x1bd0c, 0x1bd18, 0x1bd30, 0x1bd3e, 0x1bd60, 0x1bd7c, 0x1bd9c, 0x1bdc2, 0x1bdc4, 0x1bdc8, 0x1bdd0, 0x1bde6, 0x1bdfa, 0x1be12, 0x1be14, 0x1be22, 0x1be24, 0x1be28, 0x1be42, 0x1be44, 0x1be48, 0x1be50, 0x1be5e, 0x1be66, 0x1be82, 0x1be84, 0x1be88, 0x1be90, 0x1be9e, 0x1bea0, 0x1bebc, 0x1becc, 0x1bef4, 0x1bf1a, 0x1bf2e, 0x1bf32, 0x1bf34, 0x1bf4e, 0x1bf5c, 0x1bf62, 0x1bf64, 0x1bf68, 0x1c09a, 0x1c0b2, 0x1c0b4, 0x1c11a, 0x1c132, 0x1c134, 0x1c162, 0x1c164, 0x1c168, 0x1c176, 0x1c1ba, 0x1c21a, 0x1c232, 0x1c234, 0x1c24e, 0x1c25c, 0x1c262, 0x1c264, 0x1c268, 0x1c276, 0x1c28e, 0x1c2c2, 0x1c2c4, 0x1c2c8, 0x1c2d0, 0x1c2de, 0x1c2e6, 0x1c2ec, 0x1c2fa, 0x1c316, 0x1c326, 0x1c33a, 0x1c346, 0x1c34c, 0x1c372, 0x1c374, 0x1c41a, 0x1c42e, 0x1c432, 0x1c434, 0x1c44e, 0x1c45c, 0x1c462, 0x1c464, 0x1c468, 0x1c476, 0x1c48e, 0x1c49c, 0x1c4b8, 0x1c4c2, 0x1c4c8, 0x1c4d0, 0x1c4de, 0x1c4e6, 0x1c4ec, 0x1c4fa, 0x1c51c, 0x1c538, 0x1c570, 0x1c57e, 0x1c582, 0x1c584, 0x1c588, 0x1c590, 0x1c59e, 0x1c5a0, 0x1c5bc, 0x1c5c6, 0x1c5cc, 0x1c5d8, 0x1c5ee, 0x1c5f2, 0x1c5f4, 0x1c616, 0x1c626, 0x1c62c, 0x1c63a, 0x1c646, 0x1c64c, 0x1c658, 0x1c66e, 0x1c672, 0x1c674, 0x1c686, 0x1c68c, 0x1c698, 0x1c6b0, 0x1c6be, 0x1c6ce, 0x1c6dc, 0x1c6e2, 0x1c6e4, 0x1c6e8, 0x1c712, 0x1c714, 0x1c722, 0x1c728, 0x1c736, 0x1c742, 0x1c744, 0x1c748, 0x1c750, 0x1c75e, 0x1c766, 0x1c76c, 0x1c77a, 0x1c7ae, 0x1c7d6, 0x1c7ea, 0x1c81a, 0x1c82e, 0x1c832, 0x1c834, 0x1c84e, 0x1c85c, 0x1c862, 0x1c864, 0x1c868, 0x1c876, 0x1c88e, 0x1c89c, 0x1c8b8, 0x1c8c2, 0x1c8c8, 0x1c8d0, 0x1c8de, 0x1c8e6, 0x1c8ec, 0x1c8fa, 0x1c90e, 0x1c938, 0x1c970, 0x1c97e, 0x1c982, 0x1c984, 0x1c990, 0x1c99e, 0x1c9a0, 0x1c9bc, 0x1c9c6, 0x1c9cc, 0x1c9d8, 0x1c9ee, 0x1c9f2, 0x1c9f4, 0x1ca38, 0x1ca70, 0x1ca7e, 0x1cae0, 0x1cafc, 0x1cb02, 0x1cb04, 0x1cb08, 0x1cb10, 0x1cb20, 0x1cb3c, 0x1cb40, 0x1cb78, 0x1cb86, 0x1cb8c, 0x1cb98, 0x1cbb0, 0x1cbbe, 0x1cbce, 0x1cbdc, 0x1cbe2, 0x1cbe4, 0x1cbe8, 0x1cbf6, 0x1cc16, 0x1cc26, 0x1cc2c, 0x1cc3a, 0x1cc46, 0x1cc58, 0x1cc72, 0x1cc74, 0x1cc86, 0x1ccb0, 0x1ccbe, 0x1ccce, 0x1cce2, 0x1cce4, 0x1cce8, 0x1cd06, 0x1cd0c, 0x1cd18, 0x1cd30, 0x1cd3e, 0x1cd60, 0x1cd7c, 0x1cd9c, 0x1cdc2, 0x1cdc4, 0x1cdc8, 0x1cdd0, 0x1cdde, 0x1cde6, 0x1cdfa, 0x1ce22, 0x1ce28, 0x1ce42, 0x1ce50, 0x1ce5e, 0x1ce66, 0x1ce7a, 0x1ce82, 0x1ce84, 0x1ce88, 0x1ce90, 0x1ce9e, 0x1cea0, 0x1cebc, 0x1cecc, 0x1cef2, 0x1cef4, 0x1cf2e, 0x1cf32, 0x1cf34, 0x1cf4e, 0x1cf5c, 0x1cf62, 0x1cf64, 0x1cf68, 0x1cf96, 0x1cfa6, 0x1cfac, 0x1cfca, 0x1cfd2, 0x1cfd4, 0x1d02e, 0x1d032, 0x1d034, 0x1d04e, 0x1d05c, 0x1d062, 0x1d064, 0x1d068, 0x1d076, 0x1d08e, 0x1d09c, 0x1d0b8, 0x1d0c2, 0x1d0c4, 0x1d0c8, 0x1d0d0, 0x1d0de, 0x1d0e6, 0x1d0ec, 0x1d0fa, 0x1d11c, 0x1d138, 0x1d170, 0x1d17e, 0x1d182, 0x1d184, 0x1d188, 0x1d190, 0x1d19e, 0x1d1a0, 0x1d1bc, 0x1d1c6, 0x1d1cc, 0x1d1d8, 0x1d1ee, 0x1d1f2, 0x1d1f4, 0x1d21c, 0x1d238, 0x1d270, 0x1d27e, 0x1d2e0, 0x1d2fc, 0x1d302, 0x1d304, 0x1d308, 0x1d310, 0x1d31e, 0x1d320, 0x1d33c, 0x1d340, 0x1d378, 0x1d386, 0x1d38c, 0x1d398, 0x1d3b0, 0x1d3be, 0x1d3ce, 0x1d3dc, 0x1d3e2, 0x1d3e4, 0x1d3e8, 0x1d3f6, 0x1d470, 0x1d47e, 0x1d4e0, 0x1d4fc, 0x1d5c0, 0x1d5f8, 0x1d604, 0x1d608, 0x1d610, 0x1d620, 0x1d640, 0x1d678, 0x1d6f0, 0x1d706, 0x1d70c, 0x1d718, 0x1d730, 0x1d73e, 0x1d760, 0x1d77c, 0x1d78e, 0x1d79c, 0x1d7b8, 0x1d7c2, 0x1d7c4, 0x1d7c8, 0x1d7d0, 0x1d7de, 0x1d7e6, 0x1d7ec, 0x1d826, 0x1d82c, 0x1d83a, 0x1d846, 0x1d84c, 0x1d858, 0x1d872, 0x1d874, 0x1d886, 0x1d88c, 0x1d898, 0x1d8b0, 0x1d8be, 0x1d8ce, 0x1d8e2, 0x1d8e4, 0x1d8e8, 0x1d8f6, 0x1d90c, 0x1d918, 0x1d930, 0x1d93e, 0x1d960, 0x1d97c, 0x1d99c, 0x1d9c2, 0x1d9c4, 0x1d9c8, 0x1d9d0, 0x1d9e6, 0x1d9fa, 0x1da0c, 0x1da18, 0x1da30, 0x1da3e, 0x1da60, 0x1da7c, 0x1dac0, 0x1daf8, 0x1db38, 0x1db82, 0x1db84, 0x1db88, 0x1db90, 0x1db9e, 0x1dba0, 0x1dbcc, 0x1dbf2, 0x1dbf4, 0x1dc22, 0x1dc42, 0x1dc44, 0x1dc48, 0x1dc50, 0x1dc5e, 0x1dc66, 0x1dc7a, 0x1dc82, 0x1dc84, 0x1dc88, 0x1dc90, 0x1dc9e, 0x1dca0, 0x1dcbc, 0x1dccc, 0x1dcf2, 0x1dcf4, 0x1dd04, 0x1dd08, 0x1dd10, 0x1dd1e, 0x1dd20, 0x1dd3c, 0x1dd40, 0x1dd78, 0x1dd86, 0x1dd98, 0x1ddce, 0x1dde2, 0x1dde4, 0x1dde8, 0x1de2e, 0x1de32, 0x1de34, 0x1de4e, 0x1de5c, 0x1de62, 0x1de64, 0x1de68, 0x1de8e, 0x1de9c, 0x1deb8, 0x1dec2, 0x1dec4, 0x1dec8, 0x1ded0, 0x1dee6, 0x1defa, 0x1df16, 0x1df26, 0x1df2c, 0x1df46, 0x1df4c, 0x1df58, 0x1df72, 0x1df74, 0x1df8a, 0x1df92, 0x1df94, 0x1dfa2, 0x1dfa4, 0x1dfa8, 0x1e08a, 0x1e092, 0x1e094, 0x1e0a2, 0x1e0a4, 0x1e0a8, 0x1e0b6, 0x1e0da, 0x1e10a, 0x1e112, 0x1e114, 0x1e122, 0x1e124, 0x1e128, 0x1e136, 0x1e142, 0x1e144, 0x1e148, 0x1e150, 0x1e166, 0x1e16c, 0x1e17a, 0x1e19a, 0x1e1b2, 0x1e1b4, 0x1e20a, 0x1e212, 0x1e214, 0x1e222, 0x1e224, 0x1e228, 0x1e236, 0x1e242, 0x1e248, 0x1e250, 0x1e25e, 0x1e266, 0x1e26c, 0x1e27a, 0x1e282, 0x1e284, 0x1e288, 0x1e290, 0x1e2a0, 0x1e2bc, 0x1e2c6, 0x1e2cc, 0x1e2d8, 0x1e2ee, 0x1e2f2, 0x1e2f4, 0x1e31a, 0x1e332, 0x1e334, 0x1e35c, 0x1e362, 0x1e364, 0x1e368, 0x1e3ba, 0x1e40a, 0x1e412, 0x1e414, 0x1e422, 0x1e428, 0x1e436, 0x1e442, 0x1e448, 0x1e450, 0x1e45e, 0x1e466, 0x1e46c, 0x1e47a, 0x1e482, 0x1e484, 0x1e490, 0x1e49e, 0x1e4a0, 0x1e4bc, 0x1e4c6, 0x1e4cc, 0x1e4d8, 0x1e4ee, 0x1e4f2, 0x1e4f4, 0x1e502, 0x1e504, 0x1e508, 0x1e510, 0x1e51e, 0x1e520, 0x1e53c, 0x1e540, 0x1e578, 0x1e586, 0x1e58c, 0x1e598, 0x1e5b0, 0x1e5be, 0x1e5ce, 0x1e5dc, 0x1e5e2, 0x1e5e4, 0x1e5e8, 0x1e5f6, 0x1e61a, 0x1e62e, 0x1e632, 0x1e634, 0x1e64e, 0x1e65c, 0x1e662, 0x1e668, 0x1e68e, 0x1e69c, 0x1e6b8, 0x1e6c2, 0x1e6c4, 0x1e6c8, 0x1e6d0, 0x1e6e6, 0x1e6fa, 0x1e716, 0x1e726, 0x1e72c, 0x1e73a, 0x1e746, 0x1e74c, 0x1e758, 0x1e772, 0x1e774, 0x1e792, 0x1e794, 0x1e7a2, 0x1e7a4, 0x1e7a8, 0x1e7b6, 0x1e812, 0x1e814, 0x1e822, 0x1e824, 0x1e828, 0x1e836, 0x1e842, 0x1e844, 0x1e848, 0x1e850, 0x1e85e, 0x1e866, 0x1e86c, 0x1e87a, 0x1e882, 0x1e884, 0x1e888, 0x1e890, 0x1e89e, 0x1e8a0, 0x1e8bc, 0x1e8c6, 0x1e8cc, 0x1e8d8, 0x1e8ee, 0x1e8f2, 0x1e8f4, 0x1e902, 0x1e904, 0x1e908, 0x1e910, 0x1e920, 0x1e93c, 0x1e940, 0x1e978, 0x1e986, 0x1e98c, 0x1e998, 0x1e9b0, 0x1e9be, 0x1e9ce, 0x1e9dc, 0x1e9e2, 0x1e9e4, 0x1e9e8, 0x1e9f6, 0x1ea04, 0x1ea08, 0x1ea10, 0x1ea20, 0x1ea40, 0x1ea78, 0x1eaf0, 0x1eb06, 0x1eb0c, 0x1eb18, 0x1eb30, 0x1eb3e, 0x1eb60, 0x1eb7c, 0x1eb8e, 0x1eb9c, 0x1ebb8, 0x1ebc2, 0x1ebc4, 0x1ebc8, 0x1ebd0, 0x1ebde, 0x1ebe6, 0x1ebec, 0x1ec1a, 0x1ec2e, 0x1ec32, 0x1ec34, 0x1ec4e, 0x1ec5c, 0x1ec62, 0x1ec64, 0x1ec68, 0x1ec8e, 0x1ec9c, 0x1ecb8, 0x1ecc2, 0x1ecc4, 0x1ecc8, 0x1ecd0, 0x1ece6, 0x1ecfa, 0x1ed0e, 0x1ed1c, 0x1ed38, 0x1ed70, 0x1ed7e, 0x1ed82, 0x1ed84, 0x1ed88, 0x1ed90, 0x1ed9e, 0x1eda0, 0x1edcc, 0x1edf2, 0x1edf4, 0x1ee16, 0x1ee26, 0x1ee2c, 0x1ee3a, 0x1ee46, 0x1ee4c, 0x1ee58, 0x1ee6e, 0x1ee72, 0x1ee74, 0x1ee86, 0x1ee8c, 0x1ee98, 0x1eeb0, 0x1eebe, 0x1eece, 0x1eedc, 0x1eee2, 0x1eee4, 0x1eee8, 0x1ef12, 0x1ef22, 0x1ef24, 0x1ef28, 0x1ef36, 0x1ef42, 0x1ef44, 0x1ef48, 0x1ef50, 0x1ef5e, 0x1ef66, 0x1ef6c, 0x1ef7a, 0x1efae, 0x1efb2, 0x1efb4, 0x1efd6, 0x1f096, 0x1f0a6, 0x1f0ac, 0x1f0ba, 0x1f0ca, 0x1f0d2, 0x1f0d4, 0x1f116, 0x1f126, 0x1f12c, 0x1f13a, 0x1f146, 0x1f14c, 0x1f158, 0x1f16e, 0x1f172, 0x1f174, 0x1f18a, 0x1f192, 0x1f194, 0x1f1a2, 0x1f1a4, 0x1f1a8, 0x1f1da, 0x1f216, 0x1f226, 0x1f22c, 0x1f23a, 0x1f246, 0x1f258, 0x1f26e, 0x1f272, 0x1f274, 0x1f286, 0x1f28c, 0x1f298, 0x1f2b0, 0x1f2be, 0x1f2ce, 0x1f2dc, 0x1f2e2, 0x1f2e4, 0x1f2e8, 0x1f2f6, 0x1f30a, 0x1f312, 0x1f314, 0x1f322, 0x1f328, 0x1f342, 0x1f344, 0x1f348, 0x1f350, 0x1f35e, 0x1f366, 0x1f37a, 0x1f39a, 0x1f3ae, 0x1f3b2, 0x1f3b4, 0x1f416, 0x1f426, 0x1f42c, 0x1f43a, 0x1f446, 0x1f44c, 0x1f458, 0x1f46e, 0x1f472, 0x1f474, 0x1f486, 0x1f48c, 0x1f498, 0x1f4b0, 0x1f4be, 0x1f4ce, 0x1f4dc, 0x1f4e2, 0x1f4e4, 0x1f4e8, 0x1f4f6, 0x1f506, 0x1f50c, 0x1f518, 0x1f530, 0x1f53e, 0x1f560, 0x1f57c, 0x1f58e, 0x1f59c, 0x1f5b8, 0x1f5c2, 0x1f5c4, 0x1f5c8, 0x1f5d0, 0x1f5de, 0x1f5e6, 0x1f5ec, 0x1f5fa, 0x1f60a, 0x1f612, 0x1f614, 0x1f622, 0x1f624, 0x1f628, 0x1f636, 0x1f642, 0x1f644, 0x1f648, 0x1f650, 0x1f65e, 0x1f666, 0x1f67a, 0x1f682, 0x1f684, 0x1f688, 0x1f690, 0x1f69e, 0x1f6a0, 0x1f6bc, 0x1f6cc, 0x1f6f2, 0x1f6f4, 0x1f71a, 0x1f72e, 0x1f732, 0x1f734, 0x1f74e, 0x1f75c, 0x1f762, 0x1f764, 0x1f768, 0x1f776, 0x1f796, 0x1f7a6, 0x1f7ac, 0x1f7ba, 0x1f7d2, 0x1f7d4, 0x1f89a, 0x1f8ae, 0x1f8b2, 0x1f8b4, 0x1f8d6, 0x1f8ea, 0x1f91a, 0x1f92e, 0x1f932, 0x1f934, 0x1f94e, 0x1f95c, 0x1f962, 0x1f964, 0x1f968, 0x1f976, 0x1f996, 0x1f9a6, 0x1f9ac, 0x1f9ba, 0x1f9ca, 0x1f9d2, 0x1f9d4, 0x1fa1a, 0x1fa2e, 0x1fa32, 0x1fa34, 0x1fa4e, 0x1fa5c, 0x1fa62, 0x1fa64, 0x1fa68, 0x1fa76, 0x1fa8e, 0x1fa9c, 0x1fab8, 0x1fac2, 0x1fac4, 0x1fac8, 0x1fad0, 0x1fade, 0x1fae6, 0x1faec, 0x1fb16, 0x1fb26, 0x1fb2c, 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1fb92, 0x1fb94, 0x1fba2, 0x1fba4, 0x1fba8, 0x1fbb6, 0x1fbda]);
  73046. /**
  73047. * This table contains to codewords for all symbols.
  73048. */
  73049. PDF417Common.CODEWORD_TABLE = Int32Array.from([2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511, 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 809, 2483, 807, 2482, 806, 2480, 815, 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 2626, 2625, 2623, 2628, 1820, 2752, 2739, 2737, 2728, 2727, 2725, 2730, 2785, 2783, 2778, 2777, 2775, 2780, 787, 781, 747, 739, 736, 2413, 754, 752, 1719, 692, 689, 681, 2371, 678, 2369, 700, 697, 694, 703, 1688, 1686, 642, 638, 2343, 631, 2341, 627, 2338, 651, 646, 643, 2345, 654, 652, 1652, 1650, 1647, 1654, 601, 599, 2322, 596, 2321, 594, 2319, 2317, 611, 610, 608, 606, 2324, 603, 2323, 615, 614, 612, 1617, 1616, 1614, 1612, 616, 1619, 1618, 2575, 2538, 2536, 905, 901, 898, 909, 2509, 2507, 2504, 870, 867, 864, 860, 2512, 875, 872, 1781, 2490, 2489, 2487, 2485, 1748, 836, 834, 832, 830, 2494, 827, 2492, 843, 841, 839, 845, 1765, 1763, 2701, 2676, 2674, 2653, 2648, 2656, 2634, 2633, 2631, 2629, 1821, 2638, 2636, 2770, 2763, 2761, 2750, 2745, 2753, 2736, 2735, 2733, 2731, 1848, 2740, 2738, 2786, 2784, 591, 588, 576, 569, 566, 2296, 1590, 537, 534, 526, 2276, 522, 2274, 545, 542, 539, 548, 1572, 1570, 481, 2245, 466, 2242, 462, 2239, 492, 485, 482, 2249, 496, 494, 1534, 1531, 1528, 1538, 413, 2196, 406, 2191, 2188, 425, 419, 2202, 415, 2199, 432, 430, 427, 1472, 1467, 1464, 433, 1476, 1474, 368, 367, 2160, 365, 2159, 362, 2157, 2155, 2152, 378, 377, 375, 2166, 372, 2165, 369, 2162, 383, 381, 379, 2168, 1419, 1418, 1416, 1414, 385, 1411, 384, 1423, 1422, 1420, 1424, 2461, 802, 2441, 2439, 790, 786, 783, 794, 2409, 2406, 2403, 750, 742, 738, 2414, 756, 753, 1720, 2367, 2365, 2362, 2359, 1663, 693, 691, 684, 2373, 680, 2370, 702, 699, 696, 704, 1690, 1687, 2337, 2336, 2334, 2332, 1624, 2329, 1622, 640, 637, 2344, 634, 2342, 630, 2340, 650, 648, 645, 2346, 655, 653, 1653, 1651, 1649, 1655, 2612, 2597, 2595, 2571, 2568, 2565, 2576, 2534, 2529, 2526, 1787, 2540, 2537, 907, 904, 900, 910, 2503, 2502, 2500, 2498, 1768, 2495, 1767, 2510, 2508, 2506, 869, 866, 863, 2513, 876, 874, 1782, 2720, 2713, 2711, 2697, 2694, 2691, 2702, 2672, 2670, 2664, 1828, 2678, 2675, 2647, 2646, 2644, 2642, 1823, 2639, 1822, 2654, 2652, 2650, 2657, 2771, 1855, 2765, 2762, 1850, 1849, 2751, 2749, 2747, 2754, 353, 2148, 344, 342, 336, 2142, 332, 2140, 345, 1375, 1373, 306, 2130, 299, 2128, 295, 2125, 319, 314, 311, 2132, 1354, 1352, 1349, 1356, 262, 257, 2101, 253, 2096, 2093, 274, 273, 267, 2107, 263, 2104, 280, 278, 275, 1316, 1311, 1308, 1320, 1318, 2052, 202, 2050, 2044, 2040, 219, 2063, 212, 2060, 208, 2055, 224, 221, 2066, 1260, 1258, 1252, 231, 1248, 229, 1266, 1264, 1261, 1268, 155, 1998, 153, 1996, 1994, 1991, 1988, 165, 164, 2007, 162, 2006, 159, 2003, 2000, 172, 171, 169, 2012, 166, 2010, 1186, 1184, 1182, 1179, 175, 1176, 173, 1192, 1191, 1189, 1187, 176, 1194, 1193, 2313, 2307, 2305, 592, 589, 2294, 2292, 2289, 578, 572, 568, 2297, 580, 1591, 2272, 2267, 2264, 1547, 538, 536, 529, 2278, 525, 2275, 547, 544, 541, 1574, 1571, 2237, 2235, 2229, 1493, 2225, 1489, 478, 2247, 470, 2244, 465, 2241, 493, 488, 484, 2250, 498, 495, 1536, 1533, 1530, 1539, 2187, 2186, 2184, 2182, 1432, 2179, 1430, 2176, 1427, 414, 412, 2197, 409, 2195, 405, 2193, 2190, 426, 424, 421, 2203, 418, 2201, 431, 429, 1473, 1471, 1469, 1466, 434, 1477, 1475, 2478, 2472, 2470, 2459, 2457, 2454, 2462, 803, 2437, 2432, 2429, 1726, 2443, 2440, 792, 789, 785, 2401, 2399, 2393, 1702, 2389, 1699, 2411, 2408, 2405, 745, 741, 2415, 758, 755, 1721, 2358, 2357, 2355, 2353, 1661, 2350, 1660, 2347, 1657, 2368, 2366, 2364, 2361, 1666, 690, 687, 2374, 683, 2372, 701, 698, 705, 1691, 1689, 2619, 2617, 2610, 2608, 2605, 2613, 2593, 2588, 2585, 1803, 2599, 2596, 2563, 2561, 2555, 1797, 2551, 1795, 2573, 2570, 2567, 2577, 2525, 2524, 2522, 2520, 1786, 2517, 1785, 2514, 1783, 2535, 2533, 2531, 2528, 1788, 2541, 2539, 906, 903, 911, 2721, 1844, 2715, 2712, 1838, 1836, 2699, 2696, 2693, 2703, 1827, 1826, 1824, 2673, 2671, 2669, 2666, 1829, 2679, 2677, 1858, 1857, 2772, 1854, 1853, 1851, 1856, 2766, 2764, 143, 1987, 139, 1986, 135, 133, 131, 1984, 128, 1983, 125, 1981, 138, 137, 136, 1985, 1133, 1132, 1130, 112, 110, 1974, 107, 1973, 104, 1971, 1969, 122, 121, 119, 117, 1977, 114, 1976, 124, 1115, 1114, 1112, 1110, 1117, 1116, 84, 83, 1953, 81, 1952, 78, 1950, 1948, 1945, 94, 93, 91, 1959, 88, 1958, 85, 1955, 99, 97, 95, 1961, 1086, 1085, 1083, 1081, 1078, 100, 1090, 1089, 1087, 1091, 49, 47, 1917, 44, 1915, 1913, 1910, 1907, 59, 1926, 56, 1925, 53, 1922, 1919, 66, 64, 1931, 61, 1929, 1042, 1040, 1038, 71, 1035, 70, 1032, 68, 1048, 1047, 1045, 1043, 1050, 1049, 12, 10, 1869, 1867, 1864, 1861, 21, 1880, 19, 1877, 1874, 1871, 28, 1888, 25, 1886, 22, 1883, 982, 980, 977, 974, 32, 30, 991, 989, 987, 984, 34, 995, 994, 992, 2151, 2150, 2147, 2146, 2144, 356, 355, 354, 2149, 2139, 2138, 2136, 2134, 1359, 343, 341, 338, 2143, 335, 2141, 348, 347, 346, 1376, 1374, 2124, 2123, 2121, 2119, 1326, 2116, 1324, 310, 308, 305, 2131, 302, 2129, 298, 2127, 320, 318, 316, 313, 2133, 322, 321, 1355, 1353, 1351, 1357, 2092, 2091, 2089, 2087, 1276, 2084, 1274, 2081, 1271, 259, 2102, 256, 2100, 252, 2098, 2095, 272, 269, 2108, 266, 2106, 281, 279, 277, 1317, 1315, 1313, 1310, 282, 1321, 1319, 2039, 2037, 2035, 2032, 1203, 2029, 1200, 1197, 207, 2053, 205, 2051, 201, 2049, 2046, 2043, 220, 218, 2064, 215, 2062, 211, 2059, 228, 226, 223, 2069, 1259, 1257, 1254, 232, 1251, 230, 1267, 1265, 1263, 2316, 2315, 2312, 2311, 2309, 2314, 2304, 2303, 2301, 2299, 1593, 2308, 2306, 590, 2288, 2287, 2285, 2283, 1578, 2280, 1577, 2295, 2293, 2291, 579, 577, 574, 571, 2298, 582, 581, 1592, 2263, 2262, 2260, 2258, 1545, 2255, 1544, 2252, 1541, 2273, 2271, 2269, 2266, 1550, 535, 532, 2279, 528, 2277, 546, 543, 549, 1575, 1573, 2224, 2222, 2220, 1486, 2217, 1485, 2214, 1482, 1479, 2238, 2236, 2234, 2231, 1496, 2228, 1492, 480, 477, 2248, 473, 2246, 469, 2243, 490, 487, 2251, 497, 1537, 1535, 1532, 2477, 2476, 2474, 2479, 2469, 2468, 2466, 2464, 1730, 2473, 2471, 2453, 2452, 2450, 2448, 1729, 2445, 1728, 2460, 2458, 2456, 2463, 805, 804, 2428, 2427, 2425, 2423, 1725, 2420, 1724, 2417, 1722, 2438, 2436, 2434, 2431, 1727, 2444, 2442, 793, 791, 788, 795, 2388, 2386, 2384, 1697, 2381, 1696, 2378, 1694, 1692, 2402, 2400, 2398, 2395, 1703, 2392, 1701, 2412, 2410, 2407, 751, 748, 744, 2416, 759, 757, 1807, 2620, 2618, 1806, 1805, 2611, 2609, 2607, 2614, 1802, 1801, 1799, 2594, 2592, 2590, 2587, 1804, 2600, 2598, 1794, 1793, 1791, 1789, 2564, 2562, 2560, 2557, 1798, 2554, 1796, 2574, 2572, 2569, 2578, 1847, 1846, 2722, 1843, 1842, 1840, 1845, 2716, 2714, 1835, 1834, 1832, 1830, 1839, 1837, 2700, 2698, 2695, 2704, 1817, 1811, 1810, 897, 862, 1777, 829, 826, 838, 1760, 1758, 808, 2481, 1741, 1740, 1738, 1743, 2624, 1818, 2726, 2776, 782, 740, 737, 1715, 686, 679, 695, 1682, 1680, 639, 628, 2339, 647, 644, 1645, 1643, 1640, 1648, 602, 600, 597, 595, 2320, 593, 2318, 609, 607, 604, 1611, 1610, 1608, 1606, 613, 1615, 1613, 2328, 926, 924, 892, 886, 899, 857, 850, 2505, 1778, 824, 823, 821, 819, 2488, 818, 2486, 833, 831, 828, 840, 1761, 1759, 2649, 2632, 2630, 2746, 2734, 2732, 2782, 2781, 570, 567, 1587, 531, 527, 523, 540, 1566, 1564, 476, 467, 463, 2240, 486, 483, 1524, 1521, 1518, 1529, 411, 403, 2192, 399, 2189, 423, 416, 1462, 1457, 1454, 428, 1468, 1465, 2210, 366, 363, 2158, 360, 2156, 357, 2153, 376, 373, 370, 2163, 1410, 1409, 1407, 1405, 382, 1402, 380, 1417, 1415, 1412, 1421, 2175, 2174, 777, 774, 771, 784, 732, 725, 722, 2404, 743, 1716, 676, 674, 668, 2363, 665, 2360, 685, 1684, 1681, 626, 624, 622, 2335, 620, 2333, 617, 2330, 641, 635, 649, 1646, 1644, 1642, 2566, 928, 925, 2530, 2527, 894, 891, 888, 2501, 2499, 2496, 858, 856, 854, 851, 1779, 2692, 2668, 2665, 2645, 2643, 2640, 2651, 2768, 2759, 2757, 2744, 2743, 2741, 2748, 352, 1382, 340, 337, 333, 1371, 1369, 307, 300, 296, 2126, 315, 312, 1347, 1342, 1350, 261, 258, 250, 2097, 246, 2094, 271, 268, 264, 1306, 1301, 1298, 276, 1312, 1309, 2115, 203, 2048, 195, 2045, 191, 2041, 213, 209, 2056, 1246, 1244, 1238, 225, 1234, 222, 1256, 1253, 1249, 1262, 2080, 2079, 154, 1997, 150, 1995, 147, 1992, 1989, 163, 160, 2004, 156, 2001, 1175, 1174, 1172, 1170, 1167, 170, 1164, 167, 1185, 1183, 1180, 1177, 174, 1190, 1188, 2025, 2024, 2022, 587, 586, 564, 559, 556, 2290, 573, 1588, 520, 518, 512, 2268, 508, 2265, 530, 1568, 1565, 461, 457, 2233, 450, 2230, 446, 2226, 479, 471, 489, 1526, 1523, 1520, 397, 395, 2185, 392, 2183, 389, 2180, 2177, 410, 2194, 402, 422, 1463, 1461, 1459, 1456, 1470, 2455, 799, 2433, 2430, 779, 776, 773, 2397, 2394, 2390, 734, 728, 724, 746, 1717, 2356, 2354, 2351, 2348, 1658, 677, 675, 673, 670, 667, 688, 1685, 1683, 2606, 2589, 2586, 2559, 2556, 2552, 927, 2523, 2521, 2518, 2515, 1784, 2532, 895, 893, 890, 2718, 2709, 2707, 2689, 2687, 2684, 2663, 2662, 2660, 2658, 1825, 2667, 2769, 1852, 2760, 2758, 142, 141, 1139, 1138, 134, 132, 129, 126, 1982, 1129, 1128, 1126, 1131, 113, 111, 108, 105, 1972, 101, 1970, 120, 118, 115, 1109, 1108, 1106, 1104, 123, 1113, 1111, 82, 79, 1951, 75, 1949, 72, 1946, 92, 89, 86, 1956, 1077, 1076, 1074, 1072, 98, 1069, 96, 1084, 1082, 1079, 1088, 1968, 1967, 48, 45, 1916, 42, 1914, 39, 1911, 1908, 60, 57, 54, 1923, 50, 1920, 1031, 1030, 1028, 1026, 67, 1023, 65, 1020, 62, 1041, 1039, 1036, 1033, 69, 1046, 1044, 1944, 1943, 1941, 11, 9, 1868, 7, 1865, 1862, 1859, 20, 1878, 16, 1875, 13, 1872, 970, 968, 966, 963, 29, 960, 26, 23, 983, 981, 978, 975, 33, 971, 31, 990, 988, 985, 1906, 1904, 1902, 993, 351, 2145, 1383, 331, 330, 328, 326, 2137, 323, 2135, 339, 1372, 1370, 294, 293, 291, 289, 2122, 286, 2120, 283, 2117, 309, 303, 317, 1348, 1346, 1344, 245, 244, 242, 2090, 239, 2088, 236, 2085, 2082, 260, 2099, 249, 270, 1307, 1305, 1303, 1300, 1314, 189, 2038, 186, 2036, 183, 2033, 2030, 2026, 206, 198, 2047, 194, 216, 1247, 1245, 1243, 1240, 227, 1237, 1255, 2310, 2302, 2300, 2286, 2284, 2281, 565, 563, 561, 558, 575, 1589, 2261, 2259, 2256, 2253, 1542, 521, 519, 517, 514, 2270, 511, 533, 1569, 1567, 2223, 2221, 2218, 2215, 1483, 2211, 1480, 459, 456, 453, 2232, 449, 474, 491, 1527, 1525, 1522, 2475, 2467, 2465, 2451, 2449, 2446, 801, 800, 2426, 2424, 2421, 2418, 1723, 2435, 780, 778, 775, 2387, 2385, 2382, 2379, 1695, 2375, 1693, 2396, 735, 733, 730, 727, 749, 1718, 2616, 2615, 2604, 2603, 2601, 2584, 2583, 2581, 2579, 1800, 2591, 2550, 2549, 2547, 2545, 1792, 2542, 1790, 2558, 929, 2719, 1841, 2710, 2708, 1833, 1831, 2690, 2688, 2686, 1815, 1809, 1808, 1774, 1756, 1754, 1737, 1736, 1734, 1739, 1816, 1711, 1676, 1674, 633, 629, 1638, 1636, 1633, 1641, 598, 1605, 1604, 1602, 1600, 605, 1609, 1607, 2327, 887, 853, 1775, 822, 820, 1757, 1755, 1584, 524, 1560, 1558, 468, 464, 1514, 1511, 1508, 1519, 408, 404, 400, 1452, 1447, 1444, 417, 1458, 1455, 2208, 364, 361, 358, 2154, 1401, 1400, 1398, 1396, 374, 1393, 371, 1408, 1406, 1403, 1413, 2173, 2172, 772, 726, 723, 1712, 672, 669, 666, 682, 1678, 1675, 625, 623, 621, 618, 2331, 636, 632, 1639, 1637, 1635, 920, 918, 884, 880, 889, 849, 848, 847, 846, 2497, 855, 852, 1776, 2641, 2742, 2787, 1380, 334, 1367, 1365, 301, 297, 1340, 1338, 1335, 1343, 255, 251, 247, 1296, 1291, 1288, 265, 1302, 1299, 2113, 204, 196, 192, 2042, 1232, 1230, 1224, 214, 1220, 210, 1242, 1239, 1235, 1250, 2077, 2075, 151, 148, 1993, 144, 1990, 1163, 1162, 1160, 1158, 1155, 161, 1152, 157, 1173, 1171, 1168, 1165, 168, 1181, 1178, 2021, 2020, 2018, 2023, 585, 560, 557, 1585, 516, 509, 1562, 1559, 458, 447, 2227, 472, 1516, 1513, 1510, 398, 396, 393, 390, 2181, 386, 2178, 407, 1453, 1451, 1449, 1446, 420, 1460, 2209, 769, 764, 720, 712, 2391, 729, 1713, 664, 663, 661, 659, 2352, 656, 2349, 671, 1679, 1677, 2553, 922, 919, 2519, 2516, 885, 883, 881, 2685, 2661, 2659, 2767, 2756, 2755, 140, 1137, 1136, 130, 127, 1125, 1124, 1122, 1127, 109, 106, 102, 1103, 1102, 1100, 1098, 116, 1107, 1105, 1980, 80, 76, 73, 1947, 1068, 1067, 1065, 1063, 90, 1060, 87, 1075, 1073, 1070, 1080, 1966, 1965, 46, 43, 40, 1912, 36, 1909, 1019, 1018, 1016, 1014, 58, 1011, 55, 1008, 51, 1029, 1027, 1024, 1021, 63, 1037, 1034, 1940, 1939, 1937, 1942, 8, 1866, 4, 1863, 1, 1860, 956, 954, 952, 949, 946, 17, 14, 969, 967, 964, 961, 27, 957, 24, 979, 976, 972, 1901, 1900, 1898, 1896, 986, 1905, 1903, 350, 349, 1381, 329, 327, 324, 1368, 1366, 292, 290, 287, 284, 2118, 304, 1341, 1339, 1337, 1345, 243, 240, 237, 2086, 233, 2083, 254, 1297, 1295, 1293, 1290, 1304, 2114, 190, 187, 184, 2034, 180, 2031, 177, 2027, 199, 1233, 1231, 1229, 1226, 217, 1223, 1241, 2078, 2076, 584, 555, 554, 552, 550, 2282, 562, 1586, 507, 506, 504, 502, 2257, 499, 2254, 515, 1563, 1561, 445, 443, 441, 2219, 438, 2216, 435, 2212, 460, 454, 475, 1517, 1515, 1512, 2447, 798, 797, 2422, 2419, 770, 768, 766, 2383, 2380, 2376, 721, 719, 717, 714, 731, 1714, 2602, 2582, 2580, 2548, 2546, 2543, 923, 921, 2717, 2706, 2705, 2683, 2682, 2680, 1771, 1752, 1750, 1733, 1732, 1731, 1735, 1814, 1707, 1670, 1668, 1631, 1629, 1626, 1634, 1599, 1598, 1596, 1594, 1603, 1601, 2326, 1772, 1753, 1751, 1581, 1554, 1552, 1504, 1501, 1498, 1509, 1442, 1437, 1434, 401, 1448, 1445, 2206, 1392, 1391, 1389, 1387, 1384, 359, 1399, 1397, 1394, 1404, 2171, 2170, 1708, 1672, 1669, 619, 1632, 1630, 1628, 1773, 1378, 1363, 1361, 1333, 1328, 1336, 1286, 1281, 1278, 248, 1292, 1289, 2111, 1218, 1216, 1210, 197, 1206, 193, 1228, 1225, 1221, 1236, 2073, 2071, 1151, 1150, 1148, 1146, 152, 1143, 149, 1140, 145, 1161, 1159, 1156, 1153, 158, 1169, 1166, 2017, 2016, 2014, 2019, 1582, 510, 1556, 1553, 452, 448, 1506, 1500, 394, 391, 387, 1443, 1441, 1439, 1436, 1450, 2207, 765, 716, 713, 1709, 662, 660, 657, 1673, 1671, 916, 914, 879, 878, 877, 882, 1135, 1134, 1121, 1120, 1118, 1123, 1097, 1096, 1094, 1092, 103, 1101, 1099, 1979, 1059, 1058, 1056, 1054, 77, 1051, 74, 1066, 1064, 1061, 1071, 1964, 1963, 1007, 1006, 1004, 1002, 999, 41, 996, 37, 1017, 1015, 1012, 1009, 52, 1025, 1022, 1936, 1935, 1933, 1938, 942, 940, 938, 935, 932, 5, 2, 955, 953, 950, 947, 18, 943, 15, 965, 962, 958, 1895, 1894, 1892, 1890, 973, 1899, 1897, 1379, 325, 1364, 1362, 288, 285, 1334, 1332, 1330, 241, 238, 234, 1287, 1285, 1283, 1280, 1294, 2112, 188, 185, 181, 178, 2028, 1219, 1217, 1215, 1212, 200, 1209, 1227, 2074, 2072, 583, 553, 551, 1583, 505, 503, 500, 513, 1557, 1555, 444, 442, 439, 436, 2213, 455, 451, 1507, 1505, 1502, 796, 763, 762, 760, 767, 711, 710, 708, 706, 2377, 718, 715, 1710, 2544, 917, 915, 2681, 1627, 1597, 1595, 2325, 1769, 1749, 1747, 1499, 1438, 1435, 2204, 1390, 1388, 1385, 1395, 2169, 2167, 1704, 1665, 1662, 1625, 1623, 1620, 1770, 1329, 1282, 1279, 2109, 1214, 1207, 1222, 2068, 2065, 1149, 1147, 1144, 1141, 146, 1157, 1154, 2013, 2011, 2008, 2015, 1579, 1549, 1546, 1495, 1487, 1433, 1431, 1428, 1425, 388, 1440, 2205, 1705, 658, 1667, 1664, 1119, 1095, 1093, 1978, 1057, 1055, 1052, 1062, 1962, 1960, 1005, 1003, 1000, 997, 38, 1013, 1010, 1932, 1930, 1927, 1934, 941, 939, 936, 933, 6, 930, 3, 951, 948, 944, 1889, 1887, 1884, 1881, 959, 1893, 1891, 35, 1377, 1360, 1358, 1327, 1325, 1322, 1331, 1277, 1275, 1272, 1269, 235, 1284, 2110, 1205, 1204, 1201, 1198, 182, 1195, 179, 1213, 2070, 2067, 1580, 501, 1551, 1548, 440, 437, 1497, 1494, 1490, 1503, 761, 709, 707, 1706, 913, 912, 2198, 1386, 2164, 2161, 1621, 1766, 2103, 1208, 2058, 2054, 1145, 1142, 2005, 2002, 1999, 2009, 1488, 1429, 1426, 2200, 1698, 1659, 1656, 1975, 1053, 1957, 1954, 1001, 998, 1924, 1921, 1918, 1928, 937, 934, 931, 1879, 1876, 1873, 1870, 945, 1885, 1882, 1323, 1273, 1270, 2105, 1202, 1199, 1196, 1211, 2061, 2057, 1576, 1543, 1540, 1484, 1481, 1478, 1491, 1700]);
  73050. return PDF417Common;
  73051. }();
  73052. var _default = PDF417Common;
  73053. exports.default = _default;
  73054. /***/ }),
  73055. /* 435 */
  73056. /*!********************************************************************************************!*\
  73057. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/detector/Detector.js ***!
  73058. \********************************************************************************************/
  73059. /*! no static exports found */
  73060. /***/ (function(module, exports, __webpack_require__) {
  73061. "use strict";
  73062. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  73063. Object.defineProperty(exports, "__esModule", {
  73064. value: true
  73065. });
  73066. exports.default = void 0;
  73067. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  73068. var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
  73069. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  73070. var _PDF417DetectorResult = _interopRequireDefault(__webpack_require__(/*! ./PDF417DetectorResult */ 436));
  73071. /*
  73072. * Copyright 2009 ZXing authors
  73073. *
  73074. * Licensed under the Apache License, Version 2.0 (the "License");
  73075. * you may not use this file except in compliance with the License.
  73076. * You may obtain a copy of the License at
  73077. *
  73078. * http://www.apache.org/licenses/LICENSE-2.0
  73079. *
  73080. * Unless required by applicable law or agreed to in writing, software
  73081. * distributed under the License is distributed on an "AS IS" BASIS,
  73082. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  73083. * See the License for the specific language governing permissions and
  73084. * limitations under the License.
  73085. */
  73086. var __values = void 0 && (void 0).__values || function (o) {
  73087. var s = typeof Symbol === "function" && Symbol.iterator,
  73088. m = s && o[s],
  73089. i = 0;
  73090. if (m) return m.call(o);
  73091. if (o && typeof o.length === "number") return {
  73092. next: function next() {
  73093. if (o && i >= o.length) o = void 0;
  73094. return {
  73095. value: o && o[i++],
  73096. done: !o
  73097. };
  73098. }
  73099. };
  73100. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  73101. };
  73102. // import com.google.zxing.NotFoundException;
  73103. // import com.google.zxing.ResultPoint;
  73104. // import java.util.ArrayList;
  73105. // import java.util.Arrays;
  73106. // import java.util.List;
  73107. // import java.util.Map;
  73108. /**
  73109. * <p>Encapsulates logic that can detect a PDF417 Code in an image, even if the
  73110. * PDF417 Code is rotated or skewed, or partially obscured.</p>
  73111. *
  73112. * @author SITA Lab (kevin.osullivan@sita.aero)
  73113. * @author dswitkin@google.com (Daniel Switkin)
  73114. * @author Guenther Grau
  73115. */
  73116. var Detector = /** @class */function () {
  73117. function Detector() {}
  73118. /**
  73119. * <p>Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.</p>
  73120. *
  73121. * @param image barcode image to decode
  73122. * @param hints optional hints to detector
  73123. * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
  73124. * be found and returned
  73125. * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
  73126. * @throws NotFoundException if no PDF417 Code can be found
  73127. */
  73128. Detector.detectMultiple = function (image, hints, multiple) {
  73129. // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even
  73130. // different binarizers
  73131. // boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
  73132. var bitMatrix = image.getBlackMatrix();
  73133. var barcodeCoordinates = Detector.detect(multiple, bitMatrix);
  73134. if (!barcodeCoordinates.length) {
  73135. bitMatrix = bitMatrix.clone();
  73136. bitMatrix.rotate180();
  73137. barcodeCoordinates = Detector.detect(multiple, bitMatrix);
  73138. }
  73139. return new _PDF417DetectorResult.default(bitMatrix, barcodeCoordinates);
  73140. };
  73141. /**
  73142. * Detects PDF417 codes in an image. Only checks 0 degree rotation
  73143. * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
  73144. * be found and returned
  73145. * @param bitMatrix bit matrix to detect barcodes in
  73146. * @return List of ResultPoint arrays containing the coordinates of found barcodes
  73147. */
  73148. Detector.detect = function (multiple, bitMatrix) {
  73149. var e_1, _a;
  73150. var barcodeCoordinates = new Array();
  73151. var row = 0;
  73152. var column = 0;
  73153. var foundBarcodeInRow = false;
  73154. while (row < bitMatrix.getHeight()) {
  73155. var vertices = Detector.findVertices(bitMatrix, row, column);
  73156. if (vertices[0] == null && vertices[3] == null) {
  73157. if (!foundBarcodeInRow) {
  73158. // we didn't find any barcode so that's the end of searching
  73159. break;
  73160. }
  73161. // we didn't find a barcode starting at the given column and row. Try again from the first column and slightly
  73162. // below the lowest barcode we found so far.
  73163. foundBarcodeInRow = false;
  73164. column = 0;
  73165. try {
  73166. for (var barcodeCoordinates_1 = (e_1 = void 0, __values(barcodeCoordinates)), barcodeCoordinates_1_1 = barcodeCoordinates_1.next(); !barcodeCoordinates_1_1.done; barcodeCoordinates_1_1 = barcodeCoordinates_1.next()) {
  73167. var barcodeCoordinate = barcodeCoordinates_1_1.value;
  73168. if (barcodeCoordinate[1] != null) {
  73169. row = Math.trunc(Math.max(row, barcodeCoordinate[1].getY()));
  73170. }
  73171. if (barcodeCoordinate[3] != null) {
  73172. row = Math.max(row, Math.trunc(barcodeCoordinate[3].getY()));
  73173. }
  73174. }
  73175. } catch (e_1_1) {
  73176. e_1 = {
  73177. error: e_1_1
  73178. };
  73179. } finally {
  73180. try {
  73181. if (barcodeCoordinates_1_1 && !barcodeCoordinates_1_1.done && (_a = barcodeCoordinates_1.return)) _a.call(barcodeCoordinates_1);
  73182. } finally {
  73183. if (e_1) throw e_1.error;
  73184. }
  73185. }
  73186. row += Detector.ROW_STEP;
  73187. continue;
  73188. }
  73189. foundBarcodeInRow = true;
  73190. barcodeCoordinates.push(vertices);
  73191. if (!multiple) {
  73192. break;
  73193. }
  73194. // if we didn't find a right row indicator column, then continue the search for the next barcode after the
  73195. // start pattern of the barcode just found.
  73196. if (vertices[2] != null) {
  73197. column = Math.trunc(vertices[2].getX());
  73198. row = Math.trunc(vertices[2].getY());
  73199. } else {
  73200. column = Math.trunc(vertices[4].getX());
  73201. row = Math.trunc(vertices[4].getY());
  73202. }
  73203. }
  73204. return barcodeCoordinates;
  73205. };
  73206. /**
  73207. * Locate the vertices and the codewords area of a black blob using the Start
  73208. * and Stop patterns as locators.
  73209. *
  73210. * @param matrix the scanned barcode image.
  73211. * @return an array containing the vertices:
  73212. * vertices[0] x, y top left barcode
  73213. * vertices[1] x, y bottom left barcode
  73214. * vertices[2] x, y top right barcode
  73215. * vertices[3] x, y bottom right barcode
  73216. * vertices[4] x, y top left codeword area
  73217. * vertices[5] x, y bottom left codeword area
  73218. * vertices[6] x, y top right codeword area
  73219. * vertices[7] x, y bottom right codeword area
  73220. */
  73221. Detector.findVertices = function (matrix, startRow, startColumn) {
  73222. var height = matrix.getHeight();
  73223. var width = matrix.getWidth();
  73224. // const result = new ResultPoint[8];
  73225. var result = new Array(8);
  73226. Detector.copyToResult(result, Detector.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector.START_PATTERN), Detector.INDEXES_START_PATTERN);
  73227. if (result[4] != null) {
  73228. startColumn = Math.trunc(result[4].getX());
  73229. startRow = Math.trunc(result[4].getY());
  73230. }
  73231. Detector.copyToResult(result, Detector.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector.STOP_PATTERN), Detector.INDEXES_STOP_PATTERN);
  73232. return result;
  73233. };
  73234. Detector.copyToResult = function (result, tmpResult, destinationIndexes) {
  73235. for (var i = 0; i < destinationIndexes.length; i++) {
  73236. result[destinationIndexes[i]] = tmpResult[i];
  73237. }
  73238. };
  73239. Detector.findRowsWithPattern = function (matrix, height, width, startRow, startColumn, pattern) {
  73240. // const result = new ResultPoint[4];
  73241. var result = new Array(4);
  73242. var found = false;
  73243. var counters = new Int32Array(pattern.length);
  73244. for (; startRow < height; startRow += Detector.ROW_STEP) {
  73245. var loc = Detector.findGuardPattern(matrix, startColumn, startRow, width, false, pattern, counters);
  73246. if (loc != null) {
  73247. while (startRow > 0) {
  73248. var previousRowLoc = Detector.findGuardPattern(matrix, startColumn, --startRow, width, false, pattern, counters);
  73249. if (previousRowLoc != null) {
  73250. loc = previousRowLoc;
  73251. } else {
  73252. startRow++;
  73253. break;
  73254. }
  73255. }
  73256. result[0] = new _ResultPoint.default(loc[0], startRow);
  73257. result[1] = new _ResultPoint.default(loc[1], startRow);
  73258. found = true;
  73259. break;
  73260. }
  73261. }
  73262. var stopRow = startRow + 1;
  73263. // Last row of the current symbol that contains pattern
  73264. if (found) {
  73265. var skippedRowCount = 0;
  73266. var previousRowLoc = Int32Array.from([Math.trunc(result[0].getX()), Math.trunc(result[1].getX())]);
  73267. for (; stopRow < height; stopRow++) {
  73268. var loc = Detector.findGuardPattern(matrix, previousRowLoc[0], stopRow, width, false, pattern, counters);
  73269. // a found pattern is only considered to belong to the same barcode if the start and end positions
  73270. // don't differ too much. Pattern drift should be not bigger than two for consecutive rows. With
  73271. // a higher number of skipped rows drift could be larger. To keep it simple for now, we allow a slightly
  73272. // larger drift and don't check for skipped rows.
  73273. if (loc != null && Math.abs(previousRowLoc[0] - loc[0]) < Detector.MAX_PATTERN_DRIFT && Math.abs(previousRowLoc[1] - loc[1]) < Detector.MAX_PATTERN_DRIFT) {
  73274. previousRowLoc = loc;
  73275. skippedRowCount = 0;
  73276. } else {
  73277. if (skippedRowCount > Detector.SKIPPED_ROW_COUNT_MAX) {
  73278. break;
  73279. } else {
  73280. skippedRowCount++;
  73281. }
  73282. }
  73283. }
  73284. stopRow -= skippedRowCount + 1;
  73285. result[2] = new _ResultPoint.default(previousRowLoc[0], stopRow);
  73286. result[3] = new _ResultPoint.default(previousRowLoc[1], stopRow);
  73287. }
  73288. if (stopRow - startRow < Detector.BARCODE_MIN_HEIGHT) {
  73289. _Arrays.default.fill(result, null);
  73290. }
  73291. return result;
  73292. };
  73293. /**
  73294. * @param matrix row of black/white values to search
  73295. * @param column x position to start search
  73296. * @param row y position to start search
  73297. * @param width the number of pixels to search on this row
  73298. * @param pattern pattern of counts of number of black and white pixels that are
  73299. * being searched for as a pattern
  73300. * @param counters array of counters, as long as pattern, to re-use
  73301. * @return start/end horizontal offset of guard pattern, as an array of two ints.
  73302. */
  73303. Detector.findGuardPattern = function (matrix, column, row, width, whiteFirst, pattern, counters) {
  73304. _Arrays.default.fillWithin(counters, 0, counters.length, 0);
  73305. var patternStart = column;
  73306. var pixelDrift = 0;
  73307. // if there are black pixels left of the current pixel shift to the left, but only for MAX_PIXEL_DRIFT pixels
  73308. while (matrix.get(patternStart, row) && patternStart > 0 && pixelDrift++ < Detector.MAX_PIXEL_DRIFT) {
  73309. patternStart--;
  73310. }
  73311. var x = patternStart;
  73312. var counterPosition = 0;
  73313. var patternLength = pattern.length;
  73314. for (var isWhite = whiteFirst; x < width; x++) {
  73315. var pixel = matrix.get(x, row);
  73316. if (pixel !== isWhite) {
  73317. counters[counterPosition]++;
  73318. } else {
  73319. if (counterPosition === patternLength - 1) {
  73320. if (Detector.patternMatchVariance(counters, pattern, Detector.MAX_INDIVIDUAL_VARIANCE) < Detector.MAX_AVG_VARIANCE) {
  73321. return new Int32Array([patternStart, x]);
  73322. }
  73323. patternStart += counters[0] + counters[1];
  73324. _System.default.arraycopy(counters, 2, counters, 0, counterPosition - 1);
  73325. counters[counterPosition - 1] = 0;
  73326. counters[counterPosition] = 0;
  73327. counterPosition--;
  73328. } else {
  73329. counterPosition++;
  73330. }
  73331. counters[counterPosition] = 1;
  73332. isWhite = !isWhite;
  73333. }
  73334. }
  73335. if (counterPosition === patternLength - 1 && Detector.patternMatchVariance(counters, pattern, Detector.MAX_INDIVIDUAL_VARIANCE) < Detector.MAX_AVG_VARIANCE) {
  73336. return new Int32Array([patternStart, x - 1]);
  73337. }
  73338. return null;
  73339. };
  73340. /**
  73341. * Determines how closely a set of observed counts of runs of black/white
  73342. * values matches a given target pattern. This is reported as the ratio of
  73343. * the total variance from the expected pattern proportions across all
  73344. * pattern elements, to the length of the pattern.
  73345. *
  73346. * @param counters observed counters
  73347. * @param pattern expected pattern
  73348. * @param maxIndividualVariance The most any counter can differ before we give up
  73349. * @return ratio of total variance between counters and pattern compared to total pattern size
  73350. */
  73351. Detector.patternMatchVariance = function (counters, pattern, maxIndividualVariance) {
  73352. var numCounters = counters.length;
  73353. var total = 0;
  73354. var patternLength = 0;
  73355. for (var i = 0; i < numCounters; i++) {
  73356. total += counters[i];
  73357. patternLength += pattern[i];
  73358. }
  73359. if (total < patternLength) {
  73360. // If we don't even have one pixel per unit of bar width, assume this
  73361. // is too small to reliably match, so fail:
  73362. return (/*Float.POSITIVE_INFINITY*/Infinity
  73363. );
  73364. }
  73365. // We're going to fake floating-point math in integers. We just need to use more bits.
  73366. // Scale up patternLength so that intermediate values below like scaledCounter will have
  73367. // more "significant digits".
  73368. var unitBarWidth = total / patternLength;
  73369. maxIndividualVariance *= unitBarWidth;
  73370. var totalVariance = 0.0;
  73371. for (var x = 0; x < numCounters; x++) {
  73372. var counter = counters[x];
  73373. var scaledPattern = pattern[x] * unitBarWidth;
  73374. var variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
  73375. if (variance > maxIndividualVariance) {
  73376. return (/*Float.POSITIVE_INFINITY*/Infinity
  73377. );
  73378. }
  73379. totalVariance += variance;
  73380. }
  73381. return totalVariance / total;
  73382. };
  73383. Detector.INDEXES_START_PATTERN = Int32Array.from([0, 4, 1, 5]);
  73384. Detector.INDEXES_STOP_PATTERN = Int32Array.from([6, 2, 7, 3]);
  73385. Detector.MAX_AVG_VARIANCE = 0.42;
  73386. Detector.MAX_INDIVIDUAL_VARIANCE = 0.8;
  73387. // B S B S B S B S Bar/Space pattern
  73388. // 11111111 0 1 0 1 0 1 000
  73389. Detector.START_PATTERN = Int32Array.from([8, 1, 1, 1, 1, 1, 1, 3]);
  73390. // 1111111 0 1 000 1 0 1 00 1
  73391. Detector.STOP_PATTERN = Int32Array.from([7, 1, 1, 3, 1, 1, 1, 2, 1]);
  73392. Detector.MAX_PIXEL_DRIFT = 3;
  73393. Detector.MAX_PATTERN_DRIFT = 5;
  73394. // if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged.
  73395. // if we set the value too high, then we might detect the start pattern from a neighbor barcode.
  73396. Detector.SKIPPED_ROW_COUNT_MAX = 25;
  73397. // A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width. Therefore it should be at least
  73398. // 9 pixels tall. To be conservative, we use about half the size to ensure we don't miss it.
  73399. Detector.ROW_STEP = 5;
  73400. Detector.BARCODE_MIN_HEIGHT = 10;
  73401. return Detector;
  73402. }();
  73403. var _default = Detector;
  73404. exports.default = _default;
  73405. /***/ }),
  73406. /* 436 */
  73407. /*!********************************************************************************************************!*\
  73408. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/detector/PDF417DetectorResult.js ***!
  73409. \********************************************************************************************************/
  73410. /*! no static exports found */
  73411. /***/ (function(module, exports, __webpack_require__) {
  73412. "use strict";
  73413. Object.defineProperty(exports, "__esModule", {
  73414. value: true
  73415. });
  73416. exports.default = void 0;
  73417. /*
  73418. * Copyright 2007 ZXing authors
  73419. *
  73420. * Licensed under the Apache License, Version 2.0 (the "License");
  73421. * you may not use this file except in compliance with the License.
  73422. * You may obtain a copy of the License at
  73423. *
  73424. * http://www.apache.org/licenses/LICENSE-2.0
  73425. *
  73426. * Unless required by applicable law or agreed to in writing, software
  73427. * distributed under the License is distributed on an "AS IS" BASIS,
  73428. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  73429. * See the License for the specific language governing permissions and
  73430. * limitations under the License.
  73431. */
  73432. // import java.util.List;
  73433. /**
  73434. * @author Guenther Grau
  73435. */
  73436. var PDF417DetectorResult = /** @class */function () {
  73437. function PDF417DetectorResult(bits, points) {
  73438. this.bits = bits;
  73439. this.points = points;
  73440. }
  73441. PDF417DetectorResult.prototype.getBits = function () {
  73442. return this.bits;
  73443. };
  73444. PDF417DetectorResult.prototype.getPoints = function () {
  73445. return this.points;
  73446. };
  73447. return PDF417DetectorResult;
  73448. }();
  73449. var _default = PDF417DetectorResult;
  73450. exports.default = _default;
  73451. /***/ }),
  73452. /* 437 */
  73453. /*!********************************************************************************************************!*\
  73454. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/PDF417ScanningDecoder.js ***!
  73455. \********************************************************************************************************/
  73456. /*! no static exports found */
  73457. /***/ (function(module, exports, __webpack_require__) {
  73458. "use strict";
  73459. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  73460. Object.defineProperty(exports, "__esModule", {
  73461. value: true
  73462. });
  73463. exports.default = void 0;
  73464. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../ChecksumException */ 309));
  73465. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  73466. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  73467. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
  73468. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
  73469. var _ErrorCorrection = _interopRequireDefault(__webpack_require__(/*! ./ec/ErrorCorrection */ 438));
  73470. var _BoundingBox = _interopRequireDefault(__webpack_require__(/*! ./BoundingBox */ 442));
  73471. var _DetectionResultRowIndicatorColumn = _interopRequireDefault(__webpack_require__(/*! ./DetectionResultRowIndicatorColumn */ 443));
  73472. var _DetectionResult = _interopRequireDefault(__webpack_require__(/*! ./DetectionResult */ 448));
  73473. var _DetectionResultColumn = _interopRequireDefault(__webpack_require__(/*! ./DetectionResultColumn */ 445));
  73474. var _Codeword = _interopRequireDefault(__webpack_require__(/*! ./Codeword */ 449));
  73475. var _BarcodeValue = _interopRequireDefault(__webpack_require__(/*! ./BarcodeValue */ 447));
  73476. var _PDF417CodewordDecoder = _interopRequireDefault(__webpack_require__(/*! ./PDF417CodewordDecoder */ 450));
  73477. var _DecodedBitStreamParser = _interopRequireDefault(__webpack_require__(/*! ./DecodedBitStreamParser */ 451));
  73478. var _Formatter = _interopRequireDefault(__webpack_require__(/*! ../../util/Formatter */ 446));
  73479. /*
  73480. * Copyright 2013 ZXing authors
  73481. *
  73482. * Licensed under the Apache License, Version 2.0 (the "License");
  73483. * you may not use this file except in compliance with the License.
  73484. * You may obtain a copy of the License at
  73485. *
  73486. * http://www.apache.org/licenses/LICENSE-2.0
  73487. *
  73488. * Unless required by applicable law or agreed to in writing, software
  73489. * distributed under the License is distributed on an "AS IS" BASIS,
  73490. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  73491. * See the License for the specific language governing permissions and
  73492. * limitations under the License.
  73493. */
  73494. var __values = void 0 && (void 0).__values || function (o) {
  73495. var s = typeof Symbol === "function" && Symbol.iterator,
  73496. m = s && o[s],
  73497. i = 0;
  73498. if (m) return m.call(o);
  73499. if (o && typeof o.length === "number") return {
  73500. next: function next() {
  73501. if (o && i >= o.length) o = void 0;
  73502. return {
  73503. value: o && o[i++],
  73504. done: !o
  73505. };
  73506. }
  73507. };
  73508. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  73509. };
  73510. // package com.google.zxing.pdf417.decoder;
  73511. // import com.google.zxing.ChecksumException;
  73512. // import java.util.ArrayList;
  73513. // import java.util.Collection;
  73514. // import java.util.Formatter;
  73515. // import java.util.List;
  73516. /**
  73517. * @author Guenther Grau
  73518. */
  73519. var PDF417ScanningDecoder = /** @class */function () {
  73520. function PDF417ScanningDecoder() {}
  73521. /**
  73522. * @TODO don't pass in minCodewordWidth and maxCodewordWidth, pass in barcode columns for start and stop pattern
  73523. *
  73524. * columns. That way width can be deducted from the pattern column.
  73525. * This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider
  73526. * than it should be. This can happen if the scanner used a bad blackpoint.
  73527. *
  73528. * @param BitMatrix
  73529. * @param image
  73530. * @param ResultPoint
  73531. * @param imageTopLeft
  73532. * @param ResultPoint
  73533. * @param imageBottomLeft
  73534. * @param ResultPoint
  73535. * @param imageTopRight
  73536. * @param ResultPoint
  73537. * @param imageBottomRight
  73538. * @param int
  73539. * @param minCodewordWidth
  73540. * @param int
  73541. * @param maxCodewordWidth
  73542. *
  73543. * @throws NotFoundException
  73544. * @throws FormatException
  73545. * @throws ChecksumException
  73546. */
  73547. PDF417ScanningDecoder.decode = function (image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, minCodewordWidth, maxCodewordWidth) {
  73548. var boundingBox = new _BoundingBox.default(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight);
  73549. var leftRowIndicatorColumn = null;
  73550. var rightRowIndicatorColumn = null;
  73551. var detectionResult;
  73552. for (var firstPass /*boolean*/ = true;; firstPass = false) {
  73553. if (imageTopLeft != null) {
  73554. leftRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopLeft, true, minCodewordWidth, maxCodewordWidth);
  73555. }
  73556. if (imageTopRight != null) {
  73557. rightRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopRight, false, minCodewordWidth, maxCodewordWidth);
  73558. }
  73559. detectionResult = PDF417ScanningDecoder.merge(leftRowIndicatorColumn, rightRowIndicatorColumn);
  73560. if (detectionResult == null) {
  73561. throw _NotFoundException.default.getNotFoundInstance();
  73562. }
  73563. var resultBox = detectionResult.getBoundingBox();
  73564. if (firstPass && resultBox != null && (resultBox.getMinY() < boundingBox.getMinY() || resultBox.getMaxY() > boundingBox.getMaxY())) {
  73565. boundingBox = resultBox;
  73566. } else {
  73567. break;
  73568. }
  73569. }
  73570. detectionResult.setBoundingBox(boundingBox);
  73571. var maxBarcodeColumn = detectionResult.getBarcodeColumnCount() + 1;
  73572. detectionResult.setDetectionResultColumn(0, leftRowIndicatorColumn);
  73573. detectionResult.setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);
  73574. var leftToRight = leftRowIndicatorColumn != null;
  73575. for (var barcodeColumnCount /*int*/ = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {
  73576. var barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;
  73577. if (detectionResult.getDetectionResultColumn(barcodeColumn) !== /* null */undefined) {
  73578. // This will be the case for the opposite row indicator column, which doesn't need to be decoded again.
  73579. continue;
  73580. }
  73581. var detectionResultColumn = void 0;
  73582. if (barcodeColumn === 0 || barcodeColumn === maxBarcodeColumn) {
  73583. detectionResultColumn = new _DetectionResultRowIndicatorColumn.default(boundingBox, barcodeColumn === 0);
  73584. } else {
  73585. detectionResultColumn = new _DetectionResultColumn.default(boundingBox);
  73586. }
  73587. detectionResult.setDetectionResultColumn(barcodeColumn, detectionResultColumn);
  73588. var startColumn = -1;
  73589. var previousStartColumn = startColumn;
  73590. // TODO start at a row for which we know the start position, then detect upwards and downwards from there.
  73591. for (var imageRow /*int*/ = boundingBox.getMinY(); imageRow <= boundingBox.getMaxY(); imageRow++) {
  73592. startColumn = PDF417ScanningDecoder.getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight);
  73593. if (startColumn < 0 || startColumn > boundingBox.getMaxX()) {
  73594. if (previousStartColumn === -1) {
  73595. continue;
  73596. }
  73597. startColumn = previousStartColumn;
  73598. }
  73599. var codeword = PDF417ScanningDecoder.detectCodeword(image, boundingBox.getMinX(), boundingBox.getMaxX(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
  73600. if (codeword != null) {
  73601. detectionResultColumn.setCodeword(imageRow, codeword);
  73602. previousStartColumn = startColumn;
  73603. minCodewordWidth = Math.min(minCodewordWidth, codeword.getWidth());
  73604. maxCodewordWidth = Math.max(maxCodewordWidth, codeword.getWidth());
  73605. }
  73606. }
  73607. }
  73608. return PDF417ScanningDecoder.createDecoderResult(detectionResult);
  73609. };
  73610. /**
  73611. *
  73612. * @param leftRowIndicatorColumn
  73613. * @param rightRowIndicatorColumn
  73614. *
  73615. * @throws NotFoundException
  73616. */
  73617. PDF417ScanningDecoder.merge = function (leftRowIndicatorColumn, rightRowIndicatorColumn) {
  73618. if (leftRowIndicatorColumn == null && rightRowIndicatorColumn == null) {
  73619. return null;
  73620. }
  73621. var barcodeMetadata = PDF417ScanningDecoder.getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn);
  73622. if (barcodeMetadata == null) {
  73623. return null;
  73624. }
  73625. var boundingBox = _BoundingBox.default.merge(PDF417ScanningDecoder.adjustBoundingBox(leftRowIndicatorColumn), PDF417ScanningDecoder.adjustBoundingBox(rightRowIndicatorColumn));
  73626. return new _DetectionResult.default(barcodeMetadata, boundingBox);
  73627. };
  73628. /**
  73629. *
  73630. * @param rowIndicatorColumn
  73631. *
  73632. * @throws NotFoundException
  73633. */
  73634. PDF417ScanningDecoder.adjustBoundingBox = function (rowIndicatorColumn) {
  73635. var e_1, _a;
  73636. if (rowIndicatorColumn == null) {
  73637. return null;
  73638. }
  73639. var rowHeights = rowIndicatorColumn.getRowHeights();
  73640. if (rowHeights == null) {
  73641. return null;
  73642. }
  73643. var maxRowHeight = PDF417ScanningDecoder.getMax(rowHeights);
  73644. var missingStartRows = 0;
  73645. try {
  73646. for (var rowHeights_1 = __values(rowHeights), rowHeights_1_1 = rowHeights_1.next(); !rowHeights_1_1.done; rowHeights_1_1 = rowHeights_1.next()) {
  73647. var rowHeight = rowHeights_1_1.value /*int*/;
  73648. missingStartRows += maxRowHeight - rowHeight;
  73649. if (rowHeight > 0) {
  73650. break;
  73651. }
  73652. }
  73653. } catch (e_1_1) {
  73654. e_1 = {
  73655. error: e_1_1
  73656. };
  73657. } finally {
  73658. try {
  73659. if (rowHeights_1_1 && !rowHeights_1_1.done && (_a = rowHeights_1.return)) _a.call(rowHeights_1);
  73660. } finally {
  73661. if (e_1) throw e_1.error;
  73662. }
  73663. }
  73664. var codewords = rowIndicatorColumn.getCodewords();
  73665. for (var row /*int*/ = 0; missingStartRows > 0 && codewords[row] == null; row++) {
  73666. missingStartRows--;
  73667. }
  73668. var missingEndRows = 0;
  73669. for (var row /*int*/ = rowHeights.length - 1; row >= 0; row--) {
  73670. missingEndRows += maxRowHeight - rowHeights[row];
  73671. if (rowHeights[row] > 0) {
  73672. break;
  73673. }
  73674. }
  73675. for (var row /*int*/ = codewords.length - 1; missingEndRows > 0 && codewords[row] == null; row--) {
  73676. missingEndRows--;
  73677. }
  73678. return rowIndicatorColumn.getBoundingBox().addMissingRows(missingStartRows, missingEndRows, rowIndicatorColumn.isLeft());
  73679. };
  73680. PDF417ScanningDecoder.getMax = function (values) {
  73681. var e_2, _a;
  73682. var maxValue = -1;
  73683. try {
  73684. for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
  73685. var value = values_1_1.value /*int*/;
  73686. maxValue = Math.max(maxValue, value);
  73687. }
  73688. } catch (e_2_1) {
  73689. e_2 = {
  73690. error: e_2_1
  73691. };
  73692. } finally {
  73693. try {
  73694. if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
  73695. } finally {
  73696. if (e_2) throw e_2.error;
  73697. }
  73698. }
  73699. return maxValue;
  73700. };
  73701. PDF417ScanningDecoder.getBarcodeMetadata = function (leftRowIndicatorColumn, rightRowIndicatorColumn) {
  73702. var leftBarcodeMetadata;
  73703. if (leftRowIndicatorColumn == null || (leftBarcodeMetadata = leftRowIndicatorColumn.getBarcodeMetadata()) == null) {
  73704. return rightRowIndicatorColumn == null ? null : rightRowIndicatorColumn.getBarcodeMetadata();
  73705. }
  73706. var rightBarcodeMetadata;
  73707. if (rightRowIndicatorColumn == null || (rightBarcodeMetadata = rightRowIndicatorColumn.getBarcodeMetadata()) == null) {
  73708. return leftBarcodeMetadata;
  73709. }
  73710. if (leftBarcodeMetadata.getColumnCount() !== rightBarcodeMetadata.getColumnCount() && leftBarcodeMetadata.getErrorCorrectionLevel() !== rightBarcodeMetadata.getErrorCorrectionLevel() && leftBarcodeMetadata.getRowCount() !== rightBarcodeMetadata.getRowCount()) {
  73711. return null;
  73712. }
  73713. return leftBarcodeMetadata;
  73714. };
  73715. PDF417ScanningDecoder.getRowIndicatorColumn = function (image, boundingBox, startPoint, leftToRight, minCodewordWidth, maxCodewordWidth) {
  73716. var rowIndicatorColumn = new _DetectionResultRowIndicatorColumn.default(boundingBox, leftToRight);
  73717. for (var i /*int*/ = 0; i < 2; i++) {
  73718. var increment = i === 0 ? 1 : -1;
  73719. var startColumn = Math.trunc(Math.trunc(startPoint.getX()));
  73720. for (var imageRow /*int*/ = Math.trunc(Math.trunc(startPoint.getY())); imageRow <= boundingBox.getMaxY() && imageRow >= boundingBox.getMinY(); imageRow += increment) {
  73721. var codeword = PDF417ScanningDecoder.detectCodeword(image, 0, image.getWidth(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
  73722. if (codeword != null) {
  73723. rowIndicatorColumn.setCodeword(imageRow, codeword);
  73724. if (leftToRight) {
  73725. startColumn = codeword.getStartX();
  73726. } else {
  73727. startColumn = codeword.getEndX();
  73728. }
  73729. }
  73730. }
  73731. }
  73732. return rowIndicatorColumn;
  73733. };
  73734. /**
  73735. *
  73736. * @param detectionResult
  73737. * @param BarcodeValue
  73738. * @param param2
  73739. * @param param3
  73740. * @param barcodeMatrix
  73741. *
  73742. * @throws NotFoundException
  73743. */
  73744. PDF417ScanningDecoder.adjustCodewordCount = function (detectionResult, barcodeMatrix) {
  73745. var barcodeMatrix01 = barcodeMatrix[0][1];
  73746. var numberOfCodewords = barcodeMatrix01.getValue();
  73747. var calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() * detectionResult.getBarcodeRowCount() - PDF417ScanningDecoder.getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
  73748. if (numberOfCodewords.length === 0) {
  73749. if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > _PDF417Common.default.MAX_CODEWORDS_IN_BARCODE) {
  73750. throw _NotFoundException.default.getNotFoundInstance();
  73751. }
  73752. barcodeMatrix01.setValue(calculatedNumberOfCodewords);
  73753. } else if (numberOfCodewords[0] !== calculatedNumberOfCodewords) {
  73754. // The calculated one is more reliable as it is derived from the row indicator columns
  73755. barcodeMatrix01.setValue(calculatedNumberOfCodewords);
  73756. }
  73757. };
  73758. /**
  73759. *
  73760. * @param detectionResult
  73761. *
  73762. * @throws FormatException
  73763. * @throws ChecksumException
  73764. * @throws NotFoundException
  73765. */
  73766. PDF417ScanningDecoder.createDecoderResult = function (detectionResult) {
  73767. var barcodeMatrix = PDF417ScanningDecoder.createBarcodeMatrix(detectionResult);
  73768. PDF417ScanningDecoder.adjustCodewordCount(detectionResult, barcodeMatrix);
  73769. var erasures /*Collection<Integer>*/ = new Array();
  73770. var codewords = new Int32Array(detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount());
  73771. var ambiguousIndexValuesList = /*List<int[]>*/[];
  73772. var ambiguousIndexesList = /*Collection<Integer>*/new Array();
  73773. for (var row /*int*/ = 0; row < detectionResult.getBarcodeRowCount(); row++) {
  73774. for (var column /*int*/ = 0; column < detectionResult.getBarcodeColumnCount(); column++) {
  73775. var values = barcodeMatrix[row][column + 1].getValue();
  73776. var codewordIndex = row * detectionResult.getBarcodeColumnCount() + column;
  73777. if (values.length === 0) {
  73778. erasures.push(codewordIndex);
  73779. } else if (values.length === 1) {
  73780. codewords[codewordIndex] = values[0];
  73781. } else {
  73782. ambiguousIndexesList.push(codewordIndex);
  73783. ambiguousIndexValuesList.push(values);
  73784. }
  73785. }
  73786. }
  73787. var ambiguousIndexValues = new Array(ambiguousIndexValuesList.length);
  73788. for (var i /*int*/ = 0; i < ambiguousIndexValues.length; i++) {
  73789. ambiguousIndexValues[i] = ambiguousIndexValuesList[i];
  73790. }
  73791. return PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues(detectionResult.getBarcodeECLevel(), codewords, _PDF417Common.default.toIntArray(erasures), _PDF417Common.default.toIntArray(ambiguousIndexesList), ambiguousIndexValues);
  73792. };
  73793. /**
  73794. * This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The
  73795. * current error correction implementation doesn't deal with erasures very well, so it's better to provide a value
  73796. * for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't know which of
  73797. * the ambiguous values to choose. We try decode using the first value, and if that fails, we use another of the
  73798. * ambiguous values and try to decode again. This usually only happens on very hard to read and decode barcodes,
  73799. * so decoding the normal barcodes is not affected by this.
  73800. *
  73801. * @param erasureArray contains the indexes of erasures
  73802. * @param ambiguousIndexes array with the indexes that have more than one most likely value
  73803. * @param ambiguousIndexValues two dimensional array that contains the ambiguous values. The first dimension must
  73804. * be the same length as the ambiguousIndexes array
  73805. *
  73806. * @throws FormatException
  73807. * @throws ChecksumException
  73808. */
  73809. PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues = function (ecLevel, codewords, erasureArray, ambiguousIndexes, ambiguousIndexValues) {
  73810. var ambiguousIndexCount = new Int32Array(ambiguousIndexes.length);
  73811. var tries = 100;
  73812. while (tries-- > 0) {
  73813. for (var i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {
  73814. codewords[ambiguousIndexes[i]] = ambiguousIndexValues[i][ambiguousIndexCount[i]];
  73815. }
  73816. try {
  73817. return PDF417ScanningDecoder.decodeCodewords(codewords, ecLevel, erasureArray);
  73818. } catch (err) {
  73819. var ignored = err instanceof _ChecksumException.default;
  73820. if (!ignored) {
  73821. throw err;
  73822. }
  73823. }
  73824. if (ambiguousIndexCount.length === 0) {
  73825. throw _ChecksumException.default.getChecksumInstance();
  73826. }
  73827. for (var i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {
  73828. if (ambiguousIndexCount[i] < ambiguousIndexValues[i].length - 1) {
  73829. ambiguousIndexCount[i]++;
  73830. break;
  73831. } else {
  73832. ambiguousIndexCount[i] = 0;
  73833. if (i === ambiguousIndexCount.length - 1) {
  73834. throw _ChecksumException.default.getChecksumInstance();
  73835. }
  73836. }
  73837. }
  73838. }
  73839. throw _ChecksumException.default.getChecksumInstance();
  73840. };
  73841. PDF417ScanningDecoder.createBarcodeMatrix = function (detectionResult) {
  73842. var e_3, _a, e_4, _b;
  73843. // let barcodeMatrix: BarcodeValue[][] =
  73844. // new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];
  73845. var barcodeMatrix = Array.from({
  73846. length: detectionResult.getBarcodeRowCount()
  73847. }, function () {
  73848. return new Array(detectionResult.getBarcodeColumnCount() + 2);
  73849. });
  73850. for (var row /*int*/ = 0; row < barcodeMatrix.length; row++) {
  73851. for (var column_1 /*int*/ = 0; column_1 < barcodeMatrix[row].length; column_1++) {
  73852. barcodeMatrix[row][column_1] = new _BarcodeValue.default();
  73853. }
  73854. }
  73855. var column = 0;
  73856. try {
  73857. for (var _c = __values(detectionResult.getDetectionResultColumns()), _d = _c.next(); !_d.done; _d = _c.next()) {
  73858. var detectionResultColumn = _d.value /*DetectionResultColumn*/;
  73859. if (detectionResultColumn != null) {
  73860. try {
  73861. for (var _e = (e_4 = void 0, __values(detectionResultColumn.getCodewords())), _f = _e.next(); !_f.done; _f = _e.next()) {
  73862. var codeword = _f.value /*Codeword*/;
  73863. if (codeword != null) {
  73864. var rowNumber = codeword.getRowNumber();
  73865. if (rowNumber >= 0) {
  73866. if (rowNumber >= barcodeMatrix.length) {
  73867. // We have more rows than the barcode metadata allows for, ignore them.
  73868. continue;
  73869. }
  73870. barcodeMatrix[rowNumber][column].setValue(codeword.getValue());
  73871. }
  73872. }
  73873. }
  73874. } catch (e_4_1) {
  73875. e_4 = {
  73876. error: e_4_1
  73877. };
  73878. } finally {
  73879. try {
  73880. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  73881. } finally {
  73882. if (e_4) throw e_4.error;
  73883. }
  73884. }
  73885. }
  73886. column++;
  73887. }
  73888. } catch (e_3_1) {
  73889. e_3 = {
  73890. error: e_3_1
  73891. };
  73892. } finally {
  73893. try {
  73894. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  73895. } finally {
  73896. if (e_3) throw e_3.error;
  73897. }
  73898. }
  73899. return barcodeMatrix;
  73900. };
  73901. PDF417ScanningDecoder.isValidBarcodeColumn = function (detectionResult, barcodeColumn) {
  73902. return barcodeColumn >= 0 && barcodeColumn <= detectionResult.getBarcodeColumnCount() + 1;
  73903. };
  73904. PDF417ScanningDecoder.getStartColumn = function (detectionResult, barcodeColumn, imageRow, leftToRight) {
  73905. var e_5, _a;
  73906. var offset = leftToRight ? 1 : -1;
  73907. var codeword = null;
  73908. if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
  73909. codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodeword(imageRow);
  73910. }
  73911. if (codeword != null) {
  73912. return leftToRight ? codeword.getEndX() : codeword.getStartX();
  73913. }
  73914. codeword = detectionResult.getDetectionResultColumn(barcodeColumn).getCodewordNearby(imageRow);
  73915. if (codeword != null) {
  73916. return leftToRight ? codeword.getStartX() : codeword.getEndX();
  73917. }
  73918. if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
  73919. codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodewordNearby(imageRow);
  73920. }
  73921. if (codeword != null) {
  73922. return leftToRight ? codeword.getEndX() : codeword.getStartX();
  73923. }
  73924. var skippedColumns = 0;
  73925. while (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
  73926. barcodeColumn -= offset;
  73927. try {
  73928. for (var _b = (e_5 = void 0, __values(detectionResult.getDetectionResultColumn(barcodeColumn).getCodewords())), _c = _b.next(); !_c.done; _c = _b.next()) {
  73929. var previousRowCodeword = _c.value /*Codeword*/;
  73930. if (previousRowCodeword != null) {
  73931. return (leftToRight ? previousRowCodeword.getEndX() : previousRowCodeword.getStartX()) + offset * skippedColumns * (previousRowCodeword.getEndX() - previousRowCodeword.getStartX());
  73932. }
  73933. }
  73934. } catch (e_5_1) {
  73935. e_5 = {
  73936. error: e_5_1
  73937. };
  73938. } finally {
  73939. try {
  73940. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  73941. } finally {
  73942. if (e_5) throw e_5.error;
  73943. }
  73944. }
  73945. skippedColumns++;
  73946. }
  73947. return leftToRight ? detectionResult.getBoundingBox().getMinX() : detectionResult.getBoundingBox().getMaxX();
  73948. };
  73949. PDF417ScanningDecoder.detectCodeword = function (image, minColumn, maxColumn, leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth) {
  73950. startColumn = PDF417ScanningDecoder.adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
  73951. // we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length
  73952. // and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.
  73953. // min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate
  73954. // for the current position
  73955. var moduleBitCount = PDF417ScanningDecoder.getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);
  73956. if (moduleBitCount == null) {
  73957. return null;
  73958. }
  73959. var endColumn;
  73960. var codewordBitCount = _MathUtils.default.sum(moduleBitCount);
  73961. if (leftToRight) {
  73962. endColumn = startColumn + codewordBitCount;
  73963. } else {
  73964. for (var i /*int*/ = 0; i < moduleBitCount.length / 2; i++) {
  73965. var tmpCount = moduleBitCount[i];
  73966. moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];
  73967. moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;
  73968. }
  73969. endColumn = startColumn;
  73970. startColumn = endColumn - codewordBitCount;
  73971. }
  73972. // TODO implement check for width and correction of black and white bars
  73973. // use start (and maybe stop pattern) to determine if black bars are wider than white bars. If so, adjust.
  73974. // should probably done only for codewords with a lot more than 17 bits.
  73975. // The following fixes 10-1.png, which has wide black bars and small white bars
  73976. // for (let i /*int*/ = 0; i < moduleBitCount.length; i++) {
  73977. // if (i % 2 === 0) {
  73978. // moduleBitCount[i]--;
  73979. // } else {
  73980. // moduleBitCount[i]++;
  73981. // }
  73982. // }
  73983. // We could also use the width of surrounding codewords for more accurate results, but this seems
  73984. // sufficient for now
  73985. if (!PDF417ScanningDecoder.checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {
  73986. // We could try to use the startX and endX position of the codeword in the same column in the previous row,
  73987. // create the bit count from it and normalize it to 8. This would help with single pixel errors.
  73988. return null;
  73989. }
  73990. var decodedValue = _PDF417CodewordDecoder.default.getDecodedValue(moduleBitCount);
  73991. var codeword = _PDF417Common.default.getCodeword(decodedValue);
  73992. if (codeword === -1) {
  73993. return null;
  73994. }
  73995. return new _Codeword.default(startColumn, endColumn, PDF417ScanningDecoder.getCodewordBucketNumber(decodedValue), codeword);
  73996. };
  73997. PDF417ScanningDecoder.getModuleBitCount = function (image, minColumn, maxColumn, leftToRight, startColumn, imageRow) {
  73998. var imageColumn = startColumn;
  73999. var moduleBitCount = new Int32Array(8);
  74000. var moduleNumber = 0;
  74001. var increment = leftToRight ? 1 : -1;
  74002. var previousPixelValue = leftToRight;
  74003. while ((leftToRight ? imageColumn < maxColumn : imageColumn >= minColumn) && moduleNumber < moduleBitCount.length) {
  74004. if (image.get(imageColumn, imageRow) === previousPixelValue) {
  74005. moduleBitCount[moduleNumber]++;
  74006. imageColumn += increment;
  74007. } else {
  74008. moduleNumber++;
  74009. previousPixelValue = !previousPixelValue;
  74010. }
  74011. }
  74012. if (moduleNumber === moduleBitCount.length || imageColumn === (leftToRight ? maxColumn : minColumn) && moduleNumber === moduleBitCount.length - 1) {
  74013. return moduleBitCount;
  74014. }
  74015. return null;
  74016. };
  74017. PDF417ScanningDecoder.getNumberOfECCodeWords = function (barcodeECLevel) {
  74018. return 2 << barcodeECLevel;
  74019. };
  74020. PDF417ScanningDecoder.adjustCodewordStartColumn = function (image, minColumn, maxColumn, leftToRight, codewordStartColumn, imageRow) {
  74021. var correctedStartColumn = codewordStartColumn;
  74022. var increment = leftToRight ? -1 : 1;
  74023. // there should be no black pixels before the start column. If there are, then we need to start earlier.
  74024. for (var i /*int*/ = 0; i < 2; i++) {
  74025. while ((leftToRight ? correctedStartColumn >= minColumn : correctedStartColumn < maxColumn) && leftToRight === image.get(correctedStartColumn, imageRow)) {
  74026. if (Math.abs(codewordStartColumn - correctedStartColumn) > PDF417ScanningDecoder.CODEWORD_SKEW_SIZE) {
  74027. return codewordStartColumn;
  74028. }
  74029. correctedStartColumn += increment;
  74030. }
  74031. increment = -increment;
  74032. leftToRight = !leftToRight;
  74033. }
  74034. return correctedStartColumn;
  74035. };
  74036. PDF417ScanningDecoder.checkCodewordSkew = function (codewordSize, minCodewordWidth, maxCodewordWidth) {
  74037. return minCodewordWidth - PDF417ScanningDecoder.CODEWORD_SKEW_SIZE <= codewordSize && codewordSize <= maxCodewordWidth + PDF417ScanningDecoder.CODEWORD_SKEW_SIZE;
  74038. };
  74039. /**
  74040. * @throws FormatException,
  74041. * @throws ChecksumException
  74042. */
  74043. PDF417ScanningDecoder.decodeCodewords = function (codewords, ecLevel, erasures) {
  74044. if (codewords.length === 0) {
  74045. throw _FormatException.default.getFormatInstance();
  74046. }
  74047. var numECCodewords = 1 << ecLevel + 1;
  74048. var correctedErrorsCount = PDF417ScanningDecoder.correctErrors(codewords, erasures, numECCodewords);
  74049. PDF417ScanningDecoder.verifyCodewordCount(codewords, numECCodewords);
  74050. // Decode the codewords
  74051. var decoderResult = _DecodedBitStreamParser.default.decode(codewords, '' + ecLevel);
  74052. decoderResult.setErrorsCorrected(correctedErrorsCount);
  74053. decoderResult.setErasures(erasures.length);
  74054. return decoderResult;
  74055. };
  74056. /**
  74057. * <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
  74058. * correct the errors in-place.</p>
  74059. *
  74060. * @param codewords data and error correction codewords
  74061. * @param erasures positions of any known erasures
  74062. * @param numECCodewords number of error correction codewords that are available in codewords
  74063. * @throws ChecksumException if error correction fails
  74064. */
  74065. PDF417ScanningDecoder.correctErrors = function (codewords, erasures, numECCodewords) {
  74066. if (erasures != null && erasures.length > numECCodewords / 2 + PDF417ScanningDecoder.MAX_ERRORS || numECCodewords < 0 || numECCodewords > PDF417ScanningDecoder.MAX_EC_CODEWORDS) {
  74067. // Too many errors or EC Codewords is corrupted
  74068. throw _ChecksumException.default.getChecksumInstance();
  74069. }
  74070. return PDF417ScanningDecoder.errorCorrection.decode(codewords, numECCodewords, erasures);
  74071. };
  74072. /**
  74073. * Verify that all is OK with the codeword array.
  74074. * @throws FormatException
  74075. */
  74076. PDF417ScanningDecoder.verifyCodewordCount = function (codewords, numECCodewords) {
  74077. if (codewords.length < 4) {
  74078. // Codeword array size should be at least 4 allowing for
  74079. // Count CW, At least one Data CW, Error Correction CW, Error Correction CW
  74080. throw _FormatException.default.getFormatInstance();
  74081. }
  74082. // The first codeword, the Symbol Length Descriptor, shall always encode the total number of data
  74083. // codewords in the symbol, including the Symbol Length Descriptor itself, data codewords and pad
  74084. // codewords, but excluding the number of error correction codewords.
  74085. var numberOfCodewords = codewords[0];
  74086. if (numberOfCodewords > codewords.length) {
  74087. throw _FormatException.default.getFormatInstance();
  74088. }
  74089. if (numberOfCodewords === 0) {
  74090. // Reset to the length of the array - 8 (Allow for at least level 3 Error Correction (8 Error Codewords)
  74091. if (numECCodewords < codewords.length) {
  74092. codewords[0] = codewords.length - numECCodewords;
  74093. } else {
  74094. throw _FormatException.default.getFormatInstance();
  74095. }
  74096. }
  74097. };
  74098. PDF417ScanningDecoder.getBitCountForCodeword = function (codeword) {
  74099. var result = new Int32Array(8);
  74100. var previousValue = 0;
  74101. var i = result.length - 1;
  74102. while (true) {
  74103. if ((codeword & 0x1) !== previousValue) {
  74104. previousValue = codeword & 0x1;
  74105. i--;
  74106. if (i < 0) {
  74107. break;
  74108. }
  74109. }
  74110. result[i]++;
  74111. codeword >>= 1;
  74112. }
  74113. return result;
  74114. };
  74115. PDF417ScanningDecoder.getCodewordBucketNumber = function (codeword) {
  74116. if (codeword instanceof Int32Array) {
  74117. return this.getCodewordBucketNumber_Int32Array(codeword);
  74118. }
  74119. return this.getCodewordBucketNumber_number(codeword);
  74120. };
  74121. PDF417ScanningDecoder.getCodewordBucketNumber_number = function (codeword) {
  74122. return PDF417ScanningDecoder.getCodewordBucketNumber(PDF417ScanningDecoder.getBitCountForCodeword(codeword));
  74123. };
  74124. PDF417ScanningDecoder.getCodewordBucketNumber_Int32Array = function (moduleBitCount) {
  74125. return (moduleBitCount[0] - moduleBitCount[2] + moduleBitCount[4] - moduleBitCount[6] + 9) % 9;
  74126. };
  74127. PDF417ScanningDecoder.toString = function (barcodeMatrix) {
  74128. var formatter = new _Formatter.default();
  74129. // try (let formatter = new Formatter()) {
  74130. for (var row /*int*/ = 0; row < barcodeMatrix.length; row++) {
  74131. formatter.format('Row %2d: ', row);
  74132. for (var column /*int*/ = 0; column < barcodeMatrix[row].length; column++) {
  74133. var barcodeValue = barcodeMatrix[row][column];
  74134. if (barcodeValue.getValue().length === 0) {
  74135. formatter.format(' ', null);
  74136. } else {
  74137. formatter.format('%4d(%2d)', barcodeValue.getValue()[0], barcodeValue.getConfidence(barcodeValue.getValue()[0]));
  74138. }
  74139. }
  74140. formatter.format('%n');
  74141. }
  74142. return formatter.toString();
  74143. // }
  74144. };
  74145. /*final*/
  74146. PDF417ScanningDecoder.CODEWORD_SKEW_SIZE = 2;
  74147. /*final*/
  74148. PDF417ScanningDecoder.MAX_ERRORS = 3;
  74149. /*final*/
  74150. PDF417ScanningDecoder.MAX_EC_CODEWORDS = 512;
  74151. /*final*/
  74152. PDF417ScanningDecoder.errorCorrection = new _ErrorCorrection.default();
  74153. return PDF417ScanningDecoder;
  74154. }();
  74155. var _default = PDF417ScanningDecoder;
  74156. exports.default = _default;
  74157. /***/ }),
  74158. /* 438 */
  74159. /*!*****************************************************************************************************!*\
  74160. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ErrorCorrection.js ***!
  74161. \*****************************************************************************************************/
  74162. /*! no static exports found */
  74163. /***/ (function(module, exports, __webpack_require__) {
  74164. "use strict";
  74165. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  74166. Object.defineProperty(exports, "__esModule", {
  74167. value: true
  74168. });
  74169. exports.default = void 0;
  74170. var _ChecksumException = _interopRequireDefault(__webpack_require__(/*! ../../../ChecksumException */ 309));
  74171. var _ModulusPoly = _interopRequireDefault(__webpack_require__(/*! ./ModulusPoly */ 439));
  74172. var _ModulusGF = _interopRequireDefault(__webpack_require__(/*! ./ModulusGF */ 440));
  74173. /*
  74174. * Copyright 2012 ZXing authors
  74175. *
  74176. * Licensed under the Apache License, Version 2.0 (the "License");
  74177. * you may not use this file except in compliance with the License.
  74178. * You may obtain a copy of the License at
  74179. *
  74180. * http://www.apache.org/licenses/LICENSE-2.0
  74181. *
  74182. * Unless required by applicable law or agreed to in writing, software
  74183. * distributed under the License is distributed on an "AS IS" BASIS,
  74184. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  74185. * See the License for the specific language governing permissions and
  74186. * limitations under the License.
  74187. */
  74188. var __values = void 0 && (void 0).__values || function (o) {
  74189. var s = typeof Symbol === "function" && Symbol.iterator,
  74190. m = s && o[s],
  74191. i = 0;
  74192. if (m) return m.call(o);
  74193. if (o && typeof o.length === "number") return {
  74194. next: function next() {
  74195. if (o && i >= o.length) o = void 0;
  74196. return {
  74197. value: o && o[i++],
  74198. done: !o
  74199. };
  74200. }
  74201. };
  74202. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  74203. };
  74204. // package com.google.zxing.pdf417.decoder.ec;
  74205. // import com.google.zxing.ChecksumException;
  74206. /**
  74207. * <p>PDF417 error correction implementation.</p>
  74208. *
  74209. * <p>This <a href="http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#Example">example</a>
  74210. * is quite useful in understanding the algorithm.</p>
  74211. *
  74212. * @author Sean Owen
  74213. * @see com.google.zxing.common.reedsolomon.ReedSolomonDecoder
  74214. */
  74215. var ErrorCorrection = /** @class */function () {
  74216. function ErrorCorrection() {
  74217. this.field = _ModulusGF.default.PDF417_GF;
  74218. }
  74219. /**
  74220. * @param received received codewords
  74221. * @param numECCodewords number of those codewords used for EC
  74222. * @param erasures location of erasures
  74223. * @return number of errors
  74224. * @throws ChecksumException if errors cannot be corrected, maybe because of too many errors
  74225. */
  74226. ErrorCorrection.prototype.decode = function (received, numECCodewords, erasures) {
  74227. var e_1, _a;
  74228. var poly = new _ModulusPoly.default(this.field, received);
  74229. var S = new Int32Array(numECCodewords);
  74230. var error = false;
  74231. for (var i /*int*/ = numECCodewords; i > 0; i--) {
  74232. var evaluation = poly.evaluateAt(this.field.exp(i));
  74233. S[numECCodewords - i] = evaluation;
  74234. if (evaluation !== 0) {
  74235. error = true;
  74236. }
  74237. }
  74238. if (!error) {
  74239. return 0;
  74240. }
  74241. var knownErrors = this.field.getOne();
  74242. if (erasures != null) {
  74243. try {
  74244. for (var erasures_1 = __values(erasures), erasures_1_1 = erasures_1.next(); !erasures_1_1.done; erasures_1_1 = erasures_1.next()) {
  74245. var erasure = erasures_1_1.value;
  74246. var b = this.field.exp(received.length - 1 - erasure);
  74247. // Add (1 - bx) term:
  74248. var term = new _ModulusPoly.default(this.field, new Int32Array([this.field.subtract(0, b), 1]));
  74249. knownErrors = knownErrors.multiply(term);
  74250. }
  74251. } catch (e_1_1) {
  74252. e_1 = {
  74253. error: e_1_1
  74254. };
  74255. } finally {
  74256. try {
  74257. if (erasures_1_1 && !erasures_1_1.done && (_a = erasures_1.return)) _a.call(erasures_1);
  74258. } finally {
  74259. if (e_1) throw e_1.error;
  74260. }
  74261. }
  74262. }
  74263. var syndrome = new _ModulusPoly.default(this.field, S);
  74264. // syndrome = syndrome.multiply(knownErrors);
  74265. var sigmaOmega = this.runEuclideanAlgorithm(this.field.buildMonomial(numECCodewords, 1), syndrome, numECCodewords);
  74266. var sigma = sigmaOmega[0];
  74267. var omega = sigmaOmega[1];
  74268. // sigma = sigma.multiply(knownErrors);
  74269. var errorLocations = this.findErrorLocations(sigma);
  74270. var errorMagnitudes = this.findErrorMagnitudes(omega, sigma, errorLocations);
  74271. for (var i /*int*/ = 0; i < errorLocations.length; i++) {
  74272. var position = received.length - 1 - this.field.log(errorLocations[i]);
  74273. if (position < 0) {
  74274. throw _ChecksumException.default.getChecksumInstance();
  74275. }
  74276. received[position] = this.field.subtract(received[position], errorMagnitudes[i]);
  74277. }
  74278. return errorLocations.length;
  74279. };
  74280. /**
  74281. *
  74282. * @param ModulusPoly
  74283. * @param a
  74284. * @param ModulusPoly
  74285. * @param b
  74286. * @param int
  74287. * @param R
  74288. * @throws ChecksumException
  74289. */
  74290. ErrorCorrection.prototype.runEuclideanAlgorithm = function (a, b, R) {
  74291. // Assume a's degree is >= b's
  74292. if (a.getDegree() < b.getDegree()) {
  74293. var temp = a;
  74294. a = b;
  74295. b = temp;
  74296. }
  74297. var rLast = a;
  74298. var r = b;
  74299. var tLast = this.field.getZero();
  74300. var t = this.field.getOne();
  74301. // Run Euclidean algorithm until r's degree is less than R/2
  74302. while (r.getDegree() >= Math.round(R / 2)) {
  74303. var rLastLast = rLast;
  74304. var tLastLast = tLast;
  74305. rLast = r;
  74306. tLast = t;
  74307. // Divide rLastLast by rLast, with quotient in q and remainder in r
  74308. if (rLast.isZero()) {
  74309. // Oops, Euclidean algorithm already terminated?
  74310. throw _ChecksumException.default.getChecksumInstance();
  74311. }
  74312. r = rLastLast;
  74313. var q = this.field.getZero();
  74314. var denominatorLeadingTerm = rLast.getCoefficient(rLast.getDegree());
  74315. var dltInverse = this.field.inverse(denominatorLeadingTerm);
  74316. while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {
  74317. var degreeDiff = r.getDegree() - rLast.getDegree();
  74318. var scale = this.field.multiply(r.getCoefficient(r.getDegree()), dltInverse);
  74319. q = q.add(this.field.buildMonomial(degreeDiff, scale));
  74320. r = r.subtract(rLast.multiplyByMonomial(degreeDiff, scale));
  74321. }
  74322. t = q.multiply(tLast).subtract(tLastLast).negative();
  74323. }
  74324. var sigmaTildeAtZero = t.getCoefficient(0);
  74325. if (sigmaTildeAtZero === 0) {
  74326. throw _ChecksumException.default.getChecksumInstance();
  74327. }
  74328. var inverse = this.field.inverse(sigmaTildeAtZero);
  74329. var sigma = t.multiply(inverse);
  74330. var omega = r.multiply(inverse);
  74331. return [sigma, omega];
  74332. };
  74333. /**
  74334. *
  74335. * @param errorLocator
  74336. * @throws ChecksumException
  74337. */
  74338. ErrorCorrection.prototype.findErrorLocations = function (errorLocator) {
  74339. // This is a direct application of Chien's search
  74340. var numErrors = errorLocator.getDegree();
  74341. var result = new Int32Array(numErrors);
  74342. var e = 0;
  74343. for (var i /*int*/ = 1; i < this.field.getSize() && e < numErrors; i++) {
  74344. if (errorLocator.evaluateAt(i) === 0) {
  74345. result[e] = this.field.inverse(i);
  74346. e++;
  74347. }
  74348. }
  74349. if (e !== numErrors) {
  74350. throw _ChecksumException.default.getChecksumInstance();
  74351. }
  74352. return result;
  74353. };
  74354. ErrorCorrection.prototype.findErrorMagnitudes = function (errorEvaluator, errorLocator, errorLocations) {
  74355. var errorLocatorDegree = errorLocator.getDegree();
  74356. var formalDerivativeCoefficients = new Int32Array(errorLocatorDegree);
  74357. for (var i /*int*/ = 1; i <= errorLocatorDegree; i++) {
  74358. formalDerivativeCoefficients[errorLocatorDegree - i] = this.field.multiply(i, errorLocator.getCoefficient(i));
  74359. }
  74360. var formalDerivative = new _ModulusPoly.default(this.field, formalDerivativeCoefficients);
  74361. // This is directly applying Forney's Formula
  74362. var s = errorLocations.length;
  74363. var result = new Int32Array(s);
  74364. for (var i /*int*/ = 0; i < s; i++) {
  74365. var xiInverse = this.field.inverse(errorLocations[i]);
  74366. var numerator = this.field.subtract(0, errorEvaluator.evaluateAt(xiInverse));
  74367. var denominator = this.field.inverse(formalDerivative.evaluateAt(xiInverse));
  74368. result[i] = this.field.multiply(numerator, denominator);
  74369. }
  74370. return result;
  74371. };
  74372. return ErrorCorrection;
  74373. }();
  74374. var _default = ErrorCorrection;
  74375. exports.default = _default;
  74376. /***/ }),
  74377. /* 439 */
  74378. /*!*************************************************************************************************!*\
  74379. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ModulusPoly.js ***!
  74380. \*************************************************************************************************/
  74381. /*! no static exports found */
  74382. /***/ (function(module, exports, __webpack_require__) {
  74383. "use strict";
  74384. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  74385. Object.defineProperty(exports, "__esModule", {
  74386. value: true
  74387. });
  74388. exports.default = void 0;
  74389. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../../IllegalArgumentException */ 308));
  74390. var _System = _interopRequireDefault(__webpack_require__(/*! ../../../util/System */ 315));
  74391. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../../util/StringBuilder */ 320));
  74392. /*
  74393. * Copyright 2012 ZXing authors
  74394. *
  74395. * Licensed under the Apache License, Version 2.0 (the "License");
  74396. * you may not use this file except in compliance with the License.
  74397. * You may obtain a copy of the License at
  74398. *
  74399. * http://www.apache.org/licenses/LICENSE-2.0
  74400. *
  74401. * Unless required by applicable law or agreed to in writing, software
  74402. * distributed under the License is distributed on an "AS IS" BASIS,
  74403. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  74404. * See the License for the specific language governing permissions and
  74405. * limitations under the License.
  74406. */
  74407. var __values = void 0 && (void 0).__values || function (o) {
  74408. var s = typeof Symbol === "function" && Symbol.iterator,
  74409. m = s && o[s],
  74410. i = 0;
  74411. if (m) return m.call(o);
  74412. if (o && typeof o.length === "number") return {
  74413. next: function next() {
  74414. if (o && i >= o.length) o = void 0;
  74415. return {
  74416. value: o && o[i++],
  74417. done: !o
  74418. };
  74419. }
  74420. };
  74421. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  74422. };
  74423. // package com.google.zxing.pdf417.decoder.ec;
  74424. /**
  74425. * @author Sean Owen
  74426. * @see com.google.zxing.common.reedsolomon.GenericGFPoly
  74427. */
  74428. var ModulusPoly = /** @class */function () {
  74429. function ModulusPoly(field, coefficients) {
  74430. if (coefficients.length === 0) {
  74431. throw new _IllegalArgumentException.default();
  74432. }
  74433. this.field = field;
  74434. var coefficientsLength = /*int*/coefficients.length;
  74435. if (coefficientsLength > 1 && coefficients[0] === 0) {
  74436. // Leading term must be non-zero for anything except the constant polynomial "0"
  74437. var firstNonZero = /*int*/1;
  74438. while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {
  74439. firstNonZero++;
  74440. }
  74441. if (firstNonZero === coefficientsLength) {
  74442. this.coefficients = new Int32Array([0]);
  74443. } else {
  74444. this.coefficients = new Int32Array(coefficientsLength - firstNonZero);
  74445. _System.default.arraycopy(coefficients, firstNonZero, this.coefficients, 0, this.coefficients.length);
  74446. }
  74447. } else {
  74448. this.coefficients = coefficients;
  74449. }
  74450. }
  74451. ModulusPoly.prototype.getCoefficients = function () {
  74452. return this.coefficients;
  74453. };
  74454. /**
  74455. * @return degree of this polynomial
  74456. */
  74457. ModulusPoly.prototype.getDegree = function () {
  74458. return this.coefficients.length - 1;
  74459. };
  74460. /**
  74461. * @return true iff this polynomial is the monomial "0"
  74462. */
  74463. ModulusPoly.prototype.isZero = function () {
  74464. return this.coefficients[0] === 0;
  74465. };
  74466. /**
  74467. * @return coefficient of x^degree term in this polynomial
  74468. */
  74469. ModulusPoly.prototype.getCoefficient = function (degree) {
  74470. return this.coefficients[this.coefficients.length - 1 - degree];
  74471. };
  74472. /**
  74473. * @return evaluation of this polynomial at a given point
  74474. */
  74475. ModulusPoly.prototype.evaluateAt = function (a) {
  74476. var e_1, _a;
  74477. if (a === 0) {
  74478. // Just return the x^0 coefficient
  74479. return this.getCoefficient(0);
  74480. }
  74481. if (a === 1) {
  74482. // Just the sum of the coefficients
  74483. var sum = /*int*/0;
  74484. try {
  74485. for (var _b = __values(this.coefficients), _c = _b.next(); !_c.done; _c = _b.next()) {
  74486. var coefficient = _c.value /*int*/;
  74487. sum = this.field.add(sum, coefficient);
  74488. }
  74489. } catch (e_1_1) {
  74490. e_1 = {
  74491. error: e_1_1
  74492. };
  74493. } finally {
  74494. try {
  74495. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  74496. } finally {
  74497. if (e_1) throw e_1.error;
  74498. }
  74499. }
  74500. return sum;
  74501. }
  74502. var result = /*int*/this.coefficients[0];
  74503. var size = /*int*/this.coefficients.length;
  74504. for (var i /*int*/ = 1; i < size; i++) {
  74505. result = this.field.add(this.field.multiply(a, result), this.coefficients[i]);
  74506. }
  74507. return result;
  74508. };
  74509. ModulusPoly.prototype.add = function (other) {
  74510. if (!this.field.equals(other.field)) {
  74511. throw new _IllegalArgumentException.default('ModulusPolys do not have same ModulusGF field');
  74512. }
  74513. if (this.isZero()) {
  74514. return other;
  74515. }
  74516. if (other.isZero()) {
  74517. return this;
  74518. }
  74519. var smallerCoefficients = this.coefficients;
  74520. var largerCoefficients = other.coefficients;
  74521. if (smallerCoefficients.length > largerCoefficients.length) {
  74522. var temp = smallerCoefficients;
  74523. smallerCoefficients = largerCoefficients;
  74524. largerCoefficients = temp;
  74525. }
  74526. var sumDiff = new Int32Array(largerCoefficients.length);
  74527. var lengthDiff = /*int*/largerCoefficients.length - smallerCoefficients.length;
  74528. // Copy high-order terms only found in higher-degree polynomial's coefficients
  74529. _System.default.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
  74530. for (var i /*int*/ = lengthDiff; i < largerCoefficients.length; i++) {
  74531. sumDiff[i] = this.field.add(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
  74532. }
  74533. return new ModulusPoly(this.field, sumDiff);
  74534. };
  74535. ModulusPoly.prototype.subtract = function (other) {
  74536. if (!this.field.equals(other.field)) {
  74537. throw new _IllegalArgumentException.default('ModulusPolys do not have same ModulusGF field');
  74538. }
  74539. if (other.isZero()) {
  74540. return this;
  74541. }
  74542. return this.add(other.negative());
  74543. };
  74544. ModulusPoly.prototype.multiply = function (other) {
  74545. if (other instanceof ModulusPoly) {
  74546. return this.multiplyOther(other);
  74547. }
  74548. return this.multiplyScalar(other);
  74549. };
  74550. ModulusPoly.prototype.multiplyOther = function (other) {
  74551. if (!this.field.equals(other.field)) {
  74552. throw new _IllegalArgumentException.default('ModulusPolys do not have same ModulusGF field');
  74553. }
  74554. if (this.isZero() || other.isZero()) {
  74555. // return this.field.getZero();
  74556. return new ModulusPoly(this.field, new Int32Array([0]));
  74557. }
  74558. var aCoefficients = this.coefficients;
  74559. var aLength = /*int*/aCoefficients.length;
  74560. var bCoefficients = other.coefficients;
  74561. var bLength = /*int*/bCoefficients.length;
  74562. var product = new Int32Array(aLength + bLength - 1);
  74563. for (var i /*int*/ = 0; i < aLength; i++) {
  74564. var aCoeff = /*int*/aCoefficients[i];
  74565. for (var j /*int*/ = 0; j < bLength; j++) {
  74566. product[i + j] = this.field.add(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));
  74567. }
  74568. }
  74569. return new ModulusPoly(this.field, product);
  74570. };
  74571. ModulusPoly.prototype.negative = function () {
  74572. var size = /*int*/this.coefficients.length;
  74573. var negativeCoefficients = new Int32Array(size);
  74574. for (var i /*int*/ = 0; i < size; i++) {
  74575. negativeCoefficients[i] = this.field.subtract(0, this.coefficients[i]);
  74576. }
  74577. return new ModulusPoly(this.field, negativeCoefficients);
  74578. };
  74579. ModulusPoly.prototype.multiplyScalar = function (scalar) {
  74580. if (scalar === 0) {
  74581. return new ModulusPoly(this.field, new Int32Array([0]));
  74582. }
  74583. if (scalar === 1) {
  74584. return this;
  74585. }
  74586. var size = /*int*/this.coefficients.length;
  74587. var product = new Int32Array(size);
  74588. for (var i /*int*/ = 0; i < size; i++) {
  74589. product[i] = this.field.multiply(this.coefficients[i], scalar);
  74590. }
  74591. return new ModulusPoly(this.field, product);
  74592. };
  74593. ModulusPoly.prototype.multiplyByMonomial = function (degree, coefficient) {
  74594. if (degree < 0) {
  74595. throw new _IllegalArgumentException.default();
  74596. }
  74597. if (coefficient === 0) {
  74598. return new ModulusPoly(this.field, new Int32Array([0]));
  74599. }
  74600. var size = /*int*/this.coefficients.length;
  74601. var product = new Int32Array(size + degree);
  74602. for (var i /*int*/ = 0; i < size; i++) {
  74603. product[i] = this.field.multiply(this.coefficients[i], coefficient);
  74604. }
  74605. return new ModulusPoly(this.field, product);
  74606. };
  74607. /*
  74608. ModulusPoly[] divide(other: ModulusPoly) {
  74609. if (!field.equals(other.field)) {
  74610. throw new IllegalArgumentException("ModulusPolys do not have same ModulusGF field");
  74611. }
  74612. if (other.isZero()) {
  74613. throw new IllegalArgumentException("Divide by 0");
  74614. }
  74615. let quotient: ModulusPoly = field.getZero();
  74616. let remainder: ModulusPoly = this;
  74617. let denominatorLeadingTerm: /*int/ number = other.getCoefficient(other.getDegree());
  74618. let inverseDenominatorLeadingTerm: /*int/ number = field.inverse(denominatorLeadingTerm);
  74619. while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {
  74620. let degreeDifference: /*int/ number = remainder.getDegree() - other.getDegree();
  74621. let scale: /*int/ number = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);
  74622. let term: ModulusPoly = other.multiplyByMonomial(degreeDifference, scale);
  74623. let iterationQuotient: ModulusPoly = field.buildMonomial(degreeDifference, scale);
  74624. quotient = quotient.add(iterationQuotient);
  74625. remainder = remainder.subtract(term);
  74626. }
  74627. return new ModulusPoly[] { quotient, remainder };
  74628. }
  74629. */
  74630. // @Override
  74631. ModulusPoly.prototype.toString = function () {
  74632. var result = new _StringBuilder.default( /*8 * this.getDegree()*/); // dynamic string size in JS
  74633. for (var degree /*int*/ = this.getDegree(); degree >= 0; degree--) {
  74634. var coefficient = /*int*/this.getCoefficient(degree);
  74635. if (coefficient !== 0) {
  74636. if (coefficient < 0) {
  74637. result.append(' - ');
  74638. coefficient = -coefficient;
  74639. } else {
  74640. if (result.length() > 0) {
  74641. result.append(' + ');
  74642. }
  74643. }
  74644. if (degree === 0 || coefficient !== 1) {
  74645. result.append(coefficient);
  74646. }
  74647. if (degree !== 0) {
  74648. if (degree === 1) {
  74649. result.append('x');
  74650. } else {
  74651. result.append('x^');
  74652. result.append(degree);
  74653. }
  74654. }
  74655. }
  74656. }
  74657. return result.toString();
  74658. };
  74659. return ModulusPoly;
  74660. }();
  74661. var _default = ModulusPoly;
  74662. exports.default = _default;
  74663. /***/ }),
  74664. /* 440 */
  74665. /*!***********************************************************************************************!*\
  74666. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ModulusGF.js ***!
  74667. \***********************************************************************************************/
  74668. /*! no static exports found */
  74669. /***/ (function(module, exports, __webpack_require__) {
  74670. "use strict";
  74671. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  74672. Object.defineProperty(exports, "__esModule", {
  74673. value: true
  74674. });
  74675. exports.default = void 0;
  74676. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../../PDF417Common */ 434));
  74677. var _ModulusPoly = _interopRequireDefault(__webpack_require__(/*! ./ModulusPoly */ 439));
  74678. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../../IllegalArgumentException */ 308));
  74679. var _ModulusBase = _interopRequireDefault(__webpack_require__(/*! ./ModulusBase */ 441));
  74680. /*
  74681. * Copyright 2012 ZXing authors
  74682. *
  74683. * Licensed under the Apache License, Version 2.0 (the "License");
  74684. * you may not use this file except in compliance with the License.
  74685. * You may obtain a copy of the License at
  74686. *
  74687. * http://www.apache.org/licenses/LICENSE-2.0
  74688. *
  74689. * Unless required by applicable law or agreed to in writing, software
  74690. * distributed under the License is distributed on an "AS IS" BASIS,
  74691. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  74692. * See the License for the specific language governing permissions and
  74693. * limitations under the License.
  74694. */
  74695. var __extends = void 0 && (void 0).__extends || function () {
  74696. var _extendStatics = function extendStatics(d, b) {
  74697. _extendStatics = Object.setPrototypeOf || {
  74698. __proto__: []
  74699. } instanceof Array && function (d, b) {
  74700. d.__proto__ = b;
  74701. } || function (d, b) {
  74702. for (var p in b) {
  74703. if (b.hasOwnProperty(p)) d[p] = b[p];
  74704. }
  74705. };
  74706. return _extendStatics(d, b);
  74707. };
  74708. return function (d, b) {
  74709. _extendStatics(d, b);
  74710. function __() {
  74711. this.constructor = d;
  74712. }
  74713. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  74714. };
  74715. }();
  74716. // package com.google.zxing.pdf417.decoder.ec;
  74717. // import com.google.zxing.pdf417.PDF417Common;
  74718. /**
  74719. * <p>A field based on powers of a generator integer, modulo some modulus.</p>
  74720. *
  74721. * @author Sean Owen
  74722. * @see com.google.zxing.common.reedsolomon.GenericGF
  74723. */
  74724. var ModulusGF = /** @class */function (_super) {
  74725. __extends(ModulusGF, _super);
  74726. // private /*final*/ modulus: /*int*/ number;
  74727. function ModulusGF(modulus, generator) {
  74728. var _this = _super.call(this) || this;
  74729. _this.modulus = modulus;
  74730. _this.expTable = new Int32Array(modulus);
  74731. _this.logTable = new Int32Array(modulus);
  74732. var x = /*int*/1;
  74733. for (var i /*int*/ = 0; i < modulus; i++) {
  74734. _this.expTable[i] = x;
  74735. x = x * generator % modulus;
  74736. }
  74737. for (var i /*int*/ = 0; i < modulus - 1; i++) {
  74738. _this.logTable[_this.expTable[i]] = i;
  74739. }
  74740. // logTable[0] == 0 but this should never be used
  74741. _this.zero = new _ModulusPoly.default(_this, new Int32Array([0]));
  74742. _this.one = new _ModulusPoly.default(_this, new Int32Array([1]));
  74743. return _this;
  74744. }
  74745. ModulusGF.prototype.getZero = function () {
  74746. return this.zero;
  74747. };
  74748. ModulusGF.prototype.getOne = function () {
  74749. return this.one;
  74750. };
  74751. ModulusGF.prototype.buildMonomial = function (degree, coefficient) {
  74752. if (degree < 0) {
  74753. throw new _IllegalArgumentException.default();
  74754. }
  74755. if (coefficient === 0) {
  74756. return this.zero;
  74757. }
  74758. var coefficients = new Int32Array(degree + 1);
  74759. coefficients[0] = coefficient;
  74760. return new _ModulusPoly.default(this, coefficients);
  74761. };
  74762. ModulusGF.PDF417_GF = new ModulusGF(_PDF417Common.default.NUMBER_OF_CODEWORDS, 3);
  74763. return ModulusGF;
  74764. }(_ModulusBase.default);
  74765. var _default = ModulusGF;
  74766. exports.default = _default;
  74767. /***/ }),
  74768. /* 441 */
  74769. /*!*************************************************************************************************!*\
  74770. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/ec/ModulusBase.js ***!
  74771. \*************************************************************************************************/
  74772. /*! no static exports found */
  74773. /***/ (function(module, exports, __webpack_require__) {
  74774. "use strict";
  74775. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  74776. Object.defineProperty(exports, "__esModule", {
  74777. value: true
  74778. });
  74779. exports.default = void 0;
  74780. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../../IllegalArgumentException */ 308));
  74781. var _ArithmeticException = _interopRequireDefault(__webpack_require__(/*! ../../../ArithmeticException */ 341));
  74782. var ModulusBase = /** @class */function () {
  74783. function ModulusBase() {}
  74784. ModulusBase.prototype.add = function (a, b) {
  74785. return (a + b) % this.modulus;
  74786. };
  74787. ModulusBase.prototype.subtract = function (a, b) {
  74788. return (this.modulus + a - b) % this.modulus;
  74789. };
  74790. ModulusBase.prototype.exp = function (a) {
  74791. return this.expTable[a];
  74792. };
  74793. ModulusBase.prototype.log = function (a) {
  74794. if (a === 0) {
  74795. throw new _IllegalArgumentException.default();
  74796. }
  74797. return this.logTable[a];
  74798. };
  74799. ModulusBase.prototype.inverse = function (a) {
  74800. if (a === 0) {
  74801. throw new _ArithmeticException.default();
  74802. }
  74803. return this.expTable[this.modulus - this.logTable[a] - 1];
  74804. };
  74805. ModulusBase.prototype.multiply = function (a, b) {
  74806. if (a === 0 || b === 0) {
  74807. return 0;
  74808. }
  74809. return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.modulus - 1)];
  74810. };
  74811. ModulusBase.prototype.getSize = function () {
  74812. return this.modulus;
  74813. };
  74814. ModulusBase.prototype.equals = function (o) {
  74815. return o === this;
  74816. };
  74817. return ModulusBase;
  74818. }();
  74819. var _default = ModulusBase;
  74820. exports.default = _default;
  74821. /***/ }),
  74822. /* 442 */
  74823. /*!**********************************************************************************************!*\
  74824. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/BoundingBox.js ***!
  74825. \**********************************************************************************************/
  74826. /*! no static exports found */
  74827. /***/ (function(module, exports, __webpack_require__) {
  74828. "use strict";
  74829. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  74830. Object.defineProperty(exports, "__esModule", {
  74831. value: true
  74832. });
  74833. exports.default = void 0;
  74834. var _NotFoundException = _interopRequireDefault(__webpack_require__(/*! ../../NotFoundException */ 327));
  74835. var _ResultPoint = _interopRequireDefault(__webpack_require__(/*! ../../ResultPoint */ 346));
  74836. /*
  74837. * Copyright 2013 ZXing authors
  74838. *
  74839. * Licensed under the Apache License, Version 2.0 (the "License");
  74840. * you may not use this file except in compliance with the License.
  74841. * You may obtain a copy of the License at
  74842. *
  74843. * http://www.apache.org/licenses/LICENSE-2.0
  74844. *
  74845. * Unless required by applicable law or agreed to in writing, software
  74846. * distributed under the License is distributed on an "AS IS" BASIS,
  74847. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  74848. * See the License for the specific language governing permissions and
  74849. * limitations under the License.
  74850. */
  74851. // package com.google.zxing.pdf417.decoder;
  74852. // import com.google.zxing.NotFoundException;
  74853. // import com.google.zxing.ResultPoint;
  74854. /**
  74855. * @author Guenther Grau
  74856. */
  74857. var BoundingBox = /** @class */function () {
  74858. function BoundingBox(image, topLeft, bottomLeft, topRight, bottomRight) {
  74859. if (image instanceof BoundingBox) {
  74860. this.constructor_2(image);
  74861. } else {
  74862. this.constructor_1(image, topLeft, bottomLeft, topRight, bottomRight);
  74863. }
  74864. }
  74865. /**
  74866. *
  74867. * @param image
  74868. * @param topLeft
  74869. * @param bottomLeft
  74870. * @param topRight
  74871. * @param bottomRight
  74872. *
  74873. * @throws NotFoundException
  74874. */
  74875. BoundingBox.prototype.constructor_1 = function (image, topLeft, bottomLeft, topRight, bottomRight) {
  74876. var leftUnspecified = topLeft == null || bottomLeft == null;
  74877. var rightUnspecified = topRight == null || bottomRight == null;
  74878. if (leftUnspecified && rightUnspecified) {
  74879. throw new _NotFoundException.default();
  74880. }
  74881. if (leftUnspecified) {
  74882. topLeft = new _ResultPoint.default(0, topRight.getY());
  74883. bottomLeft = new _ResultPoint.default(0, bottomRight.getY());
  74884. } else if (rightUnspecified) {
  74885. topRight = new _ResultPoint.default(image.getWidth() - 1, topLeft.getY());
  74886. bottomRight = new _ResultPoint.default(image.getWidth() - 1, bottomLeft.getY());
  74887. }
  74888. this.image = image;
  74889. this.topLeft = topLeft;
  74890. this.bottomLeft = bottomLeft;
  74891. this.topRight = topRight;
  74892. this.bottomRight = bottomRight;
  74893. this.minX = Math.trunc(Math.min(topLeft.getX(), bottomLeft.getX()));
  74894. this.maxX = Math.trunc(Math.max(topRight.getX(), bottomRight.getX()));
  74895. this.minY = Math.trunc(Math.min(topLeft.getY(), topRight.getY()));
  74896. this.maxY = Math.trunc(Math.max(bottomLeft.getY(), bottomRight.getY()));
  74897. };
  74898. BoundingBox.prototype.constructor_2 = function (boundingBox) {
  74899. this.image = boundingBox.image;
  74900. this.topLeft = boundingBox.getTopLeft();
  74901. this.bottomLeft = boundingBox.getBottomLeft();
  74902. this.topRight = boundingBox.getTopRight();
  74903. this.bottomRight = boundingBox.getBottomRight();
  74904. this.minX = boundingBox.getMinX();
  74905. this.maxX = boundingBox.getMaxX();
  74906. this.minY = boundingBox.getMinY();
  74907. this.maxY = boundingBox.getMaxY();
  74908. };
  74909. /**
  74910. * @throws NotFoundException
  74911. */
  74912. BoundingBox.merge = function (leftBox, rightBox) {
  74913. if (leftBox == null) {
  74914. return rightBox;
  74915. }
  74916. if (rightBox == null) {
  74917. return leftBox;
  74918. }
  74919. return new BoundingBox(leftBox.image, leftBox.topLeft, leftBox.bottomLeft, rightBox.topRight, rightBox.bottomRight);
  74920. };
  74921. /**
  74922. * @throws NotFoundException
  74923. */
  74924. BoundingBox.prototype.addMissingRows = function (missingStartRows, missingEndRows, isLeft) {
  74925. var newTopLeft = this.topLeft;
  74926. var newBottomLeft = this.bottomLeft;
  74927. var newTopRight = this.topRight;
  74928. var newBottomRight = this.bottomRight;
  74929. if (missingStartRows > 0) {
  74930. var top_1 = isLeft ? this.topLeft : this.topRight;
  74931. var newMinY = Math.trunc(top_1.getY() - missingStartRows);
  74932. if (newMinY < 0) {
  74933. newMinY = 0;
  74934. }
  74935. var newTop = new _ResultPoint.default(top_1.getX(), newMinY);
  74936. if (isLeft) {
  74937. newTopLeft = newTop;
  74938. } else {
  74939. newTopRight = newTop;
  74940. }
  74941. }
  74942. if (missingEndRows > 0) {
  74943. var bottom = isLeft ? this.bottomLeft : this.bottomRight;
  74944. var newMaxY = Math.trunc(bottom.getY() + missingEndRows);
  74945. if (newMaxY >= this.image.getHeight()) {
  74946. newMaxY = this.image.getHeight() - 1;
  74947. }
  74948. var newBottom = new _ResultPoint.default(bottom.getX(), newMaxY);
  74949. if (isLeft) {
  74950. newBottomLeft = newBottom;
  74951. } else {
  74952. newBottomRight = newBottom;
  74953. }
  74954. }
  74955. return new BoundingBox(this.image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);
  74956. };
  74957. BoundingBox.prototype.getMinX = function () {
  74958. return this.minX;
  74959. };
  74960. BoundingBox.prototype.getMaxX = function () {
  74961. return this.maxX;
  74962. };
  74963. BoundingBox.prototype.getMinY = function () {
  74964. return this.minY;
  74965. };
  74966. BoundingBox.prototype.getMaxY = function () {
  74967. return this.maxY;
  74968. };
  74969. BoundingBox.prototype.getTopLeft = function () {
  74970. return this.topLeft;
  74971. };
  74972. BoundingBox.prototype.getTopRight = function () {
  74973. return this.topRight;
  74974. };
  74975. BoundingBox.prototype.getBottomLeft = function () {
  74976. return this.bottomLeft;
  74977. };
  74978. BoundingBox.prototype.getBottomRight = function () {
  74979. return this.bottomRight;
  74980. };
  74981. return BoundingBox;
  74982. }();
  74983. var _default = BoundingBox;
  74984. exports.default = _default;
  74985. /***/ }),
  74986. /* 443 */
  74987. /*!********************************************************************************************************************!*\
  74988. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DetectionResultRowIndicatorColumn.js ***!
  74989. \********************************************************************************************************************/
  74990. /*! no static exports found */
  74991. /***/ (function(module, exports, __webpack_require__) {
  74992. "use strict";
  74993. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  74994. Object.defineProperty(exports, "__esModule", {
  74995. value: true
  74996. });
  74997. exports.default = void 0;
  74998. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
  74999. var _BarcodeMetadata = _interopRequireDefault(__webpack_require__(/*! ./BarcodeMetadata */ 444));
  75000. var _DetectionResultColumn = _interopRequireDefault(__webpack_require__(/*! ./DetectionResultColumn */ 445));
  75001. var _BarcodeValue = _interopRequireDefault(__webpack_require__(/*! ./BarcodeValue */ 447));
  75002. /*
  75003. * Copyright 2013 ZXing authors
  75004. *
  75005. * Licensed under the Apache License, Version 2.0 (the "License");
  75006. * you may not use this file except in compliance with the License.
  75007. * You may obtain a copy of the License at
  75008. *
  75009. * http://www.apache.org/licenses/LICENSE-2.0
  75010. *
  75011. * Unless required by applicable law or agreed to in writing, software
  75012. * distributed under the License is distributed on an "AS IS" BASIS,
  75013. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  75014. * See the License for the specific language governing permissions and
  75015. * limitations under the License.
  75016. */
  75017. var __extends = void 0 && (void 0).__extends || function () {
  75018. var _extendStatics = function extendStatics(d, b) {
  75019. _extendStatics = Object.setPrototypeOf || {
  75020. __proto__: []
  75021. } instanceof Array && function (d, b) {
  75022. d.__proto__ = b;
  75023. } || function (d, b) {
  75024. for (var p in b) {
  75025. if (b.hasOwnProperty(p)) d[p] = b[p];
  75026. }
  75027. };
  75028. return _extendStatics(d, b);
  75029. };
  75030. return function (d, b) {
  75031. _extendStatics(d, b);
  75032. function __() {
  75033. this.constructor = d;
  75034. }
  75035. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  75036. };
  75037. }();
  75038. var __values = void 0 && (void 0).__values || function (o) {
  75039. var s = typeof Symbol === "function" && Symbol.iterator,
  75040. m = s && o[s],
  75041. i = 0;
  75042. if (m) return m.call(o);
  75043. if (o && typeof o.length === "number") return {
  75044. next: function next() {
  75045. if (o && i >= o.length) o = void 0;
  75046. return {
  75047. value: o && o[i++],
  75048. done: !o
  75049. };
  75050. }
  75051. };
  75052. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  75053. };
  75054. // import com.google.zxing.pdf417.PDF417Common;
  75055. /**
  75056. * @author Guenther Grau
  75057. */
  75058. var DetectionResultRowIndicatorColumn = /** @class */function (_super) {
  75059. __extends(DetectionResultRowIndicatorColumn, _super);
  75060. function DetectionResultRowIndicatorColumn(boundingBox, isLeft) {
  75061. var _this = _super.call(this, boundingBox) || this;
  75062. _this._isLeft = isLeft;
  75063. return _this;
  75064. }
  75065. DetectionResultRowIndicatorColumn.prototype.setRowNumbers = function () {
  75066. var e_1, _a;
  75067. try {
  75068. for (var _b = __values(this.getCodewords()), _c = _b.next(); !_c.done; _c = _b.next()) {
  75069. var codeword = _c.value /*Codeword*/;
  75070. if (codeword != null) {
  75071. codeword.setRowNumberAsRowIndicatorColumn();
  75072. }
  75073. }
  75074. } catch (e_1_1) {
  75075. e_1 = {
  75076. error: e_1_1
  75077. };
  75078. } finally {
  75079. try {
  75080. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  75081. } finally {
  75082. if (e_1) throw e_1.error;
  75083. }
  75084. }
  75085. };
  75086. // TODO implement properly
  75087. // TODO maybe we should add missing codewords to store the correct row number to make
  75088. // finding row numbers for other columns easier
  75089. // use row height count to make detection of invalid row numbers more reliable
  75090. DetectionResultRowIndicatorColumn.prototype.adjustCompleteIndicatorColumnRowNumbers = function (barcodeMetadata) {
  75091. var codewords = this.getCodewords();
  75092. this.setRowNumbers();
  75093. this.removeIncorrectCodewords(codewords, barcodeMetadata);
  75094. var boundingBox = this.getBoundingBox();
  75095. var top = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
  75096. var bottom = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
  75097. var firstRow = this.imageRowToCodewordIndex(Math.trunc(top.getY()));
  75098. var lastRow = this.imageRowToCodewordIndex(Math.trunc(bottom.getY()));
  75099. // We need to be careful using the average row height. Barcode could be skewed so that we have smaller and
  75100. // taller rows
  75101. // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();
  75102. var barcodeRow = -1;
  75103. var maxRowHeight = 1;
  75104. var currentRowHeight = 0;
  75105. for (var codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {
  75106. if (codewords[codewordsRow] == null) {
  75107. continue;
  75108. }
  75109. var codeword = codewords[codewordsRow];
  75110. // float expectedRowNumber = (codewordsRow - firstRow) / averageRowHeight;
  75111. // if (Math.abs(codeword.getRowNumber() - expectedRowNumber) > 2) {
  75112. // SimpleLog.log(LEVEL.WARNING,
  75113. // "Removing codeword, rowNumberSkew too high, codeword[" + codewordsRow + "]: Expected Row: " +
  75114. // expectedRowNumber + ", RealRow: " + codeword.getRowNumber() + ", value: " + codeword.getValue());
  75115. // codewords[codewordsRow] = null;
  75116. // }
  75117. var rowDifference = codeword.getRowNumber() - barcodeRow;
  75118. // TODO improve handling with case where first row indicator doesn't start with 0
  75119. if (rowDifference === 0) {
  75120. currentRowHeight++;
  75121. } else if (rowDifference === 1) {
  75122. maxRowHeight = Math.max(maxRowHeight, currentRowHeight);
  75123. currentRowHeight = 1;
  75124. barcodeRow = codeword.getRowNumber();
  75125. } else if (rowDifference < 0 || codeword.getRowNumber() >= barcodeMetadata.getRowCount() || rowDifference > codewordsRow) {
  75126. codewords[codewordsRow] = null;
  75127. } else {
  75128. var checkedRows = void 0;
  75129. if (maxRowHeight > 2) {
  75130. checkedRows = (maxRowHeight - 2) * rowDifference;
  75131. } else {
  75132. checkedRows = rowDifference;
  75133. }
  75134. var closePreviousCodewordFound = checkedRows >= codewordsRow;
  75135. for (var i /*int*/ = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {
  75136. // there must be (height * rowDifference) number of codewords missing. For now we assume height = 1.
  75137. // This should hopefully get rid of most problems already.
  75138. closePreviousCodewordFound = codewords[codewordsRow - i] != null;
  75139. }
  75140. if (closePreviousCodewordFound) {
  75141. codewords[codewordsRow] = null;
  75142. } else {
  75143. barcodeRow = codeword.getRowNumber();
  75144. currentRowHeight = 1;
  75145. }
  75146. }
  75147. }
  75148. // return (int) (averageRowHeight + 0.5);
  75149. };
  75150. DetectionResultRowIndicatorColumn.prototype.getRowHeights = function () {
  75151. var e_2, _a;
  75152. var barcodeMetadata = this.getBarcodeMetadata();
  75153. if (barcodeMetadata == null) {
  75154. return null;
  75155. }
  75156. this.adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata);
  75157. var result = new Int32Array(barcodeMetadata.getRowCount());
  75158. try {
  75159. for (var _b = __values(this.getCodewords()), _c = _b.next(); !_c.done; _c = _b.next()) {
  75160. var codeword = _c.value /*Codeword*/;
  75161. if (codeword != null) {
  75162. var rowNumber = codeword.getRowNumber();
  75163. if (rowNumber >= result.length) {
  75164. // We have more rows than the barcode metadata allows for, ignore them.
  75165. continue;
  75166. }
  75167. result[rowNumber]++;
  75168. } // else throw exception?
  75169. }
  75170. } catch (e_2_1) {
  75171. e_2 = {
  75172. error: e_2_1
  75173. };
  75174. } finally {
  75175. try {
  75176. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  75177. } finally {
  75178. if (e_2) throw e_2.error;
  75179. }
  75180. }
  75181. return result;
  75182. };
  75183. // TODO maybe we should add missing codewords to store the correct row number to make
  75184. // finding row numbers for other columns easier
  75185. // use row height count to make detection of invalid row numbers more reliable
  75186. DetectionResultRowIndicatorColumn.prototype.adjustIncompleteIndicatorColumnRowNumbers = function (barcodeMetadata) {
  75187. var boundingBox = this.getBoundingBox();
  75188. var top = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
  75189. var bottom = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
  75190. var firstRow = this.imageRowToCodewordIndex(Math.trunc(top.getY()));
  75191. var lastRow = this.imageRowToCodewordIndex(Math.trunc(bottom.getY()));
  75192. // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();
  75193. var codewords = this.getCodewords();
  75194. var barcodeRow = -1;
  75195. var maxRowHeight = 1;
  75196. var currentRowHeight = 0;
  75197. for (var codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {
  75198. if (codewords[codewordsRow] == null) {
  75199. continue;
  75200. }
  75201. var codeword = codewords[codewordsRow];
  75202. codeword.setRowNumberAsRowIndicatorColumn();
  75203. var rowDifference = codeword.getRowNumber() - barcodeRow;
  75204. // TODO improve handling with case where first row indicator doesn't start with 0
  75205. if (rowDifference === 0) {
  75206. currentRowHeight++;
  75207. } else if (rowDifference === 1) {
  75208. maxRowHeight = Math.max(maxRowHeight, currentRowHeight);
  75209. currentRowHeight = 1;
  75210. barcodeRow = codeword.getRowNumber();
  75211. } else if (codeword.getRowNumber() >= barcodeMetadata.getRowCount()) {
  75212. codewords[codewordsRow] = null;
  75213. } else {
  75214. barcodeRow = codeword.getRowNumber();
  75215. currentRowHeight = 1;
  75216. }
  75217. }
  75218. // return (int) (averageRowHeight + 0.5);
  75219. };
  75220. DetectionResultRowIndicatorColumn.prototype.getBarcodeMetadata = function () {
  75221. var e_3, _a;
  75222. var codewords = this.getCodewords();
  75223. var barcodeColumnCount = new _BarcodeValue.default();
  75224. var barcodeRowCountUpperPart = new _BarcodeValue.default();
  75225. var barcodeRowCountLowerPart = new _BarcodeValue.default();
  75226. var barcodeECLevel = new _BarcodeValue.default();
  75227. try {
  75228. for (var codewords_1 = __values(codewords), codewords_1_1 = codewords_1.next(); !codewords_1_1.done; codewords_1_1 = codewords_1.next()) {
  75229. var codeword = codewords_1_1.value /*Codeword*/;
  75230. if (codeword == null) {
  75231. continue;
  75232. }
  75233. codeword.setRowNumberAsRowIndicatorColumn();
  75234. var rowIndicatorValue = codeword.getValue() % 30;
  75235. var codewordRowNumber = codeword.getRowNumber();
  75236. if (!this._isLeft) {
  75237. codewordRowNumber += 2;
  75238. }
  75239. switch (codewordRowNumber % 3) {
  75240. case 0:
  75241. barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);
  75242. break;
  75243. case 1:
  75244. barcodeECLevel.setValue(rowIndicatorValue / 3);
  75245. barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);
  75246. break;
  75247. case 2:
  75248. barcodeColumnCount.setValue(rowIndicatorValue + 1);
  75249. break;
  75250. }
  75251. }
  75252. } catch (e_3_1) {
  75253. e_3 = {
  75254. error: e_3_1
  75255. };
  75256. } finally {
  75257. try {
  75258. if (codewords_1_1 && !codewords_1_1.done && (_a = codewords_1.return)) _a.call(codewords_1);
  75259. } finally {
  75260. if (e_3) throw e_3.error;
  75261. }
  75262. }
  75263. // Maybe we should check if we have ambiguous values?
  75264. if (barcodeColumnCount.getValue().length === 0 || barcodeRowCountUpperPart.getValue().length === 0 || barcodeRowCountLowerPart.getValue().length === 0 || barcodeECLevel.getValue().length === 0 || barcodeColumnCount.getValue()[0] < 1 || barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < _PDF417Common.default.MIN_ROWS_IN_BARCODE || barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > _PDF417Common.default.MAX_ROWS_IN_BARCODE) {
  75265. return null;
  75266. }
  75267. var barcodeMetadata = new _BarcodeMetadata.default(barcodeColumnCount.getValue()[0], barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);
  75268. this.removeIncorrectCodewords(codewords, barcodeMetadata);
  75269. return barcodeMetadata;
  75270. };
  75271. DetectionResultRowIndicatorColumn.prototype.removeIncorrectCodewords = function (codewords, barcodeMetadata) {
  75272. // Remove codewords which do not match the metadata
  75273. // TODO Maybe we should keep the incorrect codewords for the start and end positions?
  75274. for (var codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {
  75275. var codeword = codewords[codewordRow];
  75276. if (codewords[codewordRow] == null) {
  75277. continue;
  75278. }
  75279. var rowIndicatorValue = codeword.getValue() % 30;
  75280. var codewordRowNumber = codeword.getRowNumber();
  75281. if (codewordRowNumber > barcodeMetadata.getRowCount()) {
  75282. codewords[codewordRow] = null;
  75283. continue;
  75284. }
  75285. if (!this._isLeft) {
  75286. codewordRowNumber += 2;
  75287. }
  75288. switch (codewordRowNumber % 3) {
  75289. case 0:
  75290. if (rowIndicatorValue * 3 + 1 !== barcodeMetadata.getRowCountUpperPart()) {
  75291. codewords[codewordRow] = null;
  75292. }
  75293. break;
  75294. case 1:
  75295. if (Math.trunc(rowIndicatorValue / 3) !== barcodeMetadata.getErrorCorrectionLevel() || rowIndicatorValue % 3 !== barcodeMetadata.getRowCountLowerPart()) {
  75296. codewords[codewordRow] = null;
  75297. }
  75298. break;
  75299. case 2:
  75300. if (rowIndicatorValue + 1 !== barcodeMetadata.getColumnCount()) {
  75301. codewords[codewordRow] = null;
  75302. }
  75303. break;
  75304. }
  75305. }
  75306. };
  75307. DetectionResultRowIndicatorColumn.prototype.isLeft = function () {
  75308. return this._isLeft;
  75309. };
  75310. // @Override
  75311. DetectionResultRowIndicatorColumn.prototype.toString = function () {
  75312. return 'IsLeft: ' + this._isLeft + '\n' + _super.prototype.toString.call(this);
  75313. };
  75314. return DetectionResultRowIndicatorColumn;
  75315. }(_DetectionResultColumn.default);
  75316. var _default = DetectionResultRowIndicatorColumn;
  75317. exports.default = _default;
  75318. /***/ }),
  75319. /* 444 */
  75320. /*!**************************************************************************************************!*\
  75321. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/BarcodeMetadata.js ***!
  75322. \**************************************************************************************************/
  75323. /*! no static exports found */
  75324. /***/ (function(module, exports, __webpack_require__) {
  75325. "use strict";
  75326. Object.defineProperty(exports, "__esModule", {
  75327. value: true
  75328. });
  75329. exports.default = void 0;
  75330. /*
  75331. * Copyright 2013 ZXing authors
  75332. *
  75333. * Licensed under the Apache License, Version 2.0 (the "License");
  75334. * you may not use this file except in compliance with the License.
  75335. * You may obtain a copy of the License at
  75336. *
  75337. * http://www.apache.org/licenses/LICENSE-2.0
  75338. *
  75339. * Unless required by applicable law or agreed to in writing, software
  75340. * distributed under the License is distributed on an "AS IS" BASIS,
  75341. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  75342. * See the License for the specific language governing permissions and
  75343. * limitations under the License.
  75344. */
  75345. // package com.google.zxing.pdf417.decoder;
  75346. /**
  75347. * @author Guenther Grau
  75348. */
  75349. var BarcodeMetadata = /** @class */function () {
  75350. function BarcodeMetadata(columnCount, rowCountUpperPart, rowCountLowerPart, errorCorrectionLevel) {
  75351. this.columnCount = columnCount;
  75352. this.errorCorrectionLevel = errorCorrectionLevel;
  75353. this.rowCountUpperPart = rowCountUpperPart;
  75354. this.rowCountLowerPart = rowCountLowerPart;
  75355. this.rowCount = rowCountUpperPart + rowCountLowerPart;
  75356. }
  75357. BarcodeMetadata.prototype.getColumnCount = function () {
  75358. return this.columnCount;
  75359. };
  75360. BarcodeMetadata.prototype.getErrorCorrectionLevel = function () {
  75361. return this.errorCorrectionLevel;
  75362. };
  75363. BarcodeMetadata.prototype.getRowCount = function () {
  75364. return this.rowCount;
  75365. };
  75366. BarcodeMetadata.prototype.getRowCountUpperPart = function () {
  75367. return this.rowCountUpperPart;
  75368. };
  75369. BarcodeMetadata.prototype.getRowCountLowerPart = function () {
  75370. return this.rowCountLowerPart;
  75371. };
  75372. return BarcodeMetadata;
  75373. }();
  75374. var _default = BarcodeMetadata;
  75375. exports.default = _default;
  75376. /***/ }),
  75377. /* 445 */
  75378. /*!********************************************************************************************************!*\
  75379. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DetectionResultColumn.js ***!
  75380. \********************************************************************************************************/
  75381. /*! no static exports found */
  75382. /***/ (function(module, exports, __webpack_require__) {
  75383. "use strict";
  75384. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  75385. Object.defineProperty(exports, "__esModule", {
  75386. value: true
  75387. });
  75388. exports.default = void 0;
  75389. var _Formatter = _interopRequireDefault(__webpack_require__(/*! ../../util/Formatter */ 446));
  75390. var _BoundingBox = _interopRequireDefault(__webpack_require__(/*! ./BoundingBox */ 442));
  75391. /*
  75392. * Copyright 2013 ZXing authors
  75393. *
  75394. * Licensed under the Apache License, Version 2.0 (the "License");
  75395. * you may not use this file except in compliance with the License.
  75396. * You may obtain a copy of the License at
  75397. *
  75398. * http://www.apache.org/licenses/LICENSE-2.0
  75399. *
  75400. * Unless required by applicable law or agreed to in writing, software
  75401. * distributed under the License is distributed on an "AS IS" BASIS,
  75402. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  75403. * See the License for the specific language governing permissions and
  75404. * limitations under the License.
  75405. */
  75406. var __values = void 0 && (void 0).__values || function (o) {
  75407. var s = typeof Symbol === "function" && Symbol.iterator,
  75408. m = s && o[s],
  75409. i = 0;
  75410. if (m) return m.call(o);
  75411. if (o && typeof o.length === "number") return {
  75412. next: function next() {
  75413. if (o && i >= o.length) o = void 0;
  75414. return {
  75415. value: o && o[i++],
  75416. done: !o
  75417. };
  75418. }
  75419. };
  75420. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  75421. };
  75422. // package com.google.zxing.pdf417.decoder;
  75423. // import java.util.Formatter;
  75424. /**
  75425. * @author Guenther Grau
  75426. */
  75427. var DetectionResultColumn = /** @class */function () {
  75428. function DetectionResultColumn(boundingBox) {
  75429. this.boundingBox = new _BoundingBox.default(boundingBox);
  75430. // this.codewords = new Codeword[boundingBox.getMaxY() - boundingBox.getMinY() + 1];
  75431. this.codewords = new Array(boundingBox.getMaxY() - boundingBox.getMinY() + 1);
  75432. }
  75433. /*final*/
  75434. DetectionResultColumn.prototype.getCodewordNearby = function (imageRow) {
  75435. var codeword = this.getCodeword(imageRow);
  75436. if (codeword != null) {
  75437. return codeword;
  75438. }
  75439. for (var i = 1; i < DetectionResultColumn.MAX_NEARBY_DISTANCE; i++) {
  75440. var nearImageRow = this.imageRowToCodewordIndex(imageRow) - i;
  75441. if (nearImageRow >= 0) {
  75442. codeword = this.codewords[nearImageRow];
  75443. if (codeword != null) {
  75444. return codeword;
  75445. }
  75446. }
  75447. nearImageRow = this.imageRowToCodewordIndex(imageRow) + i;
  75448. if (nearImageRow < this.codewords.length) {
  75449. codeword = this.codewords[nearImageRow];
  75450. if (codeword != null) {
  75451. return codeword;
  75452. }
  75453. }
  75454. }
  75455. return null;
  75456. };
  75457. /*final int*/
  75458. DetectionResultColumn.prototype.imageRowToCodewordIndex = function (imageRow) {
  75459. return imageRow - this.boundingBox.getMinY();
  75460. };
  75461. /*final void*/
  75462. DetectionResultColumn.prototype.setCodeword = function (imageRow, codeword) {
  75463. this.codewords[this.imageRowToCodewordIndex(imageRow)] = codeword;
  75464. };
  75465. /*final*/
  75466. DetectionResultColumn.prototype.getCodeword = function (imageRow) {
  75467. return this.codewords[this.imageRowToCodewordIndex(imageRow)];
  75468. };
  75469. /*final*/
  75470. DetectionResultColumn.prototype.getBoundingBox = function () {
  75471. return this.boundingBox;
  75472. };
  75473. /*final*/
  75474. DetectionResultColumn.prototype.getCodewords = function () {
  75475. return this.codewords;
  75476. };
  75477. // @Override
  75478. DetectionResultColumn.prototype.toString = function () {
  75479. var e_1, _a;
  75480. var formatter = new _Formatter.default();
  75481. var row = 0;
  75482. try {
  75483. for (var _b = __values(this.codewords), _c = _b.next(); !_c.done; _c = _b.next()) {
  75484. var codeword = _c.value;
  75485. if (codeword == null) {
  75486. formatter.format('%3d: | %n', row++);
  75487. continue;
  75488. }
  75489. formatter.format('%3d: %3d|%3d%n', row++, codeword.getRowNumber(), codeword.getValue());
  75490. }
  75491. } catch (e_1_1) {
  75492. e_1 = {
  75493. error: e_1_1
  75494. };
  75495. } finally {
  75496. try {
  75497. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  75498. } finally {
  75499. if (e_1) throw e_1.error;
  75500. }
  75501. }
  75502. return formatter.toString();
  75503. };
  75504. DetectionResultColumn.MAX_NEARBY_DISTANCE = 5;
  75505. return DetectionResultColumn;
  75506. }();
  75507. var _default = DetectionResultColumn;
  75508. exports.default = _default;
  75509. /***/ }),
  75510. /* 446 */
  75511. /*!**********************************************************************************!*\
  75512. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Formatter.js ***!
  75513. \**********************************************************************************/
  75514. /*! no static exports found */
  75515. /***/ (function(module, exports, __webpack_require__) {
  75516. "use strict";
  75517. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  75518. Object.defineProperty(exports, "__esModule", {
  75519. value: true
  75520. });
  75521. exports.default = void 0;
  75522. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  75523. /**
  75524. * Java Formatter class polyfill that works in the JS way.
  75525. */
  75526. var Formatter = /** @class */function () {
  75527. function Formatter() {
  75528. this.buffer = '';
  75529. }
  75530. /**
  75531. *
  75532. * @see https://stackoverflow.com/a/13439711/4367683
  75533. *
  75534. * @param str
  75535. * @param arr
  75536. */
  75537. Formatter.form = function (str, arr) {
  75538. var i = -1;
  75539. function callback(exp, p0, p1, p2, p3, p4) {
  75540. if (exp === '%%') return '%';
  75541. if (arr[++i] === undefined) return undefined;
  75542. exp = p2 ? parseInt(p2.substr(1)) : undefined;
  75543. var base = p3 ? parseInt(p3.substr(1)) : undefined;
  75544. var val;
  75545. switch (p4) {
  75546. case 's':
  75547. val = arr[i];
  75548. break;
  75549. case 'c':
  75550. val = arr[i][0];
  75551. break;
  75552. case 'f':
  75553. val = parseFloat(arr[i]).toFixed(exp);
  75554. break;
  75555. case 'p':
  75556. val = parseFloat(arr[i]).toPrecision(exp);
  75557. break;
  75558. case 'e':
  75559. val = parseFloat(arr[i]).toExponential(exp);
  75560. break;
  75561. case 'x':
  75562. val = parseInt(arr[i]).toString(base ? base : 16);
  75563. break;
  75564. case 'd':
  75565. val = parseFloat(parseInt(arr[i], base ? base : 10).toPrecision(exp)).toFixed(0);
  75566. break;
  75567. }
  75568. val = (0, _typeof2.default)(val) === 'object' ? JSON.stringify(val) : (+val).toString(base);
  75569. var size = parseInt(p1); /* padding size */
  75570. var ch = p1 && p1[0] + '' === '0' ? '0' : ' '; /* isnull? */
  75571. while (val.length < size) {
  75572. val = p0 !== undefined ? val + ch : ch + val;
  75573. } /* isminus? */
  75574. return val;
  75575. }
  75576. var regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
  75577. return str.replace(regex, callback);
  75578. };
  75579. /**
  75580. *
  75581. * @param append The new string to append.
  75582. * @param args Argumets values to be formated.
  75583. */
  75584. Formatter.prototype.format = function (append) {
  75585. var args = [];
  75586. for (var _i = 1; _i < arguments.length; _i++) {
  75587. args[_i - 1] = arguments[_i];
  75588. }
  75589. this.buffer += Formatter.form(append, args);
  75590. };
  75591. /**
  75592. * Returns the Formatter string value.
  75593. */
  75594. Formatter.prototype.toString = function () {
  75595. return this.buffer;
  75596. };
  75597. return Formatter;
  75598. }();
  75599. var _default = Formatter;
  75600. exports.default = _default;
  75601. /***/ }),
  75602. /* 447 */
  75603. /*!***********************************************************************************************!*\
  75604. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/BarcodeValue.js ***!
  75605. \***********************************************************************************************/
  75606. /*! no static exports found */
  75607. /***/ (function(module, exports, __webpack_require__) {
  75608. "use strict";
  75609. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  75610. Object.defineProperty(exports, "__esModule", {
  75611. value: true
  75612. });
  75613. exports.default = void 0;
  75614. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
  75615. /*
  75616. * Copyright 2013 ZXing authors
  75617. *
  75618. * Licensed under the Apache License, Version 2.0 (the "License");
  75619. * you may not use this file except in compliance with the License.
  75620. * You may obtain a copy of the License at
  75621. *
  75622. * http://www.apache.org/licenses/LICENSE-2.0
  75623. *
  75624. * Unless required by applicable law or agreed to in writing, software
  75625. * distributed under the License is distributed on an "AS IS" BASIS,
  75626. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  75627. * See the License for the specific language governing permissions and
  75628. * limitations under the License.
  75629. */
  75630. var __values = void 0 && (void 0).__values || function (o) {
  75631. var s = typeof Symbol === "function" && Symbol.iterator,
  75632. m = s && o[s],
  75633. i = 0;
  75634. if (m) return m.call(o);
  75635. if (o && typeof o.length === "number") return {
  75636. next: function next() {
  75637. if (o && i >= o.length) o = void 0;
  75638. return {
  75639. value: o && o[i++],
  75640. done: !o
  75641. };
  75642. }
  75643. };
  75644. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  75645. };
  75646. var __read = void 0 && (void 0).__read || function (o, n) {
  75647. var m = typeof Symbol === "function" && o[Symbol.iterator];
  75648. if (!m) return o;
  75649. var i = m.call(o),
  75650. r,
  75651. ar = [],
  75652. e;
  75653. try {
  75654. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  75655. ar.push(r.value);
  75656. }
  75657. } catch (error) {
  75658. e = {
  75659. error: error
  75660. };
  75661. } finally {
  75662. try {
  75663. if (r && !r.done && (m = i["return"])) m.call(i);
  75664. } finally {
  75665. if (e) throw e.error;
  75666. }
  75667. }
  75668. return ar;
  75669. };
  75670. // package com.google.zxing.pdf417.decoder;
  75671. // import com.google.zxing.pdf417.PDF417Common;
  75672. // import java.util.ArrayList;
  75673. // import java.util.Collection;
  75674. // import java.util.HashMap;
  75675. // import java.util.Map;
  75676. // import java.util.Map.Entry;
  75677. /**
  75678. * @author Guenther Grau
  75679. */
  75680. var BarcodeValue = /** @class */function () {
  75681. function BarcodeValue() {
  75682. this.values = new Map();
  75683. }
  75684. /**
  75685. * Add an occurrence of a value
  75686. */
  75687. BarcodeValue.prototype.setValue = function (value) {
  75688. value = Math.trunc(value);
  75689. var confidence = this.values.get(value);
  75690. if (confidence == null) {
  75691. confidence = 0;
  75692. }
  75693. confidence++;
  75694. this.values.set(value, confidence);
  75695. };
  75696. /**
  75697. * Determines the maximum occurrence of a set value and returns all values which were set with this occurrence.
  75698. * @return an array of int, containing the values with the highest occurrence, or null, if no value was set
  75699. */
  75700. BarcodeValue.prototype.getValue = function () {
  75701. var e_1, _a;
  75702. var maxConfidence = -1;
  75703. var result = new Array();
  75704. var _loop_1 = function _loop_1(key, value) {
  75705. var entry = {
  75706. getKey: function getKey() {
  75707. return key;
  75708. },
  75709. getValue: function getValue() {
  75710. return value;
  75711. }
  75712. };
  75713. if (entry.getValue() > maxConfidence) {
  75714. maxConfidence = entry.getValue();
  75715. result = [];
  75716. result.push(entry.getKey());
  75717. } else if (entry.getValue() === maxConfidence) {
  75718. result.push(entry.getKey());
  75719. }
  75720. };
  75721. try {
  75722. for (var _b = __values(this.values.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
  75723. var _d = __read(_c.value, 2),
  75724. key = _d[0],
  75725. value = _d[1];
  75726. _loop_1(key, value);
  75727. }
  75728. } catch (e_1_1) {
  75729. e_1 = {
  75730. error: e_1_1
  75731. };
  75732. } finally {
  75733. try {
  75734. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  75735. } finally {
  75736. if (e_1) throw e_1.error;
  75737. }
  75738. }
  75739. return _PDF417Common.default.toIntArray(result);
  75740. };
  75741. BarcodeValue.prototype.getConfidence = function (value) {
  75742. return this.values.get(value);
  75743. };
  75744. return BarcodeValue;
  75745. }();
  75746. var _default = BarcodeValue;
  75747. exports.default = _default;
  75748. /***/ }),
  75749. /* 448 */
  75750. /*!**************************************************************************************************!*\
  75751. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DetectionResult.js ***!
  75752. \**************************************************************************************************/
  75753. /*! no static exports found */
  75754. /***/ (function(module, exports, __webpack_require__) {
  75755. "use strict";
  75756. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  75757. Object.defineProperty(exports, "__esModule", {
  75758. value: true
  75759. });
  75760. exports.default = void 0;
  75761. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
  75762. var _Formatter = _interopRequireDefault(__webpack_require__(/*! ../../util/Formatter */ 446));
  75763. /*
  75764. * Copyright 2013 ZXing authors
  75765. *
  75766. * Licensed under the Apache License, Version 2.0 (the "License");
  75767. * you may not use this file except in compliance with the License.
  75768. * You may obtain a copy of the License at
  75769. *
  75770. * http://www.apache.org/licenses/LICENSE-2.0
  75771. *
  75772. * Unless required by applicable law or agreed to in writing, software
  75773. * distributed under the License is distributed on an "AS IS" BASIS,
  75774. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  75775. * See the License for the specific language governing permissions and
  75776. * limitations under the License.
  75777. */
  75778. var __values = void 0 && (void 0).__values || function (o) {
  75779. var s = typeof Symbol === "function" && Symbol.iterator,
  75780. m = s && o[s],
  75781. i = 0;
  75782. if (m) return m.call(o);
  75783. if (o && typeof o.length === "number") return {
  75784. next: function next() {
  75785. if (o && i >= o.length) o = void 0;
  75786. return {
  75787. value: o && o[i++],
  75788. done: !o
  75789. };
  75790. }
  75791. };
  75792. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  75793. };
  75794. // package com.google.zxing.pdf417.decoder;
  75795. // import com.google.zxing.pdf417.PDF417Common;
  75796. /**
  75797. * @author Guenther Grau
  75798. */
  75799. var DetectionResult = /** @class */function () {
  75800. function DetectionResult(barcodeMetadata, boundingBox) {
  75801. /*final*/this.ADJUST_ROW_NUMBER_SKIP = 2;
  75802. this.barcodeMetadata = barcodeMetadata;
  75803. this.barcodeColumnCount = barcodeMetadata.getColumnCount();
  75804. this.boundingBox = boundingBox;
  75805. // this.detectionResultColumns = new DetectionResultColumn[this.barcodeColumnCount + 2];
  75806. this.detectionResultColumns = new Array(this.barcodeColumnCount + 2);
  75807. }
  75808. DetectionResult.prototype.getDetectionResultColumns = function () {
  75809. this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]);
  75810. this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount + 1]);
  75811. var unadjustedCodewordCount = _PDF417Common.default.MAX_CODEWORDS_IN_BARCODE;
  75812. var previousUnadjustedCount;
  75813. do {
  75814. previousUnadjustedCount = unadjustedCodewordCount;
  75815. unadjustedCodewordCount = this.adjustRowNumbersAndGetCount();
  75816. } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
  75817. return this.detectionResultColumns;
  75818. };
  75819. DetectionResult.prototype.adjustIndicatorColumnRowNumbers = function (detectionResultColumn) {
  75820. if (detectionResultColumn != null) {
  75821. detectionResultColumn.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata);
  75822. }
  75823. };
  75824. // TODO ensure that no detected codewords with unknown row number are left
  75825. // we should be able to estimate the row height and use it as a hint for the row number
  75826. // we should also fill the rows top to bottom and bottom to top
  75827. /**
  75828. * @return number of codewords which don't have a valid row number. Note that the count is not accurate as codewords
  75829. * will be counted several times. It just serves as an indicator to see when we can stop adjusting row numbers
  75830. */
  75831. DetectionResult.prototype.adjustRowNumbersAndGetCount = function () {
  75832. var unadjustedCount = this.adjustRowNumbersByRow();
  75833. if (unadjustedCount === 0) {
  75834. return 0;
  75835. }
  75836. for (var barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1; barcodeColumn++) {
  75837. var codewords = this.detectionResultColumns[barcodeColumn].getCodewords();
  75838. for (var codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {
  75839. if (codewords[codewordsRow] == null) {
  75840. continue;
  75841. }
  75842. if (!codewords[codewordsRow].hasValidRowNumber()) {
  75843. this.adjustRowNumbers(barcodeColumn, codewordsRow, codewords);
  75844. }
  75845. }
  75846. }
  75847. return unadjustedCount;
  75848. };
  75849. DetectionResult.prototype.adjustRowNumbersByRow = function () {
  75850. this.adjustRowNumbersFromBothRI();
  75851. // TODO we should only do full row adjustments if row numbers of left and right row indicator column match.
  75852. // Maybe it's even better to calculated the height (rows: d) and divide it by the number of barcode
  75853. // rows. This, together with the LRI and RRI row numbers should allow us to get a good estimate where a row
  75854. // number starts and ends.
  75855. var unadjustedCount = this.adjustRowNumbersFromLRI();
  75856. return unadjustedCount + this.adjustRowNumbersFromRRI();
  75857. };
  75858. DetectionResult.prototype.adjustRowNumbersFromBothRI = function () {
  75859. if (this.detectionResultColumns[0] == null || this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {
  75860. return;
  75861. }
  75862. var LRIcodewords = this.detectionResultColumns[0].getCodewords();
  75863. var RRIcodewords = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();
  75864. for (var codewordsRow /*int*/ = 0; codewordsRow < LRIcodewords.length; codewordsRow++) {
  75865. if (LRIcodewords[codewordsRow] != null && RRIcodewords[codewordsRow] != null && LRIcodewords[codewordsRow].getRowNumber() === RRIcodewords[codewordsRow].getRowNumber()) {
  75866. for (var barcodeColumn /*int*/ = 1; barcodeColumn <= this.barcodeColumnCount; barcodeColumn++) {
  75867. var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
  75868. if (codeword == null) {
  75869. continue;
  75870. }
  75871. codeword.setRowNumber(LRIcodewords[codewordsRow].getRowNumber());
  75872. if (!codeword.hasValidRowNumber()) {
  75873. this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;
  75874. }
  75875. }
  75876. }
  75877. }
  75878. };
  75879. DetectionResult.prototype.adjustRowNumbersFromRRI = function () {
  75880. if (this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {
  75881. return 0;
  75882. }
  75883. var unadjustedCount = 0;
  75884. var codewords = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();
  75885. for (var codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {
  75886. if (codewords[codewordsRow] == null) {
  75887. continue;
  75888. }
  75889. var rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
  75890. var invalidRowCounts = 0;
  75891. for (var barcodeColumn /*int*/ = this.barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) {
  75892. var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
  75893. if (codeword != null) {
  75894. invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
  75895. if (!codeword.hasValidRowNumber()) {
  75896. unadjustedCount++;
  75897. }
  75898. }
  75899. }
  75900. }
  75901. return unadjustedCount;
  75902. };
  75903. DetectionResult.prototype.adjustRowNumbersFromLRI = function () {
  75904. if (this.detectionResultColumns[0] == null) {
  75905. return 0;
  75906. }
  75907. var unadjustedCount = 0;
  75908. var codewords = this.detectionResultColumns[0].getCodewords();
  75909. for (var codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {
  75910. if (codewords[codewordsRow] == null) {
  75911. continue;
  75912. }
  75913. var rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
  75914. var invalidRowCounts = 0;
  75915. for (var barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) {
  75916. var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
  75917. if (codeword != null) {
  75918. invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
  75919. if (!codeword.hasValidRowNumber()) {
  75920. unadjustedCount++;
  75921. }
  75922. }
  75923. }
  75924. }
  75925. return unadjustedCount;
  75926. };
  75927. DetectionResult.adjustRowNumberIfValid = function (rowIndicatorRowNumber, invalidRowCounts, codeword) {
  75928. if (codeword == null) {
  75929. return invalidRowCounts;
  75930. }
  75931. if (!codeword.hasValidRowNumber()) {
  75932. if (codeword.isValidRowNumber(rowIndicatorRowNumber)) {
  75933. codeword.setRowNumber(rowIndicatorRowNumber);
  75934. invalidRowCounts = 0;
  75935. } else {
  75936. ++invalidRowCounts;
  75937. }
  75938. }
  75939. return invalidRowCounts;
  75940. };
  75941. DetectionResult.prototype.adjustRowNumbers = function (barcodeColumn, codewordsRow, codewords) {
  75942. var e_1, _a;
  75943. if (this.detectionResultColumns[barcodeColumn - 1] == null) {
  75944. return;
  75945. }
  75946. var codeword = codewords[codewordsRow];
  75947. var previousColumnCodewords = this.detectionResultColumns[barcodeColumn - 1].getCodewords();
  75948. var nextColumnCodewords = previousColumnCodewords;
  75949. if (this.detectionResultColumns[barcodeColumn + 1] != null) {
  75950. nextColumnCodewords = this.detectionResultColumns[barcodeColumn + 1].getCodewords();
  75951. }
  75952. // let otherCodewords: Codeword[] = new Codeword[14];
  75953. var otherCodewords = new Array(14);
  75954. otherCodewords[2] = previousColumnCodewords[codewordsRow];
  75955. otherCodewords[3] = nextColumnCodewords[codewordsRow];
  75956. if (codewordsRow > 0) {
  75957. otherCodewords[0] = codewords[codewordsRow - 1];
  75958. otherCodewords[4] = previousColumnCodewords[codewordsRow - 1];
  75959. otherCodewords[5] = nextColumnCodewords[codewordsRow - 1];
  75960. }
  75961. if (codewordsRow > 1) {
  75962. otherCodewords[8] = codewords[codewordsRow - 2];
  75963. otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];
  75964. otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];
  75965. }
  75966. if (codewordsRow < codewords.length - 1) {
  75967. otherCodewords[1] = codewords[codewordsRow + 1];
  75968. otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];
  75969. otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];
  75970. }
  75971. if (codewordsRow < codewords.length - 2) {
  75972. otherCodewords[9] = codewords[codewordsRow + 2];
  75973. otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];
  75974. otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];
  75975. }
  75976. try {
  75977. for (var otherCodewords_1 = __values(otherCodewords), otherCodewords_1_1 = otherCodewords_1.next(); !otherCodewords_1_1.done; otherCodewords_1_1 = otherCodewords_1.next()) {
  75978. var otherCodeword = otherCodewords_1_1.value;
  75979. if (DetectionResult.adjustRowNumber(codeword, otherCodeword)) {
  75980. return;
  75981. }
  75982. }
  75983. } catch (e_1_1) {
  75984. e_1 = {
  75985. error: e_1_1
  75986. };
  75987. } finally {
  75988. try {
  75989. if (otherCodewords_1_1 && !otherCodewords_1_1.done && (_a = otherCodewords_1.return)) _a.call(otherCodewords_1);
  75990. } finally {
  75991. if (e_1) throw e_1.error;
  75992. }
  75993. }
  75994. };
  75995. /**
  75996. * @return true, if row number was adjusted, false otherwise
  75997. */
  75998. DetectionResult.adjustRowNumber = function (codeword, otherCodeword) {
  75999. if (otherCodeword == null) {
  76000. return false;
  76001. }
  76002. if (otherCodeword.hasValidRowNumber() && otherCodeword.getBucket() === codeword.getBucket()) {
  76003. codeword.setRowNumber(otherCodeword.getRowNumber());
  76004. return true;
  76005. }
  76006. return false;
  76007. };
  76008. DetectionResult.prototype.getBarcodeColumnCount = function () {
  76009. return this.barcodeColumnCount;
  76010. };
  76011. DetectionResult.prototype.getBarcodeRowCount = function () {
  76012. return this.barcodeMetadata.getRowCount();
  76013. };
  76014. DetectionResult.prototype.getBarcodeECLevel = function () {
  76015. return this.barcodeMetadata.getErrorCorrectionLevel();
  76016. };
  76017. DetectionResult.prototype.setBoundingBox = function (boundingBox) {
  76018. this.boundingBox = boundingBox;
  76019. };
  76020. DetectionResult.prototype.getBoundingBox = function () {
  76021. return this.boundingBox;
  76022. };
  76023. DetectionResult.prototype.setDetectionResultColumn = function (barcodeColumn, detectionResultColumn) {
  76024. this.detectionResultColumns[barcodeColumn] = detectionResultColumn;
  76025. };
  76026. DetectionResult.prototype.getDetectionResultColumn = function (barcodeColumn) {
  76027. return this.detectionResultColumns[barcodeColumn];
  76028. };
  76029. // @Override
  76030. DetectionResult.prototype.toString = function () {
  76031. var rowIndicatorColumn = this.detectionResultColumns[0];
  76032. if (rowIndicatorColumn == null) {
  76033. rowIndicatorColumn = this.detectionResultColumns[this.barcodeColumnCount + 1];
  76034. }
  76035. // try (
  76036. var formatter = new _Formatter.default();
  76037. // ) {
  76038. for (var codewordsRow /*int*/ = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {
  76039. formatter.format('CW %3d:', codewordsRow);
  76040. for (var barcodeColumn /*int*/ = 0; barcodeColumn < this.barcodeColumnCount + 2; barcodeColumn++) {
  76041. if (this.detectionResultColumns[barcodeColumn] == null) {
  76042. formatter.format(' | ');
  76043. continue;
  76044. }
  76045. var codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
  76046. if (codeword == null) {
  76047. formatter.format(' | ');
  76048. continue;
  76049. }
  76050. formatter.format(' %3d|%3d', codeword.getRowNumber(), codeword.getValue());
  76051. }
  76052. formatter.format('%n');
  76053. }
  76054. return formatter.toString();
  76055. // }
  76056. };
  76057. return DetectionResult;
  76058. }();
  76059. var _default = DetectionResult;
  76060. exports.default = _default;
  76061. /***/ }),
  76062. /* 449 */
  76063. /*!*******************************************************************************************!*\
  76064. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/Codeword.js ***!
  76065. \*******************************************************************************************/
  76066. /*! no static exports found */
  76067. /***/ (function(module, exports, __webpack_require__) {
  76068. "use strict";
  76069. Object.defineProperty(exports, "__esModule", {
  76070. value: true
  76071. });
  76072. exports.default = void 0;
  76073. /*
  76074. * Copyright 2013 ZXing authors
  76075. *
  76076. * Licensed under the Apache License, Version 2.0 (the "License");
  76077. * you may not use this file except in compliance with the License.
  76078. * You may obtain a copy of the License at
  76079. *
  76080. * http://www.apache.org/licenses/LICENSE-2.0
  76081. *
  76082. * Unless required by applicable law or agreed to in writing, software
  76083. * distributed under the License is distributed on an "AS IS" BASIS,
  76084. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  76085. * See the License for the specific language governing permissions and
  76086. * limitations under the License.
  76087. */
  76088. // package com.google.zxing.pdf417.decoder;
  76089. /**
  76090. * @author Guenther Grau
  76091. */
  76092. var Codeword = /** @class */function () {
  76093. function Codeword(startX, endX, bucket, value) {
  76094. this.rowNumber = Codeword.BARCODE_ROW_UNKNOWN;
  76095. this.startX = Math.trunc(startX);
  76096. this.endX = Math.trunc(endX);
  76097. this.bucket = Math.trunc(bucket);
  76098. this.value = Math.trunc(value);
  76099. }
  76100. Codeword.prototype.hasValidRowNumber = function () {
  76101. return this.isValidRowNumber(this.rowNumber);
  76102. };
  76103. Codeword.prototype.isValidRowNumber = function (rowNumber) {
  76104. return rowNumber !== Codeword.BARCODE_ROW_UNKNOWN && this.bucket === rowNumber % 3 * 3;
  76105. };
  76106. Codeword.prototype.setRowNumberAsRowIndicatorColumn = function () {
  76107. this.rowNumber = Math.trunc(Math.trunc(this.value / 30) * 3 + Math.trunc(this.bucket / 3));
  76108. };
  76109. Codeword.prototype.getWidth = function () {
  76110. return this.endX - this.startX;
  76111. };
  76112. Codeword.prototype.getStartX = function () {
  76113. return this.startX;
  76114. };
  76115. Codeword.prototype.getEndX = function () {
  76116. return this.endX;
  76117. };
  76118. Codeword.prototype.getBucket = function () {
  76119. return this.bucket;
  76120. };
  76121. Codeword.prototype.getValue = function () {
  76122. return this.value;
  76123. };
  76124. Codeword.prototype.getRowNumber = function () {
  76125. return this.rowNumber;
  76126. };
  76127. Codeword.prototype.setRowNumber = function (rowNumber) {
  76128. this.rowNumber = rowNumber;
  76129. };
  76130. // @Override
  76131. Codeword.prototype.toString = function () {
  76132. return this.rowNumber + '|' + this.value;
  76133. };
  76134. Codeword.BARCODE_ROW_UNKNOWN = -1;
  76135. return Codeword;
  76136. }();
  76137. var _default = Codeword;
  76138. exports.default = _default;
  76139. /***/ }),
  76140. /* 450 */
  76141. /*!********************************************************************************************************!*\
  76142. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/PDF417CodewordDecoder.js ***!
  76143. \********************************************************************************************************/
  76144. /*! no static exports found */
  76145. /***/ (function(module, exports, __webpack_require__) {
  76146. "use strict";
  76147. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  76148. Object.defineProperty(exports, "__esModule", {
  76149. value: true
  76150. });
  76151. exports.default = void 0;
  76152. var _MathUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/detector/MathUtils */ 347));
  76153. var _PDF417Common = _interopRequireDefault(__webpack_require__(/*! ../PDF417Common */ 434));
  76154. var _Float = _interopRequireDefault(__webpack_require__(/*! ../../util/Float */ 348));
  76155. /*
  76156. * Copyright 2013 ZXing authors
  76157. *
  76158. * Licensed under the Apache License, Version 2.0 (the "License");
  76159. * you may not use this file except in compliance with the License.
  76160. * You may obtain a copy of the License at
  76161. *
  76162. * http://www.apache.org/licenses/LICENSE-2.0
  76163. *
  76164. * Unless required by applicable law or agreed to in writing, software
  76165. * distributed under the License is distributed on an "AS IS" BASIS,
  76166. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  76167. * See the License for the specific language governing permissions and
  76168. * limitations under the License.
  76169. */
  76170. // package com.google.zxing.pdf417.decoder;
  76171. // import com.google.zxing.common.detector.MathUtils;
  76172. // import com.google.zxing.pdf417.PDF417Common;
  76173. /**
  76174. * @author Guenther Grau
  76175. * @author creatale GmbH (christoph.schulz@creatale.de)
  76176. */
  76177. var PDF417CodewordDecoder = /** @class */function () {
  76178. function PDF417CodewordDecoder() {}
  76179. /* @note
  76180. * this action have to be performed before first use of class
  76181. * - static constructor
  76182. * working with 32bit float (based from Java logic)
  76183. */
  76184. PDF417CodewordDecoder.initialize = function () {
  76185. // Pre-computes the symbol ratio table.
  76186. for ( /*int*/var i = 0; i < _PDF417Common.default.SYMBOL_TABLE.length; i++) {
  76187. var currentSymbol = _PDF417Common.default.SYMBOL_TABLE[i];
  76188. var currentBit = currentSymbol & 0x1;
  76189. for ( /*int*/var j = 0; j < _PDF417Common.default.BARS_IN_MODULE; j++) {
  76190. var size = 0.0;
  76191. while ((currentSymbol & 0x1) === currentBit) {
  76192. size += 1.0;
  76193. currentSymbol >>= 1;
  76194. }
  76195. currentBit = currentSymbol & 0x1;
  76196. if (!PDF417CodewordDecoder.RATIOS_TABLE[i]) {
  76197. PDF417CodewordDecoder.RATIOS_TABLE[i] = new Array(_PDF417Common.default.BARS_IN_MODULE);
  76198. }
  76199. PDF417CodewordDecoder.RATIOS_TABLE[i][_PDF417Common.default.BARS_IN_MODULE - j - 1] = Math.fround(size / _PDF417Common.default.MODULES_IN_CODEWORD);
  76200. }
  76201. }
  76202. this.bSymbolTableReady = true;
  76203. };
  76204. PDF417CodewordDecoder.getDecodedValue = function (moduleBitCount) {
  76205. var decodedValue = PDF417CodewordDecoder.getDecodedCodewordValue(PDF417CodewordDecoder.sampleBitCounts(moduleBitCount));
  76206. if (decodedValue !== -1) {
  76207. return decodedValue;
  76208. }
  76209. return PDF417CodewordDecoder.getClosestDecodedValue(moduleBitCount);
  76210. };
  76211. PDF417CodewordDecoder.sampleBitCounts = function (moduleBitCount) {
  76212. var bitCountSum = _MathUtils.default.sum(moduleBitCount);
  76213. var result = new Int32Array(_PDF417Common.default.BARS_IN_MODULE);
  76214. var bitCountIndex = 0;
  76215. var sumPreviousBits = 0;
  76216. for ( /*int*/var i = 0; i < _PDF417Common.default.MODULES_IN_CODEWORD; i++) {
  76217. var sampleIndex = bitCountSum / (2 * _PDF417Common.default.MODULES_IN_CODEWORD) + i * bitCountSum / _PDF417Common.default.MODULES_IN_CODEWORD;
  76218. if (sumPreviousBits + moduleBitCount[bitCountIndex] <= sampleIndex) {
  76219. sumPreviousBits += moduleBitCount[bitCountIndex];
  76220. bitCountIndex++;
  76221. }
  76222. result[bitCountIndex]++;
  76223. }
  76224. return result;
  76225. };
  76226. PDF417CodewordDecoder.getDecodedCodewordValue = function (moduleBitCount) {
  76227. var decodedValue = PDF417CodewordDecoder.getBitValue(moduleBitCount);
  76228. return _PDF417Common.default.getCodeword(decodedValue) === -1 ? -1 : decodedValue;
  76229. };
  76230. PDF417CodewordDecoder.getBitValue = function (moduleBitCount) {
  76231. var result = /*long*/0;
  76232. for (var /*int*/i = 0; i < moduleBitCount.length; i++) {
  76233. for ( /*int*/var bit = 0; bit < moduleBitCount[i]; bit++) {
  76234. result = result << 1 | (i % 2 === 0 ? 1 : 0);
  76235. }
  76236. }
  76237. return Math.trunc(result);
  76238. };
  76239. // working with 32bit float (as in Java)
  76240. PDF417CodewordDecoder.getClosestDecodedValue = function (moduleBitCount) {
  76241. var bitCountSum = _MathUtils.default.sum(moduleBitCount);
  76242. var bitCountRatios = new Array(_PDF417Common.default.BARS_IN_MODULE);
  76243. if (bitCountSum > 1) {
  76244. for (var /*int*/i = 0; i < bitCountRatios.length; i++) {
  76245. bitCountRatios[i] = Math.fround(moduleBitCount[i] / bitCountSum);
  76246. }
  76247. }
  76248. var bestMatchError = _Float.default.MAX_VALUE;
  76249. var bestMatch = -1;
  76250. if (!this.bSymbolTableReady) {
  76251. PDF417CodewordDecoder.initialize();
  76252. }
  76253. for ( /*int*/var j = 0; j < PDF417CodewordDecoder.RATIOS_TABLE.length; j++) {
  76254. var error = 0.0;
  76255. var ratioTableRow = PDF417CodewordDecoder.RATIOS_TABLE[j];
  76256. for ( /*int*/var k = 0; k < _PDF417Common.default.BARS_IN_MODULE; k++) {
  76257. var diff = Math.fround(ratioTableRow[k] - bitCountRatios[k]);
  76258. error += Math.fround(diff * diff);
  76259. if (error >= bestMatchError) {
  76260. break;
  76261. }
  76262. }
  76263. if (error < bestMatchError) {
  76264. bestMatchError = error;
  76265. bestMatch = _PDF417Common.default.SYMBOL_TABLE[j];
  76266. }
  76267. }
  76268. return bestMatch;
  76269. };
  76270. // flag that the table is ready for use
  76271. PDF417CodewordDecoder.bSymbolTableReady = false;
  76272. PDF417CodewordDecoder.RATIOS_TABLE = new Array(_PDF417Common.default.SYMBOL_TABLE.length).map(function (x) {
  76273. return x = new Array(_PDF417Common.default.BARS_IN_MODULE);
  76274. });
  76275. return PDF417CodewordDecoder;
  76276. }();
  76277. var _default = PDF417CodewordDecoder;
  76278. exports.default = _default;
  76279. /***/ }),
  76280. /* 451 */
  76281. /*!*********************************************************************************************************!*\
  76282. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/decoder/DecodedBitStreamParser.js ***!
  76283. \*********************************************************************************************************/
  76284. /*! no static exports found */
  76285. /***/ (function(module, exports, __webpack_require__) {
  76286. "use strict";
  76287. /* WEBPACK VAR INJECTION */(function(global) {
  76288. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  76289. Object.defineProperty(exports, "__esModule", {
  76290. value: true
  76291. });
  76292. exports.default = void 0;
  76293. var _FormatException = _interopRequireDefault(__webpack_require__(/*! ../../FormatException */ 324));
  76294. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../../common/CharacterSetECI */ 323));
  76295. var _DecoderResult = _interopRequireDefault(__webpack_require__(/*! ../../common/DecoderResult */ 337));
  76296. var _PDF417ResultMetadata = _interopRequireDefault(__webpack_require__(/*! ../PDF417ResultMetadata */ 452));
  76297. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  76298. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  76299. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  76300. var _Long = _interopRequireDefault(__webpack_require__(/*! ../../util/Long */ 453));
  76301. var _ByteArrayOutputStream = _interopRequireDefault(__webpack_require__(/*! ../../util/ByteArrayOutputStream */ 454));
  76302. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
  76303. /*
  76304. * Copyright 2009 ZXing authors
  76305. *
  76306. * Licensed under the Apache License, Version 2.0 (the "License");
  76307. * you may not use this file except in compliance with the License.
  76308. * You may obtain a copy of the License at
  76309. *
  76310. * http://www.apache.org/licenses/LICENSE-2.0
  76311. *
  76312. * Unless required by applicable law or agreed to in writing, software
  76313. * distributed under the License is distributed on an "AS IS" BASIS,
  76314. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  76315. * See the License for the specific language governing permissions and
  76316. * limitations under the License.
  76317. */
  76318. // package com.google.zxing.pdf417.decoder;
  76319. // import com.google.zxing.FormatException;
  76320. // import com.google.zxing.common.CharacterSetECI;
  76321. // import com.google.zxing.common.DecoderResult;
  76322. // import com.google.zxing.pdf417.PDF417ResultMetadata;
  76323. // import java.io.ByteArrayOutputStream;
  76324. // import java.math.BigInteger;
  76325. // import java.nio.charset.Charset;
  76326. // import java.nio.charset.StandardCharsets;
  76327. // import java.util.Arrays;
  76328. /*private*/
  76329. var Mode;
  76330. (function (Mode) {
  76331. Mode[Mode["ALPHA"] = 0] = "ALPHA";
  76332. Mode[Mode["LOWER"] = 1] = "LOWER";
  76333. Mode[Mode["MIXED"] = 2] = "MIXED";
  76334. Mode[Mode["PUNCT"] = 3] = "PUNCT";
  76335. Mode[Mode["ALPHA_SHIFT"] = 4] = "ALPHA_SHIFT";
  76336. Mode[Mode["PUNCT_SHIFT"] = 5] = "PUNCT_SHIFT";
  76337. })(Mode || (Mode = {}));
  76338. /**
  76339. * Indirectly access the global BigInt constructor, it
  76340. * allows browsers that doesn't support BigInt to run
  76341. * the library without breaking due to "undefined BigInt"
  76342. * errors.
  76343. */
  76344. function getBigIntConstructor() {
  76345. if (typeof window !== 'undefined') {
  76346. return window['BigInt'] || null;
  76347. }
  76348. if (typeof global !== 'undefined') {
  76349. return global['BigInt'] || null;
  76350. }
  76351. if (typeof self !== 'undefined') {
  76352. return self['BigInt'] || null;
  76353. }
  76354. throw new Error('Can\'t search globals for BigInt!');
  76355. }
  76356. /**
  76357. * Used to store the BigInt constructor.
  76358. */
  76359. var BigInteger;
  76360. /**
  76361. * This function creates a bigint value. It allows browsers
  76362. * that doesn't support BigInt to run the rest of the library
  76363. * by not directly accessing the BigInt constructor.
  76364. */
  76365. function createBigInt(num) {
  76366. if (typeof BigInteger === 'undefined') {
  76367. BigInteger = getBigIntConstructor();
  76368. }
  76369. if (BigInteger === null) {
  76370. throw new Error('BigInt is not supported!');
  76371. }
  76372. return BigInteger(num);
  76373. }
  76374. function getEXP900() {
  76375. // in Java - array with length = 16
  76376. var EXP900 = [];
  76377. EXP900[0] = createBigInt(1);
  76378. var nineHundred = createBigInt(900);
  76379. EXP900[1] = nineHundred;
  76380. // in Java - array with length = 16
  76381. for (var i /*int*/ = 2; i < 16; i++) {
  76382. EXP900[i] = EXP900[i - 1] * nineHundred;
  76383. }
  76384. return EXP900;
  76385. }
  76386. /**
  76387. * <p>This class contains the methods for decoding the PDF417 codewords.</p>
  76388. *
  76389. * @author SITA Lab (kevin.osullivan@sita.aero)
  76390. * @author Guenther Grau
  76391. */
  76392. var DecodedBitStreamParser = /** @class */function () {
  76393. function DecodedBitStreamParser() {}
  76394. // private DecodedBitStreamParser() {
  76395. // }
  76396. /**
  76397. *
  76398. * @param codewords
  76399. * @param ecLevel
  76400. *
  76401. * @throws FormatException
  76402. */
  76403. DecodedBitStreamParser.decode = function (codewords, ecLevel) {
  76404. // pass encoding to result (will be used for decode symbols in byte mode)
  76405. var result = new _StringBuilder.default('');
  76406. // let encoding: Charset = StandardCharsets.ISO_8859_1;
  76407. var encoding = _CharacterSetECI.default.ISO8859_1;
  76408. /**
  76409. * @note the next command is specific from this TypeScript library
  76410. * because TS can't properly cast some values to char and
  76411. * convert it to string later correctly due to encoding
  76412. * differences from Java version. As reported here:
  76413. * https://github.com/zxing-js/library/pull/264/files#r382831593
  76414. */
  76415. result.enableDecoding(encoding);
  76416. // Get compaction mode
  76417. var codeIndex = 1;
  76418. var code = codewords[codeIndex++];
  76419. var resultMetadata = new _PDF417ResultMetadata.default();
  76420. while (codeIndex < codewords[0]) {
  76421. switch (code) {
  76422. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76423. codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, result);
  76424. break;
  76425. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
  76426. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
  76427. codeIndex = DecodedBitStreamParser.byteCompaction(code, codewords, encoding, codeIndex, result);
  76428. break;
  76429. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76430. result.append( /*(char)*/codewords[codeIndex++]);
  76431. break;
  76432. case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
  76433. codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex, result);
  76434. break;
  76435. case DecodedBitStreamParser.ECI_CHARSET:
  76436. var charsetECI = _CharacterSetECI.default.getCharacterSetECIByValue(codewords[codeIndex++]);
  76437. // encoding = Charset.forName(charsetECI.getName());
  76438. break;
  76439. case DecodedBitStreamParser.ECI_GENERAL_PURPOSE:
  76440. // Can't do anything with generic ECI; skip its 2 characters
  76441. codeIndex += 2;
  76442. break;
  76443. case DecodedBitStreamParser.ECI_USER_DEFINED:
  76444. // Can't do anything with user ECI; skip its 1 character
  76445. codeIndex++;
  76446. break;
  76447. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  76448. codeIndex = DecodedBitStreamParser.decodeMacroBlock(codewords, codeIndex, resultMetadata);
  76449. break;
  76450. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  76451. case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
  76452. // Should not see these outside a macro block
  76453. throw new _FormatException.default();
  76454. default:
  76455. // Default to text compaction. During testing numerous barcodes
  76456. // appeared to be missing the starting mode. In these cases defaulting
  76457. // to text compaction seems to work.
  76458. codeIndex--;
  76459. codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, result);
  76460. break;
  76461. }
  76462. if (codeIndex < codewords.length) {
  76463. code = codewords[codeIndex++];
  76464. } else {
  76465. throw _FormatException.default.getFormatInstance();
  76466. }
  76467. }
  76468. if (result.length() === 0) {
  76469. throw _FormatException.default.getFormatInstance();
  76470. }
  76471. var decoderResult = new _DecoderResult.default(null, result.toString(), null, ecLevel);
  76472. decoderResult.setOther(resultMetadata);
  76473. return decoderResult;
  76474. };
  76475. /**
  76476. *
  76477. * @param int
  76478. * @param param1
  76479. * @param codewords
  76480. * @param int
  76481. * @param codeIndex
  76482. * @param PDF417ResultMetadata
  76483. * @param resultMetadata
  76484. *
  76485. * @throws FormatException
  76486. */
  76487. // @SuppressWarnings("deprecation")
  76488. DecodedBitStreamParser.decodeMacroBlock = function (codewords, codeIndex, resultMetadata) {
  76489. if (codeIndex + DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
  76490. // we must have at least two bytes left for the segment index
  76491. throw _FormatException.default.getFormatInstance();
  76492. }
  76493. var segmentIndexArray = new Int32Array(DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS);
  76494. for (var i /*int*/ = 0; i < DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {
  76495. segmentIndexArray[i] = codewords[codeIndex];
  76496. }
  76497. resultMetadata.setSegmentIndex(_Integer.default.parseInt(DecodedBitStreamParser.decodeBase900toBase10(segmentIndexArray, DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS)));
  76498. var fileId = new _StringBuilder.default();
  76499. codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, fileId);
  76500. resultMetadata.setFileId(fileId.toString());
  76501. var optionalFieldsStart = -1;
  76502. if (codewords[codeIndex] === DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {
  76503. optionalFieldsStart = codeIndex + 1;
  76504. }
  76505. while (codeIndex < codewords[0]) {
  76506. switch (codewords[codeIndex]) {
  76507. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  76508. codeIndex++;
  76509. switch (codewords[codeIndex]) {
  76510. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:
  76511. var fileName = new _StringBuilder.default();
  76512. codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, fileName);
  76513. resultMetadata.setFileName(fileName.toString());
  76514. break;
  76515. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SENDER:
  76516. var sender = new _StringBuilder.default();
  76517. codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, sender);
  76518. resultMetadata.setSender(sender.toString());
  76519. break;
  76520. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:
  76521. var addressee = new _StringBuilder.default();
  76522. codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, addressee);
  76523. resultMetadata.setAddressee(addressee.toString());
  76524. break;
  76525. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:
  76526. var segmentCount = new _StringBuilder.default();
  76527. codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, segmentCount);
  76528. resultMetadata.setSegmentCount(_Integer.default.parseInt(segmentCount.toString()));
  76529. break;
  76530. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:
  76531. var timestamp = new _StringBuilder.default();
  76532. codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, timestamp);
  76533. resultMetadata.setTimestamp(_Long.default.parseLong(timestamp.toString()));
  76534. break;
  76535. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:
  76536. var checksum = new _StringBuilder.default();
  76537. codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, checksum);
  76538. resultMetadata.setChecksum(_Integer.default.parseInt(checksum.toString()));
  76539. break;
  76540. case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:
  76541. var fileSize = new _StringBuilder.default();
  76542. codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, fileSize);
  76543. resultMetadata.setFileSize(_Long.default.parseLong(fileSize.toString()));
  76544. break;
  76545. default:
  76546. throw _FormatException.default.getFormatInstance();
  76547. }
  76548. break;
  76549. case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
  76550. codeIndex++;
  76551. resultMetadata.setLastSegment(true);
  76552. break;
  76553. default:
  76554. throw _FormatException.default.getFormatInstance();
  76555. }
  76556. }
  76557. // copy optional fields to additional options
  76558. if (optionalFieldsStart !== -1) {
  76559. var optionalFieldsLength = codeIndex - optionalFieldsStart;
  76560. if (resultMetadata.isLastSegment()) {
  76561. // do not include terminator
  76562. optionalFieldsLength--;
  76563. }
  76564. resultMetadata.setOptionalData(_Arrays.default.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));
  76565. }
  76566. return codeIndex;
  76567. };
  76568. /**
  76569. * Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be
  76570. * encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as
  76571. * well as selected control characters.
  76572. *
  76573. * @param codewords The array of codewords (data + error)
  76574. * @param codeIndex The current index into the codeword array.
  76575. * @param result The decoded data is appended to the result.
  76576. * @return The next index into the codeword array.
  76577. */
  76578. DecodedBitStreamParser.textCompaction = function (codewords, codeIndex, result) {
  76579. // 2 character per codeword
  76580. var textCompactionData = new Int32Array((codewords[0] - codeIndex) * 2);
  76581. // Used to hold the byte compaction value if there is a mode shift
  76582. var byteCompactionData = new Int32Array((codewords[0] - codeIndex) * 2);
  76583. var index = 0;
  76584. var end = false;
  76585. while (codeIndex < codewords[0] && !end) {
  76586. var code = codewords[codeIndex++];
  76587. if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
  76588. textCompactionData[index] = code / 30;
  76589. textCompactionData[index + 1] = code % 30;
  76590. index += 2;
  76591. } else {
  76592. switch (code) {
  76593. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76594. // reinitialize text compaction mode to alpha sub mode
  76595. textCompactionData[index++] = DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH;
  76596. break;
  76597. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
  76598. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
  76599. case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
  76600. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  76601. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  76602. case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
  76603. codeIndex--;
  76604. end = true;
  76605. break;
  76606. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76607. // The Mode Shift codeword 913 shall cause a temporary
  76608. // switch from Text Compaction mode to Byte Compaction mode.
  76609. // This switch shall be in effect for only the next codeword,
  76610. // after which the mode shall revert to the prevailing sub-mode
  76611. // of the Text Compaction mode. Codeword 913 is only available
  76612. // in Text Compaction mode; its use is described in 5.4.2.4.
  76613. textCompactionData[index] = DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE;
  76614. code = codewords[codeIndex++];
  76615. byteCompactionData[index] = code;
  76616. index++;
  76617. break;
  76618. }
  76619. }
  76620. }
  76621. DecodedBitStreamParser.decodeTextCompaction(textCompactionData, byteCompactionData, index, result);
  76622. return codeIndex;
  76623. };
  76624. /**
  76625. * The Text Compaction mode includes all the printable ASCII characters
  76626. * (i.e. values from 32 to 126) and three ASCII control characters: HT or tab
  76627. * (9: e), LF or line feed (10: e), and CR or carriage
  76628. * return (13: e). The Text Compaction mode also includes various latch
  76629. * and shift characters which are used exclusively within the mode. The Text
  76630. * Compaction mode encodes up to 2 characters per codeword. The compaction rules
  76631. * for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode
  76632. * switches are defined in 5.4.2.3.
  76633. *
  76634. * @param textCompactionData The text compaction data.
  76635. * @param byteCompactionData The byte compaction data if there
  76636. * was a mode shift.
  76637. * @param length The size of the text compaction and byte compaction data.
  76638. * @param result The decoded data is appended to the result.
  76639. */
  76640. DecodedBitStreamParser.decodeTextCompaction = function (textCompactionData, byteCompactionData, length, result) {
  76641. // Beginning from an initial state of the Alpha sub-mode
  76642. // The default compaction mode for PDF417 in effect at the start of each symbol shall always be Text
  76643. // Compaction mode Alpha sub-mode (alphabetic: uppercase). A latch codeword from another mode to the Text
  76644. // Compaction mode shall always switch to the Text Compaction Alpha sub-mode.
  76645. var subMode = Mode.ALPHA;
  76646. var priorToShiftMode = Mode.ALPHA;
  76647. var i = 0;
  76648. while (i < length) {
  76649. var subModeCh = textCompactionData[i];
  76650. var ch = /*char*/'';
  76651. switch (subMode) {
  76652. case Mode.ALPHA:
  76653. // Alpha (alphabetic: uppercase)
  76654. if (subModeCh < 26) {
  76655. // Upper case Alpha Character
  76656. // Note: 65 = 'A' ASCII -> there is byte code of symbol
  76657. ch = /*(char)('A' + subModeCh) */String.fromCharCode(65 + subModeCh);
  76658. } else {
  76659. switch (subModeCh) {
  76660. case 26:
  76661. ch = ' ';
  76662. break;
  76663. case DecodedBitStreamParser.LL:
  76664. subMode = Mode.LOWER;
  76665. break;
  76666. case DecodedBitStreamParser.ML:
  76667. subMode = Mode.MIXED;
  76668. break;
  76669. case DecodedBitStreamParser.PS:
  76670. // Shift to punctuation
  76671. priorToShiftMode = subMode;
  76672. subMode = Mode.PUNCT_SHIFT;
  76673. break;
  76674. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76675. result.append( /*(char)*/byteCompactionData[i]);
  76676. break;
  76677. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76678. subMode = Mode.ALPHA;
  76679. break;
  76680. }
  76681. }
  76682. break;
  76683. case Mode.LOWER:
  76684. // Lower (alphabetic: lowercase)
  76685. if (subModeCh < 26) {
  76686. ch = /*(char)('a' + subModeCh)*/String.fromCharCode(97 + subModeCh);
  76687. } else {
  76688. switch (subModeCh) {
  76689. case 26:
  76690. ch = ' ';
  76691. break;
  76692. case DecodedBitStreamParser.AS:
  76693. // Shift to alpha
  76694. priorToShiftMode = subMode;
  76695. subMode = Mode.ALPHA_SHIFT;
  76696. break;
  76697. case DecodedBitStreamParser.ML:
  76698. subMode = Mode.MIXED;
  76699. break;
  76700. case DecodedBitStreamParser.PS:
  76701. // Shift to punctuation
  76702. priorToShiftMode = subMode;
  76703. subMode = Mode.PUNCT_SHIFT;
  76704. break;
  76705. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76706. // TODO Does this need to use the current character encoding? See other occurrences below
  76707. result.append( /*(char)*/byteCompactionData[i]);
  76708. break;
  76709. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76710. subMode = Mode.ALPHA;
  76711. break;
  76712. }
  76713. }
  76714. break;
  76715. case Mode.MIXED:
  76716. // Mixed (punctuation: e)
  76717. if (subModeCh < DecodedBitStreamParser.PL) {
  76718. ch = DecodedBitStreamParser.MIXED_CHARS[subModeCh];
  76719. } else {
  76720. switch (subModeCh) {
  76721. case DecodedBitStreamParser.PL:
  76722. subMode = Mode.PUNCT;
  76723. break;
  76724. case 26:
  76725. ch = ' ';
  76726. break;
  76727. case DecodedBitStreamParser.LL:
  76728. subMode = Mode.LOWER;
  76729. break;
  76730. case DecodedBitStreamParser.AL:
  76731. subMode = Mode.ALPHA;
  76732. break;
  76733. case DecodedBitStreamParser.PS:
  76734. // Shift to punctuation
  76735. priorToShiftMode = subMode;
  76736. subMode = Mode.PUNCT_SHIFT;
  76737. break;
  76738. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76739. result.append( /*(char)*/byteCompactionData[i]);
  76740. break;
  76741. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76742. subMode = Mode.ALPHA;
  76743. break;
  76744. }
  76745. }
  76746. break;
  76747. case Mode.PUNCT:
  76748. // Punctuation
  76749. if (subModeCh < DecodedBitStreamParser.PAL) {
  76750. ch = DecodedBitStreamParser.PUNCT_CHARS[subModeCh];
  76751. } else {
  76752. switch (subModeCh) {
  76753. case DecodedBitStreamParser.PAL:
  76754. subMode = Mode.ALPHA;
  76755. break;
  76756. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76757. result.append( /*(char)*/byteCompactionData[i]);
  76758. break;
  76759. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76760. subMode = Mode.ALPHA;
  76761. break;
  76762. }
  76763. }
  76764. break;
  76765. case Mode.ALPHA_SHIFT:
  76766. // Restore sub-mode
  76767. subMode = priorToShiftMode;
  76768. if (subModeCh < 26) {
  76769. ch = /*(char)('A' + subModeCh)*/String.fromCharCode(65 + subModeCh);
  76770. } else {
  76771. switch (subModeCh) {
  76772. case 26:
  76773. ch = ' ';
  76774. break;
  76775. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76776. subMode = Mode.ALPHA;
  76777. break;
  76778. }
  76779. }
  76780. break;
  76781. case Mode.PUNCT_SHIFT:
  76782. // Restore sub-mode
  76783. subMode = priorToShiftMode;
  76784. if (subModeCh < DecodedBitStreamParser.PAL) {
  76785. ch = DecodedBitStreamParser.PUNCT_CHARS[subModeCh];
  76786. } else {
  76787. switch (subModeCh) {
  76788. case DecodedBitStreamParser.PAL:
  76789. subMode = Mode.ALPHA;
  76790. break;
  76791. case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
  76792. // PS before Shift-to-Byte is used as a padding character,
  76793. // see 5.4.2.4 of the specification
  76794. result.append( /*(char)*/byteCompactionData[i]);
  76795. break;
  76796. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76797. subMode = Mode.ALPHA;
  76798. break;
  76799. }
  76800. }
  76801. break;
  76802. }
  76803. // if (ch !== 0) {
  76804. if (ch !== '') {
  76805. // Append decoded character to result
  76806. result.append(ch);
  76807. }
  76808. i++;
  76809. }
  76810. };
  76811. /**
  76812. * Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded.
  76813. * This includes all ASCII characters value 0 to 127 inclusive and provides for international
  76814. * character set support.
  76815. *
  76816. * @param mode The byte compaction mode i.e. 901 or 924
  76817. * @param codewords The array of codewords (data + error)
  76818. * @param encoding Currently active character encoding
  76819. * @param codeIndex The current index into the codeword array.
  76820. * @param result The decoded data is appended to the result.
  76821. * @return The next index into the codeword array.
  76822. */
  76823. DecodedBitStreamParser.byteCompaction = function (mode, codewords, encoding, codeIndex, result) {
  76824. var decodedBytes = new _ByteArrayOutputStream.default();
  76825. var count = 0;
  76826. var value = /*long*/0;
  76827. var end = false;
  76828. switch (mode) {
  76829. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
  76830. // Total number of Byte Compaction characters to be encoded
  76831. // is not a multiple of 6
  76832. var byteCompactedCodewords = new Int32Array(6);
  76833. var nextCode = codewords[codeIndex++];
  76834. while (codeIndex < codewords[0] && !end) {
  76835. byteCompactedCodewords[count++] = nextCode;
  76836. // Base 900
  76837. value = 900 * value + nextCode;
  76838. nextCode = codewords[codeIndex++];
  76839. // perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH
  76840. switch (nextCode) {
  76841. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76842. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
  76843. case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
  76844. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
  76845. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  76846. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  76847. case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
  76848. codeIndex--;
  76849. end = true;
  76850. break;
  76851. default:
  76852. if (count % 5 === 0 && count > 0) {
  76853. // Decode every 5 codewords
  76854. // Convert to Base 256
  76855. for (var j /*int*/ = 0; j < 6; ++j) {
  76856. /* @note
  76857. * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.
  76858. * So the next bitwise operation could not be done with simple numbers
  76859. */
  76860. decodedBytes.write( /*(byte)*/Number(createBigInt(value) >> createBigInt(8 * (5 - j))));
  76861. }
  76862. value = 0;
  76863. count = 0;
  76864. }
  76865. break;
  76866. }
  76867. }
  76868. // if the end of all codewords is reached the last codeword needs to be added
  76869. if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
  76870. byteCompactedCodewords[count++] = nextCode;
  76871. }
  76872. // If Byte Compaction mode is invoked with codeword 901,
  76873. // the last group of codewords is interpreted directly
  76874. // as one byte per codeword, without compaction.
  76875. for (var i /*int*/ = 0; i < count; i++) {
  76876. decodedBytes.write( /*(byte)*/byteCompactedCodewords[i]);
  76877. }
  76878. break;
  76879. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
  76880. // Total number of Byte Compaction characters to be encoded
  76881. // is an integer multiple of 6
  76882. while (codeIndex < codewords[0] && !end) {
  76883. var code = codewords[codeIndex++];
  76884. if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
  76885. count++;
  76886. // Base 900
  76887. value = 900 * value + code;
  76888. } else {
  76889. switch (code) {
  76890. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76891. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
  76892. case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:
  76893. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
  76894. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  76895. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  76896. case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
  76897. codeIndex--;
  76898. end = true;
  76899. break;
  76900. }
  76901. }
  76902. if (count % 5 === 0 && count > 0) {
  76903. // Decode every 5 codewords
  76904. // Convert to Base 256
  76905. /* @note
  76906. * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.
  76907. * So the next bitwise operation could not be done with simple numbers
  76908. */
  76909. for (var j /*int*/ = 0; j < 6; ++j) {
  76910. decodedBytes.write( /*(byte)*/Number(createBigInt(value) >> createBigInt(8 * (5 - j))));
  76911. }
  76912. value = 0;
  76913. count = 0;
  76914. }
  76915. }
  76916. break;
  76917. }
  76918. result.append(_StringEncoding.default.decode(decodedBytes.toByteArray(), encoding));
  76919. return codeIndex;
  76920. };
  76921. /**
  76922. * Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.
  76923. *
  76924. * @param codewords The array of codewords (data + error)
  76925. * @param codeIndex The current index into the codeword array.
  76926. * @param result The decoded data is appended to the result.
  76927. * @return The next index into the codeword array.
  76928. *
  76929. * @throws FormatException
  76930. */
  76931. DecodedBitStreamParser.numericCompaction = function (codewords, codeIndex /*int*/, result) {
  76932. var count = 0;
  76933. var end = false;
  76934. var numericCodewords = new Int32Array(DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS);
  76935. while (codeIndex < codewords[0] && !end) {
  76936. var code = codewords[codeIndex++];
  76937. if (codeIndex === codewords[0]) {
  76938. end = true;
  76939. }
  76940. if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {
  76941. numericCodewords[count] = code;
  76942. count++;
  76943. } else {
  76944. switch (code) {
  76945. case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:
  76946. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:
  76947. case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:
  76948. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:
  76949. case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
  76950. case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:
  76951. codeIndex--;
  76952. end = true;
  76953. break;
  76954. }
  76955. }
  76956. if ((count % DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {
  76957. // Re-invoking Numeric Compaction mode (by using codeword 902
  76958. // while in Numeric Compaction mode) serves to terminate the
  76959. // current Numeric Compaction mode grouping as described in 5.4.4.2,
  76960. // and then to start a new one grouping.
  76961. result.append(DecodedBitStreamParser.decodeBase900toBase10(numericCodewords, count));
  76962. count = 0;
  76963. }
  76964. }
  76965. return codeIndex;
  76966. };
  76967. /**
  76968. * Convert a list of Numeric Compacted codewords from Base 900 to Base 10.
  76969. *
  76970. * @param codewords The array of codewords
  76971. * @param count The number of codewords
  76972. * @return The decoded string representing the Numeric data.
  76973. *
  76974. * EXAMPLE
  76975. * Encode the fifteen digit numeric string 000213298174000
  76976. * Prefix the numeric string with a 1 and set the initial value of
  76977. * t = 1 000 213 298 174 000
  76978. * Calculate codeword 0
  76979. * d0 = 1 000 213 298 174 000 mod 900 = 200
  76980. *
  76981. * t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082
  76982. * Calculate codeword 1
  76983. * d1 = 1 111 348 109 082 mod 900 = 282
  76984. *
  76985. * t = 1 111 348 109 082 div 900 = 1 234 831 232
  76986. * Calculate codeword 2
  76987. * d2 = 1 234 831 232 mod 900 = 632
  76988. *
  76989. * t = 1 234 831 232 div 900 = 1 372 034
  76990. * Calculate codeword 3
  76991. * d3 = 1 372 034 mod 900 = 434
  76992. *
  76993. * t = 1 372 034 div 900 = 1 524
  76994. * Calculate codeword 4
  76995. * d4 = 1 524 mod 900 = 624
  76996. *
  76997. * t = 1 524 div 900 = 1
  76998. * Calculate codeword 5
  76999. * d5 = 1 mod 900 = 1
  77000. * t = 1 div 900 = 0
  77001. * Codeword sequence is: 1, 624, 434, 632, 282, 200
  77002. *
  77003. * Decode the above codewords involves
  77004. * 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 +
  77005. * 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000
  77006. *
  77007. * Remove leading 1 => Result is 000213298174000
  77008. *
  77009. * @throws FormatException
  77010. */
  77011. DecodedBitStreamParser.decodeBase900toBase10 = function (codewords, count) {
  77012. var result = createBigInt(0);
  77013. for (var i /*int*/ = 0; i < count; i++) {
  77014. result += DecodedBitStreamParser.EXP900[count - i - 1] * createBigInt(codewords[i]);
  77015. }
  77016. var resultString = result.toString();
  77017. if (resultString.charAt(0) !== '1') {
  77018. throw new _FormatException.default();
  77019. }
  77020. return resultString.substring(1);
  77021. };
  77022. DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH = 900;
  77023. DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH = 901;
  77024. DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH = 902;
  77025. DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6 = 924;
  77026. DecodedBitStreamParser.ECI_USER_DEFINED = 925;
  77027. DecodedBitStreamParser.ECI_GENERAL_PURPOSE = 926;
  77028. DecodedBitStreamParser.ECI_CHARSET = 927;
  77029. DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK = 928;
  77030. DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD = 923;
  77031. DecodedBitStreamParser.MACRO_PDF417_TERMINATOR = 922;
  77032. DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE = 913;
  77033. DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS = 15;
  77034. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME = 0;
  77035. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT = 1;
  77036. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP = 2;
  77037. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SENDER = 3;
  77038. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE = 4;
  77039. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE = 5;
  77040. DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM = 6;
  77041. DecodedBitStreamParser.PL = 25;
  77042. DecodedBitStreamParser.LL = 27;
  77043. DecodedBitStreamParser.AS = 27;
  77044. DecodedBitStreamParser.ML = 28;
  77045. DecodedBitStreamParser.AL = 28;
  77046. DecodedBitStreamParser.PS = 29;
  77047. DecodedBitStreamParser.PAL = 29;
  77048. DecodedBitStreamParser.PUNCT_CHARS = ';<>@[\\]_`~!\r\t,:\n-.$/"|*()?{}\'';
  77049. DecodedBitStreamParser.MIXED_CHARS = '0123456789&\r\t,:#-.$/+%*=^';
  77050. /**
  77051. * Table containing values for the exponent of 900.
  77052. * This is used in the numeric compaction decode algorithm.
  77053. */
  77054. DecodedBitStreamParser.EXP900 = getBigIntConstructor() ? getEXP900() : [];
  77055. DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS = 2;
  77056. return DecodedBitStreamParser;
  77057. }();
  77058. var _default = DecodedBitStreamParser;
  77059. exports.default = _default;
  77060. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! (webpack)/buildin/global.js */ 3)))
  77061. /***/ }),
  77062. /* 452 */
  77063. /*!***********************************************************************************************!*\
  77064. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/pdf417/PDF417ResultMetadata.js ***!
  77065. \***********************************************************************************************/
  77066. /*! no static exports found */
  77067. /***/ (function(module, exports, __webpack_require__) {
  77068. "use strict";
  77069. Object.defineProperty(exports, "__esModule", {
  77070. value: true
  77071. });
  77072. exports.default = void 0;
  77073. /*
  77074. * Copyright 2013 ZXing authors
  77075. *
  77076. * Licensed under the Apache License, Version 2.0 (the "License");
  77077. * you may not use this file except in compliance with the License.
  77078. * You may obtain a copy of the License at
  77079. *
  77080. * http://www.apache.org/licenses/LICENSE-2.0
  77081. *
  77082. * Unless required by applicable law or agreed to in writing, software
  77083. * distributed under the License is distributed on an "AS IS" BASIS,
  77084. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  77085. * See the License for the specific language governing permissions and
  77086. * limitations under the License.
  77087. */
  77088. // package com.google.zxing.pdf417;
  77089. /**
  77090. * @author Guenther Grau
  77091. */
  77092. var PDF417ResultMetadata = /** @class */function () {
  77093. function PDF417ResultMetadata() {
  77094. this.segmentCount = -1;
  77095. this.fileSize = -1;
  77096. this.timestamp = -1;
  77097. this.checksum = -1;
  77098. }
  77099. /**
  77100. * The Segment ID represents the segment of the whole file distributed over different symbols.
  77101. *
  77102. * @return File segment index
  77103. */
  77104. PDF417ResultMetadata.prototype.getSegmentIndex = function () {
  77105. return this.segmentIndex;
  77106. };
  77107. PDF417ResultMetadata.prototype.setSegmentIndex = function (segmentIndex) {
  77108. this.segmentIndex = segmentIndex;
  77109. };
  77110. /**
  77111. * Is the same for each related PDF417 symbol
  77112. *
  77113. * @return File ID
  77114. */
  77115. PDF417ResultMetadata.prototype.getFileId = function () {
  77116. return this.fileId;
  77117. };
  77118. PDF417ResultMetadata.prototype.setFileId = function (fileId) {
  77119. this.fileId = fileId;
  77120. };
  77121. /**
  77122. * @return always null
  77123. * @deprecated use dedicated already parsed fields
  77124. */
  77125. // @Deprecated
  77126. PDF417ResultMetadata.prototype.getOptionalData = function () {
  77127. return this.optionalData;
  77128. };
  77129. /**
  77130. * @param optionalData old optional data format as int array
  77131. * @deprecated parse and use new fields
  77132. */
  77133. // @Deprecated
  77134. PDF417ResultMetadata.prototype.setOptionalData = function (optionalData) {
  77135. this.optionalData = optionalData;
  77136. };
  77137. /**
  77138. * @return true if it is the last segment
  77139. */
  77140. PDF417ResultMetadata.prototype.isLastSegment = function () {
  77141. return this.lastSegment;
  77142. };
  77143. PDF417ResultMetadata.prototype.setLastSegment = function (lastSegment) {
  77144. this.lastSegment = lastSegment;
  77145. };
  77146. /**
  77147. * @return count of segments, -1 if not set
  77148. */
  77149. PDF417ResultMetadata.prototype.getSegmentCount = function () {
  77150. return this.segmentCount;
  77151. };
  77152. PDF417ResultMetadata.prototype.setSegmentCount = function (segmentCount /*int*/) {
  77153. this.segmentCount = segmentCount;
  77154. };
  77155. PDF417ResultMetadata.prototype.getSender = function () {
  77156. return this.sender || null;
  77157. };
  77158. PDF417ResultMetadata.prototype.setSender = function (sender) {
  77159. this.sender = sender;
  77160. };
  77161. PDF417ResultMetadata.prototype.getAddressee = function () {
  77162. return this.addressee || null;
  77163. };
  77164. PDF417ResultMetadata.prototype.setAddressee = function (addressee) {
  77165. this.addressee = addressee;
  77166. };
  77167. /**
  77168. * Filename of the encoded file
  77169. *
  77170. * @return filename
  77171. */
  77172. PDF417ResultMetadata.prototype.getFileName = function () {
  77173. return this.fileName;
  77174. };
  77175. PDF417ResultMetadata.prototype.setFileName = function (fileName) {
  77176. this.fileName = fileName;
  77177. };
  77178. /**
  77179. * filesize in bytes of the encoded file
  77180. *
  77181. * @return filesize in bytes, -1 if not set
  77182. */
  77183. PDF417ResultMetadata.prototype.getFileSize = function () {
  77184. return this.fileSize;
  77185. };
  77186. PDF417ResultMetadata.prototype.setFileSize = function (fileSize /*long*/) {
  77187. this.fileSize = fileSize;
  77188. };
  77189. /**
  77190. * 16-bit CRC checksum using CCITT-16
  77191. *
  77192. * @return crc checksum, -1 if not set
  77193. */
  77194. PDF417ResultMetadata.prototype.getChecksum = function () {
  77195. return this.checksum;
  77196. };
  77197. PDF417ResultMetadata.prototype.setChecksum = function (checksum /*int*/) {
  77198. this.checksum = checksum;
  77199. };
  77200. /**
  77201. * unix epock timestamp, elapsed seconds since 1970-01-01
  77202. *
  77203. * @return elapsed seconds, -1 if not set
  77204. */
  77205. PDF417ResultMetadata.prototype.getTimestamp = function () {
  77206. return this.timestamp;
  77207. };
  77208. PDF417ResultMetadata.prototype.setTimestamp = function (timestamp /*long*/) {
  77209. this.timestamp = timestamp;
  77210. };
  77211. return PDF417ResultMetadata;
  77212. }();
  77213. var _default = PDF417ResultMetadata;
  77214. exports.default = _default;
  77215. /***/ }),
  77216. /* 453 */
  77217. /*!*****************************************************************************!*\
  77218. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Long.js ***!
  77219. \*****************************************************************************/
  77220. /*! no static exports found */
  77221. /***/ (function(module, exports, __webpack_require__) {
  77222. "use strict";
  77223. Object.defineProperty(exports, "__esModule", {
  77224. value: true
  77225. });
  77226. exports.default = void 0;
  77227. /**
  77228. * Ponyfill for Java's Long class.
  77229. */
  77230. var Long = /** @class */function () {
  77231. function Long() {}
  77232. /**
  77233. * Parses a string to a number, since JS has no really Int64.
  77234. *
  77235. * @param num Numeric string.
  77236. * @param radix Destination radix.
  77237. */
  77238. Long.parseLong = function (num, radix) {
  77239. if (radix === void 0) {
  77240. radix = undefined;
  77241. }
  77242. return parseInt(num, radix);
  77243. };
  77244. return Long;
  77245. }();
  77246. var _default = Long;
  77247. exports.default = _default;
  77248. /***/ }),
  77249. /* 454 */
  77250. /*!**********************************************************************************************!*\
  77251. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/ByteArrayOutputStream.js ***!
  77252. \**********************************************************************************************/
  77253. /*! no static exports found */
  77254. /***/ (function(module, exports, __webpack_require__) {
  77255. "use strict";
  77256. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77257. Object.defineProperty(exports, "__esModule", {
  77258. value: true
  77259. });
  77260. exports.default = void 0;
  77261. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ./Arrays */ 314));
  77262. var _OutputStream = _interopRequireDefault(__webpack_require__(/*! ./OutputStream */ 455));
  77263. var _Integer = _interopRequireDefault(__webpack_require__(/*! ./Integer */ 318));
  77264. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  77265. var _OutOfMemoryError = _interopRequireDefault(__webpack_require__(/*! ../OutOfMemoryError */ 457));
  77266. var _System = _interopRequireDefault(__webpack_require__(/*! ./System */ 315));
  77267. var _IndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ../IndexOutOfBoundsException */ 317));
  77268. /*
  77269. * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  77270. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  77271. *
  77272. * This code is free software; you can redistribute it and/or modify it
  77273. * under the terms of the GNU General Public License version 2 only, as
  77274. * published by the Free Software Foundation. Oracle designates this
  77275. * particular file as subject to the "Classpath" exception as provided
  77276. * by Oracle in the LICENSE file that accompanied this code.
  77277. *
  77278. * This code is distributed in the hope that it will be useful, but WITHOUT
  77279. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  77280. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  77281. * version 2 for more details (a copy is included in the LICENSE file that
  77282. * accompanied this code).
  77283. *
  77284. * You should have received a copy of the GNU General Public License version
  77285. * 2 along with this work; if not, write to the Free Software Foundation,
  77286. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  77287. *
  77288. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  77289. * or visit www.oracle.com if you need additional information or have any
  77290. * questions.
  77291. */
  77292. var __extends = void 0 && (void 0).__extends || function () {
  77293. var _extendStatics = function extendStatics(d, b) {
  77294. _extendStatics = Object.setPrototypeOf || {
  77295. __proto__: []
  77296. } instanceof Array && function (d, b) {
  77297. d.__proto__ = b;
  77298. } || function (d, b) {
  77299. for (var p in b) {
  77300. if (b.hasOwnProperty(p)) d[p] = b[p];
  77301. }
  77302. };
  77303. return _extendStatics(d, b);
  77304. };
  77305. return function (d, b) {
  77306. _extendStatics(d, b);
  77307. function __() {
  77308. this.constructor = d;
  77309. }
  77310. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  77311. };
  77312. }();
  77313. // package java.io;
  77314. // import java.util.Arrays;
  77315. /**
  77316. * This class implements an output stream in which the data is
  77317. * written into a byte array. The buffer automatically grows as data
  77318. * is written to it.
  77319. * The data can be retrieved using <code>toByteArray()</code> and
  77320. * <code>toString()</code>.
  77321. * <p>
  77322. * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
  77323. * this class can be called after the stream has been closed without
  77324. * generating an <tt>IOException</tt>.
  77325. *
  77326. * @author Arthur van Hoff
  77327. * @since JDK1.0
  77328. */
  77329. var ByteArrayOutputStream = /** @class */function (_super) {
  77330. __extends(ByteArrayOutputStream, _super);
  77331. /**
  77332. * Creates a new byte array output stream. The buffer capacity is
  77333. * initially 32 bytes, though its size increases if necessary.
  77334. */
  77335. // public constructor() {
  77336. // this(32);
  77337. // }
  77338. /**
  77339. * Creates a new byte array output stream, with a buffer capacity of
  77340. * the specified size, in bytes.
  77341. *
  77342. * @param size the initial size.
  77343. * @exception IllegalArgumentException if size is negative.
  77344. */
  77345. function ByteArrayOutputStream(size) {
  77346. if (size === void 0) {
  77347. size = 32;
  77348. }
  77349. var _this = _super.call(this) || this;
  77350. /**
  77351. * The number of valid bytes in the buffer.
  77352. */
  77353. _this.count = 0;
  77354. if (size < 0) {
  77355. throw new _IllegalArgumentException.default('Negative initial size: ' + size);
  77356. }
  77357. _this.buf = new Uint8Array(size);
  77358. return _this;
  77359. }
  77360. /**
  77361. * Increases the capacity if necessary to ensure that it can hold
  77362. * at least the number of elements specified by the minimum
  77363. * capacity argument.
  77364. *
  77365. * @param minCapacity the desired minimum capacity
  77366. * @throws OutOfMemoryError if {@code minCapacity < 0}. This is
  77367. * interpreted as a request for the unsatisfiably large capacity
  77368. * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}.
  77369. */
  77370. ByteArrayOutputStream.prototype.ensureCapacity = function (minCapacity) {
  77371. // overflow-conscious code
  77372. if (minCapacity - this.buf.length > 0) this.grow(minCapacity);
  77373. };
  77374. /**
  77375. * Increases the capacity to ensure that it can hold at least the
  77376. * number of elements specified by the minimum capacity argument.
  77377. *
  77378. * @param minCapacity the desired minimum capacity
  77379. */
  77380. ByteArrayOutputStream.prototype.grow = function (minCapacity) {
  77381. // overflow-conscious code
  77382. var oldCapacity = this.buf.length;
  77383. var newCapacity = oldCapacity << 1;
  77384. if (newCapacity - minCapacity < 0) newCapacity = minCapacity;
  77385. if (newCapacity < 0) {
  77386. if (minCapacity < 0)
  77387. // overflow
  77388. throw new _OutOfMemoryError.default();
  77389. newCapacity = _Integer.default.MAX_VALUE;
  77390. }
  77391. this.buf = _Arrays.default.copyOfUint8Array(this.buf, newCapacity);
  77392. };
  77393. /**
  77394. * Writes the specified byte to this byte array output stream.
  77395. *
  77396. * @param b the byte to be written.
  77397. */
  77398. ByteArrayOutputStream.prototype.write = function (b) {
  77399. this.ensureCapacity(this.count + 1);
  77400. this.buf[this.count] = /*(byte)*/b;
  77401. this.count += 1;
  77402. };
  77403. /**
  77404. * Writes <code>len</code> bytes from the specified byte array
  77405. * starting at offset <code>off</code> to this byte array output stream.
  77406. *
  77407. * @param b the data.
  77408. * @param off the start offset in the data.
  77409. * @param len the number of bytes to write.
  77410. */
  77411. ByteArrayOutputStream.prototype.writeBytesOffset = function (b, off, len) {
  77412. if (off < 0 || off > b.length || len < 0 || off + len - b.length > 0) {
  77413. throw new _IndexOutOfBoundsException.default();
  77414. }
  77415. this.ensureCapacity(this.count + len);
  77416. _System.default.arraycopy(b, off, this.buf, this.count, len);
  77417. this.count += len;
  77418. };
  77419. /**
  77420. * Writes the complete contents of this byte array output stream to
  77421. * the specified output stream argument, as if by calling the output
  77422. * stream's write method using <code>out.write(buf, 0, count)</code>.
  77423. *
  77424. * @param out the output stream to which to write the data.
  77425. * @exception IOException if an I/O error occurs.
  77426. */
  77427. ByteArrayOutputStream.prototype.writeTo = function (out) {
  77428. out.writeBytesOffset(this.buf, 0, this.count);
  77429. };
  77430. /**
  77431. * Resets the <code>count</code> field of this byte array output
  77432. * stream to zero, so that all currently accumulated output in the
  77433. * output stream is discarded. The output stream can be used again,
  77434. * reusing the already allocated buffer space.
  77435. *
  77436. * @see java.io.ByteArrayInputStream#count
  77437. */
  77438. ByteArrayOutputStream.prototype.reset = function () {
  77439. this.count = 0;
  77440. };
  77441. /**
  77442. * Creates a newly allocated byte array. Its size is the current
  77443. * size of this output stream and the valid contents of the buffer
  77444. * have been copied into it.
  77445. *
  77446. * @return the current contents of this output stream, as a byte array.
  77447. * @see java.io.ByteArrayOutputStream#size()
  77448. */
  77449. ByteArrayOutputStream.prototype.toByteArray = function () {
  77450. return _Arrays.default.copyOfUint8Array(this.buf, this.count);
  77451. };
  77452. /**
  77453. * Returns the current size of the buffer.
  77454. *
  77455. * @return the value of the <code>count</code> field, which is the number
  77456. * of valid bytes in this output stream.
  77457. * @see java.io.ByteArrayOutputStream#count
  77458. */
  77459. ByteArrayOutputStream.prototype.size = function () {
  77460. return this.count;
  77461. };
  77462. ByteArrayOutputStream.prototype.toString = function (param) {
  77463. if (!param) {
  77464. return this.toString_void();
  77465. }
  77466. if (typeof param === 'string') {
  77467. return this.toString_string(param);
  77468. }
  77469. return this.toString_number(param);
  77470. };
  77471. /**
  77472. * Converts the buffer's contents into a string decoding bytes using the
  77473. * platform's default character set. The length of the new <tt>String</tt>
  77474. * is a function of the character set, and hence may not be equal to the
  77475. * size of the buffer.
  77476. *
  77477. * <p> This method always replaces malformed-input and unmappable-character
  77478. * sequences with the default replacement string for the platform's
  77479. * default character set. The {@linkplain java.nio.charset.CharsetDecoder}
  77480. * class should be used when more control over the decoding process is
  77481. * required.
  77482. *
  77483. * @return String decoded from the buffer's contents.
  77484. * @since JDK1.1
  77485. */
  77486. ByteArrayOutputStream.prototype.toString_void = function () {
  77487. return new String(this.buf /*, 0, this.count*/).toString();
  77488. };
  77489. /**
  77490. * Converts the buffer's contents into a string by decoding the bytes using
  77491. * the specified {@link java.nio.charset.Charset charsetName}. The length of
  77492. * the new <tt>String</tt> is a function of the charset, and hence may not be
  77493. * equal to the length of the byte array.
  77494. *
  77495. * <p> This method always replaces malformed-input and unmappable-character
  77496. * sequences with this charset's default replacement string. The {@link
  77497. * java.nio.charset.CharsetDecoder} class should be used when more control
  77498. * over the decoding process is required.
  77499. *
  77500. * @param charsetName the name of a supported
  77501. * {@linkplain java.nio.charset.Charset </code>charset<code>}
  77502. * @return String decoded from the buffer's contents.
  77503. * @exception UnsupportedEncodingException
  77504. * If the named charset is not supported
  77505. * @since JDK1.1
  77506. */
  77507. ByteArrayOutputStream.prototype.toString_string = function (charsetName) {
  77508. return new String(this.buf /*, 0, this.count, charsetName*/).toString();
  77509. };
  77510. /**
  77511. * Creates a newly allocated string. Its size is the current size of
  77512. * the output stream and the valid contents of the buffer have been
  77513. * copied into it. Each character <i>c</i> in the resulting string is
  77514. * constructed from the corresponding element <i>b</i> in the byte
  77515. * array such that:
  77516. * <blockquote><pre>
  77517. * c == (char)(((hibyte &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
  77518. * </pre></blockquote>
  77519. *
  77520. * @deprecated This method does not properly convert bytes into characters.
  77521. * As of JDK&nbsp;1.1, the preferred way to do this is via the
  77522. * <code>toString(String enc)</code> method, which takes an encoding-name
  77523. * argument, or the <code>toString()</code> method, which uses the
  77524. * platform's default character encoding.
  77525. *
  77526. * @param hibyte the high byte of each resulting Unicode character.
  77527. * @return the current contents of the output stream, as a string.
  77528. * @see java.io.ByteArrayOutputStream#size()
  77529. * @see java.io.ByteArrayOutputStream#toString(String)
  77530. * @see java.io.ByteArrayOutputStream#toString()
  77531. */
  77532. // @Deprecated
  77533. ByteArrayOutputStream.prototype.toString_number = function (hibyte) {
  77534. return new String(this.buf /*, hibyte, 0, this.count*/).toString();
  77535. };
  77536. /**
  77537. * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
  77538. * this class can be called after the stream has been closed without
  77539. * generating an <tt>IOException</tt>.
  77540. * <p>
  77541. *
  77542. * @throws IOException
  77543. */
  77544. ByteArrayOutputStream.prototype.close = function () {};
  77545. return ByteArrayOutputStream;
  77546. }(_OutputStream.default);
  77547. var _default = ByteArrayOutputStream;
  77548. exports.default = _default;
  77549. /***/ }),
  77550. /* 455 */
  77551. /*!*************************************************************************************!*\
  77552. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/OutputStream.js ***!
  77553. \*************************************************************************************/
  77554. /*! no static exports found */
  77555. /***/ (function(module, exports, __webpack_require__) {
  77556. "use strict";
  77557. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77558. Object.defineProperty(exports, "__esModule", {
  77559. value: true
  77560. });
  77561. exports.default = void 0;
  77562. var _IndexOutOfBoundsException = _interopRequireDefault(__webpack_require__(/*! ../IndexOutOfBoundsException */ 317));
  77563. var _NullPointerException = _interopRequireDefault(__webpack_require__(/*! ../NullPointerException */ 456));
  77564. /*
  77565. * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
  77566. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  77567. *
  77568. * This code is free software; you can redistribute it and/or modify it
  77569. * under the terms of the GNU General Public License version 2 only, as
  77570. * published by the Free Software Foundation. Oracle designates this
  77571. * particular file as subject to the "Classpath" exception as provided
  77572. * by Oracle in the LICENSE file that accompanied this code.
  77573. *
  77574. * This code is distributed in the hope that it will be useful, but WITHOUT
  77575. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  77576. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  77577. * version 2 for more details (a copy is included in the LICENSE file that
  77578. * accompanied this code).
  77579. *
  77580. * You should have received a copy of the GNU General Public License version
  77581. * 2 along with this work; if not, write to the Free Software Foundation,
  77582. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  77583. *
  77584. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  77585. * or visit www.oracle.com if you need additional information or have any
  77586. * questions.
  77587. */
  77588. // package java.io;
  77589. /**
  77590. * This abstract class is the superclass of all classes representing
  77591. * an output stream of bytes. An output stream accepts output bytes
  77592. * and sends them to some sink.
  77593. * <p>
  77594. * Applications that need to define a subclass of
  77595. * <code>OutputStream</code> must always provide at least a method
  77596. * that writes one byte of output.
  77597. *
  77598. * @author Arthur van Hoff
  77599. * @see java.io.BufferedOutputStream
  77600. * @see java.io.ByteArrayOutputStream
  77601. * @see java.io.DataOutputStream
  77602. * @see java.io.FilterOutputStream
  77603. * @see java.io.InputStream
  77604. * @see java.io.OutputStream#write(int)
  77605. * @since JDK1.0
  77606. */
  77607. var OutputStream /*implements Closeable, Flushable*/ = /** @class */function () {
  77608. function OutputStream() {}
  77609. /**
  77610. * Writes <code>b.length</code> bytes from the specified byte array
  77611. * to this output stream. The general contract for <code>write(b)</code>
  77612. * is that it should have exactly the same effect as the call
  77613. * <code>write(b, 0, b.length)</code>.
  77614. *
  77615. * @param b the data.
  77616. * @exception IOException if an I/O error occurs.
  77617. * @see java.io.OutputStream#write(byte[], int, int)
  77618. */
  77619. OutputStream.prototype.writeBytes = function (b) {
  77620. this.writeBytesOffset(b, 0, b.length);
  77621. };
  77622. /**
  77623. * Writes <code>len</code> bytes from the specified byte array
  77624. * starting at offset <code>off</code> to this output stream.
  77625. * The general contract for <code>write(b, off, len)</code> is that
  77626. * some of the bytes in the array <code>b</code> are written to the
  77627. * output stream in order; element <code>b[off]</code> is the first
  77628. * byte written and <code>b[off+len-1]</code> is the last byte written
  77629. * by this operation.
  77630. * <p>
  77631. * The <code>write</code> method of <code>OutputStream</code> calls
  77632. * the write method of one argument on each of the bytes to be
  77633. * written out. Subclasses are encouraged to override this method and
  77634. * provide a more efficient implementation.
  77635. * <p>
  77636. * If <code>b</code> is <code>null</code>, a
  77637. * <code>NullPointerException</code> is thrown.
  77638. * <p>
  77639. * If <code>off</code> is negative, or <code>len</code> is negative, or
  77640. * <code>off+len</code> is greater than the length of the array
  77641. * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
  77642. *
  77643. * @param b the data.
  77644. * @param off the start offset in the data.
  77645. * @param len the number of bytes to write.
  77646. * @exception IOException if an I/O error occurs. In particular,
  77647. * an <code>IOException</code> is thrown if the output
  77648. * stream is closed.
  77649. */
  77650. OutputStream.prototype.writeBytesOffset = function (b, off, len) {
  77651. if (b == null) {
  77652. throw new _NullPointerException.default();
  77653. } else if (off < 0 || off > b.length || len < 0 || off + len > b.length || off + len < 0) {
  77654. throw new _IndexOutOfBoundsException.default();
  77655. } else if (len === 0) {
  77656. return;
  77657. }
  77658. for (var i = 0; i < len; i++) {
  77659. this.write(b[off + i]);
  77660. }
  77661. };
  77662. /**
  77663. * Flushes this output stream and forces any buffered output bytes
  77664. * to be written out. The general contract of <code>flush</code> is
  77665. * that calling it is an indication that, if any bytes previously
  77666. * written have been buffered by the implementation of the output
  77667. * stream, such bytes should immediately be written to their
  77668. * intended destination.
  77669. * <p>
  77670. * If the intended destination of this stream is an abstraction provided by
  77671. * the underlying operating system, for example a file, then flushing the
  77672. * stream guarantees only that bytes previously written to the stream are
  77673. * passed to the operating system for writing; it does not guarantee that
  77674. * they are actually written to a physical device such as a disk drive.
  77675. * <p>
  77676. * The <code>flush</code> method of <code>OutputStream</code> does nothing.
  77677. *
  77678. * @exception IOException if an I/O error occurs.
  77679. */
  77680. OutputStream.prototype.flush = function () {};
  77681. /**
  77682. * Closes this output stream and releases any system resources
  77683. * associated with this stream. The general contract of <code>close</code>
  77684. * is that it closes the output stream. A closed stream cannot perform
  77685. * output operations and cannot be reopened.
  77686. * <p>
  77687. * The <code>close</code> method of <code>OutputStream</code> does nothing.
  77688. *
  77689. * @exception IOException if an I/O error occurs.
  77690. */
  77691. OutputStream.prototype.close = function () {};
  77692. return OutputStream;
  77693. }();
  77694. var _default = OutputStream;
  77695. exports.default = _default;
  77696. /***/ }),
  77697. /* 456 */
  77698. /*!****************************************************************************************!*\
  77699. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/NullPointerException.js ***!
  77700. \****************************************************************************************/
  77701. /*! no static exports found */
  77702. /***/ (function(module, exports, __webpack_require__) {
  77703. "use strict";
  77704. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77705. Object.defineProperty(exports, "__esModule", {
  77706. value: true
  77707. });
  77708. exports.default = void 0;
  77709. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  77710. var __extends = void 0 && (void 0).__extends || function () {
  77711. var _extendStatics = function extendStatics(d, b) {
  77712. _extendStatics = Object.setPrototypeOf || {
  77713. __proto__: []
  77714. } instanceof Array && function (d, b) {
  77715. d.__proto__ = b;
  77716. } || function (d, b) {
  77717. for (var p in b) {
  77718. if (b.hasOwnProperty(p)) d[p] = b[p];
  77719. }
  77720. };
  77721. return _extendStatics(d, b);
  77722. };
  77723. return function (d, b) {
  77724. _extendStatics(d, b);
  77725. function __() {
  77726. this.constructor = d;
  77727. }
  77728. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  77729. };
  77730. }();
  77731. /**
  77732. * Custom Error class of type Exception.
  77733. */
  77734. var NullPointerException = /** @class */function (_super) {
  77735. __extends(NullPointerException, _super);
  77736. function NullPointerException() {
  77737. return _super !== null && _super.apply(this, arguments) || this;
  77738. }
  77739. NullPointerException.kind = 'NullPointerException';
  77740. return NullPointerException;
  77741. }(_Exception.default);
  77742. var _default = NullPointerException;
  77743. exports.default = _default;
  77744. /***/ }),
  77745. /* 457 */
  77746. /*!************************************************************************************!*\
  77747. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/OutOfMemoryError.js ***!
  77748. \************************************************************************************/
  77749. /*! no static exports found */
  77750. /***/ (function(module, exports, __webpack_require__) {
  77751. "use strict";
  77752. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77753. Object.defineProperty(exports, "__esModule", {
  77754. value: true
  77755. });
  77756. exports.default = void 0;
  77757. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  77758. var __extends = void 0 && (void 0).__extends || function () {
  77759. var _extendStatics = function extendStatics(d, b) {
  77760. _extendStatics = Object.setPrototypeOf || {
  77761. __proto__: []
  77762. } instanceof Array && function (d, b) {
  77763. d.__proto__ = b;
  77764. } || function (d, b) {
  77765. for (var p in b) {
  77766. if (b.hasOwnProperty(p)) d[p] = b[p];
  77767. }
  77768. };
  77769. return _extendStatics(d, b);
  77770. };
  77771. return function (d, b) {
  77772. _extendStatics(d, b);
  77773. function __() {
  77774. this.constructor = d;
  77775. }
  77776. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  77777. };
  77778. }();
  77779. /**
  77780. * Custom Error class of type Exception.
  77781. */
  77782. var OutOfMemoryError = /** @class */function (_super) {
  77783. __extends(OutOfMemoryError, _super);
  77784. function OutOfMemoryError() {
  77785. return _super !== null && _super.apply(this, arguments) || this;
  77786. }
  77787. return OutOfMemoryError;
  77788. }(_Exception.default);
  77789. var _default = OutOfMemoryError;
  77790. exports.default = _default;
  77791. /***/ }),
  77792. /* 458 */
  77793. /*!***********************************************************************************!*\
  77794. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/ReaderException.js ***!
  77795. \***********************************************************************************/
  77796. /*! no static exports found */
  77797. /***/ (function(module, exports, __webpack_require__) {
  77798. "use strict";
  77799. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77800. Object.defineProperty(exports, "__esModule", {
  77801. value: true
  77802. });
  77803. exports.default = void 0;
  77804. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  77805. var __extends = void 0 && (void 0).__extends || function () {
  77806. var _extendStatics = function extendStatics(d, b) {
  77807. _extendStatics = Object.setPrototypeOf || {
  77808. __proto__: []
  77809. } instanceof Array && function (d, b) {
  77810. d.__proto__ = b;
  77811. } || function (d, b) {
  77812. for (var p in b) {
  77813. if (b.hasOwnProperty(p)) d[p] = b[p];
  77814. }
  77815. };
  77816. return _extendStatics(d, b);
  77817. };
  77818. return function (d, b) {
  77819. _extendStatics(d, b);
  77820. function __() {
  77821. this.constructor = d;
  77822. }
  77823. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  77824. };
  77825. }();
  77826. /**
  77827. * Custom Error class of type Exception.
  77828. */
  77829. var ReaderException = /** @class */function (_super) {
  77830. __extends(ReaderException, _super);
  77831. function ReaderException() {
  77832. return _super !== null && _super.apply(this, arguments) || this;
  77833. }
  77834. ReaderException.kind = 'ReaderException';
  77835. return ReaderException;
  77836. }(_Exception.default);
  77837. var _default = ReaderException;
  77838. exports.default = _default;
  77839. /***/ }),
  77840. /* 459 */
  77841. /*!******************************************************************************************!*\
  77842. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserPDF417Reader.js ***!
  77843. \******************************************************************************************/
  77844. /*! no static exports found */
  77845. /***/ (function(module, exports, __webpack_require__) {
  77846. "use strict";
  77847. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77848. Object.defineProperty(exports, "__esModule", {
  77849. value: true
  77850. });
  77851. exports.BrowserPDF417Reader = void 0;
  77852. var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
  77853. var _PDF417Reader = _interopRequireDefault(__webpack_require__(/*! ../core/pdf417/PDF417Reader */ 433));
  77854. var __extends = void 0 && (void 0).__extends || function () {
  77855. var _extendStatics = function extendStatics(d, b) {
  77856. _extendStatics = Object.setPrototypeOf || {
  77857. __proto__: []
  77858. } instanceof Array && function (d, b) {
  77859. d.__proto__ = b;
  77860. } || function (d, b) {
  77861. for (var p in b) {
  77862. if (b.hasOwnProperty(p)) d[p] = b[p];
  77863. }
  77864. };
  77865. return _extendStatics(d, b);
  77866. };
  77867. return function (d, b) {
  77868. _extendStatics(d, b);
  77869. function __() {
  77870. this.constructor = d;
  77871. }
  77872. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  77873. };
  77874. }();
  77875. /**
  77876. * @deprecated Moving to @zxing/browser
  77877. *
  77878. * QR Code reader to use from browser.
  77879. */
  77880. var BrowserPDF417Reader = /** @class */function (_super) {
  77881. __extends(BrowserPDF417Reader, _super);
  77882. /**
  77883. * Creates an instance of BrowserPDF417Reader.
  77884. * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
  77885. */
  77886. function BrowserPDF417Reader(timeBetweenScansMillis) {
  77887. if (timeBetweenScansMillis === void 0) {
  77888. timeBetweenScansMillis = 500;
  77889. }
  77890. return _super.call(this, new _PDF417Reader.default(), timeBetweenScansMillis) || this;
  77891. }
  77892. return BrowserPDF417Reader;
  77893. }(_BrowserCodeReader.BrowserCodeReader);
  77894. exports.BrowserPDF417Reader = BrowserPDF417Reader;
  77895. /***/ }),
  77896. /* 460 */
  77897. /*!******************************************************************************************!*\
  77898. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserQRCodeReader.js ***!
  77899. \******************************************************************************************/
  77900. /*! no static exports found */
  77901. /***/ (function(module, exports, __webpack_require__) {
  77902. "use strict";
  77903. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77904. Object.defineProperty(exports, "__esModule", {
  77905. value: true
  77906. });
  77907. exports.BrowserQRCodeReader = void 0;
  77908. var _BrowserCodeReader = __webpack_require__(/*! ./BrowserCodeReader */ 303);
  77909. var _QRCodeReader = _interopRequireDefault(__webpack_require__(/*! ../core/qrcode/QRCodeReader */ 414));
  77910. var __extends = void 0 && (void 0).__extends || function () {
  77911. var _extendStatics = function extendStatics(d, b) {
  77912. _extendStatics = Object.setPrototypeOf || {
  77913. __proto__: []
  77914. } instanceof Array && function (d, b) {
  77915. d.__proto__ = b;
  77916. } || function (d, b) {
  77917. for (var p in b) {
  77918. if (b.hasOwnProperty(p)) d[p] = b[p];
  77919. }
  77920. };
  77921. return _extendStatics(d, b);
  77922. };
  77923. return function (d, b) {
  77924. _extendStatics(d, b);
  77925. function __() {
  77926. this.constructor = d;
  77927. }
  77928. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  77929. };
  77930. }();
  77931. /**
  77932. * @deprecated Moving to @zxing/browser
  77933. *
  77934. * QR Code reader to use from browser.
  77935. */
  77936. var BrowserQRCodeReader = /** @class */function (_super) {
  77937. __extends(BrowserQRCodeReader, _super);
  77938. /**
  77939. * Creates an instance of BrowserQRCodeReader.
  77940. * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries
  77941. */
  77942. function BrowserQRCodeReader(timeBetweenScansMillis) {
  77943. if (timeBetweenScansMillis === void 0) {
  77944. timeBetweenScansMillis = 500;
  77945. }
  77946. return _super.call(this, new _QRCodeReader.default(), timeBetweenScansMillis) || this;
  77947. }
  77948. return BrowserQRCodeReader;
  77949. }(_BrowserCodeReader.BrowserCodeReader);
  77950. exports.BrowserQRCodeReader = BrowserQRCodeReader;
  77951. /***/ }),
  77952. /* 461 */
  77953. /*!*********************************************************************************************!*\
  77954. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/BrowserQRCodeSvgWriter.js ***!
  77955. \*********************************************************************************************/
  77956. /*! no static exports found */
  77957. /***/ (function(module, exports, __webpack_require__) {
  77958. "use strict";
  77959. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  77960. Object.defineProperty(exports, "__esModule", {
  77961. value: true
  77962. });
  77963. exports.BrowserQRCodeSvgWriter = void 0;
  77964. var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../core/EncodeHintType */ 462));
  77965. var _Encoder = _interopRequireDefault(__webpack_require__(/*! ../core/qrcode/encoder/Encoder */ 463));
  77966. var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ../core/qrcode/decoder/ErrorCorrectionLevel */ 419));
  77967. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../core/IllegalArgumentException */ 308));
  77968. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../core/IllegalStateException */ 344));
  77969. /**
  77970. * @deprecated Moving to @zxing/browser
  77971. */
  77972. var BrowserQRCodeSvgWriter = /** @class */function () {
  77973. function BrowserQRCodeSvgWriter() {}
  77974. /**
  77975. * Writes and renders a QRCode SVG element.
  77976. *
  77977. * @param contents
  77978. * @param width
  77979. * @param height
  77980. * @param hints
  77981. */
  77982. BrowserQRCodeSvgWriter.prototype.write = function (contents, width, height, hints) {
  77983. if (hints === void 0) {
  77984. hints = null;
  77985. }
  77986. if (contents.length === 0) {
  77987. throw new _IllegalArgumentException.default('Found empty contents');
  77988. }
  77989. // if (format != BarcodeFormat.QR_CODE) {
  77990. // throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format)
  77991. // }
  77992. if (width < 0 || height < 0) {
  77993. throw new _IllegalArgumentException.default('Requested dimensions are too small: ' + width + 'x' + height);
  77994. }
  77995. var errorCorrectionLevel = _ErrorCorrectionLevel.default.L;
  77996. var quietZone = BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE;
  77997. if (hints !== null) {
  77998. if (undefined !== hints.get(_EncodeHintType.default.ERROR_CORRECTION)) {
  77999. errorCorrectionLevel = _ErrorCorrectionLevel.default.fromString(hints.get(_EncodeHintType.default.ERROR_CORRECTION).toString());
  78000. }
  78001. if (undefined !== hints.get(_EncodeHintType.default.MARGIN)) {
  78002. quietZone = Number.parseInt(hints.get(_EncodeHintType.default.MARGIN).toString(), 10);
  78003. }
  78004. }
  78005. var code = _Encoder.default.encode(contents, errorCorrectionLevel, hints);
  78006. return this.renderResult(code, width, height, quietZone);
  78007. };
  78008. /**
  78009. * Renders the result and then appends it to the DOM.
  78010. */
  78011. BrowserQRCodeSvgWriter.prototype.writeToDom = function (containerElement, contents, width, height, hints) {
  78012. if (hints === void 0) {
  78013. hints = null;
  78014. }
  78015. if (typeof containerElement === 'string') {
  78016. containerElement = document.querySelector(containerElement);
  78017. }
  78018. var svgElement = this.write(contents, width, height, hints);
  78019. if (containerElement) containerElement.appendChild(svgElement);
  78020. };
  78021. /**
  78022. * Note that the input matrix uses 0 == white, 1 == black.
  78023. * The output matrix uses 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
  78024. */
  78025. BrowserQRCodeSvgWriter.prototype.renderResult = function (code, width /*int*/, height /*int*/, quietZone /*int*/) {
  78026. var input = code.getMatrix();
  78027. if (input === null) {
  78028. throw new _IllegalStateException.default();
  78029. }
  78030. var inputWidth = input.getWidth();
  78031. var inputHeight = input.getHeight();
  78032. var qrWidth = inputWidth + quietZone * 2;
  78033. var qrHeight = inputHeight + quietZone * 2;
  78034. var outputWidth = Math.max(width, qrWidth);
  78035. var outputHeight = Math.max(height, qrHeight);
  78036. var multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));
  78037. // Padding includes both the quiet zone and the extra white pixels to accommodate the requested
  78038. // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
  78039. // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
  78040. // handle all the padding from 100x100 (the actual QR) up to 200x160.
  78041. var leftPadding = Math.floor((outputWidth - inputWidth * multiple) / 2);
  78042. var topPadding = Math.floor((outputHeight - inputHeight * multiple) / 2);
  78043. var svgElement = this.createSVGElement(outputWidth, outputHeight);
  78044. for (var inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
  78045. // Write the contents of this row of the barcode
  78046. for (var inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
  78047. if (input.get(inputX, inputY) === 1) {
  78048. var svgRectElement = this.createSvgRectElement(outputX, outputY, multiple, multiple);
  78049. svgElement.appendChild(svgRectElement);
  78050. }
  78051. }
  78052. }
  78053. return svgElement;
  78054. };
  78055. /**
  78056. * Creates a SVG element.
  78057. *
  78058. * @param w SVG's width attribute
  78059. * @param h SVG's height attribute
  78060. */
  78061. BrowserQRCodeSvgWriter.prototype.createSVGElement = function (w, h) {
  78062. var svgElement = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'svg');
  78063. svgElement.setAttributeNS(null, 'height', w.toString());
  78064. svgElement.setAttributeNS(null, 'width', h.toString());
  78065. return svgElement;
  78066. };
  78067. /**
  78068. * Creates a SVG rect element.
  78069. *
  78070. * @param x Element's x coordinate
  78071. * @param y Element's y coordinate
  78072. * @param w Element's width attribute
  78073. * @param h Element's height attribute
  78074. */
  78075. BrowserQRCodeSvgWriter.prototype.createSvgRectElement = function (x, y, w, h) {
  78076. var rect = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'rect');
  78077. rect.setAttributeNS(null, 'x', x.toString());
  78078. rect.setAttributeNS(null, 'y', y.toString());
  78079. rect.setAttributeNS(null, 'height', w.toString());
  78080. rect.setAttributeNS(null, 'width', h.toString());
  78081. rect.setAttributeNS(null, 'fill', '#000000');
  78082. return rect;
  78083. };
  78084. BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE = 4;
  78085. /**
  78086. * SVG markup NameSpace
  78087. */
  78088. BrowserQRCodeSvgWriter.SVG_NS = 'http://www.w3.org/2000/svg';
  78089. return BrowserQRCodeSvgWriter;
  78090. }();
  78091. exports.BrowserQRCodeSvgWriter = BrowserQRCodeSvgWriter;
  78092. /***/ }),
  78093. /* 462 */
  78094. /*!**********************************************************************************!*\
  78095. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/EncodeHintType.js ***!
  78096. \**********************************************************************************/
  78097. /*! no static exports found */
  78098. /***/ (function(module, exports, __webpack_require__) {
  78099. "use strict";
  78100. Object.defineProperty(exports, "__esModule", {
  78101. value: true
  78102. });
  78103. exports.default = void 0;
  78104. /*
  78105. * Copyright 2009 ZXing authors
  78106. *
  78107. * Licensed under the Apache License, Version 2.0 (the "License");
  78108. * you may not use this file except in compliance with the License.
  78109. * You may obtain a copy of the License at
  78110. *
  78111. * http://www.apache.org/licenses/LICENSE-2.0
  78112. *
  78113. * Unless required by applicable law or agreed to in writing, software
  78114. * distributed under the License is distributed on an "AS IS" BASIS,
  78115. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  78116. * See the License for the specific language governing permissions and
  78117. * limitations under the License.
  78118. */
  78119. /*namespace com.google.zxing {*/
  78120. /**
  78121. * These are a set of hints that you may pass to Writers to specify their behavior.
  78122. *
  78123. * @author dswitkin@google.com (Daniel Switkin)
  78124. */
  78125. var EncodeHintType;
  78126. (function (EncodeHintType) {
  78127. /**
  78128. * Specifies what degree of error correction to use, for example in QR Codes.
  78129. * Type depends on the encoder. For example for QR codes it's type
  78130. * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
  78131. * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
  78132. * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
  78133. * In all cases, it can also be a {@link String} representation of the desired value as well.
  78134. * Note: an Aztec symbol should have a minimum of 25% EC words.
  78135. */
  78136. EncodeHintType[EncodeHintType["ERROR_CORRECTION"] = 0] = "ERROR_CORRECTION";
  78137. /**
  78138. * Specifies what character encoding to use where applicable (type {@link String})
  78139. */
  78140. EncodeHintType[EncodeHintType["CHARACTER_SET"] = 1] = "CHARACTER_SET";
  78141. /**
  78142. * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
  78143. */
  78144. EncodeHintType[EncodeHintType["DATA_MATRIX_SHAPE"] = 2] = "DATA_MATRIX_SHAPE";
  78145. /**
  78146. * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
  78147. * {@link String } value).
  78148. * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
  78149. * character set via ECIs.
  78150. * Please note that in that case, the most compact character encoding is chosen for characters in
  78151. * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
  78152. * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
  78153. * means of the {@link #CHARACTER_SET} encoding hint.
  78154. * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
  78155. * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
  78156. * for the purpose of delimiting AIs.
  78157. * This option and {@link #FORCE_C40} are mutually exclusive.
  78158. */
  78159. EncodeHintType[EncodeHintType["DATA_MATRIX_COMPACT"] = 3] = "DATA_MATRIX_COMPACT";
  78160. /**
  78161. * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
  78162. *
  78163. * @deprecated use width/height params in
  78164. * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
  78165. */
  78166. /*@Deprecated*/
  78167. EncodeHintType[EncodeHintType["MIN_SIZE"] = 4] = "MIN_SIZE";
  78168. /**
  78169. * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
  78170. *
  78171. * @deprecated without replacement
  78172. */
  78173. /*@Deprecated*/
  78174. EncodeHintType[EncodeHintType["MAX_SIZE"] = 5] = "MAX_SIZE";
  78175. /**
  78176. * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
  78177. * by format; for example it controls margin before and after the barcode horizontally for
  78178. * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
  78179. */
  78180. EncodeHintType[EncodeHintType["MARGIN"] = 6] = "MARGIN";
  78181. /**
  78182. * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
  78183. * {@link String} value).
  78184. */
  78185. EncodeHintType[EncodeHintType["PDF417_COMPACT"] = 7] = "PDF417_COMPACT";
  78186. /**
  78187. * Specifies what compaction mode to use for PDF417 (type
  78188. * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
  78189. * enum values).
  78190. */
  78191. EncodeHintType[EncodeHintType["PDF417_COMPACTION"] = 8] = "PDF417_COMPACTION";
  78192. /**
  78193. * Specifies the minimum and maximum number of rows and columns for PDF417 (type
  78194. * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
  78195. */
  78196. EncodeHintType[EncodeHintType["PDF417_DIMENSIONS"] = 9] = "PDF417_DIMENSIONS";
  78197. /**
  78198. * Specifies the required number of layers for an Aztec code.
  78199. * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
  78200. * 0 indicates to use the minimum number of layers (the default).
  78201. * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
  78202. * (Type {@link Integer}, or {@link String} representation of the integer value).
  78203. */
  78204. EncodeHintType[EncodeHintType["AZTEC_LAYERS"] = 10] = "AZTEC_LAYERS";
  78205. /**
  78206. * Specifies the exact version of QR code to be encoded.
  78207. * (Type {@link Integer}, or {@link String} representation of the integer value).
  78208. */
  78209. EncodeHintType[EncodeHintType["QR_VERSION"] = 11] = "QR_VERSION";
  78210. /**
  78211. * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
  78212. * {@link String } value).
  78213. */
  78214. EncodeHintType[EncodeHintType["GS1_FORMAT"] = 12] = "GS1_FORMAT";
  78215. /**
  78216. * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
  78217. * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
  78218. */
  78219. EncodeHintType[EncodeHintType["FORCE_C40"] = 13] = "FORCE_C40";
  78220. })(EncodeHintType || (EncodeHintType = {}));
  78221. var _default = EncodeHintType;
  78222. exports.default = _default;
  78223. /***/ }),
  78224. /* 463 */
  78225. /*!******************************************************************************************!*\
  78226. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/Encoder.js ***!
  78227. \******************************************************************************************/
  78228. /*! no static exports found */
  78229. /***/ (function(module, exports, __webpack_require__) {
  78230. "use strict";
  78231. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  78232. Object.defineProperty(exports, "__esModule", {
  78233. value: true
  78234. });
  78235. exports.default = void 0;
  78236. var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../../EncodeHintType */ 462));
  78237. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
  78238. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../../common/CharacterSetECI */ 323));
  78239. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
  78240. var _ReedSolomonEncoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonEncoder */ 464));
  78241. var _Mode = _interopRequireDefault(__webpack_require__(/*! ../decoder/Mode */ 425));
  78242. var _Version = _interopRequireDefault(__webpack_require__(/*! ../decoder/Version */ 417));
  78243. var _MaskUtil = _interopRequireDefault(__webpack_require__(/*! ./MaskUtil */ 465));
  78244. var _ByteMatrix = _interopRequireDefault(__webpack_require__(/*! ./ByteMatrix */ 466));
  78245. var _QRCode = _interopRequireDefault(__webpack_require__(/*! ./QRCode */ 467));
  78246. var _MatrixUtil = _interopRequireDefault(__webpack_require__(/*! ./MatrixUtil */ 468));
  78247. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../../util/StringEncoding */ 325));
  78248. var _BlockPair = _interopRequireDefault(__webpack_require__(/*! ./BlockPair */ 470));
  78249. var _WriterException = _interopRequireDefault(__webpack_require__(/*! ../../WriterException */ 469));
  78250. /*
  78251. * Copyright 2008 ZXing authors
  78252. *
  78253. * Licensed under the Apache License, Version 2.0 (the "License");
  78254. * you may not use this file except in compliance with the License.
  78255. * You may obtain a copy of the License at
  78256. *
  78257. * http://www.apache.org/licenses/LICENSE-2.0
  78258. *
  78259. * Unless required by applicable law or agreed to in writing, software
  78260. * distributed under the License is distributed on an "AS IS" BASIS,
  78261. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  78262. * See the License for the specific language governing permissions and
  78263. * limitations under the License.
  78264. */
  78265. var __values = void 0 && (void 0).__values || function (o) {
  78266. var s = typeof Symbol === "function" && Symbol.iterator,
  78267. m = s && o[s],
  78268. i = 0;
  78269. if (m) return m.call(o);
  78270. if (o && typeof o.length === "number") return {
  78271. next: function next() {
  78272. if (o && i >= o.length) o = void 0;
  78273. return {
  78274. value: o && o[i++],
  78275. done: !o
  78276. };
  78277. }
  78278. };
  78279. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  78280. };
  78281. /*namespace com.google.zxing.qrcode.encoder {*/
  78282. /*import java.io.UnsupportedEncodingException;*/
  78283. /*import java.util.ArrayList;*/
  78284. /*import java.util.Collection;*/
  78285. /*import java.util.Map;*/
  78286. /**
  78287. * @author satorux@google.com (Satoru Takabayashi) - creator
  78288. * @author dswitkin@google.com (Daniel Switkin) - ported from C++
  78289. */
  78290. var Encoder = /** @class */function () {
  78291. // TYPESCRIPTPORT: changed to UTF8, the default for js
  78292. function Encoder() {}
  78293. // The mask penalty calculation is complicated. See Table 21 of JISX0510:2004 (p.45) for details.
  78294. // Basically it applies four rules and summate all penalties.
  78295. Encoder.calculateMaskPenalty = function (matrix) {
  78296. return _MaskUtil.default.applyMaskPenaltyRule1(matrix) + _MaskUtil.default.applyMaskPenaltyRule2(matrix) + _MaskUtil.default.applyMaskPenaltyRule3(matrix) + _MaskUtil.default.applyMaskPenaltyRule4(matrix);
  78297. };
  78298. /**
  78299. * @param content text to encode
  78300. * @param ecLevel error correction level to use
  78301. * @return {@link QRCode} representing the encoded QR code
  78302. * @throws WriterException if encoding can't succeed, because of for example invalid content
  78303. * or configuration
  78304. */
  78305. // public static encode(content: string, ecLevel: ErrorCorrectionLevel): QRCode /*throws WriterException*/ {
  78306. // return encode(content, ecLevel, null)
  78307. // }
  78308. Encoder.encode = function (content, ecLevel, hints) {
  78309. if (hints === void 0) {
  78310. hints = null;
  78311. }
  78312. // Determine what character encoding has been specified by the caller, if any
  78313. var encoding = Encoder.DEFAULT_BYTE_MODE_ENCODING;
  78314. var hasEncodingHint = hints !== null && undefined !== hints.get(_EncodeHintType.default.CHARACTER_SET);
  78315. if (hasEncodingHint) {
  78316. encoding = hints.get(_EncodeHintType.default.CHARACTER_SET).toString();
  78317. }
  78318. // Pick an encoding mode appropriate for the content. Note that this will not attempt to use
  78319. // multiple modes / segments even if that were more efficient. Twould be nice.
  78320. var mode = this.chooseMode(content, encoding);
  78321. // This will store the header information, like mode and
  78322. // length, as well as "header" segments like an ECI segment.
  78323. var headerBits = new _BitArray.default();
  78324. // Append ECI segment if applicable
  78325. if (mode === _Mode.default.BYTE && (hasEncodingHint || Encoder.DEFAULT_BYTE_MODE_ENCODING !== encoding)) {
  78326. var eci = _CharacterSetECI.default.getCharacterSetECIByName(encoding);
  78327. if (eci !== undefined) {
  78328. this.appendECI(eci, headerBits);
  78329. }
  78330. }
  78331. // (With ECI in place,) Write the mode marker
  78332. this.appendModeInfo(mode, headerBits);
  78333. // Collect data within the main segment, separately, to count its size if needed. Don't add it to
  78334. // main payload yet.
  78335. var dataBits = new _BitArray.default();
  78336. this.appendBytes(content, mode, dataBits, encoding);
  78337. var version;
  78338. if (hints !== null && undefined !== hints.get(_EncodeHintType.default.QR_VERSION)) {
  78339. var versionNumber = Number.parseInt(hints.get(_EncodeHintType.default.QR_VERSION).toString(), 10);
  78340. version = _Version.default.getVersionForNumber(versionNumber);
  78341. var bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, version);
  78342. if (!this.willFit(bitsNeeded, version, ecLevel)) {
  78343. throw new _WriterException.default('Data too big for requested version');
  78344. }
  78345. } else {
  78346. version = this.recommendVersion(ecLevel, mode, headerBits, dataBits);
  78347. }
  78348. var headerAndDataBits = new _BitArray.default();
  78349. headerAndDataBits.appendBitArray(headerBits);
  78350. // Find "length" of main segment and write it
  78351. var numLetters = mode === _Mode.default.BYTE ? dataBits.getSizeInBytes() : content.length;
  78352. this.appendLengthInfo(numLetters, version, mode, headerAndDataBits);
  78353. // Put data together into the overall payload
  78354. headerAndDataBits.appendBitArray(dataBits);
  78355. var ecBlocks = version.getECBlocksForLevel(ecLevel);
  78356. var numDataBytes = version.getTotalCodewords() - ecBlocks.getTotalECCodewords();
  78357. // Terminate the bits properly.
  78358. this.terminateBits(numDataBytes, headerAndDataBits);
  78359. // Interleave data bits with error correction code.
  78360. var finalBits = this.interleaveWithECBytes(headerAndDataBits, version.getTotalCodewords(), numDataBytes, ecBlocks.getNumBlocks());
  78361. var qrCode = new _QRCode.default();
  78362. qrCode.setECLevel(ecLevel);
  78363. qrCode.setMode(mode);
  78364. qrCode.setVersion(version);
  78365. // Choose the mask pattern and set to "qrCode".
  78366. var dimension = version.getDimensionForVersion();
  78367. var matrix = new _ByteMatrix.default(dimension, dimension);
  78368. var maskPattern = this.chooseMaskPattern(finalBits, ecLevel, version, matrix);
  78369. qrCode.setMaskPattern(maskPattern);
  78370. // Build the matrix and set it to "qrCode".
  78371. _MatrixUtil.default.buildMatrix(finalBits, ecLevel, version, maskPattern, matrix);
  78372. qrCode.setMatrix(matrix);
  78373. return qrCode;
  78374. };
  78375. /**
  78376. * Decides the smallest version of QR code that will contain all of the provided data.
  78377. *
  78378. * @throws WriterException if the data cannot fit in any version
  78379. */
  78380. Encoder.recommendVersion = function (ecLevel, mode, headerBits, dataBits) {
  78381. // Hard part: need to know version to know how many bits length takes. But need to know how many
  78382. // bits it takes to know version. First we take a guess at version by assuming version will be
  78383. // the minimum, 1:
  78384. var provisionalBitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, _Version.default.getVersionForNumber(1));
  78385. var provisionalVersion = this.chooseVersion(provisionalBitsNeeded, ecLevel);
  78386. // Use that guess to calculate the right version. I am still not sure this works in 100% of cases.
  78387. var bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);
  78388. return this.chooseVersion(bitsNeeded, ecLevel);
  78389. };
  78390. Encoder.calculateBitsNeeded = function (mode, headerBits, dataBits, version) {
  78391. return headerBits.getSize() + mode.getCharacterCountBits(version) + dataBits.getSize();
  78392. };
  78393. /**
  78394. * @return the code point of the table used in alphanumeric mode or
  78395. * -1 if there is no corresponding code in the table.
  78396. */
  78397. Encoder.getAlphanumericCode = function (code /*int*/) {
  78398. if (code < Encoder.ALPHANUMERIC_TABLE.length) {
  78399. return Encoder.ALPHANUMERIC_TABLE[code];
  78400. }
  78401. return -1;
  78402. };
  78403. // public static chooseMode(content: string): Mode {
  78404. // return chooseMode(content, null);
  78405. // }
  78406. /**
  78407. * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;
  78408. * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.
  78409. */
  78410. Encoder.chooseMode = function (content, encoding) {
  78411. if (encoding === void 0) {
  78412. encoding = null;
  78413. }
  78414. if (_CharacterSetECI.default.SJIS.getName() === encoding && this.isOnlyDoubleByteKanji(content)) {
  78415. // Choose Kanji mode if all input are double-byte characters
  78416. return _Mode.default.KANJI;
  78417. }
  78418. var hasNumeric = false;
  78419. var hasAlphanumeric = false;
  78420. for (var i = 0, length_1 = content.length; i < length_1; ++i) {
  78421. var c = content.charAt(i);
  78422. if (Encoder.isDigit(c)) {
  78423. hasNumeric = true;
  78424. } else if (this.getAlphanumericCode(c.charCodeAt(0)) !== -1) {
  78425. hasAlphanumeric = true;
  78426. } else {
  78427. return _Mode.default.BYTE;
  78428. }
  78429. }
  78430. if (hasAlphanumeric) {
  78431. return _Mode.default.ALPHANUMERIC;
  78432. }
  78433. if (hasNumeric) {
  78434. return _Mode.default.NUMERIC;
  78435. }
  78436. return _Mode.default.BYTE;
  78437. };
  78438. Encoder.isOnlyDoubleByteKanji = function (content) {
  78439. var bytes;
  78440. try {
  78441. bytes = _StringEncoding.default.encode(content, _CharacterSetECI.default.SJIS); // content.getBytes("Shift_JIS"))
  78442. } catch (ignored /*: UnsupportedEncodingException*/) {
  78443. return false;
  78444. }
  78445. var length = bytes.length;
  78446. if (length % 2 !== 0) {
  78447. return false;
  78448. }
  78449. for (var i = 0; i < length; i += 2) {
  78450. var byte1 = bytes[i] & 0xFF;
  78451. if ((byte1 < 0x81 || byte1 > 0x9F) && (byte1 < 0xE0 || byte1 > 0xEB)) {
  78452. return false;
  78453. }
  78454. }
  78455. return true;
  78456. };
  78457. Encoder.chooseMaskPattern = function (bits, ecLevel, version, matrix) {
  78458. var minPenalty = Number.MAX_SAFE_INTEGER; // Lower penalty is better.
  78459. var bestMaskPattern = -1;
  78460. // We try all mask patterns to choose the best one.
  78461. for (var maskPattern = 0; maskPattern < _QRCode.default.NUM_MASK_PATTERNS; maskPattern++) {
  78462. _MatrixUtil.default.buildMatrix(bits, ecLevel, version, maskPattern, matrix);
  78463. var penalty = this.calculateMaskPenalty(matrix);
  78464. if (penalty < minPenalty) {
  78465. minPenalty = penalty;
  78466. bestMaskPattern = maskPattern;
  78467. }
  78468. }
  78469. return bestMaskPattern;
  78470. };
  78471. Encoder.chooseVersion = function (numInputBits /*int*/, ecLevel) {
  78472. for (var versionNum = 1; versionNum <= 40; versionNum++) {
  78473. var version = _Version.default.getVersionForNumber(versionNum);
  78474. if (Encoder.willFit(numInputBits, version, ecLevel)) {
  78475. return version;
  78476. }
  78477. }
  78478. throw new _WriterException.default('Data too big');
  78479. };
  78480. /**
  78481. * @return true if the number of input bits will fit in a code with the specified version and
  78482. * error correction level.
  78483. */
  78484. Encoder.willFit = function (numInputBits /*int*/, version, ecLevel) {
  78485. // In the following comments, we use numbers of Version 7-H.
  78486. // numBytes = 196
  78487. var numBytes = version.getTotalCodewords();
  78488. // getNumECBytes = 130
  78489. var ecBlocks = version.getECBlocksForLevel(ecLevel);
  78490. var numEcBytes = ecBlocks.getTotalECCodewords();
  78491. // getNumDataBytes = 196 - 130 = 66
  78492. var numDataBytes = numBytes - numEcBytes;
  78493. var totalInputBytes = (numInputBits + 7) / 8;
  78494. return numDataBytes >= totalInputBytes;
  78495. };
  78496. /**
  78497. * Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).
  78498. */
  78499. Encoder.terminateBits = function (numDataBytes /*int*/, bits) {
  78500. var capacity = numDataBytes * 8;
  78501. if (bits.getSize() > capacity) {
  78502. throw new _WriterException.default('data bits cannot fit in the QR Code' + bits.getSize() + ' > ' + capacity);
  78503. }
  78504. for (var i = 0; i < 4 && bits.getSize() < capacity; ++i) {
  78505. bits.appendBit(false);
  78506. }
  78507. // Append termination bits. See 8.4.8 of JISX0510:2004 (p.24) for details.
  78508. // If the last byte isn't 8-bit aligned, we'll add padding bits.
  78509. var numBitsInLastByte = bits.getSize() & 0x07;
  78510. if (numBitsInLastByte > 0) {
  78511. for (var i = numBitsInLastByte; i < 8; i++) {
  78512. bits.appendBit(false);
  78513. }
  78514. }
  78515. // If we have more space, we'll fill the space with padding patterns defined in 8.4.9 (p.24).
  78516. var numPaddingBytes = numDataBytes - bits.getSizeInBytes();
  78517. for (var i = 0; i < numPaddingBytes; ++i) {
  78518. bits.appendBits((i & 0x01) === 0 ? 0xEC : 0x11, 8);
  78519. }
  78520. if (bits.getSize() !== capacity) {
  78521. throw new _WriterException.default('Bits size does not equal capacity');
  78522. }
  78523. };
  78524. /**
  78525. * Get number of data bytes and number of error correction bytes for block id "blockID". Store
  78526. * the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of
  78527. * JISX0510:2004 (p.30)
  78528. */
  78529. Encoder.getNumDataBytesAndNumECBytesForBlockID = function (numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/, blockID /*int*/, numDataBytesInBlock, numECBytesInBlock) {
  78530. if (blockID >= numRSBlocks) {
  78531. throw new _WriterException.default('Block ID too large');
  78532. }
  78533. // numRsBlocksInGroup2 = 196 % 5 = 1
  78534. var numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;
  78535. // numRsBlocksInGroup1 = 5 - 1 = 4
  78536. var numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;
  78537. // numTotalBytesInGroup1 = 196 / 5 = 39
  78538. var numTotalBytesInGroup1 = Math.floor(numTotalBytes / numRSBlocks);
  78539. // numTotalBytesInGroup2 = 39 + 1 = 40
  78540. var numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;
  78541. // numDataBytesInGroup1 = 66 / 5 = 13
  78542. var numDataBytesInGroup1 = Math.floor(numDataBytes / numRSBlocks);
  78543. // numDataBytesInGroup2 = 13 + 1 = 14
  78544. var numDataBytesInGroup2 = numDataBytesInGroup1 + 1;
  78545. // numEcBytesInGroup1 = 39 - 13 = 26
  78546. var numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;
  78547. // numEcBytesInGroup2 = 40 - 14 = 26
  78548. var numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;
  78549. // Sanity checks.
  78550. // 26 = 26
  78551. if (numEcBytesInGroup1 !== numEcBytesInGroup2) {
  78552. throw new _WriterException.default('EC bytes mismatch');
  78553. }
  78554. // 5 = 4 + 1.
  78555. if (numRSBlocks !== numRsBlocksInGroup1 + numRsBlocksInGroup2) {
  78556. throw new _WriterException.default('RS blocks mismatch');
  78557. }
  78558. // 196 = (13 + 26) * 4 + (14 + 26) * 1
  78559. if (numTotalBytes !== (numDataBytesInGroup1 + numEcBytesInGroup1) * numRsBlocksInGroup1 + (numDataBytesInGroup2 + numEcBytesInGroup2) * numRsBlocksInGroup2) {
  78560. throw new _WriterException.default('Total bytes mismatch');
  78561. }
  78562. if (blockID < numRsBlocksInGroup1) {
  78563. numDataBytesInBlock[0] = numDataBytesInGroup1;
  78564. numECBytesInBlock[0] = numEcBytesInGroup1;
  78565. } else {
  78566. numDataBytesInBlock[0] = numDataBytesInGroup2;
  78567. numECBytesInBlock[0] = numEcBytesInGroup2;
  78568. }
  78569. };
  78570. /**
  78571. * Interleave "bits" with corresponding error correction bytes. On success, store the result in
  78572. * "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.
  78573. */
  78574. Encoder.interleaveWithECBytes = function (bits, numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/) {
  78575. var e_1, _a, e_2, _b;
  78576. // "bits" must have "getNumDataBytes" bytes of data.
  78577. if (bits.getSizeInBytes() !== numDataBytes) {
  78578. throw new _WriterException.default('Number of bits and data bytes does not match');
  78579. }
  78580. // Step 1. Divide data bytes into blocks and generate error correction bytes for them. We'll
  78581. // store the divided data bytes blocks and error correction bytes blocks into "blocks".
  78582. var dataBytesOffset = 0;
  78583. var maxNumDataBytes = 0;
  78584. var maxNumEcBytes = 0;
  78585. // Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.
  78586. var blocks = new Array(); // new Array<BlockPair>(numRSBlocks)
  78587. for (var i = 0; i < numRSBlocks; ++i) {
  78588. var numDataBytesInBlock = new Int32Array(1);
  78589. var numEcBytesInBlock = new Int32Array(1);
  78590. Encoder.getNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes, numRSBlocks, i, numDataBytesInBlock, numEcBytesInBlock);
  78591. var size = numDataBytesInBlock[0];
  78592. var dataBytes = new Uint8Array(size);
  78593. bits.toBytes(8 * dataBytesOffset, dataBytes, 0, size);
  78594. var ecBytes = Encoder.generateECBytes(dataBytes, numEcBytesInBlock[0]);
  78595. blocks.push(new _BlockPair.default(dataBytes, ecBytes));
  78596. maxNumDataBytes = Math.max(maxNumDataBytes, size);
  78597. maxNumEcBytes = Math.max(maxNumEcBytes, ecBytes.length);
  78598. dataBytesOffset += numDataBytesInBlock[0];
  78599. }
  78600. if (numDataBytes !== dataBytesOffset) {
  78601. throw new _WriterException.default('Data bytes does not match offset');
  78602. }
  78603. var result = new _BitArray.default();
  78604. // First, place data blocks.
  78605. for (var i = 0; i < maxNumDataBytes; ++i) {
  78606. try {
  78607. for (var blocks_1 = (e_1 = void 0, __values(blocks)), blocks_1_1 = blocks_1.next(); !blocks_1_1.done; blocks_1_1 = blocks_1.next()) {
  78608. var block = blocks_1_1.value;
  78609. var dataBytes = block.getDataBytes();
  78610. if (i < dataBytes.length) {
  78611. result.appendBits(dataBytes[i], 8);
  78612. }
  78613. }
  78614. } catch (e_1_1) {
  78615. e_1 = {
  78616. error: e_1_1
  78617. };
  78618. } finally {
  78619. try {
  78620. if (blocks_1_1 && !blocks_1_1.done && (_a = blocks_1.return)) _a.call(blocks_1);
  78621. } finally {
  78622. if (e_1) throw e_1.error;
  78623. }
  78624. }
  78625. }
  78626. // Then, place error correction blocks.
  78627. for (var i = 0; i < maxNumEcBytes; ++i) {
  78628. try {
  78629. for (var blocks_2 = (e_2 = void 0, __values(blocks)), blocks_2_1 = blocks_2.next(); !blocks_2_1.done; blocks_2_1 = blocks_2.next()) {
  78630. var block = blocks_2_1.value;
  78631. var ecBytes = block.getErrorCorrectionBytes();
  78632. if (i < ecBytes.length) {
  78633. result.appendBits(ecBytes[i], 8);
  78634. }
  78635. }
  78636. } catch (e_2_1) {
  78637. e_2 = {
  78638. error: e_2_1
  78639. };
  78640. } finally {
  78641. try {
  78642. if (blocks_2_1 && !blocks_2_1.done && (_b = blocks_2.return)) _b.call(blocks_2);
  78643. } finally {
  78644. if (e_2) throw e_2.error;
  78645. }
  78646. }
  78647. }
  78648. if (numTotalBytes !== result.getSizeInBytes()) {
  78649. // Should be same.
  78650. throw new _WriterException.default('Interleaving error: ' + numTotalBytes + ' and ' + result.getSizeInBytes() + ' differ.');
  78651. }
  78652. return result;
  78653. };
  78654. Encoder.generateECBytes = function (dataBytes, numEcBytesInBlock /*int*/) {
  78655. var numDataBytes = dataBytes.length;
  78656. var toEncode = new Int32Array(numDataBytes + numEcBytesInBlock); // int[numDataBytes + numEcBytesInBlock]
  78657. for (var i = 0; i < numDataBytes; i++) {
  78658. toEncode[i] = dataBytes[i] & 0xFF;
  78659. }
  78660. new _ReedSolomonEncoder.default(_GenericGF.default.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);
  78661. var ecBytes = new Uint8Array(numEcBytesInBlock);
  78662. for (var i = 0; i < numEcBytesInBlock; i++) {
  78663. ecBytes[i] = /*(byte) */toEncode[numDataBytes + i];
  78664. }
  78665. return ecBytes;
  78666. };
  78667. /**
  78668. * Append mode info. On success, store the result in "bits".
  78669. */
  78670. Encoder.appendModeInfo = function (mode, bits) {
  78671. bits.appendBits(mode.getBits(), 4);
  78672. };
  78673. /**
  78674. * Append length info. On success, store the result in "bits".
  78675. */
  78676. Encoder.appendLengthInfo = function (numLetters /*int*/, version, mode, bits) {
  78677. var numBits = mode.getCharacterCountBits(version);
  78678. if (numLetters >= 1 << numBits) {
  78679. throw new _WriterException.default(numLetters + ' is bigger than ' + ((1 << numBits) - 1));
  78680. }
  78681. bits.appendBits(numLetters, numBits);
  78682. };
  78683. /**
  78684. * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".
  78685. */
  78686. Encoder.appendBytes = function (content, mode, bits, encoding) {
  78687. switch (mode) {
  78688. case _Mode.default.NUMERIC:
  78689. Encoder.appendNumericBytes(content, bits);
  78690. break;
  78691. case _Mode.default.ALPHANUMERIC:
  78692. Encoder.appendAlphanumericBytes(content, bits);
  78693. break;
  78694. case _Mode.default.BYTE:
  78695. Encoder.append8BitBytes(content, bits, encoding);
  78696. break;
  78697. case _Mode.default.KANJI:
  78698. Encoder.appendKanjiBytes(content, bits);
  78699. break;
  78700. default:
  78701. throw new _WriterException.default('Invalid mode: ' + mode);
  78702. }
  78703. };
  78704. Encoder.getDigit = function (singleCharacter) {
  78705. return singleCharacter.charCodeAt(0) - 48;
  78706. };
  78707. Encoder.isDigit = function (singleCharacter) {
  78708. var cn = Encoder.getDigit(singleCharacter);
  78709. return cn >= 0 && cn <= 9;
  78710. };
  78711. Encoder.appendNumericBytes = function (content, bits) {
  78712. var length = content.length;
  78713. var i = 0;
  78714. while (i < length) {
  78715. var num1 = Encoder.getDigit(content.charAt(i));
  78716. if (i + 2 < length) {
  78717. // Encode three numeric letters in ten bits.
  78718. var num2 = Encoder.getDigit(content.charAt(i + 1));
  78719. var num3 = Encoder.getDigit(content.charAt(i + 2));
  78720. bits.appendBits(num1 * 100 + num2 * 10 + num3, 10);
  78721. i += 3;
  78722. } else if (i + 1 < length) {
  78723. // Encode two numeric letters in seven bits.
  78724. var num2 = Encoder.getDigit(content.charAt(i + 1));
  78725. bits.appendBits(num1 * 10 + num2, 7);
  78726. i += 2;
  78727. } else {
  78728. // Encode one numeric letter in four bits.
  78729. bits.appendBits(num1, 4);
  78730. i++;
  78731. }
  78732. }
  78733. };
  78734. Encoder.appendAlphanumericBytes = function (content, bits) {
  78735. var length = content.length;
  78736. var i = 0;
  78737. while (i < length) {
  78738. var code1 = Encoder.getAlphanumericCode(content.charCodeAt(i));
  78739. if (code1 === -1) {
  78740. throw new _WriterException.default();
  78741. }
  78742. if (i + 1 < length) {
  78743. var code2 = Encoder.getAlphanumericCode(content.charCodeAt(i + 1));
  78744. if (code2 === -1) {
  78745. throw new _WriterException.default();
  78746. }
  78747. // Encode two alphanumeric letters in 11 bits.
  78748. bits.appendBits(code1 * 45 + code2, 11);
  78749. i += 2;
  78750. } else {
  78751. // Encode one alphanumeric letter in six bits.
  78752. bits.appendBits(code1, 6);
  78753. i++;
  78754. }
  78755. }
  78756. };
  78757. Encoder.append8BitBytes = function (content, bits, encoding) {
  78758. var bytes;
  78759. try {
  78760. bytes = _StringEncoding.default.encode(content, encoding);
  78761. } catch (uee /*: UnsupportedEncodingException*/) {
  78762. throw new _WriterException.default(uee);
  78763. }
  78764. for (var i = 0, length_2 = bytes.length; i !== length_2; i++) {
  78765. var b = bytes[i];
  78766. bits.appendBits(b, 8);
  78767. }
  78768. };
  78769. /**
  78770. * @throws WriterException
  78771. */
  78772. Encoder.appendKanjiBytes = function (content, bits) {
  78773. var bytes;
  78774. try {
  78775. bytes = _StringEncoding.default.encode(content, _CharacterSetECI.default.SJIS);
  78776. } catch (uee /*: UnsupportedEncodingException*/) {
  78777. throw new _WriterException.default(uee);
  78778. }
  78779. var length = bytes.length;
  78780. for (var i = 0; i < length; i += 2) {
  78781. var byte1 = bytes[i] & 0xFF;
  78782. var byte2 = bytes[i + 1] & 0xFF;
  78783. var code = byte1 << 8 & 0xFFFFFFFF | byte2;
  78784. var subtracted = -1;
  78785. if (code >= 0x8140 && code <= 0x9ffc) {
  78786. subtracted = code - 0x8140;
  78787. } else if (code >= 0xe040 && code <= 0xebbf) {
  78788. subtracted = code - 0xc140;
  78789. }
  78790. if (subtracted === -1) {
  78791. throw new _WriterException.default('Invalid byte sequence');
  78792. }
  78793. var encoded = (subtracted >> 8) * 0xc0 + (subtracted & 0xff);
  78794. bits.appendBits(encoded, 13);
  78795. }
  78796. };
  78797. Encoder.appendECI = function (eci, bits) {
  78798. bits.appendBits(_Mode.default.ECI.getBits(), 4);
  78799. // This is correct for values up to 127, which is all we need now.
  78800. bits.appendBits(eci.getValue(), 8);
  78801. };
  78802. // The original table is defined in the table 5 of JISX0510:2004 (p.19).
  78803. Encoder.ALPHANUMERIC_TABLE = Int32Array.from([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1]);
  78804. Encoder.DEFAULT_BYTE_MODE_ENCODING = _CharacterSetECI.default.UTF8.getName(); // "ISO-8859-1"
  78805. return Encoder;
  78806. }();
  78807. var _default = Encoder;
  78808. exports.default = _default;
  78809. /***/ }),
  78810. /* 464 */
  78811. /*!*********************************************************************************************************!*\
  78812. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/reedsolomon/ReedSolomonEncoder.js ***!
  78813. \*********************************************************************************************************/
  78814. /*! no static exports found */
  78815. /***/ (function(module, exports, __webpack_require__) {
  78816. "use strict";
  78817. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  78818. Object.defineProperty(exports, "__esModule", {
  78819. value: true
  78820. });
  78821. exports.default = void 0;
  78822. var _GenericGFPoly = _interopRequireDefault(__webpack_require__(/*! ./GenericGFPoly */ 339));
  78823. var _System = _interopRequireDefault(__webpack_require__(/*! ../../util/System */ 315));
  78824. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  78825. /*
  78826. * Copyright 2008 ZXing authors
  78827. *
  78828. * Licensed under the Apache License, Version 2.0 (the "License");
  78829. * you may not use this file except in compliance with the License.
  78830. * You may obtain a copy of the License at
  78831. *
  78832. * http://www.apache.org/licenses/LICENSE-2.0
  78833. *
  78834. * Unless required by applicable law or agreed to in writing, software
  78835. * distributed under the License is distributed on an "AS IS" BASIS,
  78836. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  78837. * See the License for the specific language governing permissions and
  78838. * limitations under the License.
  78839. */
  78840. /**
  78841. * <p>Implements Reed-Solomon encoding, as the name implies.</p>
  78842. *
  78843. * @author Sean Owen
  78844. * @author William Rucklidge
  78845. */
  78846. var ReedSolomonEncoder = /** @class */function () {
  78847. /**
  78848. * A reed solomon error-correcting encoding constructor is created by
  78849. * passing as Galois Field with of size equal to the number of code
  78850. * words (symbols) in the alphabet (the number of values in each
  78851. * element of arrays that are encoded/decoded).
  78852. * @param field A galois field with a number of elements equal to the size
  78853. * of the alphabet of symbols to encode.
  78854. */
  78855. function ReedSolomonEncoder(field) {
  78856. this.field = field;
  78857. this.cachedGenerators = [];
  78858. this.cachedGenerators.push(new _GenericGFPoly.default(field, Int32Array.from([1])));
  78859. }
  78860. ReedSolomonEncoder.prototype.buildGenerator = function (degree /*int*/) {
  78861. var cachedGenerators = this.cachedGenerators;
  78862. if (degree >= cachedGenerators.length) {
  78863. var lastGenerator = cachedGenerators[cachedGenerators.length - 1];
  78864. var field = this.field;
  78865. for (var d = cachedGenerators.length; d <= degree; d++) {
  78866. var nextGenerator = lastGenerator.multiply(new _GenericGFPoly.default(field, Int32Array.from([1, field.exp(d - 1 + field.getGeneratorBase())])));
  78867. cachedGenerators.push(nextGenerator);
  78868. lastGenerator = nextGenerator;
  78869. }
  78870. }
  78871. return cachedGenerators[degree];
  78872. };
  78873. /**
  78874. * <p>Encode a sequence of code words (symbols) using Reed-Solomon to allow decoders
  78875. * to detect and correct errors that may have been introduced when the resulting
  78876. * data is stored or transmitted.</p>
  78877. *
  78878. * @param toEncode array used for both and output. Caller initializes the array with
  78879. * the code words (symbols) to be encoded followed by empty elements allocated to make
  78880. * space for error-correction code words in the encoded output. The array contains
  78881. * the encdoded output when encode returns. Code words are encoded as numbers from
  78882. * 0 to n-1, where n is the number of possible code words (symbols), as determined
  78883. * by the size of the Galois Field passed in the constructor of this object.
  78884. * @param ecBytes the number of elements reserved in the array (first parameter)
  78885. * to store error-correction code words. Thus, the number of code words (symbols)
  78886. * to encode in the first parameter is thus toEncode.length - ecBytes.
  78887. * Note, the use of "bytes" in the name of this parameter is misleading, as there may
  78888. * be more or fewer than 256 symbols being encoded, as determined by the number of
  78889. * elements in the Galois Field passed as a constructor to this object.
  78890. * @throws IllegalArgumentException thrown in response to validation errros.
  78891. */
  78892. ReedSolomonEncoder.prototype.encode = function (toEncode, ecBytes /*int*/) {
  78893. if (ecBytes === 0) {
  78894. throw new _IllegalArgumentException.default('No error correction bytes');
  78895. }
  78896. var dataBytes = toEncode.length - ecBytes;
  78897. if (dataBytes <= 0) {
  78898. throw new _IllegalArgumentException.default('No data bytes provided');
  78899. }
  78900. var generator = this.buildGenerator(ecBytes);
  78901. var infoCoefficients = new Int32Array(dataBytes);
  78902. _System.default.arraycopy(toEncode, 0, infoCoefficients, 0, dataBytes);
  78903. var info = new _GenericGFPoly.default(this.field, infoCoefficients);
  78904. info = info.multiplyByMonomial(ecBytes, 1);
  78905. var remainder = info.divide(generator)[1];
  78906. var coefficients = remainder.getCoefficients();
  78907. var numZeroCoefficients = ecBytes - coefficients.length;
  78908. for (var i = 0; i < numZeroCoefficients; i++) {
  78909. toEncode[dataBytes + i] = 0;
  78910. }
  78911. _System.default.arraycopy(coefficients, 0, toEncode, dataBytes + numZeroCoefficients, coefficients.length);
  78912. };
  78913. return ReedSolomonEncoder;
  78914. }();
  78915. var _default = ReedSolomonEncoder;
  78916. exports.default = _default;
  78917. /***/ }),
  78918. /* 465 */
  78919. /*!*******************************************************************************************!*\
  78920. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/MaskUtil.js ***!
  78921. \*******************************************************************************************/
  78922. /*! no static exports found */
  78923. /***/ (function(module, exports, __webpack_require__) {
  78924. "use strict";
  78925. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  78926. Object.defineProperty(exports, "__esModule", {
  78927. value: true
  78928. });
  78929. exports.default = void 0;
  78930. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  78931. /*
  78932. * Copyright 2008 ZXing authors
  78933. *
  78934. * Licensed under the Apache License, Version 2.0 (the "License");
  78935. * you may not use this file except in compliance with the License.
  78936. * You may obtain a copy of the License at
  78937. *
  78938. * http://www.apache.org/licenses/LICENSE-2.0
  78939. *
  78940. * Unless required by applicable law or agreed to in writing, software
  78941. * distributed under the License is distributed on an "AS IS" BASIS,
  78942. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  78943. * See the License for the specific language governing permissions and
  78944. * limitations under the License.
  78945. */
  78946. /**
  78947. * @author Satoru Takabayashi
  78948. * @author Daniel Switkin
  78949. * @author Sean Owen
  78950. */
  78951. var MaskUtil = /** @class */function () {
  78952. function MaskUtil() {
  78953. // do nothing
  78954. }
  78955. /**
  78956. * Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and
  78957. * give penalty to them. Example: 00000 or 11111.
  78958. */
  78959. MaskUtil.applyMaskPenaltyRule1 = function (matrix) {
  78960. return MaskUtil.applyMaskPenaltyRule1Internal(matrix, true) + MaskUtil.applyMaskPenaltyRule1Internal(matrix, false);
  78961. };
  78962. /**
  78963. * Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give
  78964. * penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a
  78965. * penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.
  78966. */
  78967. MaskUtil.applyMaskPenaltyRule2 = function (matrix) {
  78968. var penalty = 0;
  78969. var array = matrix.getArray();
  78970. var width = matrix.getWidth();
  78971. var height = matrix.getHeight();
  78972. for (var y = 0; y < height - 1; y++) {
  78973. var arrayY = array[y];
  78974. for (var x = 0; x < width - 1; x++) {
  78975. var value = arrayY[x];
  78976. if (value === arrayY[x + 1] && value === array[y + 1][x] && value === array[y + 1][x + 1]) {
  78977. penalty++;
  78978. }
  78979. }
  78980. }
  78981. return MaskUtil.N2 * penalty;
  78982. };
  78983. /**
  78984. * Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
  78985. * starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
  78986. * find patterns like 000010111010000, we give penalty once.
  78987. */
  78988. MaskUtil.applyMaskPenaltyRule3 = function (matrix) {
  78989. var numPenalties = 0;
  78990. var array = matrix.getArray();
  78991. var width = matrix.getWidth();
  78992. var height = matrix.getHeight();
  78993. for (var y = 0; y < height; y++) {
  78994. for (var x = 0; x < width; x++) {
  78995. var arrayY = array[y]; // We can at least optimize this access
  78996. if (x + 6 < width && arrayY[x] === 1 && arrayY[x + 1] === 0 && arrayY[x + 2] === 1 && arrayY[x + 3] === 1 && arrayY[x + 4] === 1 && arrayY[x + 5] === 0 && arrayY[x + 6] === 1 && (MaskUtil.isWhiteHorizontal(arrayY, x - 4, x) || MaskUtil.isWhiteHorizontal(arrayY, x + 7, x + 11))) {
  78997. numPenalties++;
  78998. }
  78999. if (y + 6 < height && array[y][x] === 1 && array[y + 1][x] === 0 && array[y + 2][x] === 1 && array[y + 3][x] === 1 && array[y + 4][x] === 1 && array[y + 5][x] === 0 && array[y + 6][x] === 1 && (MaskUtil.isWhiteVertical(array, x, y - 4, y) || MaskUtil.isWhiteVertical(array, x, y + 7, y + 11))) {
  79000. numPenalties++;
  79001. }
  79002. }
  79003. }
  79004. return numPenalties * MaskUtil.N3;
  79005. };
  79006. MaskUtil.isWhiteHorizontal = function (rowArray, from /*int*/, to /*int*/) {
  79007. from = Math.max(from, 0);
  79008. to = Math.min(to, rowArray.length);
  79009. for (var i = from; i < to; i++) {
  79010. if (rowArray[i] === 1) {
  79011. return false;
  79012. }
  79013. }
  79014. return true;
  79015. };
  79016. MaskUtil.isWhiteVertical = function (array, col /*int*/, from /*int*/, to /*int*/) {
  79017. from = Math.max(from, 0);
  79018. to = Math.min(to, array.length);
  79019. for (var i = from; i < to; i++) {
  79020. if (array[i][col] === 1) {
  79021. return false;
  79022. }
  79023. }
  79024. return true;
  79025. };
  79026. /**
  79027. * Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
  79028. * penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
  79029. */
  79030. MaskUtil.applyMaskPenaltyRule4 = function (matrix) {
  79031. var numDarkCells = 0;
  79032. var array = matrix.getArray();
  79033. var width = matrix.getWidth();
  79034. var height = matrix.getHeight();
  79035. for (var y = 0; y < height; y++) {
  79036. var arrayY = array[y];
  79037. for (var x = 0; x < width; x++) {
  79038. if (arrayY[x] === 1) {
  79039. numDarkCells++;
  79040. }
  79041. }
  79042. }
  79043. var numTotalCells = matrix.getHeight() * matrix.getWidth();
  79044. var fivePercentVariances = Math.floor(Math.abs(numDarkCells * 2 - numTotalCells) * 10 / numTotalCells);
  79045. return fivePercentVariances * MaskUtil.N4;
  79046. };
  79047. /**
  79048. * Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask
  79049. * pattern conditions.
  79050. */
  79051. MaskUtil.getDataMaskBit = function (maskPattern /*int*/, x /*int*/, y /*int*/) {
  79052. var intermediate; /*int*/
  79053. var temp; /*int*/
  79054. switch (maskPattern) {
  79055. case 0:
  79056. intermediate = y + x & 0x1;
  79057. break;
  79058. case 1:
  79059. intermediate = y & 0x1;
  79060. break;
  79061. case 2:
  79062. intermediate = x % 3;
  79063. break;
  79064. case 3:
  79065. intermediate = (y + x) % 3;
  79066. break;
  79067. case 4:
  79068. intermediate = Math.floor(y / 2) + Math.floor(x / 3) & 0x1;
  79069. break;
  79070. case 5:
  79071. temp = y * x;
  79072. intermediate = (temp & 0x1) + temp % 3;
  79073. break;
  79074. case 6:
  79075. temp = y * x;
  79076. intermediate = (temp & 0x1) + temp % 3 & 0x1;
  79077. break;
  79078. case 7:
  79079. temp = y * x;
  79080. intermediate = temp % 3 + (y + x & 0x1) & 0x1;
  79081. break;
  79082. default:
  79083. throw new _IllegalArgumentException.default('Invalid mask pattern: ' + maskPattern);
  79084. }
  79085. return intermediate === 0;
  79086. };
  79087. /**
  79088. * Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both
  79089. * vertical and horizontal orders respectively.
  79090. */
  79091. MaskUtil.applyMaskPenaltyRule1Internal = function (matrix, isHorizontal) {
  79092. var penalty = 0;
  79093. var iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth();
  79094. var jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight();
  79095. var array = matrix.getArray();
  79096. for (var i = 0; i < iLimit; i++) {
  79097. var numSameBitCells = 0;
  79098. var prevBit = -1;
  79099. for (var j = 0; j < jLimit; j++) {
  79100. var bit = isHorizontal ? array[i][j] : array[j][i];
  79101. if (bit === prevBit) {
  79102. numSameBitCells++;
  79103. } else {
  79104. if (numSameBitCells >= 5) {
  79105. penalty += MaskUtil.N1 + (numSameBitCells - 5);
  79106. }
  79107. numSameBitCells = 1; // Include the cell itself.
  79108. prevBit = bit;
  79109. }
  79110. }
  79111. if (numSameBitCells >= 5) {
  79112. penalty += MaskUtil.N1 + (numSameBitCells - 5);
  79113. }
  79114. }
  79115. return penalty;
  79116. };
  79117. // Penalty weights from section 6.8.2.1
  79118. MaskUtil.N1 = 3;
  79119. MaskUtil.N2 = 3;
  79120. MaskUtil.N3 = 40;
  79121. MaskUtil.N4 = 10;
  79122. return MaskUtil;
  79123. }();
  79124. var _default = MaskUtil;
  79125. exports.default = _default;
  79126. /***/ }),
  79127. /* 466 */
  79128. /*!*********************************************************************************************!*\
  79129. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/ByteMatrix.js ***!
  79130. \*********************************************************************************************/
  79131. /*! no static exports found */
  79132. /***/ (function(module, exports, __webpack_require__) {
  79133. "use strict";
  79134. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  79135. Object.defineProperty(exports, "__esModule", {
  79136. value: true
  79137. });
  79138. exports.default = void 0;
  79139. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  79140. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  79141. /*
  79142. * Copyright 2008 ZXing authors
  79143. *
  79144. * Licensed under the Apache License, Version 2.0 (the "License");
  79145. * you may not use this file except in compliance with the License.
  79146. * You may obtain a copy of the License at
  79147. *
  79148. * http://www.apache.org/licenses/LICENSE-2.0
  79149. *
  79150. * Unless required by applicable law or agreed to in writing, software
  79151. * distributed under the License is distributed on an "AS IS" BASIS,
  79152. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  79153. * See the License for the specific language governing permissions and
  79154. * limitations under the License.
  79155. */
  79156. var __values = void 0 && (void 0).__values || function (o) {
  79157. var s = typeof Symbol === "function" && Symbol.iterator,
  79158. m = s && o[s],
  79159. i = 0;
  79160. if (m) return m.call(o);
  79161. if (o && typeof o.length === "number") return {
  79162. next: function next() {
  79163. if (o && i >= o.length) o = void 0;
  79164. return {
  79165. value: o && o[i++],
  79166. done: !o
  79167. };
  79168. }
  79169. };
  79170. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  79171. };
  79172. /*namespace com.google.zxing.qrcode.encoder {*/
  79173. /*import java.util.Arrays;*/
  79174. /**
  79175. * JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned
  79176. * -1, 0, and 1, I'm going to use less memory and go with bytes.
  79177. *
  79178. * @author dswitkin@google.com (Daniel Switkin)
  79179. */
  79180. var ByteMatrix = /** @class */function () {
  79181. function ByteMatrix(width /*int*/, height /*int*/) {
  79182. this.width = width;
  79183. this.height = height;
  79184. var bytes = new Array(height); // [height][width]
  79185. for (var i = 0; i !== height; i++) {
  79186. bytes[i] = new Uint8Array(width);
  79187. }
  79188. this.bytes = bytes;
  79189. }
  79190. ByteMatrix.prototype.getHeight = function () {
  79191. return this.height;
  79192. };
  79193. ByteMatrix.prototype.getWidth = function () {
  79194. return this.width;
  79195. };
  79196. ByteMatrix.prototype.get = function (x /*int*/, y /*int*/) {
  79197. return this.bytes[y][x];
  79198. };
  79199. /**
  79200. * @return an internal representation as bytes, in row-major order. array[y][x] represents point (x,y)
  79201. */
  79202. ByteMatrix.prototype.getArray = function () {
  79203. return this.bytes;
  79204. };
  79205. // TYPESCRIPTPORT: preffer to let two methods instead of override to avoid type comparison inside
  79206. ByteMatrix.prototype.setNumber = function (x /*int*/, y /*int*/, value /*byte|int*/) {
  79207. this.bytes[y][x] = value;
  79208. };
  79209. // public set(x: number /*int*/, y: number /*int*/, value: number /*int*/): void {
  79210. // bytes[y][x] = (byte) value
  79211. // }
  79212. ByteMatrix.prototype.setBoolean = function (x /*int*/, y /*int*/, value) {
  79213. this.bytes[y][x] = /*(byte) */value ? 1 : 0;
  79214. };
  79215. ByteMatrix.prototype.clear = function (value /*byte*/) {
  79216. var e_1, _a;
  79217. try {
  79218. for (var _b = __values(this.bytes), _c = _b.next(); !_c.done; _c = _b.next()) {
  79219. var aByte = _c.value;
  79220. _Arrays.default.fill(aByte, value);
  79221. }
  79222. } catch (e_1_1) {
  79223. e_1 = {
  79224. error: e_1_1
  79225. };
  79226. } finally {
  79227. try {
  79228. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  79229. } finally {
  79230. if (e_1) throw e_1.error;
  79231. }
  79232. }
  79233. };
  79234. ByteMatrix.prototype.equals = function (o) {
  79235. if (!(o instanceof ByteMatrix)) {
  79236. return false;
  79237. }
  79238. var other = o;
  79239. if (this.width !== other.width) {
  79240. return false;
  79241. }
  79242. if (this.height !== other.height) {
  79243. return false;
  79244. }
  79245. for (var y = 0, height = this.height; y < height; ++y) {
  79246. var bytesY = this.bytes[y];
  79247. var otherBytesY = other.bytes[y];
  79248. for (var x = 0, width = this.width; x < width; ++x) {
  79249. if (bytesY[x] !== otherBytesY[x]) {
  79250. return false;
  79251. }
  79252. }
  79253. }
  79254. return true;
  79255. };
  79256. /*@Override*/
  79257. ByteMatrix.prototype.toString = function () {
  79258. var result = new _StringBuilder.default(); // (2 * width * height + 2)
  79259. for (var y = 0, height = this.height; y < height; ++y) {
  79260. var bytesY = this.bytes[y];
  79261. for (var x = 0, width = this.width; x < width; ++x) {
  79262. switch (bytesY[x]) {
  79263. case 0:
  79264. result.append(' 0');
  79265. break;
  79266. case 1:
  79267. result.append(' 1');
  79268. break;
  79269. default:
  79270. result.append(' ');
  79271. break;
  79272. }
  79273. }
  79274. result.append('\n');
  79275. }
  79276. return result.toString();
  79277. };
  79278. return ByteMatrix;
  79279. }();
  79280. var _default = ByteMatrix;
  79281. exports.default = _default;
  79282. /***/ }),
  79283. /* 467 */
  79284. /*!*****************************************************************************************!*\
  79285. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/QRCode.js ***!
  79286. \*****************************************************************************************/
  79287. /*! no static exports found */
  79288. /***/ (function(module, exports, __webpack_require__) {
  79289. "use strict";
  79290. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  79291. Object.defineProperty(exports, "__esModule", {
  79292. value: true
  79293. });
  79294. exports.default = void 0;
  79295. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  79296. /*
  79297. * Copyright 2008 ZXing authors
  79298. *
  79299. * Licensed under the Apache License, Version 2.0 (the "License");
  79300. * you may not use this file except in compliance with the License.
  79301. * You may obtain a copy of the License at
  79302. *
  79303. * http://www.apache.org/licenses/LICENSE-2.0
  79304. *
  79305. * Unless required by applicable law or agreed to in writing, software
  79306. * distributed under the License is distributed on an "AS IS" BASIS,
  79307. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  79308. * See the License for the specific language governing permissions and
  79309. * limitations under the License.
  79310. */
  79311. /**
  79312. * @author satorux@google.com (Satoru Takabayashi) - creator
  79313. * @author dswitkin@google.com (Daniel Switkin) - ported from C++
  79314. */
  79315. var QRCode = /** @class */function () {
  79316. function QRCode() {
  79317. this.maskPattern = -1;
  79318. }
  79319. QRCode.prototype.getMode = function () {
  79320. return this.mode;
  79321. };
  79322. QRCode.prototype.getECLevel = function () {
  79323. return this.ecLevel;
  79324. };
  79325. QRCode.prototype.getVersion = function () {
  79326. return this.version;
  79327. };
  79328. QRCode.prototype.getMaskPattern = function () {
  79329. return this.maskPattern;
  79330. };
  79331. QRCode.prototype.getMatrix = function () {
  79332. return this.matrix;
  79333. };
  79334. /*@Override*/
  79335. QRCode.prototype.toString = function () {
  79336. var result = new _StringBuilder.default(); // (200)
  79337. result.append('<<\n');
  79338. result.append(' mode: ');
  79339. result.append(this.mode ? this.mode.toString() : 'null');
  79340. result.append('\n ecLevel: ');
  79341. result.append(this.ecLevel ? this.ecLevel.toString() : 'null');
  79342. result.append('\n version: ');
  79343. result.append(this.version ? this.version.toString() : 'null');
  79344. result.append('\n maskPattern: ');
  79345. result.append(this.maskPattern.toString());
  79346. if (this.matrix) {
  79347. result.append('\n matrix:\n');
  79348. result.append(this.matrix.toString());
  79349. } else {
  79350. result.append('\n matrix: null\n');
  79351. }
  79352. result.append('>>\n');
  79353. return result.toString();
  79354. };
  79355. QRCode.prototype.setMode = function (value) {
  79356. this.mode = value;
  79357. };
  79358. QRCode.prototype.setECLevel = function (value) {
  79359. this.ecLevel = value;
  79360. };
  79361. QRCode.prototype.setVersion = function (version) {
  79362. this.version = version;
  79363. };
  79364. QRCode.prototype.setMaskPattern = function (value /*int*/) {
  79365. this.maskPattern = value;
  79366. };
  79367. QRCode.prototype.setMatrix = function (value) {
  79368. this.matrix = value;
  79369. };
  79370. // Check if "mask_pattern" is valid.
  79371. QRCode.isValidMaskPattern = function (maskPattern /*int*/) {
  79372. return maskPattern >= 0 && maskPattern < QRCode.NUM_MASK_PATTERNS;
  79373. };
  79374. QRCode.NUM_MASK_PATTERNS = 8;
  79375. return QRCode;
  79376. }();
  79377. var _default = QRCode;
  79378. exports.default = _default;
  79379. /***/ }),
  79380. /* 468 */
  79381. /*!*********************************************************************************************!*\
  79382. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/MatrixUtil.js ***!
  79383. \*********************************************************************************************/
  79384. /*! no static exports found */
  79385. /***/ (function(module, exports, __webpack_require__) {
  79386. "use strict";
  79387. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  79388. Object.defineProperty(exports, "__esModule", {
  79389. value: true
  79390. });
  79391. exports.default = void 0;
  79392. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
  79393. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  79394. var _QRCode = _interopRequireDefault(__webpack_require__(/*! ./QRCode */ 467));
  79395. var _MaskUtil = _interopRequireDefault(__webpack_require__(/*! ./MaskUtil */ 465));
  79396. var _WriterException = _interopRequireDefault(__webpack_require__(/*! ../../WriterException */ 469));
  79397. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  79398. /*
  79399. * Copyright 2008 ZXing authors
  79400. *
  79401. * Licensed under the Apache License, Version 2.0 (the "License");
  79402. * you may not use this file except in compliance with the License.
  79403. * You may obtain a copy of the License at
  79404. *
  79405. * http://www.apache.org/licenses/LICENSE-2.0
  79406. *
  79407. * Unless required by applicable law or agreed to in writing, software
  79408. * distributed under the License is distributed on an "AS IS" BASIS,
  79409. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  79410. * See the License for the specific language governing permissions and
  79411. * limitations under the License.
  79412. */
  79413. /*namespace com.google.zxing.qrcode.encoder {*/
  79414. /**
  79415. * @author satorux@google.com (Satoru Takabayashi) - creator
  79416. * @author dswitkin@google.com (Daniel Switkin) - ported from C++
  79417. */
  79418. var MatrixUtil = /** @class */function () {
  79419. function MatrixUtil() {
  79420. // do nothing
  79421. }
  79422. // Set all cells to -1 (TYPESCRIPTPORT: 255). -1 (TYPESCRIPTPORT: 255) means that the cell is empty (not set yet).
  79423. //
  79424. // JAVAPORT: We shouldn't need to do this at all. The code should be rewritten to begin encoding
  79425. // with the ByteMatrix initialized all to zero.
  79426. MatrixUtil.clearMatrix = function (matrix) {
  79427. // TYPESCRIPTPORT: we use UintArray se changed here from -1 to 255
  79428. matrix.clear( /*(byte) */ /*-1*/255);
  79429. };
  79430. // Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On
  79431. // success, store the result in "matrix" and return true.
  79432. MatrixUtil.buildMatrix = function (dataBits, ecLevel, version, maskPattern /*int*/, matrix) {
  79433. MatrixUtil.clearMatrix(matrix);
  79434. MatrixUtil.embedBasicPatterns(version, matrix);
  79435. // Type information appear with any version.
  79436. MatrixUtil.embedTypeInfo(ecLevel, maskPattern, matrix);
  79437. // Version info appear if version >= 7.
  79438. MatrixUtil.maybeEmbedVersionInfo(version, matrix);
  79439. // Data should be embedded at end.
  79440. MatrixUtil.embedDataBits(dataBits, maskPattern, matrix);
  79441. };
  79442. // Embed basic patterns. On success, modify the matrix and return true.
  79443. // The basic patterns are:
  79444. // - Position detection patterns
  79445. // - Timing patterns
  79446. // - Dark dot at the left bottom corner
  79447. // - Position adjustment patterns, if need be
  79448. MatrixUtil.embedBasicPatterns = function (version, matrix) {
  79449. // Let's get started with embedding big squares at corners.
  79450. MatrixUtil.embedPositionDetectionPatternsAndSeparators(matrix);
  79451. // Then, embed the dark dot at the left bottom corner.
  79452. MatrixUtil.embedDarkDotAtLeftBottomCorner(matrix);
  79453. // Position adjustment patterns appear if version >= 2.
  79454. MatrixUtil.maybeEmbedPositionAdjustmentPatterns(version, matrix);
  79455. // Timing patterns should be embedded after position adj. patterns.
  79456. MatrixUtil.embedTimingPatterns(matrix);
  79457. };
  79458. // Embed type information. On success, modify the matrix.
  79459. MatrixUtil.embedTypeInfo = function (ecLevel, maskPattern /*int*/, matrix) {
  79460. var typeInfoBits = new _BitArray.default();
  79461. MatrixUtil.makeTypeInfoBits(ecLevel, maskPattern, typeInfoBits);
  79462. for (var i = 0, size = typeInfoBits.getSize(); i < size; ++i) {
  79463. // Place bits in LSB to MSB order. LSB (least significant bit) is the last value in
  79464. // "typeInfoBits".
  79465. var bit = typeInfoBits.get(typeInfoBits.getSize() - 1 - i);
  79466. // Type info bits at the left top corner. See 8.9 of JISX0510:2004 (p.46).
  79467. var coordinates = MatrixUtil.TYPE_INFO_COORDINATES[i];
  79468. var x1 = coordinates[0];
  79469. var y1 = coordinates[1];
  79470. matrix.setBoolean(x1, y1, bit);
  79471. if (i < 8) {
  79472. // Right top corner.
  79473. var x2 = matrix.getWidth() - i - 1;
  79474. var y2 = 8;
  79475. matrix.setBoolean(x2, y2, bit);
  79476. } else {
  79477. // Left bottom corner.
  79478. var x2 = 8;
  79479. var y2 = matrix.getHeight() - 7 + (i - 8);
  79480. matrix.setBoolean(x2, y2, bit);
  79481. }
  79482. }
  79483. };
  79484. // Embed version information if need be. On success, modify the matrix and return true.
  79485. // See 8.10 of JISX0510:2004 (p.47) for how to embed version information.
  79486. MatrixUtil.maybeEmbedVersionInfo = function (version, matrix) {
  79487. if (version.getVersionNumber() < 7) {
  79488. // Version info is necessary if version >= 7.
  79489. return; // Don't need version info.
  79490. }
  79491. var versionInfoBits = new _BitArray.default();
  79492. MatrixUtil.makeVersionInfoBits(version, versionInfoBits);
  79493. var bitIndex = 6 * 3 - 1; // It will decrease from 17 to 0.
  79494. for (var i = 0; i < 6; ++i) {
  79495. for (var j = 0; j < 3; ++j) {
  79496. // Place bits in LSB (least significant bit) to MSB order.
  79497. var bit = versionInfoBits.get(bitIndex);
  79498. bitIndex--;
  79499. // Left bottom corner.
  79500. matrix.setBoolean(i, matrix.getHeight() - 11 + j, bit);
  79501. // Right bottom corner.
  79502. matrix.setBoolean(matrix.getHeight() - 11 + j, i, bit);
  79503. }
  79504. }
  79505. };
  79506. // Embed "dataBits" using "getMaskPattern". On success, modify the matrix and return true.
  79507. // For debugging purposes, it skips masking process if "getMaskPattern" is -1(TYPESCRIPTPORT: 255).
  79508. // See 8.7 of JISX0510:2004 (p.38) for how to embed data bits.
  79509. MatrixUtil.embedDataBits = function (dataBits, maskPattern /*int*/, matrix) {
  79510. var bitIndex = 0;
  79511. var direction = -1;
  79512. // Start from the right bottom cell.
  79513. var x = matrix.getWidth() - 1;
  79514. var y = matrix.getHeight() - 1;
  79515. while (x > 0) {
  79516. // Skip the vertical timing pattern.
  79517. if (x === 6) {
  79518. x -= 1;
  79519. }
  79520. while (y >= 0 && y < matrix.getHeight()) {
  79521. for (var i = 0; i < 2; ++i) {
  79522. var xx = x - i;
  79523. // Skip the cell if it's not empty.
  79524. if (!MatrixUtil.isEmpty(matrix.get(xx, y))) {
  79525. continue;
  79526. }
  79527. var bit = void 0;
  79528. if (bitIndex < dataBits.getSize()) {
  79529. bit = dataBits.get(bitIndex);
  79530. ++bitIndex;
  79531. } else {
  79532. // Padding bit. If there is no bit left, we'll fill the left cells with 0, as described
  79533. // in 8.4.9 of JISX0510:2004 (p. 24).
  79534. bit = false;
  79535. }
  79536. // Skip masking if mask_pattern is -1 (TYPESCRIPTPORT: 255).
  79537. if (maskPattern !== 255 && _MaskUtil.default.getDataMaskBit(maskPattern, xx, y)) {
  79538. bit = !bit;
  79539. }
  79540. matrix.setBoolean(xx, y, bit);
  79541. }
  79542. y += direction;
  79543. }
  79544. direction = -direction; // Reverse the direction.
  79545. y += direction;
  79546. x -= 2; // Move to the left.
  79547. }
  79548. // All bits should be consumed.
  79549. if (bitIndex !== dataBits.getSize()) {
  79550. throw new _WriterException.default('Not all bits consumed: ' + bitIndex + '/' + dataBits.getSize());
  79551. }
  79552. };
  79553. // Return the position of the most significant bit set (one: to) in the "value". The most
  79554. // significant bit is position 32. If there is no bit set, return 0. Examples:
  79555. // - findMSBSet(0) => 0
  79556. // - findMSBSet(1) => 1
  79557. // - findMSBSet(255) => 8
  79558. MatrixUtil.findMSBSet = function (value /*int*/) {
  79559. return 32 - _Integer.default.numberOfLeadingZeros(value);
  79560. };
  79561. // Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for "value" using polynomial "poly". The BCH
  79562. // code is used for encoding type information and version information.
  79563. // Example: Calculation of version information of 7.
  79564. // f(x) is created from 7.
  79565. // - 7 = 000111 in 6 bits
  79566. // - f(x) = x^2 + x^1 + x^0
  79567. // g(x) is given by the standard (p. 67)
  79568. // - g(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1
  79569. // Multiply f(x) by x^(18 - 6)
  79570. // - f'(x) = f(x) * x^(18 - 6)
  79571. // - f'(x) = x^14 + x^13 + x^12
  79572. // Calculate the remainder of f'(x) / g(x)
  79573. // x^2
  79574. // __________________________________________________
  79575. // g(x) )x^14 + x^13 + x^12
  79576. // x^14 + x^13 + x^12 + x^11 + x^10 + x^7 + x^4 + x^2
  79577. // --------------------------------------------------
  79578. // x^11 + x^10 + x^7 + x^4 + x^2
  79579. //
  79580. // The remainder is x^11 + x^10 + x^7 + x^4 + x^2
  79581. // Encode it in binary: 110010010100
  79582. // The return value is 0xc94 (1100 1001 0100)
  79583. //
  79584. // Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit
  79585. // operations. We don't care if coefficients are positive or negative.
  79586. MatrixUtil.calculateBCHCode = function (value /*int*/, poly /*int*/) {
  79587. if (poly === 0) {
  79588. throw new _IllegalArgumentException.default('0 polynomial');
  79589. }
  79590. // If poly is "1 1111 0010 0101" (version info poly), msbSetInPoly is 13. We'll subtract 1
  79591. // from 13 to make it 12.
  79592. var msbSetInPoly = MatrixUtil.findMSBSet(poly);
  79593. value <<= msbSetInPoly - 1;
  79594. // Do the division business using exclusive-or operations.
  79595. while (MatrixUtil.findMSBSet(value) >= msbSetInPoly) {
  79596. value ^= poly << MatrixUtil.findMSBSet(value) - msbSetInPoly;
  79597. }
  79598. // Now the "value" is the remainder (i.e. the BCH code)
  79599. return value;
  79600. };
  79601. // Make bit vector of type information. On success, store the result in "bits" and return true.
  79602. // Encode error correction level and mask pattern. See 8.9 of
  79603. // JISX0510:2004 (p.45) for details.
  79604. MatrixUtil.makeTypeInfoBits = function (ecLevel, maskPattern /*int*/, bits) {
  79605. if (!_QRCode.default.isValidMaskPattern(maskPattern)) {
  79606. throw new _WriterException.default('Invalid mask pattern');
  79607. }
  79608. var typeInfo = ecLevel.getBits() << 3 | maskPattern;
  79609. bits.appendBits(typeInfo, 5);
  79610. var bchCode = MatrixUtil.calculateBCHCode(typeInfo, MatrixUtil.TYPE_INFO_POLY);
  79611. bits.appendBits(bchCode, 10);
  79612. var maskBits = new _BitArray.default();
  79613. maskBits.appendBits(MatrixUtil.TYPE_INFO_MASK_PATTERN, 15);
  79614. bits.xor(maskBits);
  79615. if (bits.getSize() !== 15) {
  79616. // Just in case.
  79617. throw new _WriterException.default('should not happen but we got: ' + bits.getSize());
  79618. }
  79619. };
  79620. // Make bit vector of version information. On success, store the result in "bits" and return true.
  79621. // See 8.10 of JISX0510:2004 (p.45) for details.
  79622. MatrixUtil.makeVersionInfoBits = function (version, bits) {
  79623. bits.appendBits(version.getVersionNumber(), 6);
  79624. var bchCode = MatrixUtil.calculateBCHCode(version.getVersionNumber(), MatrixUtil.VERSION_INFO_POLY);
  79625. bits.appendBits(bchCode, 12);
  79626. if (bits.getSize() !== 18) {
  79627. // Just in case.
  79628. throw new _WriterException.default('should not happen but we got: ' + bits.getSize());
  79629. }
  79630. };
  79631. // Check if "value" is empty.
  79632. MatrixUtil.isEmpty = function (value /*int*/) {
  79633. return value === 255; // -1
  79634. };
  79635. MatrixUtil.embedTimingPatterns = function (matrix) {
  79636. // -8 is for skipping position detection patterns (7: size), and two horizontal/vertical
  79637. // separation patterns (1: size). Thus, 8 = 7 + 1.
  79638. for (var i = 8; i < matrix.getWidth() - 8; ++i) {
  79639. var bit = (i + 1) % 2;
  79640. // Horizontal line.
  79641. if (MatrixUtil.isEmpty(matrix.get(i, 6))) {
  79642. matrix.setNumber(i, 6, bit);
  79643. }
  79644. // Vertical line.
  79645. if (MatrixUtil.isEmpty(matrix.get(6, i))) {
  79646. matrix.setNumber(6, i, bit);
  79647. }
  79648. }
  79649. };
  79650. // Embed the lonely dark dot at left bottom corner. JISX0510:2004 (p.46)
  79651. MatrixUtil.embedDarkDotAtLeftBottomCorner = function (matrix) {
  79652. if (matrix.get(8, matrix.getHeight() - 8) === 0) {
  79653. throw new _WriterException.default();
  79654. }
  79655. matrix.setNumber(8, matrix.getHeight() - 8, 1);
  79656. };
  79657. MatrixUtil.embedHorizontalSeparationPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
  79658. for (var x = 0; x < 8; ++x) {
  79659. if (!MatrixUtil.isEmpty(matrix.get(xStart + x, yStart))) {
  79660. throw new _WriterException.default();
  79661. }
  79662. matrix.setNumber(xStart + x, yStart, 0);
  79663. }
  79664. };
  79665. MatrixUtil.embedVerticalSeparationPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
  79666. for (var y = 0; y < 7; ++y) {
  79667. if (!MatrixUtil.isEmpty(matrix.get(xStart, yStart + y))) {
  79668. throw new _WriterException.default();
  79669. }
  79670. matrix.setNumber(xStart, yStart + y, 0);
  79671. }
  79672. };
  79673. MatrixUtil.embedPositionAdjustmentPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
  79674. for (var y = 0; y < 5; ++y) {
  79675. var patternY = MatrixUtil.POSITION_ADJUSTMENT_PATTERN[y];
  79676. for (var x = 0; x < 5; ++x) {
  79677. matrix.setNumber(xStart + x, yStart + y, patternY[x]);
  79678. }
  79679. }
  79680. };
  79681. MatrixUtil.embedPositionDetectionPattern = function (xStart /*int*/, yStart /*int*/, matrix) {
  79682. for (var y = 0; y < 7; ++y) {
  79683. var patternY = MatrixUtil.POSITION_DETECTION_PATTERN[y];
  79684. for (var x = 0; x < 7; ++x) {
  79685. matrix.setNumber(xStart + x, yStart + y, patternY[x]);
  79686. }
  79687. }
  79688. };
  79689. // Embed position detection patterns and surrounding vertical/horizontal separators.
  79690. MatrixUtil.embedPositionDetectionPatternsAndSeparators = function (matrix) {
  79691. // Embed three big squares at corners.
  79692. var pdpWidth = MatrixUtil.POSITION_DETECTION_PATTERN[0].length;
  79693. // Left top corner.
  79694. MatrixUtil.embedPositionDetectionPattern(0, 0, matrix);
  79695. // Right top corner.
  79696. MatrixUtil.embedPositionDetectionPattern(matrix.getWidth() - pdpWidth, 0, matrix);
  79697. // Left bottom corner.
  79698. MatrixUtil.embedPositionDetectionPattern(0, matrix.getWidth() - pdpWidth, matrix);
  79699. // Embed horizontal separation patterns around the squares.
  79700. var hspWidth = 8;
  79701. // Left top corner.
  79702. MatrixUtil.embedHorizontalSeparationPattern(0, hspWidth - 1, matrix);
  79703. // Right top corner.
  79704. MatrixUtil.embedHorizontalSeparationPattern(matrix.getWidth() - hspWidth, hspWidth - 1, matrix);
  79705. // Left bottom corner.
  79706. MatrixUtil.embedHorizontalSeparationPattern(0, matrix.getWidth() - hspWidth, matrix);
  79707. // Embed vertical separation patterns around the squares.
  79708. var vspSize = 7;
  79709. // Left top corner.
  79710. MatrixUtil.embedVerticalSeparationPattern(vspSize, 0, matrix);
  79711. // Right top corner.
  79712. MatrixUtil.embedVerticalSeparationPattern(matrix.getHeight() - vspSize - 1, 0, matrix);
  79713. // Left bottom corner.
  79714. MatrixUtil.embedVerticalSeparationPattern(vspSize, matrix.getHeight() - vspSize, matrix);
  79715. };
  79716. // Embed position adjustment patterns if need be.
  79717. MatrixUtil.maybeEmbedPositionAdjustmentPatterns = function (version, matrix) {
  79718. if (version.getVersionNumber() < 2) {
  79719. // The patterns appear if version >= 2
  79720. return;
  79721. }
  79722. var index = version.getVersionNumber() - 1;
  79723. var coordinates = MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];
  79724. for (var i = 0, length_1 = coordinates.length; i !== length_1; i++) {
  79725. var y = coordinates[i];
  79726. if (y >= 0) {
  79727. for (var j = 0; j !== length_1; j++) {
  79728. var x = coordinates[j];
  79729. if (x >= 0 && MatrixUtil.isEmpty(matrix.get(x, y))) {
  79730. // If the cell is unset, we embed the position adjustment pattern here.
  79731. // -2 is necessary since the x/y coordinates point to the center of the pattern, not the
  79732. // left top corner.
  79733. MatrixUtil.embedPositionAdjustmentPattern(x - 2, y - 2, matrix);
  79734. }
  79735. }
  79736. }
  79737. }
  79738. };
  79739. MatrixUtil.POSITION_DETECTION_PATTERN = Array.from([Int32Array.from([1, 1, 1, 1, 1, 1, 1]), Int32Array.from([1, 0, 0, 0, 0, 0, 1]), Int32Array.from([1, 0, 1, 1, 1, 0, 1]), Int32Array.from([1, 0, 1, 1, 1, 0, 1]), Int32Array.from([1, 0, 1, 1, 1, 0, 1]), Int32Array.from([1, 0, 0, 0, 0, 0, 1]), Int32Array.from([1, 1, 1, 1, 1, 1, 1])]);
  79740. MatrixUtil.POSITION_ADJUSTMENT_PATTERN = Array.from([Int32Array.from([1, 1, 1, 1, 1]), Int32Array.from([1, 0, 0, 0, 1]), Int32Array.from([1, 0, 1, 0, 1]), Int32Array.from([1, 0, 0, 0, 1]), Int32Array.from([1, 1, 1, 1, 1])]);
  79741. // From Appendix E. Table 1, JIS0510X:2004 (71: p). The table was double-checked by komatsu.
  79742. MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE = Array.from([Int32Array.from([-1, -1, -1, -1, -1, -1, -1]), Int32Array.from([6, 18, -1, -1, -1, -1, -1]), Int32Array.from([6, 22, -1, -1, -1, -1, -1]), Int32Array.from([6, 26, -1, -1, -1, -1, -1]), Int32Array.from([6, 30, -1, -1, -1, -1, -1]), Int32Array.from([6, 34, -1, -1, -1, -1, -1]), Int32Array.from([6, 22, 38, -1, -1, -1, -1]), Int32Array.from([6, 24, 42, -1, -1, -1, -1]), Int32Array.from([6, 26, 46, -1, -1, -1, -1]), Int32Array.from([6, 28, 50, -1, -1, -1, -1]), Int32Array.from([6, 30, 54, -1, -1, -1, -1]), Int32Array.from([6, 32, 58, -1, -1, -1, -1]), Int32Array.from([6, 34, 62, -1, -1, -1, -1]), Int32Array.from([6, 26, 46, 66, -1, -1, -1]), Int32Array.from([6, 26, 48, 70, -1, -1, -1]), Int32Array.from([6, 26, 50, 74, -1, -1, -1]), Int32Array.from([6, 30, 54, 78, -1, -1, -1]), Int32Array.from([6, 30, 56, 82, -1, -1, -1]), Int32Array.from([6, 30, 58, 86, -1, -1, -1]), Int32Array.from([6, 34, 62, 90, -1, -1, -1]), Int32Array.from([6, 28, 50, 72, 94, -1, -1]), Int32Array.from([6, 26, 50, 74, 98, -1, -1]), Int32Array.from([6, 30, 54, 78, 102, -1, -1]), Int32Array.from([6, 28, 54, 80, 106, -1, -1]), Int32Array.from([6, 32, 58, 84, 110, -1, -1]), Int32Array.from([6, 30, 58, 86, 114, -1, -1]), Int32Array.from([6, 34, 62, 90, 118, -1, -1]), Int32Array.from([6, 26, 50, 74, 98, 122, -1]), Int32Array.from([6, 30, 54, 78, 102, 126, -1]), Int32Array.from([6, 26, 52, 78, 104, 130, -1]), Int32Array.from([6, 30, 56, 82, 108, 134, -1]), Int32Array.from([6, 34, 60, 86, 112, 138, -1]), Int32Array.from([6, 30, 58, 86, 114, 142, -1]), Int32Array.from([6, 34, 62, 90, 118, 146, -1]), Int32Array.from([6, 30, 54, 78, 102, 126, 150]), Int32Array.from([6, 24, 50, 76, 102, 128, 154]), Int32Array.from([6, 28, 54, 80, 106, 132, 158]), Int32Array.from([6, 32, 58, 84, 110, 136, 162]), Int32Array.from([6, 26, 54, 82, 110, 138, 166]), Int32Array.from([6, 30, 58, 86, 114, 142, 170])]);
  79743. // Type info cells at the left top corner.
  79744. MatrixUtil.TYPE_INFO_COORDINATES = Array.from([Int32Array.from([8, 0]), Int32Array.from([8, 1]), Int32Array.from([8, 2]), Int32Array.from([8, 3]), Int32Array.from([8, 4]), Int32Array.from([8, 5]), Int32Array.from([8, 7]), Int32Array.from([8, 8]), Int32Array.from([7, 8]), Int32Array.from([5, 8]), Int32Array.from([4, 8]), Int32Array.from([3, 8]), Int32Array.from([2, 8]), Int32Array.from([1, 8]), Int32Array.from([0, 8])]);
  79745. // From Appendix D in JISX0510:2004 (p. 67)
  79746. MatrixUtil.VERSION_INFO_POLY = 0x1f25; // 1 1111 0010 0101
  79747. // From Appendix C in JISX0510:2004 (p.65).
  79748. MatrixUtil.TYPE_INFO_POLY = 0x537;
  79749. MatrixUtil.TYPE_INFO_MASK_PATTERN = 0x5412;
  79750. return MatrixUtil;
  79751. }();
  79752. var _default = MatrixUtil;
  79753. exports.default = _default;
  79754. /***/ }),
  79755. /* 469 */
  79756. /*!***********************************************************************************!*\
  79757. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/WriterException.js ***!
  79758. \***********************************************************************************/
  79759. /*! no static exports found */
  79760. /***/ (function(module, exports, __webpack_require__) {
  79761. "use strict";
  79762. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  79763. Object.defineProperty(exports, "__esModule", {
  79764. value: true
  79765. });
  79766. exports.default = void 0;
  79767. var _Exception = _interopRequireDefault(__webpack_require__(/*! ./Exception */ 305));
  79768. var __extends = void 0 && (void 0).__extends || function () {
  79769. var _extendStatics = function extendStatics(d, b) {
  79770. _extendStatics = Object.setPrototypeOf || {
  79771. __proto__: []
  79772. } instanceof Array && function (d, b) {
  79773. d.__proto__ = b;
  79774. } || function (d, b) {
  79775. for (var p in b) {
  79776. if (b.hasOwnProperty(p)) d[p] = b[p];
  79777. }
  79778. };
  79779. return _extendStatics(d, b);
  79780. };
  79781. return function (d, b) {
  79782. _extendStatics(d, b);
  79783. function __() {
  79784. this.constructor = d;
  79785. }
  79786. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  79787. };
  79788. }();
  79789. /**
  79790. * Custom Error class of type Exception.
  79791. */
  79792. var WriterException = /** @class */function (_super) {
  79793. __extends(WriterException, _super);
  79794. function WriterException() {
  79795. return _super !== null && _super.apply(this, arguments) || this;
  79796. }
  79797. WriterException.kind = 'WriterException';
  79798. return WriterException;
  79799. }(_Exception.default);
  79800. var _default = WriterException;
  79801. exports.default = _default;
  79802. /***/ }),
  79803. /* 470 */
  79804. /*!********************************************************************************************!*\
  79805. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/encoder/BlockPair.js ***!
  79806. \********************************************************************************************/
  79807. /*! no static exports found */
  79808. /***/ (function(module, exports, __webpack_require__) {
  79809. "use strict";
  79810. Object.defineProperty(exports, "__esModule", {
  79811. value: true
  79812. });
  79813. exports.default = void 0;
  79814. /*
  79815. * Copyright 2008 ZXing authors
  79816. *
  79817. * Licensed under the Apache License, Version 2.0 (the "License");
  79818. * you may not use this file except in compliance with the License.
  79819. * You may obtain a copy of the License at
  79820. *
  79821. * http://www.apache.org/licenses/LICENSE-2.0
  79822. *
  79823. * Unless required by applicable law or agreed to in writing, software
  79824. * distributed under the License is distributed on an "AS IS" BASIS,
  79825. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  79826. * See the License for the specific language governing permissions and
  79827. * limitations under the License.
  79828. */
  79829. /*namespace com.google.zxing.qrcode.encoder {*/
  79830. var BlockPair = /** @class */function () {
  79831. function BlockPair(dataBytes, errorCorrectionBytes) {
  79832. this.dataBytes = dataBytes;
  79833. this.errorCorrectionBytes = errorCorrectionBytes;
  79834. }
  79835. BlockPair.prototype.getDataBytes = function () {
  79836. return this.dataBytes;
  79837. };
  79838. BlockPair.prototype.getErrorCorrectionBytes = function () {
  79839. return this.errorCorrectionBytes;
  79840. };
  79841. return BlockPair;
  79842. }();
  79843. var _default = BlockPair;
  79844. exports.default = _default;
  79845. /***/ }),
  79846. /* 471 */
  79847. /*!*************************************************************************************************!*\
  79848. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/DecodeContinuouslyCallback.js ***!
  79849. \*************************************************************************************************/
  79850. /*! no static exports found */
  79851. /***/ (function(module, exports) {
  79852. /***/ }),
  79853. /* 472 */
  79854. /*!*********************************************************************************************!*\
  79855. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/browser/HTMLVisualMediaElement.js ***!
  79856. \*********************************************************************************************/
  79857. /*! no static exports found */
  79858. /***/ (function(module, exports) {
  79859. /***/ }),
  79860. /* 473 */
  79861. /*!*************************************************************************************!*\
  79862. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/MultiFormatWriter.js ***!
  79863. \*************************************************************************************/
  79864. /*! no static exports found */
  79865. /***/ (function(module, exports, __webpack_require__) {
  79866. "use strict";
  79867. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  79868. Object.defineProperty(exports, "__esModule", {
  79869. value: true
  79870. });
  79871. exports.default = void 0;
  79872. var _QRCodeWriter = _interopRequireDefault(__webpack_require__(/*! ./qrcode/QRCodeWriter */ 474));
  79873. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ./BarcodeFormat */ 334));
  79874. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
  79875. /*
  79876. * Copyright 2008 ZXing authors
  79877. *
  79878. * Licensed under the Apache License, Version 2.0 (the "License");
  79879. * you may not use this file except in compliance with the License.
  79880. * You may obtain a copy of the License at
  79881. *
  79882. * http://www.apache.org/licenses/LICENSE-2.0
  79883. *
  79884. * Unless required by applicable law or agreed to in writing, software
  79885. * distributed under the License is distributed on an "AS IS" BASIS,
  79886. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  79887. * See the License for the specific language governing permissions and
  79888. * limitations under the License.
  79889. */
  79890. // import DataMatrixWriter from './datamatrix/DataMatrixWriter'
  79891. // import CodaBarWriter from './oned/CodaBarWriter'
  79892. // import Code128Writer from './oned/Code128Writer'
  79893. // import Code39Writer from './oned/Code39Writer'
  79894. // import Code93Writer from './oned/Code93Writer'
  79895. // import EAN13Writer from './oned/EAN13Writer'
  79896. // import EAN8Writer from './oned/EAN8Writer'
  79897. // import ITFWriter from './oned/ITFWriter'
  79898. // import UPCAWriter from './oned/UPCAWriter'
  79899. // import UPCEWriter from './oned/UPCEWriter'
  79900. // import PDF417Writer from './pdf417/PDF417Writer'
  79901. /*import java.util.Map;*/
  79902. /**
  79903. * This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat
  79904. * requested and encodes the barcode with the supplied contents.
  79905. *
  79906. * @author dswitkin@google.com (Daniel Switkin)
  79907. */
  79908. var MultiFormatWriter = /** @class */function () {
  79909. function MultiFormatWriter() {}
  79910. /*@Override*/
  79911. // public encode(contents: string,
  79912. // format: BarcodeFormat,
  79913. // width: number /*int*/,
  79914. // height: number /*int*/): BitMatrix /*throws WriterException */ {
  79915. // return encode(contents, format, width, height, null)
  79916. // }
  79917. /*@Override*/
  79918. MultiFormatWriter.prototype.encode = function (contents, format, width /*int*/, height /*int*/, hints) {
  79919. var writer;
  79920. switch (format) {
  79921. // case BarcodeFormat.EAN_8:
  79922. // writer = new EAN8Writer()
  79923. // break
  79924. // case BarcodeFormat.UPC_E:
  79925. // writer = new UPCEWriter()
  79926. // break
  79927. // case BarcodeFormat.EAN_13:
  79928. // writer = new EAN13Writer()
  79929. // break
  79930. // case BarcodeFormat.UPC_A:
  79931. // writer = new UPCAWriter()
  79932. // break
  79933. case _BarcodeFormat.default.QR_CODE:
  79934. writer = new _QRCodeWriter.default();
  79935. break;
  79936. // case BarcodeFormat.CODE_39:
  79937. // writer = new Code39Writer()
  79938. // break
  79939. // case BarcodeFormat.CODE_93:
  79940. // writer = new Code93Writer()
  79941. // break
  79942. // case BarcodeFormat.CODE_128:
  79943. // writer = new Code128Writer()
  79944. // break
  79945. // case BarcodeFormat.ITF:
  79946. // writer = new ITFWriter()
  79947. // break
  79948. // case BarcodeFormat.PDF_417:
  79949. // writer = new PDF417Writer()
  79950. // break
  79951. // case BarcodeFormat.CODABAR:
  79952. // writer = new CodaBarWriter()
  79953. // break
  79954. // case BarcodeFormat.DATA_MATRIX:
  79955. // writer = new DataMatrixWriter()
  79956. // break
  79957. // case BarcodeFormat.AZTEC:
  79958. // writer = new AztecWriter()
  79959. // break
  79960. default:
  79961. throw new _IllegalArgumentException.default('No encoder available for format ' + format);
  79962. }
  79963. return writer.encode(contents, format, width, height, hints);
  79964. };
  79965. return MultiFormatWriter;
  79966. }();
  79967. var _default = MultiFormatWriter;
  79968. exports.default = _default;
  79969. /***/ }),
  79970. /* 474 */
  79971. /*!***************************************************************************************!*\
  79972. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/qrcode/QRCodeWriter.js ***!
  79973. \***************************************************************************************/
  79974. /*! no static exports found */
  79975. /***/ (function(module, exports, __webpack_require__) {
  79976. "use strict";
  79977. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  79978. Object.defineProperty(exports, "__esModule", {
  79979. value: true
  79980. });
  79981. exports.default = void 0;
  79982. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  79983. var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../EncodeHintType */ 462));
  79984. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
  79985. var _ErrorCorrectionLevel = _interopRequireDefault(__webpack_require__(/*! ./decoder/ErrorCorrectionLevel */ 419));
  79986. var _Encoder = _interopRequireDefault(__webpack_require__(/*! ./encoder/Encoder */ 463));
  79987. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  79988. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../IllegalStateException */ 344));
  79989. /*
  79990. * Copyright 2008 ZXing authors
  79991. *
  79992. * Licensed under the Apache License, Version 2.0 (the "License");
  79993. * you may not use this file except in compliance with the License.
  79994. * You may obtain a copy of the License at
  79995. *
  79996. * http://www.apache.org/licenses/LICENSE-2.0
  79997. *
  79998. * Unless required by applicable law or agreed to in writing, software
  79999. * distributed under the License is distributed on an "AS IS" BASIS,
  80000. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  80001. * See the License for the specific language governing permissions and
  80002. * limitations under the License.
  80003. */
  80004. /*namespace com.google.zxing.qrcode {*/
  80005. /*import java.util.Map;*/
  80006. /**
  80007. * This object renders a QR Code as a BitMatrix 2D array of greyscale values.
  80008. *
  80009. * @author dswitkin@google.com (Daniel Switkin)
  80010. */
  80011. var QRCodeWriter = /** @class */function () {
  80012. function QRCodeWriter() {}
  80013. /*@Override*/
  80014. // public encode(contents: string, format: BarcodeFormat, width: number /*int*/, height: number /*int*/): BitMatrix
  80015. // /*throws WriterException */ {
  80016. // return encode(contents, format, width, height, null)
  80017. // }
  80018. /*@Override*/
  80019. QRCodeWriter.prototype.encode = function (contents, format, width /*int*/, height /*int*/, hints) {
  80020. if (contents.length === 0) {
  80021. throw new _IllegalArgumentException.default('Found empty contents');
  80022. }
  80023. if (format !== _BarcodeFormat.default.QR_CODE) {
  80024. throw new _IllegalArgumentException.default('Can only encode QR_CODE, but got ' + format);
  80025. }
  80026. if (width < 0 || height < 0) {
  80027. throw new _IllegalArgumentException.default("Requested dimensions are too small: " + width + "x" + height);
  80028. }
  80029. var errorCorrectionLevel = _ErrorCorrectionLevel.default.L;
  80030. var quietZone = QRCodeWriter.QUIET_ZONE_SIZE;
  80031. if (hints !== null) {
  80032. if (undefined !== hints.get(_EncodeHintType.default.ERROR_CORRECTION)) {
  80033. errorCorrectionLevel = _ErrorCorrectionLevel.default.fromString(hints.get(_EncodeHintType.default.ERROR_CORRECTION).toString());
  80034. }
  80035. if (undefined !== hints.get(_EncodeHintType.default.MARGIN)) {
  80036. quietZone = Number.parseInt(hints.get(_EncodeHintType.default.MARGIN).toString(), 10);
  80037. }
  80038. }
  80039. var code = _Encoder.default.encode(contents, errorCorrectionLevel, hints);
  80040. return QRCodeWriter.renderResult(code, width, height, quietZone);
  80041. };
  80042. // Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses
  80043. // 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
  80044. QRCodeWriter.renderResult = function (code, width /*int*/, height /*int*/, quietZone /*int*/) {
  80045. var input = code.getMatrix();
  80046. if (input === null) {
  80047. throw new _IllegalStateException.default();
  80048. }
  80049. var inputWidth = input.getWidth();
  80050. var inputHeight = input.getHeight();
  80051. var qrWidth = inputWidth + quietZone * 2;
  80052. var qrHeight = inputHeight + quietZone * 2;
  80053. var outputWidth = Math.max(width, qrWidth);
  80054. var outputHeight = Math.max(height, qrHeight);
  80055. var multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));
  80056. // Padding includes both the quiet zone and the extra white pixels to accommodate the requested
  80057. // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.
  80058. // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will
  80059. // handle all the padding from 100x100 (the actual QR) up to 200x160.
  80060. var leftPadding = Math.floor((outputWidth - inputWidth * multiple) / 2);
  80061. var topPadding = Math.floor((outputHeight - inputHeight * multiple) / 2);
  80062. var output = new _BitMatrix.default(outputWidth, outputHeight);
  80063. for (var inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
  80064. // Write the contents of this row of the barcode
  80065. for (var inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
  80066. if (input.get(inputX, inputY) === 1) {
  80067. output.setRegion(outputX, outputY, multiple, multiple);
  80068. }
  80069. }
  80070. }
  80071. return output;
  80072. };
  80073. QRCodeWriter.QUIET_ZONE_SIZE = 4;
  80074. return QRCodeWriter;
  80075. }();
  80076. var _default = QRCodeWriter;
  80077. exports.default = _default;
  80078. /***/ }),
  80079. /* 475 */
  80080. /*!********************************************************************************************!*\
  80081. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/PlanarYUVLuminanceSource.js ***!
  80082. \********************************************************************************************/
  80083. /*! no static exports found */
  80084. /***/ (function(module, exports, __webpack_require__) {
  80085. "use strict";
  80086. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80087. Object.defineProperty(exports, "__esModule", {
  80088. value: true
  80089. });
  80090. exports.default = void 0;
  80091. var _System = _interopRequireDefault(__webpack_require__(/*! ./util/System */ 315));
  80092. var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./LuminanceSource */ 330));
  80093. var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./InvertedLuminanceSource */ 329));
  80094. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
  80095. /*
  80096. * Copyright 2009 ZXing authors
  80097. *
  80098. * Licensed under the Apache License, Version 2.0 (the "License");
  80099. * you may not use this file except in compliance with the License.
  80100. * You may obtain a copy of the License at
  80101. *
  80102. * http://www.apache.org/licenses/LICENSE-2.0
  80103. *
  80104. * Unless required by applicable law or agreed to in writing, software
  80105. * distributed under the License is distributed on an "AS IS" BASIS,
  80106. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  80107. * See the License for the specific language governing permissions and
  80108. * limitations under the License.
  80109. */
  80110. var __extends = void 0 && (void 0).__extends || function () {
  80111. var _extendStatics = function extendStatics(d, b) {
  80112. _extendStatics = Object.setPrototypeOf || {
  80113. __proto__: []
  80114. } instanceof Array && function (d, b) {
  80115. d.__proto__ = b;
  80116. } || function (d, b) {
  80117. for (var p in b) {
  80118. if (b.hasOwnProperty(p)) d[p] = b[p];
  80119. }
  80120. };
  80121. return _extendStatics(d, b);
  80122. };
  80123. return function (d, b) {
  80124. _extendStatics(d, b);
  80125. function __() {
  80126. this.constructor = d;
  80127. }
  80128. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  80129. };
  80130. }();
  80131. /*namespace com.google.zxing {*/
  80132. /**
  80133. * This object extends LuminanceSource around an array of YUV data returned from the camera driver,
  80134. * with the option to crop to a rectangle within the full data. This can be used to exclude
  80135. * superfluous pixels around the perimeter and speed up decoding.
  80136. *
  80137. * It works for any pixel format where the Y channel is planar and appears first, including
  80138. * YCbCr_420_SP and YCbCr_422_SP.
  80139. *
  80140. * @author dswitkin@google.com (Daniel Switkin)
  80141. */
  80142. var PlanarYUVLuminanceSource = /** @class */function (_super) {
  80143. __extends(PlanarYUVLuminanceSource, _super);
  80144. function PlanarYUVLuminanceSource(yuvData, dataWidth /*int*/, dataHeight /*int*/, left /*int*/, top /*int*/, width /*int*/, height /*int*/, reverseHorizontal) {
  80145. var _this = _super.call(this, width, height) || this;
  80146. _this.yuvData = yuvData;
  80147. _this.dataWidth = dataWidth;
  80148. _this.dataHeight = dataHeight;
  80149. _this.left = left;
  80150. _this.top = top;
  80151. if (left + width > dataWidth || top + height > dataHeight) {
  80152. throw new _IllegalArgumentException.default('Crop rectangle does not fit within image data.');
  80153. }
  80154. if (reverseHorizontal) {
  80155. _this.reverseHorizontal(width, height);
  80156. }
  80157. return _this;
  80158. }
  80159. /*@Override*/
  80160. PlanarYUVLuminanceSource.prototype.getRow = function (y /*int*/, row) {
  80161. if (y < 0 || y >= this.getHeight()) {
  80162. throw new _IllegalArgumentException.default('Requested row is outside the image: ' + y);
  80163. }
  80164. var width = this.getWidth();
  80165. if (row === null || row === undefined || row.length < width) {
  80166. row = new Uint8ClampedArray(width);
  80167. }
  80168. var offset = (y + this.top) * this.dataWidth + this.left;
  80169. _System.default.arraycopy(this.yuvData, offset, row, 0, width);
  80170. return row;
  80171. };
  80172. /*@Override*/
  80173. PlanarYUVLuminanceSource.prototype.getMatrix = function () {
  80174. var width = this.getWidth();
  80175. var height = this.getHeight();
  80176. // If the caller asks for the entire underlying image, save the copy and give them the
  80177. // original data. The docs specifically warn that result.length must be ignored.
  80178. if (width === this.dataWidth && height === this.dataHeight) {
  80179. return this.yuvData;
  80180. }
  80181. var area = width * height;
  80182. var matrix = new Uint8ClampedArray(area);
  80183. var inputOffset = this.top * this.dataWidth + this.left;
  80184. // If the width matches the full width of the underlying data, perform a single copy.
  80185. if (width === this.dataWidth) {
  80186. _System.default.arraycopy(this.yuvData, inputOffset, matrix, 0, area);
  80187. return matrix;
  80188. }
  80189. // Otherwise copy one cropped row at a time.
  80190. for (var y = 0; y < height; y++) {
  80191. var outputOffset = y * width;
  80192. _System.default.arraycopy(this.yuvData, inputOffset, matrix, outputOffset, width);
  80193. inputOffset += this.dataWidth;
  80194. }
  80195. return matrix;
  80196. };
  80197. /*@Override*/
  80198. PlanarYUVLuminanceSource.prototype.isCropSupported = function () {
  80199. return true;
  80200. };
  80201. /*@Override*/
  80202. PlanarYUVLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  80203. return new PlanarYUVLuminanceSource(this.yuvData, this.dataWidth, this.dataHeight, this.left + left, this.top + top, width, height, false);
  80204. };
  80205. PlanarYUVLuminanceSource.prototype.renderThumbnail = function () {
  80206. var width = this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
  80207. var height = this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
  80208. var pixels = new Int32Array(width * height);
  80209. var yuv = this.yuvData;
  80210. var inputOffset = this.top * this.dataWidth + this.left;
  80211. for (var y = 0; y < height; y++) {
  80212. var outputOffset = y * width;
  80213. for (var x = 0; x < width; x++) {
  80214. var grey = yuv[inputOffset + x * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR] & 0xff;
  80215. pixels[outputOffset + x] = 0xFF000000 | grey * 0x00010101;
  80216. }
  80217. inputOffset += this.dataWidth * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
  80218. }
  80219. return pixels;
  80220. };
  80221. /**
  80222. * @return width of image from {@link #renderThumbnail()}
  80223. */
  80224. PlanarYUVLuminanceSource.prototype.getThumbnailWidth = function () {
  80225. return this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
  80226. };
  80227. /**
  80228. * @return height of image from {@link #renderThumbnail()}
  80229. */
  80230. PlanarYUVLuminanceSource.prototype.getThumbnailHeight = function () {
  80231. return this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;
  80232. };
  80233. PlanarYUVLuminanceSource.prototype.reverseHorizontal = function (width /*int*/, height /*int*/) {
  80234. var yuvData = this.yuvData;
  80235. for (var y = 0, rowStart = this.top * this.dataWidth + this.left; y < height; y++, rowStart += this.dataWidth) {
  80236. var middle = rowStart + width / 2;
  80237. for (var x1 = rowStart, x2 = rowStart + width - 1; x1 < middle; x1++, x2--) {
  80238. var temp = yuvData[x1];
  80239. yuvData[x1] = yuvData[x2];
  80240. yuvData[x2] = temp;
  80241. }
  80242. }
  80243. };
  80244. PlanarYUVLuminanceSource.prototype.invert = function () {
  80245. return new _InvertedLuminanceSource.default(this);
  80246. };
  80247. PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR = 2;
  80248. return PlanarYUVLuminanceSource;
  80249. }(_LuminanceSource.default);
  80250. var _default = PlanarYUVLuminanceSource;
  80251. exports.default = _default;
  80252. /***/ }),
  80253. /* 476 */
  80254. /*!**************************************************************************************!*\
  80255. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/RGBLuminanceSource.js ***!
  80256. \**************************************************************************************/
  80257. /*! no static exports found */
  80258. /***/ (function(module, exports, __webpack_require__) {
  80259. "use strict";
  80260. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80261. Object.defineProperty(exports, "__esModule", {
  80262. value: true
  80263. });
  80264. exports.default = void 0;
  80265. var _InvertedLuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./InvertedLuminanceSource */ 329));
  80266. var _LuminanceSource = _interopRequireDefault(__webpack_require__(/*! ./LuminanceSource */ 330));
  80267. var _System = _interopRequireDefault(__webpack_require__(/*! ./util/System */ 315));
  80268. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ./IllegalArgumentException */ 308));
  80269. /*
  80270. * Copyright 2009 ZXing authors
  80271. *
  80272. * Licensed under the Apache License, Version 2.0 (the "License");
  80273. * you may not use this file except in compliance with the License.
  80274. * You may obtain a copy of the License at
  80275. *
  80276. * http://www.apache.org/licenses/LICENSE-2.0
  80277. *
  80278. * Unless required by applicable law or agreed to in writing, software
  80279. * distributed under the License is distributed on an "AS IS" BASIS,
  80280. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  80281. * See the License for the specific language governing permissions and
  80282. * limitations under the License.
  80283. */
  80284. var __extends = void 0 && (void 0).__extends || function () {
  80285. var _extendStatics = function extendStatics(d, b) {
  80286. _extendStatics = Object.setPrototypeOf || {
  80287. __proto__: []
  80288. } instanceof Array && function (d, b) {
  80289. d.__proto__ = b;
  80290. } || function (d, b) {
  80291. for (var p in b) {
  80292. if (b.hasOwnProperty(p)) d[p] = b[p];
  80293. }
  80294. };
  80295. return _extendStatics(d, b);
  80296. };
  80297. return function (d, b) {
  80298. _extendStatics(d, b);
  80299. function __() {
  80300. this.constructor = d;
  80301. }
  80302. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  80303. };
  80304. }();
  80305. /*namespace com.google.zxing {*/
  80306. /**
  80307. * This class is used to help decode images from files which arrive as RGB data from
  80308. * an ARGB pixel array. It does not support rotation.
  80309. *
  80310. * @author dswitkin@google.com (Daniel Switkin)
  80311. * @author Betaminos
  80312. */
  80313. var RGBLuminanceSource = /** @class */function (_super) {
  80314. __extends(RGBLuminanceSource, _super);
  80315. function RGBLuminanceSource(luminances, width /*int*/, height /*int*/, dataWidth /*int*/, dataHeight /*int*/, left /*int*/, top /*int*/) {
  80316. var _this = _super.call(this, width, height) || this;
  80317. _this.dataWidth = dataWidth;
  80318. _this.dataHeight = dataHeight;
  80319. _this.left = left;
  80320. _this.top = top;
  80321. if (luminances.BYTES_PER_ELEMENT === 4) {
  80322. // Int32Array
  80323. var size = width * height;
  80324. var luminancesUint8Array = new Uint8ClampedArray(size);
  80325. for (var offset = 0; offset < size; offset++) {
  80326. var pixel = luminances[offset];
  80327. var r = pixel >> 16 & 0xff; // red
  80328. var g2 = pixel >> 7 & 0x1fe; // 2 * green
  80329. var b = pixel & 0xff; // blue
  80330. // Calculate green-favouring average cheaply
  80331. luminancesUint8Array[offset] = /*(byte) */(r + g2 + b) / 4 & 0xFF;
  80332. }
  80333. _this.luminances = luminancesUint8Array;
  80334. } else {
  80335. _this.luminances = luminances;
  80336. }
  80337. if (undefined === dataWidth) {
  80338. _this.dataWidth = width;
  80339. }
  80340. if (undefined === dataHeight) {
  80341. _this.dataHeight = height;
  80342. }
  80343. if (undefined === left) {
  80344. _this.left = 0;
  80345. }
  80346. if (undefined === top) {
  80347. _this.top = 0;
  80348. }
  80349. if (_this.left + width > _this.dataWidth || _this.top + height > _this.dataHeight) {
  80350. throw new _IllegalArgumentException.default('Crop rectangle does not fit within image data.');
  80351. }
  80352. return _this;
  80353. }
  80354. /*@Override*/
  80355. RGBLuminanceSource.prototype.getRow = function (y /*int*/, row) {
  80356. if (y < 0 || y >= this.getHeight()) {
  80357. throw new _IllegalArgumentException.default('Requested row is outside the image: ' + y);
  80358. }
  80359. var width = this.getWidth();
  80360. if (row === null || row === undefined || row.length < width) {
  80361. row = new Uint8ClampedArray(width);
  80362. }
  80363. var offset = (y + this.top) * this.dataWidth + this.left;
  80364. _System.default.arraycopy(this.luminances, offset, row, 0, width);
  80365. return row;
  80366. };
  80367. /*@Override*/
  80368. RGBLuminanceSource.prototype.getMatrix = function () {
  80369. var width = this.getWidth();
  80370. var height = this.getHeight();
  80371. // If the caller asks for the entire underlying image, save the copy and give them the
  80372. // original data. The docs specifically warn that result.length must be ignored.
  80373. if (width === this.dataWidth && height === this.dataHeight) {
  80374. return this.luminances;
  80375. }
  80376. var area = width * height;
  80377. var matrix = new Uint8ClampedArray(area);
  80378. var inputOffset = this.top * this.dataWidth + this.left;
  80379. // If the width matches the full width of the underlying data, perform a single copy.
  80380. if (width === this.dataWidth) {
  80381. _System.default.arraycopy(this.luminances, inputOffset, matrix, 0, area);
  80382. return matrix;
  80383. }
  80384. // Otherwise copy one cropped row at a time.
  80385. for (var y = 0; y < height; y++) {
  80386. var outputOffset = y * width;
  80387. _System.default.arraycopy(this.luminances, inputOffset, matrix, outputOffset, width);
  80388. inputOffset += this.dataWidth;
  80389. }
  80390. return matrix;
  80391. };
  80392. /*@Override*/
  80393. RGBLuminanceSource.prototype.isCropSupported = function () {
  80394. return true;
  80395. };
  80396. /*@Override*/
  80397. RGBLuminanceSource.prototype.crop = function (left /*int*/, top /*int*/, width /*int*/, height /*int*/) {
  80398. return new RGBLuminanceSource(this.luminances, width, height, this.dataWidth, this.dataHeight, this.left + left, this.top + top);
  80399. };
  80400. RGBLuminanceSource.prototype.invert = function () {
  80401. return new _InvertedLuminanceSource.default(this);
  80402. };
  80403. return RGBLuminanceSource;
  80404. }(_LuminanceSource.default);
  80405. var _default = RGBLuminanceSource;
  80406. exports.default = _default;
  80407. /***/ }),
  80408. /* 477 */
  80409. /*!********************************************************************************!*\
  80410. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Charset.js ***!
  80411. \********************************************************************************/
  80412. /*! no static exports found */
  80413. /***/ (function(module, exports, __webpack_require__) {
  80414. "use strict";
  80415. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80416. Object.defineProperty(exports, "__esModule", {
  80417. value: true
  80418. });
  80419. exports.default = void 0;
  80420. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../common/CharacterSetECI */ 323));
  80421. var __extends = void 0 && (void 0).__extends || function () {
  80422. var _extendStatics = function extendStatics(d, b) {
  80423. _extendStatics = Object.setPrototypeOf || {
  80424. __proto__: []
  80425. } instanceof Array && function (d, b) {
  80426. d.__proto__ = b;
  80427. } || function (d, b) {
  80428. for (var p in b) {
  80429. if (b.hasOwnProperty(p)) d[p] = b[p];
  80430. }
  80431. };
  80432. return _extendStatics(d, b);
  80433. };
  80434. return function (d, b) {
  80435. _extendStatics(d, b);
  80436. function __() {
  80437. this.constructor = d;
  80438. }
  80439. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  80440. };
  80441. }();
  80442. /**
  80443. * Just to make a shortcut between Java code and TS code.
  80444. */
  80445. var Charset = /** @class */function (_super) {
  80446. __extends(Charset, _super);
  80447. function Charset() {
  80448. return _super !== null && _super.apply(this, arguments) || this;
  80449. }
  80450. Charset.forName = function (name) {
  80451. return this.getCharacterSetECIByName(name);
  80452. };
  80453. return Charset;
  80454. }(_CharacterSetECI.default);
  80455. var _default = Charset;
  80456. exports.default = _default;
  80457. /***/ }),
  80458. /* 478 */
  80459. /*!*****************************************************************************************!*\
  80460. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/StandardCharsets.js ***!
  80461. \*****************************************************************************************/
  80462. /*! no static exports found */
  80463. /***/ (function(module, exports, __webpack_require__) {
  80464. "use strict";
  80465. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80466. Object.defineProperty(exports, "__esModule", {
  80467. value: true
  80468. });
  80469. exports.default = void 0;
  80470. var _CharacterSetECI = _interopRequireDefault(__webpack_require__(/*! ../common/CharacterSetECI */ 323));
  80471. /**
  80472. * Just to make a shortcut between Java code and TS code.
  80473. */
  80474. var StandardCharsets = /** @class */function () {
  80475. function StandardCharsets() {}
  80476. StandardCharsets.ISO_8859_1 = _CharacterSetECI.default.ISO8859_1;
  80477. return StandardCharsets;
  80478. }();
  80479. var _default = StandardCharsets;
  80480. exports.default = _default;
  80481. /***/ }),
  80482. /* 479 */
  80483. /*!*******************************************************************************************************!*\
  80484. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/DefaultPlacement.js ***!
  80485. \*******************************************************************************************************/
  80486. /*! no static exports found */
  80487. /***/ (function(module, exports, __webpack_require__) {
  80488. "use strict";
  80489. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80490. Object.defineProperty(exports, "__esModule", {
  80491. value: true
  80492. });
  80493. exports.default = void 0;
  80494. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  80495. /**
  80496. * Symbol Character Placement Program. Adapted from Annex M.1 in ISO/IEC 16022:2000(E).
  80497. */
  80498. var DefaultPlacement = /** @class */function () {
  80499. /**
  80500. * Main constructor
  80501. *
  80502. * @param codewords the codewords to place
  80503. * @param numcols the number of columns
  80504. * @param numrows the number of rows
  80505. */
  80506. function DefaultPlacement(codewords, numcols, numrows) {
  80507. this.codewords = codewords;
  80508. this.numcols = numcols;
  80509. this.numrows = numrows;
  80510. this.bits = new Uint8Array(numcols * numrows);
  80511. _Arrays.default.fill(this.bits, 2); // Initialize with "not set" value
  80512. }
  80513. DefaultPlacement.prototype.getNumrows = function () {
  80514. return this.numrows;
  80515. };
  80516. DefaultPlacement.prototype.getNumcols = function () {
  80517. return this.numcols;
  80518. };
  80519. DefaultPlacement.prototype.getBits = function () {
  80520. return this.bits;
  80521. };
  80522. DefaultPlacement.prototype.getBit = function (col, row) {
  80523. return this.bits[row * this.numcols + col] === 1;
  80524. };
  80525. DefaultPlacement.prototype.setBit = function (col, row, bit) {
  80526. this.bits[row * this.numcols + col] = bit ? 1 : 0;
  80527. };
  80528. DefaultPlacement.prototype.noBit = function (col, row) {
  80529. return this.bits[row * this.numcols + col] === 2;
  80530. };
  80531. DefaultPlacement.prototype.place = function () {
  80532. var pos = 0;
  80533. var row = 4;
  80534. var col = 0;
  80535. do {
  80536. // repeatedly first check for one of the special corner cases, then...
  80537. if (row === this.numrows && col === 0) {
  80538. this.corner1(pos++);
  80539. }
  80540. if (row === this.numrows - 2 && col === 0 && this.numcols % 4 !== 0) {
  80541. this.corner2(pos++);
  80542. }
  80543. if (row === this.numrows - 2 && col === 0 && this.numcols % 8 === 4) {
  80544. this.corner3(pos++);
  80545. }
  80546. if (row === this.numrows + 4 && col === 2 && this.numcols % 8 === 0) {
  80547. this.corner4(pos++);
  80548. }
  80549. // sweep upward diagonally, inserting successive characters...
  80550. do {
  80551. if (row < this.numrows && col >= 0 && this.noBit(col, row)) {
  80552. this.utah(row, col, pos++);
  80553. }
  80554. row -= 2;
  80555. col += 2;
  80556. } while (row >= 0 && col < this.numcols);
  80557. row++;
  80558. col += 3;
  80559. // and then sweep downward diagonally, inserting successive characters, ...
  80560. do {
  80561. if (row >= 0 && col < this.numcols && this.noBit(col, row)) {
  80562. this.utah(row, col, pos++);
  80563. }
  80564. row += 2;
  80565. col -= 2;
  80566. } while (row < this.numrows && col >= 0);
  80567. row += 3;
  80568. col++;
  80569. // ...until the entire array is scanned
  80570. } while (row < this.numrows || col < this.numcols);
  80571. // Lastly, if the lower right-hand corner is untouched, fill in fixed pattern
  80572. if (this.noBit(this.numcols - 1, this.numrows - 1)) {
  80573. this.setBit(this.numcols - 1, this.numrows - 1, true);
  80574. this.setBit(this.numcols - 2, this.numrows - 2, true);
  80575. }
  80576. };
  80577. DefaultPlacement.prototype.module = function (row, col, pos, bit) {
  80578. if (row < 0) {
  80579. row += this.numrows;
  80580. col += 4 - (this.numrows + 4) % 8;
  80581. }
  80582. if (col < 0) {
  80583. col += this.numcols;
  80584. row += 4 - (this.numcols + 4) % 8;
  80585. }
  80586. // Note the conversion:
  80587. var v = this.codewords.charCodeAt(pos);
  80588. v &= 1 << 8 - bit;
  80589. this.setBit(col, row, v !== 0);
  80590. };
  80591. /**
  80592. * Places the 8 bits of a utah-shaped symbol character in ECC200.
  80593. *
  80594. * @param row the row
  80595. * @param col the column
  80596. * @param pos character position
  80597. */
  80598. DefaultPlacement.prototype.utah = function (row, col, pos) {
  80599. this.module(row - 2, col - 2, pos, 1);
  80600. this.module(row - 2, col - 1, pos, 2);
  80601. this.module(row - 1, col - 2, pos, 3);
  80602. this.module(row - 1, col - 1, pos, 4);
  80603. this.module(row - 1, col, pos, 5);
  80604. this.module(row, col - 2, pos, 6);
  80605. this.module(row, col - 1, pos, 7);
  80606. this.module(row, col, pos, 8);
  80607. };
  80608. DefaultPlacement.prototype.corner1 = function (pos) {
  80609. this.module(this.numrows - 1, 0, pos, 1);
  80610. this.module(this.numrows - 1, 1, pos, 2);
  80611. this.module(this.numrows - 1, 2, pos, 3);
  80612. this.module(0, this.numcols - 2, pos, 4);
  80613. this.module(0, this.numcols - 1, pos, 5);
  80614. this.module(1, this.numcols - 1, pos, 6);
  80615. this.module(2, this.numcols - 1, pos, 7);
  80616. this.module(3, this.numcols - 1, pos, 8);
  80617. };
  80618. DefaultPlacement.prototype.corner2 = function (pos) {
  80619. this.module(this.numrows - 3, 0, pos, 1);
  80620. this.module(this.numrows - 2, 0, pos, 2);
  80621. this.module(this.numrows - 1, 0, pos, 3);
  80622. this.module(0, this.numcols - 4, pos, 4);
  80623. this.module(0, this.numcols - 3, pos, 5);
  80624. this.module(0, this.numcols - 2, pos, 6);
  80625. this.module(0, this.numcols - 1, pos, 7);
  80626. this.module(1, this.numcols - 1, pos, 8);
  80627. };
  80628. DefaultPlacement.prototype.corner3 = function (pos) {
  80629. this.module(this.numrows - 3, 0, pos, 1);
  80630. this.module(this.numrows - 2, 0, pos, 2);
  80631. this.module(this.numrows - 1, 0, pos, 3);
  80632. this.module(0, this.numcols - 2, pos, 4);
  80633. this.module(0, this.numcols - 1, pos, 5);
  80634. this.module(1, this.numcols - 1, pos, 6);
  80635. this.module(2, this.numcols - 1, pos, 7);
  80636. this.module(3, this.numcols - 1, pos, 8);
  80637. };
  80638. DefaultPlacement.prototype.corner4 = function (pos) {
  80639. this.module(this.numrows - 1, 0, pos, 1);
  80640. this.module(this.numrows - 1, this.numcols - 1, pos, 2);
  80641. this.module(0, this.numcols - 3, pos, 3);
  80642. this.module(0, this.numcols - 2, pos, 4);
  80643. this.module(0, this.numcols - 1, pos, 5);
  80644. this.module(1, this.numcols - 3, pos, 6);
  80645. this.module(1, this.numcols - 2, pos, 7);
  80646. this.module(1, this.numcols - 1, pos, 8);
  80647. };
  80648. return DefaultPlacement;
  80649. }();
  80650. var _default = DefaultPlacement;
  80651. exports.default = _default;
  80652. /***/ }),
  80653. /* 480 */
  80654. /*!******************************************************************************************************!*\
  80655. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/ErrorCorrection.js ***!
  80656. \******************************************************************************************************/
  80657. /*! no static exports found */
  80658. /***/ (function(module, exports, __webpack_require__) {
  80659. "use strict";
  80660. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80661. Object.defineProperty(exports, "__esModule", {
  80662. value: true
  80663. });
  80664. exports.default = void 0;
  80665. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  80666. var _constants = __webpack_require__(/*! ./constants */ 481);
  80667. /**
  80668. * Error Correction Code for ECC200.
  80669. */
  80670. var ErrorCorrection = /** @class */function () {
  80671. function ErrorCorrection() {}
  80672. /**
  80673. * Creates the ECC200 error correction for an encoded message.
  80674. *
  80675. * @param codewords the codewords
  80676. * @param symbolInfo information about the symbol to be encoded
  80677. * @return the codewords with interleaved error correction.
  80678. */
  80679. ErrorCorrection.encodeECC200 = function (codewords, symbolInfo) {
  80680. if (codewords.length !== symbolInfo.getDataCapacity()) {
  80681. throw new Error('The number of codewords does not match the selected symbol');
  80682. }
  80683. var sb = new _StringBuilder.default();
  80684. sb.append(codewords);
  80685. var blockCount = symbolInfo.getInterleavedBlockCount();
  80686. if (blockCount === 1) {
  80687. var ecc = this.createECCBlock(codewords, symbolInfo.getErrorCodewords());
  80688. sb.append(ecc);
  80689. } else {
  80690. // sb.setLength(sb.capacity());
  80691. var dataSizes = [];
  80692. var errorSizes = [];
  80693. for (var i = 0; i < blockCount; i++) {
  80694. dataSizes[i] = symbolInfo.getDataLengthForInterleavedBlock(i + 1);
  80695. errorSizes[i] = symbolInfo.getErrorLengthForInterleavedBlock(i + 1);
  80696. }
  80697. for (var block = 0; block < blockCount; block++) {
  80698. var temp = new _StringBuilder.default();
  80699. for (var d = block; d < symbolInfo.getDataCapacity(); d += blockCount) {
  80700. temp.append(codewords.charAt(d));
  80701. }
  80702. var ecc = this.createECCBlock(temp.toString(), errorSizes[block]);
  80703. var pos = 0;
  80704. for (var e = block; e < errorSizes[block] * blockCount; e += blockCount) {
  80705. sb.setCharAt(symbolInfo.getDataCapacity() + e, ecc.charAt(pos++));
  80706. }
  80707. }
  80708. }
  80709. return sb.toString();
  80710. };
  80711. ErrorCorrection.createECCBlock = function (codewords, numECWords) {
  80712. var table = -1;
  80713. for (var i = 0; i < _constants.FACTOR_SETS.length; i++) {
  80714. if (_constants.FACTOR_SETS[i] === numECWords) {
  80715. table = i;
  80716. break;
  80717. }
  80718. }
  80719. if (table < 0) {
  80720. throw new Error('Illegal number of error correction codewords specified: ' + numECWords);
  80721. }
  80722. var poly = _constants.FACTORS[table];
  80723. var ecc = [];
  80724. for (var i = 0; i < numECWords; i++) {
  80725. ecc[i] = 0;
  80726. }
  80727. for (var i = 0; i < codewords.length; i++) {
  80728. var m = ecc[numECWords - 1] ^ codewords.charAt(i).charCodeAt(0);
  80729. for (var k = numECWords - 1; k > 0; k--) {
  80730. if (m !== 0 && poly[k] !== 0) {
  80731. ecc[k] = ecc[k - 1] ^ _constants.ALOG[(_constants.LOG[m] + _constants.LOG[poly[k]]) % 255];
  80732. } else {
  80733. ecc[k] = ecc[k - 1];
  80734. }
  80735. }
  80736. if (m !== 0 && poly[0] !== 0) {
  80737. ecc[0] = _constants.ALOG[(_constants.LOG[m] + _constants.LOG[poly[0]]) % 255];
  80738. } else {
  80739. ecc[0] = 0;
  80740. }
  80741. }
  80742. var eccReversed = [];
  80743. for (var i = 0; i < numECWords; i++) {
  80744. eccReversed[i] = ecc[numECWords - i - 1];
  80745. }
  80746. return eccReversed.map(function (c) {
  80747. return String.fromCharCode(c);
  80748. }).join('');
  80749. };
  80750. return ErrorCorrection;
  80751. }();
  80752. var _default = ErrorCorrection;
  80753. exports.default = _default;
  80754. /***/ }),
  80755. /* 481 */
  80756. /*!************************************************************************************************!*\
  80757. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/constants.js ***!
  80758. \************************************************************************************************/
  80759. /*! no static exports found */
  80760. /***/ (function(module, exports, __webpack_require__) {
  80761. "use strict";
  80762. Object.defineProperty(exports, "__esModule", {
  80763. value: true
  80764. });
  80765. exports.X12_UNLATCH = exports.X12_ENCODATION = exports.UPPER_SHIFT = exports.TEXT_ENCODATION = exports.SymbolShapeHint = exports.PAD = exports.MODULO_VALUE = exports.MACRO_TRAILER = exports.MACRO_06_HEADER = exports.MACRO_06 = exports.MACRO_05_HEADER = exports.MACRO_05 = exports.LOG = exports.LATCH_TO_TEXT = exports.LATCH_TO_EDIFACT = exports.LATCH_TO_C40 = exports.LATCH_TO_BASE256 = exports.LATCH_TO_ANSIX12 = exports.FACTOR_SETS = exports.FACTORS = exports.EDIFACT_ENCODATION = exports.C40_UNLATCH = exports.C40_ENCODATION = exports.BASE256_ENCODATION = exports.ASCII_ENCODATION = exports.ALOG = void 0;
  80766. var _a;
  80767. /**
  80768. * Lookup table which factors to use for which number of error correction codewords.
  80769. * See FACTORS.
  80770. */
  80771. var FACTOR_SETS = [5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68];
  80772. /**
  80773. * Precomputed polynomial factors for ECC 200.
  80774. */
  80775. exports.FACTOR_SETS = FACTOR_SETS;
  80776. var FACTORS = [[228, 48, 15, 111, 62], [23, 68, 144, 134, 240, 92, 254], [28, 24, 185, 166, 223, 248, 116, 255, 110, 61], [175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120], [41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242], [156, 97, 192, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185], [83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 90, 188], [15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 174, 186, 172], [52, 190, 88, 205, 109, 39, 176, 21, 155, 197, 251, 223, 155, 21, 5, 172, 254, 124, 12, 181, 184, 96, 50, 193], [211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255], [245, 127, 242, 218, 130, 250, 162, 181, 102, 120, 84, 179, 220, 251, 80, 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 225, 98, 81, 112], [77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, 202, 69, 50, 150, 177, 226, 5, 9, 5], [245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19], [175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192, 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46], [242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143, 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, 250, 106, 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204], [220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232, 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186]];
  80777. exports.FACTORS = FACTORS;
  80778. var /*final*/MODULO_VALUE = 0x12d;
  80779. exports.MODULO_VALUE = MODULO_VALUE;
  80780. var static_LOG = function static_LOG(LOG, ALOG) {
  80781. var p = 1;
  80782. for (var i = 0; i < 255; i++) {
  80783. ALOG[i] = p;
  80784. LOG[p] = i;
  80785. p *= 2;
  80786. if (p >= 256) {
  80787. p ^= MODULO_VALUE;
  80788. }
  80789. }
  80790. return {
  80791. LOG: LOG,
  80792. ALOG: ALOG
  80793. };
  80794. };
  80795. var LOG = (_a = static_LOG([], []), _a.LOG),
  80796. ALOG = _a.ALOG;
  80797. exports.ALOG = ALOG;
  80798. exports.LOG = LOG;
  80799. var SymbolShapeHint;
  80800. exports.SymbolShapeHint = SymbolShapeHint;
  80801. (function (SymbolShapeHint) {
  80802. SymbolShapeHint[SymbolShapeHint["FORCE_NONE"] = 0] = "FORCE_NONE";
  80803. SymbolShapeHint[SymbolShapeHint["FORCE_SQUARE"] = 1] = "FORCE_SQUARE";
  80804. SymbolShapeHint[SymbolShapeHint["FORCE_RECTANGLE"] = 2] = "FORCE_RECTANGLE";
  80805. })(SymbolShapeHint || (exports.SymbolShapeHint = SymbolShapeHint = {}));
  80806. /**
  80807. * Padding character
  80808. */
  80809. var PAD = 129;
  80810. /**
  80811. * mode latch to C40 encodation mode
  80812. */
  80813. exports.PAD = PAD;
  80814. var LATCH_TO_C40 = 230;
  80815. /**
  80816. * mode latch to Base 256 encodation mode
  80817. */
  80818. exports.LATCH_TO_C40 = LATCH_TO_C40;
  80819. var LATCH_TO_BASE256 = 231;
  80820. /**
  80821. * FNC1 Codeword
  80822. */
  80823. // private static FNC1 = 232;
  80824. /**
  80825. * Structured Append Codeword
  80826. */
  80827. // private static STRUCTURED_APPEND = 233;
  80828. /**
  80829. * Reader Programming
  80830. */
  80831. // private static READER_PROGRAMMING = 234;
  80832. /**
  80833. * Upper Shift
  80834. */
  80835. exports.LATCH_TO_BASE256 = LATCH_TO_BASE256;
  80836. var UPPER_SHIFT = 235;
  80837. /**
  80838. * 05 Macro
  80839. */
  80840. exports.UPPER_SHIFT = UPPER_SHIFT;
  80841. var MACRO_05 = 236;
  80842. /**
  80843. * 06 Macro
  80844. */
  80845. exports.MACRO_05 = MACRO_05;
  80846. var MACRO_06 = 237;
  80847. /**
  80848. * mode latch to ANSI X.12 encodation mode
  80849. */
  80850. exports.MACRO_06 = MACRO_06;
  80851. var LATCH_TO_ANSIX12 = 238;
  80852. /**
  80853. * mode latch to Text encodation mode
  80854. */
  80855. exports.LATCH_TO_ANSIX12 = LATCH_TO_ANSIX12;
  80856. var LATCH_TO_TEXT = 239;
  80857. /**
  80858. * mode latch to EDIFACT encodation mode
  80859. */
  80860. exports.LATCH_TO_TEXT = LATCH_TO_TEXT;
  80861. var LATCH_TO_EDIFACT = 240;
  80862. /**
  80863. * ECI character (Extended Channel Interpretation)
  80864. */
  80865. // private export const ECI = 241;
  80866. /**
  80867. * Unlatch from C40 encodation
  80868. */
  80869. exports.LATCH_TO_EDIFACT = LATCH_TO_EDIFACT;
  80870. var C40_UNLATCH = 254;
  80871. /**
  80872. * Unlatch from X12 encodation
  80873. */
  80874. exports.C40_UNLATCH = C40_UNLATCH;
  80875. var X12_UNLATCH = 254;
  80876. /**
  80877. * 05 Macro header
  80878. */
  80879. exports.X12_UNLATCH = X12_UNLATCH;
  80880. var MACRO_05_HEADER = "[)>\x1E05\x1D";
  80881. /**
  80882. * 06 Macro header
  80883. */
  80884. exports.MACRO_05_HEADER = MACRO_05_HEADER;
  80885. var MACRO_06_HEADER = "[)>\x1E06\x1D";
  80886. /**
  80887. * Macro trailer
  80888. */
  80889. exports.MACRO_06_HEADER = MACRO_06_HEADER;
  80890. var MACRO_TRAILER = "\x1E\x04";
  80891. exports.MACRO_TRAILER = MACRO_TRAILER;
  80892. var ASCII_ENCODATION = 0;
  80893. exports.ASCII_ENCODATION = ASCII_ENCODATION;
  80894. var C40_ENCODATION = 1;
  80895. exports.C40_ENCODATION = C40_ENCODATION;
  80896. var TEXT_ENCODATION = 2;
  80897. exports.TEXT_ENCODATION = TEXT_ENCODATION;
  80898. var X12_ENCODATION = 3;
  80899. exports.X12_ENCODATION = X12_ENCODATION;
  80900. var EDIFACT_ENCODATION = 4;
  80901. exports.EDIFACT_ENCODATION = EDIFACT_ENCODATION;
  80902. var BASE256_ENCODATION = 5;
  80903. exports.BASE256_ENCODATION = BASE256_ENCODATION;
  80904. /***/ }),
  80905. /* 482 */
  80906. /*!*******************************************************************************************************!*\
  80907. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js ***!
  80908. \*******************************************************************************************************/
  80909. /*! no static exports found */
  80910. /***/ (function(module, exports, __webpack_require__) {
  80911. "use strict";
  80912. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  80913. Object.defineProperty(exports, "__esModule", {
  80914. value: true
  80915. });
  80916. exports.default = void 0;
  80917. var _ASCIIEncoder = __webpack_require__(/*! ./ASCIIEncoder */ 483);
  80918. var _Base256Encoder = __webpack_require__(/*! ./Base256Encoder */ 484);
  80919. var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
  80920. var _constants = __webpack_require__(/*! ./constants */ 481);
  80921. var _EdifactEncoder = __webpack_require__(/*! ./EdifactEncoder */ 486);
  80922. var _EncoderContext = __webpack_require__(/*! ./EncoderContext */ 487);
  80923. var _X12Encoder = __webpack_require__(/*! ./X12Encoder */ 489);
  80924. var _TextEncoder = __webpack_require__(/*! ./TextEncoder */ 490);
  80925. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  80926. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  80927. // tslint:disable-next-line:no-circular-imports
  80928. // tslint:disable-next-line:no-circular-imports
  80929. // tslint:disable-next-line:no-circular-imports
  80930. // tslint:disable-next-line:no-circular-imports
  80931. // tslint:disable-next-line:no-circular-imports
  80932. // tslint:disable-next-line:no-circular-imports
  80933. /**
  80934. * DataMatrix ECC 200 data encoder following the algorithm described in ISO/IEC 16022:200(E) in
  80935. * annex S.
  80936. */
  80937. var HighLevelEncoder = /** @class */function () {
  80938. function HighLevelEncoder() {}
  80939. HighLevelEncoder.randomize253State = function (codewordPosition) {
  80940. var pseudoRandom = 149 * codewordPosition % 253 + 1;
  80941. var tempVariable = _constants.PAD + pseudoRandom;
  80942. return tempVariable <= 254 ? tempVariable : tempVariable - 254;
  80943. };
  80944. /**
  80945. * Performs message encoding of a DataMatrix message using the algorithm described in annex P
  80946. * of ISO/IEC 16022:2000(E).
  80947. *
  80948. * @param msg the message
  80949. * @param shape requested shape. May be {@code SymbolShapeHint.FORCE_NONE},
  80950. * {@code SymbolShapeHint.FORCE_SQUARE} or {@code SymbolShapeHint.FORCE_RECTANGLE}.
  80951. * @param minSize the minimum symbol size constraint or null for no constraint
  80952. * @param maxSize the maximum symbol size constraint or null for no constraint
  80953. * @param forceC40 enforce C40 encoding
  80954. * @return the encoded message (the char values range from 0 to 255)
  80955. */
  80956. HighLevelEncoder.encodeHighLevel = function (msg, shape, minSize, maxSize, forceC40) {
  80957. if (shape === void 0) {
  80958. shape = 0 /* FORCE_NONE */;
  80959. }
  80960. if (minSize === void 0) {
  80961. minSize = null;
  80962. }
  80963. if (maxSize === void 0) {
  80964. maxSize = null;
  80965. }
  80966. if (forceC40 === void 0) {
  80967. forceC40 = false;
  80968. }
  80969. // the codewords 0..255 are encoded as Unicode characters
  80970. var c40Encoder = new _C40Encoder.C40Encoder();
  80971. var encoders = [new _ASCIIEncoder.ASCIIEncoder(), c40Encoder, new _TextEncoder.TextEncoder(), new _X12Encoder.X12Encoder(), new _EdifactEncoder.EdifactEncoder(), new _Base256Encoder.Base256Encoder()];
  80972. var context = new _EncoderContext.EncoderContext(msg);
  80973. context.setSymbolShape(shape);
  80974. context.setSizeConstraints(minSize, maxSize);
  80975. if (msg.startsWith(_constants.MACRO_05_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
  80976. context.writeCodeword(_constants.MACRO_05);
  80977. context.setSkipAtEnd(2);
  80978. context.pos += _constants.MACRO_05_HEADER.length;
  80979. } else if (msg.startsWith(_constants.MACRO_06_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
  80980. context.writeCodeword(_constants.MACRO_06);
  80981. context.setSkipAtEnd(2);
  80982. context.pos += _constants.MACRO_06_HEADER.length;
  80983. }
  80984. var encodingMode = _constants.ASCII_ENCODATION; // Default mode
  80985. if (forceC40) {
  80986. c40Encoder.encodeMaximal(context);
  80987. encodingMode = context.getNewEncoding();
  80988. context.resetEncoderSignal();
  80989. }
  80990. while (context.hasMoreCharacters()) {
  80991. encoders[encodingMode].encode(context);
  80992. if (context.getNewEncoding() >= 0) {
  80993. encodingMode = context.getNewEncoding();
  80994. context.resetEncoderSignal();
  80995. }
  80996. }
  80997. var len = context.getCodewordCount();
  80998. context.updateSymbolInfo();
  80999. var capacity = context.getSymbolInfo().getDataCapacity();
  81000. if (len < capacity && encodingMode !== _constants.ASCII_ENCODATION && encodingMode !== _constants.BASE256_ENCODATION && encodingMode !== _constants.EDIFACT_ENCODATION) {
  81001. context.writeCodeword("\xFE"); // Unlatch (254)
  81002. }
  81003. // Padding
  81004. var codewords = context.getCodewords();
  81005. if (codewords.length() < capacity) {
  81006. codewords.append(_constants.PAD);
  81007. }
  81008. while (codewords.length() < capacity) {
  81009. codewords.append(this.randomize253State(codewords.length() + 1));
  81010. }
  81011. return context.getCodewords().toString();
  81012. };
  81013. HighLevelEncoder.lookAheadTest = function (msg, startpos, currentMode) {
  81014. var newMode = this.lookAheadTestIntern(msg, startpos, currentMode);
  81015. if (currentMode === _constants.X12_ENCODATION && newMode === _constants.X12_ENCODATION) {
  81016. var endpos = Math.min(startpos + 3, msg.length);
  81017. for (var i = startpos; i < endpos; i++) {
  81018. if (!this.isNativeX12(msg.charCodeAt(i))) {
  81019. return _constants.ASCII_ENCODATION;
  81020. }
  81021. }
  81022. } else if (currentMode === _constants.EDIFACT_ENCODATION && newMode === _constants.EDIFACT_ENCODATION) {
  81023. var endpos = Math.min(startpos + 4, msg.length);
  81024. for (var i = startpos; i < endpos; i++) {
  81025. if (!this.isNativeEDIFACT(msg.charCodeAt(i))) {
  81026. return _constants.ASCII_ENCODATION;
  81027. }
  81028. }
  81029. }
  81030. return newMode;
  81031. };
  81032. HighLevelEncoder.lookAheadTestIntern = function (msg, startpos, currentMode) {
  81033. if (startpos >= msg.length) {
  81034. return currentMode;
  81035. }
  81036. var charCounts;
  81037. // step J
  81038. if (currentMode === _constants.ASCII_ENCODATION) {
  81039. charCounts = [0, 1, 1, 1, 1, 1.25];
  81040. } else {
  81041. charCounts = [1, 2, 2, 2, 2, 2.25];
  81042. charCounts[currentMode] = 0;
  81043. }
  81044. var charsProcessed = 0;
  81045. var mins = new Uint8Array(6);
  81046. var intCharCounts = [];
  81047. while (true) {
  81048. // step K
  81049. if (startpos + charsProcessed === msg.length) {
  81050. _Arrays.default.fill(mins, 0);
  81051. _Arrays.default.fill(intCharCounts, 0);
  81052. var min = this.findMinimums(charCounts, intCharCounts, _Integer.default.MAX_VALUE, mins);
  81053. var minCount = this.getMinimumCount(mins);
  81054. if (intCharCounts[_constants.ASCII_ENCODATION] === min) {
  81055. return _constants.ASCII_ENCODATION;
  81056. }
  81057. if (minCount === 1) {
  81058. if (mins[_constants.BASE256_ENCODATION] > 0) {
  81059. return _constants.BASE256_ENCODATION;
  81060. }
  81061. if (mins[_constants.EDIFACT_ENCODATION] > 0) {
  81062. return _constants.EDIFACT_ENCODATION;
  81063. }
  81064. if (mins[_constants.TEXT_ENCODATION] > 0) {
  81065. return _constants.TEXT_ENCODATION;
  81066. }
  81067. if (mins[_constants.X12_ENCODATION] > 0) {
  81068. return _constants.X12_ENCODATION;
  81069. }
  81070. }
  81071. return _constants.C40_ENCODATION;
  81072. }
  81073. var c = msg.charCodeAt(startpos + charsProcessed);
  81074. charsProcessed++;
  81075. // step L
  81076. if (this.isDigit(c)) {
  81077. charCounts[_constants.ASCII_ENCODATION] += 0.5;
  81078. } else if (this.isExtendedASCII(c)) {
  81079. charCounts[_constants.ASCII_ENCODATION] = Math.ceil(charCounts[_constants.ASCII_ENCODATION]);
  81080. charCounts[_constants.ASCII_ENCODATION] += 2.0;
  81081. } else {
  81082. charCounts[_constants.ASCII_ENCODATION] = Math.ceil(charCounts[_constants.ASCII_ENCODATION]);
  81083. charCounts[_constants.ASCII_ENCODATION]++;
  81084. }
  81085. // step M
  81086. if (this.isNativeC40(c)) {
  81087. charCounts[_constants.C40_ENCODATION] += 2.0 / 3.0;
  81088. } else if (this.isExtendedASCII(c)) {
  81089. charCounts[_constants.C40_ENCODATION] += 8.0 / 3.0;
  81090. } else {
  81091. charCounts[_constants.C40_ENCODATION] += 4.0 / 3.0;
  81092. }
  81093. // step N
  81094. if (this.isNativeText(c)) {
  81095. charCounts[_constants.TEXT_ENCODATION] += 2.0 / 3.0;
  81096. } else if (this.isExtendedASCII(c)) {
  81097. charCounts[_constants.TEXT_ENCODATION] += 8.0 / 3.0;
  81098. } else {
  81099. charCounts[_constants.TEXT_ENCODATION] += 4.0 / 3.0;
  81100. }
  81101. // step O
  81102. if (this.isNativeX12(c)) {
  81103. charCounts[_constants.X12_ENCODATION] += 2.0 / 3.0;
  81104. } else if (this.isExtendedASCII(c)) {
  81105. charCounts[_constants.X12_ENCODATION] += 13.0 / 3.0;
  81106. } else {
  81107. charCounts[_constants.X12_ENCODATION] += 10.0 / 3.0;
  81108. }
  81109. // step P
  81110. if (this.isNativeEDIFACT(c)) {
  81111. charCounts[_constants.EDIFACT_ENCODATION] += 3.0 / 4.0;
  81112. } else if (this.isExtendedASCII(c)) {
  81113. charCounts[_constants.EDIFACT_ENCODATION] += 17.0 / 4.0;
  81114. } else {
  81115. charCounts[_constants.EDIFACT_ENCODATION] += 13.0 / 4.0;
  81116. }
  81117. // step Q
  81118. if (this.isSpecialB256(c)) {
  81119. charCounts[_constants.BASE256_ENCODATION] += 4.0;
  81120. } else {
  81121. charCounts[_constants.BASE256_ENCODATION]++;
  81122. }
  81123. // step R
  81124. if (charsProcessed >= 4) {
  81125. _Arrays.default.fill(mins, 0);
  81126. _Arrays.default.fill(intCharCounts, 0);
  81127. this.findMinimums(charCounts, intCharCounts, _Integer.default.MAX_VALUE, mins);
  81128. if (intCharCounts[_constants.ASCII_ENCODATION] < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION])) {
  81129. return _constants.ASCII_ENCODATION;
  81130. }
  81131. if (intCharCounts[_constants.BASE256_ENCODATION] < intCharCounts[_constants.ASCII_ENCODATION] || intCharCounts[_constants.BASE256_ENCODATION] + 1 < this.min(intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION])) {
  81132. return _constants.BASE256_ENCODATION;
  81133. }
  81134. if (intCharCounts[_constants.EDIFACT_ENCODATION] + 1 < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.ASCII_ENCODATION])) {
  81135. return _constants.EDIFACT_ENCODATION;
  81136. }
  81137. if (intCharCounts[_constants.TEXT_ENCODATION] + 1 < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION], intCharCounts[_constants.X12_ENCODATION], intCharCounts[_constants.ASCII_ENCODATION])) {
  81138. return _constants.TEXT_ENCODATION;
  81139. }
  81140. if (intCharCounts[_constants.X12_ENCODATION] + 1 < this.min(intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.C40_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION], intCharCounts[_constants.ASCII_ENCODATION])) {
  81141. return _constants.X12_ENCODATION;
  81142. }
  81143. if (intCharCounts[_constants.C40_ENCODATION] + 1 < this.min(intCharCounts[_constants.ASCII_ENCODATION], intCharCounts[_constants.BASE256_ENCODATION], intCharCounts[_constants.EDIFACT_ENCODATION], intCharCounts[_constants.TEXT_ENCODATION])) {
  81144. if (intCharCounts[_constants.C40_ENCODATION] < intCharCounts[_constants.X12_ENCODATION]) {
  81145. return _constants.C40_ENCODATION;
  81146. }
  81147. if (intCharCounts[_constants.C40_ENCODATION] === intCharCounts[_constants.X12_ENCODATION]) {
  81148. var p = startpos + charsProcessed + 1;
  81149. while (p < msg.length) {
  81150. var tc = msg.charCodeAt(p);
  81151. if (this.isX12TermSep(tc)) {
  81152. return _constants.X12_ENCODATION;
  81153. }
  81154. if (!this.isNativeX12(tc)) {
  81155. break;
  81156. }
  81157. p++;
  81158. }
  81159. return _constants.C40_ENCODATION;
  81160. }
  81161. }
  81162. }
  81163. }
  81164. };
  81165. HighLevelEncoder.min = function (f1, f2, f3, f4, f5) {
  81166. var val = Math.min(f1, Math.min(f2, Math.min(f3, f4)));
  81167. if (f5 === undefined) {
  81168. return val;
  81169. } else {
  81170. return Math.min(val, f5);
  81171. }
  81172. };
  81173. HighLevelEncoder.findMinimums = function (charCounts, intCharCounts, min, mins) {
  81174. for (var i = 0; i < 6; i++) {
  81175. var current = intCharCounts[i] = Math.ceil(charCounts[i]);
  81176. if (min > current) {
  81177. min = current;
  81178. _Arrays.default.fill(mins, 0);
  81179. }
  81180. if (min === current) {
  81181. mins[i] = mins[i] + 1;
  81182. }
  81183. }
  81184. return min;
  81185. };
  81186. HighLevelEncoder.getMinimumCount = function (mins) {
  81187. var minCount = 0;
  81188. for (var i = 0; i < 6; i++) {
  81189. minCount += mins[i];
  81190. }
  81191. return minCount || 0;
  81192. };
  81193. HighLevelEncoder.isDigit = function (ch) {
  81194. return ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0);
  81195. };
  81196. HighLevelEncoder.isExtendedASCII = function (ch) {
  81197. return ch >= 128 && ch <= 255;
  81198. };
  81199. HighLevelEncoder.isNativeC40 = function (ch) {
  81200. return ch === ' '.charCodeAt(0) || ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0) || ch >= 'A'.charCodeAt(0) && ch <= 'Z'.charCodeAt(0);
  81201. };
  81202. HighLevelEncoder.isNativeText = function (ch) {
  81203. return ch === ' '.charCodeAt(0) || ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0) || ch >= 'a'.charCodeAt(0) && ch <= 'z'.charCodeAt(0);
  81204. };
  81205. HighLevelEncoder.isNativeX12 = function (ch) {
  81206. return this.isX12TermSep(ch) || ch === ' '.charCodeAt(0) || ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0) || ch >= 'A'.charCodeAt(0) && ch <= 'Z'.charCodeAt(0);
  81207. };
  81208. HighLevelEncoder.isX12TermSep = function (ch) {
  81209. return ch === 13 ||
  81210. // CR
  81211. ch === '*'.charCodeAt(0) || ch === '>'.charCodeAt(0);
  81212. };
  81213. HighLevelEncoder.isNativeEDIFACT = function (ch) {
  81214. return ch >= ' '.charCodeAt(0) && ch <= '^'.charCodeAt(0);
  81215. };
  81216. HighLevelEncoder.isSpecialB256 = function (ch) {
  81217. return false; // TODO NOT IMPLEMENTED YET!!!
  81218. };
  81219. /**
  81220. * Determines the number of consecutive characters that are encodable using numeric compaction.
  81221. *
  81222. * @param msg the message
  81223. * @param startpos the start position within the message
  81224. * @return the requested character count
  81225. */
  81226. HighLevelEncoder.determineConsecutiveDigitCount = function (msg, startpos) {
  81227. if (startpos === void 0) {
  81228. startpos = 0;
  81229. }
  81230. var len = msg.length;
  81231. var idx = startpos;
  81232. while (idx < len && this.isDigit(msg.charCodeAt(idx))) {
  81233. idx++;
  81234. }
  81235. return idx - startpos;
  81236. };
  81237. HighLevelEncoder.illegalCharacter = function (singleCharacter) {
  81238. var hex = _Integer.default.toHexString(singleCharacter.charCodeAt(0));
  81239. hex = '0000'.substring(0, 4 - hex.length) + hex;
  81240. throw new Error('Illegal character: ' + singleCharacter + ' (0x' + hex + ')');
  81241. };
  81242. return HighLevelEncoder;
  81243. }();
  81244. var _default = HighLevelEncoder;
  81245. exports.default = _default;
  81246. /***/ }),
  81247. /* 483 */
  81248. /*!***************************************************************************************************!*\
  81249. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/ASCIIEncoder.js ***!
  81250. \***************************************************************************************************/
  81251. /*! no static exports found */
  81252. /***/ (function(module, exports, __webpack_require__) {
  81253. "use strict";
  81254. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  81255. Object.defineProperty(exports, "__esModule", {
  81256. value: true
  81257. });
  81258. exports.ASCIIEncoder = void 0;
  81259. var _constants = __webpack_require__(/*! ./constants */ 481);
  81260. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  81261. // tslint:disable-next-line:no-circular-imports
  81262. var ASCIIEncoder = /** @class */function () {
  81263. function ASCIIEncoder() {}
  81264. ASCIIEncoder.prototype.getEncodingMode = function () {
  81265. return _constants.ASCII_ENCODATION;
  81266. };
  81267. ASCIIEncoder.prototype.encode = function (context) {
  81268. // step B
  81269. var n = _HighLevelEncoder.default.determineConsecutiveDigitCount(context.getMessage(), context.pos);
  81270. if (n >= 2) {
  81271. context.writeCodeword(this.encodeASCIIDigits(context.getMessage().charCodeAt(context.pos), context.getMessage().charCodeAt(context.pos + 1)));
  81272. context.pos += 2;
  81273. } else {
  81274. var c = context.getCurrentChar();
  81275. var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
  81276. if (newMode !== this.getEncodingMode()) {
  81277. switch (newMode) {
  81278. case _constants.BASE256_ENCODATION:
  81279. context.writeCodeword(_constants.LATCH_TO_BASE256);
  81280. context.signalEncoderChange(_constants.BASE256_ENCODATION);
  81281. return;
  81282. case _constants.C40_ENCODATION:
  81283. context.writeCodeword(_constants.LATCH_TO_C40);
  81284. context.signalEncoderChange(_constants.C40_ENCODATION);
  81285. return;
  81286. case _constants.X12_ENCODATION:
  81287. context.writeCodeword(_constants.LATCH_TO_ANSIX12);
  81288. context.signalEncoderChange(_constants.X12_ENCODATION);
  81289. break;
  81290. case _constants.TEXT_ENCODATION:
  81291. context.writeCodeword(_constants.LATCH_TO_TEXT);
  81292. context.signalEncoderChange(_constants.TEXT_ENCODATION);
  81293. break;
  81294. case _constants.EDIFACT_ENCODATION:
  81295. context.writeCodeword(_constants.LATCH_TO_EDIFACT);
  81296. context.signalEncoderChange(_constants.EDIFACT_ENCODATION);
  81297. break;
  81298. default:
  81299. throw new Error('Illegal mode: ' + newMode);
  81300. }
  81301. } else if (_HighLevelEncoder.default.isExtendedASCII(c)) {
  81302. context.writeCodeword(_constants.UPPER_SHIFT);
  81303. context.writeCodeword(c - 128 + 1);
  81304. context.pos++;
  81305. } else {
  81306. context.writeCodeword(c + 1);
  81307. context.pos++;
  81308. }
  81309. }
  81310. };
  81311. ASCIIEncoder.prototype.encodeASCIIDigits = function (digit1, digit2) {
  81312. if (_HighLevelEncoder.default.isDigit(digit1) && _HighLevelEncoder.default.isDigit(digit2)) {
  81313. var num = (digit1 - 48) * 10 + (digit2 - 48);
  81314. return num + 130;
  81315. }
  81316. throw new Error('not digits: ' + digit1 + digit2);
  81317. };
  81318. return ASCIIEncoder;
  81319. }();
  81320. exports.ASCIIEncoder = ASCIIEncoder;
  81321. /***/ }),
  81322. /* 484 */
  81323. /*!*****************************************************************************************************!*\
  81324. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/Base256Encoder.js ***!
  81325. \*****************************************************************************************************/
  81326. /*! no static exports found */
  81327. /***/ (function(module, exports, __webpack_require__) {
  81328. "use strict";
  81329. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  81330. Object.defineProperty(exports, "__esModule", {
  81331. value: true
  81332. });
  81333. exports.Base256Encoder = void 0;
  81334. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  81335. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  81336. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  81337. var _constants = __webpack_require__(/*! ./constants */ 481);
  81338. var Base256Encoder = /** @class */function () {
  81339. function Base256Encoder() {}
  81340. Base256Encoder.prototype.getEncodingMode = function () {
  81341. return _constants.BASE256_ENCODATION;
  81342. };
  81343. Base256Encoder.prototype.encode = function (context) {
  81344. var buffer = new _StringBuilder.default();
  81345. buffer.append(0); // Initialize length field
  81346. while (context.hasMoreCharacters()) {
  81347. var c = context.getCurrentChar();
  81348. buffer.append(c);
  81349. context.pos++;
  81350. var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
  81351. if (newMode !== this.getEncodingMode()) {
  81352. // Return to ASCII encodation, which will actually handle latch to new mode
  81353. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  81354. break;
  81355. }
  81356. }
  81357. var dataCount = buffer.length() - 1;
  81358. var lengthFieldSize = 1;
  81359. var currentSize = context.getCodewordCount() + dataCount + lengthFieldSize;
  81360. context.updateSymbolInfo(currentSize);
  81361. var mustPad = context.getSymbolInfo().getDataCapacity() - currentSize > 0;
  81362. if (context.hasMoreCharacters() || mustPad) {
  81363. if (dataCount <= 249) {
  81364. buffer.setCharAt(0, _StringUtils.default.getCharAt(dataCount));
  81365. } else if (dataCount <= 1555) {
  81366. buffer.setCharAt(0, _StringUtils.default.getCharAt(Math.floor(dataCount / 250) + 249));
  81367. buffer.insert(1, _StringUtils.default.getCharAt(dataCount % 250));
  81368. } else {
  81369. throw new Error('Message length not in valid ranges: ' + dataCount);
  81370. }
  81371. }
  81372. for (var i = 0, c = buffer.length(); i < c; i++) {
  81373. context.writeCodeword(this.randomize255State(buffer.charAt(i).charCodeAt(0), context.getCodewordCount() + 1));
  81374. }
  81375. };
  81376. Base256Encoder.prototype.randomize255State = function (ch, codewordPosition) {
  81377. var pseudoRandom = 149 * codewordPosition % 255 + 1;
  81378. var tempVariable = ch + pseudoRandom;
  81379. if (tempVariable <= 255) {
  81380. return tempVariable;
  81381. } else {
  81382. return tempVariable - 256;
  81383. }
  81384. };
  81385. return Base256Encoder;
  81386. }();
  81387. exports.Base256Encoder = Base256Encoder;
  81388. /***/ }),
  81389. /* 485 */
  81390. /*!*************************************************************************************************!*\
  81391. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/C40Encoder.js ***!
  81392. \*************************************************************************************************/
  81393. /*! no static exports found */
  81394. /***/ (function(module, exports, __webpack_require__) {
  81395. "use strict";
  81396. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  81397. Object.defineProperty(exports, "__esModule", {
  81398. value: true
  81399. });
  81400. exports.C40Encoder = void 0;
  81401. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  81402. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  81403. var _constants = __webpack_require__(/*! ./constants */ 481);
  81404. var C40Encoder = /** @class */function () {
  81405. function C40Encoder() {}
  81406. C40Encoder.prototype.getEncodingMode = function () {
  81407. return _constants.C40_ENCODATION;
  81408. };
  81409. C40Encoder.prototype.encodeMaximal = function (context) {
  81410. var buffer = new _StringBuilder.default();
  81411. var lastCharSize = 0;
  81412. var backtrackStartPosition = context.pos;
  81413. var backtrackBufferLength = 0;
  81414. while (context.hasMoreCharacters()) {
  81415. var c = context.getCurrentChar();
  81416. context.pos++;
  81417. lastCharSize = this.encodeChar(c, buffer);
  81418. if (buffer.length() % 3 === 0) {
  81419. backtrackStartPosition = context.pos;
  81420. backtrackBufferLength = buffer.length();
  81421. }
  81422. }
  81423. if (backtrackBufferLength !== buffer.length()) {
  81424. var unwritten = Math.floor(buffer.length() / 3 * 2);
  81425. var curCodewordCount = Math.floor(context.getCodewordCount() + unwritten + 1); // +1 for the latch to C40
  81426. context.updateSymbolInfo(curCodewordCount);
  81427. var available = context.getSymbolInfo().getDataCapacity() - curCodewordCount;
  81428. var rest = Math.floor(buffer.length() % 3);
  81429. if (rest === 2 && available !== 2 || rest === 1 && (lastCharSize > 3 || available !== 1)) {
  81430. // buffer.setLength(backtrackBufferLength);
  81431. context.pos = backtrackStartPosition;
  81432. }
  81433. }
  81434. if (buffer.length() > 0) {
  81435. context.writeCodeword(_constants.LATCH_TO_C40);
  81436. }
  81437. this.handleEOD(context, buffer);
  81438. };
  81439. C40Encoder.prototype.encode = function (context) {
  81440. // step C
  81441. var buffer = new _StringBuilder.default();
  81442. while (context.hasMoreCharacters()) {
  81443. var c = context.getCurrentChar();
  81444. context.pos++;
  81445. var lastCharSize = this.encodeChar(c, buffer);
  81446. var unwritten = Math.floor(buffer.length() / 3) * 2;
  81447. var curCodewordCount = context.getCodewordCount() + unwritten;
  81448. context.updateSymbolInfo(curCodewordCount);
  81449. var available = context.getSymbolInfo().getDataCapacity() - curCodewordCount;
  81450. if (!context.hasMoreCharacters()) {
  81451. // Avoid having a single C40 value in the last triplet
  81452. var removed = new _StringBuilder.default();
  81453. if (buffer.length() % 3 === 2 && available !== 2) {
  81454. lastCharSize = this.backtrackOneCharacter(context, buffer, removed, lastCharSize);
  81455. }
  81456. while (buffer.length() % 3 === 1 && (lastCharSize > 3 || available !== 1)) {
  81457. lastCharSize = this.backtrackOneCharacter(context, buffer, removed, lastCharSize);
  81458. }
  81459. break;
  81460. }
  81461. var count = buffer.length();
  81462. if (count % 3 === 0) {
  81463. var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
  81464. if (newMode !== this.getEncodingMode()) {
  81465. // Return to ASCII encodation, which will actually handle latch to new mode
  81466. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  81467. break;
  81468. }
  81469. }
  81470. }
  81471. this.handleEOD(context, buffer);
  81472. };
  81473. C40Encoder.prototype.backtrackOneCharacter = function (context, buffer, removed, lastCharSize) {
  81474. var count = buffer.length();
  81475. var test = buffer.toString().substring(0, count - lastCharSize);
  81476. buffer.setLengthToZero();
  81477. buffer.append(test);
  81478. // buffer.delete(count - lastCharSize, count);
  81479. /*for (let i = count - lastCharSize; i < count; i++) {
  81480. buffer.deleteCharAt(i);
  81481. }*/
  81482. context.pos--;
  81483. var c = context.getCurrentChar();
  81484. lastCharSize = this.encodeChar(c, removed);
  81485. context.resetSymbolInfo(); // Deal with possible reduction in symbol size
  81486. return lastCharSize;
  81487. };
  81488. C40Encoder.prototype.writeNextTriplet = function (context, buffer) {
  81489. context.writeCodewords(this.encodeToCodewords(buffer.toString()));
  81490. var test = buffer.toString().substring(3);
  81491. buffer.setLengthToZero();
  81492. buffer.append(test);
  81493. // buffer.delete(0, 3);
  81494. /*for (let i = 0; i < 3; i++) {
  81495. buffer.deleteCharAt(i);
  81496. }*/
  81497. };
  81498. /**
  81499. * Handle "end of data" situations
  81500. *
  81501. * @param context the encoder context
  81502. * @param buffer the buffer with the remaining encoded characters
  81503. */
  81504. C40Encoder.prototype.handleEOD = function (context, buffer) {
  81505. var unwritten = Math.floor(buffer.length() / 3 * 2);
  81506. var rest = buffer.length() % 3;
  81507. var curCodewordCount = context.getCodewordCount() + unwritten;
  81508. context.updateSymbolInfo(curCodewordCount);
  81509. var available = context.getSymbolInfo().getDataCapacity() - curCodewordCount;
  81510. if (rest === 2) {
  81511. buffer.append('\0'); // Shift 1
  81512. while (buffer.length() >= 3) {
  81513. this.writeNextTriplet(context, buffer);
  81514. }
  81515. if (context.hasMoreCharacters()) {
  81516. context.writeCodeword(_constants.C40_UNLATCH);
  81517. }
  81518. } else if (available === 1 && rest === 1) {
  81519. while (buffer.length() >= 3) {
  81520. this.writeNextTriplet(context, buffer);
  81521. }
  81522. if (context.hasMoreCharacters()) {
  81523. context.writeCodeword(_constants.C40_UNLATCH);
  81524. }
  81525. // else no unlatch
  81526. context.pos--;
  81527. } else if (rest === 0) {
  81528. while (buffer.length() >= 3) {
  81529. this.writeNextTriplet(context, buffer);
  81530. }
  81531. if (available > 0 || context.hasMoreCharacters()) {
  81532. context.writeCodeword(_constants.C40_UNLATCH);
  81533. }
  81534. } else {
  81535. throw new Error('Unexpected case. Please report!');
  81536. }
  81537. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  81538. };
  81539. C40Encoder.prototype.encodeChar = function (c, sb) {
  81540. if (c === ' '.charCodeAt(0)) {
  81541. sb.append(3);
  81542. return 1;
  81543. }
  81544. if (c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) {
  81545. sb.append(c - 48 + 4);
  81546. return 1;
  81547. }
  81548. if (c >= 'A'.charCodeAt(0) && c <= 'Z'.charCodeAt(0)) {
  81549. sb.append(c - 65 + 14);
  81550. return 1;
  81551. }
  81552. if (c < ' '.charCodeAt(0)) {
  81553. sb.append(0); // Shift 1 Set
  81554. sb.append(c);
  81555. return 2;
  81556. }
  81557. if (c <= '/'.charCodeAt(0)) {
  81558. sb.append(1); // Shift 2 Set
  81559. sb.append(c - 33);
  81560. return 2;
  81561. }
  81562. if (c <= '@'.charCodeAt(0)) {
  81563. sb.append(1); // Shift 2 Set
  81564. sb.append(c - 58 + 15);
  81565. return 2;
  81566. }
  81567. if (c <= '_'.charCodeAt(0)) {
  81568. sb.append(1); // Shift 2 Set
  81569. sb.append(c - 91 + 22);
  81570. return 2;
  81571. }
  81572. if (c <= 127) {
  81573. sb.append(2); // Shift 3 Set
  81574. sb.append(c - 96);
  81575. return 2;
  81576. }
  81577. sb.append(1 + "\x1E"); // Shift 2, Upper Shift
  81578. var len = 2;
  81579. len += this.encodeChar(c - 128, sb);
  81580. return len;
  81581. };
  81582. C40Encoder.prototype.encodeToCodewords = function (sb) {
  81583. var v = 1600 * sb.charCodeAt(0) + 40 * sb.charCodeAt(1) + sb.charCodeAt(2) + 1;
  81584. var cw1 = v / 256;
  81585. var cw2 = v % 256;
  81586. var result = new _StringBuilder.default();
  81587. result.append(cw1);
  81588. result.append(cw2);
  81589. return result.toString();
  81590. };
  81591. return C40Encoder;
  81592. }();
  81593. exports.C40Encoder = C40Encoder;
  81594. /***/ }),
  81595. /* 486 */
  81596. /*!*****************************************************************************************************!*\
  81597. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/EdifactEncoder.js ***!
  81598. \*****************************************************************************************************/
  81599. /*! no static exports found */
  81600. /***/ (function(module, exports, __webpack_require__) {
  81601. "use strict";
  81602. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  81603. Object.defineProperty(exports, "__esModule", {
  81604. value: true
  81605. });
  81606. exports.EdifactEncoder = void 0;
  81607. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  81608. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  81609. var _constants = __webpack_require__(/*! ./constants */ 481);
  81610. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  81611. var EdifactEncoder = /** @class */function () {
  81612. function EdifactEncoder() {}
  81613. EdifactEncoder.prototype.getEncodingMode = function () {
  81614. return _constants.EDIFACT_ENCODATION;
  81615. };
  81616. EdifactEncoder.prototype.encode = function (context) {
  81617. // step F
  81618. var buffer = new _StringBuilder.default();
  81619. while (context.hasMoreCharacters()) {
  81620. var c = context.getCurrentChar();
  81621. this.encodeChar(c, buffer);
  81622. context.pos++;
  81623. var count = buffer.length();
  81624. if (count >= 4) {
  81625. context.writeCodewords(this.encodeToCodewords(buffer.toString()));
  81626. var test_1 = buffer.toString().substring(4);
  81627. buffer.setLengthToZero();
  81628. buffer.append(test_1);
  81629. // buffer.delete(0, 4);
  81630. // for (let i = 0; i < 4; i++) {
  81631. // buffer.deleteCharAt(i);
  81632. // }
  81633. var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
  81634. if (newMode !== this.getEncodingMode()) {
  81635. // Return to ASCII encodation, which will actually handle latch to new mode
  81636. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  81637. break;
  81638. }
  81639. }
  81640. }
  81641. buffer.append(_StringUtils.default.getCharAt(31)); // Unlatch
  81642. this.handleEOD(context, buffer);
  81643. };
  81644. /**
  81645. * Handle "end of data" situations
  81646. *
  81647. * @param context the encoder context
  81648. * @param buffer the buffer with the remaining encoded characters
  81649. */
  81650. EdifactEncoder.prototype.handleEOD = function (context, buffer) {
  81651. try {
  81652. var count = buffer.length();
  81653. if (count === 0) {
  81654. return; // Already finished
  81655. }
  81656. if (count === 1) {
  81657. // Only an unlatch at the end
  81658. context.updateSymbolInfo();
  81659. var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
  81660. var remaining = context.getRemainingCharacters();
  81661. // The following two lines are a hack inspired by the 'fix' from https://sourceforge.net/p/barcode4j/svn/221/
  81662. if (remaining > available) {
  81663. context.updateSymbolInfo(context.getCodewordCount() + 1);
  81664. available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
  81665. }
  81666. if (remaining <= available && available <= 2) {
  81667. return; // No unlatch
  81668. }
  81669. }
  81670. if (count > 4) {
  81671. throw new Error('Count must not exceed 4');
  81672. }
  81673. var restChars = count - 1;
  81674. var encoded = this.encodeToCodewords(buffer.toString());
  81675. var endOfSymbolReached = !context.hasMoreCharacters();
  81676. var restInAscii = endOfSymbolReached && restChars <= 2;
  81677. if (restChars <= 2) {
  81678. context.updateSymbolInfo(context.getCodewordCount() + restChars);
  81679. var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
  81680. if (available >= 3) {
  81681. restInAscii = false;
  81682. context.updateSymbolInfo(context.getCodewordCount() + encoded.length);
  81683. // available = context.symbolInfo.dataCapacity - context.getCodewordCount();
  81684. }
  81685. }
  81686. if (restInAscii) {
  81687. context.resetSymbolInfo();
  81688. context.pos -= restChars;
  81689. } else {
  81690. context.writeCodewords(encoded);
  81691. }
  81692. } finally {
  81693. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  81694. }
  81695. };
  81696. EdifactEncoder.prototype.encodeChar = function (c, sb) {
  81697. if (c >= ' '.charCodeAt(0) && c <= '?'.charCodeAt(0)) {
  81698. sb.append(c);
  81699. } else if (c >= '@'.charCodeAt(0) && c <= '^'.charCodeAt(0)) {
  81700. sb.append(_StringUtils.default.getCharAt(c - 64));
  81701. } else {
  81702. _HighLevelEncoder.default.illegalCharacter(_StringUtils.default.getCharAt(c));
  81703. }
  81704. };
  81705. EdifactEncoder.prototype.encodeToCodewords = function (sb) {
  81706. var len = sb.length;
  81707. if (len === 0) {
  81708. throw new Error('StringBuilder must not be empty');
  81709. }
  81710. var c1 = sb.charAt(0).charCodeAt(0);
  81711. var c2 = len >= 2 ? sb.charAt(1).charCodeAt(0) : 0;
  81712. var c3 = len >= 3 ? sb.charAt(2).charCodeAt(0) : 0;
  81713. var c4 = len >= 4 ? sb.charAt(3).charCodeAt(0) : 0;
  81714. var v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
  81715. var cw1 = v >> 16 & 255;
  81716. var cw2 = v >> 8 & 255;
  81717. var cw3 = v & 255;
  81718. var res = new _StringBuilder.default();
  81719. res.append(cw1);
  81720. if (len >= 2) {
  81721. res.append(cw2);
  81722. }
  81723. if (len >= 3) {
  81724. res.append(cw3);
  81725. }
  81726. return res.toString();
  81727. };
  81728. return EdifactEncoder;
  81729. }();
  81730. exports.EdifactEncoder = EdifactEncoder;
  81731. /***/ }),
  81732. /* 487 */
  81733. /*!*****************************************************************************************************!*\
  81734. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/EncoderContext.js ***!
  81735. \*****************************************************************************************************/
  81736. /*! no static exports found */
  81737. /***/ (function(module, exports, __webpack_require__) {
  81738. "use strict";
  81739. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  81740. Object.defineProperty(exports, "__esModule", {
  81741. value: true
  81742. });
  81743. exports.EncoderContext = void 0;
  81744. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  81745. var _SymbolInfo = _interopRequireDefault(__webpack_require__(/*! ./SymbolInfo */ 488));
  81746. var EncoderContext = /** @class */function () {
  81747. function EncoderContext(msg) {
  81748. this.msg = msg;
  81749. this.pos = 0;
  81750. this.skipAtEnd = 0;
  81751. // From this point on Strings are not Unicode anymore!
  81752. var msgBinary = msg.split('').map(function (c) {
  81753. return c.charCodeAt(0);
  81754. });
  81755. var sb = new _StringBuilder.default();
  81756. for (var i = 0, c = msgBinary.length; i < c; i++) {
  81757. var ch = String.fromCharCode(msgBinary[i] & 0xff);
  81758. if (ch === '?' && msg.charAt(i) !== '?') {
  81759. throw new Error('Message contains characters outside ISO-8859-1 encoding.');
  81760. }
  81761. sb.append(ch);
  81762. }
  81763. this.msg = sb.toString(); // Not Unicode here!
  81764. this.shape = 0 /* FORCE_NONE */;
  81765. this.codewords = new _StringBuilder.default();
  81766. this.newEncoding = -1;
  81767. }
  81768. EncoderContext.prototype.setSymbolShape = function (shape) {
  81769. this.shape = shape;
  81770. };
  81771. EncoderContext.prototype.setSizeConstraints = function (minSize, maxSize) {
  81772. this.minSize = minSize;
  81773. this.maxSize = maxSize;
  81774. };
  81775. EncoderContext.prototype.getMessage = function () {
  81776. return this.msg;
  81777. };
  81778. EncoderContext.prototype.setSkipAtEnd = function (count) {
  81779. this.skipAtEnd = count;
  81780. };
  81781. EncoderContext.prototype.getCurrentChar = function () {
  81782. return this.msg.charCodeAt(this.pos);
  81783. };
  81784. EncoderContext.prototype.getCurrent = function () {
  81785. return this.msg.charCodeAt(this.pos);
  81786. };
  81787. EncoderContext.prototype.getCodewords = function () {
  81788. return this.codewords;
  81789. };
  81790. EncoderContext.prototype.writeCodewords = function (codewords) {
  81791. this.codewords.append(codewords);
  81792. };
  81793. EncoderContext.prototype.writeCodeword = function (codeword) {
  81794. this.codewords.append(codeword);
  81795. };
  81796. EncoderContext.prototype.getCodewordCount = function () {
  81797. return this.codewords.length();
  81798. };
  81799. EncoderContext.prototype.getNewEncoding = function () {
  81800. return this.newEncoding;
  81801. };
  81802. EncoderContext.prototype.signalEncoderChange = function (encoding) {
  81803. this.newEncoding = encoding;
  81804. };
  81805. EncoderContext.prototype.resetEncoderSignal = function () {
  81806. this.newEncoding = -1;
  81807. };
  81808. EncoderContext.prototype.hasMoreCharacters = function () {
  81809. return this.pos < this.getTotalMessageCharCount();
  81810. };
  81811. EncoderContext.prototype.getTotalMessageCharCount = function () {
  81812. return this.msg.length - this.skipAtEnd;
  81813. };
  81814. EncoderContext.prototype.getRemainingCharacters = function () {
  81815. return this.getTotalMessageCharCount() - this.pos;
  81816. };
  81817. EncoderContext.prototype.getSymbolInfo = function () {
  81818. return this.symbolInfo;
  81819. };
  81820. EncoderContext.prototype.updateSymbolInfo = function (len) {
  81821. if (len === void 0) {
  81822. len = this.getCodewordCount();
  81823. }
  81824. if (this.symbolInfo == null || len > this.symbolInfo.getDataCapacity()) {
  81825. this.symbolInfo = _SymbolInfo.default.lookup(len, this.shape, this.minSize, this.maxSize, true);
  81826. }
  81827. };
  81828. EncoderContext.prototype.resetSymbolInfo = function () {
  81829. this.symbolInfo = null;
  81830. };
  81831. return EncoderContext;
  81832. }();
  81833. exports.EncoderContext = EncoderContext;
  81834. /***/ }),
  81835. /* 488 */
  81836. /*!*************************************************************************************************!*\
  81837. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/SymbolInfo.js ***!
  81838. \*************************************************************************************************/
  81839. /*! no static exports found */
  81840. /***/ (function(module, exports, __webpack_require__) {
  81841. "use strict";
  81842. Object.defineProperty(exports, "__esModule", {
  81843. value: true
  81844. });
  81845. exports.default = exports.PROD_SYMBOLS = void 0;
  81846. var __extends = void 0 && (void 0).__extends || function () {
  81847. var _extendStatics = function extendStatics(d, b) {
  81848. _extendStatics = Object.setPrototypeOf || {
  81849. __proto__: []
  81850. } instanceof Array && function (d, b) {
  81851. d.__proto__ = b;
  81852. } || function (d, b) {
  81853. for (var p in b) {
  81854. if (b.hasOwnProperty(p)) d[p] = b[p];
  81855. }
  81856. };
  81857. return _extendStatics(d, b);
  81858. };
  81859. return function (d, b) {
  81860. _extendStatics(d, b);
  81861. function __() {
  81862. this.constructor = d;
  81863. }
  81864. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  81865. };
  81866. }();
  81867. var __values = void 0 && (void 0).__values || function (o) {
  81868. var s = typeof Symbol === "function" && Symbol.iterator,
  81869. m = s && o[s],
  81870. i = 0;
  81871. if (m) return m.call(o);
  81872. if (o && typeof o.length === "number") return {
  81873. next: function next() {
  81874. if (o && i >= o.length) o = void 0;
  81875. return {
  81876. value: o && o[i++],
  81877. done: !o
  81878. };
  81879. }
  81880. };
  81881. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  81882. };
  81883. /**
  81884. * Symbol info table for DataMatrix.
  81885. */
  81886. var SymbolInfo = /** @class */function () {
  81887. function SymbolInfo(rectangular, dataCapacity, errorCodewords, matrixWidth, matrixHeight, dataRegions, rsBlockData, rsBlockError) {
  81888. if (rsBlockData === void 0) {
  81889. rsBlockData = 0;
  81890. }
  81891. if (rsBlockError === void 0) {
  81892. rsBlockError = 0;
  81893. }
  81894. this.rectangular = rectangular;
  81895. this.dataCapacity = dataCapacity;
  81896. this.errorCodewords = errorCodewords;
  81897. this.matrixWidth = matrixWidth;
  81898. this.matrixHeight = matrixHeight;
  81899. this.dataRegions = dataRegions;
  81900. this.rsBlockData = rsBlockData;
  81901. this.rsBlockError = rsBlockError;
  81902. }
  81903. SymbolInfo.lookup = function (dataCodewords, shape, minSize, maxSize, fail) {
  81904. var e_1, _a;
  81905. if (shape === void 0) {
  81906. shape = 0 /* FORCE_NONE */;
  81907. }
  81908. if (minSize === void 0) {
  81909. minSize = null;
  81910. }
  81911. if (maxSize === void 0) {
  81912. maxSize = null;
  81913. }
  81914. if (fail === void 0) {
  81915. fail = true;
  81916. }
  81917. try {
  81918. for (var PROD_SYMBOLS_1 = __values(PROD_SYMBOLS), PROD_SYMBOLS_1_1 = PROD_SYMBOLS_1.next(); !PROD_SYMBOLS_1_1.done; PROD_SYMBOLS_1_1 = PROD_SYMBOLS_1.next()) {
  81919. var symbol = PROD_SYMBOLS_1_1.value;
  81920. if (shape === 1 /* FORCE_SQUARE */ && symbol.rectangular) {
  81921. continue;
  81922. }
  81923. if (shape === 2 /* FORCE_RECTANGLE */ && !symbol.rectangular) {
  81924. continue;
  81925. }
  81926. if (minSize != null && (symbol.getSymbolWidth() < minSize.getWidth() || symbol.getSymbolHeight() < minSize.getHeight())) {
  81927. continue;
  81928. }
  81929. if (maxSize != null && (symbol.getSymbolWidth() > maxSize.getWidth() || symbol.getSymbolHeight() > maxSize.getHeight())) {
  81930. continue;
  81931. }
  81932. if (dataCodewords <= symbol.dataCapacity) {
  81933. return symbol;
  81934. }
  81935. }
  81936. } catch (e_1_1) {
  81937. e_1 = {
  81938. error: e_1_1
  81939. };
  81940. } finally {
  81941. try {
  81942. if (PROD_SYMBOLS_1_1 && !PROD_SYMBOLS_1_1.done && (_a = PROD_SYMBOLS_1.return)) _a.call(PROD_SYMBOLS_1);
  81943. } finally {
  81944. if (e_1) throw e_1.error;
  81945. }
  81946. }
  81947. if (fail) {
  81948. throw new Error("Can't find a symbol arrangement that matches the message. Data codewords: " + dataCodewords);
  81949. }
  81950. return null;
  81951. };
  81952. SymbolInfo.prototype.getHorizontalDataRegions = function () {
  81953. switch (this.dataRegions) {
  81954. case 1:
  81955. return 1;
  81956. case 2:
  81957. case 4:
  81958. return 2;
  81959. case 16:
  81960. return 4;
  81961. case 36:
  81962. return 6;
  81963. default:
  81964. throw new Error('Cannot handle this number of data regions');
  81965. }
  81966. };
  81967. SymbolInfo.prototype.getVerticalDataRegions = function () {
  81968. switch (this.dataRegions) {
  81969. case 1:
  81970. case 2:
  81971. return 1;
  81972. case 4:
  81973. return 2;
  81974. case 16:
  81975. return 4;
  81976. case 36:
  81977. return 6;
  81978. default:
  81979. throw new Error('Cannot handle this number of data regions');
  81980. }
  81981. };
  81982. SymbolInfo.prototype.getSymbolDataWidth = function () {
  81983. return this.getHorizontalDataRegions() * this.matrixWidth;
  81984. };
  81985. SymbolInfo.prototype.getSymbolDataHeight = function () {
  81986. return this.getVerticalDataRegions() * this.matrixHeight;
  81987. };
  81988. SymbolInfo.prototype.getSymbolWidth = function () {
  81989. return this.getSymbolDataWidth() + this.getHorizontalDataRegions() * 2;
  81990. };
  81991. SymbolInfo.prototype.getSymbolHeight = function () {
  81992. return this.getSymbolDataHeight() + this.getVerticalDataRegions() * 2;
  81993. };
  81994. SymbolInfo.prototype.getCodewordCount = function () {
  81995. return this.dataCapacity + this.errorCodewords;
  81996. };
  81997. SymbolInfo.prototype.getInterleavedBlockCount = function () {
  81998. if (!this.rsBlockData) return 1;
  81999. return this.dataCapacity / this.rsBlockData;
  82000. };
  82001. SymbolInfo.prototype.getDataCapacity = function () {
  82002. return this.dataCapacity;
  82003. };
  82004. SymbolInfo.prototype.getErrorCodewords = function () {
  82005. return this.errorCodewords;
  82006. };
  82007. SymbolInfo.prototype.getDataLengthForInterleavedBlock = function (index) {
  82008. return this.rsBlockData;
  82009. };
  82010. SymbolInfo.prototype.getErrorLengthForInterleavedBlock = function (index) {
  82011. return this.rsBlockError;
  82012. };
  82013. return SymbolInfo;
  82014. }();
  82015. var _default = SymbolInfo;
  82016. exports.default = _default;
  82017. var DataMatrixSymbolInfo144 = /** @class */function (_super) {
  82018. __extends(DataMatrixSymbolInfo144, _super);
  82019. function DataMatrixSymbolInfo144() {
  82020. return _super.call(this, false, 1558, 620, 22, 22, 36, -1, 62) || this;
  82021. }
  82022. DataMatrixSymbolInfo144.prototype.getInterleavedBlockCount = function () {
  82023. return 10;
  82024. };
  82025. DataMatrixSymbolInfo144.prototype.getDataLengthForInterleavedBlock = function (index) {
  82026. return index <= 8 ? 156 : 155;
  82027. };
  82028. return DataMatrixSymbolInfo144;
  82029. }(SymbolInfo);
  82030. var PROD_SYMBOLS = [new SymbolInfo(false, 3, 5, 8, 8, 1), new SymbolInfo(false, 5, 7, 10, 10, 1), /*rect*/new SymbolInfo(true, 5, 7, 16, 6, 1), new SymbolInfo(false, 8, 10, 12, 12, 1), /*rect*/new SymbolInfo(true, 10, 11, 14, 6, 2), new SymbolInfo(false, 12, 12, 14, 14, 1), /*rect*/new SymbolInfo(true, 16, 14, 24, 10, 1), new SymbolInfo(false, 18, 14, 16, 16, 1), new SymbolInfo(false, 22, 18, 18, 18, 1), /*rect*/new SymbolInfo(true, 22, 18, 16, 10, 2), new SymbolInfo(false, 30, 20, 20, 20, 1), /*rect*/new SymbolInfo(true, 32, 24, 16, 14, 2), new SymbolInfo(false, 36, 24, 22, 22, 1), new SymbolInfo(false, 44, 28, 24, 24, 1), /*rect*/new SymbolInfo(true, 49, 28, 22, 14, 2), new SymbolInfo(false, 62, 36, 14, 14, 4), new SymbolInfo(false, 86, 42, 16, 16, 4), new SymbolInfo(false, 114, 48, 18, 18, 4), new SymbolInfo(false, 144, 56, 20, 20, 4), new SymbolInfo(false, 174, 68, 22, 22, 4), new SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42), new SymbolInfo(false, 280, 112, 14, 14, 16, 140, 56), new SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36), new SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48), new SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56), new SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68), new SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56), new SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68), new SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62), new DataMatrixSymbolInfo144()];
  82031. exports.PROD_SYMBOLS = PROD_SYMBOLS;
  82032. /***/ }),
  82033. /* 489 */
  82034. /*!*************************************************************************************************!*\
  82035. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/X12Encoder.js ***!
  82036. \*************************************************************************************************/
  82037. /*! no static exports found */
  82038. /***/ (function(module, exports, __webpack_require__) {
  82039. "use strict";
  82040. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  82041. Object.defineProperty(exports, "__esModule", {
  82042. value: true
  82043. });
  82044. exports.X12Encoder = void 0;
  82045. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  82046. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../../util/StringBuilder */ 320));
  82047. var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
  82048. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  82049. var _constants = __webpack_require__(/*! ./constants */ 481);
  82050. var __extends = void 0 && (void 0).__extends || function () {
  82051. var _extendStatics = function extendStatics(d, b) {
  82052. _extendStatics = Object.setPrototypeOf || {
  82053. __proto__: []
  82054. } instanceof Array && function (d, b) {
  82055. d.__proto__ = b;
  82056. } || function (d, b) {
  82057. for (var p in b) {
  82058. if (b.hasOwnProperty(p)) d[p] = b[p];
  82059. }
  82060. };
  82061. return _extendStatics(d, b);
  82062. };
  82063. return function (d, b) {
  82064. _extendStatics(d, b);
  82065. function __() {
  82066. this.constructor = d;
  82067. }
  82068. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  82069. };
  82070. }();
  82071. var X12Encoder = /** @class */function (_super) {
  82072. __extends(X12Encoder, _super);
  82073. function X12Encoder() {
  82074. return _super !== null && _super.apply(this, arguments) || this;
  82075. }
  82076. X12Encoder.prototype.getEncodingMode = function () {
  82077. return _constants.X12_ENCODATION;
  82078. };
  82079. X12Encoder.prototype.encode = function (context) {
  82080. // step C
  82081. var buffer = new _StringBuilder.default();
  82082. while (context.hasMoreCharacters()) {
  82083. var c = context.getCurrentChar();
  82084. context.pos++;
  82085. this.encodeChar(c, buffer);
  82086. var count = buffer.length();
  82087. if (count % 3 === 0) {
  82088. this.writeNextTriplet(context, buffer);
  82089. var newMode = _HighLevelEncoder.default.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
  82090. if (newMode !== this.getEncodingMode()) {
  82091. // Return to ASCII encodation, which will actually handle latch to new mode
  82092. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  82093. break;
  82094. }
  82095. }
  82096. }
  82097. this.handleEOD(context, buffer);
  82098. };
  82099. X12Encoder.prototype.encodeChar = function (c, sb) {
  82100. switch (c) {
  82101. case 13:
  82102. // CR (Carriage return)
  82103. sb.append(0);
  82104. break;
  82105. case '*'.charCodeAt(0):
  82106. sb.append(1);
  82107. break;
  82108. case '>'.charCodeAt(0):
  82109. sb.append(2);
  82110. break;
  82111. case ' '.charCodeAt(0):
  82112. sb.append(3);
  82113. break;
  82114. default:
  82115. if (c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) {
  82116. sb.append(c - 48 + 4);
  82117. } else if (c >= 'A'.charCodeAt(0) && c <= 'Z'.charCodeAt(0)) {
  82118. sb.append(c - 65 + 14);
  82119. } else {
  82120. _HighLevelEncoder.default.illegalCharacter(_StringUtils.default.getCharAt(c));
  82121. }
  82122. break;
  82123. }
  82124. return 1;
  82125. };
  82126. X12Encoder.prototype.handleEOD = function (context, buffer) {
  82127. context.updateSymbolInfo();
  82128. var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
  82129. var count = buffer.length();
  82130. context.pos -= count;
  82131. if (context.getRemainingCharacters() > 1 || available > 1 || context.getRemainingCharacters() !== available) {
  82132. context.writeCodeword(_constants.X12_UNLATCH);
  82133. }
  82134. if (context.getNewEncoding() < 0) {
  82135. context.signalEncoderChange(_constants.ASCII_ENCODATION);
  82136. }
  82137. };
  82138. return X12Encoder;
  82139. }(_C40Encoder.C40Encoder);
  82140. exports.X12Encoder = X12Encoder;
  82141. /***/ }),
  82142. /* 490 */
  82143. /*!**************************************************************************************************!*\
  82144. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/TextEncoder.js ***!
  82145. \**************************************************************************************************/
  82146. /*! no static exports found */
  82147. /***/ (function(module, exports, __webpack_require__) {
  82148. "use strict";
  82149. Object.defineProperty(exports, "__esModule", {
  82150. value: true
  82151. });
  82152. exports.TextEncoder = void 0;
  82153. var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
  82154. var _constants = __webpack_require__(/*! ./constants */ 481);
  82155. var __extends = void 0 && (void 0).__extends || function () {
  82156. var _extendStatics = function extendStatics(d, b) {
  82157. _extendStatics = Object.setPrototypeOf || {
  82158. __proto__: []
  82159. } instanceof Array && function (d, b) {
  82160. d.__proto__ = b;
  82161. } || function (d, b) {
  82162. for (var p in b) {
  82163. if (b.hasOwnProperty(p)) d[p] = b[p];
  82164. }
  82165. };
  82166. return _extendStatics(d, b);
  82167. };
  82168. return function (d, b) {
  82169. _extendStatics(d, b);
  82170. function __() {
  82171. this.constructor = d;
  82172. }
  82173. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  82174. };
  82175. }();
  82176. var TextEncoder = /** @class */function (_super) {
  82177. __extends(TextEncoder, _super);
  82178. function TextEncoder() {
  82179. return _super !== null && _super.apply(this, arguments) || this;
  82180. }
  82181. TextEncoder.prototype.getEncodingMode = function () {
  82182. return _constants.TEXT_ENCODATION;
  82183. };
  82184. TextEncoder.prototype.encodeChar = function (c, sb) {
  82185. if (c === ' '.charCodeAt(0)) {
  82186. sb.append(3);
  82187. return 1;
  82188. }
  82189. if (c >= '0'.charCodeAt(0) && c <= '9'.charCodeAt(0)) {
  82190. sb.append(c - 48 + 4);
  82191. return 1;
  82192. }
  82193. if (c >= 'a'.charCodeAt(0) && c <= 'z'.charCodeAt(0)) {
  82194. sb.append(c - 97 + 14);
  82195. return 1;
  82196. }
  82197. if (c < ' '.charCodeAt(0)) {
  82198. sb.append(0); // Shift 1 Set
  82199. sb.append(c);
  82200. return 2;
  82201. }
  82202. if (c <= '/'.charCodeAt(0)) {
  82203. sb.append(1); // Shift 2 Set
  82204. sb.append(c - 33);
  82205. return 2;
  82206. }
  82207. if (c <= '@'.charCodeAt(0)) {
  82208. sb.append(1); // Shift 2 Set
  82209. sb.append(c - 58 + 15);
  82210. return 2;
  82211. }
  82212. if (c >= '['.charCodeAt(0) && c <= '_'.charCodeAt(0)) {
  82213. sb.append(1); // Shift 2 Set
  82214. sb.append(c - 91 + 22);
  82215. return 2;
  82216. }
  82217. if (c === '`'.charCodeAt(0)) {
  82218. sb.append(2); // Shift 3 Set
  82219. sb.append(0); // '`' - 96 == 0
  82220. return 2;
  82221. }
  82222. if (c <= 'Z'.charCodeAt(0)) {
  82223. sb.append(2); // Shift 3 Set
  82224. sb.append(c - 65 + 1);
  82225. return 2;
  82226. }
  82227. if (c <= 127) {
  82228. sb.append(2); // Shift 3 Set
  82229. sb.append(c - 123 + 27);
  82230. return 2;
  82231. }
  82232. sb.append(1 + "\x1E"); // Shift 2, Upper Shift
  82233. var len = 2;
  82234. len += this.encodeChar(c - 128, sb);
  82235. return len;
  82236. };
  82237. return TextEncoder;
  82238. }(_C40Encoder.C40Encoder);
  82239. exports.TextEncoder = TextEncoder;
  82240. /***/ }),
  82241. /* 491 */
  82242. /*!***********************************************************************************************!*\
  82243. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/DataMatrixWriter.js ***!
  82244. \***********************************************************************************************/
  82245. /*! no static exports found */
  82246. /***/ (function(module, exports, __webpack_require__) {
  82247. "use strict";
  82248. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  82249. Object.defineProperty(exports, "__esModule", {
  82250. value: true
  82251. });
  82252. exports.default = void 0;
  82253. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  82254. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
  82255. var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../EncodeHintType */ 462));
  82256. var _ByteMatrix = _interopRequireDefault(__webpack_require__(/*! ../qrcode/encoder/ByteMatrix */ 466));
  82257. var _Charset = _interopRequireDefault(__webpack_require__(/*! ../util/Charset */ 477));
  82258. var _encoder = __webpack_require__(/*! ./encoder */ 492);
  82259. var DataMatrixWriter = /** @class */function () {
  82260. function DataMatrixWriter() {}
  82261. DataMatrixWriter.prototype.encode = function (contents, format, width, height, hints) {
  82262. if (hints === void 0) {
  82263. hints = null;
  82264. }
  82265. if (contents.trim() === '') {
  82266. throw new Error('Found empty contents');
  82267. }
  82268. if (format !== _BarcodeFormat.default.DATA_MATRIX) {
  82269. throw new Error('Can only encode DATA_MATRIX, but got ' + format);
  82270. }
  82271. if (width < 0 || height < 0) {
  82272. throw new Error('Requested dimensions can\'t be negative: ' + width + 'x' + height);
  82273. }
  82274. // Try to get force shape & min / max size
  82275. var shape = 0 /* FORCE_NONE */;
  82276. var minSize = null;
  82277. var maxSize = null;
  82278. if (hints != null) {
  82279. var requestedShape = hints.get(_EncodeHintType.default.DATA_MATRIX_SHAPE);
  82280. if (requestedShape != null) {
  82281. shape = requestedShape;
  82282. }
  82283. var requestedMinSize = hints.get(_EncodeHintType.default.MIN_SIZE);
  82284. if (requestedMinSize != null) {
  82285. minSize = requestedMinSize;
  82286. }
  82287. var requestedMaxSize = hints.get(_EncodeHintType.default.MAX_SIZE);
  82288. if (requestedMaxSize != null) {
  82289. maxSize = requestedMaxSize;
  82290. }
  82291. }
  82292. // 1. step: Data encodation
  82293. var encoded;
  82294. var hasCompactionHint = hints != null && hints.has(_EncodeHintType.default.DATA_MATRIX_COMPACT) && Boolean(hints.get(_EncodeHintType.default.DATA_MATRIX_COMPACT).toString());
  82295. if (hasCompactionHint) {
  82296. var hasGS1FormatHint = hints.has(_EncodeHintType.default.GS1_FORMAT) && Boolean(hints.get(_EncodeHintType.default.GS1_FORMAT).toString());
  82297. var charset = null;
  82298. var hasEncodingHint = hints.has(_EncodeHintType.default.CHARACTER_SET);
  82299. if (hasEncodingHint) {
  82300. charset = _Charset.default.forName(hints.get(_EncodeHintType.default.CHARACTER_SET).toString());
  82301. }
  82302. encoded = _encoder.MinimalEncoder.encodeHighLevel(contents, charset, hasGS1FormatHint ? 0x1d : -1, shape);
  82303. } else {
  82304. var hasForceC40Hint = hints != null && hints.has(_EncodeHintType.default.FORCE_C40) && Boolean(hints.get(_EncodeHintType.default.FORCE_C40).toString());
  82305. encoded = _encoder.HighLevelEncoder.encodeHighLevel(contents, shape, minSize, maxSize, hasForceC40Hint);
  82306. }
  82307. var symbolInfo = _encoder.SymbolInfo.lookup(encoded.length, shape, minSize, maxSize, true);
  82308. // 2. step: ECC generation
  82309. var codewords = _encoder.ErrorCorrection.encodeECC200(encoded, symbolInfo);
  82310. // 3. step: Module placement in Matrix
  82311. var placement = new _encoder.DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
  82312. placement.place();
  82313. // 4. step: low-level encoding
  82314. return this.encodeLowLevel(placement, symbolInfo, width, height);
  82315. };
  82316. /**
  82317. * Encode the given symbol info to a bit matrix.
  82318. *
  82319. * @param placement The DataMatrix placement.
  82320. * @param symbolInfo The symbol info to encode.
  82321. * @return The bit matrix generated.
  82322. */
  82323. DataMatrixWriter.prototype.encodeLowLevel = function (placement, symbolInfo, width, height) {
  82324. var symbolWidth = symbolInfo.getSymbolDataWidth();
  82325. var symbolHeight = symbolInfo.getSymbolDataHeight();
  82326. var matrix = new _ByteMatrix.default(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHeight());
  82327. var matrixY = 0;
  82328. for (var y = 0; y < symbolHeight; y++) {
  82329. // Fill the top edge with alternate 0 / 1
  82330. var matrixX = void 0;
  82331. if (y % symbolInfo.matrixHeight === 0) {
  82332. matrixX = 0;
  82333. for (var x = 0; x < symbolInfo.getSymbolWidth(); x++) {
  82334. matrix.setBoolean(matrixX, matrixY, x % 2 === 0);
  82335. matrixX++;
  82336. }
  82337. matrixY++;
  82338. }
  82339. matrixX = 0;
  82340. for (var x = 0; x < symbolWidth; x++) {
  82341. // Fill the right edge with full 1
  82342. if (x % symbolInfo.matrixWidth === 0) {
  82343. matrix.setBoolean(matrixX, matrixY, true);
  82344. matrixX++;
  82345. }
  82346. matrix.setBoolean(matrixX, matrixY, placement.getBit(x, y));
  82347. matrixX++;
  82348. // Fill the right edge with alternate 0 / 1
  82349. if (x % symbolInfo.matrixWidth === symbolInfo.matrixWidth - 1) {
  82350. matrix.setBoolean(matrixX, matrixY, y % 2 === 0);
  82351. matrixX++;
  82352. }
  82353. }
  82354. matrixY++;
  82355. // Fill the bottom edge with full 1
  82356. if (y % symbolInfo.matrixHeight === symbolInfo.matrixHeight - 1) {
  82357. matrixX = 0;
  82358. for (var x = 0; x < symbolInfo.getSymbolWidth(); x++) {
  82359. matrix.setBoolean(matrixX, matrixY, true);
  82360. matrixX++;
  82361. }
  82362. matrixY++;
  82363. }
  82364. }
  82365. return this.convertByteMatrixToBitMatrix(matrix, width, height);
  82366. };
  82367. /**
  82368. * Convert the ByteMatrix to BitMatrix.
  82369. *
  82370. * @param reqHeight The requested height of the image (in pixels) with the Datamatrix code
  82371. * @param reqWidth The requested width of the image (in pixels) with the Datamatrix code
  82372. * @param matrix The input matrix.
  82373. * @return The output matrix.
  82374. */
  82375. DataMatrixWriter.prototype.convertByteMatrixToBitMatrix = function (matrix, reqWidth, reqHeight) {
  82376. var matrixWidth = matrix.getWidth();
  82377. var matrixHeight = matrix.getHeight();
  82378. var outputWidth = Math.max(reqWidth, matrixWidth);
  82379. var outputHeight = Math.max(reqHeight, matrixHeight);
  82380. var multiple = Math.min(outputWidth / matrixWidth, outputHeight / matrixHeight);
  82381. var leftPadding = (outputWidth - matrixWidth * multiple) / 2;
  82382. var topPadding = (outputHeight - matrixHeight * multiple) / 2;
  82383. var output;
  82384. // remove padding if requested width and height are too small
  82385. if (reqHeight < matrixHeight || reqWidth < matrixWidth) {
  82386. leftPadding = 0;
  82387. topPadding = 0;
  82388. output = new _BitMatrix.default(matrixWidth, matrixHeight);
  82389. } else {
  82390. output = new _BitMatrix.default(reqWidth, reqHeight);
  82391. }
  82392. output.clear();
  82393. for (var inputY = 0, outputY = topPadding; inputY < matrixHeight; inputY++, outputY += multiple) {
  82394. // Write the contents of this row of the bytematrix
  82395. for (var inputX = 0, outputX = leftPadding; inputX < matrixWidth; inputX++, outputX += multiple) {
  82396. if (matrix.get(inputX, inputY) === 1) {
  82397. output.setRegion(outputX, outputY, multiple, multiple);
  82398. }
  82399. }
  82400. }
  82401. return output;
  82402. };
  82403. return DataMatrixWriter;
  82404. }();
  82405. var _default = DataMatrixWriter;
  82406. exports.default = _default;
  82407. /***/ }),
  82408. /* 492 */
  82409. /*!********************************************************************************************!*\
  82410. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/index.js ***!
  82411. \********************************************************************************************/
  82412. /*! no static exports found */
  82413. /***/ (function(module, exports, __webpack_require__) {
  82414. "use strict";
  82415. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  82416. Object.defineProperty(exports, "__esModule", {
  82417. value: true
  82418. });
  82419. Object.defineProperty(exports, "ASCIIEncoder", {
  82420. enumerable: true,
  82421. get: function get() {
  82422. return _ASCIIEncoder.ASCIIEncoder;
  82423. }
  82424. });
  82425. Object.defineProperty(exports, "Base256Encoder", {
  82426. enumerable: true,
  82427. get: function get() {
  82428. return _Base256Encoder.Base256Encoder;
  82429. }
  82430. });
  82431. Object.defineProperty(exports, "C40Encoder", {
  82432. enumerable: true,
  82433. get: function get() {
  82434. return _C40Encoder.C40Encoder;
  82435. }
  82436. });
  82437. Object.defineProperty(exports, "DefaultPlacement", {
  82438. enumerable: true,
  82439. get: function get() {
  82440. return _DefaultPlacement.default;
  82441. }
  82442. });
  82443. Object.defineProperty(exports, "EdifactEncoder", {
  82444. enumerable: true,
  82445. get: function get() {
  82446. return _EdifactEncoder.EdifactEncoder;
  82447. }
  82448. });
  82449. Object.defineProperty(exports, "EncoderContext", {
  82450. enumerable: true,
  82451. get: function get() {
  82452. return _EncoderContext.EncoderContext;
  82453. }
  82454. });
  82455. Object.defineProperty(exports, "ErrorCorrection", {
  82456. enumerable: true,
  82457. get: function get() {
  82458. return _ErrorCorrection.default;
  82459. }
  82460. });
  82461. Object.defineProperty(exports, "HighLevelEncoder", {
  82462. enumerable: true,
  82463. get: function get() {
  82464. return _HighLevelEncoder.default;
  82465. }
  82466. });
  82467. Object.defineProperty(exports, "MinimalEncoder", {
  82468. enumerable: true,
  82469. get: function get() {
  82470. return _MinimalEncoder.MinimalEncoder;
  82471. }
  82472. });
  82473. Object.defineProperty(exports, "SymbolInfo", {
  82474. enumerable: true,
  82475. get: function get() {
  82476. return _SymbolInfo.default;
  82477. }
  82478. });
  82479. Object.defineProperty(exports, "TextEncoder", {
  82480. enumerable: true,
  82481. get: function get() {
  82482. return _TextEncoder.TextEncoder;
  82483. }
  82484. });
  82485. Object.defineProperty(exports, "X12Encoder", {
  82486. enumerable: true,
  82487. get: function get() {
  82488. return _X12Encoder.X12Encoder;
  82489. }
  82490. });
  82491. var _ASCIIEncoder = __webpack_require__(/*! ./ASCIIEncoder */ 483);
  82492. var _Base256Encoder = __webpack_require__(/*! ./Base256Encoder */ 484);
  82493. var _C40Encoder = __webpack_require__(/*! ./C40Encoder */ 485);
  82494. var _DefaultPlacement = _interopRequireDefault(__webpack_require__(/*! ./DefaultPlacement */ 479));
  82495. var _EdifactEncoder = __webpack_require__(/*! ./EdifactEncoder */ 486);
  82496. var _EncoderContext = __webpack_require__(/*! ./EncoderContext */ 487);
  82497. var _ErrorCorrection = _interopRequireDefault(__webpack_require__(/*! ./ErrorCorrection */ 480));
  82498. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  82499. var _MinimalEncoder = __webpack_require__(/*! ./MinimalEncoder */ 493);
  82500. var _SymbolInfo = _interopRequireDefault(__webpack_require__(/*! ./SymbolInfo */ 488));
  82501. var _TextEncoder = __webpack_require__(/*! ./TextEncoder */ 490);
  82502. var _X12Encoder = __webpack_require__(/*! ./X12Encoder */ 489);
  82503. /***/ }),
  82504. /* 493 */
  82505. /*!*****************************************************************************************************!*\
  82506. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/datamatrix/encoder/MinimalEncoder.js ***!
  82507. \*****************************************************************************************************/
  82508. /*! no static exports found */
  82509. /***/ (function(module, exports, __webpack_require__) {
  82510. "use strict";
  82511. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  82512. Object.defineProperty(exports, "__esModule", {
  82513. value: true
  82514. });
  82515. exports.MinimalEncoder = void 0;
  82516. var _constants = __webpack_require__(/*! ./constants */ 481);
  82517. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 482));
  82518. var _MinimalECIInput = __webpack_require__(/*! ../../common/MinimalECIInput */ 494);
  82519. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  82520. var __extends = void 0 && (void 0).__extends || function () {
  82521. var _extendStatics = function extendStatics(d, b) {
  82522. _extendStatics = Object.setPrototypeOf || {
  82523. __proto__: []
  82524. } instanceof Array && function (d, b) {
  82525. d.__proto__ = b;
  82526. } || function (d, b) {
  82527. for (var p in b) {
  82528. if (b.hasOwnProperty(p)) d[p] = b[p];
  82529. }
  82530. };
  82531. return _extendStatics(d, b);
  82532. };
  82533. return function (d, b) {
  82534. _extendStatics(d, b);
  82535. function __() {
  82536. this.constructor = d;
  82537. }
  82538. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  82539. };
  82540. }();
  82541. var __values = void 0 && (void 0).__values || function (o) {
  82542. var s = typeof Symbol === "function" && Symbol.iterator,
  82543. m = s && o[s],
  82544. i = 0;
  82545. if (m) return m.call(o);
  82546. if (o && typeof o.length === "number") return {
  82547. next: function next() {
  82548. if (o && i >= o.length) o = void 0;
  82549. return {
  82550. value: o && o[i++],
  82551. done: !o
  82552. };
  82553. }
  82554. };
  82555. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  82556. };
  82557. var __read = void 0 && (void 0).__read || function (o, n) {
  82558. var m = typeof Symbol === "function" && o[Symbol.iterator];
  82559. if (!m) return o;
  82560. var i = m.call(o),
  82561. r,
  82562. ar = [],
  82563. e;
  82564. try {
  82565. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
  82566. ar.push(r.value);
  82567. }
  82568. } catch (error) {
  82569. e = {
  82570. error: error
  82571. };
  82572. } finally {
  82573. try {
  82574. if (r && !r.done && (m = i["return"])) m.call(i);
  82575. } finally {
  82576. if (e) throw e.error;
  82577. }
  82578. }
  82579. return ar;
  82580. };
  82581. var __spread = void 0 && (void 0).__spread || function () {
  82582. for (var ar = [], i = 0; i < arguments.length; i++) {
  82583. ar = ar.concat(__read(arguments[i]));
  82584. }
  82585. return ar;
  82586. };
  82587. var Mode;
  82588. (function (Mode) {
  82589. Mode[Mode["ASCII"] = 0] = "ASCII";
  82590. Mode[Mode["C40"] = 1] = "C40";
  82591. Mode[Mode["TEXT"] = 2] = "TEXT";
  82592. Mode[Mode["X12"] = 3] = "X12";
  82593. Mode[Mode["EDF"] = 4] = "EDF";
  82594. Mode[Mode["B256"] = 5] = "B256";
  82595. })(Mode || (Mode = {}));
  82596. var C40_SHIFT2_CHARS = ['!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_'];
  82597. var MinimalEncoder = /** @class */function () {
  82598. function MinimalEncoder() {}
  82599. MinimalEncoder.isExtendedASCII = function (ch, fnc1) {
  82600. return ch !== fnc1 && ch >= 128 && ch <= 255;
  82601. };
  82602. MinimalEncoder.isInC40Shift1Set = function (ch) {
  82603. return ch <= 31;
  82604. };
  82605. MinimalEncoder.isInC40Shift2Set = function (ch, fnc1) {
  82606. var e_1, _a;
  82607. try {
  82608. for (var C40_SHIFT2_CHARS_1 = __values(C40_SHIFT2_CHARS), C40_SHIFT2_CHARS_1_1 = C40_SHIFT2_CHARS_1.next(); !C40_SHIFT2_CHARS_1_1.done; C40_SHIFT2_CHARS_1_1 = C40_SHIFT2_CHARS_1.next()) {
  82609. var c40Shift2Char = C40_SHIFT2_CHARS_1_1.value;
  82610. if (c40Shift2Char.charCodeAt(0) === ch) {
  82611. return true;
  82612. }
  82613. }
  82614. } catch (e_1_1) {
  82615. e_1 = {
  82616. error: e_1_1
  82617. };
  82618. } finally {
  82619. try {
  82620. if (C40_SHIFT2_CHARS_1_1 && !C40_SHIFT2_CHARS_1_1.done && (_a = C40_SHIFT2_CHARS_1.return)) _a.call(C40_SHIFT2_CHARS_1);
  82621. } finally {
  82622. if (e_1) throw e_1.error;
  82623. }
  82624. }
  82625. return ch === fnc1;
  82626. };
  82627. MinimalEncoder.isInTextShift1Set = function (ch) {
  82628. return this.isInC40Shift1Set(ch);
  82629. };
  82630. MinimalEncoder.isInTextShift2Set = function (ch, fnc1) {
  82631. return this.isInC40Shift2Set(ch, fnc1);
  82632. };
  82633. /**
  82634. * Performs message encoding of a DataMatrix message
  82635. *
  82636. * @param msg the message
  82637. * @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
  82638. * chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
  82639. * charset to encode any character in the input that can be encoded by it if the charset is among the
  82640. * supported charsets.
  82641. * @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1
  82642. * bar code. If the value is not -1 then a FNC1 is also prepended.
  82643. * @param shape requested shape.
  82644. * @return the encoded message (the char values range from 0 to 255)
  82645. */
  82646. MinimalEncoder.encodeHighLevel = function (msg, priorityCharset, fnc1, shape) {
  82647. if (priorityCharset === void 0) {
  82648. priorityCharset = null;
  82649. }
  82650. if (fnc1 === void 0) {
  82651. fnc1 = -1;
  82652. }
  82653. if (shape === void 0) {
  82654. shape = 0 /* FORCE_NONE */;
  82655. }
  82656. var macroId = 0;
  82657. if (msg.startsWith(_constants.MACRO_05_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
  82658. macroId = 5;
  82659. msg = msg.substring(_constants.MACRO_05_HEADER.length, msg.length - 2);
  82660. } else if (msg.startsWith(_constants.MACRO_06_HEADER) && msg.endsWith(_constants.MACRO_TRAILER)) {
  82661. macroId = 6;
  82662. msg = msg.substring(_constants.MACRO_06_HEADER.length, msg.length - 2);
  82663. }
  82664. return decodeURIComponent(escape(String.fromCharCode.apply(String, __spread(this.encode(msg, priorityCharset, fnc1, shape, macroId)))));
  82665. };
  82666. /**
  82667. * Encodes input minimally and returns an array of the codewords
  82668. *
  82669. * @param input The string to encode
  82670. * @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
  82671. * chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
  82672. * charset to encode any character in the input that can be encoded by it if the charset is among the
  82673. * supported charsets.
  82674. * @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1
  82675. * bar code. If the value is not -1 then a FNC1 is also prepended.
  82676. * @param shape requested shape.
  82677. * @param macroId Prepends the specified macro function in case that a value of 5 or 6 is specified.
  82678. * @return An array of bytes representing the codewords of a minimal encoding.
  82679. */
  82680. MinimalEncoder.encode = function (input, priorityCharset, fnc1, shape, macroId) {
  82681. return this.encodeMinimally(new Input(input, priorityCharset, fnc1, shape, macroId)).getBytes();
  82682. };
  82683. MinimalEncoder.addEdge = function (edges, edge) {
  82684. var vertexIndex = edge.fromPosition + edge.characterLength;
  82685. if (edges[vertexIndex][edge.getEndMode()] === null || edges[vertexIndex][edge.getEndMode()].cachedTotalSize > edge.cachedTotalSize) {
  82686. edges[vertexIndex][edge.getEndMode()] = edge;
  82687. }
  82688. };
  82689. /** @return the number of words in which the string starting at from can be encoded in c40 or text mode.
  82690. * The number of characters encoded is returned in characterLength.
  82691. * The number of characters encoded is also minimal in the sense that the algorithm stops as soon
  82692. * as a character encoding fills a C40 word competely (three C40 values). An exception is at the
  82693. * end of the string where two C40 values are allowed (according to the spec the third c40 value
  82694. * is filled with 0 (Shift 1) in this case).
  82695. */
  82696. MinimalEncoder.getNumberOfC40Words = function (input, from, c40, characterLength) {
  82697. var thirdsCount = 0;
  82698. for (var i = from; i < input.length(); i++) {
  82699. if (input.isECI(i)) {
  82700. characterLength[0] = 0;
  82701. return 0;
  82702. }
  82703. var ci = input.charAt(i);
  82704. if (c40 && _HighLevelEncoder.default.isNativeC40(ci) || !c40 && _HighLevelEncoder.default.isNativeText(ci)) {
  82705. thirdsCount++; // native
  82706. } else if (!MinimalEncoder.isExtendedASCII(ci, input.getFNC1Character())) {
  82707. thirdsCount += 2; // shift
  82708. } else {
  82709. var asciiValue = ci & 0xff;
  82710. if (asciiValue >= 128 && (c40 && _HighLevelEncoder.default.isNativeC40(asciiValue - 128) || !c40 && _HighLevelEncoder.default.isNativeText(asciiValue - 128))) {
  82711. thirdsCount += 3; // shift, Upper shift
  82712. } else {
  82713. thirdsCount += 4; // shift, Upper shift, shift
  82714. }
  82715. }
  82716. if (thirdsCount % 3 === 0 || (thirdsCount - 2) % 3 === 0 && i + 1 === input.length()) {
  82717. characterLength[0] = i - from + 1;
  82718. return Math.ceil(thirdsCount / 3.0);
  82719. }
  82720. }
  82721. characterLength[0] = 0;
  82722. return 0;
  82723. };
  82724. MinimalEncoder.addEdges = function (input, edges, from, previous) {
  82725. var e_2, _a;
  82726. if (input.isECI(from)) {
  82727. this.addEdge(edges, new Edge(input, Mode.ASCII, from, 1, previous));
  82728. return;
  82729. }
  82730. var ch = input.charAt(from);
  82731. if (previous === null || previous.getEndMode() !== Mode.EDF) {
  82732. // not possible to unlatch a full EDF edge to something
  82733. // else
  82734. if (_HighLevelEncoder.default.isDigit(ch) && input.haveNCharacters(from, 2) && _HighLevelEncoder.default.isDigit(input.charAt(from + 1))) {
  82735. // two digits ASCII encoded
  82736. this.addEdge(edges, new Edge(input, Mode.ASCII, from, 2, previous));
  82737. } else {
  82738. // one ASCII encoded character or an extended character via Upper Shift
  82739. this.addEdge(edges, new Edge(input, Mode.ASCII, from, 1, previous));
  82740. }
  82741. var modes = [Mode.C40, Mode.TEXT];
  82742. try {
  82743. for (var modes_1 = __values(modes), modes_1_1 = modes_1.next(); !modes_1_1.done; modes_1_1 = modes_1.next()) {
  82744. var mode = modes_1_1.value;
  82745. var characterLength = [];
  82746. if (MinimalEncoder.getNumberOfC40Words(input, from, mode === Mode.C40, characterLength) > 0) {
  82747. this.addEdge(edges, new Edge(input, mode, from, characterLength[0], previous));
  82748. }
  82749. }
  82750. } catch (e_2_1) {
  82751. e_2 = {
  82752. error: e_2_1
  82753. };
  82754. } finally {
  82755. try {
  82756. if (modes_1_1 && !modes_1_1.done && (_a = modes_1.return)) _a.call(modes_1);
  82757. } finally {
  82758. if (e_2) throw e_2.error;
  82759. }
  82760. }
  82761. if (input.haveNCharacters(from, 3) && _HighLevelEncoder.default.isNativeX12(input.charAt(from)) && _HighLevelEncoder.default.isNativeX12(input.charAt(from + 1)) && _HighLevelEncoder.default.isNativeX12(input.charAt(from + 2))) {
  82762. this.addEdge(edges, new Edge(input, Mode.X12, from, 3, previous));
  82763. }
  82764. this.addEdge(edges, new Edge(input, Mode.B256, from, 1, previous));
  82765. }
  82766. // We create 4 EDF edges, with 1, 2 3 or 4 characters length. The fourth normally doesn't have a latch to ASCII
  82767. // unless it is 2 characters away from the end of the input.
  82768. var i;
  82769. for (i = 0; i < 3; i++) {
  82770. var pos = from + i;
  82771. if (input.haveNCharacters(pos, 1) && _HighLevelEncoder.default.isNativeEDIFACT(input.charAt(pos))) {
  82772. this.addEdge(edges, new Edge(input, Mode.EDF, from, i + 1, previous));
  82773. } else {
  82774. break;
  82775. }
  82776. }
  82777. if (i === 3 && input.haveNCharacters(from, 4) && _HighLevelEncoder.default.isNativeEDIFACT(input.charAt(from + 3))) {
  82778. this.addEdge(edges, new Edge(input, Mode.EDF, from, 4, previous));
  82779. }
  82780. };
  82781. MinimalEncoder.encodeMinimally = function (input) {
  82782. /* The minimal encoding is computed by Dijkstra. The acyclic graph is modeled as follows:
  82783. * A vertex represents a combination of a position in the input and an encoding mode where position 0
  82784. * denotes the position left of the first character, 1 the position left of the second character and so on.
  82785. * Likewise the end vertices are located after the last character at position input.length().
  82786. * For any position there might be up to six vertices, one for each of the encoding types ASCII, C40, TEXT, X12,
  82787. * EDF and B256.
  82788. *
  82789. * As an example consider the input string "ABC123" then at position 0 there is only one vertex with the default
  82790. * ASCII encodation. At position 3 there might be vertices for the types ASCII, C40, X12, EDF and B256.
  82791. *
  82792. * An edge leading to such a vertex encodes one or more of the characters left of the position that the vertex
  82793. * represents. It encodes the characters in the encoding mode of the vertex that it ends on. In other words,
  82794. * all edges leading to a particular vertex encode the same characters (the length of the suffix can vary) using the same
  82795. * encoding mode.
  82796. * As an example consider the input string "ABC123" and the vertex (4,EDF). Possible edges leading to this vertex
  82797. * are:
  82798. * (0,ASCII) --EDF(ABC1)--> (4,EDF)
  82799. * (1,ASCII) --EDF(BC1)--> (4,EDF)
  82800. * (1,B256) --EDF(BC1)--> (4,EDF)
  82801. * (1,EDF) --EDF(BC1)--> (4,EDF)
  82802. * (2,ASCII) --EDF(C1)--> (4,EDF)
  82803. * (2,B256) --EDF(C1)--> (4,EDF)
  82804. * (2,EDF) --EDF(C1)--> (4,EDF)
  82805. * (3,ASCII) --EDF(1)--> (4,EDF)
  82806. * (3,B256) --EDF(1)--> (4,EDF)
  82807. * (3,EDF) --EDF(1)--> (4,EDF)
  82808. * (3,C40) --EDF(1)--> (4,EDF)
  82809. * (3,X12) --EDF(1)--> (4,EDF)
  82810. *
  82811. * The edges leading to a vertex are stored in such a way that there is a fast way to enumerate the edges ending
  82812. * on a particular vertex.
  82813. *
  82814. * The algorithm processes the vertices in order of their position thereby performing the following:
  82815. *
  82816. * For every vertex at position i the algorithm enumerates the edges ending on the vertex and removes all but the
  82817. * shortest from that list.
  82818. * Then it processes the vertices for the position i+1. If i+1 == input.length() then the algorithm ends
  82819. * and chooses the the edge with the smallest size from any of the edges leading to vertices at this position.
  82820. * Otherwise the algorithm computes all possible outgoing edges for the vertices at the position i+1
  82821. *
  82822. * Examples:
  82823. * The process is illustrated by showing the graph (edges) after each iteration from left to right over the input:
  82824. * An edge is drawn as follows "(" + fromVertex + ") -- " + encodingMode + "(" + encodedInput + ") (" +
  82825. * accumulatedSize + ") --> (" + toVertex + ")"
  82826. *
  82827. * Example 1 encoding the string "ABCDEFG":
  82828. *
  82829. *
  82830. * Situation after adding edges to the start vertex (0,ASCII)
  82831. * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
  82832. * (0,ASCII) B256(A) (3) --> (1,B256)
  82833. * (0,ASCII) EDF(AB) (4) --> (2,EDF)
  82834. * (0,ASCII) C40(ABC) (3) --> (3,C40)
  82835. * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
  82836. * (0,ASCII) X12(ABC) (3) --> (3,X12)
  82837. * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
  82838. * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
  82839. *
  82840. * Situation after adding edges to vertices at position 1
  82841. * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
  82842. * (0,ASCII) B256(A) (3) --> (1,B256)
  82843. * (0,ASCII) EDF(AB) (4) --> (2,EDF)
  82844. * (0,ASCII) C40(ABC) (3) --> (3,C40)
  82845. * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
  82846. * (0,ASCII) X12(ABC) (3) --> (3,X12)
  82847. * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
  82848. * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
  82849. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII)
  82850. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) B256(B) (4) --> (2,B256)
  82851. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BC) (5) --> (3,EDF)
  82852. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40)
  82853. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) TEXT(BCD) (6) --> (4,TEXT)
  82854. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12)
  82855. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCD) (5) --> (4,EDF)
  82856. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCDE) (5) --> (5,EDF)
  82857. * (0,ASCII) B256(A) (3) --> (1,B256) ASCII(B) (4) --> (2,ASCII)
  82858. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256)
  82859. * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BC) (6) --> (3,EDF)
  82860. * (0,ASCII) B256(A) (3) --> (1,B256) C40(BCD) (5) --> (4,C40)
  82861. * (0,ASCII) B256(A) (3) --> (1,B256) TEXT(BCD) (7) --> (4,TEXT)
  82862. * (0,ASCII) B256(A) (3) --> (1,B256) X12(BCD) (5) --> (4,X12)
  82863. * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCD) (6) --> (4,EDF)
  82864. * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCDE) (6) --> (5,EDF)
  82865. *
  82866. * Edge "(1,ASCII) ASCII(B) (2) --> (2,ASCII)" is minimal for the vertex (2,ASCII) so that edge "(1,B256) ASCII(B) (4) --> (2,ASCII)" is removed.
  82867. * Edge "(1,B256) B256(B) (3) --> (2,B256)" is minimal for the vertext (2,B256) so that the edge "(1,ASCII) B256(B) (4) --> (2,B256)" is removed.
  82868. *
  82869. * Situation after adding edges to vertices at position 2
  82870. * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
  82871. * (0,ASCII) B256(A) (3) --> (1,B256)
  82872. * (0,ASCII) EDF(AB) (4) --> (2,EDF)
  82873. * (0,ASCII) C40(ABC) (3) --> (3,C40)
  82874. * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
  82875. * (0,ASCII) X12(ABC) (3) --> (3,X12)
  82876. * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
  82877. * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
  82878. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII)
  82879. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BC) (5) --> (3,EDF)
  82880. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40)
  82881. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) TEXT(BCD) (6) --> (4,TEXT)
  82882. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12)
  82883. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCD) (5) --> (4,EDF)
  82884. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCDE) (5) --> (5,EDF)
  82885. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256)
  82886. * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BC) (6) --> (3,EDF)
  82887. * (0,ASCII) B256(A) (3) --> (1,B256) C40(BCD) (5) --> (4,C40)
  82888. * (0,ASCII) B256(A) (3) --> (1,B256) TEXT(BCD) (7) --> (4,TEXT)
  82889. * (0,ASCII) B256(A) (3) --> (1,B256) X12(BCD) (5) --> (4,X12)
  82890. * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCD) (6) --> (4,EDF)
  82891. * (0,ASCII) B256(A) (3) --> (1,B256) EDF(BCDE) (6) --> (5,EDF)
  82892. * (0,ASCII) EDF(AB) (4) --> (2,EDF) ASCII(C) (5) --> (3,ASCII)
  82893. * (0,ASCII) EDF(AB) (4) --> (2,EDF) B256(C) (6) --> (3,B256)
  82894. * (0,ASCII) EDF(AB) (4) --> (2,EDF) EDF(CD) (7) --> (4,EDF)
  82895. * (0,ASCII) EDF(AB) (4) --> (2,EDF) C40(CDE) (6) --> (5,C40)
  82896. * (0,ASCII) EDF(AB) (4) --> (2,EDF) TEXT(CDE) (8) --> (5,TEXT)
  82897. * (0,ASCII) EDF(AB) (4) --> (2,EDF) X12(CDE) (6) --> (5,X12)
  82898. * (0,ASCII) EDF(AB) (4) --> (2,EDF) EDF(CDE) (7) --> (5,EDF)
  82899. * (0,ASCII) EDF(AB) (4) --> (2,EDF) EDF(CDEF) (7) --> (6,EDF)
  82900. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII)
  82901. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) B256(C) (5) --> (3,B256)
  82902. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CD) (6) --> (4,EDF)
  82903. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) C40(CDE) (5) --> (5,C40)
  82904. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) TEXT(CDE) (7) --> (5,TEXT)
  82905. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) X12(CDE) (5) --> (5,X12)
  82906. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CDE) (6) --> (5,EDF)
  82907. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CDEF) (6) --> (6,EDF)
  82908. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) ASCII(C) (4) --> (3,ASCII)
  82909. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256)
  82910. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CD) (6) --> (4,EDF)
  82911. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) C40(CDE) (5) --> (5,C40)
  82912. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) TEXT(CDE) (7) --> (5,TEXT)
  82913. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) X12(CDE) (5) --> (5,X12)
  82914. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDE) (6) --> (5,EDF)
  82915. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) EDF(CDEF) (6) --> (6,EDF)
  82916. *
  82917. * Edge "(2,ASCII) ASCII(C) (3) --> (3,ASCII)" is minimal for the vertex (3,ASCII) so that edges "(2,EDF) ASCII(C) (5) --> (3,ASCII)"
  82918. * and "(2,B256) ASCII(C) (4) --> (3,ASCII)" can be removed.
  82919. * Edge "(0,ASCII) EDF(ABC) (4) --> (3,EDF)" is minimal for the vertex (3,EDF) so that edges "(1,ASCII) EDF(BC) (5) --> (3,EDF)"
  82920. * and "(1,B256) EDF(BC) (6) --> (3,EDF)" can be removed.
  82921. * Edge "(2,B256) B256(C) (4) --> (3,B256)" is minimal for the vertex (3,B256) so that edges "(2,ASCII) B256(C) (5) --> (3,B256)"
  82922. * and "(2,EDF) B256(C) (6) --> (3,B256)" can be removed.
  82923. *
  82924. * This continues for vertices 3 thru 7
  82925. *
  82926. * Situation after adding edges to vertices at position 7
  82927. * (0,ASCII) ASCII(A) (1) --> (1,ASCII)
  82928. * (0,ASCII) B256(A) (3) --> (1,B256)
  82929. * (0,ASCII) EDF(AB) (4) --> (2,EDF)
  82930. * (0,ASCII) C40(ABC) (3) --> (3,C40)
  82931. * (0,ASCII) TEXT(ABC) (5) --> (3,TEXT)
  82932. * (0,ASCII) X12(ABC) (3) --> (3,X12)
  82933. * (0,ASCII) EDF(ABC) (4) --> (3,EDF)
  82934. * (0,ASCII) EDF(ABCD) (4) --> (4,EDF)
  82935. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII)
  82936. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40)
  82937. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) TEXT(BCD) (6) --> (4,TEXT)
  82938. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12)
  82939. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) EDF(BCDE) (5) --> (5,EDF)
  82940. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256)
  82941. * (0,ASCII) C40(ABC) (3) --> (3,C40) C40(DEF) (5) --> (6,C40)
  82942. * (0,ASCII) X12(ABC) (3) --> (3,X12) X12(DEF) (5) --> (6,X12)
  82943. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII)
  82944. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) C40(CDE) (5) --> (5,C40)
  82945. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) TEXT(CDE) (7) --> (5,TEXT)
  82946. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) X12(CDE) (5) --> (5,X12)
  82947. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) EDF(CDEF) (6) --> (6,EDF)
  82948. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) C40(BCD) (4) --> (4,C40) C40(EFG) (6) --> (7,C40) //Solution 1
  82949. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) X12(BCD) (4) --> (4,X12) X12(EFG) (6) --> (7,X12) //Solution 2
  82950. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256)
  82951. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII)
  82952. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) TEXT(DEF) (8) --> (6,TEXT)
  82953. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) EDF(DEFG) (7) --> (7,EDF)
  82954. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256)
  82955. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) ASCII(E) (5) --> (5,ASCII)
  82956. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) TEXT(EFG) (9) --> (7,TEXT)
  82957. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256) B256(E) (6) --> (5,B256)
  82958. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) ASCII(E) (5) --> (5,ASCII) ASCII(F) (6) --> (6,ASCII)
  82959. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256) B256(E) (6) --> (5,B256) B256(F) (7) --> (6,B256)
  82960. * (0,ASCII) ASCII(A) (1) --> (1,ASCII) ASCII(B) (2) --> (2,ASCII) ASCII(C) (3) --> (3,ASCII) ASCII(D) (4) --> (4,ASCII) ASCII(E) (5) --> (5,ASCII) ASCII(F) (6) --> (6,ASCII) ASCII(G) (7) --> (7,ASCII)
  82961. * (0,ASCII) B256(A) (3) --> (1,B256) B256(B) (3) --> (2,B256) B256(C) (4) --> (3,B256) B256(D) (5) --> (4,B256) B256(E) (6) --> (5,B256) B256(F) (7) --> (6,B256) B256(G) (8) --> (7,B256)
  82962. *
  82963. * Hence a minimal encoding of "ABCDEFG" is either ASCII(A),C40(BCDEFG) or ASCII(A), X12(BCDEFG) with a size of 5 bytes.
  82964. */
  82965. var inputLength = input.length();
  82966. // Array that represents vertices. There is a vertex for every character and mode.
  82967. // The last dimension in the array below encodes the 6 modes ASCII, C40, TEXT, X12, EDF and B256
  82968. var edges = Array(inputLength + 1).fill(null).map(function () {
  82969. return Array(6).fill(0);
  82970. });
  82971. this.addEdges(input, edges, 0, null);
  82972. for (var i = 1; i <= inputLength; i++) {
  82973. for (var j = 0; j < 6; j++) {
  82974. if (edges[i][j] !== null && i < inputLength) {
  82975. this.addEdges(input, edges, i, edges[i][j]);
  82976. }
  82977. }
  82978. // optimize memory by removing edges that have been passed.
  82979. for (var j = 0; j < 6; j++) {
  82980. edges[i - 1][j] = null;
  82981. }
  82982. }
  82983. var minimalJ = -1;
  82984. var minimalSize = _Integer.default.MAX_VALUE;
  82985. for (var j = 0; j < 6; j++) {
  82986. if (edges[inputLength][j] !== null) {
  82987. var edge = edges[inputLength][j];
  82988. var size = j >= 1 && j <= 3 ? edge.cachedTotalSize + 1 : edge.cachedTotalSize; // C40, TEXT and X12 need an
  82989. // extra unlatch at the end
  82990. if (size < minimalSize) {
  82991. minimalSize = size;
  82992. minimalJ = j;
  82993. }
  82994. }
  82995. }
  82996. if (minimalJ < 0) {
  82997. throw new Error('Failed to encode "' + input + '"');
  82998. }
  82999. return new Result(edges[inputLength][minimalJ]);
  83000. };
  83001. return MinimalEncoder;
  83002. }();
  83003. exports.MinimalEncoder = MinimalEncoder;
  83004. var Result = /** @class */function () {
  83005. function Result(solution) {
  83006. var input = solution.input;
  83007. var size = 0;
  83008. var bytesAL = [];
  83009. var randomizePostfixLength = [];
  83010. var randomizeLengths = [];
  83011. if ((solution.mode === Mode.C40 || solution.mode === Mode.TEXT || solution.mode === Mode.X12) && solution.getEndMode() !== Mode.ASCII) {
  83012. size += this.prepend(Edge.getBytes(254), bytesAL);
  83013. }
  83014. var current = solution;
  83015. while (current !== null) {
  83016. size += this.prepend(current.getDataBytes(), bytesAL);
  83017. if (current.previous === null || current.getPreviousStartMode() !== current.getMode()) {
  83018. if (current.getMode() === Mode.B256) {
  83019. if (size <= 249) {
  83020. bytesAL.unshift(size);
  83021. size++;
  83022. } else {
  83023. bytesAL.unshift(size % 250);
  83024. bytesAL.unshift(size / 250 + 249);
  83025. size += 2;
  83026. }
  83027. randomizePostfixLength.push(bytesAL.length);
  83028. randomizeLengths.push(size);
  83029. }
  83030. this.prepend(current.getLatchBytes(), bytesAL);
  83031. size = 0;
  83032. }
  83033. current = current.previous;
  83034. }
  83035. if (input.getMacroId() === 5) {
  83036. size += this.prepend(Edge.getBytes(236), bytesAL);
  83037. } else if (input.getMacroId() === 6) {
  83038. size += this.prepend(Edge.getBytes(237), bytesAL);
  83039. }
  83040. if (input.getFNC1Character() > 0) {
  83041. size += this.prepend(Edge.getBytes(232), bytesAL);
  83042. }
  83043. for (var i = 0; i < randomizePostfixLength.length; i++) {
  83044. this.applyRandomPattern(bytesAL, bytesAL.length - randomizePostfixLength[i], randomizeLengths[i]);
  83045. }
  83046. // add padding
  83047. var capacity = solution.getMinSymbolSize(bytesAL.length);
  83048. if (bytesAL.length < capacity) {
  83049. bytesAL.push(129);
  83050. }
  83051. while (bytesAL.length < capacity) {
  83052. bytesAL.push(this.randomize253State(bytesAL.length + 1));
  83053. }
  83054. this.bytes = new Uint8Array(bytesAL.length);
  83055. for (var i = 0; i < this.bytes.length; i++) {
  83056. this.bytes[i] = bytesAL[i];
  83057. }
  83058. }
  83059. Result.prototype.prepend = function (bytes, into) {
  83060. for (var i = bytes.length - 1; i >= 0; i--) {
  83061. into.unshift(bytes[i]);
  83062. }
  83063. return bytes.length;
  83064. };
  83065. Result.prototype.randomize253State = function (codewordPosition) {
  83066. var pseudoRandom = 149 * codewordPosition % 253 + 1;
  83067. var tempVariable = 129 + pseudoRandom;
  83068. return tempVariable <= 254 ? tempVariable : tempVariable - 254;
  83069. };
  83070. Result.prototype.applyRandomPattern = function (bytesAL, startPosition, length) {
  83071. for (var i = 0; i < length; i++) {
  83072. // See "B.1 253-state algorithm
  83073. var Pad_codeword_position = startPosition + i;
  83074. var Pad_codeword_value = bytesAL[Pad_codeword_position] & 0xff;
  83075. var pseudo_random_number = 149 * (Pad_codeword_position + 1) % 255 + 1;
  83076. var temp_variable = Pad_codeword_value + pseudo_random_number;
  83077. bytesAL[Pad_codeword_position] = temp_variable <= 255 ? temp_variable : temp_variable - 256;
  83078. }
  83079. };
  83080. Result.prototype.getBytes = function () {
  83081. return this.bytes;
  83082. };
  83083. return Result;
  83084. }();
  83085. var Edge = /** @class */function () {
  83086. function Edge(input, mode, fromPosition, characterLength, previous) {
  83087. this.input = input;
  83088. this.mode = mode;
  83089. this.fromPosition = fromPosition;
  83090. this.characterLength = characterLength;
  83091. this.previous = previous;
  83092. this.allCodewordCapacities = [3, 5, 8, 10, 12, 16, 18, 22, 30, 32, 36, 44, 49, 62, 86, 114, 144, 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558];
  83093. this.squareCodewordCapacities = [3, 5, 8, 12, 18, 22, 30, 36, 44, 62, 86, 114, 144, 174, 204, 280, 368, 456, 576, 696, 816, 1050, 1304, 1558];
  83094. this.rectangularCodewordCapacities = [5, 10, 16, 33, 32, 49];
  83095. if (!(fromPosition + characterLength <= input.length())) {
  83096. throw new Error('Invalid edge');
  83097. }
  83098. var size = previous !== null ? previous.cachedTotalSize : 0;
  83099. var previousMode = this.getPreviousMode();
  83100. /*
  83101. * Switching modes
  83102. * ASCII -> C40: latch 230
  83103. * ASCII -> TEXT: latch 239
  83104. * ASCII -> X12: latch 238
  83105. * ASCII -> EDF: latch 240
  83106. * ASCII -> B256: latch 231
  83107. * C40 -> ASCII: word(c1,c2,c3), 254
  83108. * TEXT -> ASCII: word(c1,c2,c3), 254
  83109. * X12 -> ASCII: word(c1,c2,c3), 254
  83110. * EDIFACT -> ASCII: Unlatch character,0,0,0 or c1,Unlatch character,0,0 or c1,c2,Unlatch character,0 or
  83111. * c1,c2,c3,Unlatch character
  83112. * B256 -> ASCII: without latch after n bytes
  83113. */
  83114. switch (mode) {
  83115. case Mode.ASCII:
  83116. size++;
  83117. if (input.isECI(fromPosition) || MinimalEncoder.isExtendedASCII(input.charAt(fromPosition), input.getFNC1Character())) {
  83118. size++;
  83119. }
  83120. if (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12) {
  83121. size++; // unlatch 254 to ASCII
  83122. }
  83123. break;
  83124. case Mode.B256:
  83125. size++;
  83126. if (previousMode !== Mode.B256) {
  83127. size++; // byte count
  83128. } else if (this.getB256Size() === 250) {
  83129. size++; // extra byte count
  83130. }
  83131. if (previousMode === Mode.ASCII) {
  83132. size++; // latch to B256
  83133. } else if (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12) {
  83134. size += 2; // unlatch to ASCII, latch to B256
  83135. }
  83136. break;
  83137. case Mode.C40:
  83138. case Mode.TEXT:
  83139. case Mode.X12:
  83140. if (mode === Mode.X12) {
  83141. size += 2;
  83142. } else {
  83143. var charLen = [];
  83144. size += MinimalEncoder.getNumberOfC40Words(input, fromPosition, mode === Mode.C40, charLen) * 2;
  83145. }
  83146. if (previousMode === Mode.ASCII || previousMode === Mode.B256) {
  83147. size++; // additional byte for latch from ASCII to this mode
  83148. } else if (previousMode !== mode && (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12)) {
  83149. size += 2; // unlatch 254 to ASCII followed by latch to this mode
  83150. }
  83151. break;
  83152. case Mode.EDF:
  83153. size += 3;
  83154. if (previousMode === Mode.ASCII || previousMode === Mode.B256) {
  83155. size++; // additional byte for latch from ASCII to this mode
  83156. } else if (previousMode === Mode.C40 || previousMode === Mode.TEXT || previousMode === Mode.X12) {
  83157. size += 2; // unlatch 254 to ASCII followed by latch to this mode
  83158. }
  83159. break;
  83160. }
  83161. this.cachedTotalSize = size;
  83162. }
  83163. // does not count beyond 250
  83164. Edge.prototype.getB256Size = function () {
  83165. var cnt = 0;
  83166. var current = this;
  83167. while (current !== null && current.mode === Mode.B256 && cnt <= 250) {
  83168. cnt++;
  83169. current = current.previous;
  83170. }
  83171. return cnt;
  83172. };
  83173. Edge.prototype.getPreviousStartMode = function () {
  83174. return this.previous === null ? Mode.ASCII : this.previous.mode;
  83175. };
  83176. Edge.prototype.getPreviousMode = function () {
  83177. return this.previous === null ? Mode.ASCII : this.previous.getEndMode();
  83178. };
  83179. /** Returns Mode.ASCII in case that:
  83180. * - Mode is EDIFACT and characterLength is less than 4 or the remaining characters can be encoded in at most 2
  83181. * ASCII bytes.
  83182. * - Mode is C40, TEXT or X12 and the remaining characters can be encoded in at most 1 ASCII byte.
  83183. * Returns mode in all other cases.
  83184. * */
  83185. Edge.prototype.getEndMode = function () {
  83186. if (this.mode === Mode.EDF) {
  83187. if (this.characterLength < 4) {
  83188. return Mode.ASCII;
  83189. }
  83190. var lastASCII = this.getLastASCII(); // see 5.2.8.2 EDIFACT encodation Rules
  83191. if (lastASCII > 0 && this.getCodewordsRemaining(this.cachedTotalSize + lastASCII) <= 2 - lastASCII) {
  83192. return Mode.ASCII;
  83193. }
  83194. }
  83195. if (this.mode === Mode.C40 || this.mode === Mode.TEXT || this.mode === Mode.X12) {
  83196. // see 5.2.5.2 C40 encodation rules and 5.2.7.2 ANSI X12 encodation rules
  83197. if (this.fromPosition + this.characterLength >= this.input.length() && this.getCodewordsRemaining(this.cachedTotalSize) === 0) {
  83198. return Mode.ASCII;
  83199. }
  83200. var lastASCII = this.getLastASCII();
  83201. if (lastASCII === 1 && this.getCodewordsRemaining(this.cachedTotalSize + 1) === 0) {
  83202. return Mode.ASCII;
  83203. }
  83204. }
  83205. return this.mode;
  83206. };
  83207. Edge.prototype.getMode = function () {
  83208. return this.mode;
  83209. };
  83210. /** Peeks ahead and returns 1 if the postfix consists of exactly two digits, 2 if the postfix consists of exactly
  83211. * two consecutive digits and a non extended character or of 4 digits.
  83212. * Returns 0 in any other case
  83213. **/
  83214. Edge.prototype.getLastASCII = function () {
  83215. var length = this.input.length();
  83216. var from = this.fromPosition + this.characterLength;
  83217. if (length - from > 4 || from >= length) {
  83218. return 0;
  83219. }
  83220. if (length - from === 1) {
  83221. if (MinimalEncoder.isExtendedASCII(this.input.charAt(from), this.input.getFNC1Character())) {
  83222. return 0;
  83223. }
  83224. return 1;
  83225. }
  83226. if (length - from === 2) {
  83227. if (MinimalEncoder.isExtendedASCII(this.input.charAt(from), this.input.getFNC1Character()) || MinimalEncoder.isExtendedASCII(this.input.charAt(from + 1), this.input.getFNC1Character())) {
  83228. return 0;
  83229. }
  83230. if (_HighLevelEncoder.default.isDigit(this.input.charAt(from)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 1))) {
  83231. return 1;
  83232. }
  83233. return 2;
  83234. }
  83235. if (length - from === 3) {
  83236. if (_HighLevelEncoder.default.isDigit(this.input.charAt(from)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 1)) && !MinimalEncoder.isExtendedASCII(this.input.charAt(from + 2), this.input.getFNC1Character())) {
  83237. return 2;
  83238. }
  83239. if (_HighLevelEncoder.default.isDigit(this.input.charAt(from + 1)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 2)) && !MinimalEncoder.isExtendedASCII(this.input.charAt(from), this.input.getFNC1Character())) {
  83240. return 2;
  83241. }
  83242. return 0;
  83243. }
  83244. if (_HighLevelEncoder.default.isDigit(this.input.charAt(from)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 1)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 2)) && _HighLevelEncoder.default.isDigit(this.input.charAt(from + 3))) {
  83245. return 2;
  83246. }
  83247. return 0;
  83248. };
  83249. /** Returns the capacity in codewords of the smallest symbol that has enough capacity to fit the given minimal
  83250. * number of codewords.
  83251. **/
  83252. Edge.prototype.getMinSymbolSize = function (minimum) {
  83253. var e_3, _a, e_4, _b, e_5, _c;
  83254. switch (this.input.getShapeHint()) {
  83255. case 1 /* FORCE_SQUARE */:
  83256. try {
  83257. for (var _d = __values(this.squareCodewordCapacities), _e = _d.next(); !_e.done; _e = _d.next()) {
  83258. var capacity = _e.value;
  83259. if (capacity >= minimum) {
  83260. return capacity;
  83261. }
  83262. }
  83263. } catch (e_3_1) {
  83264. e_3 = {
  83265. error: e_3_1
  83266. };
  83267. } finally {
  83268. try {
  83269. if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
  83270. } finally {
  83271. if (e_3) throw e_3.error;
  83272. }
  83273. }
  83274. break;
  83275. case 2 /* FORCE_RECTANGLE */:
  83276. try {
  83277. for (var _f = __values(this.rectangularCodewordCapacities), _g = _f.next(); !_g.done; _g = _f.next()) {
  83278. var capacity = _g.value;
  83279. if (capacity >= minimum) {
  83280. return capacity;
  83281. }
  83282. }
  83283. } catch (e_4_1) {
  83284. e_4 = {
  83285. error: e_4_1
  83286. };
  83287. } finally {
  83288. try {
  83289. if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
  83290. } finally {
  83291. if (e_4) throw e_4.error;
  83292. }
  83293. }
  83294. break;
  83295. }
  83296. try {
  83297. for (var _h = __values(this.allCodewordCapacities), _j = _h.next(); !_j.done; _j = _h.next()) {
  83298. var capacity = _j.value;
  83299. if (capacity >= minimum) {
  83300. return capacity;
  83301. }
  83302. }
  83303. } catch (e_5_1) {
  83304. e_5 = {
  83305. error: e_5_1
  83306. };
  83307. } finally {
  83308. try {
  83309. if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
  83310. } finally {
  83311. if (e_5) throw e_5.error;
  83312. }
  83313. }
  83314. return this.allCodewordCapacities[this.allCodewordCapacities.length - 1];
  83315. };
  83316. /** Returns the remaining capacity in codewords of the smallest symbol that has enough capacity to fit the given
  83317. * minimal number of codewords.
  83318. **/
  83319. Edge.prototype.getCodewordsRemaining = function (minimum) {
  83320. return this.getMinSymbolSize(minimum) - minimum;
  83321. };
  83322. Edge.getBytes = function (c1, c2) {
  83323. var result = new Uint8Array(c2 ? 2 : 1);
  83324. result[0] = c1;
  83325. if (c2) {
  83326. result[1] = c2;
  83327. }
  83328. return result;
  83329. };
  83330. Edge.prototype.setC40Word = function (bytes, offset, c1, c2, c3) {
  83331. var val16 = 1600 * (c1 & 0xff) + 40 * (c2 & 0xff) + (c3 & 0xff) + 1;
  83332. bytes[offset] = val16 / 256;
  83333. bytes[offset + 1] = val16 % 256;
  83334. };
  83335. Edge.prototype.getX12Value = function (c) {
  83336. return c === 13 ? 0 : c === 42 ? 1 : c === 62 ? 2 : c === 32 ? 3 : c >= 48 && c <= 57 ? c - 44 : c >= 65 && c <= 90 ? c - 51 : c;
  83337. };
  83338. Edge.prototype.getX12Words = function () {
  83339. if (!(this.characterLength % 3 === 0)) {
  83340. throw new Error('X12 words must be a multiple of 3');
  83341. }
  83342. var result = new Uint8Array(this.characterLength / 3 * 2);
  83343. for (var i = 0; i < result.length; i += 2) {
  83344. this.setC40Word(result, i, this.getX12Value(this.input.charAt(this.fromPosition + i / 2 * 3)), this.getX12Value(this.input.charAt(this.fromPosition + i / 2 * 3 + 1)), this.getX12Value(this.input.charAt(this.fromPosition + i / 2 * 3 + 2)));
  83345. }
  83346. return result;
  83347. };
  83348. Edge.prototype.getShiftValue = function (c, c40, fnc1) {
  83349. return c40 && MinimalEncoder.isInC40Shift1Set(c) || !c40 && MinimalEncoder.isInTextShift1Set(c) ? 0 : c40 && MinimalEncoder.isInC40Shift2Set(c, fnc1) || !c40 && MinimalEncoder.isInTextShift2Set(c, fnc1) ? 1 : 2;
  83350. };
  83351. Edge.prototype.getC40Value = function (c40, setIndex, c, fnc1) {
  83352. if (c === fnc1) {
  83353. if (!(setIndex === 2)) {
  83354. throw new Error('FNC1 cannot be used in C40 shift 2');
  83355. }
  83356. return 27;
  83357. }
  83358. if (c40) {
  83359. return c <= 31 ? c : c === 32 ? 3 : c <= 47 ? c - 33 : c <= 57 ? c - 44 : c <= 64 ? c - 43 : c <= 90 ? c - 51 : c <= 95 ? c - 69 : c <= 127 ? c - 96 : c;
  83360. } else {
  83361. return c === 0 ? 0 : setIndex === 0 && c <= 3 ? c - 1 // is this a bug in the spec?
  83362. : setIndex === 1 && c <= 31 ? c : c === 32 ? 3 : c >= 33 && c <= 47 ? c - 33 : c >= 48 && c <= 57 ? c - 44 : c >= 58 && c <= 64 ? c - 43 : c >= 65 && c <= 90 ? c - 64 : c >= 91 && c <= 95 ? c - 69 : c === 96 ? 0 : c >= 97 && c <= 122 ? c - 83 : c >= 123 && c <= 127 ? c - 96 : c;
  83363. }
  83364. };
  83365. Edge.prototype.getC40Words = function (c40, fnc1) {
  83366. var c40Values = [];
  83367. for (var i = 0; i < this.characterLength; i++) {
  83368. var ci = this.input.charAt(this.fromPosition + i);
  83369. if (c40 && _HighLevelEncoder.default.isNativeC40(ci) || !c40 && _HighLevelEncoder.default.isNativeText(ci)) {
  83370. c40Values.push(this.getC40Value(c40, 0, ci, fnc1));
  83371. } else if (!MinimalEncoder.isExtendedASCII(ci, fnc1)) {
  83372. var shiftValue = this.getShiftValue(ci, c40, fnc1);
  83373. c40Values.push(shiftValue); // Shift[123]
  83374. c40Values.push(this.getC40Value(c40, shiftValue, ci, fnc1));
  83375. } else {
  83376. var asciiValue = (ci & 0xff) - 128;
  83377. if (c40 && _HighLevelEncoder.default.isNativeC40(asciiValue) || !c40 && _HighLevelEncoder.default.isNativeText(asciiValue)) {
  83378. c40Values.push(1); // Shift 2
  83379. c40Values.push(30); // Upper Shift
  83380. c40Values.push(this.getC40Value(c40, 0, asciiValue, fnc1));
  83381. } else {
  83382. c40Values.push(1); // Shift 2
  83383. c40Values.push(30); // Upper Shift
  83384. var shiftValue = this.getShiftValue(asciiValue, c40, fnc1);
  83385. c40Values.push(shiftValue); // Shift[123]
  83386. c40Values.push(this.getC40Value(c40, shiftValue, asciiValue, fnc1));
  83387. }
  83388. }
  83389. }
  83390. if (c40Values.length % 3 !== 0) {
  83391. if (!((c40Values.length - 2) % 3 === 0 && this.fromPosition + this.characterLength === this.input.length())) {
  83392. throw new Error('C40 words must be a multiple of 3');
  83393. }
  83394. c40Values.push(0); // pad with 0 (Shift 1)
  83395. }
  83396. var result = new Uint8Array(c40Values.length / 3 * 2);
  83397. var byteIndex = 0;
  83398. for (var i = 0; i < c40Values.length; i += 3) {
  83399. this.setC40Word(result, byteIndex, c40Values[i] & 0xff, c40Values[i + 1] & 0xff, c40Values[i + 2] & 0xff);
  83400. byteIndex += 2;
  83401. }
  83402. return result;
  83403. };
  83404. Edge.prototype.getEDFBytes = function () {
  83405. var numberOfThirds = Math.ceil(this.characterLength / 4.0);
  83406. var result = new Uint8Array(numberOfThirds * 3);
  83407. var pos = this.fromPosition;
  83408. var endPos = Math.min(this.fromPosition + this.characterLength - 1, this.input.length() - 1);
  83409. for (var i = 0; i < numberOfThirds; i += 3) {
  83410. var edfValues = [];
  83411. for (var j = 0; j < 4; j++) {
  83412. if (pos <= endPos) {
  83413. edfValues[j] = this.input.charAt(pos++) & 0x3f;
  83414. } else {
  83415. edfValues[j] = pos === endPos + 1 ? 0x1f : 0;
  83416. }
  83417. }
  83418. var val24 = edfValues[0] << 18;
  83419. val24 |= edfValues[1] << 12;
  83420. val24 |= edfValues[2] << 6;
  83421. val24 |= edfValues[3];
  83422. result[i] = val24 >> 16 & 0xff;
  83423. result[i + 1] = val24 >> 8 & 0xff;
  83424. result[i + 2] = val24 & 0xff;
  83425. }
  83426. return result;
  83427. };
  83428. Edge.prototype.getLatchBytes = function () {
  83429. switch (this.getPreviousMode()) {
  83430. case Mode.ASCII:
  83431. case Mode.B256:
  83432. // after B256 ends (via length) we are back to ASCII
  83433. switch (this.mode) {
  83434. case Mode.B256:
  83435. return Edge.getBytes(231);
  83436. case Mode.C40:
  83437. return Edge.getBytes(230);
  83438. case Mode.TEXT:
  83439. return Edge.getBytes(239);
  83440. case Mode.X12:
  83441. return Edge.getBytes(238);
  83442. case Mode.EDF:
  83443. return Edge.getBytes(240);
  83444. }
  83445. break;
  83446. case Mode.C40:
  83447. case Mode.TEXT:
  83448. case Mode.X12:
  83449. if (this.mode !== this.getPreviousMode()) {
  83450. switch (this.mode) {
  83451. case Mode.ASCII:
  83452. return Edge.getBytes(254);
  83453. case Mode.B256:
  83454. return Edge.getBytes(254, 231);
  83455. case Mode.C40:
  83456. return Edge.getBytes(254, 230);
  83457. case Mode.TEXT:
  83458. return Edge.getBytes(254, 239);
  83459. case Mode.X12:
  83460. return Edge.getBytes(254, 238);
  83461. case Mode.EDF:
  83462. return Edge.getBytes(254, 240);
  83463. }
  83464. }
  83465. break;
  83466. case Mode.EDF:
  83467. // The rightmost EDIFACT edge always contains an unlatch character
  83468. if (this.mode !== Mode.EDF) {
  83469. throw new Error('Cannot switch from EDF to ' + this.mode);
  83470. }
  83471. break;
  83472. }
  83473. return new Uint8Array(0);
  83474. };
  83475. // Important: The function does not return the length bytes (one or two) in case of B256 encoding
  83476. Edge.prototype.getDataBytes = function () {
  83477. switch (this.mode) {
  83478. case Mode.ASCII:
  83479. if (this.input.isECI(this.fromPosition)) {
  83480. return Edge.getBytes(241, this.input.getECIValue(this.fromPosition) + 1);
  83481. } else if (MinimalEncoder.isExtendedASCII(this.input.charAt(this.fromPosition), this.input.getFNC1Character())) {
  83482. return Edge.getBytes(235, this.input.charAt(this.fromPosition) - 127);
  83483. } else if (this.characterLength === 2) {
  83484. return Edge.getBytes(this.input.charAt(this.fromPosition) * 10 + this.input.charAt(this.fromPosition + 1) + 130);
  83485. } else if (this.input.isFNC1(this.fromPosition)) {
  83486. return Edge.getBytes(232);
  83487. } else {
  83488. return Edge.getBytes(this.input.charAt(this.fromPosition) + 1);
  83489. }
  83490. case Mode.B256:
  83491. return Edge.getBytes(this.input.charAt(this.fromPosition));
  83492. case Mode.C40:
  83493. return this.getC40Words(true, this.input.getFNC1Character());
  83494. case Mode.TEXT:
  83495. return this.getC40Words(false, this.input.getFNC1Character());
  83496. case Mode.X12:
  83497. return this.getX12Words();
  83498. case Mode.EDF:
  83499. return this.getEDFBytes();
  83500. }
  83501. };
  83502. return Edge;
  83503. }();
  83504. var Input = /** @class */function (_super) {
  83505. __extends(Input, _super);
  83506. function Input(stringToEncode, priorityCharset, fnc1, shape, macroId) {
  83507. var _this = _super.call(this, stringToEncode, priorityCharset, fnc1) || this;
  83508. _this.shape = shape;
  83509. _this.macroId = macroId;
  83510. return _this;
  83511. }
  83512. Input.prototype.getMacroId = function () {
  83513. return this.macroId;
  83514. };
  83515. Input.prototype.getShapeHint = function () {
  83516. return this.shape;
  83517. };
  83518. return Input;
  83519. }(_MinimalECIInput.MinimalECIInput);
  83520. /***/ }),
  83521. /* 494 */
  83522. /*!******************************************************************************************!*\
  83523. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/MinimalECIInput.js ***!
  83524. \******************************************************************************************/
  83525. /*! no static exports found */
  83526. /***/ (function(module, exports, __webpack_require__) {
  83527. "use strict";
  83528. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  83529. Object.defineProperty(exports, "__esModule", {
  83530. value: true
  83531. });
  83532. exports.MinimalECIInput = void 0;
  83533. var _ECIEncoderSet = __webpack_require__(/*! ./ECIEncoderSet */ 495);
  83534. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
  83535. var _StringBuilder = _interopRequireDefault(__webpack_require__(/*! ../util/StringBuilder */ 320));
  83536. var COST_PER_ECI = 3; // approximated (latch + 2 codewords)
  83537. var MinimalECIInput = /** @class */function () {
  83538. /**
  83539. * Constructs a minimal input
  83540. *
  83541. * @param stringToEncode the character string to encode
  83542. * @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
  83543. * chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
  83544. * charset to encode any character in the input that can be encoded by it if the charset is among the
  83545. * supported charsets.
  83546. * @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not GS1
  83547. * input.
  83548. */
  83549. function MinimalECIInput(stringToEncode, priorityCharset, fnc1) {
  83550. this.fnc1 = fnc1;
  83551. var encoderSet = new _ECIEncoderSet.ECIEncoderSet(stringToEncode, priorityCharset, fnc1);
  83552. if (encoderSet.length() === 1) {
  83553. // optimization for the case when all can be encoded without ECI in ISO-8859-1
  83554. for (var i = 0; i < this.bytes.length; i++) {
  83555. var c = stringToEncode.charAt(i).charCodeAt(0);
  83556. this.bytes[i] = c === fnc1 ? 1000 : c;
  83557. }
  83558. } else {
  83559. this.bytes = this.encodeMinimally(stringToEncode, encoderSet, fnc1);
  83560. }
  83561. }
  83562. MinimalECIInput.prototype.getFNC1Character = function () {
  83563. return this.fnc1;
  83564. };
  83565. /**
  83566. * Returns the length of this input. The length is the number
  83567. * of {@code byte}s, FNC1 characters or ECIs in the sequence.
  83568. *
  83569. * @return the number of {@code char}s in this sequence
  83570. */
  83571. MinimalECIInput.prototype.length = function () {
  83572. return this.bytes.length;
  83573. };
  83574. MinimalECIInput.prototype.haveNCharacters = function (index, n) {
  83575. if (index + n - 1 >= this.bytes.length) {
  83576. return false;
  83577. }
  83578. for (var i = 0; i < n; i++) {
  83579. if (this.isECI(index + i)) {
  83580. return false;
  83581. }
  83582. }
  83583. return true;
  83584. };
  83585. /**
  83586. * Returns the {@code byte} value at the specified index. An index ranges from zero
  83587. * to {@code length() - 1}. The first {@code byte} value of the sequence is at
  83588. * index zero, the next at index one, and so on, as for array
  83589. * indexing.
  83590. *
  83591. * @param index the index of the {@code byte} value to be returned
  83592. *
  83593. * @return the specified {@code byte} value as character or the FNC1 character
  83594. *
  83595. * @throws IndexOutOfBoundsException
  83596. * if the {@code index} argument is negative or not less than
  83597. * {@code length()}
  83598. * @throws IllegalArgumentException
  83599. * if the value at the {@code index} argument is an ECI (@see #isECI)
  83600. */
  83601. MinimalECIInput.prototype.charAt = function (index) {
  83602. if (index < 0 || index >= this.length()) {
  83603. throw new Error('' + index);
  83604. }
  83605. if (this.isECI(index)) {
  83606. throw new Error('value at ' + index + ' is not a character but an ECI');
  83607. }
  83608. return this.isFNC1(index) ? this.fnc1 : this.bytes[index];
  83609. };
  83610. /**
  83611. * Returns a {@code CharSequence} that is a subsequence of this sequence.
  83612. * The subsequence starts with the {@code char} value at the specified index and
  83613. * ends with the {@code char} value at index {@code end - 1}. The length
  83614. * (in {@code char}s) of the
  83615. * returned sequence is {@code end - start}, so if {@code start == end}
  83616. * then an empty sequence is returned.
  83617. *
  83618. * @param start the start index, inclusive
  83619. * @param end the end index, exclusive
  83620. *
  83621. * @return the specified subsequence
  83622. *
  83623. * @throws IndexOutOfBoundsException
  83624. * if {@code start} or {@code end} are negative,
  83625. * if {@code end} is greater than {@code length()},
  83626. * or if {@code start} is greater than {@code end}
  83627. * @throws IllegalArgumentException
  83628. * if a value in the range {@code start}-{@code end} is an ECI (@see #isECI)
  83629. */
  83630. MinimalECIInput.prototype.subSequence = function (start, end) {
  83631. if (start < 0 || start > end || end > this.length()) {
  83632. throw new Error('' + start);
  83633. }
  83634. var result = new _StringBuilder.default();
  83635. for (var i = start; i < end; i++) {
  83636. if (this.isECI(i)) {
  83637. throw new Error('value at ' + i + ' is not a character but an ECI');
  83638. }
  83639. result.append(this.charAt(i));
  83640. }
  83641. return result.toString();
  83642. };
  83643. /**
  83644. * Determines if a value is an ECI
  83645. *
  83646. * @param index the index of the value
  83647. *
  83648. * @return true if the value at position {@code index} is an ECI
  83649. *
  83650. * @throws IndexOutOfBoundsException
  83651. * if the {@code index} argument is negative or not less than
  83652. * {@code length()}
  83653. */
  83654. MinimalECIInput.prototype.isECI = function (index) {
  83655. if (index < 0 || index >= this.length()) {
  83656. throw new Error('' + index);
  83657. }
  83658. return this.bytes[index] > 255 && this.bytes[index] <= 999;
  83659. };
  83660. /**
  83661. * Determines if a value is the FNC1 character
  83662. *
  83663. * @param index the index of the value
  83664. *
  83665. * @return true if the value at position {@code index} is the FNC1 character
  83666. *
  83667. * @throws IndexOutOfBoundsException
  83668. * if the {@code index} argument is negative or not less than
  83669. * {@code length()}
  83670. */
  83671. MinimalECIInput.prototype.isFNC1 = function (index) {
  83672. if (index < 0 || index >= this.length()) {
  83673. throw new Error('' + index);
  83674. }
  83675. return this.bytes[index] === 1000;
  83676. };
  83677. /**
  83678. * Returns the {@code int} ECI value at the specified index. An index ranges from zero
  83679. * to {@code length() - 1}. The first {@code byte} value of the sequence is at
  83680. * index zero, the next at index one, and so on, as for array
  83681. * indexing.
  83682. *
  83683. * @param index the index of the {@code int} value to be returned
  83684. *
  83685. * @return the specified {@code int} ECI value.
  83686. * The ECI specified the encoding of all bytes with a higher index until the
  83687. * next ECI or until the end of the input if no other ECI follows.
  83688. *
  83689. * @throws IndexOutOfBoundsException
  83690. * if the {@code index} argument is negative or not less than
  83691. * {@code length()}
  83692. * @throws IllegalArgumentException
  83693. * if the value at the {@code index} argument is not an ECI (@see #isECI)
  83694. */
  83695. MinimalECIInput.prototype.getECIValue = function (index) {
  83696. if (index < 0 || index >= this.length()) {
  83697. throw new Error('' + index);
  83698. }
  83699. if (!this.isECI(index)) {
  83700. throw new Error('value at ' + index + ' is not an ECI but a character');
  83701. }
  83702. return this.bytes[index] - 256;
  83703. };
  83704. MinimalECIInput.prototype.addEdge = function (edges, to, edge) {
  83705. if (edges[to][edge.encoderIndex] == null || edges[to][edge.encoderIndex].cachedTotalSize > edge.cachedTotalSize) {
  83706. edges[to][edge.encoderIndex] = edge;
  83707. }
  83708. };
  83709. MinimalECIInput.prototype.addEdges = function (stringToEncode, encoderSet, edges, from, previous, fnc1) {
  83710. var ch = stringToEncode.charAt(from).charCodeAt(0);
  83711. var start = 0;
  83712. var end = encoderSet.length();
  83713. if (encoderSet.getPriorityEncoderIndex() >= 0 && (ch === fnc1 || encoderSet.canEncode(ch, encoderSet.getPriorityEncoderIndex()))) {
  83714. start = encoderSet.getPriorityEncoderIndex();
  83715. end = start + 1;
  83716. }
  83717. for (var i = start; i < end; i++) {
  83718. if (ch === fnc1 || encoderSet.canEncode(ch, i)) {
  83719. this.addEdge(edges, from + 1, new InputEdge(ch, encoderSet, i, previous, fnc1));
  83720. }
  83721. }
  83722. };
  83723. MinimalECIInput.prototype.encodeMinimally = function (stringToEncode, encoderSet, fnc1) {
  83724. var inputLength = stringToEncode.length;
  83725. // Array that represents vertices. There is a vertex for every character and encoding.
  83726. var edges = new InputEdge[inputLength + 1][encoderSet.length()]();
  83727. this.addEdges(stringToEncode, encoderSet, edges, 0, null, fnc1);
  83728. for (var i = 1; i <= inputLength; i++) {
  83729. for (var j = 0; j < encoderSet.length(); j++) {
  83730. if (edges[i][j] != null && i < inputLength) {
  83731. this.addEdges(stringToEncode, encoderSet, edges, i, edges[i][j], fnc1);
  83732. }
  83733. }
  83734. // optimize memory by removing edges that have been passed.
  83735. for (var j = 0; j < encoderSet.length(); j++) {
  83736. edges[i - 1][j] = null;
  83737. }
  83738. }
  83739. var minimalJ = -1;
  83740. var minimalSize = _Integer.default.MAX_VALUE;
  83741. for (var j = 0; j < encoderSet.length(); j++) {
  83742. if (edges[inputLength][j] != null) {
  83743. var edge = edges[inputLength][j];
  83744. if (edge.cachedTotalSize < minimalSize) {
  83745. minimalSize = edge.cachedTotalSize;
  83746. minimalJ = j;
  83747. }
  83748. }
  83749. }
  83750. if (minimalJ < 0) {
  83751. throw new Error('Failed to encode "' + stringToEncode + '"');
  83752. }
  83753. var intsAL = [];
  83754. var current = edges[inputLength][minimalJ];
  83755. while (current != null) {
  83756. if (current.isFNC1()) {
  83757. intsAL.unshift(1000);
  83758. } else {
  83759. var bytes = encoderSet.encode(current.c, current.encoderIndex);
  83760. for (var i = bytes.length - 1; i >= 0; i--) {
  83761. intsAL.unshift(bytes[i] & 0xff);
  83762. }
  83763. }
  83764. var previousEncoderIndex = current.previous === null ? 0 : current.previous.encoderIndex;
  83765. if (previousEncoderIndex !== current.encoderIndex) {
  83766. intsAL.unshift(256 + encoderSet.getECIValue(current.encoderIndex));
  83767. }
  83768. current = current.previous;
  83769. }
  83770. var ints = [];
  83771. for (var i = 0; i < ints.length; i++) {
  83772. ints[i] = intsAL[i];
  83773. }
  83774. return ints;
  83775. };
  83776. return MinimalECIInput;
  83777. }();
  83778. exports.MinimalECIInput = MinimalECIInput;
  83779. var InputEdge = /** @class */function () {
  83780. function InputEdge(c, encoderSet, encoderIndex, previous, fnc1) {
  83781. this.c = c;
  83782. this.encoderSet = encoderSet;
  83783. this.encoderIndex = encoderIndex;
  83784. this.previous = previous;
  83785. this.fnc1 = fnc1;
  83786. this.c = c === fnc1 ? 1000 : c;
  83787. var size = this.isFNC1() ? 1 : encoderSet.encode(c, encoderIndex).length;
  83788. var previousEncoderIndex = previous === null ? 0 : previous.encoderIndex;
  83789. if (previousEncoderIndex !== encoderIndex) {
  83790. size += COST_PER_ECI;
  83791. }
  83792. if (previous != null) {
  83793. size += previous.cachedTotalSize;
  83794. }
  83795. this.cachedTotalSize = size;
  83796. }
  83797. InputEdge.prototype.isFNC1 = function () {
  83798. return this.c === 1000;
  83799. };
  83800. return InputEdge;
  83801. }();
  83802. /***/ }),
  83803. /* 495 */
  83804. /*!****************************************************************************************!*\
  83805. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/common/ECIEncoderSet.js ***!
  83806. \****************************************************************************************/
  83807. /*! no static exports found */
  83808. /***/ (function(module, exports, __webpack_require__) {
  83809. "use strict";
  83810. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  83811. Object.defineProperty(exports, "__esModule", {
  83812. value: true
  83813. });
  83814. exports.ECIEncoderSet = void 0;
  83815. var _Charset = _interopRequireDefault(__webpack_require__(/*! ../util/Charset */ 477));
  83816. var _StandardCharsets = _interopRequireDefault(__webpack_require__(/*! ../util/StandardCharsets */ 478));
  83817. var _StringEncoding = _interopRequireDefault(__webpack_require__(/*! ../util/StringEncoding */ 325));
  83818. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ./StringUtils */ 321));
  83819. /**
  83820. * Set of CharsetEncoders for a given input string
  83821. *
  83822. * Invariants:
  83823. * - The list contains only encoders from CharacterSetECI (list is shorter then the list of encoders available on
  83824. * the platform for which ECI values are defined).
  83825. * - The list contains encoders at least one encoder for every character in the input.
  83826. * - The first encoder in the list is always the ISO-8859-1 encoder even of no character in the input can be encoded
  83827. * by it.
  83828. * - If the input contains a character that is not in ISO-8859-1 then the last two entries in the list will be the
  83829. * UTF-8 encoder and the UTF-16BE encoder.
  83830. *
  83831. * @author Alex Geller
  83832. */
  83833. var __values = void 0 && (void 0).__values || function (o) {
  83834. var s = typeof Symbol === "function" && Symbol.iterator,
  83835. m = s && o[s],
  83836. i = 0;
  83837. if (m) return m.call(o);
  83838. if (o && typeof o.length === "number") return {
  83839. next: function next() {
  83840. if (o && i >= o.length) o = void 0;
  83841. return {
  83842. value: o && o[i++],
  83843. done: !o
  83844. };
  83845. }
  83846. };
  83847. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  83848. };
  83849. var CharsetEncoder = /** @class */function () {
  83850. function CharsetEncoder(charset) {
  83851. this.charset = charset;
  83852. this.name = charset.name;
  83853. }
  83854. CharsetEncoder.prototype.canEncode = function (c) {
  83855. try {
  83856. return _StringEncoding.default.encode(c, this.charset) != null;
  83857. } catch (ex) {
  83858. return false;
  83859. }
  83860. };
  83861. return CharsetEncoder;
  83862. }();
  83863. var ECIEncoderSet = /** @class */function () {
  83864. /**
  83865. * Constructs an encoder set
  83866. *
  83867. * @param stringToEncode the string that needs to be encoded
  83868. * @param priorityCharset The preferred {@link Charset} or null.
  83869. * @param fnc1 fnc1 denotes the character in the input that represents the FNC1 character or -1 for a non-GS1 bar
  83870. * code. When specified, it is considered an error to pass it as argument to the methods canEncode() or encode().
  83871. */
  83872. function ECIEncoderSet(stringToEncode, priorityCharset, fnc1) {
  83873. var e_1, _a, e_2, _b, e_3, _c;
  83874. this.ENCODERS = ['IBM437', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16', 'windows-1250', 'windows-1251', 'windows-1252', 'windows-1256', 'Shift_JIS'].map(function (name) {
  83875. return new CharsetEncoder(_Charset.default.forName(name));
  83876. });
  83877. this.encoders = [];
  83878. var neededEncoders = [];
  83879. // we always need the ISO-8859-1 encoder. It is the default encoding
  83880. neededEncoders.push(new CharsetEncoder(_StandardCharsets.default.ISO_8859_1));
  83881. var needUnicodeEncoder = priorityCharset != null && priorityCharset.name.startsWith('UTF');
  83882. // Walk over the input string and see if all characters can be encoded with the list of encoders
  83883. for (var i = 0; i < stringToEncode.length; i++) {
  83884. var canEncode = false;
  83885. try {
  83886. for (var neededEncoders_1 = (e_1 = void 0, __values(neededEncoders)), neededEncoders_1_1 = neededEncoders_1.next(); !neededEncoders_1_1.done; neededEncoders_1_1 = neededEncoders_1.next()) {
  83887. var encoder = neededEncoders_1_1.value;
  83888. var singleCharacter = stringToEncode.charAt(i);
  83889. var c = singleCharacter.charCodeAt(0);
  83890. if (c === fnc1 || encoder.canEncode(singleCharacter)) {
  83891. canEncode = true;
  83892. break;
  83893. }
  83894. }
  83895. } catch (e_1_1) {
  83896. e_1 = {
  83897. error: e_1_1
  83898. };
  83899. } finally {
  83900. try {
  83901. if (neededEncoders_1_1 && !neededEncoders_1_1.done && (_a = neededEncoders_1.return)) _a.call(neededEncoders_1);
  83902. } finally {
  83903. if (e_1) throw e_1.error;
  83904. }
  83905. }
  83906. if (!canEncode) {
  83907. try {
  83908. // for the character at position i we don't yet have an encoder in the list
  83909. for (var _d = (e_2 = void 0, __values(this.ENCODERS)), _e = _d.next(); !_e.done; _e = _d.next()) {
  83910. var encoder = _e.value;
  83911. if (encoder.canEncode(stringToEncode.charAt(i))) {
  83912. // Good, we found an encoder that can encode the character. We add him to the list and continue scanning
  83913. // the input
  83914. neededEncoders.push(encoder);
  83915. canEncode = true;
  83916. break;
  83917. }
  83918. }
  83919. } catch (e_2_1) {
  83920. e_2 = {
  83921. error: e_2_1
  83922. };
  83923. } finally {
  83924. try {
  83925. if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
  83926. } finally {
  83927. if (e_2) throw e_2.error;
  83928. }
  83929. }
  83930. }
  83931. if (!canEncode) {
  83932. // The character is not encodeable by any of the single byte encoders so we remember that we will need a
  83933. // Unicode encoder.
  83934. needUnicodeEncoder = true;
  83935. }
  83936. }
  83937. if (neededEncoders.length === 1 && !needUnicodeEncoder) {
  83938. // the entire input can be encoded by the ISO-8859-1 encoder
  83939. this.encoders = [neededEncoders[0]];
  83940. } else {
  83941. // we need more than one single byte encoder or we need a Unicode encoder.
  83942. // In this case we append a UTF-8 and UTF-16 encoder to the list
  83943. this.encoders = [];
  83944. var index = 0;
  83945. try {
  83946. for (var neededEncoders_2 = __values(neededEncoders), neededEncoders_2_1 = neededEncoders_2.next(); !neededEncoders_2_1.done; neededEncoders_2_1 = neededEncoders_2.next()) {
  83947. var encoder = neededEncoders_2_1.value;
  83948. this.encoders[index++] = encoder;
  83949. }
  83950. } catch (e_3_1) {
  83951. e_3 = {
  83952. error: e_3_1
  83953. };
  83954. } finally {
  83955. try {
  83956. if (neededEncoders_2_1 && !neededEncoders_2_1.done && (_c = neededEncoders_2.return)) _c.call(neededEncoders_2);
  83957. } finally {
  83958. if (e_3) throw e_3.error;
  83959. }
  83960. }
  83961. // this.encoders[index] = new CharsetEncoder(StandardCharsets.UTF_8);
  83962. // this.encoders[index + 1] = new CharsetEncoder(StandardCharsets.UTF_16BE);
  83963. }
  83964. // Compute priorityEncoderIndex by looking up priorityCharset in encoders
  83965. var priorityEncoderIndexValue = -1;
  83966. if (priorityCharset != null) {
  83967. for (var i = 0; i < this.encoders.length; i++) {
  83968. if (this.encoders[i] != null && priorityCharset.name === this.encoders[i].name) {
  83969. priorityEncoderIndexValue = i;
  83970. break;
  83971. }
  83972. }
  83973. }
  83974. this.priorityEncoderIndex = priorityEncoderIndexValue;
  83975. // invariants
  83976. // if(this?.encoders?.[0].name !== StandardCharsets.ISO_8859_1)){
  83977. // throw new Error("ISO-8859-1 must be the first encoder");
  83978. // }
  83979. }
  83980. ECIEncoderSet.prototype.length = function () {
  83981. return this.encoders.length;
  83982. };
  83983. ECIEncoderSet.prototype.getCharsetName = function (index) {
  83984. if (!(index < this.length())) {
  83985. throw new Error('index must be less than length');
  83986. }
  83987. return this.encoders[index].name;
  83988. };
  83989. ECIEncoderSet.prototype.getCharset = function (index) {
  83990. if (!(index < this.length())) {
  83991. throw new Error('index must be less than length');
  83992. }
  83993. return this.encoders[index].charset;
  83994. };
  83995. ECIEncoderSet.prototype.getECIValue = function (encoderIndex) {
  83996. return this.encoders[encoderIndex].charset.getValueIdentifier();
  83997. };
  83998. /*
  83999. * returns -1 if no priority charset was defined
  84000. */
  84001. ECIEncoderSet.prototype.getPriorityEncoderIndex = function () {
  84002. return this.priorityEncoderIndex;
  84003. };
  84004. ECIEncoderSet.prototype.canEncode = function (c, encoderIndex) {
  84005. if (!(encoderIndex < this.length())) {
  84006. throw new Error('index must be less than length');
  84007. }
  84008. return true;
  84009. };
  84010. ECIEncoderSet.prototype.encode = function (c, encoderIndex) {
  84011. if (!(encoderIndex < this.length())) {
  84012. throw new Error('index must be less than length');
  84013. }
  84014. return _StringEncoding.default.encode(_StringUtils.default.getCharAt(c), this.encoders[encoderIndex].name);
  84015. };
  84016. return ECIEncoderSet;
  84017. }();
  84018. exports.ECIEncoderSet = ECIEncoderSet;
  84019. /***/ }),
  84020. /* 496 */
  84021. /*!*************************************************************************************!*\
  84022. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/AztecWriter.js ***!
  84023. \*************************************************************************************/
  84024. /*! no static exports found */
  84025. /***/ (function(module, exports, __webpack_require__) {
  84026. "use strict";
  84027. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  84028. Object.defineProperty(exports, "__esModule", {
  84029. value: true
  84030. });
  84031. exports.default = void 0;
  84032. var _BarcodeFormat = _interopRequireDefault(__webpack_require__(/*! ../BarcodeFormat */ 334));
  84033. var _EncodeHintType = _interopRequireDefault(__webpack_require__(/*! ../EncodeHintType */ 462));
  84034. var _Encoder = _interopRequireDefault(__webpack_require__(/*! ./encoder/Encoder */ 497));
  84035. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../common/BitMatrix */ 319));
  84036. var _Charset = _interopRequireDefault(__webpack_require__(/*! ../util/Charset */ 477));
  84037. var _StandardCharsets = _interopRequireDefault(__webpack_require__(/*! ../util/StandardCharsets */ 478));
  84038. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../util/Integer */ 318));
  84039. var _IllegalStateException = _interopRequireDefault(__webpack_require__(/*! ../IllegalStateException */ 344));
  84040. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../IllegalArgumentException */ 308));
  84041. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../common/StringUtils */ 321));
  84042. /*
  84043. * Copyright 2013 ZXing authors
  84044. *
  84045. * Licensed under the Apache License, Version 2.0 (the "License");
  84046. * you may not use this file except in compliance with the License.
  84047. * You may obtain a copy of the License at
  84048. *
  84049. * http://www.apache.org/licenses/LICENSE-2.0
  84050. *
  84051. * Unless required by applicable law or agreed to in writing, software
  84052. * distributed under the License is distributed on an "AS IS" BASIS,
  84053. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  84054. * See the License for the specific language governing permissions and
  84055. * limitations under the License.
  84056. */
  84057. // package com.google.zxing.aztec;
  84058. // import com.google.zxing.BarcodeFormat;
  84059. // import com.google.zxing.EncodeHintType;
  84060. // import com.google.zxing.aztec.encoder.Encoder;
  84061. // import com.google.zxing.common.BitMatrix;
  84062. // import java.nio.charset.Charset;
  84063. // import java.nio.charset.StandardCharsets;
  84064. // import java.util.Map;
  84065. /**
  84066. * Renders an Aztec code as a {@link BitMatrix}.
  84067. */
  84068. var AztecWriter = /** @class */function () {
  84069. function AztecWriter() {}
  84070. // @Override
  84071. AztecWriter.prototype.encode = function (contents, format, width, height) {
  84072. return this.encodeWithHints(contents, format, width, height, null);
  84073. };
  84074. // @Override
  84075. AztecWriter.prototype.encodeWithHints = function (contents, format, width, height, hints) {
  84076. var charset = _StandardCharsets.default.ISO_8859_1;
  84077. var eccPercent = _Encoder.default.DEFAULT_EC_PERCENT;
  84078. var layers = _Encoder.default.DEFAULT_AZTEC_LAYERS;
  84079. if (hints != null) {
  84080. if (hints.has(_EncodeHintType.default.CHARACTER_SET)) {
  84081. charset = _Charset.default.forName(hints.get(_EncodeHintType.default.CHARACTER_SET).toString());
  84082. }
  84083. if (hints.has(_EncodeHintType.default.ERROR_CORRECTION)) {
  84084. eccPercent = _Integer.default.parseInt(hints.get(_EncodeHintType.default.ERROR_CORRECTION).toString());
  84085. }
  84086. if (hints.has(_EncodeHintType.default.AZTEC_LAYERS)) {
  84087. layers = _Integer.default.parseInt(hints.get(_EncodeHintType.default.AZTEC_LAYERS).toString());
  84088. }
  84089. }
  84090. return AztecWriter.encodeLayers(contents, format, width, height, charset, eccPercent, layers);
  84091. };
  84092. AztecWriter.encodeLayers = function (contents, format, width, height, charset, eccPercent, layers) {
  84093. if (format !== _BarcodeFormat.default.AZTEC) {
  84094. throw new _IllegalArgumentException.default('Can only encode AZTEC, but got ' + format);
  84095. }
  84096. var aztec = _Encoder.default.encode(_StringUtils.default.getBytes(contents, charset), eccPercent, layers);
  84097. return AztecWriter.renderResult(aztec, width, height);
  84098. };
  84099. AztecWriter.renderResult = function (code, width, height) {
  84100. var input = code.getMatrix();
  84101. if (input == null) {
  84102. throw new _IllegalStateException.default();
  84103. }
  84104. var inputWidth = input.getWidth();
  84105. var inputHeight = input.getHeight();
  84106. var outputWidth = Math.max(width, inputWidth);
  84107. var outputHeight = Math.max(height, inputHeight);
  84108. var multiple = Math.min(outputWidth / inputWidth, outputHeight / inputHeight);
  84109. var leftPadding = (outputWidth - inputWidth * multiple) / 2;
  84110. var topPadding = (outputHeight - inputHeight * multiple) / 2;
  84111. var output = new _BitMatrix.default(outputWidth, outputHeight);
  84112. for (var inputY /*int*/ = 0, outputY = topPadding; inputY < inputHeight; inputY++, outputY += multiple) {
  84113. // Write the contents of this row of the barcode
  84114. for (var inputX /*int*/ = 0, outputX = leftPadding; inputX < inputWidth; inputX++, outputX += multiple) {
  84115. if (input.get(inputX, inputY)) {
  84116. output.setRegion(outputX, outputY, multiple, multiple);
  84117. }
  84118. }
  84119. }
  84120. return output;
  84121. };
  84122. return AztecWriter;
  84123. }();
  84124. var _default = AztecWriter;
  84125. exports.default = _default;
  84126. /***/ }),
  84127. /* 497 */
  84128. /*!*****************************************************************************************!*\
  84129. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/Encoder.js ***!
  84130. \*****************************************************************************************/
  84131. /*! no static exports found */
  84132. /***/ (function(module, exports, __webpack_require__) {
  84133. "use strict";
  84134. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  84135. Object.defineProperty(exports, "__esModule", {
  84136. value: true
  84137. });
  84138. exports.default = void 0;
  84139. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
  84140. var _IllegalArgumentException = _interopRequireDefault(__webpack_require__(/*! ../../IllegalArgumentException */ 308));
  84141. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  84142. var _BitMatrix = _interopRequireDefault(__webpack_require__(/*! ../../common/BitMatrix */ 319));
  84143. var _AztecCode = _interopRequireDefault(__webpack_require__(/*! ./AztecCode */ 498));
  84144. var _ReedSolomonEncoder = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/ReedSolomonEncoder */ 464));
  84145. var _GenericGF = _interopRequireDefault(__webpack_require__(/*! ../../common/reedsolomon/GenericGF */ 338));
  84146. var _HighLevelEncoder = _interopRequireDefault(__webpack_require__(/*! ./HighLevelEncoder */ 499));
  84147. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  84148. var __values = void 0 && (void 0).__values || function (o) {
  84149. var s = typeof Symbol === "function" && Symbol.iterator,
  84150. m = s && o[s],
  84151. i = 0;
  84152. if (m) return m.call(o);
  84153. if (o && typeof o.length === "number") return {
  84154. next: function next() {
  84155. if (o && i >= o.length) o = void 0;
  84156. return {
  84157. value: o && o[i++],
  84158. done: !o
  84159. };
  84160. }
  84161. };
  84162. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  84163. };
  84164. /*
  84165. * Copyright 2013 ZXing authors
  84166. *
  84167. * Licensed under the Apache License, Version 2.0 (the "License");
  84168. * you may not use this file except in compliance with the License.
  84169. * You may obtain a copy of the License at
  84170. *
  84171. * http://www.apache.org/licenses/LICENSE-2.0
  84172. *
  84173. * Unless required by applicable law or agreed to in writing, software
  84174. * distributed under the License is distributed on an "AS IS" BASIS,
  84175. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  84176. * See the License for the specific language governing permissions and
  84177. * limitations under the License.
  84178. */
  84179. // package com.google.zxing.aztec.encoder;
  84180. // import com.google.zxing.common.BitArray;
  84181. // import com.google.zxing.common.BitMatrix;
  84182. // import com.google.zxing.common.reedsolomon.GenericGF;
  84183. // import com.google.zxing.common.reedsolomon.ReedSolomonEncoder;
  84184. /**
  84185. * Generates Aztec 2D barcodes.
  84186. *
  84187. * @author Rustam Abdullaev
  84188. */
  84189. var Encoder = /** @class */function () {
  84190. function Encoder() {}
  84191. /**
  84192. * Encodes the given binary content as an Aztec symbol
  84193. *
  84194. * @param data input data string
  84195. * @return Aztec symbol matrix with metadata
  84196. */
  84197. Encoder.encodeBytes = function (data) {
  84198. return Encoder.encode(data, Encoder.DEFAULT_EC_PERCENT, Encoder.DEFAULT_AZTEC_LAYERS);
  84199. };
  84200. /**
  84201. * Encodes the given binary content as an Aztec symbol
  84202. *
  84203. * @param data input data string
  84204. * @param minECCPercent minimal percentage of error check words (According to ISO/IEC 24778:2008,
  84205. * a minimum of 23% + 3 words is recommended)
  84206. * @param userSpecifiedLayers if non-zero, a user-specified value for the number of layers
  84207. * @return Aztec symbol matrix with metadata
  84208. */
  84209. Encoder.encode = function (data, minECCPercent, userSpecifiedLayers) {
  84210. // High-level encode
  84211. var bits = new _HighLevelEncoder.default(data).encode();
  84212. // stuff bits and choose symbol size
  84213. var eccBits = _Integer.default.truncDivision(bits.getSize() * minECCPercent, 100) + 11;
  84214. var totalSizeBits = bits.getSize() + eccBits;
  84215. var compact;
  84216. var layers;
  84217. var totalBitsInLayer;
  84218. var wordSize;
  84219. var stuffedBits;
  84220. if (userSpecifiedLayers !== Encoder.DEFAULT_AZTEC_LAYERS) {
  84221. compact = userSpecifiedLayers < 0;
  84222. layers = Math.abs(userSpecifiedLayers);
  84223. if (layers > (compact ? Encoder.MAX_NB_BITS_COMPACT : Encoder.MAX_NB_BITS)) {
  84224. throw new _IllegalArgumentException.default(_StringUtils.default.format('Illegal value %s for layers', userSpecifiedLayers));
  84225. }
  84226. totalBitsInLayer = Encoder.totalBitsInLayer(layers, compact);
  84227. wordSize = Encoder.WORD_SIZE[layers];
  84228. var usableBitsInLayers = totalBitsInLayer - totalBitsInLayer % wordSize;
  84229. stuffedBits = Encoder.stuffBits(bits, wordSize);
  84230. if (stuffedBits.getSize() + eccBits > usableBitsInLayers) {
  84231. throw new _IllegalArgumentException.default('Data to large for user specified layer');
  84232. }
  84233. if (compact && stuffedBits.getSize() > wordSize * 64) {
  84234. // Compact format only allows 64 data words, though C4 can hold more words than that
  84235. throw new _IllegalArgumentException.default('Data to large for user specified layer');
  84236. }
  84237. } else {
  84238. wordSize = 0;
  84239. stuffedBits = null;
  84240. // We look at the possible table sizes in the order Compact1, Compact2, Compact3,
  84241. // Compact4, Normal4,... Normal(i) for i < 4 isn't typically used since Compact(i+1)
  84242. // is the same size, but has more data.
  84243. for (var i /*int*/ = 0;; i++) {
  84244. if (i > Encoder.MAX_NB_BITS) {
  84245. throw new _IllegalArgumentException.default('Data too large for an Aztec code');
  84246. }
  84247. compact = i <= 3;
  84248. layers = compact ? i + 1 : i;
  84249. totalBitsInLayer = Encoder.totalBitsInLayer(layers, compact);
  84250. if (totalSizeBits > totalBitsInLayer) {
  84251. continue;
  84252. }
  84253. // [Re]stuff the bits if this is the first opportunity, or if the
  84254. // wordSize has changed
  84255. if (stuffedBits == null || wordSize !== Encoder.WORD_SIZE[layers]) {
  84256. wordSize = Encoder.WORD_SIZE[layers];
  84257. stuffedBits = Encoder.stuffBits(bits, wordSize);
  84258. }
  84259. var usableBitsInLayers = totalBitsInLayer - totalBitsInLayer % wordSize;
  84260. if (compact && stuffedBits.getSize() > wordSize * 64) {
  84261. // Compact format only allows 64 data words, though C4 can hold more words than that
  84262. continue;
  84263. }
  84264. if (stuffedBits.getSize() + eccBits <= usableBitsInLayers) {
  84265. break;
  84266. }
  84267. }
  84268. }
  84269. var messageBits = Encoder.generateCheckWords(stuffedBits, totalBitsInLayer, wordSize);
  84270. // generate mode message
  84271. var messageSizeInWords = stuffedBits.getSize() / wordSize;
  84272. var modeMessage = Encoder.generateModeMessage(compact, layers, messageSizeInWords);
  84273. // allocate symbol
  84274. var baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
  84275. var alignmentMap = new Int32Array(baseMatrixSize);
  84276. var matrixSize;
  84277. if (compact) {
  84278. // no alignment marks in compact mode, alignmentMap is a no-op
  84279. matrixSize = baseMatrixSize;
  84280. for (var i /*int*/ = 0; i < alignmentMap.length; i++) {
  84281. alignmentMap[i] = i;
  84282. }
  84283. } else {
  84284. matrixSize = baseMatrixSize + 1 + 2 * _Integer.default.truncDivision(_Integer.default.truncDivision(baseMatrixSize, 2) - 1, 15);
  84285. var origCenter = _Integer.default.truncDivision(baseMatrixSize, 2);
  84286. var center = _Integer.default.truncDivision(matrixSize, 2);
  84287. for (var i /*int*/ = 0; i < origCenter; i++) {
  84288. var newOffset = i + _Integer.default.truncDivision(i, 15);
  84289. alignmentMap[origCenter - i - 1] = center - newOffset - 1;
  84290. alignmentMap[origCenter + i] = center + newOffset + 1;
  84291. }
  84292. }
  84293. var matrix = new _BitMatrix.default(matrixSize);
  84294. // draw data bits
  84295. for (var i /*int*/ = 0, rowOffset = 0; i < layers; i++) {
  84296. var rowSize = (layers - i) * 4 + (compact ? 9 : 12);
  84297. for (var j /*int*/ = 0; j < rowSize; j++) {
  84298. var columnOffset = j * 2;
  84299. for (var k /*int*/ = 0; k < 2; k++) {
  84300. if (messageBits.get(rowOffset + columnOffset + k)) {
  84301. matrix.set(alignmentMap[i * 2 + k], alignmentMap[i * 2 + j]);
  84302. }
  84303. if (messageBits.get(rowOffset + rowSize * 2 + columnOffset + k)) {
  84304. matrix.set(alignmentMap[i * 2 + j], alignmentMap[baseMatrixSize - 1 - i * 2 - k]);
  84305. }
  84306. if (messageBits.get(rowOffset + rowSize * 4 + columnOffset + k)) {
  84307. matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - k], alignmentMap[baseMatrixSize - 1 - i * 2 - j]);
  84308. }
  84309. if (messageBits.get(rowOffset + rowSize * 6 + columnOffset + k)) {
  84310. matrix.set(alignmentMap[baseMatrixSize - 1 - i * 2 - j], alignmentMap[i * 2 + k]);
  84311. }
  84312. }
  84313. }
  84314. rowOffset += rowSize * 8;
  84315. }
  84316. // draw mode message
  84317. Encoder.drawModeMessage(matrix, compact, matrixSize, modeMessage);
  84318. // draw alignment marks
  84319. if (compact) {
  84320. Encoder.drawBullsEye(matrix, _Integer.default.truncDivision(matrixSize, 2), 5);
  84321. } else {
  84322. Encoder.drawBullsEye(matrix, _Integer.default.truncDivision(matrixSize, 2), 7);
  84323. for (var i /*int*/ = 0, j = 0; i < _Integer.default.truncDivision(baseMatrixSize, 2) - 1; i += 15, j += 16) {
  84324. for (var k /*int*/ = _Integer.default.truncDivision(matrixSize, 2) & 1; k < matrixSize; k += 2) {
  84325. matrix.set(_Integer.default.truncDivision(matrixSize, 2) - j, k);
  84326. matrix.set(_Integer.default.truncDivision(matrixSize, 2) + j, k);
  84327. matrix.set(k, _Integer.default.truncDivision(matrixSize, 2) - j);
  84328. matrix.set(k, _Integer.default.truncDivision(matrixSize, 2) + j);
  84329. }
  84330. }
  84331. }
  84332. var aztec = new _AztecCode.default();
  84333. aztec.setCompact(compact);
  84334. aztec.setSize(matrixSize);
  84335. aztec.setLayers(layers);
  84336. aztec.setCodeWords(messageSizeInWords);
  84337. aztec.setMatrix(matrix);
  84338. return aztec;
  84339. };
  84340. Encoder.drawBullsEye = function (matrix, center, size) {
  84341. for (var i /*int*/ = 0; i < size; i += 2) {
  84342. for (var j /*int*/ = center - i; j <= center + i; j++) {
  84343. matrix.set(j, center - i);
  84344. matrix.set(j, center + i);
  84345. matrix.set(center - i, j);
  84346. matrix.set(center + i, j);
  84347. }
  84348. }
  84349. matrix.set(center - size, center - size);
  84350. matrix.set(center - size + 1, center - size);
  84351. matrix.set(center - size, center - size + 1);
  84352. matrix.set(center + size, center - size);
  84353. matrix.set(center + size, center - size + 1);
  84354. matrix.set(center + size, center + size - 1);
  84355. };
  84356. Encoder.generateModeMessage = function (compact, layers, messageSizeInWords) {
  84357. var modeMessage = new _BitArray.default();
  84358. if (compact) {
  84359. modeMessage.appendBits(layers - 1, 2);
  84360. modeMessage.appendBits(messageSizeInWords - 1, 6);
  84361. modeMessage = Encoder.generateCheckWords(modeMessage, 28, 4);
  84362. } else {
  84363. modeMessage.appendBits(layers - 1, 5);
  84364. modeMessage.appendBits(messageSizeInWords - 1, 11);
  84365. modeMessage = Encoder.generateCheckWords(modeMessage, 40, 4);
  84366. }
  84367. return modeMessage;
  84368. };
  84369. Encoder.drawModeMessage = function (matrix, compact, matrixSize, modeMessage) {
  84370. var center = _Integer.default.truncDivision(matrixSize, 2);
  84371. if (compact) {
  84372. for (var i /*int*/ = 0; i < 7; i++) {
  84373. var offset = center - 3 + i;
  84374. if (modeMessage.get(i)) {
  84375. matrix.set(offset, center - 5);
  84376. }
  84377. if (modeMessage.get(i + 7)) {
  84378. matrix.set(center + 5, offset);
  84379. }
  84380. if (modeMessage.get(20 - i)) {
  84381. matrix.set(offset, center + 5);
  84382. }
  84383. if (modeMessage.get(27 - i)) {
  84384. matrix.set(center - 5, offset);
  84385. }
  84386. }
  84387. } else {
  84388. for (var i /*int*/ = 0; i < 10; i++) {
  84389. var offset = center - 5 + i + _Integer.default.truncDivision(i, 5);
  84390. if (modeMessage.get(i)) {
  84391. matrix.set(offset, center - 7);
  84392. }
  84393. if (modeMessage.get(i + 10)) {
  84394. matrix.set(center + 7, offset);
  84395. }
  84396. if (modeMessage.get(29 - i)) {
  84397. matrix.set(offset, center + 7);
  84398. }
  84399. if (modeMessage.get(39 - i)) {
  84400. matrix.set(center - 7, offset);
  84401. }
  84402. }
  84403. }
  84404. };
  84405. Encoder.generateCheckWords = function (bitArray, totalBits, wordSize) {
  84406. var e_1, _a;
  84407. // bitArray is guaranteed to be a multiple of the wordSize, so no padding needed
  84408. var messageSizeInWords = bitArray.getSize() / wordSize;
  84409. var rs = new _ReedSolomonEncoder.default(Encoder.getGF(wordSize));
  84410. var totalWords = _Integer.default.truncDivision(totalBits, wordSize);
  84411. var messageWords = Encoder.bitsToWords(bitArray, wordSize, totalWords);
  84412. rs.encode(messageWords, totalWords - messageSizeInWords);
  84413. var startPad = totalBits % wordSize;
  84414. var messageBits = new _BitArray.default();
  84415. messageBits.appendBits(0, startPad);
  84416. try {
  84417. for (var _b = __values(Array.from(messageWords)), _c = _b.next(); !_c.done; _c = _b.next()) {
  84418. var messageWord = _c.value /*: int*/;
  84419. messageBits.appendBits(messageWord, wordSize);
  84420. }
  84421. } catch (e_1_1) {
  84422. e_1 = {
  84423. error: e_1_1
  84424. };
  84425. } finally {
  84426. try {
  84427. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  84428. } finally {
  84429. if (e_1) throw e_1.error;
  84430. }
  84431. }
  84432. return messageBits;
  84433. };
  84434. Encoder.bitsToWords = function (stuffedBits, wordSize, totalWords) {
  84435. var message = new Int32Array(totalWords);
  84436. var i;
  84437. var n;
  84438. for (i = 0, n = stuffedBits.getSize() / wordSize; i < n; i++) {
  84439. var value = 0;
  84440. for (var j /*int*/ = 0; j < wordSize; j++) {
  84441. value |= stuffedBits.get(i * wordSize + j) ? 1 << wordSize - j - 1 : 0;
  84442. }
  84443. message[i] = value;
  84444. }
  84445. return message;
  84446. };
  84447. Encoder.getGF = function (wordSize) {
  84448. switch (wordSize) {
  84449. case 4:
  84450. return _GenericGF.default.AZTEC_PARAM;
  84451. case 6:
  84452. return _GenericGF.default.AZTEC_DATA_6;
  84453. case 8:
  84454. return _GenericGF.default.AZTEC_DATA_8;
  84455. case 10:
  84456. return _GenericGF.default.AZTEC_DATA_10;
  84457. case 12:
  84458. return _GenericGF.default.AZTEC_DATA_12;
  84459. default:
  84460. throw new _IllegalArgumentException.default('Unsupported word size ' + wordSize);
  84461. }
  84462. };
  84463. Encoder.stuffBits = function (bits, wordSize) {
  84464. var out = new _BitArray.default();
  84465. var n = bits.getSize();
  84466. var mask = (1 << wordSize) - 2;
  84467. for (var i /*int*/ = 0; i < n; i += wordSize) {
  84468. var word = 0;
  84469. for (var j /*int*/ = 0; j < wordSize; j++) {
  84470. if (i + j >= n || bits.get(i + j)) {
  84471. word |= 1 << wordSize - 1 - j;
  84472. }
  84473. }
  84474. if ((word & mask) === mask) {
  84475. out.appendBits(word & mask, wordSize);
  84476. i--;
  84477. } else if ((word & mask) === 0) {
  84478. out.appendBits(word | 1, wordSize);
  84479. i--;
  84480. } else {
  84481. out.appendBits(word, wordSize);
  84482. }
  84483. }
  84484. return out;
  84485. };
  84486. Encoder.totalBitsInLayer = function (layers, compact) {
  84487. return ((compact ? 88 : 112) + 16 * layers) * layers;
  84488. };
  84489. Encoder.DEFAULT_EC_PERCENT = 33; // default minimal percentage of error check words
  84490. Encoder.DEFAULT_AZTEC_LAYERS = 0;
  84491. Encoder.MAX_NB_BITS = 32;
  84492. Encoder.MAX_NB_BITS_COMPACT = 4;
  84493. Encoder.WORD_SIZE = Int32Array.from([4, 6, 6, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12]);
  84494. return Encoder;
  84495. }();
  84496. var _default = Encoder;
  84497. exports.default = _default;
  84498. /***/ }),
  84499. /* 498 */
  84500. /*!*******************************************************************************************!*\
  84501. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/AztecCode.js ***!
  84502. \*******************************************************************************************/
  84503. /*! no static exports found */
  84504. /***/ (function(module, exports, __webpack_require__) {
  84505. "use strict";
  84506. Object.defineProperty(exports, "__esModule", {
  84507. value: true
  84508. });
  84509. exports.default = void 0;
  84510. /*
  84511. * Copyright 2013 ZXing authors
  84512. *
  84513. * Licensed under the Apache License, Version 2.0 (the "License");
  84514. * you may not use this file except in compliance with the License.
  84515. * You may obtain a copy of the License at
  84516. *
  84517. * http://www.apache.org/licenses/LICENSE-2.0
  84518. *
  84519. * Unless required by applicable law or agreed to in writing, software
  84520. * distributed under the License is distributed on an "AS IS" BASIS,
  84521. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  84522. * See the License for the specific language governing permissions and
  84523. * limitations under the License.
  84524. */
  84525. /**
  84526. * Aztec 2D code representation
  84527. *
  84528. * @author Rustam Abdullaev
  84529. */
  84530. var AztecCode = /** @class */function () {
  84531. function AztecCode() {}
  84532. /**
  84533. * @return {@code true} if compact instead of full mode
  84534. */
  84535. AztecCode.prototype.isCompact = function () {
  84536. return this.compact;
  84537. };
  84538. AztecCode.prototype.setCompact = function (compact) {
  84539. this.compact = compact;
  84540. };
  84541. /**
  84542. * @return size in pixels (width and height)
  84543. */
  84544. AztecCode.prototype.getSize = function () {
  84545. return this.size;
  84546. };
  84547. AztecCode.prototype.setSize = function (size) {
  84548. this.size = size;
  84549. };
  84550. /**
  84551. * @return number of levels
  84552. */
  84553. AztecCode.prototype.getLayers = function () {
  84554. return this.layers;
  84555. };
  84556. AztecCode.prototype.setLayers = function (layers) {
  84557. this.layers = layers;
  84558. };
  84559. /**
  84560. * @return number of data codewords
  84561. */
  84562. AztecCode.prototype.getCodeWords = function () {
  84563. return this.codeWords;
  84564. };
  84565. AztecCode.prototype.setCodeWords = function (codeWords) {
  84566. this.codeWords = codeWords;
  84567. };
  84568. /**
  84569. * @return the symbol image
  84570. */
  84571. AztecCode.prototype.getMatrix = function () {
  84572. return this.matrix;
  84573. };
  84574. AztecCode.prototype.setMatrix = function (matrix) {
  84575. this.matrix = matrix;
  84576. };
  84577. return AztecCode;
  84578. }();
  84579. var _default = AztecCode;
  84580. exports.default = _default;
  84581. /***/ }),
  84582. /* 499 */
  84583. /*!**************************************************************************************************!*\
  84584. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/HighLevelEncoder.js ***!
  84585. \**************************************************************************************************/
  84586. /*! no static exports found */
  84587. /***/ (function(module, exports, __webpack_require__) {
  84588. "use strict";
  84589. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  84590. var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  84591. Object.defineProperty(exports, "__esModule", {
  84592. value: true
  84593. });
  84594. exports.default = void 0;
  84595. var _Collections = _interopRequireDefault(__webpack_require__(/*! ../../util/Collections */ 500));
  84596. var _State = _interopRequireDefault(__webpack_require__(/*! ./State */ 501));
  84597. var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
  84598. var CharMap = _interopRequireWildcard(__webpack_require__(/*! ./CharMap */ 509));
  84599. var ShiftTable = _interopRequireWildcard(__webpack_require__(/*! ./ShiftTable */ 508));
  84600. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  84601. function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  84602. function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  84603. /*
  84604. * Copyright 2013 ZXing authors
  84605. *
  84606. * Licensed under the Apache License, Version 2.0 (the "License");
  84607. * you may not use this file except in compliance with the License.
  84608. * You may obtain a copy of the License at
  84609. *
  84610. * http://www.apache.org/licenses/LICENSE-2.0
  84611. *
  84612. * Unless required by applicable law or agreed to in writing, software
  84613. * distributed under the License is distributed on an "AS IS" BASIS,
  84614. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  84615. * See the License for the specific language governing permissions and
  84616. * limitations under the License.
  84617. */
  84618. var __values = void 0 && (void 0).__values || function (o) {
  84619. var s = typeof Symbol === "function" && Symbol.iterator,
  84620. m = s && o[s],
  84621. i = 0;
  84622. if (m) return m.call(o);
  84623. if (o && typeof o.length === "number") return {
  84624. next: function next() {
  84625. if (o && i >= o.length) o = void 0;
  84626. return {
  84627. value: o && o[i++],
  84628. done: !o
  84629. };
  84630. }
  84631. };
  84632. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  84633. };
  84634. // import java.util.Collection;
  84635. // import java.util.Collections;
  84636. /**
  84637. * This produces nearly optimal encodings of text into the first-level of
  84638. * encoding used by Aztec code.
  84639. *
  84640. * It uses a dynamic algorithm. For each prefix of the string, it determines
  84641. * a set of encodings that could lead to this prefix. We repeatedly add a
  84642. * character and generate a new set of optimal encodings until we have read
  84643. * through the entire input.
  84644. *
  84645. * @author Frank Yellin
  84646. * @author Rustam Abdullaev
  84647. */
  84648. var HighLevelEncoder = /** @class */function () {
  84649. function HighLevelEncoder(text) {
  84650. this.text = text;
  84651. }
  84652. /**
  84653. * @return text represented by this encoder encoded as a {@link BitArray}
  84654. */
  84655. HighLevelEncoder.prototype.encode = function () {
  84656. var spaceCharCode = _StringUtils.default.getCharCode(' ');
  84657. var lineBreakCharCode = _StringUtils.default.getCharCode('\n');
  84658. var states = _Collections.default.singletonList(_State.default.INITIAL_STATE);
  84659. for (var index = 0; index < this.text.length; index++) {
  84660. var pairCode = void 0;
  84661. var nextChar = index + 1 < this.text.length ? this.text[index + 1] : 0;
  84662. switch (this.text[index]) {
  84663. case _StringUtils.default.getCharCode('\r'):
  84664. pairCode = nextChar === lineBreakCharCode ? 2 : 0;
  84665. break;
  84666. case _StringUtils.default.getCharCode('.'):
  84667. pairCode = nextChar === spaceCharCode ? 3 : 0;
  84668. break;
  84669. case _StringUtils.default.getCharCode(','):
  84670. pairCode = nextChar === spaceCharCode ? 4 : 0;
  84671. break;
  84672. case _StringUtils.default.getCharCode(':'):
  84673. pairCode = nextChar === spaceCharCode ? 5 : 0;
  84674. break;
  84675. default:
  84676. pairCode = 0;
  84677. }
  84678. if (pairCode > 0) {
  84679. // We have one of the four special PUNCT pairs. Treat them specially.
  84680. // Get a new set of states for the two new characters.
  84681. states = HighLevelEncoder.updateStateListForPair(states, index, pairCode);
  84682. index++;
  84683. } else {
  84684. // Get a new set of states for the new character.
  84685. states = this.updateStateListForChar(states, index);
  84686. }
  84687. }
  84688. // We are left with a set of states. Find the shortest one.
  84689. var minState = _Collections.default.min(states, function (a, b) {
  84690. return a.getBitCount() - b.getBitCount();
  84691. });
  84692. // Convert it to a bit array, and return.
  84693. return minState.toBitArray(this.text);
  84694. };
  84695. // We update a set of states for a new character by updating each state
  84696. // for the new character, merging the results, and then removing the
  84697. // non-optimal states.
  84698. HighLevelEncoder.prototype.updateStateListForChar = function (states, index) {
  84699. var e_1, _a;
  84700. var result = [];
  84701. try {
  84702. for (var states_1 = __values(states), states_1_1 = states_1.next(); !states_1_1.done; states_1_1 = states_1.next()) {
  84703. var state = states_1_1.value /*State*/;
  84704. this.updateStateForChar(state, index, result);
  84705. }
  84706. } catch (e_1_1) {
  84707. e_1 = {
  84708. error: e_1_1
  84709. };
  84710. } finally {
  84711. try {
  84712. if (states_1_1 && !states_1_1.done && (_a = states_1.return)) _a.call(states_1);
  84713. } finally {
  84714. if (e_1) throw e_1.error;
  84715. }
  84716. }
  84717. return HighLevelEncoder.simplifyStates(result);
  84718. };
  84719. // Return a set of states that represent the possible ways of updating this
  84720. // state for the next character. The resulting set of states are added to
  84721. // the "result" list.
  84722. HighLevelEncoder.prototype.updateStateForChar = function (state, index, result) {
  84723. var ch = this.text[index] & 0xff;
  84724. var charInCurrentTable = CharMap.CHAR_MAP[state.getMode()][ch] > 0;
  84725. var stateNoBinary = null;
  84726. for (var mode /*int*/ = 0; mode <= C.MODE_PUNCT; mode++) {
  84727. var charInMode = CharMap.CHAR_MAP[mode][ch];
  84728. if (charInMode > 0) {
  84729. if (stateNoBinary == null) {
  84730. // Only create stateNoBinary the first time it's required.
  84731. stateNoBinary = state.endBinaryShift(index);
  84732. }
  84733. // Try generating the character by latching to its mode
  84734. if (!charInCurrentTable || mode === state.getMode() || mode === C.MODE_DIGIT) {
  84735. // If the character is in the current table, we don't want to latch to
  84736. // any other mode except possibly digit (which uses only 4 bits). Any
  84737. // other latch would be equally successful *after* this character, and
  84738. // so wouldn't save any bits.
  84739. var latchState = stateNoBinary.latchAndAppend(mode, charInMode);
  84740. result.push(latchState);
  84741. }
  84742. // Try generating the character by switching to its mode.
  84743. if (!charInCurrentTable && ShiftTable.SHIFT_TABLE[state.getMode()][mode] >= 0) {
  84744. // It never makes sense to temporarily shift to another mode if the
  84745. // character exists in the current mode. That can never save bits.
  84746. var shiftState = stateNoBinary.shiftAndAppend(mode, charInMode);
  84747. result.push(shiftState);
  84748. }
  84749. }
  84750. }
  84751. if (state.getBinaryShiftByteCount() > 0 || CharMap.CHAR_MAP[state.getMode()][ch] === 0) {
  84752. // It's never worthwhile to go into binary shift mode if you're not already
  84753. // in binary shift mode, and the character exists in your current mode.
  84754. // That can never save bits over just outputting the char in the current mode.
  84755. var binaryState = state.addBinaryShiftChar(index);
  84756. result.push(binaryState);
  84757. }
  84758. };
  84759. HighLevelEncoder.updateStateListForPair = function (states, index, pairCode) {
  84760. var e_2, _a;
  84761. var result = [];
  84762. try {
  84763. for (var states_2 = __values(states), states_2_1 = states_2.next(); !states_2_1.done; states_2_1 = states_2.next()) {
  84764. var state = states_2_1.value /*State*/;
  84765. this.updateStateForPair(state, index, pairCode, result);
  84766. }
  84767. } catch (e_2_1) {
  84768. e_2 = {
  84769. error: e_2_1
  84770. };
  84771. } finally {
  84772. try {
  84773. if (states_2_1 && !states_2_1.done && (_a = states_2.return)) _a.call(states_2);
  84774. } finally {
  84775. if (e_2) throw e_2.error;
  84776. }
  84777. }
  84778. return this.simplifyStates(result);
  84779. };
  84780. HighLevelEncoder.updateStateForPair = function (state, index, pairCode, result) {
  84781. var stateNoBinary = state.endBinaryShift(index);
  84782. // Possibility 1. Latch to C.MODE_PUNCT, and then append this code
  84783. result.push(stateNoBinary.latchAndAppend(C.MODE_PUNCT, pairCode));
  84784. if (state.getMode() !== C.MODE_PUNCT) {
  84785. // Possibility 2. Shift to C.MODE_PUNCT, and then append this code.
  84786. // Every state except C.MODE_PUNCT (handled above) can shift
  84787. result.push(stateNoBinary.shiftAndAppend(C.MODE_PUNCT, pairCode));
  84788. }
  84789. if (pairCode === 3 || pairCode === 4) {
  84790. // both characters are in DIGITS. Sometimes better to just add two digits
  84791. var digitState = stateNoBinary.latchAndAppend(C.MODE_DIGIT, 16 - pairCode) // period or comma in DIGIT
  84792. .latchAndAppend(C.MODE_DIGIT, 1); // space in DIGIT
  84793. result.push(digitState);
  84794. }
  84795. if (state.getBinaryShiftByteCount() > 0) {
  84796. // It only makes sense to do the characters as binary if we're already
  84797. // in binary mode.
  84798. var binaryState = state.addBinaryShiftChar(index).addBinaryShiftChar(index + 1);
  84799. result.push(binaryState);
  84800. }
  84801. };
  84802. HighLevelEncoder.simplifyStates = function (states) {
  84803. var e_3, _a, e_4, _b;
  84804. var result = [];
  84805. try {
  84806. for (var states_3 = __values(states), states_3_1 = states_3.next(); !states_3_1.done; states_3_1 = states_3.next()) {
  84807. var newState = states_3_1.value;
  84808. var add = true;
  84809. var _loop_1 = function _loop_1(oldState) {
  84810. if (oldState.isBetterThanOrEqualTo(newState)) {
  84811. add = false;
  84812. return "break";
  84813. }
  84814. if (newState.isBetterThanOrEqualTo(oldState)) {
  84815. // iterator.remove();
  84816. result = result.filter(function (x) {
  84817. return x !== oldState;
  84818. }); // remove old state
  84819. }
  84820. };
  84821. try {
  84822. for (var result_1 = (e_4 = void 0, __values(result)), result_1_1 = result_1.next(); !result_1_1.done; result_1_1 = result_1.next()) {
  84823. var oldState = result_1_1.value;
  84824. var state_1 = _loop_1(oldState);
  84825. if (state_1 === "break") break;
  84826. }
  84827. } catch (e_4_1) {
  84828. e_4 = {
  84829. error: e_4_1
  84830. };
  84831. } finally {
  84832. try {
  84833. if (result_1_1 && !result_1_1.done && (_b = result_1.return)) _b.call(result_1);
  84834. } finally {
  84835. if (e_4) throw e_4.error;
  84836. }
  84837. }
  84838. if (add) {
  84839. result.push(newState);
  84840. }
  84841. }
  84842. } catch (e_3_1) {
  84843. e_3 = {
  84844. error: e_3_1
  84845. };
  84846. } finally {
  84847. try {
  84848. if (states_3_1 && !states_3_1.done && (_a = states_3.return)) _a.call(states_3);
  84849. } finally {
  84850. if (e_3) throw e_3.error;
  84851. }
  84852. }
  84853. return result;
  84854. };
  84855. return HighLevelEncoder;
  84856. }();
  84857. var _default = HighLevelEncoder;
  84858. exports.default = _default;
  84859. /***/ }),
  84860. /* 500 */
  84861. /*!************************************************************************************!*\
  84862. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/util/Collections.js ***!
  84863. \************************************************************************************/
  84864. /*! no static exports found */
  84865. /***/ (function(module, exports, __webpack_require__) {
  84866. "use strict";
  84867. Object.defineProperty(exports, "__esModule", {
  84868. value: true
  84869. });
  84870. exports.default = void 0;
  84871. var Collections = /** @class */function () {
  84872. function Collections() {}
  84873. /**
  84874. * The singletonList(T) method is used to return an immutable list containing only the specified object.
  84875. */
  84876. Collections.singletonList = function (item) {
  84877. return [item];
  84878. };
  84879. /**
  84880. * The min(Collection<? extends T>, Comparator<? super T>) method is used to return the minimum element of the given collection, according to the order induced by the specified comparator.
  84881. */
  84882. Collections.min = function (collection, comparator) {
  84883. return collection.sort(comparator)[0];
  84884. };
  84885. return Collections;
  84886. }();
  84887. var _default = Collections;
  84888. exports.default = _default;
  84889. /***/ }),
  84890. /* 501 */
  84891. /*!***************************************************************************************!*\
  84892. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/State.js ***!
  84893. \***************************************************************************************/
  84894. /*! no static exports found */
  84895. /***/ (function(module, exports, __webpack_require__) {
  84896. "use strict";
  84897. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  84898. var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  84899. Object.defineProperty(exports, "__esModule", {
  84900. value: true
  84901. });
  84902. exports.default = void 0;
  84903. var _BitArray = _interopRequireDefault(__webpack_require__(/*! ../../common/BitArray */ 313));
  84904. var TokenHelpers = _interopRequireWildcard(__webpack_require__(/*! ./TokenHelpers */ 502));
  84905. var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
  84906. var LatchTable = _interopRequireWildcard(__webpack_require__(/*! ./LatchTable */ 507));
  84907. var ShiftTable = _interopRequireWildcard(__webpack_require__(/*! ./ShiftTable */ 508));
  84908. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  84909. function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  84910. function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  84911. /*
  84912. * Copyright 2013 ZXing authors
  84913. *
  84914. * Licensed under the Apache License, Version 2.0 (the "License");
  84915. * you may not use this file except in compliance with the License.
  84916. * You may obtain a copy of the License at
  84917. *
  84918. * http://www.apache.org/licenses/LICENSE-2.0
  84919. *
  84920. * Unless required by applicable law or agreed to in writing, software
  84921. * distributed under the License is distributed on an "AS IS" BASIS,
  84922. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  84923. * See the License for the specific language governing permissions and
  84924. * limitations under the License.
  84925. */
  84926. var __values = void 0 && (void 0).__values || function (o) {
  84927. var s = typeof Symbol === "function" && Symbol.iterator,
  84928. m = s && o[s],
  84929. i = 0;
  84930. if (m) return m.call(o);
  84931. if (o && typeof o.length === "number") return {
  84932. next: function next() {
  84933. if (o && i >= o.length) o = void 0;
  84934. return {
  84935. value: o && o[i++],
  84936. done: !o
  84937. };
  84938. }
  84939. };
  84940. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  84941. };
  84942. // package com.google.zxing.aztec.encoder;
  84943. // import java.util.Deque;
  84944. // import java.util.LinkedList;
  84945. // import com.google.zxing.common.BitArray;
  84946. /**
  84947. * State represents all information about a sequence necessary to generate the current output.
  84948. * Note that a state is immutable.
  84949. */
  84950. var State = /** @class */function () {
  84951. function State(token, mode, binaryBytes, bitCount) {
  84952. this.token = token;
  84953. this.mode = mode;
  84954. this.binaryShiftByteCount = binaryBytes;
  84955. this.bitCount = bitCount;
  84956. // Make sure we match the token
  84957. // int binaryShiftBitCount = (binaryShiftByteCount * 8) +
  84958. // (binaryShiftByteCount === 0 ? 0 :
  84959. // binaryShiftByteCount <= 31 ? 10 :
  84960. // binaryShiftByteCount <= 62 ? 20 : 21);
  84961. // assert this.bitCount === token.getTotalBitCount() + binaryShiftBitCount;
  84962. }
  84963. State.prototype.getMode = function () {
  84964. return this.mode;
  84965. };
  84966. State.prototype.getToken = function () {
  84967. return this.token;
  84968. };
  84969. State.prototype.getBinaryShiftByteCount = function () {
  84970. return this.binaryShiftByteCount;
  84971. };
  84972. State.prototype.getBitCount = function () {
  84973. return this.bitCount;
  84974. };
  84975. // Create a new state representing this state with a latch to a (not
  84976. // necessary different) mode, and then a code.
  84977. State.prototype.latchAndAppend = function (mode, value) {
  84978. // assert binaryShiftByteCount === 0;
  84979. var bitCount = this.bitCount;
  84980. var token = this.token;
  84981. if (mode !== this.mode) {
  84982. var latch = LatchTable.LATCH_TABLE[this.mode][mode];
  84983. token = TokenHelpers.add(token, latch & 0xffff, latch >> 16);
  84984. bitCount += latch >> 16;
  84985. }
  84986. var latchModeBitCount = mode === C.MODE_DIGIT ? 4 : 5;
  84987. token = TokenHelpers.add(token, value, latchModeBitCount);
  84988. return new State(token, mode, 0, bitCount + latchModeBitCount);
  84989. };
  84990. // Create a new state representing this state, with a temporary shift
  84991. // to a different mode to output a single value.
  84992. State.prototype.shiftAndAppend = function (mode, value) {
  84993. // assert binaryShiftByteCount === 0 && this.mode !== mode;
  84994. var token = this.token;
  84995. var thisModeBitCount = this.mode === C.MODE_DIGIT ? 4 : 5;
  84996. // Shifts exist only to UPPER and PUNCT, both with tokens size 5.
  84997. token = TokenHelpers.add(token, ShiftTable.SHIFT_TABLE[this.mode][mode], thisModeBitCount);
  84998. token = TokenHelpers.add(token, value, 5);
  84999. return new State(token, this.mode, 0, this.bitCount + thisModeBitCount + 5);
  85000. };
  85001. // Create a new state representing this state, but an additional character
  85002. // output in Binary Shift mode.
  85003. State.prototype.addBinaryShiftChar = function (index) {
  85004. var token = this.token;
  85005. var mode = this.mode;
  85006. var bitCount = this.bitCount;
  85007. if (this.mode === C.MODE_PUNCT || this.mode === C.MODE_DIGIT) {
  85008. // assert binaryShiftByteCount === 0;
  85009. var latch = LatchTable.LATCH_TABLE[mode][C.MODE_UPPER];
  85010. token = TokenHelpers.add(token, latch & 0xffff, latch >> 16);
  85011. bitCount += latch >> 16;
  85012. mode = C.MODE_UPPER;
  85013. }
  85014. var deltaBitCount = this.binaryShiftByteCount === 0 || this.binaryShiftByteCount === 31 ? 18 : this.binaryShiftByteCount === 62 ? 9 : 8;
  85015. var result = new State(token, mode, this.binaryShiftByteCount + 1, bitCount + deltaBitCount);
  85016. if (result.binaryShiftByteCount === 2047 + 31) {
  85017. // The string is as long as it's allowed to be. We should end it.
  85018. result = result.endBinaryShift(index + 1);
  85019. }
  85020. return result;
  85021. };
  85022. // Create the state identical to this one, but we are no longer in
  85023. // Binary Shift mode.
  85024. State.prototype.endBinaryShift = function (index) {
  85025. if (this.binaryShiftByteCount === 0) {
  85026. return this;
  85027. }
  85028. var token = this.token;
  85029. token = TokenHelpers.addBinaryShift(token, index - this.binaryShiftByteCount, this.binaryShiftByteCount);
  85030. // assert token.getTotalBitCount() === this.bitCount;
  85031. return new State(token, this.mode, 0, this.bitCount);
  85032. };
  85033. // Returns true if "this" state is better (equal: or) to be in than "that"
  85034. // state under all possible circumstances.
  85035. State.prototype.isBetterThanOrEqualTo = function (other) {
  85036. var newModeBitCount = this.bitCount + (LatchTable.LATCH_TABLE[this.mode][other.mode] >> 16);
  85037. if (this.binaryShiftByteCount < other.binaryShiftByteCount) {
  85038. // add additional B/S encoding cost of other, if any
  85039. newModeBitCount += State.calculateBinaryShiftCost(other) - State.calculateBinaryShiftCost(this);
  85040. } else if (this.binaryShiftByteCount > other.binaryShiftByteCount && other.binaryShiftByteCount > 0) {
  85041. // maximum possible additional cost (it: h)
  85042. newModeBitCount += 10;
  85043. }
  85044. return newModeBitCount <= other.bitCount;
  85045. };
  85046. State.prototype.toBitArray = function (text) {
  85047. var e_1, _a;
  85048. // Reverse the tokens, so that they are in the order that they should
  85049. // be output
  85050. var symbols = [];
  85051. for (var token = this.endBinaryShift(text.length).token; token !== null; token = token.getPrevious()) {
  85052. symbols.unshift(token);
  85053. }
  85054. var bitArray = new _BitArray.default();
  85055. try {
  85056. // Add each token to the result.
  85057. for (var symbols_1 = __values(symbols), symbols_1_1 = symbols_1.next(); !symbols_1_1.done; symbols_1_1 = symbols_1.next()) {
  85058. var symbol = symbols_1_1.value;
  85059. symbol.appendTo(bitArray, text);
  85060. }
  85061. } catch (e_1_1) {
  85062. e_1 = {
  85063. error: e_1_1
  85064. };
  85065. } finally {
  85066. try {
  85067. if (symbols_1_1 && !symbols_1_1.done && (_a = symbols_1.return)) _a.call(symbols_1);
  85068. } finally {
  85069. if (e_1) throw e_1.error;
  85070. }
  85071. }
  85072. // assert bitArray.getSize() === this.bitCount;
  85073. return bitArray;
  85074. };
  85075. /**
  85076. * @Override
  85077. */
  85078. State.prototype.toString = function () {
  85079. return _StringUtils.default.format('%s bits=%d bytes=%d', C.MODE_NAMES[this.mode], this.bitCount, this.binaryShiftByteCount);
  85080. };
  85081. State.calculateBinaryShiftCost = function (state) {
  85082. if (state.binaryShiftByteCount > 62) {
  85083. return 21; // B/S with extended length
  85084. }
  85085. if (state.binaryShiftByteCount > 31) {
  85086. return 20; // two B/S
  85087. }
  85088. if (state.binaryShiftByteCount > 0) {
  85089. return 10; // one B/S
  85090. }
  85091. return 0;
  85092. };
  85093. State.INITIAL_STATE = new State(C.EMPTY_TOKEN, C.MODE_UPPER, 0, 0);
  85094. return State;
  85095. }();
  85096. var _default = State;
  85097. exports.default = _default;
  85098. /***/ }),
  85099. /* 502 */
  85100. /*!**********************************************************************************************!*\
  85101. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/TokenHelpers.js ***!
  85102. \**********************************************************************************************/
  85103. /*! no static exports found */
  85104. /***/ (function(module, exports, __webpack_require__) {
  85105. "use strict";
  85106. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85107. Object.defineProperty(exports, "__esModule", {
  85108. value: true
  85109. });
  85110. exports.add = add;
  85111. exports.addBinaryShift = addBinaryShift;
  85112. var _SimpleToken = _interopRequireDefault(__webpack_require__(/*! ./SimpleToken */ 503));
  85113. var _BinaryShiftToken = _interopRequireDefault(__webpack_require__(/*! ./BinaryShiftToken */ 505));
  85114. function addBinaryShift(token, start, byteCount) {
  85115. // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
  85116. return new _BinaryShiftToken.default(token, start, byteCount);
  85117. }
  85118. function add(token, value, bitCount) {
  85119. return new _SimpleToken.default(token, value, bitCount);
  85120. }
  85121. /***/ }),
  85122. /* 503 */
  85123. /*!*********************************************************************************************!*\
  85124. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/SimpleToken.js ***!
  85125. \*********************************************************************************************/
  85126. /*! no static exports found */
  85127. /***/ (function(module, exports, __webpack_require__) {
  85128. "use strict";
  85129. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85130. Object.defineProperty(exports, "__esModule", {
  85131. value: true
  85132. });
  85133. exports.default = void 0;
  85134. var _Token = _interopRequireDefault(__webpack_require__(/*! ./Token */ 504));
  85135. var _Integer = _interopRequireDefault(__webpack_require__(/*! ../../util/Integer */ 318));
  85136. /*
  85137. * Copyright 2013 ZXing authors
  85138. *
  85139. * Licensed under the Apache License, Version 2.0 (the "License");
  85140. * you may not use this file except in compliance with the License.
  85141. * You may obtain a copy of the License at
  85142. *
  85143. * http://www.apache.org/licenses/LICENSE-2.0
  85144. *
  85145. * Unless required by applicable law or agreed to in writing, software
  85146. * distributed under the License is distributed on an "AS IS" BASIS,
  85147. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  85148. * See the License for the specific language governing permissions and
  85149. * limitations under the License.
  85150. */
  85151. var __extends = void 0 && (void 0).__extends || function () {
  85152. var _extendStatics = function extendStatics(d, b) {
  85153. _extendStatics = Object.setPrototypeOf || {
  85154. __proto__: []
  85155. } instanceof Array && function (d, b) {
  85156. d.__proto__ = b;
  85157. } || function (d, b) {
  85158. for (var p in b) {
  85159. if (b.hasOwnProperty(p)) d[p] = b[p];
  85160. }
  85161. };
  85162. return _extendStatics(d, b);
  85163. };
  85164. return function (d, b) {
  85165. _extendStatics(d, b);
  85166. function __() {
  85167. this.constructor = d;
  85168. }
  85169. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  85170. };
  85171. }();
  85172. var SimpleToken = /** @class */function (_super) {
  85173. __extends(SimpleToken, _super);
  85174. function SimpleToken(previous, value, bitCount) {
  85175. var _this = _super.call(this, previous) || this;
  85176. _this.value = value;
  85177. _this.bitCount = bitCount;
  85178. return _this;
  85179. }
  85180. /**
  85181. * @Override
  85182. */
  85183. SimpleToken.prototype.appendTo = function (bitArray, text) {
  85184. bitArray.appendBits(this.value, this.bitCount);
  85185. };
  85186. SimpleToken.prototype.add = function (value, bitCount) {
  85187. return new SimpleToken(this, value, bitCount);
  85188. };
  85189. SimpleToken.prototype.addBinaryShift = function (start, byteCount) {
  85190. // no-op can't binary shift a simple token
  85191. console.warn('addBinaryShift on SimpleToken, this simply returns a copy of this token');
  85192. return new SimpleToken(this, start, byteCount);
  85193. };
  85194. /**
  85195. * @Override
  85196. */
  85197. SimpleToken.prototype.toString = function () {
  85198. var value = this.value & (1 << this.bitCount) - 1;
  85199. value |= 1 << this.bitCount;
  85200. return '<' + _Integer.default.toBinaryString(value | 1 << this.bitCount).substring(1) + '>';
  85201. };
  85202. return SimpleToken;
  85203. }(_Token.default);
  85204. var _default = SimpleToken;
  85205. exports.default = _default;
  85206. /***/ }),
  85207. /* 504 */
  85208. /*!***************************************************************************************!*\
  85209. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/Token.js ***!
  85210. \***************************************************************************************/
  85211. /*! no static exports found */
  85212. /***/ (function(module, exports, __webpack_require__) {
  85213. "use strict";
  85214. Object.defineProperty(exports, "__esModule", {
  85215. value: true
  85216. });
  85217. exports.default = void 0;
  85218. /*
  85219. * Copyright 2013 ZXing authors
  85220. *
  85221. * Licensed under the Apache License, Version 2.0 (the "License");
  85222. * you may not use this file except in compliance with the License.
  85223. * You may obtain a copy of the License at
  85224. *
  85225. * http://www.apache.org/licenses/LICENSE-2.0
  85226. *
  85227. * Unless required by applicable law or agreed to in writing, software
  85228. * distributed under the License is distributed on an "AS IS" BASIS,
  85229. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  85230. * See the License for the specific language governing permissions and
  85231. * limitations under the License.
  85232. */
  85233. var Token = /** @class */function () {
  85234. function Token(previous) {
  85235. this.previous = previous;
  85236. }
  85237. Token.prototype.getPrevious = function () {
  85238. return this.previous;
  85239. };
  85240. return Token;
  85241. }();
  85242. var _default = Token;
  85243. exports.default = _default;
  85244. /***/ }),
  85245. /* 505 */
  85246. /*!**************************************************************************************************!*\
  85247. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/BinaryShiftToken.js ***!
  85248. \**************************************************************************************************/
  85249. /*! no static exports found */
  85250. /***/ (function(module, exports, __webpack_require__) {
  85251. "use strict";
  85252. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85253. Object.defineProperty(exports, "__esModule", {
  85254. value: true
  85255. });
  85256. exports.default = void 0;
  85257. var _SimpleToken = _interopRequireDefault(__webpack_require__(/*! ./SimpleToken */ 503));
  85258. /*
  85259. * Copyright 2013 ZXing authors
  85260. *
  85261. * Licensed under the Apache License, Version 2.0 (the "License");
  85262. * you may not use this file except in compliance with the License.
  85263. * You may obtain a copy of the License at
  85264. *
  85265. * http://www.apache.org/licenses/LICENSE-2.0
  85266. *
  85267. * Unless required by applicable law or agreed to in writing, software
  85268. * distributed under the License is distributed on an "AS IS" BASIS,
  85269. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  85270. * See the License for the specific language governing permissions and
  85271. * limitations under the License.
  85272. */
  85273. var __extends = void 0 && (void 0).__extends || function () {
  85274. var _extendStatics = function extendStatics(d, b) {
  85275. _extendStatics = Object.setPrototypeOf || {
  85276. __proto__: []
  85277. } instanceof Array && function (d, b) {
  85278. d.__proto__ = b;
  85279. } || function (d, b) {
  85280. for (var p in b) {
  85281. if (b.hasOwnProperty(p)) d[p] = b[p];
  85282. }
  85283. };
  85284. return _extendStatics(d, b);
  85285. };
  85286. return function (d, b) {
  85287. _extendStatics(d, b);
  85288. function __() {
  85289. this.constructor = d;
  85290. }
  85291. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  85292. };
  85293. }();
  85294. var BinaryShiftToken = /** @class */function (_super) {
  85295. __extends(BinaryShiftToken, _super);
  85296. function BinaryShiftToken(previous, binaryShiftStart, binaryShiftByteCount) {
  85297. var _this = _super.call(this, previous, 0, 0) || this;
  85298. _this.binaryShiftStart = binaryShiftStart;
  85299. _this.binaryShiftByteCount = binaryShiftByteCount;
  85300. return _this;
  85301. }
  85302. /**
  85303. * @Override
  85304. */
  85305. BinaryShiftToken.prototype.appendTo = function (bitArray, text) {
  85306. for (var i = 0; i < this.binaryShiftByteCount; i++) {
  85307. if (i === 0 || i === 31 && this.binaryShiftByteCount <= 62) {
  85308. // We need a header before the first character, and before
  85309. // character 31 when the total byte code is <= 62
  85310. bitArray.appendBits(31, 5); // BINARY_SHIFT
  85311. if (this.binaryShiftByteCount > 62) {
  85312. bitArray.appendBits(this.binaryShiftByteCount - 31, 16);
  85313. } else if (i === 0) {
  85314. // 1 <= binaryShiftByteCode <= 62
  85315. bitArray.appendBits(Math.min(this.binaryShiftByteCount, 31), 5);
  85316. } else {
  85317. // 32 <= binaryShiftCount <= 62 and i == 31
  85318. bitArray.appendBits(this.binaryShiftByteCount - 31, 5);
  85319. }
  85320. }
  85321. bitArray.appendBits(text[this.binaryShiftStart + i], 8);
  85322. }
  85323. };
  85324. BinaryShiftToken.prototype.addBinaryShift = function (start, byteCount) {
  85325. // int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);
  85326. return new BinaryShiftToken(this, start, byteCount);
  85327. };
  85328. /**
  85329. * @Override
  85330. */
  85331. BinaryShiftToken.prototype.toString = function () {
  85332. return '<' + this.binaryShiftStart + '::' + (this.binaryShiftStart + this.binaryShiftByteCount - 1) + '>';
  85333. };
  85334. return BinaryShiftToken;
  85335. }(_SimpleToken.default);
  85336. var _default = BinaryShiftToken;
  85337. exports.default = _default;
  85338. /***/ }),
  85339. /* 506 */
  85340. /*!**************************************************************************************************!*\
  85341. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/EncoderConstants.js ***!
  85342. \**************************************************************************************************/
  85343. /*! no static exports found */
  85344. /***/ (function(module, exports, __webpack_require__) {
  85345. "use strict";
  85346. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85347. Object.defineProperty(exports, "__esModule", {
  85348. value: true
  85349. });
  85350. exports.MODE_UPPER = exports.MODE_PUNCT = exports.MODE_NAMES = exports.MODE_MIXED = exports.MODE_LOWER = exports.MODE_DIGIT = exports.EMPTY_TOKEN = void 0;
  85351. var _SimpleToken = _interopRequireDefault(__webpack_require__(/*! ./SimpleToken */ 503));
  85352. var /*final*/MODE_NAMES = ['UPPER', 'LOWER', 'DIGIT', 'MIXED', 'PUNCT'];
  85353. exports.MODE_NAMES = MODE_NAMES;
  85354. var /*final*/MODE_UPPER = 0; // 5 bits
  85355. exports.MODE_UPPER = MODE_UPPER;
  85356. var /*final*/MODE_LOWER = 1; // 5 bits
  85357. exports.MODE_LOWER = MODE_LOWER;
  85358. var /*final*/MODE_DIGIT = 2; // 4 bits
  85359. exports.MODE_DIGIT = MODE_DIGIT;
  85360. var /*final*/MODE_MIXED = 3; // 5 bits
  85361. exports.MODE_MIXED = MODE_MIXED;
  85362. var /*final*/MODE_PUNCT = 4; // 5 bits
  85363. exports.MODE_PUNCT = MODE_PUNCT;
  85364. var EMPTY_TOKEN = new _SimpleToken.default(null, 0, 0);
  85365. exports.EMPTY_TOKEN = EMPTY_TOKEN;
  85366. /***/ }),
  85367. /* 507 */
  85368. /*!********************************************************************************************!*\
  85369. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/LatchTable.js ***!
  85370. \********************************************************************************************/
  85371. /*! no static exports found */
  85372. /***/ (function(module, exports, __webpack_require__) {
  85373. "use strict";
  85374. Object.defineProperty(exports, "__esModule", {
  85375. value: true
  85376. });
  85377. exports.LATCH_TABLE = void 0;
  85378. // The Latch Table shows, for each pair of Modes, the optimal method for
  85379. // getting from one mode to another. In the worst possible case, this can
  85380. // be up to 14 bits. In the best possible case, we are already there!
  85381. // The high half-word of each entry gives the number of bits.
  85382. // The low half-word of each entry are the actual bits necessary to change
  85383. var LATCH_TABLE = [Int32Array.from([0, (5 << 16) + 28, (5 << 16) + 30, (5 << 16) + 29, (10 << 16) + (29 << 5) + 30 // UPPER -> MIXED -> PUNCT
  85384. ]), Int32Array.from([(9 << 16) + (30 << 4) + 14, 0, (5 << 16) + 30, (5 << 16) + 29, (10 << 16) + (29 << 5) + 30 // LOWER -> MIXED -> PUNCT
  85385. ]), Int32Array.from([(4 << 16) + 14, (9 << 16) + (14 << 5) + 28, 0, (9 << 16) + (14 << 5) + 29, (14 << 16) + (14 << 10) + (29 << 5) + 30
  85386. // DIGIT -> UPPER -> MIXED -> PUNCT
  85387. ]), Int32Array.from([(5 << 16) + 29, (5 << 16) + 28, (10 << 16) + (29 << 5) + 30, 0, (5 << 16) + 30 // MIXED -> PUNCT
  85388. ]), Int32Array.from([(5 << 16) + 31, (10 << 16) + (31 << 5) + 28, (10 << 16) + (31 << 5) + 30, (10 << 16) + (31 << 5) + 29, 0])];
  85389. exports.LATCH_TABLE = LATCH_TABLE;
  85390. /***/ }),
  85391. /* 508 */
  85392. /*!********************************************************************************************!*\
  85393. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/ShiftTable.js ***!
  85394. \********************************************************************************************/
  85395. /*! no static exports found */
  85396. /***/ (function(module, exports, __webpack_require__) {
  85397. "use strict";
  85398. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85399. var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  85400. Object.defineProperty(exports, "__esModule", {
  85401. value: true
  85402. });
  85403. exports.SHIFT_TABLE = void 0;
  85404. exports.static_SHIFT_TABLE = static_SHIFT_TABLE;
  85405. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  85406. var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
  85407. function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  85408. function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  85409. var __values = void 0 && (void 0).__values || function (o) {
  85410. var s = typeof Symbol === "function" && Symbol.iterator,
  85411. m = s && o[s],
  85412. i = 0;
  85413. if (m) return m.call(o);
  85414. if (o && typeof o.length === "number") return {
  85415. next: function next() {
  85416. if (o && i >= o.length) o = void 0;
  85417. return {
  85418. value: o && o[i++],
  85419. done: !o
  85420. };
  85421. }
  85422. };
  85423. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  85424. };
  85425. function static_SHIFT_TABLE(SHIFT_TABLE) {
  85426. var e_1, _a;
  85427. try {
  85428. for (var SHIFT_TABLE_1 = __values(SHIFT_TABLE), SHIFT_TABLE_1_1 = SHIFT_TABLE_1.next(); !SHIFT_TABLE_1_1.done; SHIFT_TABLE_1_1 = SHIFT_TABLE_1.next()) {
  85429. var table = SHIFT_TABLE_1_1.value /*Int32Array*/;
  85430. _Arrays.default.fill(table, -1);
  85431. }
  85432. } catch (e_1_1) {
  85433. e_1 = {
  85434. error: e_1_1
  85435. };
  85436. } finally {
  85437. try {
  85438. if (SHIFT_TABLE_1_1 && !SHIFT_TABLE_1_1.done && (_a = SHIFT_TABLE_1.return)) _a.call(SHIFT_TABLE_1);
  85439. } finally {
  85440. if (e_1) throw e_1.error;
  85441. }
  85442. }
  85443. SHIFT_TABLE[C.MODE_UPPER][C.MODE_PUNCT] = 0;
  85444. SHIFT_TABLE[C.MODE_LOWER][C.MODE_PUNCT] = 0;
  85445. SHIFT_TABLE[C.MODE_LOWER][C.MODE_UPPER] = 28;
  85446. SHIFT_TABLE[C.MODE_MIXED][C.MODE_PUNCT] = 0;
  85447. SHIFT_TABLE[C.MODE_DIGIT][C.MODE_PUNCT] = 0;
  85448. SHIFT_TABLE[C.MODE_DIGIT][C.MODE_UPPER] = 15;
  85449. return SHIFT_TABLE;
  85450. }
  85451. var /*final*/SHIFT_TABLE = static_SHIFT_TABLE(_Arrays.default.createInt32Array(6, 6)); // mode shift codes, per table
  85452. exports.SHIFT_TABLE = SHIFT_TABLE;
  85453. /***/ }),
  85454. /* 509 */
  85455. /*!*****************************************************************************************!*\
  85456. !*** E:/git/2021项目/v3-H5/node_modules/@zxing/library/esm/core/aztec/encoder/CharMap.js ***!
  85457. \*****************************************************************************************/
  85458. /*! no static exports found */
  85459. /***/ (function(module, exports, __webpack_require__) {
  85460. "use strict";
  85461. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85462. var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ 13);
  85463. Object.defineProperty(exports, "__esModule", {
  85464. value: true
  85465. });
  85466. exports.CHAR_MAP = void 0;
  85467. exports.static_CHAR_MAP = static_CHAR_MAP;
  85468. var C = _interopRequireWildcard(__webpack_require__(/*! ./EncoderConstants */ 506));
  85469. var _Arrays = _interopRequireDefault(__webpack_require__(/*! ../../util/Arrays */ 314));
  85470. var _StringUtils = _interopRequireDefault(__webpack_require__(/*! ../../common/StringUtils */ 321));
  85471. function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  85472. function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  85473. function static_CHAR_MAP(CHAR_MAP) {
  85474. var spaceCharCode = _StringUtils.default.getCharCode(' ');
  85475. var pointCharCode = _StringUtils.default.getCharCode('.');
  85476. var commaCharCode = _StringUtils.default.getCharCode(',');
  85477. CHAR_MAP[C.MODE_UPPER][spaceCharCode] = 1;
  85478. var zUpperCharCode = _StringUtils.default.getCharCode('Z');
  85479. var aUpperCharCode = _StringUtils.default.getCharCode('A');
  85480. for (var c = aUpperCharCode; c <= zUpperCharCode; c++) {
  85481. CHAR_MAP[C.MODE_UPPER][c] = c - aUpperCharCode + 2;
  85482. }
  85483. CHAR_MAP[C.MODE_LOWER][spaceCharCode] = 1;
  85484. var zLowerCharCode = _StringUtils.default.getCharCode('z');
  85485. var aLowerCharCode = _StringUtils.default.getCharCode('a');
  85486. for (var c = aLowerCharCode; c <= zLowerCharCode; c++) {
  85487. CHAR_MAP[C.MODE_LOWER][c] = c - aLowerCharCode + 2;
  85488. }
  85489. CHAR_MAP[C.MODE_DIGIT][spaceCharCode] = 1;
  85490. var nineCharCode = _StringUtils.default.getCharCode('9');
  85491. var zeroCharCode = _StringUtils.default.getCharCode('0');
  85492. for (var c = zeroCharCode; c <= nineCharCode; c++) {
  85493. CHAR_MAP[C.MODE_DIGIT][c] = c - zeroCharCode + 2;
  85494. }
  85495. CHAR_MAP[C.MODE_DIGIT][commaCharCode] = 12;
  85496. CHAR_MAP[C.MODE_DIGIT][pointCharCode] = 13;
  85497. var mixedTable = ['\x00', ' ', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\b', '\t', '\n', '\x0b', '\f', '\r', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '@', '\\', '^', '_', '`', '|', '~', '\x7f'];
  85498. for (var i = 0; i < mixedTable.length; i++) {
  85499. CHAR_MAP[C.MODE_MIXED][_StringUtils.default.getCharCode(mixedTable[i])] = i;
  85500. }
  85501. var punctTable = ['\x00', '\r', '\x00', '\x00', '\x00', '\x00', '!', '\'', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}'];
  85502. for (var i = 0; i < punctTable.length; i++) {
  85503. if (_StringUtils.default.getCharCode(punctTable[i]) > 0) {
  85504. CHAR_MAP[C.MODE_PUNCT][_StringUtils.default.getCharCode(punctTable[i])] = i;
  85505. }
  85506. }
  85507. return CHAR_MAP;
  85508. }
  85509. var CHAR_MAP = static_CHAR_MAP(_Arrays.default.createInt32Array(5, 256));
  85510. exports.CHAR_MAP = CHAR_MAP;
  85511. /***/ }),
  85512. /* 510 */
  85513. /*!************************************************!*\
  85514. !*** E:/git/2021项目/v3-H5/utils/scanTheCode.js ***!
  85515. \************************************************/
  85516. /*! no static exports found */
  85517. /***/ (function(module, exports, __webpack_require__) {
  85518. "use strict";
  85519. /* WEBPACK VAR INJECTION */(function(uni) {
  85520. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85521. Object.defineProperty(exports, "__esModule", {
  85522. value: true
  85523. });
  85524. exports.scanCode = scanCode;
  85525. exports.scanTheCodeDataTreating = scanTheCodeDataTreating;
  85526. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 50));
  85527. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 52));
  85528. var _index = __webpack_require__(/*! @/pages/api/index.js */ 63);
  85529. /*************** 扫码相关方法 ***************/
  85530. // 公共扫码-方法
  85531. function scanCode(path) {
  85532. /*************** H5方法 ***************/
  85533. /*************** 微信方法 ***************/
  85534. uni.scanCode({
  85535. onlyFromCamera: true,
  85536. success: function success(res) {
  85537. scanTheCodeDataTreating(path, res.result);
  85538. },
  85539. fail: function fail(err) {
  85540. uni.showToast({
  85541. mask: true,
  85542. icon: "none",
  85543. position: "center",
  85544. title: err,
  85545. duration: 2000
  85546. });
  85547. return false;
  85548. }
  85549. });
  85550. }
  85551. //公共扫码-参数处理方法
  85552. function scanTheCodeDataTreating(path, result) {
  85553. if (result.indexOf('type') != -1) {
  85554. //项目二维码
  85555. var list = result.split("?")[1].split("&");
  85556. var codeData = {};
  85557. list.forEach(function (item) {
  85558. codeData[item.split("=")[0]] = item.split("=")[1];
  85559. });
  85560. if (codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type == 7 || codeData.type == 8 || codeData.type == 10 || codeData.type == 11 || codeData.type == 12 || codeData.type == 13 || codeData.type == 14) {
  85561. // 基础扫码逻辑
  85562. goCodePage(path, result);
  85563. } else if (codeData.type == 5) {
  85564. // 同位素实验室相关-暂时注释
  85565. // laboratorySubPassOutIsotopeSubSignF(path,codeData.subId,result);
  85566. uni.reLaunch({
  85567. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  85568. });
  85569. } else if (codeData.type == 9) {
  85570. chemicalAppletSelectStockInfoF(path, codeData.code);
  85571. }
  85572. } else {
  85573. chemicalAppletSelectStockInfoF(path, result);
  85574. }
  85575. }
  85576. //通用二维码页面
  85577. function goCodePage(path, result) {
  85578. if (path == 'home') {
  85579. uni.reLaunch({
  85580. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  85581. });
  85582. } else {
  85583. uni.showToast({
  85584. mask: true,
  85585. icon: "none",
  85586. position: "center",
  85587. title: "当前页面无法使用该二维码",
  85588. duration: 2000
  85589. });
  85590. setTimeout(function () {
  85591. uni.navigateBack();
  85592. }, 2000);
  85593. }
  85594. }
  85595. //查询是否是同位素实验并且有签退
  85596. function laboratorySubPassOutIsotopeSubSignF(_x, _x2, _x3) {
  85597. return _laboratorySubPassOutIsotopeSubSignF.apply(this, arguments);
  85598. } //扫码查询-化学品基本信息
  85599. function _laboratorySubPassOutIsotopeSubSignF() {
  85600. _laboratorySubPassOutIsotopeSubSignF = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(path, subId, result) {
  85601. var _yield$laboratorySubP, data, obj;
  85602. return _regenerator.default.wrap(function _callee$(_context) {
  85603. while (1) {
  85604. switch (_context.prev = _context.next) {
  85605. case 0:
  85606. if (!(path == 'home')) {
  85607. _context.next = 8;
  85608. break;
  85609. }
  85610. _context.next = 3;
  85611. return (0, _index.laboratorySubPassOutIsotopeSubSign)({
  85612. subId: subId
  85613. });
  85614. case 3:
  85615. _yield$laboratorySubP = _context.sent;
  85616. data = _yield$laboratorySubP.data;
  85617. if (data.code == 200) {
  85618. if (data.data.isotope) {
  85619. obj = {
  85620. subId: subId,
  85621. subName: data.data.subName,
  85622. passOutId: data.data.passOutId
  85623. };
  85624. uni.navigateTo({
  85625. url: "/pages_basics/views/photoInspection?item=" + encodeURIComponent(JSON.stringify(obj))
  85626. });
  85627. } else {
  85628. uni.reLaunch({
  85629. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(result)
  85630. });
  85631. }
  85632. }
  85633. _context.next = 10;
  85634. break;
  85635. case 8:
  85636. uni.showToast({
  85637. mask: true,
  85638. icon: "none",
  85639. position: "center",
  85640. title: "当前页面无法使用该二维码",
  85641. duration: 2000
  85642. });
  85643. setTimeout(function () {
  85644. uni.navigateBack();
  85645. }, 2000);
  85646. case 10:
  85647. case "end":
  85648. return _context.stop();
  85649. }
  85650. }
  85651. }, _callee);
  85652. }));
  85653. return _laboratorySubPassOutIsotopeSubSignF.apply(this, arguments);
  85654. }
  85655. function chemicalAppletSelectStockInfoF(_x4, _x5) {
  85656. return _chemicalAppletSelectStockInfoF.apply(this, arguments);
  85657. }
  85658. function _chemicalAppletSelectStockInfoF() {
  85659. _chemicalAppletSelectStockInfoF = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(path, code) {
  85660. var _yield$chemicalApplet, data;
  85661. return _regenerator.default.wrap(function _callee2$(_context2) {
  85662. while (1) {
  85663. switch (_context2.prev = _context2.next) {
  85664. case 0:
  85665. if (!(path == 'home')) {
  85666. _context2.next = 8;
  85667. break;
  85668. }
  85669. _context2.next = 3;
  85670. return (0, _index.chemicalAppletSelectStockInfo)({
  85671. tagCode: code
  85672. });
  85673. case 3:
  85674. _yield$chemicalApplet = _context2.sent;
  85675. data = _yield$chemicalApplet.data;
  85676. if (data.code == 200) {
  85677. if (data.data) {
  85678. data.data.code = code;
  85679. //化学品信息
  85680. uni.navigateTo({
  85681. url: "/pages_basics/views/chemicalsInfo/chemicalsInfo?item=" + encodeURIComponent(JSON.stringify(data.data))
  85682. });
  85683. } else {
  85684. uni.showToast({
  85685. mask: true,
  85686. icon: "none",
  85687. position: "center",
  85688. title: '未找到相关信息,请扫描正确的二维码',
  85689. duration: 2000
  85690. });
  85691. }
  85692. }
  85693. _context2.next = 10;
  85694. break;
  85695. case 8:
  85696. uni.showToast({
  85697. mask: true,
  85698. icon: "none",
  85699. position: "center",
  85700. title: "当前页面无法使用该二维码",
  85701. duration: 2000
  85702. });
  85703. setTimeout(function () {
  85704. uni.navigateBack();
  85705. }, 2000);
  85706. case 10:
  85707. case "end":
  85708. return _context2.stop();
  85709. }
  85710. }
  85711. }, _callee2);
  85712. }));
  85713. return _chemicalAppletSelectStockInfoF.apply(this, arguments);
  85714. }
  85715. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  85716. /***/ }),
  85717. /* 511 */,
  85718. /* 512 */,
  85719. /* 513 */,
  85720. /* 514 */,
  85721. /* 515 */,
  85722. /* 516 */,
  85723. /* 517 */,
  85724. /* 518 */,
  85725. /* 519 */,
  85726. /* 520 */,
  85727. /* 521 */,
  85728. /* 522 */,
  85729. /* 523 */,
  85730. /* 524 */,
  85731. /* 525 */,
  85732. /* 526 */,
  85733. /* 527 */,
  85734. /* 528 */,
  85735. /* 529 */,
  85736. /* 530 */,
  85737. /* 531 */,
  85738. /* 532 */,
  85739. /* 533 */,
  85740. /* 534 */,
  85741. /* 535 */,
  85742. /* 536 */,
  85743. /* 537 */,
  85744. /* 538 */,
  85745. /* 539 */,
  85746. /* 540 */,
  85747. /* 541 */,
  85748. /* 542 */,
  85749. /* 543 */,
  85750. /* 544 */,
  85751. /* 545 */,
  85752. /* 546 */,
  85753. /* 547 */,
  85754. /* 548 */,
  85755. /* 549 */,
  85756. /* 550 */,
  85757. /* 551 */,
  85758. /* 552 */,
  85759. /* 553 */,
  85760. /* 554 */,
  85761. /* 555 */,
  85762. /* 556 */,
  85763. /* 557 */,
  85764. /* 558 */,
  85765. /* 559 */,
  85766. /* 560 */,
  85767. /* 561 */,
  85768. /* 562 */,
  85769. /* 563 */,
  85770. /* 564 */,
  85771. /* 565 */,
  85772. /* 566 */,
  85773. /* 567 */,
  85774. /* 568 */,
  85775. /* 569 */,
  85776. /* 570 */,
  85777. /* 571 */,
  85778. /* 572 */,
  85779. /* 573 */,
  85780. /* 574 */,
  85781. /* 575 */,
  85782. /* 576 */,
  85783. /* 577 */,
  85784. /* 578 */,
  85785. /* 579 */,
  85786. /* 580 */,
  85787. /* 581 */,
  85788. /* 582 */,
  85789. /* 583 */,
  85790. /* 584 */,
  85791. /* 585 */,
  85792. /* 586 */,
  85793. /* 587 */,
  85794. /* 588 */,
  85795. /* 589 */,
  85796. /* 590 */,
  85797. /* 591 */,
  85798. /* 592 */,
  85799. /* 593 */
  85800. /*!*****************************************************!*\
  85801. !*** E:/git/2021项目/v3-H5/pages_basics/api/index.js ***!
  85802. \*****************************************************/
  85803. /*! no static exports found */
  85804. /***/ (function(module, exports, __webpack_require__) {
  85805. "use strict";
  85806. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  85807. Object.defineProperty(exports, "__esModule", {
  85808. value: true
  85809. });
  85810. exports.updateSignature = exports.systemUserSelectByPage = exports.systemUserPersonalData = exports.systemUserEditUser = exports.systemUserDetail = exports.systemMineWarningNoticeList = exports.systemMineWarningNoticeDetail = exports.systemMineUserEdit = exports.systemMineLinkGetEquipmentDetail = exports.systemMineLinkGetEducationExamDetail = exports.systemMineLinkGetCagePositionDetail = exports.querygenSign = exports.querySignature = exports.menuLinkPost = exports.laboratoryEventFindByEventId = exports.laboratoryAppletSignSubList = exports.laboratoryAppletSignOutSubmit = exports.laboratoryAppletPhotoInspectList = exports.laboratoryAppletPassOutList = exports.laboratoryAppletPassOutCount = exports.laboratoryAppletOutCheckList = exports.laboratoryAppletAddPhotoInspect = exports.gradingControlFinish = exports.gradingControlDetail = exports.gradingControlAdd = exports.gradingControl = exports.chemicalAppletSelectStockRecord = exports.authNumCaptchaNotRegistered = exports.authNumCaptcha = exports.authForgetPassword = void 0;
  85811. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  85812. var _request = __webpack_require__(/*! @/api/request/request.js */ 64);
  85813. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  85814. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  85815. //用户修改头像接口
  85816. var systemMineUserEdit = function systemMineUserEdit(data) {
  85817. return (0, _request.apiResquest)({
  85818. url: "/system/mine/user/edit",
  85819. method: 'POST',
  85820. data: _objectSpread({}, data)
  85821. });
  85822. };
  85823. //预警记录-列表
  85824. exports.systemMineUserEdit = systemMineUserEdit;
  85825. var systemMineWarningNoticeList = function systemMineWarningNoticeList(data) {
  85826. return (0, _request.apiResquest)({
  85827. url: "/system/mine/warningNoticeList",
  85828. method: 'POST',
  85829. data: _objectSpread({}, data)
  85830. });
  85831. };
  85832. //预警记录-非预案详情
  85833. exports.systemMineWarningNoticeList = systemMineWarningNoticeList;
  85834. var systemMineWarningNoticeDetail = function systemMineWarningNoticeDetail(data) {
  85835. return (0, _request.apiResquest)({
  85836. url: "/system/mine/warningNoticeDetail",
  85837. method: 'get',
  85838. data: _objectSpread({}, data)
  85839. });
  85840. };
  85841. //预警记录-预案详情
  85842. exports.systemMineWarningNoticeDetail = systemMineWarningNoticeDetail;
  85843. var laboratoryEventFindByEventId = function laboratoryEventFindByEventId(data) {
  85844. return (0, _request.apiResquest)({
  85845. url: "/laboratory/event/findByEventId",
  85846. method: 'get',
  85847. data: _objectSpread({}, data)
  85848. });
  85849. };
  85850. //进出记录/离开检查-实验室列表
  85851. exports.laboratoryEventFindByEventId = laboratoryEventFindByEventId;
  85852. var laboratoryAppletSignSubList = function laboratoryAppletSignSubList(data) {
  85853. return (0, _request.apiResquest)({
  85854. url: "/laboratory/applet/signSubList",
  85855. method: 'POST',
  85856. data: _objectSpread({}, data)
  85857. });
  85858. };
  85859. //进出记录-头部数据
  85860. exports.laboratoryAppletSignSubList = laboratoryAppletSignSubList;
  85861. var laboratoryAppletPassOutCount = function laboratoryAppletPassOutCount(data) {
  85862. return (0, _request.apiResquest)({
  85863. url: "/laboratory/applet/passOutCount",
  85864. method: 'POST',
  85865. data: _objectSpread({}, data)
  85866. });
  85867. };
  85868. //进出记录-列表
  85869. exports.laboratoryAppletPassOutCount = laboratoryAppletPassOutCount;
  85870. var laboratoryAppletPassOutList = function laboratoryAppletPassOutList(data) {
  85871. return (0, _request.apiResquest)({
  85872. url: "/laboratory/applet/passOutList",
  85873. method: 'POST',
  85874. data: _objectSpread({}, data)
  85875. });
  85876. };
  85877. //进出记录-照片列表
  85878. exports.laboratoryAppletPassOutList = laboratoryAppletPassOutList;
  85879. var laboratoryAppletPhotoInspectList = function laboratoryAppletPhotoInspectList(data) {
  85880. return (0, _request.apiResquest)({
  85881. url: "/laboratory/applet/photoInspectList",
  85882. method: 'POST',
  85883. data: _objectSpread({}, data)
  85884. });
  85885. };
  85886. //离开检查-检查项查询
  85887. exports.laboratoryAppletPhotoInspectList = laboratoryAppletPhotoInspectList;
  85888. var laboratoryAppletOutCheckList = function laboratoryAppletOutCheckList(data) {
  85889. return (0, _request.apiResquest)({
  85890. url: "/laboratory/applet/outCheckList",
  85891. method: 'POST',
  85892. data: _objectSpread({}, data)
  85893. });
  85894. };
  85895. //离开检查-提交
  85896. exports.laboratoryAppletOutCheckList = laboratoryAppletOutCheckList;
  85897. var laboratoryAppletAddPhotoInspect = function laboratoryAppletAddPhotoInspect(data) {
  85898. return (0, _request.apiResquest)({
  85899. url: "/laboratory/applet/addPhotoInspect",
  85900. method: 'POST',
  85901. data: _objectSpread({}, data)
  85902. });
  85903. };
  85904. //离开检查-直接离开
  85905. exports.laboratoryAppletAddPhotoInspect = laboratoryAppletAddPhotoInspect;
  85906. var laboratoryAppletSignOutSubmit = function laboratoryAppletSignOutSubmit(data) {
  85907. return (0, _request.apiResquest)({
  85908. url: "/laboratory/applet/signOutSubmit",
  85909. method: 'POST',
  85910. data: _objectSpread({}, data)
  85911. });
  85912. };
  85913. //查询用户电子签名
  85914. exports.laboratoryAppletSignOutSubmit = laboratoryAppletSignOutSubmit;
  85915. var querySignature = function querySignature(data) {
  85916. return (0, _request.apiResquest)({
  85917. url: "/system/user/querySignature",
  85918. method: 'get',
  85919. data: _objectSpread({}, data)
  85920. });
  85921. };
  85922. //小程序电子签名抠图生成图片
  85923. exports.querySignature = querySignature;
  85924. var querygenSign = function querygenSign(data) {
  85925. return (0, _request.apiResquest)({
  85926. url: "/system/user/genSign",
  85927. method: 'POST',
  85928. data: _objectSpread({}, data)
  85929. });
  85930. };
  85931. //小程序用户修改签名
  85932. exports.querygenSign = querygenSign;
  85933. var updateSignature = function updateSignature(data) {
  85934. return (0, _request.apiResquest)({
  85935. url: "/system/user/appSignature",
  85936. method: 'POST',
  85937. data: _objectSpread({}, data)
  85938. });
  85939. };
  85940. //设备资产管理
  85941. exports.updateSignature = updateSignature;
  85942. var systemMineLinkGetEquipmentDetail = function systemMineLinkGetEquipmentDetail(data) {
  85943. return (0, _request.apiResquest)({
  85944. url: "/system/mine/link/getEquipmentDetail",
  85945. method: 'get',
  85946. data: _objectSpread({}, data)
  85947. });
  85948. };
  85949. //笼位管理
  85950. exports.systemMineLinkGetEquipmentDetail = systemMineLinkGetEquipmentDetail;
  85951. var systemMineLinkGetCagePositionDetail = function systemMineLinkGetCagePositionDetail(data) {
  85952. return (0, _request.apiResquest)({
  85953. url: "/system/mine/link/getCagePositionDetail",
  85954. method: 'get',
  85955. data: _objectSpread({}, data)
  85956. });
  85957. };
  85958. //安全教育与考试
  85959. exports.systemMineLinkGetCagePositionDetail = systemMineLinkGetCagePositionDetail;
  85960. var systemMineLinkGetEducationExamDetail = function systemMineLinkGetEducationExamDetail(data) {
  85961. return (0, _request.apiResquest)({
  85962. url: "/system/mine/link/getEducationExamDetail",
  85963. method: 'get',
  85964. data: _objectSpread({}, data)
  85965. });
  85966. };
  85967. //设备资产管理/笼位管理获取跳转参数
  85968. exports.systemMineLinkGetEducationExamDetail = systemMineLinkGetEducationExamDetail;
  85969. var menuLinkPost = function menuLinkPost(url, data) {
  85970. return (0, _request.apiResquestOutside)({
  85971. url: url,
  85972. method: 'POST',
  85973. data: _objectSpread({}, data)
  85974. });
  85975. };
  85976. //分级管控未完成工作列表
  85977. exports.menuLinkPost = menuLinkPost;
  85978. var gradingControl = function gradingControl(data) {
  85979. return (0, _request.apiResquest)({
  85980. url: "/laboratory/app/lab/manage/havingList",
  85981. method: 'POST',
  85982. data: _objectSpread({}, data)
  85983. });
  85984. };
  85985. //完成分级管控工作
  85986. exports.gradingControl = gradingControl;
  85987. var gradingControlAdd = function gradingControlAdd(data) {
  85988. return (0, _request.apiResquest)({
  85989. url: "/laboratory/app/lab/manage/finish",
  85990. method: 'POST',
  85991. data: _objectSpread({}, data)
  85992. });
  85993. };
  85994. //分级管控已完成工作列表
  85995. exports.gradingControlAdd = gradingControlAdd;
  85996. var gradingControlFinish = function gradingControlFinish(data) {
  85997. return (0, _request.apiResquest)({
  85998. url: "/laboratory/app/lab/manage/finishList",
  85999. method: 'POST',
  86000. data: _objectSpread({}, data)
  86001. });
  86002. };
  86003. //分级管控详细信息
  86004. exports.gradingControlFinish = gradingControlFinish;
  86005. var gradingControlDetail = function gradingControlDetail(data) {
  86006. return (0, _request.apiResquest)({
  86007. url: "/laboratory/app/lab/manage/getInfo/" + data,
  86008. method: 'GET'
  86009. //data: data,
  86010. });
  86011. };
  86012. //通过手机号码-获取数字验证码(需要手机号已存在)
  86013. exports.gradingControlDetail = gradingControlDetail;
  86014. var authNumCaptcha = function authNumCaptcha(data) {
  86015. return (0, _request.apiResquest)({
  86016. url: "/auth/numCaptcha",
  86017. method: 'get',
  86018. data: _objectSpread({}, data)
  86019. });
  86020. };
  86021. //通过手机号码-获取数字验证码(需要手机号不存在)
  86022. exports.authNumCaptcha = authNumCaptcha;
  86023. var authNumCaptchaNotRegistered = function authNumCaptchaNotRegistered(data) {
  86024. return (0, _request.apiResquest)({
  86025. url: "/auth/numCaptchaNotRegistered",
  86026. method: 'get',
  86027. data: _objectSpread({}, data)
  86028. });
  86029. };
  86030. //忘记密码/修改密码-提交
  86031. exports.authNumCaptchaNotRegistered = authNumCaptchaNotRegistered;
  86032. var authForgetPassword = function authForgetPassword(data) {
  86033. return (0, _request.apiResquest)({
  86034. url: "/auth/forgetPassword",
  86035. method: 'POST',
  86036. data: _objectSpread({}, data)
  86037. });
  86038. };
  86039. //查询用户信息-(初始密码/手机号/导师/身份)
  86040. exports.authForgetPassword = authForgetPassword;
  86041. var systemUserPersonalData = function systemUserPersonalData(data) {
  86042. return (0, _request.apiResquest)({
  86043. url: "/system/user/personalData",
  86044. method: 'get'
  86045. });
  86046. };
  86047. //根据用户id查询用户详情
  86048. exports.systemUserPersonalData = systemUserPersonalData;
  86049. var systemUserDetail = function systemUserDetail(data) {
  86050. return (0, _request.apiResquest)({
  86051. url: "/system/user/detail",
  86052. method: 'get',
  86053. data: _objectSpread({}, data)
  86054. });
  86055. };
  86056. //查询导师列表
  86057. exports.systemUserDetail = systemUserDetail;
  86058. var systemUserSelectByPage = function systemUserSelectByPage(data) {
  86059. return (0, _request.apiResquest)({
  86060. url: "/system/user/selectByPage",
  86061. method: 'POST',
  86062. data: _objectSpread({}, data)
  86063. });
  86064. };
  86065. //完善用户信息-提交
  86066. exports.systemUserSelectByPage = systemUserSelectByPage;
  86067. var systemUserEditUser = function systemUserEditUser(data) {
  86068. return (0, _request.apiResquest)({
  86069. url: "/system/user/editUser",
  86070. method: 'POST',
  86071. data: _objectSpread({}, data)
  86072. });
  86073. };
  86074. //扫码查询-化学品使用记录
  86075. exports.systemUserEditUser = systemUserEditUser;
  86076. var chemicalAppletSelectStockRecord = function chemicalAppletSelectStockRecord(data) {
  86077. return (0, _request.apiResquest)({
  86078. url: "/chemical/applet/selectStockRecord",
  86079. method: 'POST',
  86080. data: _objectSpread({}, data)
  86081. });
  86082. };
  86083. exports.chemicalAppletSelectStockRecord = chemicalAppletSelectStockRecord;
  86084. /***/ }),
  86085. /* 594 */,
  86086. /* 595 */,
  86087. /* 596 */,
  86088. /* 597 */,
  86089. /* 598 */,
  86090. /* 599 */,
  86091. /* 600 */,
  86092. /* 601 */,
  86093. /* 602 */,
  86094. /* 603 */,
  86095. /* 604 */,
  86096. /* 605 */,
  86097. /* 606 */,
  86098. /* 607 */,
  86099. /* 608 */,
  86100. /* 609 */,
  86101. /* 610 */,
  86102. /* 611 */,
  86103. /* 612 */,
  86104. /* 613 */,
  86105. /* 614 */,
  86106. /* 615 */,
  86107. /* 616 */,
  86108. /* 617 */,
  86109. /* 618 */,
  86110. /* 619 */,
  86111. /* 620 */,
  86112. /* 621 */,
  86113. /* 622 */,
  86114. /* 623 */,
  86115. /* 624 */,
  86116. /* 625 */,
  86117. /* 626 */,
  86118. /* 627 */,
  86119. /* 628 */,
  86120. /* 629 */,
  86121. /* 630 */,
  86122. /* 631 */,
  86123. /* 632 */,
  86124. /* 633 */,
  86125. /* 634 */,
  86126. /* 635 */,
  86127. /* 636 */,
  86128. /* 637 */,
  86129. /* 638 */,
  86130. /* 639 */,
  86131. /* 640 */,
  86132. /* 641 */,
  86133. /* 642 */,
  86134. /* 643 */,
  86135. /* 644 */,
  86136. /* 645 */,
  86137. /* 646 */,
  86138. /* 647 */,
  86139. /* 648 */,
  86140. /* 649 */,
  86141. /* 650 */,
  86142. /* 651 */,
  86143. /* 652 */,
  86144. /* 653 */,
  86145. /* 654 */,
  86146. /* 655 */,
  86147. /* 656 */,
  86148. /* 657 */,
  86149. /* 658 */,
  86150. /* 659 */,
  86151. /* 660 */,
  86152. /* 661 */,
  86153. /* 662 */,
  86154. /* 663 */,
  86155. /* 664 */,
  86156. /* 665 */,
  86157. /* 666 */,
  86158. /* 667 */,
  86159. /* 668 */,
  86160. /* 669 */,
  86161. /* 670 */,
  86162. /* 671 */,
  86163. /* 672 */,
  86164. /* 673 */,
  86165. /* 674 */
  86166. /*!*****************************************************!*\
  86167. !*** E:/git/2021项目/v3-H5/pages_manage/api/index.js ***!
  86168. \*****************************************************/
  86169. /*! no static exports found */
  86170. /***/ (function(module, exports, __webpack_require__) {
  86171. "use strict";
  86172. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  86173. Object.defineProperty(exports, "__esModule", {
  86174. value: true
  86175. });
  86176. exports.applyRemoteOpenLockConfirm = applyRemoteOpenLockConfirm;
  86177. exports.laboratoryAppletGetSubDetailInfo = exports.laboratoryAppletGetApplyDetails = exports.laboratoryAppletEditApp = exports.laboratoryAppletAuditListByApply = exports.iotAppSpeakerPlayVoice = exports.iotAppSpeakerFindHorn = exports.iotAppSensorFindBySubId = exports.iotAppHardwareOperatingHardware = exports.iotAppHardwareFindByType = exports.iotAppDeviceFindByType = void 0;
  86178. exports.laboratoryAppletLabLockApplyDelete = laboratoryAppletLabLockApplyDelete;
  86179. exports.laboratoryAppletLabLockApplyList = laboratoryAppletLabLockApplyList;
  86180. exports.laboratoryAppletSubList = void 0;
  86181. exports.laboratoryApplyAddAddApply = laboratoryApplyAddAddApply;
  86182. exports.laboratoryApplyGetUserInfo = laboratoryApplyGetUserInfo;
  86183. exports.laboratoryApplyRemoteOpenLock = laboratoryApplyRemoteOpenLock;
  86184. exports.laboratoryGradeManageList = exports.laboratoryGradeManageExecute = exports.laboratoryExitRelayOpenLight = exports.laboratoryExitRelayCloseLight = exports.laboratoryExitLineGetRedisEvacuation = exports.laboratoryExitLineExecuteEvacuation = exports.laboratoryClassTypeGetList = exports.laboratoryClassLevelGetList = exports.laboratoryBigViewSelectTriggerInfo = exports.laboratoryBigViewGetFloorByBigView = exports.laboratoryBigViewGetBuildByBigView = void 0;
  86185. exports.laboratoryLabOpenLockLogUpdateLockData = laboratoryLabOpenLockLogUpdateLockData;
  86186. exports.systemDeptDropList = exports.laboratoryexitLineEndEvacuation = exports.laboratorySubRelInfoSelectAdminBySubPage = exports.laboratoryPlanCloseRiskPlan = void 0;
  86187. exports.systemSubjectGetAppSubject = systemSubjectGetAppSubject;
  86188. exports.systemSubjectGetAppSubjectByLogin = systemSubjectGetAppSubjectByLogin;
  86189. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  86190. var _request = __webpack_require__(/*! @/api/request/request.js */ 64);
  86191. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  86192. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  86193. //实验室-列表-获取学院列表下拉列表
  86194. var systemDeptDropList = function systemDeptDropList(data) {
  86195. return (0, _request.apiResquest)({
  86196. url: "/system/dept/dropList",
  86197. method: 'POST',
  86198. data: _objectSpread({}, data)
  86199. });
  86200. };
  86201. //实验室-列表-获取分类下拉列表
  86202. exports.systemDeptDropList = systemDeptDropList;
  86203. var laboratoryClassTypeGetList = function laboratoryClassTypeGetList(data) {
  86204. return (0, _request.apiResquest)({
  86205. url: "/laboratory/classType/getList",
  86206. method: 'POST',
  86207. data: _objectSpread({}, data)
  86208. });
  86209. };
  86210. //实验室-列表-获取分级
  86211. exports.laboratoryClassTypeGetList = laboratoryClassTypeGetList;
  86212. var laboratoryClassLevelGetList = function laboratoryClassLevelGetList(data) {
  86213. return (0, _request.apiResquest)({
  86214. url: "/laboratory/classLevel/getList",
  86215. method: 'POST',
  86216. data: _objectSpread({}, data)
  86217. });
  86218. };
  86219. //实验室-列表
  86220. exports.laboratoryClassLevelGetList = laboratoryClassLevelGetList;
  86221. var laboratoryAppletSubList = function laboratoryAppletSubList(data) {
  86222. return (0, _request.apiResquest)({
  86223. url: "/laboratory/applet/subList",
  86224. method: 'POST',
  86225. data: _objectSpread({}, data)
  86226. });
  86227. };
  86228. //实验室-详情
  86229. exports.laboratoryAppletSubList = laboratoryAppletSubList;
  86230. var laboratoryAppletGetSubDetailInfo = function laboratoryAppletGetSubDetailInfo(data) {
  86231. return (0, _request.apiResquest)({
  86232. url: "/laboratory/applet/getSubDetailInfo",
  86233. method: 'GET',
  86234. data: data
  86235. });
  86236. };
  86237. //实验室-查询传感器状态
  86238. exports.laboratoryAppletGetSubDetailInfo = laboratoryAppletGetSubDetailInfo;
  86239. var iotAppSensorFindBySubId = function iotAppSensorFindBySubId(data) {
  86240. return (0, _request.apiResquest)({
  86241. url: "/iot/app/sensor/findBySubId",
  86242. method: 'GET',
  86243. data: data
  86244. });
  86245. };
  86246. //实验室-查询硬件设备
  86247. exports.iotAppSensorFindBySubId = iotAppSensorFindBySubId;
  86248. var iotAppHardwareFindByType = function iotAppHardwareFindByType(data) {
  86249. return (0, _request.apiResquest)({
  86250. url: "/iot/app/hardware/findByType",
  86251. method: 'POST',
  86252. data: _objectSpread({}, data)
  86253. });
  86254. };
  86255. //实验室-硬件设备-开关
  86256. exports.iotAppHardwareFindByType = iotAppHardwareFindByType;
  86257. var iotAppHardwareOperatingHardware = function iotAppHardwareOperatingHardware(data) {
  86258. return (0, _request.apiResquest)({
  86259. url: "/iot/app/hardware/operatingHardware",
  86260. method: 'GET',
  86261. data: data
  86262. });
  86263. };
  86264. //实验室-查询物联设备
  86265. exports.iotAppHardwareOperatingHardware = iotAppHardwareOperatingHardware;
  86266. var iotAppDeviceFindByType = function iotAppDeviceFindByType(data) {
  86267. return (0, _request.apiResquest)({
  86268. url: "/iot/app/device/findByType",
  86269. method: 'POST',
  86270. data: _objectSpread({}, data)
  86271. });
  86272. };
  86273. //实验室-查询喇叭列表
  86274. exports.iotAppDeviceFindByType = iotAppDeviceFindByType;
  86275. var iotAppSpeakerFindHorn = function iotAppSpeakerFindHorn(data) {
  86276. return (0, _request.apiResquest)({
  86277. url: "/iot/app/speaker/findHorn",
  86278. method: 'GET',
  86279. data: data
  86280. });
  86281. };
  86282. //实验室-喇叭播放
  86283. exports.iotAppSpeakerFindHorn = iotAppSpeakerFindHorn;
  86284. var iotAppSpeakerPlayVoice = function iotAppSpeakerPlayVoice(data) {
  86285. return (0, _request.apiResquest)({
  86286. url: "/iot/app/speaker/playVoice",
  86287. method: 'GET',
  86288. data: data
  86289. });
  86290. };
  86291. //应急处置-查询楼栋楼层
  86292. exports.iotAppSpeakerPlayVoice = iotAppSpeakerPlayVoice;
  86293. var laboratoryBigViewGetBuildByBigView = function laboratoryBigViewGetBuildByBigView(data) {
  86294. return (0, _request.apiResquest)({
  86295. url: "/laboratory/bigView/getBuildByBigView",
  86296. method: 'GET',
  86297. data: data
  86298. });
  86299. };
  86300. //应急疏散-新实验室列表(替代原楼栋-楼层-实验室页面)
  86301. exports.laboratoryBigViewGetBuildByBigView = laboratoryBigViewGetBuildByBigView;
  86302. var laboratorySubRelInfoSelectAdminBySubPage = function laboratorySubRelInfoSelectAdminBySubPage(data) {
  86303. return (0, _request.apiResquest)({
  86304. url: "/laboratory/subRelInfo/selectAdminBySubPage",
  86305. method: 'post',
  86306. data: data
  86307. });
  86308. };
  86309. /****************疏散相关接口****************/
  86310. //查询当前用户下的预案触发数据
  86311. exports.laboratorySubRelInfoSelectAdminBySubPage = laboratorySubRelInfoSelectAdminBySubPage;
  86312. var laboratoryBigViewSelectTriggerInfo = function laboratoryBigViewSelectTriggerInfo(data) {
  86313. return (0, _request.apiResquest)({
  86314. url: "/laboratory/bigView/selectTriggerInfo",
  86315. method: 'GET',
  86316. data: data
  86317. });
  86318. };
  86319. //-应急处置-楼层布局数据
  86320. exports.laboratoryBigViewSelectTriggerInfo = laboratoryBigViewSelectTriggerInfo;
  86321. var laboratoryBigViewGetFloorByBigView = function laboratoryBigViewGetFloorByBigView(data) {
  86322. return (0, _request.apiResquest)({
  86323. url: "/laboratory/bigView/getFloorByBigView",
  86324. method: 'GET',
  86325. data: data
  86326. });
  86327. };
  86328. //查询当前发生的疏散
  86329. exports.laboratoryBigViewGetFloorByBigView = laboratoryBigViewGetFloorByBigView;
  86330. var laboratoryExitLineGetRedisEvacuation = function laboratoryExitLineGetRedisEvacuation(data) {
  86331. return (0, _request.apiResquest)({
  86332. url: "/laboratory/exitLine/getRedisEvacuation",
  86333. method: 'post',
  86334. data: data
  86335. });
  86336. };
  86337. //应急处置-执行疏散
  86338. exports.laboratoryExitLineGetRedisEvacuation = laboratoryExitLineGetRedisEvacuation;
  86339. var laboratoryExitLineExecuteEvacuation = function laboratoryExitLineExecuteEvacuation(data) {
  86340. return (0, _request.apiResquest)({
  86341. url: "/laboratory/exitLine/executeEvacuation",
  86342. method: 'post',
  86343. data: data
  86344. });
  86345. };
  86346. //应急处置-结束疏散
  86347. exports.laboratoryExitLineExecuteEvacuation = laboratoryExitLineExecuteEvacuation;
  86348. var laboratoryexitLineEndEvacuation = function laboratoryexitLineEndEvacuation(data) {
  86349. return (0, _request.apiResquest)({
  86350. url: "/laboratory/exitLine/endEvacuation",
  86351. method: 'post',
  86352. data: data
  86353. });
  86354. };
  86355. //应急处置-开灯
  86356. exports.laboratoryexitLineEndEvacuation = laboratoryexitLineEndEvacuation;
  86357. var laboratoryExitRelayOpenLight = function laboratoryExitRelayOpenLight(data) {
  86358. return (0, _request.apiResquest)({
  86359. url: "/laboratory/exitRelay/openLight",
  86360. method: 'post',
  86361. data: data
  86362. });
  86363. };
  86364. //应急处置-关灯
  86365. exports.laboratoryExitRelayOpenLight = laboratoryExitRelayOpenLight;
  86366. var laboratoryExitRelayCloseLight = function laboratoryExitRelayCloseLight(data) {
  86367. return (0, _request.apiResquest)({
  86368. url: "/laboratory/exitRelay/closeLight",
  86369. method: 'post',
  86370. data: data
  86371. });
  86372. };
  86373. //应急处置-结束预案
  86374. exports.laboratoryExitRelayCloseLight = laboratoryExitRelayCloseLight;
  86375. var laboratoryPlanCloseRiskPlan = function laboratoryPlanCloseRiskPlan(data) {
  86376. return (0, _request.apiResquest)({
  86377. url: "/laboratory/plan/closeRiskPlan",
  86378. method: 'GET',
  86379. data: data
  86380. });
  86381. };
  86382. //安全准入审核列表接口
  86383. exports.laboratoryPlanCloseRiskPlan = laboratoryPlanCloseRiskPlan;
  86384. var laboratoryAppletAuditListByApply = function laboratoryAppletAuditListByApply(data) {
  86385. return (0, _request.apiResquest)({
  86386. url: "/laboratory/applet/auditListByApply",
  86387. method: 'POST',
  86388. data: _objectSpread({}, data)
  86389. });
  86390. };
  86391. //审核信息详情(管理端)
  86392. exports.laboratoryAppletAuditListByApply = laboratoryAppletAuditListByApply;
  86393. var laboratoryAppletGetApplyDetails = function laboratoryAppletGetApplyDetails(data) {
  86394. return (0, _request.apiResquest)({
  86395. url: "/laboratory/applet/getApplyDetails",
  86396. method: 'GET',
  86397. data: data
  86398. });
  86399. };
  86400. //安全准入审批接口
  86401. exports.laboratoryAppletGetApplyDetails = laboratoryAppletGetApplyDetails;
  86402. var laboratoryAppletEditApp = function laboratoryAppletEditApp(data) {
  86403. return (0, _request.apiResquest)({
  86404. url: '/laboratory/applet/editApp',
  86405. method: 'POST',
  86406. data: data
  86407. });
  86408. };
  86409. //分级管控-列表
  86410. exports.laboratoryAppletEditApp = laboratoryAppletEditApp;
  86411. var laboratoryGradeManageList = function laboratoryGradeManageList(data) {
  86412. return (0, _request.apiResquest)({
  86413. url: '/laboratory/gradeManage/list',
  86414. method: 'POST',
  86415. data: data
  86416. });
  86417. };
  86418. //分级管控-执行
  86419. exports.laboratoryGradeManageList = laboratoryGradeManageList;
  86420. var laboratoryGradeManageExecute = function laboratoryGradeManageExecute(data) {
  86421. return (0, _request.apiResquest)({
  86422. url: '/laboratory/gradeManage/execute',
  86423. method: 'POST',
  86424. data: data
  86425. });
  86426. };
  86427. /* *门禁授权* */
  86428. //授权开门-查询实验室列表
  86429. exports.laboratoryGradeManageExecute = laboratoryGradeManageExecute;
  86430. function systemSubjectGetAppSubject(data) {
  86431. return (0, _request.apiResquest)({
  86432. url: '/system/subject/getAppSubject',
  86433. method: 'post',
  86434. data: _objectSpread({}, data)
  86435. });
  86436. }
  86437. //授权开门-查询被授权人
  86438. function laboratoryApplyGetUserInfo(data) {
  86439. return (0, _request.apiResquest)({
  86440. url: '/laboratory/apply/getUserInfo',
  86441. method: 'post',
  86442. data: _objectSpread({}, data)
  86443. });
  86444. }
  86445. //授权开门-授权
  86446. function laboratoryApplyAddAddApply(data) {
  86447. return (0, _request.apiResquest)({
  86448. url: '/laboratory/apply/addAddApply',
  86449. method: 'post',
  86450. data: _objectSpread({}, data)
  86451. });
  86452. }
  86453. //远程开门-开门
  86454. function laboratoryApplyRemoteOpenLock(data) {
  86455. return (0, _request.apiResquest)({
  86456. url: '/laboratory/apply/remoteOpenLock',
  86457. method: 'post',
  86458. data: _objectSpread({}, data)
  86459. });
  86460. }
  86461. //开门5秒后状态查询
  86462. function applyRemoteOpenLockConfirm(data) {
  86463. return (0, _request.apiResquest)({
  86464. url: '/laboratory/apply/remoteOpenLock/confirm',
  86465. method: 'GET',
  86466. data: data
  86467. });
  86468. }
  86469. //授权记录
  86470. function laboratoryAppletLabLockApplyList(data) {
  86471. return (0, _request.apiResquest)({
  86472. url: '/laboratory/applet/labLockApply/list',
  86473. method: 'post',
  86474. data: _objectSpread({}, data)
  86475. });
  86476. }
  86477. //删除-授权记录
  86478. function laboratoryAppletLabLockApplyDelete(data) {
  86479. return (0, _request.apiResquest)({
  86480. url: '/laboratory/applet/labLockApply/delete',
  86481. method: 'post',
  86482. data: _objectSpread({}, data)
  86483. });
  86484. }
  86485. //查询-负责人/安全员 所属的实验室列表
  86486. function systemSubjectGetAppSubjectByLogin(data) {
  86487. return (0, _request.apiResquest)({
  86488. url: '/system/subject/getAppSubjectByLogin',
  86489. method: 'post',
  86490. data: _objectSpread({}, data)
  86491. });
  86492. }
  86493. //远程开门-记录开门时间/开门状态
  86494. function laboratoryLabOpenLockLogUpdateLockData(data) {
  86495. return (0, _request.apiResquest)({
  86496. url: '/laboratory/labOpenLockLog/updateLockData',
  86497. method: 'post',
  86498. data: _objectSpread({}, data)
  86499. });
  86500. }
  86501. /***/ }),
  86502. /* 675 */,
  86503. /* 676 */,
  86504. /* 677 */,
  86505. /* 678 */,
  86506. /* 679 */,
  86507. /* 680 */,
  86508. /* 681 */,
  86509. /* 682 */,
  86510. /* 683 */,
  86511. /* 684 */,
  86512. /* 685 */,
  86513. /* 686 */,
  86514. /* 687 */,
  86515. /* 688 */,
  86516. /* 689 */,
  86517. /* 690 */,
  86518. /* 691 */,
  86519. /* 692 */,
  86520. /* 693 */,
  86521. /* 694 */,
  86522. /* 695 */,
  86523. /* 696 */,
  86524. /* 697 */,
  86525. /* 698 */,
  86526. /* 699 */,
  86527. /* 700 */,
  86528. /* 701 */,
  86529. /* 702 */,
  86530. /* 703 */,
  86531. /* 704 */,
  86532. /* 705 */,
  86533. /* 706 */,
  86534. /* 707 */,
  86535. /* 708 */,
  86536. /* 709 */,
  86537. /* 710 */,
  86538. /* 711 */,
  86539. /* 712 */,
  86540. /* 713 */,
  86541. /* 714 */,
  86542. /* 715 */,
  86543. /* 716 */,
  86544. /* 717 */,
  86545. /* 718 */,
  86546. /* 719 */,
  86547. /* 720 */,
  86548. /* 721 */,
  86549. /* 722 */,
  86550. /* 723 */,
  86551. /* 724 */,
  86552. /* 725 */,
  86553. /* 726 */,
  86554. /* 727 */,
  86555. /* 728 */,
  86556. /* 729 */,
  86557. /* 730 */,
  86558. /* 731 */,
  86559. /* 732 */,
  86560. /* 733 */,
  86561. /* 734 */,
  86562. /* 735 */,
  86563. /* 736 */,
  86564. /* 737 */,
  86565. /* 738 */,
  86566. /* 739 */,
  86567. /* 740 */,
  86568. /* 741 */,
  86569. /* 742 */,
  86570. /* 743 */,
  86571. /* 744 */,
  86572. /* 745 */,
  86573. /* 746 */,
  86574. /* 747 */,
  86575. /* 748 */,
  86576. /* 749 */,
  86577. /* 750 */,
  86578. /* 751 */,
  86579. /* 752 */,
  86580. /* 753 */,
  86581. /* 754 */,
  86582. /* 755 */,
  86583. /* 756 */,
  86584. /* 757 */,
  86585. /* 758 */,
  86586. /* 759 */,
  86587. /* 760 */,
  86588. /* 761 */,
  86589. /* 762 */,
  86590. /* 763 */,
  86591. /* 764 */,
  86592. /* 765 */,
  86593. /* 766 */,
  86594. /* 767 */,
  86595. /* 768 */,
  86596. /* 769 */,
  86597. /* 770 */,
  86598. /* 771 */,
  86599. /* 772 */,
  86600. /* 773 */,
  86601. /* 774 */,
  86602. /* 775 */,
  86603. /* 776 */,
  86604. /* 777 */,
  86605. /* 778 */,
  86606. /* 779 */,
  86607. /* 780 */,
  86608. /* 781 */,
  86609. /* 782 */,
  86610. /* 783 */,
  86611. /* 784 */,
  86612. /* 785 */,
  86613. /* 786 */,
  86614. /* 787 */,
  86615. /* 788 */,
  86616. /* 789 */,
  86617. /* 790 */,
  86618. /* 791 */,
  86619. /* 792 */,
  86620. /* 793 */,
  86621. /* 794 */,
  86622. /* 795 */,
  86623. /* 796 */,
  86624. /* 797 */,
  86625. /* 798 */,
  86626. /* 799 */,
  86627. /* 800 */,
  86628. /* 801 */,
  86629. /* 802 */,
  86630. /* 803 */,
  86631. /* 804 */,
  86632. /* 805 */,
  86633. /* 806 */,
  86634. /* 807 */,
  86635. /* 808 */,
  86636. /* 809 */,
  86637. /* 810 */,
  86638. /* 811 */,
  86639. /* 812 */,
  86640. /* 813 */,
  86641. /* 814 */,
  86642. /* 815 */,
  86643. /* 816 */,
  86644. /* 817 */,
  86645. /* 818 */,
  86646. /* 819 */,
  86647. /* 820 */,
  86648. /* 821 */,
  86649. /* 822 */,
  86650. /* 823 */,
  86651. /* 824 */,
  86652. /* 825 */,
  86653. /* 826 */,
  86654. /* 827 */,
  86655. /* 828 */,
  86656. /* 829 */,
  86657. /* 830 */,
  86658. /* 831 */,
  86659. /* 832 */,
  86660. /* 833 */,
  86661. /* 834 */,
  86662. /* 835 */,
  86663. /* 836 */,
  86664. /* 837 */,
  86665. /* 838 */,
  86666. /* 839 */,
  86667. /* 840 */,
  86668. /* 841 */,
  86669. /* 842 */,
  86670. /* 843 */,
  86671. /* 844 */,
  86672. /* 845 */,
  86673. /* 846 */,
  86674. /* 847 */,
  86675. /* 848 */,
  86676. /* 849 */,
  86677. /* 850 */,
  86678. /* 851 */,
  86679. /* 852 */,
  86680. /* 853 */,
  86681. /* 854 */,
  86682. /* 855 */,
  86683. /* 856 */,
  86684. /* 857 */,
  86685. /* 858 */,
  86686. /* 859 */,
  86687. /* 860 */,
  86688. /* 861 */,
  86689. /* 862 */,
  86690. /* 863 */,
  86691. /* 864 */
  86692. /*!******************************************!*\
  86693. !*** E:/git/2021项目/v3-H5/utils/index.js ***!
  86694. \******************************************/
  86695. /*! no static exports found */
  86696. /***/ (function(module, exports, __webpack_require__) {
  86697. "use strict";
  86698. /* WEBPACK VAR INJECTION */(function(uni) {
  86699. Object.defineProperty(exports, "__esModule", {
  86700. value: true
  86701. });
  86702. exports.controlsRestrictVerify = controlsRestrictVerify;
  86703. exports.itoOrVideoLimits = itoOrVideoLimits;
  86704. exports.pageRestrictVerify = pageRestrictVerify;
  86705. var _config = __webpack_require__(/*! @/api/request/config.js */ 33);
  86706. /* 操作权限验证
  86707. * str 为权限字符 用于匹配操作角色的字符
  86708. * str === performEvacuation 应急疏散操作权限
  86709. * str === checkGentle 安全检查
  86710. */
  86711. function controlsRestrictVerify(str) {
  86712. if (str) {
  86713. var controlsRestrict = uni.getStorageSync('controlsRestrict');
  86714. return controlsRestrict.indexOf(str) != -1;
  86715. } else {
  86716. return false;
  86717. }
  86718. }
  86719. /* 页面权限验证
  86720. * str 为权限字符 用于匹配操作角色的字符
  86721. */
  86722. function pageRestrictVerify(str) {
  86723. if (str) {
  86724. var permissions = uni.getStorageSync('permissions') + '';
  86725. return permissions.indexOf(str) != -1;
  86726. } else {
  86727. return false;
  86728. }
  86729. }
  86730. /* 硬件控制与视频监控权限验证(校级管理员/院级管理员/实验室管理员)
  86731. subAdminId 传入的实验室管理员ID
  86732. schoolId 校级管理员身份ID
  86733. collegeId 院级管理员身份ID
  86734. userInfo.position 当前用户身份ID (系统用户为NULL)
  86735. userInfo.userId 当前用户userID
  86736. */
  86737. function itoOrVideoLimits(subAdminId) {
  86738. var userInfo = uni.getStorageSync('user');
  86739. var schoolId = _config.config.schoolId;
  86740. var collegeId = _config.config.collegeId;
  86741. if (userInfo.position == null) {
  86742. //如果是管理员(系统用户)
  86743. return true;
  86744. } else if (userInfo.position == schoolId || userInfo.position == collegeId) {
  86745. //如果是校级管理员/院级管理员
  86746. return true;
  86747. } else if (userInfo.userId == subAdminId) {
  86748. //如果当前用户userId 与 管理员ID相等
  86749. return true;
  86750. } else {
  86751. return false;
  86752. }
  86753. }
  86754. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  86755. /***/ }),
  86756. /* 865 */,
  86757. /* 866 */,
  86758. /* 867 */,
  86759. /* 868 */,
  86760. /* 869 */,
  86761. /* 870 */,
  86762. /* 871 */,
  86763. /* 872 */,
  86764. /* 873 */,
  86765. /* 874 */,
  86766. /* 875 */,
  86767. /* 876 */,
  86768. /* 877 */,
  86769. /* 878 */,
  86770. /* 879 */,
  86771. /* 880 */,
  86772. /* 881 */,
  86773. /* 882 */,
  86774. /* 883 */,
  86775. /* 884 */,
  86776. /* 885 */,
  86777. /* 886 */,
  86778. /* 887 */,
  86779. /* 888 */,
  86780. /* 889 */,
  86781. /* 890 */,
  86782. /* 891 */,
  86783. /* 892 */,
  86784. /* 893 */,
  86785. /* 894 */,
  86786. /* 895 */,
  86787. /* 896 */,
  86788. /* 897 */,
  86789. /* 898 */,
  86790. /* 899 */,
  86791. /* 900 */,
  86792. /* 901 */,
  86793. /* 902 */,
  86794. /* 903 */,
  86795. /* 904 */,
  86796. /* 905 */,
  86797. /* 906 */,
  86798. /* 907 */,
  86799. /* 908 */,
  86800. /* 909 */,
  86801. /* 910 */,
  86802. /* 911 */,
  86803. /* 912 */,
  86804. /* 913 */,
  86805. /* 914 */,
  86806. /* 915 */,
  86807. /* 916 */,
  86808. /* 917 */,
  86809. /* 918 */,
  86810. /* 919 */,
  86811. /* 920 */,
  86812. /* 921 */,
  86813. /* 922 */,
  86814. /* 923 */,
  86815. /* 924 */,
  86816. /* 925 */,
  86817. /* 926 */,
  86818. /* 927 */,
  86819. /* 928 */,
  86820. /* 929 */,
  86821. /* 930 */,
  86822. /* 931 */,
  86823. /* 932 */,
  86824. /* 933 */,
  86825. /* 934 */,
  86826. /* 935 */,
  86827. /* 936 */,
  86828. /* 937 */,
  86829. /* 938 */,
  86830. /* 939 */,
  86831. /* 940 */,
  86832. /* 941 */,
  86833. /* 942 */,
  86834. /* 943 */,
  86835. /* 944 */,
  86836. /* 945 */,
  86837. /* 946 */,
  86838. /* 947 */,
  86839. /* 948 */,
  86840. /* 949 */,
  86841. /* 950 */,
  86842. /* 951 */
  86843. /*!*******************************************************************************************!*\
  86844. !*** E:/git/2021项目/v3-H5/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js ***!
  86845. \*******************************************************************************************/
  86846. /*! no static exports found */
  86847. /***/ (function(module, exports, __webpack_require__) {
  86848. "use strict";
  86849. Object.defineProperty(exports, "__esModule", {
  86850. value: true
  86851. });
  86852. exports.fontData = void 0;
  86853. var fontData = [{
  86854. "font_class": "arrow-down",
  86855. "unicode": "\uE6BE"
  86856. }, {
  86857. "font_class": "arrow-left",
  86858. "unicode": "\uE6BC"
  86859. }, {
  86860. "font_class": "arrow-right",
  86861. "unicode": "\uE6BB"
  86862. }, {
  86863. "font_class": "arrow-up",
  86864. "unicode": "\uE6BD"
  86865. }, {
  86866. "font_class": "auth",
  86867. "unicode": "\uE6AB"
  86868. }, {
  86869. "font_class": "auth-filled",
  86870. "unicode": "\uE6CC"
  86871. }, {
  86872. "font_class": "back",
  86873. "unicode": "\uE6B9"
  86874. }, {
  86875. "font_class": "bars",
  86876. "unicode": "\uE627"
  86877. }, {
  86878. "font_class": "calendar",
  86879. "unicode": "\uE6A0"
  86880. }, {
  86881. "font_class": "calendar-filled",
  86882. "unicode": "\uE6C0"
  86883. }, {
  86884. "font_class": "camera",
  86885. "unicode": "\uE65A"
  86886. }, {
  86887. "font_class": "camera-filled",
  86888. "unicode": "\uE658"
  86889. }, {
  86890. "font_class": "cart",
  86891. "unicode": "\uE631"
  86892. }, {
  86893. "font_class": "cart-filled",
  86894. "unicode": "\uE6D0"
  86895. }, {
  86896. "font_class": "chat",
  86897. "unicode": "\uE65D"
  86898. }, {
  86899. "font_class": "chat-filled",
  86900. "unicode": "\uE659"
  86901. }, {
  86902. "font_class": "chatboxes",
  86903. "unicode": "\uE696"
  86904. }, {
  86905. "font_class": "chatboxes-filled",
  86906. "unicode": "\uE692"
  86907. }, {
  86908. "font_class": "chatbubble",
  86909. "unicode": "\uE697"
  86910. }, {
  86911. "font_class": "chatbubble-filled",
  86912. "unicode": "\uE694"
  86913. }, {
  86914. "font_class": "checkbox",
  86915. "unicode": "\uE62B"
  86916. }, {
  86917. "font_class": "checkbox-filled",
  86918. "unicode": "\uE62C"
  86919. }, {
  86920. "font_class": "checkmarkempty",
  86921. "unicode": "\uE65C"
  86922. }, {
  86923. "font_class": "circle",
  86924. "unicode": "\uE65B"
  86925. }, {
  86926. "font_class": "circle-filled",
  86927. "unicode": "\uE65E"
  86928. }, {
  86929. "font_class": "clear",
  86930. "unicode": "\uE66D"
  86931. }, {
  86932. "font_class": "close",
  86933. "unicode": "\uE673"
  86934. }, {
  86935. "font_class": "closeempty",
  86936. "unicode": "\uE66C"
  86937. }, {
  86938. "font_class": "cloud-download",
  86939. "unicode": "\uE647"
  86940. }, {
  86941. "font_class": "cloud-download-filled",
  86942. "unicode": "\uE646"
  86943. }, {
  86944. "font_class": "cloud-upload",
  86945. "unicode": "\uE645"
  86946. }, {
  86947. "font_class": "cloud-upload-filled",
  86948. "unicode": "\uE648"
  86949. }, {
  86950. "font_class": "color",
  86951. "unicode": "\uE6CF"
  86952. }, {
  86953. "font_class": "color-filled",
  86954. "unicode": "\uE6C9"
  86955. }, {
  86956. "font_class": "compose",
  86957. "unicode": "\uE67F"
  86958. }, {
  86959. "font_class": "contact",
  86960. "unicode": "\uE693"
  86961. }, {
  86962. "font_class": "contact-filled",
  86963. "unicode": "\uE695"
  86964. }, {
  86965. "font_class": "down",
  86966. "unicode": "\uE6B8"
  86967. }, {
  86968. "font_class": "bottom",
  86969. "unicode": "\uE6B8"
  86970. }, {
  86971. "font_class": "download",
  86972. "unicode": "\uE68D"
  86973. }, {
  86974. "font_class": "download-filled",
  86975. "unicode": "\uE681"
  86976. }, {
  86977. "font_class": "email",
  86978. "unicode": "\uE69E"
  86979. }, {
  86980. "font_class": "email-filled",
  86981. "unicode": "\uE69A"
  86982. }, {
  86983. "font_class": "eye",
  86984. "unicode": "\uE651"
  86985. }, {
  86986. "font_class": "eye-filled",
  86987. "unicode": "\uE66A"
  86988. }, {
  86989. "font_class": "eye-slash",
  86990. "unicode": "\uE6B3"
  86991. }, {
  86992. "font_class": "eye-slash-filled",
  86993. "unicode": "\uE6B4"
  86994. }, {
  86995. "font_class": "fire",
  86996. "unicode": "\uE6A1"
  86997. }, {
  86998. "font_class": "fire-filled",
  86999. "unicode": "\uE6C5"
  87000. }, {
  87001. "font_class": "flag",
  87002. "unicode": "\uE65F"
  87003. }, {
  87004. "font_class": "flag-filled",
  87005. "unicode": "\uE660"
  87006. }, {
  87007. "font_class": "folder-add",
  87008. "unicode": "\uE6A9"
  87009. }, {
  87010. "font_class": "folder-add-filled",
  87011. "unicode": "\uE6C8"
  87012. }, {
  87013. "font_class": "font",
  87014. "unicode": "\uE6A3"
  87015. }, {
  87016. "font_class": "forward",
  87017. "unicode": "\uE6BA"
  87018. }, {
  87019. "font_class": "gear",
  87020. "unicode": "\uE664"
  87021. }, {
  87022. "font_class": "gear-filled",
  87023. "unicode": "\uE661"
  87024. }, {
  87025. "font_class": "gift",
  87026. "unicode": "\uE6A4"
  87027. }, {
  87028. "font_class": "gift-filled",
  87029. "unicode": "\uE6C4"
  87030. }, {
  87031. "font_class": "hand-down",
  87032. "unicode": "\uE63D"
  87033. }, {
  87034. "font_class": "hand-down-filled",
  87035. "unicode": "\uE63C"
  87036. }, {
  87037. "font_class": "hand-up",
  87038. "unicode": "\uE63F"
  87039. }, {
  87040. "font_class": "hand-up-filled",
  87041. "unicode": "\uE63E"
  87042. }, {
  87043. "font_class": "headphones",
  87044. "unicode": "\uE630"
  87045. }, {
  87046. "font_class": "heart",
  87047. "unicode": "\uE639"
  87048. }, {
  87049. "font_class": "heart-filled",
  87050. "unicode": "\uE641"
  87051. }, {
  87052. "font_class": "help",
  87053. "unicode": "\uE679"
  87054. }, {
  87055. "font_class": "help-filled",
  87056. "unicode": "\uE674"
  87057. }, {
  87058. "font_class": "home",
  87059. "unicode": "\uE662"
  87060. }, {
  87061. "font_class": "home-filled",
  87062. "unicode": "\uE663"
  87063. }, {
  87064. "font_class": "image",
  87065. "unicode": "\uE670"
  87066. }, {
  87067. "font_class": "image-filled",
  87068. "unicode": "\uE678"
  87069. }, {
  87070. "font_class": "images",
  87071. "unicode": "\uE650"
  87072. }, {
  87073. "font_class": "images-filled",
  87074. "unicode": "\uE64B"
  87075. }, {
  87076. "font_class": "info",
  87077. "unicode": "\uE669"
  87078. }, {
  87079. "font_class": "info-filled",
  87080. "unicode": "\uE649"
  87081. }, {
  87082. "font_class": "left",
  87083. "unicode": "\uE6B7"
  87084. }, {
  87085. "font_class": "link",
  87086. "unicode": "\uE6A5"
  87087. }, {
  87088. "font_class": "list",
  87089. "unicode": "\uE644"
  87090. }, {
  87091. "font_class": "location",
  87092. "unicode": "\uE6AE"
  87093. }, {
  87094. "font_class": "location-filled",
  87095. "unicode": "\uE6AF"
  87096. }, {
  87097. "font_class": "locked",
  87098. "unicode": "\uE66B"
  87099. }, {
  87100. "font_class": "locked-filled",
  87101. "unicode": "\uE668"
  87102. }, {
  87103. "font_class": "loop",
  87104. "unicode": "\uE633"
  87105. }, {
  87106. "font_class": "mail-open",
  87107. "unicode": "\uE643"
  87108. }, {
  87109. "font_class": "mail-open-filled",
  87110. "unicode": "\uE63A"
  87111. }, {
  87112. "font_class": "map",
  87113. "unicode": "\uE667"
  87114. }, {
  87115. "font_class": "map-filled",
  87116. "unicode": "\uE666"
  87117. }, {
  87118. "font_class": "map-pin",
  87119. "unicode": "\uE6AD"
  87120. }, {
  87121. "font_class": "map-pin-ellipse",
  87122. "unicode": "\uE6AC"
  87123. }, {
  87124. "font_class": "medal",
  87125. "unicode": "\uE6A2"
  87126. }, {
  87127. "font_class": "medal-filled",
  87128. "unicode": "\uE6C3"
  87129. }, {
  87130. "font_class": "mic",
  87131. "unicode": "\uE671"
  87132. }, {
  87133. "font_class": "mic-filled",
  87134. "unicode": "\uE677"
  87135. }, {
  87136. "font_class": "micoff",
  87137. "unicode": "\uE67E"
  87138. }, {
  87139. "font_class": "micoff-filled",
  87140. "unicode": "\uE6B0"
  87141. }, {
  87142. "font_class": "minus",
  87143. "unicode": "\uE66F"
  87144. }, {
  87145. "font_class": "minus-filled",
  87146. "unicode": "\uE67D"
  87147. }, {
  87148. "font_class": "more",
  87149. "unicode": "\uE64D"
  87150. }, {
  87151. "font_class": "more-filled",
  87152. "unicode": "\uE64E"
  87153. }, {
  87154. "font_class": "navigate",
  87155. "unicode": "\uE66E"
  87156. }, {
  87157. "font_class": "navigate-filled",
  87158. "unicode": "\uE67A"
  87159. }, {
  87160. "font_class": "notification",
  87161. "unicode": "\uE6A6"
  87162. }, {
  87163. "font_class": "notification-filled",
  87164. "unicode": "\uE6C1"
  87165. }, {
  87166. "font_class": "paperclip",
  87167. "unicode": "\uE652"
  87168. }, {
  87169. "font_class": "paperplane",
  87170. "unicode": "\uE672"
  87171. }, {
  87172. "font_class": "paperplane-filled",
  87173. "unicode": "\uE675"
  87174. }, {
  87175. "font_class": "person",
  87176. "unicode": "\uE699"
  87177. }, {
  87178. "font_class": "person-filled",
  87179. "unicode": "\uE69D"
  87180. }, {
  87181. "font_class": "personadd",
  87182. "unicode": "\uE69F"
  87183. }, {
  87184. "font_class": "personadd-filled",
  87185. "unicode": "\uE698"
  87186. }, {
  87187. "font_class": "personadd-filled-copy",
  87188. "unicode": "\uE6D1"
  87189. }, {
  87190. "font_class": "phone",
  87191. "unicode": "\uE69C"
  87192. }, {
  87193. "font_class": "phone-filled",
  87194. "unicode": "\uE69B"
  87195. }, {
  87196. "font_class": "plus",
  87197. "unicode": "\uE676"
  87198. }, {
  87199. "font_class": "plus-filled",
  87200. "unicode": "\uE6C7"
  87201. }, {
  87202. "font_class": "plusempty",
  87203. "unicode": "\uE67B"
  87204. }, {
  87205. "font_class": "pulldown",
  87206. "unicode": "\uE632"
  87207. }, {
  87208. "font_class": "pyq",
  87209. "unicode": "\uE682"
  87210. }, {
  87211. "font_class": "qq",
  87212. "unicode": "\uE680"
  87213. }, {
  87214. "font_class": "redo",
  87215. "unicode": "\uE64A"
  87216. }, {
  87217. "font_class": "redo-filled",
  87218. "unicode": "\uE655"
  87219. }, {
  87220. "font_class": "refresh",
  87221. "unicode": "\uE657"
  87222. }, {
  87223. "font_class": "refresh-filled",
  87224. "unicode": "\uE656"
  87225. }, {
  87226. "font_class": "refreshempty",
  87227. "unicode": "\uE6BF"
  87228. }, {
  87229. "font_class": "reload",
  87230. "unicode": "\uE6B2"
  87231. }, {
  87232. "font_class": "right",
  87233. "unicode": "\uE6B5"
  87234. }, {
  87235. "font_class": "scan",
  87236. "unicode": "\uE62A"
  87237. }, {
  87238. "font_class": "search",
  87239. "unicode": "\uE654"
  87240. }, {
  87241. "font_class": "settings",
  87242. "unicode": "\uE653"
  87243. }, {
  87244. "font_class": "settings-filled",
  87245. "unicode": "\uE6CE"
  87246. }, {
  87247. "font_class": "shop",
  87248. "unicode": "\uE62F"
  87249. }, {
  87250. "font_class": "shop-filled",
  87251. "unicode": "\uE6CD"
  87252. }, {
  87253. "font_class": "smallcircle",
  87254. "unicode": "\uE67C"
  87255. }, {
  87256. "font_class": "smallcircle-filled",
  87257. "unicode": "\uE665"
  87258. }, {
  87259. "font_class": "sound",
  87260. "unicode": "\uE684"
  87261. }, {
  87262. "font_class": "sound-filled",
  87263. "unicode": "\uE686"
  87264. }, {
  87265. "font_class": "spinner-cycle",
  87266. "unicode": "\uE68A"
  87267. }, {
  87268. "font_class": "staff",
  87269. "unicode": "\uE6A7"
  87270. }, {
  87271. "font_class": "staff-filled",
  87272. "unicode": "\uE6CB"
  87273. }, {
  87274. "font_class": "star",
  87275. "unicode": "\uE688"
  87276. }, {
  87277. "font_class": "star-filled",
  87278. "unicode": "\uE68F"
  87279. }, {
  87280. "font_class": "starhalf",
  87281. "unicode": "\uE683"
  87282. }, {
  87283. "font_class": "trash",
  87284. "unicode": "\uE687"
  87285. }, {
  87286. "font_class": "trash-filled",
  87287. "unicode": "\uE685"
  87288. }, {
  87289. "font_class": "tune",
  87290. "unicode": "\uE6AA"
  87291. }, {
  87292. "font_class": "tune-filled",
  87293. "unicode": "\uE6CA"
  87294. }, {
  87295. "font_class": "undo",
  87296. "unicode": "\uE64F"
  87297. }, {
  87298. "font_class": "undo-filled",
  87299. "unicode": "\uE64C"
  87300. }, {
  87301. "font_class": "up",
  87302. "unicode": "\uE6B6"
  87303. }, {
  87304. "font_class": "top",
  87305. "unicode": "\uE6B6"
  87306. }, {
  87307. "font_class": "upload",
  87308. "unicode": "\uE690"
  87309. }, {
  87310. "font_class": "upload-filled",
  87311. "unicode": "\uE68E"
  87312. }, {
  87313. "font_class": "videocam",
  87314. "unicode": "\uE68C"
  87315. }, {
  87316. "font_class": "videocam-filled",
  87317. "unicode": "\uE689"
  87318. }, {
  87319. "font_class": "vip",
  87320. "unicode": "\uE6A8"
  87321. }, {
  87322. "font_class": "vip-filled",
  87323. "unicode": "\uE6C6"
  87324. }, {
  87325. "font_class": "wallet",
  87326. "unicode": "\uE6B1"
  87327. }, {
  87328. "font_class": "wallet-filled",
  87329. "unicode": "\uE6C2"
  87330. }, {
  87331. "font_class": "weibo",
  87332. "unicode": "\uE68B"
  87333. }, {
  87334. "font_class": "weixin",
  87335. "unicode": "\uE691"
  87336. }];
  87337. // export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
  87338. exports.fontData = fontData;
  87339. /***/ }),
  87340. /* 952 */,
  87341. /* 953 */,
  87342. /* 954 */,
  87343. /* 955 */,
  87344. /* 956 */,
  87345. /* 957 */,
  87346. /* 958 */,
  87347. /* 959 */,
  87348. /* 960 */,
  87349. /* 961 */,
  87350. /* 962 */,
  87351. /* 963 */,
  87352. /* 964 */,
  87353. /* 965 */,
  87354. /* 966 */,
  87355. /* 967 */,
  87356. /* 968 */,
  87357. /* 969 */,
  87358. /* 970 */,
  87359. /* 971 */,
  87360. /* 972 */,
  87361. /* 973 */
  87362. /*!********************************************************************************************************!*\
  87363. !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js ***!
  87364. \********************************************************************************************************/
  87365. /*! no static exports found */
  87366. /***/ (function(module, exports, __webpack_require__) {
  87367. "use strict";
  87368. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  87369. Object.defineProperty(exports, "__esModule", {
  87370. value: true
  87371. });
  87372. exports.default = void 0;
  87373. var _en = _interopRequireDefault(__webpack_require__(/*! ./en.json */ 974));
  87374. var _zhHans = _interopRequireDefault(__webpack_require__(/*! ./zh-Hans.json */ 975));
  87375. var _zhHant = _interopRequireDefault(__webpack_require__(/*! ./zh-Hant.json */ 976));
  87376. var _default = {
  87377. en: _en.default,
  87378. 'zh-Hans': _zhHans.default,
  87379. 'zh-Hant': _zhHant.default
  87380. };
  87381. exports.default = _default;
  87382. /***/ }),
  87383. /* 974 */
  87384. /*!*******************************************************************************************************!*\
  87385. !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json ***!
  87386. \*******************************************************************************************************/
  87387. /*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.SUN, uni-calender.confirm, default */
  87388. /***/ (function(module) {
  87389. module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"select date\",\"uni-datetime-picker.selectTime\":\"select time\",\"uni-datetime-picker.selectDateTime\":\"select date and time\",\"uni-datetime-picker.startDate\":\"start date\",\"uni-datetime-picker.endDate\":\"end date\",\"uni-datetime-picker.startTime\":\"start time\",\"uni-datetime-picker.endTime\":\"end time\",\"uni-datetime-picker.ok\":\"ok\",\"uni-datetime-picker.clear\":\"clear\",\"uni-datetime-picker.cancel\":\"cancel\",\"uni-datetime-picker.year\":\"-\",\"uni-datetime-picker.month\":\"\",\"uni-calender.MON\":\"MON\",\"uni-calender.TUE\":\"TUE\",\"uni-calender.WED\":\"WED\",\"uni-calender.THU\":\"THU\",\"uni-calender.FRI\":\"FRI\",\"uni-calender.SAT\":\"SAT\",\"uni-calender.SUN\":\"SUN\",\"uni-calender.confirm\":\"confirm\"}");
  87390. /***/ }),
  87391. /* 975 */
  87392. /*!************************************************************************************************************!*\
  87393. !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json ***!
  87394. \************************************************************************************************************/
  87395. /*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.SUN, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.confirm, default */
  87396. /***/ (function(module) {
  87397. module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"选择日期\",\"uni-datetime-picker.selectTime\":\"选择时间\",\"uni-datetime-picker.selectDateTime\":\"选择日期时间\",\"uni-datetime-picker.startDate\":\"开始日期\",\"uni-datetime-picker.endDate\":\"结束日期\",\"uni-datetime-picker.startTime\":\"开始时间\",\"uni-datetime-picker.endTime\":\"结束时间\",\"uni-datetime-picker.ok\":\"确定\",\"uni-datetime-picker.clear\":\"清除\",\"uni-datetime-picker.cancel\":\"取消\",\"uni-datetime-picker.year\":\"年\",\"uni-datetime-picker.month\":\"月\",\"uni-calender.SUN\":\"日\",\"uni-calender.MON\":\"一\",\"uni-calender.TUE\":\"二\",\"uni-calender.WED\":\"三\",\"uni-calender.THU\":\"四\",\"uni-calender.FRI\":\"五\",\"uni-calender.SAT\":\"六\",\"uni-calender.confirm\":\"确认\"}");
  87398. /***/ }),
  87399. /* 976 */
  87400. /*!************************************************************************************************************!*\
  87401. !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json ***!
  87402. \************************************************************************************************************/
  87403. /*! exports provided: uni-datetime-picker.selectDate, uni-datetime-picker.selectTime, uni-datetime-picker.selectDateTime, uni-datetime-picker.startDate, uni-datetime-picker.endDate, uni-datetime-picker.startTime, uni-datetime-picker.endTime, uni-datetime-picker.ok, uni-datetime-picker.clear, uni-datetime-picker.cancel, uni-datetime-picker.year, uni-datetime-picker.month, uni-calender.SUN, uni-calender.MON, uni-calender.TUE, uni-calender.WED, uni-calender.THU, uni-calender.FRI, uni-calender.SAT, uni-calender.confirm, default */
  87404. /***/ (function(module) {
  87405. module.exports = JSON.parse("{\"uni-datetime-picker.selectDate\":\"選擇日期\",\"uni-datetime-picker.selectTime\":\"選擇時間\",\"uni-datetime-picker.selectDateTime\":\"選擇日期時間\",\"uni-datetime-picker.startDate\":\"開始日期\",\"uni-datetime-picker.endDate\":\"結束日期\",\"uni-datetime-picker.startTime\":\"開始时间\",\"uni-datetime-picker.endTime\":\"結束时间\",\"uni-datetime-picker.ok\":\"確定\",\"uni-datetime-picker.clear\":\"清除\",\"uni-datetime-picker.cancel\":\"取消\",\"uni-datetime-picker.year\":\"年\",\"uni-datetime-picker.month\":\"月\",\"uni-calender.SUN\":\"日\",\"uni-calender.MON\":\"一\",\"uni-calender.TUE\":\"二\",\"uni-calender.WED\":\"三\",\"uni-calender.THU\":\"四\",\"uni-calender.FRI\":\"五\",\"uni-calender.SAT\":\"六\",\"uni-calender.confirm\":\"確認\"}");
  87406. /***/ }),
  87407. /* 977 */
  87408. /*!**************************************************************************************************!*\
  87409. !*** E:/git/2021项目/v3-H5/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js ***!
  87410. \**************************************************************************************************/
  87411. /*! no static exports found */
  87412. /***/ (function(module, exports, __webpack_require__) {
  87413. "use strict";
  87414. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  87415. Object.defineProperty(exports, "__esModule", {
  87416. value: true
  87417. });
  87418. exports.Calendar = void 0;
  87419. exports.addZero = addZero;
  87420. exports.checkDate = checkDate;
  87421. exports.dateCompare = dateCompare;
  87422. exports.fixIosDateFormat = fixIosDateFormat;
  87423. exports.getDate = getDate;
  87424. exports.getDateTime = getDateTime;
  87425. exports.getDefaultSecond = getDefaultSecond;
  87426. exports.getTime = getTime;
  87427. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  87428. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  87429. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  87430. var Calendar = /*#__PURE__*/function () {
  87431. function Calendar() {
  87432. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  87433. selected = _ref.selected,
  87434. startDate = _ref.startDate,
  87435. endDate = _ref.endDate,
  87436. range = _ref.range;
  87437. (0, _classCallCheck2.default)(this, Calendar);
  87438. // 当前日期
  87439. this.date = this.getDateObj(new Date()); // 当前初入日期
  87440. // 打点信息
  87441. this.selected = selected || [];
  87442. // 起始时间
  87443. this.startDate = startDate;
  87444. // 终止时间
  87445. this.endDate = endDate;
  87446. // 是否范围选择
  87447. this.range = range;
  87448. // 多选状态
  87449. this.cleanMultipleStatus();
  87450. // 每周日期
  87451. this.weeks = {};
  87452. this.lastHover = false;
  87453. }
  87454. /**
  87455. * 设置日期
  87456. * @param {Object} date
  87457. */
  87458. (0, _createClass2.default)(Calendar, [{
  87459. key: "setDate",
  87460. value: function setDate(date) {
  87461. var selectDate = this.getDateObj(date);
  87462. this.getWeeks(selectDate.fullDate);
  87463. }
  87464. /**
  87465. * 清理多选状态
  87466. */
  87467. }, {
  87468. key: "cleanMultipleStatus",
  87469. value: function cleanMultipleStatus() {
  87470. this.multipleStatus = {
  87471. before: '',
  87472. after: '',
  87473. data: []
  87474. };
  87475. }
  87476. }, {
  87477. key: "setStartDate",
  87478. value: function setStartDate(startDate) {
  87479. this.startDate = startDate;
  87480. }
  87481. }, {
  87482. key: "setEndDate",
  87483. value: function setEndDate(endDate) {
  87484. this.endDate = endDate;
  87485. }
  87486. }, {
  87487. key: "getPreMonthObj",
  87488. value: function getPreMonthObj(date) {
  87489. date = fixIosDateFormat(date);
  87490. date = new Date(date);
  87491. var oldMonth = date.getMonth();
  87492. date.setMonth(oldMonth - 1);
  87493. var newMonth = date.getMonth();
  87494. if (oldMonth !== 0 && newMonth - oldMonth === 0) {
  87495. date.setMonth(newMonth - 1);
  87496. }
  87497. return this.getDateObj(date);
  87498. }
  87499. }, {
  87500. key: "getNextMonthObj",
  87501. value: function getNextMonthObj(date) {
  87502. date = fixIosDateFormat(date);
  87503. date = new Date(date);
  87504. var oldMonth = date.getMonth();
  87505. date.setMonth(oldMonth + 1);
  87506. var newMonth = date.getMonth();
  87507. if (newMonth - oldMonth > 1) {
  87508. date.setMonth(newMonth - 1);
  87509. }
  87510. return this.getDateObj(date);
  87511. }
  87512. /**
  87513. * 获取指定格式Date对象
  87514. */
  87515. }, {
  87516. key: "getDateObj",
  87517. value: function getDateObj(date) {
  87518. date = fixIosDateFormat(date);
  87519. date = new Date(date);
  87520. return {
  87521. fullDate: getDate(date),
  87522. year: date.getFullYear(),
  87523. month: addZero(date.getMonth() + 1),
  87524. date: addZero(date.getDate()),
  87525. day: date.getDay()
  87526. };
  87527. }
  87528. /**
  87529. * 获取上一个月日期集合
  87530. */
  87531. }, {
  87532. key: "getPreMonthDays",
  87533. value: function getPreMonthDays(amount, dateObj) {
  87534. var result = [];
  87535. for (var i = amount - 1; i >= 0; i--) {
  87536. var month = dateObj.month - 1;
  87537. result.push({
  87538. date: new Date(dateObj.year, month, -i).getDate(),
  87539. month: month,
  87540. disable: true
  87541. });
  87542. }
  87543. return result;
  87544. }
  87545. /**
  87546. * 获取本月日期集合
  87547. */
  87548. }, {
  87549. key: "getCurrentMonthDays",
  87550. value: function getCurrentMonthDays(amount, dateObj) {
  87551. var _this = this;
  87552. var result = [];
  87553. var fullDate = this.date.fullDate;
  87554. var _loop = function _loop(i) {
  87555. var currentDate = "".concat(dateObj.year, "-").concat(dateObj.month, "-").concat(addZero(i));
  87556. var isToday = fullDate === currentDate;
  87557. // 获取打点信息
  87558. var info = _this.selected && _this.selected.find(function (item) {
  87559. if (_this.dateEqual(currentDate, item.date)) {
  87560. return item;
  87561. }
  87562. });
  87563. // 日期禁用
  87564. var disableBefore = true;
  87565. var disableAfter = true;
  87566. if (_this.startDate) {
  87567. disableBefore = dateCompare(_this.startDate, currentDate);
  87568. }
  87569. if (_this.endDate) {
  87570. disableAfter = dateCompare(currentDate, _this.endDate);
  87571. }
  87572. var multiples = _this.multipleStatus.data;
  87573. var multiplesStatus = -1;
  87574. if (_this.range && multiples) {
  87575. multiplesStatus = multiples.findIndex(function (item) {
  87576. return _this.dateEqual(item, currentDate);
  87577. });
  87578. }
  87579. var checked = multiplesStatus !== -1;
  87580. result.push({
  87581. fullDate: currentDate,
  87582. year: dateObj.year,
  87583. date: i,
  87584. multiple: _this.range ? checked : false,
  87585. beforeMultiple: _this.isLogicBefore(currentDate, _this.multipleStatus.before, _this.multipleStatus.after),
  87586. afterMultiple: _this.isLogicAfter(currentDate, _this.multipleStatus.before, _this.multipleStatus.after),
  87587. month: dateObj.month,
  87588. disable: _this.startDate && !dateCompare(_this.startDate, currentDate) || _this.endDate && !dateCompare(currentDate, _this.endDate),
  87589. isToday: isToday,
  87590. userChecked: false,
  87591. extraInfo: info
  87592. });
  87593. };
  87594. for (var i = 1; i <= amount; i++) {
  87595. _loop(i);
  87596. }
  87597. return result;
  87598. }
  87599. /**
  87600. * 获取下一个月日期集合
  87601. */
  87602. }, {
  87603. key: "_getNextMonthDays",
  87604. value: function _getNextMonthDays(amount, dateObj) {
  87605. var result = [];
  87606. var month = dateObj.month + 1;
  87607. for (var i = 1; i <= amount; i++) {
  87608. result.push({
  87609. date: i,
  87610. month: month,
  87611. disable: true
  87612. });
  87613. }
  87614. return result;
  87615. }
  87616. /**
  87617. * 获取当前日期详情
  87618. * @param {Object} date
  87619. */
  87620. }, {
  87621. key: "getInfo",
  87622. value: function getInfo(date) {
  87623. var _this2 = this;
  87624. if (!date) {
  87625. date = new Date();
  87626. }
  87627. var res = this.calendar.find(function (item) {
  87628. return item.fullDate === _this2.getDateObj(date).fullDate;
  87629. });
  87630. return res ? res : this.getDateObj(date);
  87631. }
  87632. /**
  87633. * 比较时间是否相等
  87634. */
  87635. }, {
  87636. key: "dateEqual",
  87637. value: function dateEqual(before, after) {
  87638. before = new Date(fixIosDateFormat(before));
  87639. after = new Date(fixIosDateFormat(after));
  87640. return before.valueOf() === after.valueOf();
  87641. }
  87642. /**
  87643. * 比较真实起始日期
  87644. */
  87645. }, {
  87646. key: "isLogicBefore",
  87647. value: function isLogicBefore(currentDate, before, after) {
  87648. var logicBefore = before;
  87649. if (before && after) {
  87650. logicBefore = dateCompare(before, after) ? before : after;
  87651. }
  87652. return this.dateEqual(logicBefore, currentDate);
  87653. }
  87654. }, {
  87655. key: "isLogicAfter",
  87656. value: function isLogicAfter(currentDate, before, after) {
  87657. var logicAfter = after;
  87658. if (before && after) {
  87659. logicAfter = dateCompare(before, after) ? after : before;
  87660. }
  87661. return this.dateEqual(logicAfter, currentDate);
  87662. }
  87663. /**
  87664. * 获取日期范围内所有日期
  87665. * @param {Object} begin
  87666. * @param {Object} end
  87667. */
  87668. }, {
  87669. key: "geDateAll",
  87670. value: function geDateAll(begin, end) {
  87671. var arr = [];
  87672. var ab = begin.split('-');
  87673. var ae = end.split('-');
  87674. var db = new Date();
  87675. db.setFullYear(ab[0], ab[1] - 1, ab[2]);
  87676. var de = new Date();
  87677. de.setFullYear(ae[0], ae[1] - 1, ae[2]);
  87678. var unixDb = db.getTime() - 24 * 60 * 60 * 1000;
  87679. var unixDe = de.getTime() - 24 * 60 * 60 * 1000;
  87680. for (var k = unixDb; k <= unixDe;) {
  87681. k = k + 24 * 60 * 60 * 1000;
  87682. arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
  87683. }
  87684. return arr;
  87685. }
  87686. /**
  87687. * 获取多选状态
  87688. */
  87689. }, {
  87690. key: "setMultiple",
  87691. value: function setMultiple(fullDate) {
  87692. if (!this.range) return;
  87693. var _this$multipleStatus = this.multipleStatus,
  87694. before = _this$multipleStatus.before,
  87695. after = _this$multipleStatus.after;
  87696. if (before && after) {
  87697. if (!this.lastHover) {
  87698. this.lastHover = true;
  87699. return;
  87700. }
  87701. this.multipleStatus.before = fullDate;
  87702. this.multipleStatus.after = '';
  87703. this.multipleStatus.data = [];
  87704. this.multipleStatus.fulldate = '';
  87705. this.lastHover = false;
  87706. } else {
  87707. if (!before) {
  87708. this.multipleStatus.before = fullDate;
  87709. this.multipleStatus.after = undefined;
  87710. this.lastHover = false;
  87711. } else {
  87712. this.multipleStatus.after = fullDate;
  87713. if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
  87714. this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
  87715. } else {
  87716. this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
  87717. }
  87718. this.lastHover = true;
  87719. }
  87720. }
  87721. this.getWeeks(fullDate);
  87722. }
  87723. /**
  87724. * 鼠标 hover 更新多选状态
  87725. */
  87726. }, {
  87727. key: "setHoverMultiple",
  87728. value: function setHoverMultiple(fullDate) {
  87729. //抖音小程序点击会触发hover事件,需要避免一下
  87730. if (!this.range || this.lastHover) return;
  87731. var before = this.multipleStatus.before;
  87732. if (!before) {
  87733. this.multipleStatus.before = fullDate;
  87734. } else {
  87735. this.multipleStatus.after = fullDate;
  87736. if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
  87737. this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
  87738. } else {
  87739. this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
  87740. }
  87741. }
  87742. this.getWeeks(fullDate);
  87743. }
  87744. /**
  87745. * 更新默认值多选状态
  87746. */
  87747. }, {
  87748. key: "setDefaultMultiple",
  87749. value: function setDefaultMultiple(before, after) {
  87750. this.multipleStatus.before = before;
  87751. this.multipleStatus.after = after;
  87752. if (before && after) {
  87753. if (dateCompare(before, after)) {
  87754. this.multipleStatus.data = this.geDateAll(before, after);
  87755. this.getWeeks(after);
  87756. } else {
  87757. this.multipleStatus.data = this.geDateAll(after, before);
  87758. this.getWeeks(before);
  87759. }
  87760. }
  87761. }
  87762. /**
  87763. * 获取每周数据
  87764. * @param {Object} dateData
  87765. */
  87766. }, {
  87767. key: "getWeeks",
  87768. value: function getWeeks(dateData) {
  87769. var _this$getDateObj = this.getDateObj(dateData),
  87770. year = _this$getDateObj.year,
  87771. month = _this$getDateObj.month;
  87772. var preMonthDayAmount = new Date(year, month - 1, 1).getDay();
  87773. var preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
  87774. var currentMonthDayAmount = new Date(year, month, 0).getDate();
  87775. var currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
  87776. var nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
  87777. var nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
  87778. var calendarDays = [].concat((0, _toConsumableArray2.default)(preMonthDays), (0, _toConsumableArray2.default)(currentMonthDays), (0, _toConsumableArray2.default)(nextMonthDays));
  87779. var weeks = new Array(6);
  87780. for (var i = 0; i < calendarDays.length; i++) {
  87781. var index = Math.floor(i / 7);
  87782. if (!weeks[index]) {
  87783. weeks[index] = new Array(7);
  87784. }
  87785. weeks[index][i % 7] = calendarDays[i];
  87786. }
  87787. this.calendar = calendarDays;
  87788. this.weeks = weeks;
  87789. }
  87790. }]);
  87791. return Calendar;
  87792. }();
  87793. exports.Calendar = Calendar;
  87794. function getDateTime(date, hideSecond) {
  87795. return "".concat(getDate(date), " ").concat(getTime(date, hideSecond));
  87796. }
  87797. function getDate(date) {
  87798. date = fixIosDateFormat(date);
  87799. date = new Date(date);
  87800. var year = date.getFullYear();
  87801. var month = date.getMonth() + 1;
  87802. var day = date.getDate();
  87803. return "".concat(year, "-").concat(addZero(month), "-").concat(addZero(day));
  87804. }
  87805. function getTime(date, hideSecond) {
  87806. date = fixIosDateFormat(date);
  87807. date = new Date(date);
  87808. var hour = date.getHours();
  87809. var minute = date.getMinutes();
  87810. var second = date.getSeconds();
  87811. return hideSecond ? "".concat(addZero(hour), ":").concat(addZero(minute)) : "".concat(addZero(hour), ":").concat(addZero(minute), ":").concat(addZero(second));
  87812. }
  87813. function addZero(num) {
  87814. if (num < 10) {
  87815. num = "0".concat(num);
  87816. }
  87817. return num;
  87818. }
  87819. function getDefaultSecond(hideSecond) {
  87820. return hideSecond ? '00:00' : '00:00:00';
  87821. }
  87822. function dateCompare(startDate, endDate) {
  87823. startDate = new Date(fixIosDateFormat(startDate));
  87824. endDate = new Date(fixIosDateFormat(endDate));
  87825. return startDate <= endDate;
  87826. }
  87827. function checkDate(date) {
  87828. var dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
  87829. return date.match(dateReg);
  87830. }
  87831. //ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号
  87832. var dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
  87833. function fixIosDateFormat(value) {
  87834. if (typeof value === 'string' && dateTimeReg.test(value)) {
  87835. value = value.replace(/-/g, '/');
  87836. }
  87837. return value;
  87838. }
  87839. /***/ }),
  87840. /* 978 */,
  87841. /* 979 */,
  87842. /* 980 */,
  87843. /* 981 */,
  87844. /* 982 */,
  87845. /* 983 */,
  87846. /* 984 */,
  87847. /* 985 */
  87848. /*!*********************************************************************************************************!*\
  87849. !*** E:/git/2021项目/v3-H5/uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.js ***!
  87850. \*********************************************************************************************************/
  87851. /*! no static exports found */
  87852. /***/ (function(module, exports, __webpack_require__) {
  87853. "use strict";
  87854. /* WEBPACK VAR INJECTION */(function(uniCloud) {
  87855. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  87856. Object.defineProperty(exports, "__esModule", {
  87857. value: true
  87858. });
  87859. exports.default = void 0;
  87860. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  87861. var _default2 = {
  87862. props: {
  87863. localdata: {
  87864. type: [Array, Object],
  87865. default: function _default() {
  87866. return [];
  87867. }
  87868. },
  87869. spaceInfo: {
  87870. type: Object,
  87871. default: function _default() {
  87872. return {};
  87873. }
  87874. },
  87875. collection: {
  87876. type: String,
  87877. default: ''
  87878. },
  87879. action: {
  87880. type: String,
  87881. default: ''
  87882. },
  87883. field: {
  87884. type: String,
  87885. default: ''
  87886. },
  87887. orderby: {
  87888. type: String,
  87889. default: ''
  87890. },
  87891. where: {
  87892. type: [String, Object],
  87893. default: ''
  87894. },
  87895. pageData: {
  87896. type: String,
  87897. default: 'add'
  87898. },
  87899. pageCurrent: {
  87900. type: Number,
  87901. default: 1
  87902. },
  87903. pageSize: {
  87904. type: Number,
  87905. default: 20
  87906. },
  87907. getcount: {
  87908. type: [Boolean, String],
  87909. default: false
  87910. },
  87911. getone: {
  87912. type: [Boolean, String],
  87913. default: false
  87914. },
  87915. gettree: {
  87916. type: [Boolean, String],
  87917. default: false
  87918. },
  87919. manual: {
  87920. type: Boolean,
  87921. default: false
  87922. },
  87923. value: {
  87924. type: [Array, String, Number],
  87925. default: function _default() {
  87926. return [];
  87927. }
  87928. },
  87929. modelValue: {
  87930. type: [Array, String, Number],
  87931. default: function _default() {
  87932. return [];
  87933. }
  87934. },
  87935. preload: {
  87936. type: Boolean,
  87937. default: false
  87938. },
  87939. stepSearh: {
  87940. type: Boolean,
  87941. default: true
  87942. },
  87943. selfField: {
  87944. type: String,
  87945. default: ''
  87946. },
  87947. parentField: {
  87948. type: String,
  87949. default: ''
  87950. },
  87951. multiple: {
  87952. type: Boolean,
  87953. default: false
  87954. },
  87955. map: {
  87956. type: Object,
  87957. default: function _default() {
  87958. return {
  87959. text: "text",
  87960. value: "value"
  87961. };
  87962. }
  87963. }
  87964. },
  87965. data: function data() {
  87966. return {
  87967. loading: false,
  87968. errorMessage: '',
  87969. loadMore: {
  87970. contentdown: '',
  87971. contentrefresh: '',
  87972. contentnomore: ''
  87973. },
  87974. dataList: [],
  87975. selected: [],
  87976. selectedIndex: 0,
  87977. page: {
  87978. current: this.pageCurrent,
  87979. size: this.pageSize,
  87980. count: 0
  87981. }
  87982. };
  87983. },
  87984. computed: {
  87985. isLocaldata: function isLocaldata() {
  87986. return !this.collection.length;
  87987. },
  87988. postField: function postField() {
  87989. var fields = [this.field];
  87990. if (this.parentField) {
  87991. fields.push("".concat(this.parentField, " as parent_value"));
  87992. }
  87993. return fields.join(',');
  87994. },
  87995. dataValue: function dataValue() {
  87996. var isModelValue = Array.isArray(this.modelValue) ? this.modelValue.length > 0 : this.modelValue !== null || this.modelValue !== undefined;
  87997. return isModelValue ? this.modelValue : this.value;
  87998. },
  87999. hasValue: function hasValue() {
  88000. if (typeof this.dataValue === 'number') {
  88001. return true;
  88002. }
  88003. return this.dataValue != null && this.dataValue.length > 0;
  88004. }
  88005. },
  88006. created: function created() {
  88007. var _this = this;
  88008. this.$watch(function () {
  88009. var al = [];
  88010. ['pageCurrent', 'pageSize', 'spaceInfo', 'value', 'modelValue', 'localdata', 'collection', 'action', 'field', 'orderby', 'where', 'getont', 'getcount', 'gettree'].forEach(function (key) {
  88011. al.push(_this[key]);
  88012. });
  88013. return al;
  88014. }, function (newValue, oldValue) {
  88015. var needReset = false;
  88016. for (var i = 2; i < newValue.length; i++) {
  88017. if (newValue[i] != oldValue[i]) {
  88018. needReset = true;
  88019. break;
  88020. }
  88021. }
  88022. if (newValue[0] != oldValue[0]) {
  88023. _this.page.current = _this.pageCurrent;
  88024. }
  88025. _this.page.size = _this.pageSize;
  88026. _this.onPropsChange();
  88027. });
  88028. this._treeData = [];
  88029. },
  88030. methods: {
  88031. onPropsChange: function onPropsChange() {
  88032. this._treeData = [];
  88033. },
  88034. getCommand: function getCommand() {
  88035. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  88036. /* eslint-disable no-undef */
  88037. var db = uniCloud.database(this.spaceInfo);
  88038. var action = options.action || this.action;
  88039. if (action) {
  88040. db = db.action(action);
  88041. }
  88042. var collection = options.collection || this.collection;
  88043. db = db.collection(collection);
  88044. var where = options.where || this.where;
  88045. if (!(!where || !Object.keys(where).length)) {
  88046. db = db.where(where);
  88047. }
  88048. var field = options.field || this.field;
  88049. if (field) {
  88050. db = db.field(field);
  88051. }
  88052. var orderby = options.orderby || this.orderby;
  88053. if (orderby) {
  88054. db = db.orderBy(orderby);
  88055. }
  88056. var current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current;
  88057. var size = options.pageSize !== undefined ? options.pageSize : this.page.size;
  88058. var getCount = options.getcount !== undefined ? options.getcount : this.getcount;
  88059. var getTree = options.gettree !== undefined ? options.gettree : this.gettree;
  88060. var getOptions = {
  88061. getCount: getCount,
  88062. getTree: getTree
  88063. };
  88064. if (options.getTreePath) {
  88065. getOptions.getTreePath = options.getTreePath;
  88066. }
  88067. db = db.skip(size * (current - 1)).limit(size).get(getOptions);
  88068. return db;
  88069. },
  88070. getNodeData: function getNodeData(callback) {
  88071. var _this2 = this;
  88072. if (this.loading) {
  88073. return;
  88074. }
  88075. this.loading = true;
  88076. this.getCommand({
  88077. field: this.postField,
  88078. where: this._pathWhere()
  88079. }).then(function (res) {
  88080. _this2.loading = false;
  88081. _this2.selected = res.result.data;
  88082. callback && callback();
  88083. }).catch(function (err) {
  88084. _this2.loading = false;
  88085. _this2.errorMessage = err;
  88086. });
  88087. },
  88088. getTreePath: function getTreePath(callback) {
  88089. var _this3 = this;
  88090. if (this.loading) {
  88091. return;
  88092. }
  88093. this.loading = true;
  88094. this.getCommand({
  88095. field: this.postField,
  88096. getTreePath: {
  88097. startWith: "".concat(this.selfField, "=='").concat(this.dataValue, "'")
  88098. }
  88099. }).then(function (res) {
  88100. _this3.loading = false;
  88101. var treePath = [];
  88102. _this3._extractTreePath(res.result.data, treePath);
  88103. _this3.selected = treePath;
  88104. callback && callback();
  88105. }).catch(function (err) {
  88106. _this3.loading = false;
  88107. _this3.errorMessage = err;
  88108. });
  88109. },
  88110. loadData: function loadData() {
  88111. var _this4 = this;
  88112. if (this.isLocaldata) {
  88113. this._processLocalData();
  88114. return;
  88115. }
  88116. if (this.dataValue != null) {
  88117. this._loadNodeData(function (data) {
  88118. _this4._treeData = data;
  88119. _this4._updateBindData();
  88120. _this4._updateSelected();
  88121. });
  88122. return;
  88123. }
  88124. if (this.stepSearh) {
  88125. this._loadNodeData(function (data) {
  88126. _this4._treeData = data;
  88127. _this4._updateBindData();
  88128. });
  88129. } else {
  88130. this._loadAllData(function (data) {
  88131. _this4._treeData = [];
  88132. _this4._extractTree(data, _this4._treeData, null);
  88133. _this4._updateBindData();
  88134. });
  88135. }
  88136. },
  88137. _loadAllData: function _loadAllData(callback) {
  88138. var _this5 = this;
  88139. if (this.loading) {
  88140. return;
  88141. }
  88142. this.loading = true;
  88143. this.getCommand({
  88144. field: this.postField,
  88145. gettree: true,
  88146. startwith: "".concat(this.selfField, "=='").concat(this.dataValue, "'")
  88147. }).then(function (res) {
  88148. _this5.loading = false;
  88149. callback(res.result.data);
  88150. _this5.onDataChange();
  88151. }).catch(function (err) {
  88152. _this5.loading = false;
  88153. _this5.errorMessage = err;
  88154. });
  88155. },
  88156. _loadNodeData: function _loadNodeData(callback, pw) {
  88157. var _this6 = this;
  88158. if (this.loading) {
  88159. return;
  88160. }
  88161. this.loading = true;
  88162. this.getCommand({
  88163. field: this.postField,
  88164. where: pw || this._postWhere(),
  88165. pageSize: 500
  88166. }).then(function (res) {
  88167. _this6.loading = false;
  88168. callback(res.result.data);
  88169. _this6.onDataChange();
  88170. }).catch(function (err) {
  88171. _this6.loading = false;
  88172. _this6.errorMessage = err;
  88173. });
  88174. },
  88175. _pathWhere: function _pathWhere() {
  88176. var result = [];
  88177. var where_field = this._getParentNameByField();
  88178. if (where_field) {
  88179. result.push("".concat(where_field, " == '").concat(this.dataValue, "'"));
  88180. }
  88181. if (this.where) {
  88182. return "(".concat(this.where, ") && (").concat(result.join(' || '), ")");
  88183. }
  88184. return result.join(' || ');
  88185. },
  88186. _postWhere: function _postWhere() {
  88187. var result = [];
  88188. var selected = this.selected;
  88189. var parentField = this.parentField;
  88190. if (parentField) {
  88191. result.push("".concat(parentField, " == null || ").concat(parentField, " == \"\""));
  88192. }
  88193. if (selected.length) {
  88194. for (var i = 0; i < selected.length - 1; i++) {
  88195. result.push("".concat(parentField, " == '").concat(selected[i].value, "'"));
  88196. }
  88197. }
  88198. var where = [];
  88199. if (this.where) {
  88200. where.push("(".concat(this.where, ")"));
  88201. }
  88202. if (result.length) {
  88203. where.push("(".concat(result.join(' || '), ")"));
  88204. }
  88205. return where.join(' && ');
  88206. },
  88207. _nodeWhere: function _nodeWhere() {
  88208. var result = [];
  88209. var selected = this.selected;
  88210. if (selected.length) {
  88211. result.push("".concat(this.parentField, " == '").concat(selected[selected.length - 1].value, "'"));
  88212. }
  88213. if (this.where) {
  88214. return "(".concat(this.where, ") && (").concat(result.join(' || '), ")");
  88215. }
  88216. return result.join(' || ');
  88217. },
  88218. _getParentNameByField: function _getParentNameByField() {
  88219. var fields = this.field.split(',');
  88220. var where_field = null;
  88221. for (var i = 0; i < fields.length; i++) {
  88222. var items = fields[i].split('as');
  88223. if (items.length < 2) {
  88224. continue;
  88225. }
  88226. if (items[1].trim() === 'value') {
  88227. where_field = items[0].trim();
  88228. break;
  88229. }
  88230. }
  88231. return where_field;
  88232. },
  88233. _isTreeView: function _isTreeView() {
  88234. return this.parentField && this.selfField;
  88235. },
  88236. _updateSelected: function _updateSelected() {
  88237. var dl = this.dataList;
  88238. var sl = this.selected;
  88239. var textField = this.map.text;
  88240. var valueField = this.map.value;
  88241. for (var i = 0; i < sl.length; i++) {
  88242. var value = sl[i].value;
  88243. var dl2 = dl[i];
  88244. for (var j = 0; j < dl2.length; j++) {
  88245. var item2 = dl2[j];
  88246. if (item2[valueField] === value) {
  88247. sl[i].text = item2[textField];
  88248. break;
  88249. }
  88250. }
  88251. }
  88252. },
  88253. _updateBindData: function _updateBindData(node) {
  88254. var _this$_filterData = this._filterData(this._treeData, this.selected),
  88255. dataList = _this$_filterData.dataList,
  88256. hasNodes = _this$_filterData.hasNodes;
  88257. var isleaf = this._stepSearh === false && !hasNodes;
  88258. if (node) {
  88259. node.isleaf = isleaf;
  88260. }
  88261. this.dataList = dataList;
  88262. this.selectedIndex = dataList.length - 1;
  88263. if (!isleaf && this.selected.length < dataList.length) {
  88264. this.selected.push({
  88265. value: null,
  88266. text: "请选择"
  88267. });
  88268. }
  88269. return {
  88270. isleaf: isleaf,
  88271. hasNodes: hasNodes
  88272. };
  88273. },
  88274. _filterData: function _filterData(data, paths) {
  88275. var dataList = [];
  88276. var hasNodes = true;
  88277. dataList.push(data.filter(function (item) {
  88278. return item.parent_value === null || item.parent_value === undefined || item.parent_value === '';
  88279. }));
  88280. for (var i = 0; i < paths.length; i++) {
  88281. var value = paths[i].value;
  88282. var nodes = data.filter(function (item) {
  88283. return item.parent_value === value;
  88284. });
  88285. if (nodes.length) {
  88286. dataList.push(nodes);
  88287. } else {
  88288. hasNodes = false;
  88289. }
  88290. }
  88291. return {
  88292. dataList: dataList,
  88293. hasNodes: hasNodes
  88294. };
  88295. },
  88296. _extractTree: function _extractTree(nodes, result, parent_value) {
  88297. var list = result || [];
  88298. var valueField = this.map.value;
  88299. for (var i = 0; i < nodes.length; i++) {
  88300. var node = nodes[i];
  88301. var child = {};
  88302. for (var key in node) {
  88303. if (key !== 'children') {
  88304. child[key] = node[key];
  88305. }
  88306. }
  88307. if (parent_value !== null && parent_value !== undefined && parent_value !== '') {
  88308. child.parent_value = parent_value;
  88309. }
  88310. result.push(child);
  88311. var children = node.children;
  88312. if (children) {
  88313. this._extractTree(children, result, node[valueField]);
  88314. }
  88315. }
  88316. },
  88317. _extractTreePath: function _extractTreePath(nodes, result) {
  88318. var list = result || [];
  88319. for (var i = 0; i < nodes.length; i++) {
  88320. var node = nodes[i];
  88321. var child = {};
  88322. for (var key in node) {
  88323. if (key !== 'children') {
  88324. child[key] = node[key];
  88325. }
  88326. }
  88327. result.push(child);
  88328. var children = node.children;
  88329. if (children) {
  88330. this._extractTreePath(children, result);
  88331. }
  88332. }
  88333. },
  88334. _findNodePath: function _findNodePath(key, nodes) {
  88335. var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  88336. var textField = this.map.text;
  88337. var valueField = this.map.value;
  88338. for (var i = 0; i < nodes.length; i++) {
  88339. var node = nodes[i];
  88340. var children = node.children;
  88341. var text = node[textField];
  88342. var value = node[valueField];
  88343. path.push({
  88344. value: value,
  88345. text: text
  88346. });
  88347. if (value === key) {
  88348. return path;
  88349. }
  88350. if (children) {
  88351. var p = this._findNodePath(key, children, path);
  88352. if (p.length) {
  88353. return p;
  88354. }
  88355. }
  88356. path.pop();
  88357. }
  88358. return [];
  88359. },
  88360. _processLocalData: function _processLocalData() {
  88361. this._treeData = [];
  88362. this._extractTree(this.localdata, this._treeData);
  88363. var inputValue = this.dataValue;
  88364. if (inputValue === undefined) {
  88365. return;
  88366. }
  88367. if (Array.isArray(inputValue)) {
  88368. inputValue = inputValue[inputValue.length - 1];
  88369. if ((0, _typeof2.default)(inputValue) === 'object' && inputValue[this.map.value]) {
  88370. inputValue = inputValue[this.map.value];
  88371. }
  88372. }
  88373. this.selected = this._findNodePath(inputValue, this.localdata);
  88374. }
  88375. }
  88376. };
  88377. exports.default = _default2;
  88378. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js */ 986)["uniCloud"]))
  88379. /***/ }),
  88380. /* 986 */
  88381. /*!************************************************************************************!*\
  88382. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js ***!
  88383. \************************************************************************************/
  88384. /*! no static exports found */
  88385. /***/ (function(module, exports, __webpack_require__) {
  88386. "use strict";
  88387. /* WEBPACK VAR INJECTION */(function(global, uni, wx) {
  88388. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  88389. Object.defineProperty(exports, "__esModule", {
  88390. value: true
  88391. });
  88392. exports.uniCloud = exports.default = exports.UniCloudError = void 0;
  88393. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 50));
  88394. var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ 987));
  88395. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  88396. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  88397. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  88398. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 52));
  88399. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  88400. var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ 988));
  88401. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ 989));
  88402. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ 990));
  88403. var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ 991));
  88404. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  88405. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  88406. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 993));
  88407. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e34) { throw _e34; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e35) { didErr = true; err = _e35; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
  88408. 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); }
  88409. 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; }
  88410. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  88411. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  88412. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
  88413. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  88414. "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;
  88415. function t(e) {
  88416. return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
  88417. }
  88418. function n(e, t, n) {
  88419. return e(n = {
  88420. path: t,
  88421. exports: {},
  88422. require: function require(e, t) {
  88423. return function () {
  88424. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  88425. }(null == t && n.path);
  88426. }
  88427. }, n.exports), n.exports;
  88428. }
  88429. var s = n(function (e, t) {
  88430. var n;
  88431. e.exports = (n = n || function (e, t) {
  88432. var n = Object.create || function () {
  88433. function e() {}
  88434. return function (t) {
  88435. var n;
  88436. return e.prototype = t, n = new e(), e.prototype = null, n;
  88437. };
  88438. }(),
  88439. s = {},
  88440. r = s.lib = {},
  88441. i = r.Base = {
  88442. extend: function extend(e) {
  88443. var t = n(this);
  88444. return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function () {
  88445. t.$super.init.apply(this, arguments);
  88446. }), t.init.prototype = t, t.$super = this, t;
  88447. },
  88448. create: function create() {
  88449. var e = this.extend();
  88450. return e.init.apply(e, arguments), e;
  88451. },
  88452. init: function init() {},
  88453. mixIn: function mixIn(e) {
  88454. for (var t in e) {
  88455. e.hasOwnProperty(t) && (this[t] = e[t]);
  88456. }
  88457. e.hasOwnProperty("toString") && (this.toString = e.toString);
  88458. },
  88459. clone: function clone() {
  88460. return this.init.prototype.extend(this);
  88461. }
  88462. },
  88463. o = r.WordArray = i.extend({
  88464. init: function init(e, n) {
  88465. e = this.words = e || [], this.sigBytes = n != t ? n : 4 * e.length;
  88466. },
  88467. toString: function toString(e) {
  88468. return (e || c).stringify(this);
  88469. },
  88470. concat: function concat(e) {
  88471. var t = this.words,
  88472. n = e.words,
  88473. s = this.sigBytes,
  88474. r = e.sigBytes;
  88475. if (this.clamp(), s % 4) for (var i = 0; i < r; i++) {
  88476. var o = n[i >>> 2] >>> 24 - i % 4 * 8 & 255;
  88477. t[s + i >>> 2] |= o << 24 - (s + i) % 4 * 8;
  88478. } else for (i = 0; i < r; i += 4) {
  88479. t[s + i >>> 2] = n[i >>> 2];
  88480. }
  88481. return this.sigBytes += r, this;
  88482. },
  88483. clamp: function clamp() {
  88484. var t = this.words,
  88485. n = this.sigBytes;
  88486. t[n >>> 2] &= 4294967295 << 32 - n % 4 * 8, t.length = e.ceil(n / 4);
  88487. },
  88488. clone: function clone() {
  88489. var e = i.clone.call(this);
  88490. return e.words = this.words.slice(0), e;
  88491. },
  88492. random: function random(t) {
  88493. for (var n, s = [], r = function r(t) {
  88494. var n = 987654321,
  88495. s = 4294967295;
  88496. return function () {
  88497. var r = ((n = 36969 * (65535 & n) + (n >> 16) & s) << 16) + (t = 18e3 * (65535 & t) + (t >> 16) & s) & s;
  88498. return r /= 4294967296, (r += .5) * (e.random() > .5 ? 1 : -1);
  88499. };
  88500. }, i = 0; i < t; i += 4) {
  88501. var a = r(4294967296 * (n || e.random()));
  88502. n = 987654071 * a(), s.push(4294967296 * a() | 0);
  88503. }
  88504. return new o.init(s, t);
  88505. }
  88506. }),
  88507. a = s.enc = {},
  88508. c = a.Hex = {
  88509. stringify: function stringify(e) {
  88510. for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
  88511. var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
  88512. s.push((i >>> 4).toString(16)), s.push((15 & i).toString(16));
  88513. }
  88514. return s.join("");
  88515. },
  88516. parse: function parse(e) {
  88517. for (var t = e.length, n = [], s = 0; s < t; s += 2) {
  88518. n[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;
  88519. }
  88520. return new o.init(n, t / 2);
  88521. }
  88522. },
  88523. u = a.Latin1 = {
  88524. stringify: function stringify(e) {
  88525. for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
  88526. var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
  88527. s.push(String.fromCharCode(i));
  88528. }
  88529. return s.join("");
  88530. },
  88531. parse: function parse(e) {
  88532. for (var t = e.length, n = [], s = 0; s < t; s++) {
  88533. n[s >>> 2] |= (255 & e.charCodeAt(s)) << 24 - s % 4 * 8;
  88534. }
  88535. return new o.init(n, t);
  88536. }
  88537. },
  88538. h = a.Utf8 = {
  88539. stringify: function stringify(e) {
  88540. try {
  88541. return decodeURIComponent(escape(u.stringify(e)));
  88542. } catch (e) {
  88543. throw new Error("Malformed UTF-8 data");
  88544. }
  88545. },
  88546. parse: function parse(e) {
  88547. return u.parse(unescape(encodeURIComponent(e)));
  88548. }
  88549. },
  88550. l = r.BufferedBlockAlgorithm = i.extend({
  88551. reset: function reset() {
  88552. this._data = new o.init(), this._nDataBytes = 0;
  88553. },
  88554. _append: function _append(e) {
  88555. "string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;
  88556. },
  88557. _process: function _process(t) {
  88558. var n = this._data,
  88559. s = n.words,
  88560. r = n.sigBytes,
  88561. i = this.blockSize,
  88562. a = r / (4 * i),
  88563. c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * i,
  88564. u = e.min(4 * c, r);
  88565. if (c) {
  88566. for (var h = 0; h < c; h += i) {
  88567. this._doProcessBlock(s, h);
  88568. }
  88569. var l = s.splice(0, c);
  88570. n.sigBytes -= u;
  88571. }
  88572. return new o.init(l, u);
  88573. },
  88574. clone: function clone() {
  88575. var e = i.clone.call(this);
  88576. return e._data = this._data.clone(), e;
  88577. },
  88578. _minBufferSize: 0
  88579. });
  88580. r.Hasher = l.extend({
  88581. cfg: i.extend(),
  88582. init: function init(e) {
  88583. this.cfg = this.cfg.extend(e), this.reset();
  88584. },
  88585. reset: function reset() {
  88586. l.reset.call(this), this._doReset();
  88587. },
  88588. update: function update(e) {
  88589. return this._append(e), this._process(), this;
  88590. },
  88591. finalize: function finalize(e) {
  88592. return e && this._append(e), this._doFinalize();
  88593. },
  88594. blockSize: 16,
  88595. _createHelper: function _createHelper(e) {
  88596. return function (t, n) {
  88597. return new e.init(n).finalize(t);
  88598. };
  88599. },
  88600. _createHmacHelper: function _createHmacHelper(e) {
  88601. return function (t, n) {
  88602. return new d.HMAC.init(e, n).finalize(t);
  88603. };
  88604. }
  88605. });
  88606. var d = s.algo = {};
  88607. return s;
  88608. }(Math), n);
  88609. }),
  88610. r = s,
  88611. i = (n(function (e, t) {
  88612. var n;
  88613. e.exports = (n = r, function (e) {
  88614. var t = n,
  88615. s = t.lib,
  88616. r = s.WordArray,
  88617. i = s.Hasher,
  88618. o = t.algo,
  88619. a = [];
  88620. !function () {
  88621. for (var t = 0; t < 64; t++) {
  88622. a[t] = 4294967296 * e.abs(e.sin(t + 1)) | 0;
  88623. }
  88624. }();
  88625. var c = o.MD5 = i.extend({
  88626. _doReset: function _doReset() {
  88627. this._hash = new r.init([1732584193, 4023233417, 2562383102, 271733878]);
  88628. },
  88629. _doProcessBlock: function _doProcessBlock(e, t) {
  88630. for (var n = 0; n < 16; n++) {
  88631. var s = t + n,
  88632. r = e[s];
  88633. e[s] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8);
  88634. }
  88635. var i = this._hash.words,
  88636. o = e[t + 0],
  88637. c = e[t + 1],
  88638. p = e[t + 2],
  88639. f = e[t + 3],
  88640. g = e[t + 4],
  88641. m = e[t + 5],
  88642. y = e[t + 6],
  88643. _ = e[t + 7],
  88644. w = e[t + 8],
  88645. v = e[t + 9],
  88646. I = e[t + 10],
  88647. S = e[t + 11],
  88648. T = e[t + 12],
  88649. b = e[t + 13],
  88650. E = e[t + 14],
  88651. k = e[t + 15],
  88652. P = i[0],
  88653. C = i[1],
  88654. A = i[2],
  88655. O = i[3];
  88656. P = u(P, C, A, O, o, 7, a[0]), O = u(O, P, C, A, c, 12, a[1]), A = u(A, O, P, C, p, 17, a[2]), C = u(C, A, O, P, f, 22, a[3]), P = u(P, C, A, O, g, 7, a[4]), O = u(O, P, C, A, m, 12, a[5]), A = u(A, O, P, C, y, 17, a[6]), C = u(C, A, O, P, _, 22, a[7]), P = u(P, C, A, O, w, 7, a[8]), O = u(O, P, C, A, v, 12, a[9]), A = u(A, O, P, C, I, 17, a[10]), C = u(C, A, O, P, S, 22, a[11]), P = u(P, C, A, O, T, 7, a[12]), O = u(O, P, C, A, b, 12, a[13]), A = u(A, O, P, C, E, 17, a[14]), P = h(P, C = u(C, A, O, P, k, 22, a[15]), A, O, c, 5, a[16]), O = h(O, P, C, A, y, 9, a[17]), A = h(A, O, P, C, S, 14, a[18]), C = h(C, A, O, P, o, 20, a[19]), P = h(P, C, A, O, m, 5, a[20]), O = h(O, P, C, A, I, 9, a[21]), A = h(A, O, P, C, k, 14, a[22]), C = h(C, A, O, P, g, 20, a[23]), P = h(P, C, A, O, v, 5, a[24]), O = h(O, P, C, A, E, 9, a[25]), A = h(A, O, P, C, f, 14, a[26]), C = h(C, A, O, P, w, 20, a[27]), P = h(P, C, A, O, b, 5, a[28]), O = h(O, P, C, A, p, 9, a[29]), A = h(A, O, P, C, _, 14, a[30]), P = l(P, C = h(C, A, O, P, T, 20, a[31]), A, O, m, 4, a[32]), O = l(O, P, C, A, w, 11, a[33]), A = l(A, O, P, C, S, 16, a[34]), C = l(C, A, O, P, E, 23, a[35]), P = l(P, C, A, O, c, 4, a[36]), O = l(O, P, C, A, g, 11, a[37]), A = l(A, O, P, C, _, 16, a[38]), C = l(C, A, O, P, I, 23, a[39]), P = l(P, C, A, O, b, 4, a[40]), O = l(O, P, C, A, o, 11, a[41]), A = l(A, O, P, C, f, 16, a[42]), C = l(C, A, O, P, y, 23, a[43]), P = l(P, C, A, O, v, 4, a[44]), O = l(O, P, C, A, T, 11, a[45]), A = l(A, O, P, C, k, 16, a[46]), P = d(P, C = l(C, A, O, P, p, 23, a[47]), A, O, o, 6, a[48]), O = d(O, P, C, A, _, 10, a[49]), A = d(A, O, P, C, E, 15, a[50]), C = d(C, A, O, P, m, 21, a[51]), P = d(P, C, A, O, T, 6, a[52]), O = d(O, P, C, A, f, 10, a[53]), A = d(A, O, P, C, I, 15, a[54]), C = d(C, A, O, P, c, 21, a[55]), P = d(P, C, A, O, w, 6, a[56]), O = d(O, P, C, A, k, 10, a[57]), A = d(A, O, P, C, y, 15, a[58]), C = d(C, A, O, P, b, 21, a[59]), P = d(P, C, A, O, g, 6, a[60]), O = d(O, P, C, A, S, 10, a[61]), A = d(A, O, P, C, p, 15, a[62]), C = d(C, A, O, P, v, 21, a[63]), i[0] = i[0] + P | 0, i[1] = i[1] + C | 0, i[2] = i[2] + A | 0, i[3] = i[3] + O | 0;
  88657. },
  88658. _doFinalize: function _doFinalize() {
  88659. var t = this._data,
  88660. n = t.words,
  88661. s = 8 * this._nDataBytes,
  88662. r = 8 * t.sigBytes;
  88663. n[r >>> 5] |= 128 << 24 - r % 32;
  88664. var i = e.floor(s / 4294967296),
  88665. o = s;
  88666. n[15 + (r + 64 >>> 9 << 4)] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8), n[14 + (r + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), t.sigBytes = 4 * (n.length + 1), this._process();
  88667. for (var a = this._hash, c = a.words, u = 0; u < 4; u++) {
  88668. var h = c[u];
  88669. c[u] = 16711935 & (h << 8 | h >>> 24) | 4278255360 & (h << 24 | h >>> 8);
  88670. }
  88671. return a;
  88672. },
  88673. clone: function clone() {
  88674. var e = i.clone.call(this);
  88675. return e._hash = this._hash.clone(), e;
  88676. }
  88677. });
  88678. function u(e, t, n, s, r, i, o) {
  88679. var a = e + (t & n | ~t & s) + r + o;
  88680. return (a << i | a >>> 32 - i) + t;
  88681. }
  88682. function h(e, t, n, s, r, i, o) {
  88683. var a = e + (t & s | n & ~s) + r + o;
  88684. return (a << i | a >>> 32 - i) + t;
  88685. }
  88686. function l(e, t, n, s, r, i, o) {
  88687. var a = e + (t ^ n ^ s) + r + o;
  88688. return (a << i | a >>> 32 - i) + t;
  88689. }
  88690. function d(e, t, n, s, r, i, o) {
  88691. var a = e + (n ^ (t | ~s)) + r + o;
  88692. return (a << i | a >>> 32 - i) + t;
  88693. }
  88694. t.MD5 = i._createHelper(c), t.HmacMD5 = i._createHmacHelper(c);
  88695. }(Math), n.MD5);
  88696. }), n(function (e, t) {
  88697. var n;
  88698. e.exports = (n = r, void function () {
  88699. var e = n,
  88700. t = e.lib.Base,
  88701. s = e.enc.Utf8;
  88702. e.algo.HMAC = t.extend({
  88703. init: function init(e, t) {
  88704. e = this._hasher = new e.init(), "string" == typeof t && (t = s.parse(t));
  88705. var n = e.blockSize,
  88706. r = 4 * n;
  88707. t.sigBytes > r && (t = e.finalize(t)), t.clamp();
  88708. for (var i = this._oKey = t.clone(), o = this._iKey = t.clone(), a = i.words, c = o.words, u = 0; u < n; u++) {
  88709. a[u] ^= 1549556828, c[u] ^= 909522486;
  88710. }
  88711. i.sigBytes = o.sigBytes = r, this.reset();
  88712. },
  88713. reset: function reset() {
  88714. var e = this._hasher;
  88715. e.reset(), e.update(this._iKey);
  88716. },
  88717. update: function update(e) {
  88718. return this._hasher.update(e), this;
  88719. },
  88720. finalize: function finalize(e) {
  88721. var t = this._hasher,
  88722. n = t.finalize(e);
  88723. return t.reset(), t.finalize(this._oKey.clone().concat(n));
  88724. }
  88725. });
  88726. }());
  88727. }), n(function (e, t) {
  88728. e.exports = r.HmacMD5;
  88729. })),
  88730. o = n(function (e, t) {
  88731. e.exports = r.enc.Utf8;
  88732. }),
  88733. a = n(function (e, t) {
  88734. var n;
  88735. e.exports = (n = r, function () {
  88736. var e = n,
  88737. t = e.lib.WordArray;
  88738. function s(e, n, s) {
  88739. for (var r = [], i = 0, o = 0; o < n; o++) {
  88740. if (o % 4) {
  88741. var a = s[e.charCodeAt(o - 1)] << o % 4 * 2,
  88742. c = s[e.charCodeAt(o)] >>> 6 - o % 4 * 2;
  88743. r[i >>> 2] |= (a | c) << 24 - i % 4 * 8, i++;
  88744. }
  88745. }
  88746. return t.create(r, i);
  88747. }
  88748. e.enc.Base64 = {
  88749. stringify: function stringify(e) {
  88750. var t = e.words,
  88751. n = e.sigBytes,
  88752. s = this._map;
  88753. e.clamp();
  88754. for (var r = [], i = 0; i < n; i += 3) {
  88755. for (var o = (t[i >>> 2] >>> 24 - i % 4 * 8 & 255) << 16 | (t[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255) << 8 | t[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255, a = 0; a < 4 && i + .75 * a < n; a++) {
  88756. r.push(s.charAt(o >>> 6 * (3 - a) & 63));
  88757. }
  88758. }
  88759. var c = s.charAt(64);
  88760. if (c) for (; r.length % 4;) {
  88761. r.push(c);
  88762. }
  88763. return r.join("");
  88764. },
  88765. parse: function parse(e) {
  88766. var t = e.length,
  88767. n = this._map,
  88768. r = this._reverseMap;
  88769. if (!r) {
  88770. r = this._reverseMap = [];
  88771. for (var i = 0; i < n.length; i++) {
  88772. r[n.charCodeAt(i)] = i;
  88773. }
  88774. }
  88775. var o = n.charAt(64);
  88776. if (o) {
  88777. var a = e.indexOf(o);
  88778. -1 !== a && (t = a);
  88779. }
  88780. return s(e, t, r);
  88781. },
  88782. _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
  88783. };
  88784. }(), n.enc.Base64);
  88785. });
  88786. var c = "uni_id_token",
  88787. u = "uni_id_token_expired",
  88788. h = "uniIdToken",
  88789. l = {
  88790. DEFAULT: "FUNCTION",
  88791. FUNCTION: "FUNCTION",
  88792. OBJECT: "OBJECT",
  88793. CLIENT_DB: "CLIENT_DB"
  88794. },
  88795. d = "pending",
  88796. p = "fulfilled",
  88797. f = "rejected";
  88798. function g(e) {
  88799. return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
  88800. }
  88801. function m(e) {
  88802. return "object" === g(e);
  88803. }
  88804. function y(e) {
  88805. return "function" == typeof e;
  88806. }
  88807. function _(e) {
  88808. return function () {
  88809. try {
  88810. return e.apply(e, arguments);
  88811. } catch (e) {
  88812. console.error(e);
  88813. }
  88814. };
  88815. }
  88816. var w = "REJECTED",
  88817. v = "NOT_PENDING";
  88818. var I = /*#__PURE__*/function () {
  88819. function I() {
  88820. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  88821. e = _ref.createPromise,
  88822. _ref$retryRule = _ref.retryRule,
  88823. t = _ref$retryRule === void 0 ? w : _ref$retryRule;
  88824. (0, _classCallCheck2.default)(this, I);
  88825. this.createPromise = e, this.status = null, this.promise = null, this.retryRule = t;
  88826. }
  88827. (0, _createClass2.default)(I, [{
  88828. key: "needRetry",
  88829. get: function get() {
  88830. if (!this.status) return !0;
  88831. switch (this.retryRule) {
  88832. case w:
  88833. return this.status === f;
  88834. case v:
  88835. return this.status !== d;
  88836. }
  88837. }
  88838. }, {
  88839. key: "exec",
  88840. value: function exec() {
  88841. var _this = this;
  88842. return this.needRetry ? (this.status = d, this.promise = this.createPromise().then(function (e) {
  88843. return _this.status = p, Promise.resolve(e);
  88844. }, function (e) {
  88845. return _this.status = f, Promise.reject(e);
  88846. }), this.promise) : this.promise;
  88847. }
  88848. }]);
  88849. return I;
  88850. }();
  88851. var S = /*#__PURE__*/function () {
  88852. function S() {
  88853. (0, _classCallCheck2.default)(this, S);
  88854. this._callback = {};
  88855. }
  88856. (0, _createClass2.default)(S, [{
  88857. key: "addListener",
  88858. value: function addListener(e, t) {
  88859. this._callback[e] || (this._callback[e] = []), this._callback[e].push(t);
  88860. }
  88861. }, {
  88862. key: "on",
  88863. value: function on(e, t) {
  88864. return this.addListener(e, t);
  88865. }
  88866. }, {
  88867. key: "removeListener",
  88868. value: function removeListener(e, t) {
  88869. if (!t) throw new Error('The "listener" argument must be of type function. Received undefined');
  88870. var n = this._callback[e];
  88871. if (!n) return;
  88872. var s = function (e, t) {
  88873. for (var _n2 = e.length - 1; _n2 >= 0; _n2--) {
  88874. if (e[_n2] === t) return _n2;
  88875. }
  88876. return -1;
  88877. }(n, t);
  88878. n.splice(s, 1);
  88879. }
  88880. }, {
  88881. key: "off",
  88882. value: function off(e, t) {
  88883. return this.removeListener(e, t);
  88884. }
  88885. }, {
  88886. key: "removeAllListener",
  88887. value: function removeAllListener(e) {
  88888. delete this._callback[e];
  88889. }
  88890. }, {
  88891. key: "emit",
  88892. value: function emit(e) {
  88893. var n = this._callback[e];
  88894. for (var _len = arguments.length, t = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  88895. t[_key - 1] = arguments[_key];
  88896. }
  88897. if (n) for (var _e2 = 0; _e2 < n.length; _e2++) {
  88898. n[_e2].apply(n, t);
  88899. }
  88900. }
  88901. }]);
  88902. return S;
  88903. }();
  88904. function T(e) {
  88905. return e && "string" == typeof e ? JSON.parse(e) : e;
  88906. }
  88907. var b = "development" === "development",
  88908. E = "mp-weixin",
  88909. k = "true" === undefined || !0 === undefined,
  88910. P = T([]),
  88911. C = "h5" === E ? "web" : "app-plus" === E || "app-harmony" === E ? "app" : E,
  88912. A = T(undefined),
  88913. O = T([]) || [],
  88914. x = true;
  88915. var N = "";
  88916. try {
  88917. N = (__webpack_require__(/*! uni-stat-config */ 994).default || __webpack_require__(/*! uni-stat-config */ 994)).appid;
  88918. } catch (e) {}
  88919. var R,
  88920. L = {};
  88921. function U(e) {
  88922. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  88923. var n, s;
  88924. return n = L, s = e, Object.prototype.hasOwnProperty.call(n, s) || (L[e] = t), L[e];
  88925. }
  88926. function D() {
  88927. return R || (R = function () {
  88928. if ("undefined" != typeof globalThis) return globalThis;
  88929. if ("undefined" != typeof self) return self;
  88930. if ("undefined" != typeof window) return window;
  88931. function e() {
  88932. return this;
  88933. }
  88934. return void 0 !== e() ? e() : new Function("return this")();
  88935. }(), R);
  88936. }
  88937. "app" === C && (L = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {});
  88938. var M = ["invoke", "success", "fail", "complete"],
  88939. q = U("_globalUniCloudInterceptor");
  88940. function F(e, t) {
  88941. q[e] || (q[e] = {}), m(t) && Object.keys(t).forEach(function (n) {
  88942. M.indexOf(n) > -1 && function (e, t, n) {
  88943. var s = q[e][t];
  88944. s || (s = q[e][t] = []), -1 === s.indexOf(n) && y(n) && s.push(n);
  88945. }(e, n, t[n]);
  88946. });
  88947. }
  88948. function K(e, t) {
  88949. q[e] || (q[e] = {}), m(t) ? Object.keys(t).forEach(function (n) {
  88950. M.indexOf(n) > -1 && function (e, t, n) {
  88951. var s = q[e][t];
  88952. if (!s) return;
  88953. var r = s.indexOf(n);
  88954. r > -1 && s.splice(r, 1);
  88955. }(e, n, t[n]);
  88956. }) : delete q[e];
  88957. }
  88958. function j(e, t) {
  88959. return e && 0 !== e.length ? e.reduce(function (e, n) {
  88960. return e.then(function () {
  88961. return n(t);
  88962. });
  88963. }, Promise.resolve()) : Promise.resolve();
  88964. }
  88965. function $(e, t) {
  88966. return q[e] && q[e][t] || [];
  88967. }
  88968. function B(e) {
  88969. F("callObject", e);
  88970. }
  88971. var W = U("_globalUniCloudListener"),
  88972. H = {
  88973. RESPONSE: "response",
  88974. NEED_LOGIN: "needLogin",
  88975. REFRESH_TOKEN: "refreshToken"
  88976. },
  88977. J = {
  88978. CLIENT_DB: "clientdb",
  88979. CLOUD_FUNCTION: "cloudfunction",
  88980. CLOUD_OBJECT: "cloudobject"
  88981. };
  88982. function z(e) {
  88983. return W[e] || (W[e] = []), W[e];
  88984. }
  88985. function V(e, t) {
  88986. var n = z(e);
  88987. n.includes(t) || n.push(t);
  88988. }
  88989. function G(e, t) {
  88990. var n = z(e),
  88991. s = n.indexOf(t);
  88992. -1 !== s && n.splice(s, 1);
  88993. }
  88994. function Y(e, t) {
  88995. var n = z(e);
  88996. for (var _e3 = 0; _e3 < n.length; _e3++) {
  88997. (0, n[_e3])(t);
  88998. }
  88999. }
  89000. var Q,
  89001. X = !1;
  89002. function Z() {
  89003. return Q || (Q = new Promise(function (e) {
  89004. X && e(), function t() {
  89005. if ("function" == typeof getCurrentPages) {
  89006. var _t2 = getCurrentPages();
  89007. _t2 && _t2[0] && (X = !0, e());
  89008. }
  89009. X || setTimeout(function () {
  89010. t();
  89011. }, 30);
  89012. }();
  89013. }), Q);
  89014. }
  89015. function ee(e) {
  89016. var t = {};
  89017. for (var _n3 in e) {
  89018. var _s2 = e[_n3];
  89019. y(_s2) && (t[_n3] = _(_s2));
  89020. }
  89021. return t;
  89022. }
  89023. var te = /*#__PURE__*/function (_Error) {
  89024. (0, _inherits2.default)(te, _Error);
  89025. var _super = _createSuper(te);
  89026. function te(e) {
  89027. var _this2;
  89028. (0, _classCallCheck2.default)(this, te);
  89029. _this2 = _super.call(this, e.message), _this2.errMsg = e.message || e.errMsg || "unknown system error", _this2.code = _this2.errCode = e.code || e.errCode || "SYSTEM_ERROR", _this2.errSubject = _this2.subject = e.subject || e.errSubject, _this2.cause = e.cause, _this2.requestId = e.requestId;
  89030. return _this2;
  89031. }
  89032. (0, _createClass2.default)(te, [{
  89033. key: "toJson",
  89034. value: function toJson() {
  89035. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  89036. if (!(e >= 10)) return e++, {
  89037. errCode: this.errCode,
  89038. errMsg: this.errMsg,
  89039. errSubject: this.errSubject,
  89040. cause: this.cause && this.cause.toJson ? this.cause.toJson(e) : this.cause
  89041. };
  89042. }
  89043. }]);
  89044. return te;
  89045. }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
  89046. exports.UniCloudError = te;
  89047. var ne = {
  89048. request: function request(e) {
  89049. return uni.request(e);
  89050. },
  89051. uploadFile: function uploadFile(e) {
  89052. return uni.uploadFile(e);
  89053. },
  89054. setStorageSync: function setStorageSync(e, t) {
  89055. return uni.setStorageSync(e, t);
  89056. },
  89057. getStorageSync: function getStorageSync(e) {
  89058. return uni.getStorageSync(e);
  89059. },
  89060. removeStorageSync: function removeStorageSync(e) {
  89061. return uni.removeStorageSync(e);
  89062. },
  89063. clearStorageSync: function clearStorageSync() {
  89064. return uni.clearStorageSync();
  89065. },
  89066. connectSocket: function connectSocket(e) {
  89067. return uni.connectSocket(e);
  89068. }
  89069. };
  89070. function se() {
  89071. return {
  89072. token: ne.getStorageSync(c) || ne.getStorageSync(h),
  89073. tokenExpired: ne.getStorageSync(u)
  89074. };
  89075. }
  89076. function re() {
  89077. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  89078. e = _ref2.token,
  89079. t = _ref2.tokenExpired;
  89080. e && ne.setStorageSync(c, e), t && ne.setStorageSync(u, t);
  89081. }
  89082. var ie, oe;
  89083. function ae() {
  89084. return ie || (ie = uni.getSystemInfoSync()), ie;
  89085. }
  89086. function ce() {
  89087. var e, t;
  89088. try {
  89089. if (uni.getLaunchOptionsSync) {
  89090. if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1) return;
  89091. var _uni$getLaunchOptions = uni.getLaunchOptionsSync(),
  89092. _n4 = _uni$getLaunchOptions.scene,
  89093. _s3 = _uni$getLaunchOptions.channel;
  89094. e = _s3, t = _n4;
  89095. }
  89096. } catch (e) {}
  89097. return {
  89098. channel: e,
  89099. scene: t
  89100. };
  89101. }
  89102. var ue = {};
  89103. function he() {
  89104. var e = uni.getLocale && uni.getLocale() || "en";
  89105. if (oe) return _objectSpread(_objectSpread(_objectSpread({}, ue), oe), {}, {
  89106. locale: e,
  89107. LOCALE: e
  89108. });
  89109. var t = ae(),
  89110. n = t.deviceId,
  89111. s = t.osName,
  89112. r = t.uniPlatform,
  89113. i = t.appId,
  89114. o = ["appId", "appLanguage", "appName", "appVersion", "appVersionCode", "appWgtVersion", "browserName", "browserVersion", "deviceBrand", "deviceId", "deviceModel", "deviceType", "osName", "osVersion", "romName", "romVersion", "ua", "hostName", "hostVersion", "uniPlatform", "uniRuntimeVersion", "uniRuntimeVersionCode", "uniCompilerVersion", "uniCompilerVersionCode"];
  89115. for (var _e4 in t) {
  89116. Object.hasOwnProperty.call(t, _e4) && -1 === o.indexOf(_e4) && delete t[_e4];
  89117. }
  89118. return oe = _objectSpread(_objectSpread({
  89119. PLATFORM: r,
  89120. OS: s,
  89121. APPID: i,
  89122. DEVICEID: n
  89123. }, ce()), t), _objectSpread(_objectSpread(_objectSpread({}, ue), oe), {}, {
  89124. locale: e,
  89125. LOCALE: e
  89126. });
  89127. }
  89128. var le = {
  89129. sign: function sign(e, t) {
  89130. var n = "";
  89131. return Object.keys(e).sort().forEach(function (t) {
  89132. e[t] && (n = n + "&" + t + "=" + e[t]);
  89133. }), n = n.slice(1), i(n, t).toString();
  89134. },
  89135. wrappedRequest: function wrappedRequest(e, t) {
  89136. return new Promise(function (n, s) {
  89137. t(Object.assign(e, {
  89138. complete: function complete(e) {
  89139. e || (e = {}), b && "web" === C && e.errMsg && 0 === e.errMsg.indexOf("request:fail") && console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5");
  89140. var t = e.data && e.data.header && e.data.header["x-serverless-request-id"] || e.header && e.header["request-id"];
  89141. if (!e.statusCode || e.statusCode >= 400) {
  89142. var _n5 = e.data && e.data.error && e.data.error.code || "SYS_ERR",
  89143. _r = e.data && e.data.error && e.data.error.message || e.errMsg || "request:fail";
  89144. return s(new te({
  89145. code: _n5,
  89146. message: _r,
  89147. requestId: t
  89148. }));
  89149. }
  89150. var r = e.data;
  89151. if (r.error) return s(new te({
  89152. code: r.error.code,
  89153. message: r.error.message,
  89154. requestId: t
  89155. }));
  89156. r.result = r.data, r.requestId = t, delete r.data, n(r);
  89157. }
  89158. }));
  89159. });
  89160. },
  89161. toBase64: function toBase64(e) {
  89162. return a.stringify(o.parse(e));
  89163. }
  89164. };
  89165. var de = /*#__PURE__*/function () {
  89166. function de(e) {
  89167. var _this3 = this;
  89168. (0, _classCallCheck2.default)(this, de);
  89169. ["spaceId", "clientSecret"].forEach(function (t) {
  89170. if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error("".concat(t, " required"));
  89171. }), this.config = Object.assign({}, {
  89172. endpoint: 0 === e.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com"
  89173. }, e), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = ne, this._getAccessTokenPromiseHub = new I({
  89174. createPromise: function createPromise() {
  89175. return _this3.requestAuth(_this3.setupRequest({
  89176. method: "serverless.auth.user.anonymousAuthorize",
  89177. params: "{}"
  89178. }, "auth")).then(function (e) {
  89179. if (!e.result || !e.result.accessToken) throw new te({
  89180. code: "AUTH_FAILED",
  89181. message: "获取accessToken失败"
  89182. });
  89183. _this3.setAccessToken(e.result.accessToken);
  89184. });
  89185. },
  89186. retryRule: v
  89187. });
  89188. }
  89189. (0, _createClass2.default)(de, [{
  89190. key: "hasAccessToken",
  89191. get: function get() {
  89192. return !!this.accessToken;
  89193. }
  89194. }, {
  89195. key: "setAccessToken",
  89196. value: function setAccessToken(e) {
  89197. this.accessToken = e;
  89198. }
  89199. }, {
  89200. key: "requestWrapped",
  89201. value: function requestWrapped(e) {
  89202. return le.wrappedRequest(e, this.adapter.request);
  89203. }
  89204. }, {
  89205. key: "requestAuth",
  89206. value: function requestAuth(e) {
  89207. return this.requestWrapped(e);
  89208. }
  89209. }, {
  89210. key: "request",
  89211. value: function request(e, t) {
  89212. var _this4 = this;
  89213. return Promise.resolve().then(function () {
  89214. return _this4.hasAccessToken ? t ? _this4.requestWrapped(e) : _this4.requestWrapped(e).catch(function (t) {
  89215. return new Promise(function (e, n) {
  89216. !t || "GATEWAY_INVALID_TOKEN" !== t.code && "InvalidParameter.InvalidToken" !== t.code ? n(t) : e();
  89217. }).then(function () {
  89218. return _this4.getAccessToken();
  89219. }).then(function () {
  89220. var t = _this4.rebuildRequest(e);
  89221. return _this4.request(t, !0);
  89222. });
  89223. }) : _this4.getAccessToken().then(function () {
  89224. var t = _this4.rebuildRequest(e);
  89225. return _this4.request(t, !0);
  89226. });
  89227. });
  89228. }
  89229. }, {
  89230. key: "rebuildRequest",
  89231. value: function rebuildRequest(e) {
  89232. var t = Object.assign({}, e);
  89233. return t.data.token = this.accessToken, t.header["x-basement-token"] = this.accessToken, t.header["x-serverless-sign"] = le.sign(t.data, this.config.clientSecret), t;
  89234. }
  89235. }, {
  89236. key: "setupRequest",
  89237. value: function setupRequest(e, t) {
  89238. var n = Object.assign({}, e, {
  89239. spaceId: this.config.spaceId,
  89240. timestamp: Date.now()
  89241. }),
  89242. s = {
  89243. "Content-Type": "application/json"
  89244. };
  89245. return "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = le.sign(n, this.config.clientSecret), {
  89246. url: this.config.requestUrl,
  89247. method: "POST",
  89248. data: n,
  89249. dataType: "json",
  89250. header: s
  89251. };
  89252. }
  89253. }, {
  89254. key: "getAccessToken",
  89255. value: function getAccessToken() {
  89256. return this._getAccessTokenPromiseHub.exec();
  89257. }
  89258. }, {
  89259. key: "authorize",
  89260. value: function () {
  89261. var _authorize = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  89262. return _regenerator.default.wrap(function _callee$(_context) {
  89263. while (1) {
  89264. switch (_context.prev = _context.next) {
  89265. case 0:
  89266. _context.next = 2;
  89267. return this.getAccessToken();
  89268. case 2:
  89269. case "end":
  89270. return _context.stop();
  89271. }
  89272. }
  89273. }, _callee, this);
  89274. }));
  89275. function authorize() {
  89276. return _authorize.apply(this, arguments);
  89277. }
  89278. return authorize;
  89279. }()
  89280. }, {
  89281. key: "callFunction",
  89282. value: function callFunction(e) {
  89283. var t = {
  89284. method: "serverless.function.runtime.invoke",
  89285. params: JSON.stringify({
  89286. functionTarget: e.name,
  89287. functionArgs: e.data || {}
  89288. })
  89289. };
  89290. return this.request(_objectSpread(_objectSpread({}, this.setupRequest(t)), {}, {
  89291. timeout: e.timeout
  89292. }));
  89293. }
  89294. }, {
  89295. key: "getOSSUploadOptionsFromPath",
  89296. value: function getOSSUploadOptionsFromPath(e) {
  89297. var t = {
  89298. method: "serverless.file.resource.generateProximalSign",
  89299. params: JSON.stringify(e)
  89300. };
  89301. return this.request(this.setupRequest(t));
  89302. }
  89303. }, {
  89304. key: "uploadFileToOSS",
  89305. value: function uploadFileToOSS(_ref3) {
  89306. var _this5 = this;
  89307. var e = _ref3.url,
  89308. t = _ref3.formData,
  89309. n = _ref3.name,
  89310. s = _ref3.filePath,
  89311. r = _ref3.fileType,
  89312. i = _ref3.onUploadProgress;
  89313. return new Promise(function (o, a) {
  89314. var c = _this5.adapter.uploadFile({
  89315. url: e,
  89316. formData: t,
  89317. name: n,
  89318. filePath: s,
  89319. fileType: r,
  89320. header: {
  89321. "X-OSS-server-side-encrpytion": "AES256"
  89322. },
  89323. success: function success(e) {
  89324. e && e.statusCode < 400 ? o(e) : a(new te({
  89325. code: "UPLOAD_FAILED",
  89326. message: "文件上传失败"
  89327. }));
  89328. },
  89329. fail: function fail(e) {
  89330. a(new te({
  89331. code: e.code || "UPLOAD_FAILED",
  89332. message: e.message || e.errMsg || "文件上传失败"
  89333. }));
  89334. }
  89335. });
  89336. "function" == typeof i && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
  89337. i({
  89338. loaded: e.totalBytesSent,
  89339. total: e.totalBytesExpectedToSend
  89340. });
  89341. });
  89342. });
  89343. }
  89344. }, {
  89345. key: "reportOSSUpload",
  89346. value: function reportOSSUpload(e) {
  89347. var t = {
  89348. method: "serverless.file.resource.report",
  89349. params: JSON.stringify(e)
  89350. };
  89351. return this.request(this.setupRequest(t));
  89352. }
  89353. }, {
  89354. key: "uploadFile",
  89355. value: function () {
  89356. var _uploadFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref4) {
  89357. var e, t, _ref4$fileType, n, _ref4$cloudPathAsReal, s, r, i, o, a, c, u, h, l, d, p, f, m, y, _, _e5, w;
  89358. return _regenerator.default.wrap(function _callee2$(_context2) {
  89359. while (1) {
  89360. switch (_context2.prev = _context2.next) {
  89361. case 0:
  89362. e = _ref4.filePath, t = _ref4.cloudPath, _ref4$fileType = _ref4.fileType, n = _ref4$fileType === void 0 ? "image" : _ref4$fileType, _ref4$cloudPathAsReal = _ref4.cloudPathAsRealPath, s = _ref4$cloudPathAsReal === void 0 ? !1 : _ref4$cloudPathAsReal, r = _ref4.onUploadProgress, i = _ref4.config;
  89363. if (!("string" !== g(t))) {
  89364. _context2.next = 3;
  89365. break;
  89366. }
  89367. throw new te({
  89368. code: "INVALID_PARAM",
  89369. message: "cloudPath必须为字符串类型"
  89370. });
  89371. case 3:
  89372. if (t = t.trim()) {
  89373. _context2.next = 5;
  89374. break;
  89375. }
  89376. throw new te({
  89377. code: "INVALID_PARAM",
  89378. message: "cloudPath不可为空"
  89379. });
  89380. case 5:
  89381. if (!/:\/\//.test(t)) {
  89382. _context2.next = 7;
  89383. break;
  89384. }
  89385. throw new te({
  89386. code: "INVALID_PARAM",
  89387. message: "cloudPath不合法"
  89388. });
  89389. case 7:
  89390. o = i && i.envType || this.config.envType;
  89391. if (!(s && ("/" !== t[0] && (t = "/" + t), t.indexOf("\\") > -1))) {
  89392. _context2.next = 10;
  89393. break;
  89394. }
  89395. throw new te({
  89396. code: "INVALID_PARAM",
  89397. message: "使用cloudPath作为路径时,cloudPath不可包含“\\”"
  89398. });
  89399. case 10:
  89400. _context2.next = 12;
  89401. return this.getOSSUploadOptionsFromPath({
  89402. env: o,
  89403. filename: s ? t.split("/").pop() : t,
  89404. fileId: s ? t : void 0
  89405. });
  89406. case 12:
  89407. a = _context2.sent.result;
  89408. c = "https://" + a.cdnDomain + "/" + a.ossPath;
  89409. u = a.securityToken;
  89410. h = a.accessKeyId;
  89411. l = a.signature;
  89412. d = a.host;
  89413. p = a.ossPath;
  89414. f = a.id;
  89415. m = a.policy;
  89416. y = a.ossCallbackUrl;
  89417. _ = {
  89418. "Cache-Control": "max-age=2592000",
  89419. "Content-Disposition": "attachment",
  89420. OSSAccessKeyId: h,
  89421. Signature: l,
  89422. host: d,
  89423. id: f,
  89424. key: p,
  89425. policy: m,
  89426. success_action_status: 200
  89427. };
  89428. if (u && (_["x-oss-security-token"] = u), y) {
  89429. _e5 = JSON.stringify({
  89430. callbackUrl: y,
  89431. callbackBody: JSON.stringify({
  89432. fileId: f,
  89433. spaceId: this.config.spaceId
  89434. }),
  89435. callbackBodyType: "application/json"
  89436. });
  89437. _.callback = le.toBase64(_e5);
  89438. }
  89439. w = {
  89440. url: "https://" + a.host,
  89441. formData: _,
  89442. fileName: "file",
  89443. name: "file",
  89444. filePath: e,
  89445. fileType: n
  89446. };
  89447. _context2.next = 27;
  89448. return this.uploadFileToOSS(Object.assign({}, w, {
  89449. onUploadProgress: r
  89450. }));
  89451. case 27:
  89452. if (!y) {
  89453. _context2.next = 29;
  89454. break;
  89455. }
  89456. return _context2.abrupt("return", {
  89457. success: !0,
  89458. filePath: e,
  89459. fileID: c
  89460. });
  89461. case 29:
  89462. _context2.next = 31;
  89463. return this.reportOSSUpload({
  89464. id: f
  89465. });
  89466. case 31:
  89467. if (!_context2.sent.success) {
  89468. _context2.next = 33;
  89469. break;
  89470. }
  89471. return _context2.abrupt("return", {
  89472. success: !0,
  89473. filePath: e,
  89474. fileID: c
  89475. });
  89476. case 33:
  89477. throw new te({
  89478. code: "UPLOAD_FAILED",
  89479. message: "文件上传失败"
  89480. });
  89481. case 34:
  89482. case "end":
  89483. return _context2.stop();
  89484. }
  89485. }
  89486. }, _callee2, this);
  89487. }));
  89488. function uploadFile(_x) {
  89489. return _uploadFile.apply(this, arguments);
  89490. }
  89491. return uploadFile;
  89492. }()
  89493. }, {
  89494. key: "getTempFileURL",
  89495. value: function getTempFileURL() {
  89496. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  89497. e = _ref5.fileList;
  89498. return new Promise(function (t, n) {
  89499. Array.isArray(e) && 0 !== e.length || n(new te({
  89500. code: "INVALID_PARAM",
  89501. message: "fileList的元素必须是非空的字符串"
  89502. })), t({
  89503. fileList: e.map(function (e) {
  89504. return {
  89505. fileID: e,
  89506. tempFileURL: e
  89507. };
  89508. })
  89509. });
  89510. });
  89511. }
  89512. }, {
  89513. key: "getFileInfo",
  89514. value: function () {
  89515. var _getFileInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
  89516. var _ref6,
  89517. e,
  89518. t,
  89519. _args3 = arguments;
  89520. return _regenerator.default.wrap(function _callee3$(_context3) {
  89521. while (1) {
  89522. switch (_context3.prev = _context3.next) {
  89523. case 0:
  89524. _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, e = _ref6.fileList;
  89525. if (!(!Array.isArray(e) || 0 === e.length)) {
  89526. _context3.next = 3;
  89527. break;
  89528. }
  89529. throw new te({
  89530. code: "INVALID_PARAM",
  89531. message: "fileList的元素必须是非空的字符串"
  89532. });
  89533. case 3:
  89534. t = {
  89535. method: "serverless.file.resource.info",
  89536. params: JSON.stringify({
  89537. id: e.map(function (e) {
  89538. return e.split("?")[0];
  89539. }).join(",")
  89540. })
  89541. };
  89542. _context3.next = 6;
  89543. return this.request(this.setupRequest(t));
  89544. case 6:
  89545. _context3.t0 = _context3.sent.result;
  89546. return _context3.abrupt("return", {
  89547. fileList: _context3.t0
  89548. });
  89549. case 8:
  89550. case "end":
  89551. return _context3.stop();
  89552. }
  89553. }
  89554. }, _callee3, this);
  89555. }));
  89556. function getFileInfo() {
  89557. return _getFileInfo.apply(this, arguments);
  89558. }
  89559. return getFileInfo;
  89560. }()
  89561. }]);
  89562. return de;
  89563. }();
  89564. var pe = {
  89565. init: function init(e) {
  89566. var t = new de(e),
  89567. n = {
  89568. signInAnonymously: function signInAnonymously() {
  89569. return t.authorize();
  89570. },
  89571. getLoginState: function getLoginState() {
  89572. return Promise.resolve(!1);
  89573. }
  89574. };
  89575. return t.auth = function () {
  89576. return n;
  89577. }, t.customAuth = t.auth, t;
  89578. }
  89579. };
  89580. var fe = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
  89581. var ge;
  89582. !function (e) {
  89583. e.local = "local", e.none = "none", e.session = "session";
  89584. }(ge || (ge = {}));
  89585. var me = function me() {},
  89586. ye = n(function (e, t) {
  89587. var n;
  89588. e.exports = (n = r, function (e) {
  89589. var t = n,
  89590. s = t.lib,
  89591. r = s.WordArray,
  89592. i = s.Hasher,
  89593. o = t.algo,
  89594. a = [],
  89595. c = [];
  89596. !function () {
  89597. function t(t) {
  89598. for (var n = e.sqrt(t), s = 2; s <= n; s++) {
  89599. if (!(t % s)) return !1;
  89600. }
  89601. return !0;
  89602. }
  89603. function n(e) {
  89604. return 4294967296 * (e - (0 | e)) | 0;
  89605. }
  89606. for (var s = 2, r = 0; r < 64;) {
  89607. t(s) && (r < 8 && (a[r] = n(e.pow(s, .5))), c[r] = n(e.pow(s, 1 / 3)), r++), s++;
  89608. }
  89609. }();
  89610. var u = [],
  89611. h = o.SHA256 = i.extend({
  89612. _doReset: function _doReset() {
  89613. this._hash = new r.init(a.slice(0));
  89614. },
  89615. _doProcessBlock: function _doProcessBlock(e, t) {
  89616. for (var n = this._hash.words, s = n[0], r = n[1], i = n[2], o = n[3], a = n[4], h = n[5], l = n[6], d = n[7], p = 0; p < 64; p++) {
  89617. if (p < 16) u[p] = 0 | e[t + p];else {
  89618. var f = u[p - 15],
  89619. g = (f << 25 | f >>> 7) ^ (f << 14 | f >>> 18) ^ f >>> 3,
  89620. m = u[p - 2],
  89621. y = (m << 15 | m >>> 17) ^ (m << 13 | m >>> 19) ^ m >>> 10;
  89622. u[p] = g + u[p - 7] + y + u[p - 16];
  89623. }
  89624. var _ = s & r ^ s & i ^ r & i,
  89625. w = (s << 30 | s >>> 2) ^ (s << 19 | s >>> 13) ^ (s << 10 | s >>> 22),
  89626. v = d + ((a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25)) + (a & h ^ ~a & l) + c[p] + u[p];
  89627. d = l, l = h, h = a, a = o + v | 0, o = i, i = r, r = s, s = v + (w + _) | 0;
  89628. }
  89629. n[0] = n[0] + s | 0, n[1] = n[1] + r | 0, n[2] = n[2] + i | 0, n[3] = n[3] + o | 0, n[4] = n[4] + a | 0, n[5] = n[5] + h | 0, n[6] = n[6] + l | 0, n[7] = n[7] + d | 0;
  89630. },
  89631. _doFinalize: function _doFinalize() {
  89632. var t = this._data,
  89633. n = t.words,
  89634. s = 8 * this._nDataBytes,
  89635. r = 8 * t.sigBytes;
  89636. return n[r >>> 5] |= 128 << 24 - r % 32, n[14 + (r + 64 >>> 9 << 4)] = e.floor(s / 4294967296), n[15 + (r + 64 >>> 9 << 4)] = s, t.sigBytes = 4 * n.length, this._process(), this._hash;
  89637. },
  89638. clone: function clone() {
  89639. var e = i.clone.call(this);
  89640. return e._hash = this._hash.clone(), e;
  89641. }
  89642. });
  89643. t.SHA256 = i._createHelper(h), t.HmacSHA256 = i._createHmacHelper(h);
  89644. }(Math), n.SHA256);
  89645. }),
  89646. _e = ye,
  89647. we = n(function (e, t) {
  89648. e.exports = r.HmacSHA256;
  89649. });
  89650. var ve = function ve() {
  89651. var e;
  89652. if (!Promise) {
  89653. e = function e() {}, e.promise = {};
  89654. var _t3 = function _t3() {
  89655. throw new te({
  89656. message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'
  89657. });
  89658. };
  89659. return Object.defineProperty(e.promise, "then", {
  89660. get: _t3
  89661. }), Object.defineProperty(e.promise, "catch", {
  89662. get: _t3
  89663. }), e;
  89664. }
  89665. var t = new Promise(function (t, n) {
  89666. e = function e(_e6, s) {
  89667. return _e6 ? n(_e6) : t(s);
  89668. };
  89669. });
  89670. return e.promise = t, e;
  89671. };
  89672. function Ie(e) {
  89673. return void 0 === e;
  89674. }
  89675. function Se(e) {
  89676. return "[object Null]" === Object.prototype.toString.call(e);
  89677. }
  89678. function Te() {
  89679. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  89680. return e.replace(/([\s\S]+)\s+(请前往云开发AI小助手查看问题:.*)/, "$1");
  89681. }
  89682. function be() {
  89683. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
  89684. var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  89685. var n = "";
  89686. for (var _s4 = 0; _s4 < e; _s4++) {
  89687. n += t.charAt(Math.floor(62 * Math.random()));
  89688. }
  89689. return n;
  89690. }
  89691. var Ee;
  89692. function ke(e) {
  89693. var t = (n = e, "[object Array]" === Object.prototype.toString.call(n) ? e : [e]);
  89694. var n;
  89695. var _iterator = _createForOfIteratorHelper(t),
  89696. _step;
  89697. try {
  89698. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  89699. var _e7 = _step.value;
  89700. var _t4 = _e7.isMatch,
  89701. _n6 = _e7.genAdapter,
  89702. _s5 = _e7.runtime;
  89703. if (_t4()) return {
  89704. adapter: _n6(),
  89705. runtime: _s5
  89706. };
  89707. }
  89708. } catch (err) {
  89709. _iterator.e(err);
  89710. } finally {
  89711. _iterator.f();
  89712. }
  89713. }
  89714. !function (e) {
  89715. e.WEB = "web", e.WX_MP = "wx_mp";
  89716. }(Ee || (Ee = {}));
  89717. var Pe = {
  89718. adapter: null,
  89719. runtime: void 0
  89720. },
  89721. Ce = ["anonymousUuidKey"];
  89722. var Ae = /*#__PURE__*/function (_me) {
  89723. (0, _inherits2.default)(Ae, _me);
  89724. var _super2 = _createSuper(Ae);
  89725. function Ae() {
  89726. var _this6;
  89727. (0, _classCallCheck2.default)(this, Ae);
  89728. _this6 = _super2.call(this), Pe.adapter.root.tcbObject || (Pe.adapter.root.tcbObject = {});
  89729. return _this6;
  89730. }
  89731. (0, _createClass2.default)(Ae, [{
  89732. key: "setItem",
  89733. value: function setItem(e, t) {
  89734. Pe.adapter.root.tcbObject[e] = t;
  89735. }
  89736. }, {
  89737. key: "getItem",
  89738. value: function getItem(e) {
  89739. return Pe.adapter.root.tcbObject[e];
  89740. }
  89741. }, {
  89742. key: "removeItem",
  89743. value: function removeItem(e) {
  89744. delete Pe.adapter.root.tcbObject[e];
  89745. }
  89746. }, {
  89747. key: "clear",
  89748. value: function clear() {
  89749. delete Pe.adapter.root.tcbObject;
  89750. }
  89751. }]);
  89752. return Ae;
  89753. }(me);
  89754. function Oe(e, t) {
  89755. switch (e) {
  89756. case "local":
  89757. return t.localStorage || new Ae();
  89758. case "none":
  89759. return new Ae();
  89760. default:
  89761. return t.sessionStorage || new Ae();
  89762. }
  89763. }
  89764. var xe = /*#__PURE__*/function () {
  89765. function xe(e) {
  89766. (0, _classCallCheck2.default)(this, xe);
  89767. if (!this._storage) {
  89768. this._persistence = Pe.adapter.primaryStorage || e.persistence, this._storage = Oe(this._persistence, Pe.adapter);
  89769. var _t5 = "access_token_".concat(e.env),
  89770. _n7 = "access_token_expire_".concat(e.env),
  89771. _s6 = "refresh_token_".concat(e.env),
  89772. _r2 = "anonymous_uuid_".concat(e.env),
  89773. _i = "login_type_".concat(e.env),
  89774. _o = "device_id",
  89775. _a = "token_type_".concat(e.env),
  89776. _c = "user_info_".concat(e.env);
  89777. this.keys = {
  89778. accessTokenKey: _t5,
  89779. accessTokenExpireKey: _n7,
  89780. refreshTokenKey: _s6,
  89781. anonymousUuidKey: _r2,
  89782. loginTypeKey: _i,
  89783. userInfoKey: _c,
  89784. deviceIdKey: _o,
  89785. tokenTypeKey: _a
  89786. };
  89787. }
  89788. }
  89789. (0, _createClass2.default)(xe, [{
  89790. key: "updatePersistence",
  89791. value: function updatePersistence(e) {
  89792. if (e === this._persistence) return;
  89793. var t = "local" === this._persistence;
  89794. this._persistence = e;
  89795. var n = Oe(e, Pe.adapter);
  89796. for (var _e8 in this.keys) {
  89797. var _s7 = this.keys[_e8];
  89798. if (t && Ce.includes(_e8)) continue;
  89799. var _r3 = this._storage.getItem(_s7);
  89800. Ie(_r3) || Se(_r3) || (n.setItem(_s7, _r3), this._storage.removeItem(_s7));
  89801. }
  89802. this._storage = n;
  89803. }
  89804. }, {
  89805. key: "setStore",
  89806. value: function setStore(e, t, n) {
  89807. if (!this._storage) return;
  89808. var s = {
  89809. version: n || "localCachev1",
  89810. content: t
  89811. },
  89812. r = JSON.stringify(s);
  89813. try {
  89814. this._storage.setItem(e, r);
  89815. } catch (e) {
  89816. throw e;
  89817. }
  89818. }
  89819. }, {
  89820. key: "getStore",
  89821. value: function getStore(e, t) {
  89822. try {
  89823. if (!this._storage) return;
  89824. } catch (e) {
  89825. return "";
  89826. }
  89827. t = t || "localCachev1";
  89828. var n = this._storage.getItem(e);
  89829. if (!n) return "";
  89830. if (n.indexOf(t) >= 0) {
  89831. return JSON.parse(n).content;
  89832. }
  89833. return "";
  89834. }
  89835. }, {
  89836. key: "removeStore",
  89837. value: function removeStore(e) {
  89838. this._storage.removeItem(e);
  89839. }
  89840. }]);
  89841. return xe;
  89842. }();
  89843. var Ne = {},
  89844. Re = {};
  89845. function Le(e) {
  89846. return Ne[e];
  89847. }
  89848. var Ue = /*#__PURE__*/(0, _createClass2.default)(function Ue(e, t) {
  89849. (0, _classCallCheck2.default)(this, Ue);
  89850. this.data = t || null, this.name = e;
  89851. });
  89852. var De = /*#__PURE__*/function (_Ue) {
  89853. (0, _inherits2.default)(De, _Ue);
  89854. var _super3 = _createSuper(De);
  89855. function De(e, t) {
  89856. var _this7;
  89857. (0, _classCallCheck2.default)(this, De);
  89858. _this7 = _super3.call(this, "error", {
  89859. error: e,
  89860. data: t
  89861. }), _this7.error = e;
  89862. return _this7;
  89863. }
  89864. return (0, _createClass2.default)(De);
  89865. }(Ue);
  89866. var Me = new ( /*#__PURE__*/function () {
  89867. function _class() {
  89868. (0, _classCallCheck2.default)(this, _class);
  89869. this._listeners = {};
  89870. }
  89871. (0, _createClass2.default)(_class, [{
  89872. key: "on",
  89873. value: function on(e, t) {
  89874. return function (e, t, n) {
  89875. n[e] = n[e] || [], n[e].push(t);
  89876. }(e, t, this._listeners), this;
  89877. }
  89878. }, {
  89879. key: "off",
  89880. value: function off(e, t) {
  89881. return function (e, t, n) {
  89882. if (n && n[e]) {
  89883. var _s8 = n[e].indexOf(t);
  89884. -1 !== _s8 && n[e].splice(_s8, 1);
  89885. }
  89886. }(e, t, this._listeners), this;
  89887. }
  89888. }, {
  89889. key: "fire",
  89890. value: function fire(e, t) {
  89891. if (e instanceof De) return console.error(e.error), this;
  89892. var n = "string" == typeof e ? new Ue(e, t || {}) : e;
  89893. var s = n.name;
  89894. if (this._listens(s)) {
  89895. n.target = this;
  89896. var _e9 = this._listeners[s] ? (0, _toConsumableArray2.default)(this._listeners[s]) : [];
  89897. var _iterator2 = _createForOfIteratorHelper(_e9),
  89898. _step2;
  89899. try {
  89900. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  89901. var _t6 = _step2.value;
  89902. _t6.call(this, n);
  89903. }
  89904. } catch (err) {
  89905. _iterator2.e(err);
  89906. } finally {
  89907. _iterator2.f();
  89908. }
  89909. }
  89910. return this;
  89911. }
  89912. }, {
  89913. key: "_listens",
  89914. value: function _listens(e) {
  89915. return this._listeners[e] && this._listeners[e].length > 0;
  89916. }
  89917. }]);
  89918. return _class;
  89919. }())();
  89920. function qe(e, t) {
  89921. Me.on(e, t);
  89922. }
  89923. function Fe(e) {
  89924. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  89925. Me.fire(e, t);
  89926. }
  89927. function Ke(e, t) {
  89928. Me.off(e, t);
  89929. }
  89930. var je = "loginStateChanged",
  89931. $e = "loginStateExpire",
  89932. Be = "loginTypeChanged",
  89933. We = "anonymousConverted",
  89934. He = "refreshAccessToken";
  89935. var Je;
  89936. !function (e) {
  89937. e.ANONYMOUS = "ANONYMOUS", e.WECHAT = "WECHAT", e.WECHAT_PUBLIC = "WECHAT-PUBLIC", e.WECHAT_OPEN = "WECHAT-OPEN", e.CUSTOM = "CUSTOM", e.EMAIL = "EMAIL", e.USERNAME = "USERNAME", e.NULL = "NULL";
  89938. }(Je || (Je = {}));
  89939. var ze = /*#__PURE__*/function () {
  89940. function ze() {
  89941. (0, _classCallCheck2.default)(this, ze);
  89942. this._fnPromiseMap = new Map();
  89943. }
  89944. (0, _createClass2.default)(ze, [{
  89945. key: "run",
  89946. value: function () {
  89947. var _run = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(e, t) {
  89948. var _this8 = this;
  89949. var n;
  89950. return _regenerator.default.wrap(function _callee5$(_context5) {
  89951. while (1) {
  89952. switch (_context5.prev = _context5.next) {
  89953. case 0:
  89954. n = this._fnPromiseMap.get(e);
  89955. return _context5.abrupt("return", (n || (n = new Promise( /*#__PURE__*/function () {
  89956. var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(n, s) {
  89957. var _e10;
  89958. return _regenerator.default.wrap(function _callee4$(_context4) {
  89959. while (1) {
  89960. switch (_context4.prev = _context4.next) {
  89961. case 0:
  89962. _context4.prev = 0;
  89963. _context4.next = 3;
  89964. return _this8._runIdlePromise();
  89965. case 3:
  89966. _e10 = t();
  89967. _context4.t0 = n;
  89968. _context4.next = 7;
  89969. return _e10;
  89970. case 7:
  89971. _context4.t1 = _context4.sent;
  89972. (0, _context4.t0)(_context4.t1);
  89973. _context4.next = 14;
  89974. break;
  89975. case 11:
  89976. _context4.prev = 11;
  89977. _context4.t2 = _context4["catch"](0);
  89978. s(_context4.t2);
  89979. case 14:
  89980. _context4.prev = 14;
  89981. _this8._fnPromiseMap.delete(e);
  89982. return _context4.finish(14);
  89983. case 17:
  89984. case "end":
  89985. return _context4.stop();
  89986. }
  89987. }
  89988. }, _callee4, null, [[0, 11, 14, 17]]);
  89989. }));
  89990. return function (_x4, _x5) {
  89991. return _ref7.apply(this, arguments);
  89992. };
  89993. }()), this._fnPromiseMap.set(e, n)), n));
  89994. case 2:
  89995. case "end":
  89996. return _context5.stop();
  89997. }
  89998. }
  89999. }, _callee5, this);
  90000. }));
  90001. function run(_x2, _x3) {
  90002. return _run.apply(this, arguments);
  90003. }
  90004. return run;
  90005. }()
  90006. }, {
  90007. key: "_runIdlePromise",
  90008. value: function _runIdlePromise() {
  90009. return Promise.resolve();
  90010. }
  90011. }]);
  90012. return ze;
  90013. }();
  90014. var Ve = /*#__PURE__*/function () {
  90015. function Ve(e) {
  90016. (0, _classCallCheck2.default)(this, Ve);
  90017. this._singlePromise = new ze(), this._cache = Le(e.env), this._baseURL = "https://".concat(e.env, ".ap-shanghai.tcb-api.tencentcloudapi.com"), this._reqClass = new Pe.adapter.reqClass({
  90018. timeout: e.timeout,
  90019. timeoutMsg: "\u8BF7\u6C42\u5728".concat(e.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"),
  90020. restrictedMethods: ["post"]
  90021. });
  90022. }
  90023. (0, _createClass2.default)(Ve, [{
  90024. key: "_getDeviceId",
  90025. value: function _getDeviceId() {
  90026. if (this._deviceID) return this._deviceID;
  90027. var e = this._cache.keys.deviceIdKey;
  90028. var t = this._cache.getStore(e);
  90029. return "string" == typeof t && t.length >= 16 && t.length <= 48 || (t = be(), this._cache.setStore(e, t)), this._deviceID = t, t;
  90030. }
  90031. }, {
  90032. key: "_request",
  90033. value: function () {
  90034. var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(e, t) {
  90035. var n,
  90036. s,
  90037. _e11,
  90038. _t7,
  90039. _n8,
  90040. _args6 = arguments;
  90041. return _regenerator.default.wrap(function _callee6$(_context6) {
  90042. while (1) {
  90043. switch (_context6.prev = _context6.next) {
  90044. case 0:
  90045. n = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
  90046. s = {
  90047. "x-request-id": be(),
  90048. "x-device-id": this._getDeviceId()
  90049. };
  90050. if (!n.withAccessToken) {
  90051. _context6.next = 9;
  90052. break;
  90053. }
  90054. _e11 = this._cache.keys.tokenTypeKey;
  90055. _context6.next = 6;
  90056. return this.getAccessToken();
  90057. case 6:
  90058. _t7 = _context6.sent;
  90059. _n8 = this._cache.getStore(_e11);
  90060. s.authorization = "".concat(_n8, " ").concat(_t7);
  90061. case 9:
  90062. return _context6.abrupt("return", this._reqClass["get" === n.method ? "get" : "post"]({
  90063. url: "".concat(this._baseURL).concat(e),
  90064. data: t,
  90065. headers: s
  90066. }));
  90067. case 10:
  90068. case "end":
  90069. return _context6.stop();
  90070. }
  90071. }
  90072. }, _callee6, this);
  90073. }));
  90074. function _request(_x6, _x7) {
  90075. return _request2.apply(this, arguments);
  90076. }
  90077. return _request;
  90078. }()
  90079. }, {
  90080. key: "_fetchAccessToken",
  90081. value: function () {
  90082. var _fetchAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
  90083. var _this9 = this;
  90084. var _this$_cache$keys, e, t, n, s, r, i, o, a, c;
  90085. return _regenerator.default.wrap(function _callee8$(_context8) {
  90086. while (1) {
  90087. switch (_context8.prev = _context8.next) {
  90088. case 0:
  90089. _this$_cache$keys = this._cache.keys, e = _this$_cache$keys.loginTypeKey, t = _this$_cache$keys.accessTokenKey, n = _this$_cache$keys.accessTokenExpireKey, s = _this$_cache$keys.tokenTypeKey, r = this._cache.getStore(e);
  90090. if (!(r && r !== Je.ANONYMOUS)) {
  90091. _context8.next = 3;
  90092. break;
  90093. }
  90094. throw new te({
  90095. code: "INVALID_OPERATION",
  90096. message: "非匿名登录不支持刷新 access token"
  90097. });
  90098. case 3:
  90099. _context8.next = 5;
  90100. return this._singlePromise.run("fetchAccessToken", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
  90101. return _regenerator.default.wrap(function _callee7$(_context7) {
  90102. while (1) {
  90103. switch (_context7.prev = _context7.next) {
  90104. case 0:
  90105. _context7.next = 2;
  90106. return _this9._request("/auth/v1/signin/anonymously", {}, {
  90107. method: "post"
  90108. });
  90109. case 2:
  90110. return _context7.abrupt("return", _context7.sent.data);
  90111. case 3:
  90112. case "end":
  90113. return _context7.stop();
  90114. }
  90115. }
  90116. }, _callee7);
  90117. })));
  90118. case 5:
  90119. i = _context8.sent;
  90120. o = i.access_token;
  90121. a = i.expires_in;
  90122. c = i.token_type;
  90123. return _context8.abrupt("return", (this._cache.setStore(s, c), this._cache.setStore(t, o), this._cache.setStore(n, Date.now() + 1e3 * a), o));
  90124. case 10:
  90125. case "end":
  90126. return _context8.stop();
  90127. }
  90128. }
  90129. }, _callee8, this);
  90130. }));
  90131. function _fetchAccessToken() {
  90132. return _fetchAccessToken2.apply(this, arguments);
  90133. }
  90134. return _fetchAccessToken;
  90135. }()
  90136. }, {
  90137. key: "isAccessTokenExpired",
  90138. value: function isAccessTokenExpired(e, t) {
  90139. var n = !0;
  90140. return e && t && (n = t < Date.now()), n;
  90141. }
  90142. }, {
  90143. key: "getAccessToken",
  90144. value: function () {
  90145. var _getAccessToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
  90146. var _this$_cache$keys2, e, t, n, s;
  90147. return _regenerator.default.wrap(function _callee9$(_context9) {
  90148. while (1) {
  90149. switch (_context9.prev = _context9.next) {
  90150. case 0:
  90151. _this$_cache$keys2 = this._cache.keys, e = _this$_cache$keys2.accessTokenKey, t = _this$_cache$keys2.accessTokenExpireKey, n = this._cache.getStore(e), s = this._cache.getStore(t);
  90152. return _context9.abrupt("return", this.isAccessTokenExpired(n, s) ? this._fetchAccessToken() : n);
  90153. case 2:
  90154. case "end":
  90155. return _context9.stop();
  90156. }
  90157. }
  90158. }, _callee9, this);
  90159. }));
  90160. function getAccessToken() {
  90161. return _getAccessToken.apply(this, arguments);
  90162. }
  90163. return getAccessToken;
  90164. }()
  90165. }, {
  90166. key: "refreshAccessToken",
  90167. value: function () {
  90168. var _refreshAccessToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
  90169. var _this$_cache$keys3, e, t, n;
  90170. return _regenerator.default.wrap(function _callee10$(_context10) {
  90171. while (1) {
  90172. switch (_context10.prev = _context10.next) {
  90173. case 0:
  90174. _this$_cache$keys3 = this._cache.keys, e = _this$_cache$keys3.accessTokenKey, t = _this$_cache$keys3.accessTokenExpireKey, n = _this$_cache$keys3.loginTypeKey;
  90175. return _context10.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.setStore(n, Je.ANONYMOUS), this.getAccessToken()));
  90176. case 2:
  90177. case "end":
  90178. return _context10.stop();
  90179. }
  90180. }
  90181. }, _callee10, this);
  90182. }));
  90183. function refreshAccessToken() {
  90184. return _refreshAccessToken.apply(this, arguments);
  90185. }
  90186. return refreshAccessToken;
  90187. }()
  90188. }, {
  90189. key: "getUserInfo",
  90190. value: function () {
  90191. var _getUserInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
  90192. var _this10 = this;
  90193. return _regenerator.default.wrap(function _callee12$(_context12) {
  90194. while (1) {
  90195. switch (_context12.prev = _context12.next) {
  90196. case 0:
  90197. return _context12.abrupt("return", this._singlePromise.run("getUserInfo", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
  90198. return _regenerator.default.wrap(function _callee11$(_context11) {
  90199. while (1) {
  90200. switch (_context11.prev = _context11.next) {
  90201. case 0:
  90202. _context11.next = 2;
  90203. return _this10._request("/auth/v1/user/me", {}, {
  90204. withAccessToken: !0,
  90205. method: "get"
  90206. });
  90207. case 2:
  90208. return _context11.abrupt("return", _context11.sent.data);
  90209. case 3:
  90210. case "end":
  90211. return _context11.stop();
  90212. }
  90213. }
  90214. }, _callee11);
  90215. }))));
  90216. case 1:
  90217. case "end":
  90218. return _context12.stop();
  90219. }
  90220. }
  90221. }, _callee12, this);
  90222. }));
  90223. function getUserInfo() {
  90224. return _getUserInfo.apply(this, arguments);
  90225. }
  90226. return getUserInfo;
  90227. }()
  90228. }]);
  90229. return Ve;
  90230. }();
  90231. var Ge = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"],
  90232. Ye = {
  90233. "X-SDK-Version": "1.3.5"
  90234. };
  90235. function Qe(e, t, n) {
  90236. var s = e[t];
  90237. e[t] = function (t) {
  90238. var r = {},
  90239. i = {};
  90240. n.forEach(function (n) {
  90241. var _n$call = n.call(e, t),
  90242. s = _n$call.data,
  90243. o = _n$call.headers;
  90244. Object.assign(r, s), Object.assign(i, o);
  90245. });
  90246. var o = t.data;
  90247. return o && function () {
  90248. var e;
  90249. if (e = o, "[object FormData]" !== Object.prototype.toString.call(e)) t.data = _objectSpread(_objectSpread({}, o), r);else for (var _e12 in r) {
  90250. o.append(_e12, r[_e12]);
  90251. }
  90252. }(), t.headers = _objectSpread(_objectSpread({}, t.headers || {}), i), s.call(e, t);
  90253. };
  90254. }
  90255. function Xe() {
  90256. var e = Math.random().toString(16).slice(2);
  90257. return {
  90258. data: {
  90259. seqId: e
  90260. },
  90261. headers: _objectSpread(_objectSpread({}, Ye), {}, {
  90262. "x-seqid": e
  90263. })
  90264. };
  90265. }
  90266. var Ze = /*#__PURE__*/function () {
  90267. function Ze() {
  90268. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  90269. (0, _classCallCheck2.default)(this, Ze);
  90270. var t;
  90271. this.config = e, this._reqClass = new Pe.adapter.reqClass({
  90272. timeout: this.config.timeout,
  90273. timeoutMsg: "\u8BF7\u6C42\u5728".concat(this.config.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"),
  90274. restrictedMethods: ["post"]
  90275. }), this._cache = Le(this.config.env), this._localCache = (t = this.config.env, Re[t]), this.oauth = new Ve(this.config), Qe(this._reqClass, "post", [Xe]), Qe(this._reqClass, "upload", [Xe]), Qe(this._reqClass, "download", [Xe]);
  90276. }
  90277. (0, _createClass2.default)(Ze, [{
  90278. key: "post",
  90279. value: function () {
  90280. var _post = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(e) {
  90281. return _regenerator.default.wrap(function _callee13$(_context13) {
  90282. while (1) {
  90283. switch (_context13.prev = _context13.next) {
  90284. case 0:
  90285. _context13.next = 2;
  90286. return this._reqClass.post(e);
  90287. case 2:
  90288. return _context13.abrupt("return", _context13.sent);
  90289. case 3:
  90290. case "end":
  90291. return _context13.stop();
  90292. }
  90293. }
  90294. }, _callee13, this);
  90295. }));
  90296. function post(_x8) {
  90297. return _post.apply(this, arguments);
  90298. }
  90299. return post;
  90300. }()
  90301. }, {
  90302. key: "upload",
  90303. value: function () {
  90304. var _upload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
  90305. return _regenerator.default.wrap(function _callee14$(_context14) {
  90306. while (1) {
  90307. switch (_context14.prev = _context14.next) {
  90308. case 0:
  90309. _context14.next = 2;
  90310. return this._reqClass.upload(e);
  90311. case 2:
  90312. return _context14.abrupt("return", _context14.sent);
  90313. case 3:
  90314. case "end":
  90315. return _context14.stop();
  90316. }
  90317. }
  90318. }, _callee14, this);
  90319. }));
  90320. function upload(_x9) {
  90321. return _upload.apply(this, arguments);
  90322. }
  90323. return upload;
  90324. }()
  90325. }, {
  90326. key: "download",
  90327. value: function () {
  90328. var _download = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(e) {
  90329. return _regenerator.default.wrap(function _callee15$(_context15) {
  90330. while (1) {
  90331. switch (_context15.prev = _context15.next) {
  90332. case 0:
  90333. _context15.next = 2;
  90334. return this._reqClass.download(e);
  90335. case 2:
  90336. return _context15.abrupt("return", _context15.sent);
  90337. case 3:
  90338. case "end":
  90339. return _context15.stop();
  90340. }
  90341. }
  90342. }, _callee15, this);
  90343. }));
  90344. function download(_x10) {
  90345. return _download.apply(this, arguments);
  90346. }
  90347. return download;
  90348. }()
  90349. }, {
  90350. key: "refreshAccessToken",
  90351. value: function () {
  90352. var _refreshAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
  90353. var e, t;
  90354. return _regenerator.default.wrap(function _callee16$(_context16) {
  90355. while (1) {
  90356. switch (_context16.prev = _context16.next) {
  90357. case 0:
  90358. this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
  90359. _context16.prev = 1;
  90360. _context16.next = 4;
  90361. return this._refreshAccessTokenPromise;
  90362. case 4:
  90363. e = _context16.sent;
  90364. _context16.next = 10;
  90365. break;
  90366. case 7:
  90367. _context16.prev = 7;
  90368. _context16.t0 = _context16["catch"](1);
  90369. t = _context16.t0;
  90370. case 10:
  90371. if (!(this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t)) {
  90372. _context16.next = 12;
  90373. break;
  90374. }
  90375. throw t;
  90376. case 12:
  90377. return _context16.abrupt("return", e);
  90378. case 13:
  90379. case "end":
  90380. return _context16.stop();
  90381. }
  90382. }
  90383. }, _callee16, this, [[1, 7]]);
  90384. }));
  90385. function refreshAccessToken() {
  90386. return _refreshAccessToken2.apply(this, arguments);
  90387. }
  90388. return refreshAccessToken;
  90389. }()
  90390. }, {
  90391. key: "_refreshAccessToken",
  90392. value: function () {
  90393. var _refreshAccessToken3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
  90394. var _this$_cache$keys4, e, t, n, s, r, i, o, a, _e13, _e14, _t8, _s9;
  90395. return _regenerator.default.wrap(function _callee17$(_context17) {
  90396. while (1) {
  90397. switch (_context17.prev = _context17.next) {
  90398. case 0:
  90399. _this$_cache$keys4 = this._cache.keys, e = _this$_cache$keys4.accessTokenKey, t = _this$_cache$keys4.accessTokenExpireKey, n = _this$_cache$keys4.refreshTokenKey, s = _this$_cache$keys4.loginTypeKey, r = _this$_cache$keys4.anonymousUuidKey;
  90400. this._cache.removeStore(e), this._cache.removeStore(t);
  90401. i = this._cache.getStore(n);
  90402. if (i) {
  90403. _context17.next = 5;
  90404. break;
  90405. }
  90406. throw new te({
  90407. message: "未登录CloudBase"
  90408. });
  90409. case 5:
  90410. o = {
  90411. refresh_token: i
  90412. };
  90413. _context17.next = 8;
  90414. return this.request("auth.fetchAccessTokenWithRefreshToken", o);
  90415. case 8:
  90416. a = _context17.sent;
  90417. if (!a.data.code) {
  90418. _context17.next = 21;
  90419. break;
  90420. }
  90421. _e13 = a.data.code;
  90422. if (!("SIGN_PARAM_INVALID" === _e13 || "REFRESH_TOKEN_EXPIRED" === _e13 || "INVALID_REFRESH_TOKEN" === _e13)) {
  90423. _context17.next = 20;
  90424. break;
  90425. }
  90426. if (!(this._cache.getStore(s) === Je.ANONYMOUS && "INVALID_REFRESH_TOKEN" === _e13)) {
  90427. _context17.next = 19;
  90428. break;
  90429. }
  90430. _e14 = this._cache.getStore(r);
  90431. _t8 = this._cache.getStore(n);
  90432. _context17.next = 17;
  90433. return this.send("auth.signInAnonymously", {
  90434. anonymous_uuid: _e14,
  90435. refresh_token: _t8
  90436. });
  90437. case 17:
  90438. _s9 = _context17.sent;
  90439. return _context17.abrupt("return", (this.setRefreshToken(_s9.refresh_token), this._refreshAccessToken()));
  90440. case 19:
  90441. Fe($e), this._cache.removeStore(n);
  90442. case 20:
  90443. throw new te({
  90444. code: a.data.code,
  90445. message: "\u5237\u65B0access token\u5931\u8D25\uFF1A".concat(a.data.code)
  90446. });
  90447. case 21:
  90448. if (!a.data.access_token) {
  90449. _context17.next = 23;
  90450. break;
  90451. }
  90452. return _context17.abrupt("return", (Fe(He), this._cache.setStore(e, a.data.access_token), this._cache.setStore(t, a.data.access_token_expire + Date.now()), {
  90453. accessToken: a.data.access_token,
  90454. accessTokenExpire: a.data.access_token_expire
  90455. }));
  90456. case 23:
  90457. a.data.refresh_token && (this._cache.removeStore(n), this._cache.setStore(n, a.data.refresh_token), this._refreshAccessToken());
  90458. case 24:
  90459. case "end":
  90460. return _context17.stop();
  90461. }
  90462. }
  90463. }, _callee17, this);
  90464. }));
  90465. function _refreshAccessToken() {
  90466. return _refreshAccessToken3.apply(this, arguments);
  90467. }
  90468. return _refreshAccessToken;
  90469. }()
  90470. }, {
  90471. key: "getAccessToken",
  90472. value: function () {
  90473. var _getAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
  90474. var _this$_cache$keys5, e, t, n, s, r, i;
  90475. return _regenerator.default.wrap(function _callee18$(_context18) {
  90476. while (1) {
  90477. switch (_context18.prev = _context18.next) {
  90478. case 0:
  90479. _this$_cache$keys5 = this._cache.keys, e = _this$_cache$keys5.accessTokenKey, t = _this$_cache$keys5.accessTokenExpireKey, n = _this$_cache$keys5.refreshTokenKey;
  90480. if (this._cache.getStore(n)) {
  90481. _context18.next = 3;
  90482. break;
  90483. }
  90484. throw new te({
  90485. message: "refresh token不存在,登录状态异常"
  90486. });
  90487. case 3:
  90488. s = this._cache.getStore(e), r = this._cache.getStore(t), i = !0;
  90489. _context18.t0 = this._shouldRefreshAccessTokenHook;
  90490. if (!_context18.t0) {
  90491. _context18.next = 9;
  90492. break;
  90493. }
  90494. _context18.next = 8;
  90495. return this._shouldRefreshAccessTokenHook(s, r);
  90496. case 8:
  90497. _context18.t0 = !_context18.sent;
  90498. case 9:
  90499. _context18.t1 = _context18.t0;
  90500. if (!_context18.t1) {
  90501. _context18.next = 12;
  90502. break;
  90503. }
  90504. i = !1;
  90505. case 12:
  90506. return _context18.abrupt("return", (!s || !r || r < Date.now()) && i ? this.refreshAccessToken() : {
  90507. accessToken: s,
  90508. accessTokenExpire: r
  90509. });
  90510. case 13:
  90511. case "end":
  90512. return _context18.stop();
  90513. }
  90514. }
  90515. }, _callee18, this);
  90516. }));
  90517. function getAccessToken() {
  90518. return _getAccessToken2.apply(this, arguments);
  90519. }
  90520. return getAccessToken;
  90521. }()
  90522. }, {
  90523. key: "request",
  90524. value: function () {
  90525. var _request3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(e, t, n) {
  90526. var s, r, i, o, _e15, _e16, a, c, u, h, l, d, p, f, g;
  90527. return _regenerator.default.wrap(function _callee19$(_context19) {
  90528. while (1) {
  90529. switch (_context19.prev = _context19.next) {
  90530. case 0:
  90531. s = "x-tcb-trace_".concat(this.config.env);
  90532. r = "application/x-www-form-urlencoded";
  90533. i = _objectSpread({
  90534. action: e,
  90535. env: this.config.env,
  90536. dataVersion: "2019-08-16"
  90537. }, t);
  90538. _context19.t0 = -1 === Ge.indexOf(e);
  90539. if (!_context19.t0) {
  90540. _context19.next = 9;
  90541. break;
  90542. }
  90543. this._cache.keys;
  90544. _context19.next = 8;
  90545. return this.oauth.getAccessToken();
  90546. case 8:
  90547. i.access_token = _context19.sent;
  90548. case 9:
  90549. if (!("storage.uploadFile" === e)) {
  90550. _context19.next = 15;
  90551. break;
  90552. }
  90553. o = new FormData();
  90554. for (_e15 in o) {
  90555. o.hasOwnProperty(_e15) && void 0 !== o[_e15] && o.append(_e15, i[_e15]);
  90556. }
  90557. r = "multipart/form-data";
  90558. _context19.next = 17;
  90559. break;
  90560. case 15:
  90561. r = "application/json", o = {};
  90562. for (_e16 in i) {
  90563. void 0 !== i[_e16] && (o[_e16] = i[_e16]);
  90564. }
  90565. case 17:
  90566. a = {
  90567. headers: {
  90568. "content-type": r
  90569. }
  90570. };
  90571. n && n.timeout && (a.timeout = n.timeout), n && n.onUploadProgress && (a.onUploadProgress = n.onUploadProgress);
  90572. c = this._localCache.getStore(s);
  90573. c && (a.headers["X-TCB-Trace"] = c);
  90574. u = t.parse, h = t.inQuery, l = t.search;
  90575. d = {
  90576. env: this.config.env
  90577. };
  90578. u && (d.parse = !0), h && (d = _objectSpread(_objectSpread({}, h), d));
  90579. p = function (e, t) {
  90580. var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  90581. var s = /\?/.test(t);
  90582. var r = "";
  90583. for (var _e17 in n) {
  90584. "" === r ? !s && (t += "?") : r += "&", r += "".concat(_e17, "=").concat(encodeURIComponent(n[_e17]));
  90585. }
  90586. return /^http(s)?\:\/\//.test(t += r) ? t : "".concat(e).concat(t);
  90587. }(fe, "//tcb-api.tencentcloudapi.com/web", d);
  90588. l && (p += l);
  90589. _context19.next = 28;
  90590. return this.post(_objectSpread({
  90591. url: p,
  90592. data: o
  90593. }, a));
  90594. case 28:
  90595. f = _context19.sent;
  90596. g = f.header && f.header["x-tcb-trace"];
  90597. if (!(g && this._localCache.setStore(s, g), 200 !== Number(f.status) && 200 !== Number(f.statusCode) || !f.data)) {
  90598. _context19.next = 32;
  90599. break;
  90600. }
  90601. throw new te({
  90602. code: "NETWORK_ERROR",
  90603. message: "network request error"
  90604. });
  90605. case 32:
  90606. return _context19.abrupt("return", f);
  90607. case 33:
  90608. case "end":
  90609. return _context19.stop();
  90610. }
  90611. }
  90612. }, _callee19, this);
  90613. }));
  90614. function request(_x11, _x12, _x13) {
  90615. return _request3.apply(this, arguments);
  90616. }
  90617. return request;
  90618. }()
  90619. }, {
  90620. key: "send",
  90621. value: function () {
  90622. var _send = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(e) {
  90623. var t,
  90624. n,
  90625. s,
  90626. _s10,
  90627. _args20 = arguments;
  90628. return _regenerator.default.wrap(function _callee20$(_context20) {
  90629. while (1) {
  90630. switch (_context20.prev = _context20.next) {
  90631. case 0:
  90632. t = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
  90633. n = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
  90634. _context20.next = 4;
  90635. return this.request(e, t, _objectSpread(_objectSpread({}, n), {}, {
  90636. onUploadProgress: t.onUploadProgress
  90637. }));
  90638. case 4:
  90639. s = _context20.sent;
  90640. if (!(("ACCESS_TOKEN_DISABLED" === s.data.code || "ACCESS_TOKEN_EXPIRED" === s.data.code) && -1 === Ge.indexOf(e))) {
  90641. _context20.next = 14;
  90642. break;
  90643. }
  90644. _context20.next = 8;
  90645. return this.oauth.refreshAccessToken();
  90646. case 8:
  90647. _context20.next = 10;
  90648. return this.request(e, t, _objectSpread(_objectSpread({}, n), {}, {
  90649. onUploadProgress: t.onUploadProgress
  90650. }));
  90651. case 10:
  90652. _s10 = _context20.sent;
  90653. if (!_s10.data.code) {
  90654. _context20.next = 13;
  90655. break;
  90656. }
  90657. throw new te({
  90658. code: _s10.data.code,
  90659. message: Te(_s10.data.message)
  90660. });
  90661. case 13:
  90662. return _context20.abrupt("return", _s10.data);
  90663. case 14:
  90664. if (!s.data.code) {
  90665. _context20.next = 16;
  90666. break;
  90667. }
  90668. throw new te({
  90669. code: s.data.code,
  90670. message: Te(s.data.message)
  90671. });
  90672. case 16:
  90673. return _context20.abrupt("return", s.data);
  90674. case 17:
  90675. case "end":
  90676. return _context20.stop();
  90677. }
  90678. }
  90679. }, _callee20, this);
  90680. }));
  90681. function send(_x14) {
  90682. return _send.apply(this, arguments);
  90683. }
  90684. return send;
  90685. }()
  90686. }, {
  90687. key: "setRefreshToken",
  90688. value: function setRefreshToken(e) {
  90689. var _this$_cache$keys6 = this._cache.keys,
  90690. t = _this$_cache$keys6.accessTokenKey,
  90691. n = _this$_cache$keys6.accessTokenExpireKey,
  90692. s = _this$_cache$keys6.refreshTokenKey;
  90693. this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
  90694. }
  90695. }]);
  90696. return Ze;
  90697. }();
  90698. var et = {};
  90699. function tt(e) {
  90700. return et[e];
  90701. }
  90702. var nt = /*#__PURE__*/function () {
  90703. function nt(e) {
  90704. (0, _classCallCheck2.default)(this, nt);
  90705. this.config = e, this._cache = Le(e.env), this._request = tt(e.env);
  90706. }
  90707. (0, _createClass2.default)(nt, [{
  90708. key: "setRefreshToken",
  90709. value: function setRefreshToken(e) {
  90710. var _this$_cache$keys7 = this._cache.keys,
  90711. t = _this$_cache$keys7.accessTokenKey,
  90712. n = _this$_cache$keys7.accessTokenExpireKey,
  90713. s = _this$_cache$keys7.refreshTokenKey;
  90714. this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
  90715. }
  90716. }, {
  90717. key: "setAccessToken",
  90718. value: function setAccessToken(e, t) {
  90719. var _this$_cache$keys8 = this._cache.keys,
  90720. n = _this$_cache$keys8.accessTokenKey,
  90721. s = _this$_cache$keys8.accessTokenExpireKey;
  90722. this._cache.setStore(n, e), this._cache.setStore(s, t);
  90723. }
  90724. }, {
  90725. key: "refreshUserInfo",
  90726. value: function () {
  90727. var _refreshUserInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
  90728. var _yield$this$_request$, e;
  90729. return _regenerator.default.wrap(function _callee21$(_context21) {
  90730. while (1) {
  90731. switch (_context21.prev = _context21.next) {
  90732. case 0:
  90733. _context21.next = 2;
  90734. return this._request.send("auth.getUserInfo", {});
  90735. case 2:
  90736. _yield$this$_request$ = _context21.sent;
  90737. e = _yield$this$_request$.data;
  90738. return _context21.abrupt("return", (this.setLocalUserInfo(e), e));
  90739. case 5:
  90740. case "end":
  90741. return _context21.stop();
  90742. }
  90743. }
  90744. }, _callee21, this);
  90745. }));
  90746. function refreshUserInfo() {
  90747. return _refreshUserInfo.apply(this, arguments);
  90748. }
  90749. return refreshUserInfo;
  90750. }()
  90751. }, {
  90752. key: "setLocalUserInfo",
  90753. value: function setLocalUserInfo(e) {
  90754. var t = this._cache.keys.userInfoKey;
  90755. this._cache.setStore(t, e);
  90756. }
  90757. }]);
  90758. return nt;
  90759. }();
  90760. var st = /*#__PURE__*/function () {
  90761. function st(e) {
  90762. (0, _classCallCheck2.default)(this, st);
  90763. if (!e) throw new te({
  90764. code: "PARAM_ERROR",
  90765. message: "envId is not defined"
  90766. });
  90767. this._envId = e, this._cache = Le(this._envId), this._request = tt(this._envId), this.setUserInfo();
  90768. }
  90769. (0, _createClass2.default)(st, [{
  90770. key: "linkWithTicket",
  90771. value: function linkWithTicket(e) {
  90772. if ("string" != typeof e) throw new te({
  90773. code: "PARAM_ERROR",
  90774. message: "ticket must be string"
  90775. });
  90776. return this._request.send("auth.linkWithTicket", {
  90777. ticket: e
  90778. });
  90779. }
  90780. }, {
  90781. key: "linkWithRedirect",
  90782. value: function linkWithRedirect(e) {
  90783. e.signInWithRedirect();
  90784. }
  90785. }, {
  90786. key: "updatePassword",
  90787. value: function updatePassword(e, t) {
  90788. return this._request.send("auth.updatePassword", {
  90789. oldPassword: t,
  90790. newPassword: e
  90791. });
  90792. }
  90793. }, {
  90794. key: "updateEmail",
  90795. value: function updateEmail(e) {
  90796. return this._request.send("auth.updateEmail", {
  90797. newEmail: e
  90798. });
  90799. }
  90800. }, {
  90801. key: "updateUsername",
  90802. value: function updateUsername(e) {
  90803. if ("string" != typeof e) throw new te({
  90804. code: "PARAM_ERROR",
  90805. message: "username must be a string"
  90806. });
  90807. return this._request.send("auth.updateUsername", {
  90808. username: e
  90809. });
  90810. }
  90811. }, {
  90812. key: "getLinkedUidList",
  90813. value: function () {
  90814. var _getLinkedUidList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
  90815. var _yield$this$_request$2, e, t, n;
  90816. return _regenerator.default.wrap(function _callee22$(_context22) {
  90817. while (1) {
  90818. switch (_context22.prev = _context22.next) {
  90819. case 0:
  90820. _context22.next = 2;
  90821. return this._request.send("auth.getLinkedUidList", {});
  90822. case 2:
  90823. _yield$this$_request$2 = _context22.sent;
  90824. e = _yield$this$_request$2.data;
  90825. t = !1;
  90826. n = e.users;
  90827. return _context22.abrupt("return", (n.forEach(function (e) {
  90828. e.wxOpenId && e.wxPublicId && (t = !0);
  90829. }), {
  90830. users: n,
  90831. hasPrimaryUid: t
  90832. }));
  90833. case 7:
  90834. case "end":
  90835. return _context22.stop();
  90836. }
  90837. }
  90838. }, _callee22, this);
  90839. }));
  90840. function getLinkedUidList() {
  90841. return _getLinkedUidList.apply(this, arguments);
  90842. }
  90843. return getLinkedUidList;
  90844. }()
  90845. }, {
  90846. key: "setPrimaryUid",
  90847. value: function setPrimaryUid(e) {
  90848. return this._request.send("auth.setPrimaryUid", {
  90849. uid: e
  90850. });
  90851. }
  90852. }, {
  90853. key: "unlink",
  90854. value: function unlink(e) {
  90855. return this._request.send("auth.unlink", {
  90856. platform: e
  90857. });
  90858. }
  90859. }, {
  90860. key: "update",
  90861. value: function () {
  90862. var _update = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(e) {
  90863. var t, n, s, r, i, o, _yield$this$_request$3, a;
  90864. return _regenerator.default.wrap(function _callee23$(_context23) {
  90865. while (1) {
  90866. switch (_context23.prev = _context23.next) {
  90867. case 0:
  90868. t = e.nickName;
  90869. n = e.gender;
  90870. s = e.avatarUrl;
  90871. r = e.province;
  90872. i = e.country;
  90873. o = e.city;
  90874. _context23.next = 8;
  90875. return this._request.send("auth.updateUserInfo", {
  90876. nickName: t,
  90877. gender: n,
  90878. avatarUrl: s,
  90879. province: r,
  90880. country: i,
  90881. city: o
  90882. });
  90883. case 8:
  90884. _yield$this$_request$3 = _context23.sent;
  90885. a = _yield$this$_request$3.data;
  90886. this.setLocalUserInfo(a);
  90887. case 11:
  90888. case "end":
  90889. return _context23.stop();
  90890. }
  90891. }
  90892. }, _callee23, this);
  90893. }));
  90894. function update(_x15) {
  90895. return _update.apply(this, arguments);
  90896. }
  90897. return update;
  90898. }()
  90899. }, {
  90900. key: "refresh",
  90901. value: function () {
  90902. var _refresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
  90903. var e;
  90904. return _regenerator.default.wrap(function _callee24$(_context24) {
  90905. while (1) {
  90906. switch (_context24.prev = _context24.next) {
  90907. case 0:
  90908. _context24.next = 2;
  90909. return this._request.oauth.getUserInfo();
  90910. case 2:
  90911. e = _context24.sent;
  90912. return _context24.abrupt("return", (this.setLocalUserInfo(e), e));
  90913. case 4:
  90914. case "end":
  90915. return _context24.stop();
  90916. }
  90917. }
  90918. }, _callee24, this);
  90919. }));
  90920. function refresh() {
  90921. return _refresh.apply(this, arguments);
  90922. }
  90923. return refresh;
  90924. }()
  90925. }, {
  90926. key: "setUserInfo",
  90927. value: function setUserInfo() {
  90928. var _this11 = this;
  90929. var e = this._cache.keys.userInfoKey,
  90930. t = this._cache.getStore(e);
  90931. ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach(function (e) {
  90932. _this11[e] = t[e];
  90933. }), this.location = {
  90934. country: t.country,
  90935. province: t.province,
  90936. city: t.city
  90937. };
  90938. }
  90939. }, {
  90940. key: "setLocalUserInfo",
  90941. value: function setLocalUserInfo(e) {
  90942. var t = this._cache.keys.userInfoKey;
  90943. this._cache.setStore(t, e), this.setUserInfo();
  90944. }
  90945. }]);
  90946. return st;
  90947. }();
  90948. var rt = /*#__PURE__*/function () {
  90949. function rt(e) {
  90950. (0, _classCallCheck2.default)(this, rt);
  90951. if (!e) throw new te({
  90952. code: "PARAM_ERROR",
  90953. message: "envId is not defined"
  90954. });
  90955. this._cache = Le(e);
  90956. var _this$_cache$keys9 = this._cache.keys,
  90957. t = _this$_cache$keys9.refreshTokenKey,
  90958. n = _this$_cache$keys9.accessTokenKey,
  90959. s = _this$_cache$keys9.accessTokenExpireKey,
  90960. r = this._cache.getStore(t),
  90961. i = this._cache.getStore(n),
  90962. o = this._cache.getStore(s);
  90963. this.credential = {
  90964. refreshToken: r,
  90965. accessToken: i,
  90966. accessTokenExpire: o
  90967. }, this.user = new st(e);
  90968. }
  90969. (0, _createClass2.default)(rt, [{
  90970. key: "isAnonymousAuth",
  90971. get: function get() {
  90972. return this.loginType === Je.ANONYMOUS;
  90973. }
  90974. }, {
  90975. key: "isCustomAuth",
  90976. get: function get() {
  90977. return this.loginType === Je.CUSTOM;
  90978. }
  90979. }, {
  90980. key: "isWeixinAuth",
  90981. get: function get() {
  90982. return this.loginType === Je.WECHAT || this.loginType === Je.WECHAT_OPEN || this.loginType === Je.WECHAT_PUBLIC;
  90983. }
  90984. }, {
  90985. key: "loginType",
  90986. get: function get() {
  90987. return this._cache.getStore(this._cache.keys.loginTypeKey);
  90988. }
  90989. }]);
  90990. return rt;
  90991. }();
  90992. var it = /*#__PURE__*/function (_nt) {
  90993. (0, _inherits2.default)(it, _nt);
  90994. var _super4 = _createSuper(it);
  90995. function it() {
  90996. (0, _classCallCheck2.default)(this, it);
  90997. return _super4.apply(this, arguments);
  90998. }
  90999. (0, _createClass2.default)(it, [{
  91000. key: "signIn",
  91001. value: function () {
  91002. var _signIn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
  91003. var e;
  91004. return _regenerator.default.wrap(function _callee25$(_context25) {
  91005. while (1) {
  91006. switch (_context25.prev = _context25.next) {
  91007. case 0:
  91008. this._cache.updatePersistence("local");
  91009. _context25.next = 3;
  91010. return this._request.oauth.getAccessToken();
  91011. case 3:
  91012. Fe(je);
  91013. Fe(Be, {
  91014. env: this.config.env,
  91015. loginType: Je.ANONYMOUS,
  91016. persistence: "local"
  91017. });
  91018. e = new rt(this.config.env);
  91019. _context25.next = 8;
  91020. return e.user.refresh();
  91021. case 8:
  91022. return _context25.abrupt("return", e);
  91023. case 9:
  91024. case "end":
  91025. return _context25.stop();
  91026. }
  91027. }
  91028. }, _callee25, this);
  91029. }));
  91030. function signIn() {
  91031. return _signIn.apply(this, arguments);
  91032. }
  91033. return signIn;
  91034. }()
  91035. }, {
  91036. key: "linkAndRetrieveDataWithTicket",
  91037. value: function () {
  91038. var _linkAndRetrieveDataWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(e) {
  91039. var _this$_cache$keys10, t, n, s, r, i;
  91040. return _regenerator.default.wrap(function _callee26$(_context26) {
  91041. while (1) {
  91042. switch (_context26.prev = _context26.next) {
  91043. case 0:
  91044. _this$_cache$keys10 = this._cache.keys;
  91045. t = _this$_cache$keys10.anonymousUuidKey;
  91046. n = _this$_cache$keys10.refreshTokenKey;
  91047. s = this._cache.getStore(t);
  91048. r = this._cache.getStore(n);
  91049. _context26.next = 7;
  91050. return this._request.send("auth.linkAndRetrieveDataWithTicket", {
  91051. anonymous_uuid: s,
  91052. refresh_token: r,
  91053. ticket: e
  91054. });
  91055. case 7:
  91056. i = _context26.sent;
  91057. if (!i.refresh_token) {
  91058. _context26.next = 16;
  91059. break;
  91060. }
  91061. this._clearAnonymousUUID();
  91062. this.setRefreshToken(i.refresh_token);
  91063. _context26.next = 13;
  91064. return this._request.refreshAccessToken();
  91065. case 13:
  91066. Fe(We, {
  91067. env: this.config.env
  91068. });
  91069. Fe(Be, {
  91070. loginType: Je.CUSTOM,
  91071. persistence: "local"
  91072. });
  91073. return _context26.abrupt("return", {
  91074. credential: {
  91075. refreshToken: i.refresh_token
  91076. }
  91077. });
  91078. case 16:
  91079. throw new te({
  91080. message: "匿名转化失败"
  91081. });
  91082. case 17:
  91083. case "end":
  91084. return _context26.stop();
  91085. }
  91086. }
  91087. }, _callee26, this);
  91088. }));
  91089. function linkAndRetrieveDataWithTicket(_x16) {
  91090. return _linkAndRetrieveDataWithTicket.apply(this, arguments);
  91091. }
  91092. return linkAndRetrieveDataWithTicket;
  91093. }()
  91094. }, {
  91095. key: "_setAnonymousUUID",
  91096. value: function _setAnonymousUUID(e) {
  91097. var _this$_cache$keys11 = this._cache.keys,
  91098. t = _this$_cache$keys11.anonymousUuidKey,
  91099. n = _this$_cache$keys11.loginTypeKey;
  91100. this._cache.removeStore(t), this._cache.setStore(t, e), this._cache.setStore(n, Je.ANONYMOUS);
  91101. }
  91102. }, {
  91103. key: "_clearAnonymousUUID",
  91104. value: function _clearAnonymousUUID() {
  91105. this._cache.removeStore(this._cache.keys.anonymousUuidKey);
  91106. }
  91107. }]);
  91108. return it;
  91109. }(nt);
  91110. var ot = /*#__PURE__*/function (_nt2) {
  91111. (0, _inherits2.default)(ot, _nt2);
  91112. var _super5 = _createSuper(ot);
  91113. function ot() {
  91114. (0, _classCallCheck2.default)(this, ot);
  91115. return _super5.apply(this, arguments);
  91116. }
  91117. (0, _createClass2.default)(ot, [{
  91118. key: "signIn",
  91119. value: function () {
  91120. var _signIn2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(e) {
  91121. var t, n;
  91122. return _regenerator.default.wrap(function _callee27$(_context27) {
  91123. while (1) {
  91124. switch (_context27.prev = _context27.next) {
  91125. case 0:
  91126. if (!("string" != typeof e)) {
  91127. _context27.next = 2;
  91128. break;
  91129. }
  91130. throw new te({
  91131. code: "PARAM_ERROR",
  91132. message: "ticket must be a string"
  91133. });
  91134. case 2:
  91135. t = this._cache.keys.refreshTokenKey;
  91136. _context27.next = 5;
  91137. return this._request.send("auth.signInWithTicket", {
  91138. ticket: e,
  91139. refresh_token: this._cache.getStore(t) || ""
  91140. });
  91141. case 5:
  91142. n = _context27.sent;
  91143. if (!n.refresh_token) {
  91144. _context27.next = 15;
  91145. break;
  91146. }
  91147. this.setRefreshToken(n.refresh_token);
  91148. _context27.next = 10;
  91149. return this._request.refreshAccessToken();
  91150. case 10:
  91151. Fe(je);
  91152. Fe(Be, {
  91153. env: this.config.env,
  91154. loginType: Je.CUSTOM,
  91155. persistence: this.config.persistence
  91156. });
  91157. _context27.next = 14;
  91158. return this.refreshUserInfo();
  91159. case 14:
  91160. return _context27.abrupt("return", new rt(this.config.env));
  91161. case 15:
  91162. throw new te({
  91163. message: "自定义登录失败"
  91164. });
  91165. case 16:
  91166. case "end":
  91167. return _context27.stop();
  91168. }
  91169. }
  91170. }, _callee27, this);
  91171. }));
  91172. function signIn(_x17) {
  91173. return _signIn2.apply(this, arguments);
  91174. }
  91175. return signIn;
  91176. }()
  91177. }]);
  91178. return ot;
  91179. }(nt);
  91180. var at = /*#__PURE__*/function (_nt3) {
  91181. (0, _inherits2.default)(at, _nt3);
  91182. var _super6 = _createSuper(at);
  91183. function at() {
  91184. (0, _classCallCheck2.default)(this, at);
  91185. return _super6.apply(this, arguments);
  91186. }
  91187. (0, _createClass2.default)(at, [{
  91188. key: "signIn",
  91189. value: function () {
  91190. var _signIn3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(e, t) {
  91191. var n, s, r, i, o;
  91192. return _regenerator.default.wrap(function _callee28$(_context28) {
  91193. while (1) {
  91194. switch (_context28.prev = _context28.next) {
  91195. case 0:
  91196. if (!("string" != typeof e)) {
  91197. _context28.next = 2;
  91198. break;
  91199. }
  91200. throw new te({
  91201. code: "PARAM_ERROR",
  91202. message: "email must be a string"
  91203. });
  91204. case 2:
  91205. n = this._cache.keys.refreshTokenKey;
  91206. _context28.next = 5;
  91207. return this._request.send("auth.signIn", {
  91208. loginType: "EMAIL",
  91209. email: e,
  91210. password: t,
  91211. refresh_token: this._cache.getStore(n) || ""
  91212. });
  91213. case 5:
  91214. s = _context28.sent;
  91215. r = s.refresh_token;
  91216. i = s.access_token;
  91217. o = s.access_token_expire;
  91218. if (!r) {
  91219. _context28.next = 22;
  91220. break;
  91221. }
  91222. this.setRefreshToken(r);
  91223. if (!(i && o)) {
  91224. _context28.next = 15;
  91225. break;
  91226. }
  91227. this.setAccessToken(i, o);
  91228. _context28.next = 17;
  91229. break;
  91230. case 15:
  91231. _context28.next = 17;
  91232. return this._request.refreshAccessToken();
  91233. case 17:
  91234. _context28.next = 19;
  91235. return this.refreshUserInfo();
  91236. case 19:
  91237. Fe(je);
  91238. Fe(Be, {
  91239. env: this.config.env,
  91240. loginType: Je.EMAIL,
  91241. persistence: this.config.persistence
  91242. });
  91243. return _context28.abrupt("return", new rt(this.config.env));
  91244. case 22:
  91245. throw s.code ? new te({
  91246. code: s.code,
  91247. message: "\u90AE\u7BB1\u767B\u5F55\u5931\u8D25: ".concat(s.message)
  91248. }) : new te({
  91249. message: "邮箱登录失败"
  91250. });
  91251. case 23:
  91252. case "end":
  91253. return _context28.stop();
  91254. }
  91255. }
  91256. }, _callee28, this);
  91257. }));
  91258. function signIn(_x18, _x19) {
  91259. return _signIn3.apply(this, arguments);
  91260. }
  91261. return signIn;
  91262. }()
  91263. }, {
  91264. key: "activate",
  91265. value: function () {
  91266. var _activate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(e) {
  91267. return _regenerator.default.wrap(function _callee29$(_context29) {
  91268. while (1) {
  91269. switch (_context29.prev = _context29.next) {
  91270. case 0:
  91271. return _context29.abrupt("return", this._request.send("auth.activateEndUserMail", {
  91272. token: e
  91273. }));
  91274. case 1:
  91275. case "end":
  91276. return _context29.stop();
  91277. }
  91278. }
  91279. }, _callee29, this);
  91280. }));
  91281. function activate(_x20) {
  91282. return _activate.apply(this, arguments);
  91283. }
  91284. return activate;
  91285. }()
  91286. }, {
  91287. key: "resetPasswordWithToken",
  91288. value: function () {
  91289. var _resetPasswordWithToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(e, t) {
  91290. return _regenerator.default.wrap(function _callee30$(_context30) {
  91291. while (1) {
  91292. switch (_context30.prev = _context30.next) {
  91293. case 0:
  91294. return _context30.abrupt("return", this._request.send("auth.resetPasswordWithToken", {
  91295. token: e,
  91296. newPassword: t
  91297. }));
  91298. case 1:
  91299. case "end":
  91300. return _context30.stop();
  91301. }
  91302. }
  91303. }, _callee30, this);
  91304. }));
  91305. function resetPasswordWithToken(_x21, _x22) {
  91306. return _resetPasswordWithToken.apply(this, arguments);
  91307. }
  91308. return resetPasswordWithToken;
  91309. }()
  91310. }]);
  91311. return at;
  91312. }(nt);
  91313. var ct = /*#__PURE__*/function (_nt4) {
  91314. (0, _inherits2.default)(ct, _nt4);
  91315. var _super7 = _createSuper(ct);
  91316. function ct() {
  91317. (0, _classCallCheck2.default)(this, ct);
  91318. return _super7.apply(this, arguments);
  91319. }
  91320. (0, _createClass2.default)(ct, [{
  91321. key: "signIn",
  91322. value: function () {
  91323. var _signIn4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(e, t) {
  91324. var n, s, r, i, o;
  91325. return _regenerator.default.wrap(function _callee31$(_context31) {
  91326. while (1) {
  91327. switch (_context31.prev = _context31.next) {
  91328. case 0:
  91329. if (!("string" != typeof e)) {
  91330. _context31.next = 2;
  91331. break;
  91332. }
  91333. throw new te({
  91334. code: "PARAM_ERROR",
  91335. message: "username must be a string"
  91336. });
  91337. case 2:
  91338. "string" != typeof t && (t = "", console.warn("password is empty"));
  91339. n = this._cache.keys.refreshTokenKey;
  91340. _context31.next = 6;
  91341. return this._request.send("auth.signIn", {
  91342. loginType: Je.USERNAME,
  91343. username: e,
  91344. password: t,
  91345. refresh_token: this._cache.getStore(n) || ""
  91346. });
  91347. case 6:
  91348. s = _context31.sent;
  91349. r = s.refresh_token;
  91350. i = s.access_token_expire;
  91351. o = s.access_token;
  91352. if (!r) {
  91353. _context31.next = 23;
  91354. break;
  91355. }
  91356. this.setRefreshToken(r);
  91357. if (!(o && i)) {
  91358. _context31.next = 16;
  91359. break;
  91360. }
  91361. this.setAccessToken(o, i);
  91362. _context31.next = 18;
  91363. break;
  91364. case 16:
  91365. _context31.next = 18;
  91366. return this._request.refreshAccessToken();
  91367. case 18:
  91368. _context31.next = 20;
  91369. return this.refreshUserInfo();
  91370. case 20:
  91371. Fe(je);
  91372. Fe(Be, {
  91373. env: this.config.env,
  91374. loginType: Je.USERNAME,
  91375. persistence: this.config.persistence
  91376. });
  91377. return _context31.abrupt("return", new rt(this.config.env));
  91378. case 23:
  91379. throw s.code ? new te({
  91380. code: s.code,
  91381. message: "\u7528\u6237\u540D\u5BC6\u7801\u767B\u5F55\u5931\u8D25: ".concat(s.message)
  91382. }) : new te({
  91383. message: "用户名密码登录失败"
  91384. });
  91385. case 24:
  91386. case "end":
  91387. return _context31.stop();
  91388. }
  91389. }
  91390. }, _callee31, this);
  91391. }));
  91392. function signIn(_x23, _x24) {
  91393. return _signIn4.apply(this, arguments);
  91394. }
  91395. return signIn;
  91396. }()
  91397. }]);
  91398. return ct;
  91399. }(nt);
  91400. var ut = /*#__PURE__*/function () {
  91401. function ut(e) {
  91402. (0, _classCallCheck2.default)(this, ut);
  91403. this.config = e, this._cache = Le(e.env), this._request = tt(e.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), qe(Be, this._onLoginTypeChanged);
  91404. }
  91405. (0, _createClass2.default)(ut, [{
  91406. key: "currentUser",
  91407. get: function get() {
  91408. var e = this.hasLoginState();
  91409. return e && e.user || null;
  91410. }
  91411. }, {
  91412. key: "loginType",
  91413. get: function get() {
  91414. return this._cache.getStore(this._cache.keys.loginTypeKey);
  91415. }
  91416. }, {
  91417. key: "anonymousAuthProvider",
  91418. value: function anonymousAuthProvider() {
  91419. return new it(this.config);
  91420. }
  91421. }, {
  91422. key: "customAuthProvider",
  91423. value: function customAuthProvider() {
  91424. return new ot(this.config);
  91425. }
  91426. }, {
  91427. key: "emailAuthProvider",
  91428. value: function emailAuthProvider() {
  91429. return new at(this.config);
  91430. }
  91431. }, {
  91432. key: "usernameAuthProvider",
  91433. value: function usernameAuthProvider() {
  91434. return new ct(this.config);
  91435. }
  91436. }, {
  91437. key: "signInAnonymously",
  91438. value: function () {
  91439. var _signInAnonymously = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
  91440. return _regenerator.default.wrap(function _callee32$(_context32) {
  91441. while (1) {
  91442. switch (_context32.prev = _context32.next) {
  91443. case 0:
  91444. return _context32.abrupt("return", new it(this.config).signIn());
  91445. case 1:
  91446. case "end":
  91447. return _context32.stop();
  91448. }
  91449. }
  91450. }, _callee32, this);
  91451. }));
  91452. function signInAnonymously() {
  91453. return _signInAnonymously.apply(this, arguments);
  91454. }
  91455. return signInAnonymously;
  91456. }()
  91457. }, {
  91458. key: "signInWithEmailAndPassword",
  91459. value: function () {
  91460. var _signInWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(e, t) {
  91461. return _regenerator.default.wrap(function _callee33$(_context33) {
  91462. while (1) {
  91463. switch (_context33.prev = _context33.next) {
  91464. case 0:
  91465. return _context33.abrupt("return", new at(this.config).signIn(e, t));
  91466. case 1:
  91467. case "end":
  91468. return _context33.stop();
  91469. }
  91470. }
  91471. }, _callee33, this);
  91472. }));
  91473. function signInWithEmailAndPassword(_x25, _x26) {
  91474. return _signInWithEmailAndPassword.apply(this, arguments);
  91475. }
  91476. return signInWithEmailAndPassword;
  91477. }()
  91478. }, {
  91479. key: "signInWithUsernameAndPassword",
  91480. value: function signInWithUsernameAndPassword(e, t) {
  91481. return new ct(this.config).signIn(e, t);
  91482. }
  91483. }, {
  91484. key: "linkAndRetrieveDataWithTicket",
  91485. value: function () {
  91486. var _linkAndRetrieveDataWithTicket2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(e) {
  91487. return _regenerator.default.wrap(function _callee34$(_context34) {
  91488. while (1) {
  91489. switch (_context34.prev = _context34.next) {
  91490. case 0:
  91491. this._anonymousAuthProvider || (this._anonymousAuthProvider = new it(this.config)), qe(We, this._onAnonymousConverted);
  91492. _context34.next = 3;
  91493. return this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e);
  91494. case 3:
  91495. return _context34.abrupt("return", _context34.sent);
  91496. case 4:
  91497. case "end":
  91498. return _context34.stop();
  91499. }
  91500. }
  91501. }, _callee34, this);
  91502. }));
  91503. function linkAndRetrieveDataWithTicket(_x27) {
  91504. return _linkAndRetrieveDataWithTicket2.apply(this, arguments);
  91505. }
  91506. return linkAndRetrieveDataWithTicket;
  91507. }()
  91508. }, {
  91509. key: "signOut",
  91510. value: function () {
  91511. var _signOut = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
  91512. var _this$_cache$keys12, e, t, n, s, r;
  91513. return _regenerator.default.wrap(function _callee35$(_context35) {
  91514. while (1) {
  91515. switch (_context35.prev = _context35.next) {
  91516. case 0:
  91517. if (!(this.loginType === Je.ANONYMOUS)) {
  91518. _context35.next = 2;
  91519. break;
  91520. }
  91521. throw new te({
  91522. message: "匿名用户不支持登出操作"
  91523. });
  91524. case 2:
  91525. _this$_cache$keys12 = this._cache.keys, e = _this$_cache$keys12.refreshTokenKey, t = _this$_cache$keys12.accessTokenKey, n = _this$_cache$keys12.accessTokenExpireKey, s = this._cache.getStore(e);
  91526. if (s) {
  91527. _context35.next = 5;
  91528. break;
  91529. }
  91530. return _context35.abrupt("return");
  91531. case 5:
  91532. _context35.next = 7;
  91533. return this._request.send("auth.logout", {
  91534. refresh_token: s
  91535. });
  91536. case 7:
  91537. r = _context35.sent;
  91538. return _context35.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.removeStore(n), Fe(je), Fe(Be, {
  91539. env: this.config.env,
  91540. loginType: Je.NULL,
  91541. persistence: this.config.persistence
  91542. }), r));
  91543. case 9:
  91544. case "end":
  91545. return _context35.stop();
  91546. }
  91547. }
  91548. }, _callee35, this);
  91549. }));
  91550. function signOut() {
  91551. return _signOut.apply(this, arguments);
  91552. }
  91553. return signOut;
  91554. }()
  91555. }, {
  91556. key: "signUpWithEmailAndPassword",
  91557. value: function () {
  91558. var _signUpWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(e, t) {
  91559. return _regenerator.default.wrap(function _callee36$(_context36) {
  91560. while (1) {
  91561. switch (_context36.prev = _context36.next) {
  91562. case 0:
  91563. return _context36.abrupt("return", this._request.send("auth.signUpWithEmailAndPassword", {
  91564. email: e,
  91565. password: t
  91566. }));
  91567. case 1:
  91568. case "end":
  91569. return _context36.stop();
  91570. }
  91571. }
  91572. }, _callee36, this);
  91573. }));
  91574. function signUpWithEmailAndPassword(_x28, _x29) {
  91575. return _signUpWithEmailAndPassword.apply(this, arguments);
  91576. }
  91577. return signUpWithEmailAndPassword;
  91578. }()
  91579. }, {
  91580. key: "sendPasswordResetEmail",
  91581. value: function () {
  91582. var _sendPasswordResetEmail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37(e) {
  91583. return _regenerator.default.wrap(function _callee37$(_context37) {
  91584. while (1) {
  91585. switch (_context37.prev = _context37.next) {
  91586. case 0:
  91587. return _context37.abrupt("return", this._request.send("auth.sendPasswordResetEmail", {
  91588. email: e
  91589. }));
  91590. case 1:
  91591. case "end":
  91592. return _context37.stop();
  91593. }
  91594. }
  91595. }, _callee37, this);
  91596. }));
  91597. function sendPasswordResetEmail(_x30) {
  91598. return _sendPasswordResetEmail.apply(this, arguments);
  91599. }
  91600. return sendPasswordResetEmail;
  91601. }()
  91602. }, {
  91603. key: "onLoginStateChanged",
  91604. value: function onLoginStateChanged(e) {
  91605. var _this12 = this;
  91606. qe(je, function () {
  91607. var t = _this12.hasLoginState();
  91608. e.call(_this12, t);
  91609. });
  91610. var t = this.hasLoginState();
  91611. e.call(this, t);
  91612. }
  91613. }, {
  91614. key: "onLoginStateExpired",
  91615. value: function onLoginStateExpired(e) {
  91616. qe($e, e.bind(this));
  91617. }
  91618. }, {
  91619. key: "onAccessTokenRefreshed",
  91620. value: function onAccessTokenRefreshed(e) {
  91621. qe(He, e.bind(this));
  91622. }
  91623. }, {
  91624. key: "onAnonymousConverted",
  91625. value: function onAnonymousConverted(e) {
  91626. qe(We, e.bind(this));
  91627. }
  91628. }, {
  91629. key: "onLoginTypeChanged",
  91630. value: function onLoginTypeChanged(e) {
  91631. var _this13 = this;
  91632. qe(Be, function () {
  91633. var t = _this13.hasLoginState();
  91634. e.call(_this13, t);
  91635. });
  91636. }
  91637. }, {
  91638. key: "getAccessToken",
  91639. value: function () {
  91640. var _getAccessToken3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
  91641. return _regenerator.default.wrap(function _callee38$(_context38) {
  91642. while (1) {
  91643. switch (_context38.prev = _context38.next) {
  91644. case 0:
  91645. _context38.next = 2;
  91646. return this._request.getAccessToken();
  91647. case 2:
  91648. _context38.t0 = _context38.sent.accessToken;
  91649. _context38.t1 = this.config.env;
  91650. return _context38.abrupt("return", {
  91651. accessToken: _context38.t0,
  91652. env: _context38.t1
  91653. });
  91654. case 5:
  91655. case "end":
  91656. return _context38.stop();
  91657. }
  91658. }
  91659. }, _callee38, this);
  91660. }));
  91661. function getAccessToken() {
  91662. return _getAccessToken3.apply(this, arguments);
  91663. }
  91664. return getAccessToken;
  91665. }()
  91666. }, {
  91667. key: "hasLoginState",
  91668. value: function hasLoginState() {
  91669. var _this$_cache$keys13 = this._cache.keys,
  91670. e = _this$_cache$keys13.accessTokenKey,
  91671. t = _this$_cache$keys13.accessTokenExpireKey,
  91672. n = this._cache.getStore(e),
  91673. s = this._cache.getStore(t);
  91674. return this._request.oauth.isAccessTokenExpired(n, s) ? null : new rt(this.config.env);
  91675. }
  91676. }, {
  91677. key: "isUsernameRegistered",
  91678. value: function () {
  91679. var _isUsernameRegistered = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39(e) {
  91680. var _yield$this$_request$4, t;
  91681. return _regenerator.default.wrap(function _callee39$(_context39) {
  91682. while (1) {
  91683. switch (_context39.prev = _context39.next) {
  91684. case 0:
  91685. if (!("string" != typeof e)) {
  91686. _context39.next = 2;
  91687. break;
  91688. }
  91689. throw new te({
  91690. code: "PARAM_ERROR",
  91691. message: "username must be a string"
  91692. });
  91693. case 2:
  91694. _context39.next = 4;
  91695. return this._request.send("auth.isUsernameRegistered", {
  91696. username: e
  91697. });
  91698. case 4:
  91699. _yield$this$_request$4 = _context39.sent;
  91700. t = _yield$this$_request$4.data;
  91701. return _context39.abrupt("return", t && t.isRegistered);
  91702. case 7:
  91703. case "end":
  91704. return _context39.stop();
  91705. }
  91706. }
  91707. }, _callee39, this);
  91708. }));
  91709. function isUsernameRegistered(_x31) {
  91710. return _isUsernameRegistered.apply(this, arguments);
  91711. }
  91712. return isUsernameRegistered;
  91713. }()
  91714. }, {
  91715. key: "getLoginState",
  91716. value: function getLoginState() {
  91717. return Promise.resolve(this.hasLoginState());
  91718. }
  91719. }, {
  91720. key: "signInWithTicket",
  91721. value: function () {
  91722. var _signInWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(e) {
  91723. return _regenerator.default.wrap(function _callee40$(_context40) {
  91724. while (1) {
  91725. switch (_context40.prev = _context40.next) {
  91726. case 0:
  91727. return _context40.abrupt("return", new ot(this.config).signIn(e));
  91728. case 1:
  91729. case "end":
  91730. return _context40.stop();
  91731. }
  91732. }
  91733. }, _callee40, this);
  91734. }));
  91735. function signInWithTicket(_x32) {
  91736. return _signInWithTicket.apply(this, arguments);
  91737. }
  91738. return signInWithTicket;
  91739. }()
  91740. }, {
  91741. key: "shouldRefreshAccessToken",
  91742. value: function shouldRefreshAccessToken(e) {
  91743. this._request._shouldRefreshAccessTokenHook = e.bind(this);
  91744. }
  91745. }, {
  91746. key: "getUserInfo",
  91747. value: function getUserInfo() {
  91748. return this._request.send("auth.getUserInfo", {}).then(function (e) {
  91749. return e.code ? e : _objectSpread(_objectSpread({}, e.data), {}, {
  91750. requestId: e.seqId
  91751. });
  91752. });
  91753. }
  91754. }, {
  91755. key: "getAuthHeader",
  91756. value: function getAuthHeader() {
  91757. var _this$_cache$keys14 = this._cache.keys,
  91758. e = _this$_cache$keys14.refreshTokenKey,
  91759. t = _this$_cache$keys14.accessTokenKey,
  91760. n = this._cache.getStore(e);
  91761. return {
  91762. "x-cloudbase-credentials": this._cache.getStore(t) + "/@@/" + n
  91763. };
  91764. }
  91765. }, {
  91766. key: "_onAnonymousConverted",
  91767. value: function _onAnonymousConverted(e) {
  91768. var t = e.data.env;
  91769. t === this.config.env && this._cache.updatePersistence(this.config.persistence);
  91770. }
  91771. }, {
  91772. key: "_onLoginTypeChanged",
  91773. value: function _onLoginTypeChanged(e) {
  91774. var _e$data = e.data,
  91775. t = _e$data.loginType,
  91776. n = _e$data.persistence,
  91777. s = _e$data.env;
  91778. s === this.config.env && (this._cache.updatePersistence(n), this._cache.setStore(this._cache.keys.loginTypeKey, t));
  91779. }
  91780. }]);
  91781. return ut;
  91782. }();
  91783. var ht = function ht(e, t) {
  91784. t = t || ve();
  91785. var n = tt(this.config.env),
  91786. s = e.cloudPath,
  91787. r = e.filePath,
  91788. i = e.onUploadProgress,
  91789. _e$fileType = e.fileType,
  91790. o = _e$fileType === void 0 ? "image" : _e$fileType;
  91791. return n.send("storage.getUploadMetadata", {
  91792. path: s
  91793. }).then(function (e) {
  91794. var _e$data2 = e.data,
  91795. a = _e$data2.url,
  91796. c = _e$data2.authorization,
  91797. u = _e$data2.token,
  91798. h = _e$data2.fileId,
  91799. l = _e$data2.cosFileId,
  91800. d = e.requestId,
  91801. p = {
  91802. key: s,
  91803. signature: c,
  91804. "x-cos-meta-fileid": l,
  91805. success_action_status: "201",
  91806. "x-cos-security-token": u
  91807. };
  91808. n.upload({
  91809. url: a,
  91810. data: p,
  91811. file: r,
  91812. name: s,
  91813. fileType: o,
  91814. onUploadProgress: i
  91815. }).then(function (e) {
  91816. 201 === e.statusCode ? t(null, {
  91817. fileID: h,
  91818. requestId: d
  91819. }) : t(new te({
  91820. code: "STORAGE_REQUEST_FAIL",
  91821. message: "STORAGE_REQUEST_FAIL: ".concat(e.data)
  91822. }));
  91823. }).catch(function (e) {
  91824. t(e);
  91825. });
  91826. }).catch(function (e) {
  91827. t(e);
  91828. }), t.promise;
  91829. },
  91830. lt = function lt(e, t) {
  91831. t = t || ve();
  91832. var n = tt(this.config.env),
  91833. s = e.cloudPath;
  91834. return n.send("storage.getUploadMetadata", {
  91835. path: s
  91836. }).then(function (e) {
  91837. t(null, e);
  91838. }).catch(function (e) {
  91839. t(e);
  91840. }), t.promise;
  91841. },
  91842. dt = function dt(_ref10, t) {
  91843. var e = _ref10.fileList;
  91844. if (t = t || ve(), !e || !Array.isArray(e)) return {
  91845. code: "INVALID_PARAM",
  91846. message: "fileList必须是非空的数组"
  91847. };
  91848. var _iterator3 = _createForOfIteratorHelper(e),
  91849. _step3;
  91850. try {
  91851. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  91852. var _t9 = _step3.value;
  91853. if (!_t9 || "string" != typeof _t9) return {
  91854. code: "INVALID_PARAM",
  91855. message: "fileList的元素必须是非空的字符串"
  91856. };
  91857. }
  91858. } catch (err) {
  91859. _iterator3.e(err);
  91860. } finally {
  91861. _iterator3.f();
  91862. }
  91863. var n = {
  91864. fileid_list: e
  91865. };
  91866. return tt(this.config.env).send("storage.batchDeleteFile", n).then(function (e) {
  91867. e.code ? t(null, e) : t(null, {
  91868. fileList: e.data.delete_list,
  91869. requestId: e.requestId
  91870. });
  91871. }).catch(function (e) {
  91872. t(e);
  91873. }), t.promise;
  91874. },
  91875. pt = function pt(_ref11, t) {
  91876. var e = _ref11.fileList;
  91877. t = t || ve(), e && Array.isArray(e) || t(null, {
  91878. code: "INVALID_PARAM",
  91879. message: "fileList必须是非空的数组"
  91880. });
  91881. var n = [];
  91882. var _iterator4 = _createForOfIteratorHelper(e),
  91883. _step4;
  91884. try {
  91885. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  91886. var _s11 = _step4.value;
  91887. "object" == (0, _typeof2.default)(_s11) ? (_s11.hasOwnProperty("fileID") && _s11.hasOwnProperty("maxAge") || t(null, {
  91888. code: "INVALID_PARAM",
  91889. message: "fileList的元素必须是包含fileID和maxAge的对象"
  91890. }), n.push({
  91891. fileid: _s11.fileID,
  91892. max_age: _s11.maxAge
  91893. })) : "string" == typeof _s11 ? n.push({
  91894. fileid: _s11
  91895. }) : t(null, {
  91896. code: "INVALID_PARAM",
  91897. message: "fileList的元素必须是字符串"
  91898. });
  91899. }
  91900. } catch (err) {
  91901. _iterator4.e(err);
  91902. } finally {
  91903. _iterator4.f();
  91904. }
  91905. var s = {
  91906. file_list: n
  91907. };
  91908. return tt(this.config.env).send("storage.batchGetDownloadUrl", s).then(function (e) {
  91909. e.code ? t(null, e) : t(null, {
  91910. fileList: e.data.download_list,
  91911. requestId: e.requestId
  91912. });
  91913. }).catch(function (e) {
  91914. t(e);
  91915. }), t.promise;
  91916. },
  91917. ft = /*#__PURE__*/function () {
  91918. var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(_ref12, t) {
  91919. var e, n, s, r;
  91920. return _regenerator.default.wrap(function _callee41$(_context41) {
  91921. while (1) {
  91922. switch (_context41.prev = _context41.next) {
  91923. case 0:
  91924. e = _ref12.fileID;
  91925. _context41.next = 3;
  91926. return pt.call(this, {
  91927. fileList: [{
  91928. fileID: e,
  91929. maxAge: 600
  91930. }]
  91931. });
  91932. case 3:
  91933. n = _context41.sent.fileList[0];
  91934. if (!("SUCCESS" !== n.code)) {
  91935. _context41.next = 6;
  91936. break;
  91937. }
  91938. return _context41.abrupt("return", t ? t(n) : new Promise(function (e) {
  91939. e(n);
  91940. }));
  91941. case 6:
  91942. s = tt(this.config.env);
  91943. r = n.download_url;
  91944. if (!(r = encodeURI(r), !t)) {
  91945. _context41.next = 10;
  91946. break;
  91947. }
  91948. return _context41.abrupt("return", s.download({
  91949. url: r
  91950. }));
  91951. case 10:
  91952. _context41.t0 = t;
  91953. _context41.next = 13;
  91954. return s.download({
  91955. url: r
  91956. });
  91957. case 13:
  91958. _context41.t1 = _context41.sent;
  91959. (0, _context41.t0)(_context41.t1);
  91960. case 15:
  91961. case "end":
  91962. return _context41.stop();
  91963. }
  91964. }
  91965. }, _callee41, this);
  91966. }));
  91967. return function ft(_x33, _x34) {
  91968. return _ref13.apply(this, arguments);
  91969. };
  91970. }(),
  91971. gt = function gt(_ref14, o) {
  91972. var e = _ref14.name,
  91973. t = _ref14.data,
  91974. n = _ref14.query,
  91975. s = _ref14.parse,
  91976. r = _ref14.search,
  91977. i = _ref14.timeout;
  91978. var a = o || ve();
  91979. var c;
  91980. try {
  91981. c = t ? JSON.stringify(t) : "";
  91982. } catch (e) {
  91983. return Promise.reject(e);
  91984. }
  91985. if (!e) return Promise.reject(new te({
  91986. code: "PARAM_ERROR",
  91987. message: "函数名不能为空"
  91988. }));
  91989. var u = {
  91990. inQuery: n,
  91991. parse: s,
  91992. search: r,
  91993. function_name: e,
  91994. request_data: c
  91995. };
  91996. return tt(this.config.env).send("functions.invokeFunction", u, {
  91997. timeout: i
  91998. }).then(function (e) {
  91999. if (e.code) a(null, e);else {
  92000. var _t10 = e.data.response_data;
  92001. if (s) a(null, {
  92002. result: _t10,
  92003. requestId: e.requestId
  92004. });else try {
  92005. _t10 = JSON.parse(e.data.response_data), a(null, {
  92006. result: _t10,
  92007. requestId: e.requestId
  92008. });
  92009. } catch (e) {
  92010. a(new te({
  92011. message: "response data must be json"
  92012. }));
  92013. }
  92014. }
  92015. return a.promise;
  92016. }).catch(function (e) {
  92017. a(e);
  92018. }), a.promise;
  92019. },
  92020. mt = {
  92021. timeout: 15e3,
  92022. persistence: "session"
  92023. },
  92024. yt = 6e5,
  92025. _t = {};
  92026. var wt = /*#__PURE__*/function () {
  92027. function wt(e) {
  92028. (0, _classCallCheck2.default)(this, wt);
  92029. this.config = e || this.config, this.authObj = void 0;
  92030. }
  92031. (0, _createClass2.default)(wt, [{
  92032. key: "init",
  92033. value: function init(e) {
  92034. switch (Pe.adapter || (this.requestClient = new Pe.adapter.reqClass({
  92035. timeout: e.timeout || 5e3,
  92036. timeoutMsg: "\u8BF7\u6C42\u5728".concat((e.timeout || 5e3) / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD")
  92037. })), this.config = _objectSpread(_objectSpread({}, mt), e), !0) {
  92038. case this.config.timeout > yt:
  92039. console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = yt;
  92040. break;
  92041. case this.config.timeout < 100:
  92042. console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
  92043. }
  92044. return new wt(this.config);
  92045. }
  92046. }, {
  92047. key: "auth",
  92048. value: function auth() {
  92049. var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  92050. e = _ref15.persistence;
  92051. if (this.authObj) return this.authObj;
  92052. var t = e || Pe.adapter.primaryStorage || mt.persistence;
  92053. var n;
  92054. return t !== this.config.persistence && (this.config.persistence = t), function (e) {
  92055. var t = e.env;
  92056. Ne[t] = new xe(e), Re[t] = new xe(_objectSpread(_objectSpread({}, e), {}, {
  92057. persistence: "local"
  92058. }));
  92059. }(this.config), n = this.config, et[n.env] = new Ze(n), this.authObj = new ut(this.config), this.authObj;
  92060. }
  92061. }, {
  92062. key: "on",
  92063. value: function on(e, t) {
  92064. return qe.apply(this, [e, t]);
  92065. }
  92066. }, {
  92067. key: "off",
  92068. value: function off(e, t) {
  92069. return Ke.apply(this, [e, t]);
  92070. }
  92071. }, {
  92072. key: "callFunction",
  92073. value: function callFunction(e, t) {
  92074. return gt.apply(this, [e, t]);
  92075. }
  92076. }, {
  92077. key: "deleteFile",
  92078. value: function deleteFile(e, t) {
  92079. return dt.apply(this, [e, t]);
  92080. }
  92081. }, {
  92082. key: "getTempFileURL",
  92083. value: function getTempFileURL(e, t) {
  92084. return pt.apply(this, [e, t]);
  92085. }
  92086. }, {
  92087. key: "downloadFile",
  92088. value: function downloadFile(e, t) {
  92089. return ft.apply(this, [e, t]);
  92090. }
  92091. }, {
  92092. key: "uploadFile",
  92093. value: function uploadFile(e, t) {
  92094. return ht.apply(this, [e, t]);
  92095. }
  92096. }, {
  92097. key: "getUploadMetadata",
  92098. value: function getUploadMetadata(e, t) {
  92099. return lt.apply(this, [e, t]);
  92100. }
  92101. }, {
  92102. key: "registerExtension",
  92103. value: function registerExtension(e) {
  92104. _t[e.name] = e;
  92105. }
  92106. }, {
  92107. key: "invokeExtension",
  92108. value: function () {
  92109. var _invokeExtension = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(e, t) {
  92110. var n;
  92111. return _regenerator.default.wrap(function _callee42$(_context42) {
  92112. while (1) {
  92113. switch (_context42.prev = _context42.next) {
  92114. case 0:
  92115. n = _t[e];
  92116. if (n) {
  92117. _context42.next = 3;
  92118. break;
  92119. }
  92120. throw new te({
  92121. message: "\u6269\u5C55".concat(e, " \u5FC5\u987B\u5148\u6CE8\u518C")
  92122. });
  92123. case 3:
  92124. _context42.next = 5;
  92125. return n.invoke(t, this);
  92126. case 5:
  92127. return _context42.abrupt("return", _context42.sent);
  92128. case 6:
  92129. case "end":
  92130. return _context42.stop();
  92131. }
  92132. }
  92133. }, _callee42, this);
  92134. }));
  92135. function invokeExtension(_x35, _x36) {
  92136. return _invokeExtension.apply(this, arguments);
  92137. }
  92138. return invokeExtension;
  92139. }()
  92140. }, {
  92141. key: "useAdapters",
  92142. value: function useAdapters(e) {
  92143. var _ref16 = ke(e) || {},
  92144. t = _ref16.adapter,
  92145. n = _ref16.runtime;
  92146. t && (Pe.adapter = t), n && (Pe.runtime = n);
  92147. }
  92148. }]);
  92149. return wt;
  92150. }();
  92151. var vt = new wt();
  92152. function It(e, t, n) {
  92153. void 0 === n && (n = {});
  92154. var s = /\?/.test(t),
  92155. r = "";
  92156. for (var i in n) {
  92157. "" === r ? !s && (t += "?") : r += "&", r += i + "=" + encodeURIComponent(n[i]);
  92158. }
  92159. return /^http(s)?:\/\//.test(t += r) ? t : "" + e + t;
  92160. }
  92161. var St = /*#__PURE__*/function () {
  92162. function St() {
  92163. (0, _classCallCheck2.default)(this, St);
  92164. }
  92165. (0, _createClass2.default)(St, [{
  92166. key: "get",
  92167. value: function get(e) {
  92168. var t = e.url,
  92169. n = e.data,
  92170. s = e.headers,
  92171. r = e.timeout;
  92172. return new Promise(function (e, i) {
  92173. ne.request({
  92174. url: It("https:", t),
  92175. data: n,
  92176. method: "GET",
  92177. header: s,
  92178. timeout: r,
  92179. success: function success(t) {
  92180. e(t);
  92181. },
  92182. fail: function fail(e) {
  92183. i(e);
  92184. }
  92185. });
  92186. });
  92187. }
  92188. }, {
  92189. key: "post",
  92190. value: function post(e) {
  92191. var t = e.url,
  92192. n = e.data,
  92193. s = e.headers,
  92194. r = e.timeout;
  92195. return new Promise(function (e, i) {
  92196. ne.request({
  92197. url: It("https:", t),
  92198. data: n,
  92199. method: "POST",
  92200. header: s,
  92201. timeout: r,
  92202. success: function success(t) {
  92203. e(t);
  92204. },
  92205. fail: function fail(e) {
  92206. i(e);
  92207. }
  92208. });
  92209. });
  92210. }
  92211. }, {
  92212. key: "upload",
  92213. value: function upload(e) {
  92214. return new Promise(function (t, n) {
  92215. var s = e.url,
  92216. r = e.file,
  92217. i = e.data,
  92218. o = e.headers,
  92219. a = e.fileType,
  92220. c = ne.uploadFile({
  92221. url: It("https:", s),
  92222. name: "file",
  92223. formData: Object.assign({}, i),
  92224. filePath: r,
  92225. fileType: a,
  92226. header: o,
  92227. success: function success(e) {
  92228. var n = {
  92229. statusCode: e.statusCode,
  92230. data: e.data || {}
  92231. };
  92232. 200 === e.statusCode && i.success_action_status && (n.statusCode = parseInt(i.success_action_status, 10)), t(n);
  92233. },
  92234. fail: function fail(e) {
  92235. n(new Error(e.errMsg || "uploadFile:fail"));
  92236. }
  92237. });
  92238. "function" == typeof e.onUploadProgress && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (t) {
  92239. e.onUploadProgress({
  92240. loaded: t.totalBytesSent,
  92241. total: t.totalBytesExpectedToSend
  92242. });
  92243. });
  92244. });
  92245. }
  92246. }]);
  92247. return St;
  92248. }();
  92249. var Tt = {
  92250. setItem: function setItem(e, t) {
  92251. ne.setStorageSync(e, t);
  92252. },
  92253. getItem: function getItem(e) {
  92254. return ne.getStorageSync(e);
  92255. },
  92256. removeItem: function removeItem(e) {
  92257. ne.removeStorageSync(e);
  92258. },
  92259. clear: function clear() {
  92260. ne.clearStorageSync();
  92261. }
  92262. };
  92263. var bt = {
  92264. genAdapter: function genAdapter() {
  92265. return {
  92266. root: {},
  92267. reqClass: St,
  92268. localStorage: Tt,
  92269. primaryStorage: "local"
  92270. };
  92271. },
  92272. isMatch: function isMatch() {
  92273. return !0;
  92274. },
  92275. runtime: "uni_app"
  92276. };
  92277. vt.useAdapters(bt);
  92278. var Et = vt,
  92279. kt = Et.init;
  92280. Et.init = function (e) {
  92281. e.env = e.spaceId;
  92282. var t = kt.call(this, e);
  92283. t.config.provider = "tencent", t.config.spaceId = e.spaceId;
  92284. var n = t.auth;
  92285. return t.auth = function (e) {
  92286. var t = n.call(this, e);
  92287. return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach(function (e) {
  92288. var n;
  92289. t[e] = (n = t[e], function (e) {
  92290. e = e || {};
  92291. var _ee = ee(e),
  92292. t = _ee.success,
  92293. s = _ee.fail,
  92294. r = _ee.complete;
  92295. if (!(t || s || r)) return n.call(this, e);
  92296. n.call(this, e).then(function (e) {
  92297. t && t(e), r && r(e);
  92298. }, function (e) {
  92299. s && s(e), r && r(e);
  92300. });
  92301. }).bind(t);
  92302. }), t;
  92303. }, t.customAuth = t.auth, t;
  92304. };
  92305. var Pt = Et;
  92306. function Ct(_x37, _x38) {
  92307. return _Ct.apply(this, arguments);
  92308. }
  92309. function _Ct() {
  92310. _Ct = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee68(e, t) {
  92311. var n, _e31, s;
  92312. return _regenerator.default.wrap(function _callee68$(_context68) {
  92313. while (1) {
  92314. switch (_context68.prev = _context68.next) {
  92315. case 0:
  92316. n = "http://".concat(e, ":").concat(t, "/system/ping");
  92317. _context68.prev = 1;
  92318. _context68.next = 4;
  92319. return s = {
  92320. url: n,
  92321. timeout: 500
  92322. }, new Promise(function (e, t) {
  92323. ne.request(_objectSpread(_objectSpread({}, s), {}, {
  92324. success: function success(t) {
  92325. e(t);
  92326. },
  92327. fail: function fail(e) {
  92328. t(e);
  92329. }
  92330. }));
  92331. });
  92332. case 4:
  92333. _e31 = _context68.sent;
  92334. return _context68.abrupt("return", !(!_e31.data || 0 !== _e31.data.code));
  92335. case 8:
  92336. _context68.prev = 8;
  92337. _context68.t0 = _context68["catch"](1);
  92338. return _context68.abrupt("return", !1);
  92339. case 11:
  92340. case "end":
  92341. return _context68.stop();
  92342. }
  92343. }
  92344. }, _callee68, null, [[1, 8]]);
  92345. }));
  92346. return _Ct.apply(this, arguments);
  92347. }
  92348. function At(_x39, _x40) {
  92349. return _At.apply(this, arguments);
  92350. }
  92351. function _At() {
  92352. _At = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee69(e, t) {
  92353. var n, s, _r10;
  92354. return _regenerator.default.wrap(function _callee69$(_context69) {
  92355. while (1) {
  92356. switch (_context69.prev = _context69.next) {
  92357. case 0:
  92358. s = 0;
  92359. case 1:
  92360. if (!(s < e.length)) {
  92361. _context69.next = 11;
  92362. break;
  92363. }
  92364. _r10 = e[s];
  92365. _context69.next = 5;
  92366. return Ct(_r10, t);
  92367. case 5:
  92368. if (!_context69.sent) {
  92369. _context69.next = 8;
  92370. break;
  92371. }
  92372. n = _r10;
  92373. return _context69.abrupt("break", 11);
  92374. case 8:
  92375. s++;
  92376. _context69.next = 1;
  92377. break;
  92378. case 11:
  92379. return _context69.abrupt("return", {
  92380. address: n,
  92381. port: t
  92382. });
  92383. case 12:
  92384. case "end":
  92385. return _context69.stop();
  92386. }
  92387. }
  92388. }, _callee69);
  92389. }));
  92390. return _At.apply(this, arguments);
  92391. }
  92392. var Ot = {
  92393. "serverless.file.resource.generateProximalSign": "storage/generate-proximal-sign",
  92394. "serverless.file.resource.report": "storage/report",
  92395. "serverless.file.resource.delete": "storage/delete",
  92396. "serverless.file.resource.getTempFileURL": "storage/get-temp-file-url"
  92397. };
  92398. var xt = /*#__PURE__*/function () {
  92399. function xt(e) {
  92400. (0, _classCallCheck2.default)(this, xt);
  92401. if (["spaceId", "clientSecret"].forEach(function (t) {
  92402. if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error("".concat(t, " required"));
  92403. }), !e.endpoint) throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");
  92404. this.config = Object.assign({}, e), this.config.provider = "dcloud", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.adapter = ne;
  92405. }
  92406. (0, _createClass2.default)(xt, [{
  92407. key: "request",
  92408. value: function () {
  92409. var _request4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43(e) {
  92410. var _this14 = this;
  92411. var t,
  92412. n,
  92413. _args43 = arguments;
  92414. return _regenerator.default.wrap(function _callee43$(_context43) {
  92415. while (1) {
  92416. switch (_context43.prev = _context43.next) {
  92417. case 0:
  92418. t = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : !0;
  92419. n = b && t;
  92420. if (!n) {
  92421. _context43.next = 8;
  92422. break;
  92423. }
  92424. _context43.next = 5;
  92425. return this.setupLocalRequest(e);
  92426. case 5:
  92427. _context43.t0 = _context43.sent;
  92428. _context43.next = 9;
  92429. break;
  92430. case 8:
  92431. _context43.t0 = this.setupRequest(e);
  92432. case 9:
  92433. e = _context43.t0;
  92434. return _context43.abrupt("return", Promise.resolve().then(function () {
  92435. return n ? _this14.requestLocal(e) : le.wrappedRequest(e, _this14.adapter.request);
  92436. }));
  92437. case 11:
  92438. case "end":
  92439. return _context43.stop();
  92440. }
  92441. }
  92442. }, _callee43, this);
  92443. }));
  92444. function request(_x41) {
  92445. return _request4.apply(this, arguments);
  92446. }
  92447. return request;
  92448. }()
  92449. }, {
  92450. key: "requestLocal",
  92451. value: function requestLocal(e) {
  92452. var _this15 = this;
  92453. return new Promise(function (t, n) {
  92454. _this15.adapter.request(Object.assign(e, {
  92455. complete: function complete(e) {
  92456. if (e || (e = {}), !e.statusCode || e.statusCode >= 400) {
  92457. var _t11 = e.data && e.data.code || "SYS_ERR",
  92458. _s12 = e.data && e.data.message || "request:fail";
  92459. return n(new te({
  92460. code: _t11,
  92461. message: _s12
  92462. }));
  92463. }
  92464. t({
  92465. success: !0,
  92466. result: e.data
  92467. });
  92468. }
  92469. }));
  92470. });
  92471. }
  92472. }, {
  92473. key: "setupRequest",
  92474. value: function setupRequest(e) {
  92475. var t = Object.assign({}, e, {
  92476. spaceId: this.config.spaceId,
  92477. timestamp: Date.now()
  92478. }),
  92479. n = {
  92480. "Content-Type": "application/json"
  92481. };
  92482. n["x-serverless-sign"] = le.sign(t, this.config.clientSecret);
  92483. var s = he();
  92484. n["x-client-info"] = encodeURIComponent(JSON.stringify(s));
  92485. var _se = se(),
  92486. r = _se.token;
  92487. return n["x-client-token"] = r, {
  92488. url: this.config.requestUrl,
  92489. method: "POST",
  92490. data: t,
  92491. dataType: "json",
  92492. header: JSON.parse(JSON.stringify(n))
  92493. };
  92494. }
  92495. }, {
  92496. key: "setupLocalRequest",
  92497. value: function () {
  92498. var _setupLocalRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(e) {
  92499. var t, _se2, n, s, _ref17, r, i, _yield$At, o;
  92500. return _regenerator.default.wrap(function _callee44$(_context44) {
  92501. while (1) {
  92502. switch (_context44.prev = _context44.next) {
  92503. case 0:
  92504. t = he();
  92505. _se2 = se();
  92506. n = _se2.token;
  92507. s = Object.assign({}, e, {
  92508. spaceId: this.config.spaceId,
  92509. timestamp: Date.now(),
  92510. clientInfo: t,
  92511. token: n
  92512. });
  92513. _ref17 = this.__dev__ && this.__dev__.debugInfo || {};
  92514. r = _ref17.address;
  92515. i = _ref17.servePort;
  92516. _context44.next = 9;
  92517. return At(r, i);
  92518. case 9:
  92519. _yield$At = _context44.sent;
  92520. o = _yield$At.address;
  92521. return _context44.abrupt("return", {
  92522. url: "http://".concat(o, ":").concat(i, "/").concat(Ot[e.method]),
  92523. method: "POST",
  92524. data: s,
  92525. dataType: "json",
  92526. header: JSON.parse(JSON.stringify({
  92527. "Content-Type": "application/json"
  92528. }))
  92529. });
  92530. case 12:
  92531. case "end":
  92532. return _context44.stop();
  92533. }
  92534. }
  92535. }, _callee44, this);
  92536. }));
  92537. function setupLocalRequest(_x42) {
  92538. return _setupLocalRequest.apply(this, arguments);
  92539. }
  92540. return setupLocalRequest;
  92541. }()
  92542. }, {
  92543. key: "callFunction",
  92544. value: function callFunction(e) {
  92545. var t = {
  92546. method: "serverless.function.runtime.invoke",
  92547. params: JSON.stringify({
  92548. functionTarget: e.name,
  92549. functionArgs: e.data || {}
  92550. })
  92551. };
  92552. return this.request(t, !1);
  92553. }
  92554. }, {
  92555. key: "getUploadFileOptions",
  92556. value: function getUploadFileOptions(e) {
  92557. var t = {
  92558. method: "serverless.file.resource.generateProximalSign",
  92559. params: JSON.stringify(e)
  92560. };
  92561. return this.request(t);
  92562. }
  92563. }, {
  92564. key: "reportUploadFile",
  92565. value: function reportUploadFile(e) {
  92566. var t = {
  92567. method: "serverless.file.resource.report",
  92568. params: JSON.stringify(e)
  92569. };
  92570. return this.request(t);
  92571. }
  92572. }, {
  92573. key: "uploadFile",
  92574. value: function uploadFile(_ref18) {
  92575. var _this16 = this;
  92576. var e = _ref18.filePath,
  92577. t = _ref18.cloudPath,
  92578. _ref18$fileType = _ref18.fileType,
  92579. n = _ref18$fileType === void 0 ? "image" : _ref18$fileType,
  92580. s = _ref18.onUploadProgress;
  92581. if (!t) throw new te({
  92582. code: "CLOUDPATH_REQUIRED",
  92583. message: "cloudPath不可为空"
  92584. });
  92585. var r;
  92586. return this.getUploadFileOptions({
  92587. cloudPath: t
  92588. }).then(function (t) {
  92589. var _t$result = t.result,
  92590. i = _t$result.url,
  92591. o = _t$result.formData,
  92592. a = _t$result.name;
  92593. return r = t.result.fileUrl, new Promise(function (t, r) {
  92594. var c = _this16.adapter.uploadFile({
  92595. url: i,
  92596. formData: o,
  92597. name: a,
  92598. filePath: e,
  92599. fileType: n,
  92600. success: function success(e) {
  92601. e && e.statusCode < 400 ? t(e) : r(new te({
  92602. code: "UPLOAD_FAILED",
  92603. message: "文件上传失败"
  92604. }));
  92605. },
  92606. fail: function fail(e) {
  92607. r(new te({
  92608. code: e.code || "UPLOAD_FAILED",
  92609. message: e.message || e.errMsg || "文件上传失败"
  92610. }));
  92611. }
  92612. });
  92613. "function" == typeof s && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
  92614. s({
  92615. loaded: e.totalBytesSent,
  92616. total: e.totalBytesExpectedToSend
  92617. });
  92618. });
  92619. });
  92620. }).then(function () {
  92621. return _this16.reportUploadFile({
  92622. cloudPath: t
  92623. });
  92624. }).then(function (t) {
  92625. return new Promise(function (n, s) {
  92626. t.success ? n({
  92627. success: !0,
  92628. filePath: e,
  92629. fileID: r
  92630. }) : s(new te({
  92631. code: "UPLOAD_FAILED",
  92632. message: "文件上传失败"
  92633. }));
  92634. });
  92635. });
  92636. }
  92637. }, {
  92638. key: "deleteFile",
  92639. value: function deleteFile(_ref19) {
  92640. var e = _ref19.fileList;
  92641. var t = {
  92642. method: "serverless.file.resource.delete",
  92643. params: JSON.stringify({
  92644. fileList: e
  92645. })
  92646. };
  92647. return this.request(t).then(function (e) {
  92648. if (e.success) return e.result;
  92649. throw new te({
  92650. code: "DELETE_FILE_FAILED",
  92651. message: "删除文件失败"
  92652. });
  92653. });
  92654. }
  92655. }, {
  92656. key: "getTempFileURL",
  92657. value: function getTempFileURL() {
  92658. var _ref20 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  92659. e = _ref20.fileList,
  92660. t = _ref20.maxAge;
  92661. if (!Array.isArray(e) || 0 === e.length) throw new te({
  92662. code: "INVALID_PARAM",
  92663. message: "fileList的元素必须是非空的字符串"
  92664. });
  92665. var n = {
  92666. method: "serverless.file.resource.getTempFileURL",
  92667. params: JSON.stringify({
  92668. fileList: e,
  92669. maxAge: t
  92670. })
  92671. };
  92672. return this.request(n).then(function (e) {
  92673. if (e.success) return {
  92674. fileList: e.result.fileList.map(function (e) {
  92675. return {
  92676. fileID: e.fileID,
  92677. tempFileURL: e.tempFileURL
  92678. };
  92679. })
  92680. };
  92681. throw new te({
  92682. code: "GET_TEMP_FILE_URL_FAILED",
  92683. message: "获取临时文件链接失败"
  92684. });
  92685. });
  92686. }
  92687. }]);
  92688. return xt;
  92689. }();
  92690. var Nt = {
  92691. init: function init(e) {
  92692. var t = new xt(e),
  92693. n = {
  92694. signInAnonymously: function signInAnonymously() {
  92695. return Promise.resolve();
  92696. },
  92697. getLoginState: function getLoginState() {
  92698. return Promise.resolve(!1);
  92699. }
  92700. };
  92701. return t.auth = function () {
  92702. return n;
  92703. }, t.customAuth = t.auth, t;
  92704. }
  92705. },
  92706. Rt = n(function (e, t) {
  92707. e.exports = r.enc.Hex;
  92708. });
  92709. function Lt() {
  92710. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (e) {
  92711. var t = 16 * Math.random() | 0;
  92712. return ("x" === e ? t : 3 & t | 8).toString(16);
  92713. });
  92714. }
  92715. function Ut() {
  92716. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  92717. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  92718. var n = t.data,
  92719. s = t.functionName,
  92720. r = t.method,
  92721. i = t.headers,
  92722. _t$signHeaderKeys = t.signHeaderKeys,
  92723. o = _t$signHeaderKeys === void 0 ? [] : _t$signHeaderKeys,
  92724. a = t.config,
  92725. c = String(Date.now()),
  92726. u = Lt(),
  92727. h = Object.assign({}, i, {
  92728. "x-from-app-id": a.spaceAppId,
  92729. "x-from-env-id": a.spaceId,
  92730. "x-to-env-id": a.spaceId,
  92731. "x-from-instance-id": c,
  92732. "x-from-function-name": s,
  92733. "x-client-timestamp": c,
  92734. "x-alipay-source": "client",
  92735. "x-request-id": u,
  92736. "x-alipay-callid": u,
  92737. "x-trace-id": u
  92738. }),
  92739. l = ["x-from-app-id", "x-from-env-id", "x-to-env-id", "x-from-instance-id", "x-from-function-name", "x-client-timestamp"].concat(o),
  92740. _ref21 = e.split("?") || [],
  92741. _ref22 = (0, _slicedToArray2.default)(_ref21, 2),
  92742. _ref22$ = _ref22[0],
  92743. d = _ref22$ === void 0 ? "" : _ref22$,
  92744. _ref22$2 = _ref22[1],
  92745. p = _ref22$2 === void 0 ? "" : _ref22$2,
  92746. f = function (e) {
  92747. var t = "HMAC-SHA256",
  92748. n = e.signedHeaders.join(";"),
  92749. s = e.signedHeaders.map(function (t) {
  92750. return "".concat(t.toLowerCase(), ":").concat(e.headers[t], "\n");
  92751. }).join(""),
  92752. r = _e(e.body).toString(Rt),
  92753. i = "".concat(e.method.toUpperCase(), "\n").concat(e.path, "\n").concat(e.query, "\n").concat(s, "\n").concat(n, "\n").concat(r, "\n"),
  92754. o = _e(i).toString(Rt),
  92755. a = "".concat(t, "\n").concat(e.timestamp, "\n").concat(o, "\n"),
  92756. c = we(a, e.secretKey).toString(Rt);
  92757. return "".concat(t, " Credential=").concat(e.secretId, ", SignedHeaders=").concat(n, ", Signature=").concat(c);
  92758. }({
  92759. path: d,
  92760. query: p,
  92761. method: r,
  92762. headers: h,
  92763. timestamp: c,
  92764. body: JSON.stringify(n),
  92765. secretId: a.accessKey,
  92766. secretKey: a.secretKey,
  92767. signedHeaders: l.sort()
  92768. });
  92769. return {
  92770. url: "".concat(a.endpoint).concat(e),
  92771. headers: Object.assign({}, h, {
  92772. Authorization: f
  92773. })
  92774. };
  92775. }
  92776. function Dt(_ref23) {
  92777. var e = _ref23.url,
  92778. t = _ref23.data,
  92779. _ref23$method = _ref23.method,
  92780. n = _ref23$method === void 0 ? "POST" : _ref23$method,
  92781. _ref23$headers = _ref23.headers,
  92782. s = _ref23$headers === void 0 ? {} : _ref23$headers,
  92783. r = _ref23.timeout;
  92784. return new Promise(function (i, o) {
  92785. ne.request({
  92786. url: e,
  92787. method: n,
  92788. data: "object" == (0, _typeof2.default)(t) ? JSON.stringify(t) : t,
  92789. header: s,
  92790. dataType: "json",
  92791. timeout: r,
  92792. complete: function complete() {
  92793. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  92794. var t = s["x-trace-id"] || "";
  92795. if (!e.statusCode || e.statusCode >= 400) {
  92796. var _ref24 = e.data || {},
  92797. _n9 = _ref24.message,
  92798. _s13 = _ref24.errMsg,
  92799. _r4 = _ref24.trace_id;
  92800. return o(new te({
  92801. code: "SYS_ERR",
  92802. message: _n9 || _s13 || "request:fail",
  92803. requestId: _r4 || t
  92804. }));
  92805. }
  92806. i({
  92807. status: e.statusCode,
  92808. data: e.data,
  92809. headers: e.header,
  92810. requestId: t
  92811. });
  92812. }
  92813. });
  92814. });
  92815. }
  92816. function Mt(e, t) {
  92817. var n = e.path,
  92818. s = e.data,
  92819. _e$method = e.method,
  92820. r = _e$method === void 0 ? "GET" : _e$method,
  92821. _Ut = Ut(n, {
  92822. functionName: "",
  92823. data: s,
  92824. method: r,
  92825. headers: {
  92826. "x-alipay-cloud-mode": "oss",
  92827. "x-data-api-type": "oss",
  92828. "x-expire-timestamp": Date.now() + 6e4
  92829. },
  92830. signHeaderKeys: ["x-data-api-type", "x-expire-timestamp"],
  92831. config: t
  92832. }),
  92833. i = _Ut.url,
  92834. o = _Ut.headers;
  92835. return Dt({
  92836. url: i,
  92837. data: s,
  92838. method: r,
  92839. headers: o
  92840. }).then(function (e) {
  92841. var t = e.data || {};
  92842. if (!t.success) throw new te({
  92843. code: e.errCode,
  92844. message: e.errMsg,
  92845. requestId: e.requestId
  92846. });
  92847. return t.data || {};
  92848. }).catch(function (e) {
  92849. throw new te({
  92850. code: e.errCode,
  92851. message: e.errMsg,
  92852. requestId: e.requestId
  92853. });
  92854. });
  92855. }
  92856. function qt() {
  92857. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  92858. var t = e.trim().replace(/^cloud:\/\//, ""),
  92859. n = t.indexOf("/");
  92860. if (n <= 0) throw new te({
  92861. code: "INVALID_PARAM",
  92862. message: "fileID不合法"
  92863. });
  92864. var s = t.substring(0, n),
  92865. r = t.substring(n + 1);
  92866. return s !== this.config.spaceId && console.warn("file ".concat(e, " does not belong to env ").concat(this.config.spaceId)), r;
  92867. }
  92868. function Ft() {
  92869. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  92870. return "cloud://".concat(this.config.spaceId, "/").concat(e.replace(/^\/+/, ""));
  92871. }
  92872. var Kt = /*#__PURE__*/function () {
  92873. function Kt(e) {
  92874. (0, _classCallCheck2.default)(this, Kt);
  92875. this.config = e;
  92876. }
  92877. (0, _createClass2.default)(Kt, [{
  92878. key: "signedURL",
  92879. value: function signedURL(e) {
  92880. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  92881. var n = "/ws/function/".concat(e),
  92882. s = this.config.wsEndpoint.replace(/^ws(s)?:\/\//, ""),
  92883. r = Object.assign({}, t, {
  92884. accessKeyId: this.config.accessKey,
  92885. signatureNonce: Lt(),
  92886. timestamp: "" + Date.now()
  92887. }),
  92888. i = [n, ["accessKeyId", "authorization", "signatureNonce", "timestamp"].sort().map(function (e) {
  92889. return r[e] ? "".concat(e, "=").concat(r[e]) : null;
  92890. }).filter(Boolean).join("&"), "host:".concat(s)].join("\n"),
  92891. o = ["HMAC-SHA256", _e(i).toString(Rt)].join("\n"),
  92892. a = we(o, this.config.secretKey).toString(Rt),
  92893. c = Object.keys(r).map(function (e) {
  92894. return "".concat(e, "=").concat(encodeURIComponent(r[e]));
  92895. }).join("&");
  92896. return "".concat(this.config.wsEndpoint).concat(n, "?").concat(c, "&signature=").concat(a);
  92897. }
  92898. }]);
  92899. return Kt;
  92900. }();
  92901. var jt = /*#__PURE__*/function () {
  92902. function jt(e) {
  92903. (0, _classCallCheck2.default)(this, jt);
  92904. if (["spaceId", "spaceAppId", "accessKey", "secretKey"].forEach(function (t) {
  92905. if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error("".concat(t, " required"));
  92906. }), e.endpoint) {
  92907. if ("string" != typeof e.endpoint) throw new Error("endpoint must be string");
  92908. if (!/^https:\/\//.test(e.endpoint)) throw new Error("endpoint must start with https://");
  92909. e.endpoint = e.endpoint.replace(/\/$/, "");
  92910. }
  92911. this.config = Object.assign({}, e, {
  92912. endpoint: e.endpoint || "https://".concat(e.spaceId, ".api-hz.cloudbasefunction.cn"),
  92913. wsEndpoint: e.wsEndpoint || "wss://".concat(e.spaceId, ".api-hz.cloudbasefunction.cn")
  92914. }), this._websocket = new Kt(this.config);
  92915. }
  92916. (0, _createClass2.default)(jt, [{
  92917. key: "callFunction",
  92918. value: function callFunction(e) {
  92919. return function (e, t) {
  92920. var n = e.name,
  92921. s = e.data,
  92922. _e$async = e.async,
  92923. r = _e$async === void 0 ? !1 : _e$async,
  92924. i = e.timeout,
  92925. o = "POST",
  92926. a = {
  92927. "x-to-function-name": n
  92928. };
  92929. r && (a["x-function-invoke-type"] = "async");
  92930. var _Ut2 = Ut("/functions/invokeFunction", {
  92931. functionName: n,
  92932. data: s,
  92933. method: o,
  92934. headers: a,
  92935. signHeaderKeys: ["x-to-function-name"],
  92936. config: t
  92937. }),
  92938. c = _Ut2.url,
  92939. u = _Ut2.headers;
  92940. return Dt({
  92941. url: c,
  92942. data: s,
  92943. method: o,
  92944. headers: u,
  92945. timeout: i
  92946. }).then(function (e) {
  92947. var t = 0;
  92948. if (r) {
  92949. var _n10 = e.data || {};
  92950. t = "200" === _n10.errCode ? 0 : _n10.errCode, e.data = _n10.data || {}, e.errMsg = _n10.errMsg;
  92951. }
  92952. if (0 !== t) throw new te({
  92953. code: t,
  92954. message: e.errMsg,
  92955. requestId: e.requestId
  92956. });
  92957. return {
  92958. errCode: t,
  92959. success: 0 === t,
  92960. requestId: e.requestId,
  92961. result: e.data
  92962. };
  92963. }).catch(function (e) {
  92964. throw new te({
  92965. code: e.errCode,
  92966. message: e.errMsg,
  92967. requestId: e.requestId
  92968. });
  92969. });
  92970. }(e, this.config);
  92971. }
  92972. }, {
  92973. key: "uploadFileToOSS",
  92974. value: function uploadFileToOSS(_ref25) {
  92975. var e = _ref25.url,
  92976. t = _ref25.filePath,
  92977. n = _ref25.fileType,
  92978. s = _ref25.formData,
  92979. r = _ref25.onUploadProgress;
  92980. return new Promise(function (i, o) {
  92981. var a = ne.uploadFile({
  92982. url: e,
  92983. filePath: t,
  92984. fileType: n,
  92985. formData: s,
  92986. name: "file",
  92987. success: function success(e) {
  92988. e && e.statusCode < 400 ? i(e) : o(new te({
  92989. code: "UPLOAD_FAILED",
  92990. message: "文件上传失败"
  92991. }));
  92992. },
  92993. fail: function fail(e) {
  92994. o(new te({
  92995. code: e.code || "UPLOAD_FAILED",
  92996. message: e.message || e.errMsg || "文件上传失败"
  92997. }));
  92998. }
  92999. });
  93000. "function" == typeof r && a && "function" == typeof a.onProgressUpdate && a.onProgressUpdate(function (e) {
  93001. r({
  93002. loaded: e.totalBytesSent,
  93003. total: e.totalBytesExpectedToSend
  93004. });
  93005. });
  93006. });
  93007. }
  93008. }, {
  93009. key: "uploadFile",
  93010. value: function () {
  93011. var _uploadFile2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45(_ref26) {
  93012. var e, _ref26$cloudPath, t, _ref26$fileType, n, s, r, i, o, a, c;
  93013. return _regenerator.default.wrap(function _callee45$(_context45) {
  93014. while (1) {
  93015. switch (_context45.prev = _context45.next) {
  93016. case 0:
  93017. e = _ref26.filePath, _ref26$cloudPath = _ref26.cloudPath, t = _ref26$cloudPath === void 0 ? "" : _ref26$cloudPath, _ref26$fileType = _ref26.fileType, n = _ref26$fileType === void 0 ? "image" : _ref26$fileType, s = _ref26.onUploadProgress;
  93018. if (!("string" !== g(t))) {
  93019. _context45.next = 3;
  93020. break;
  93021. }
  93022. throw new te({
  93023. code: "INVALID_PARAM",
  93024. message: "cloudPath必须为字符串类型"
  93025. });
  93026. case 3:
  93027. if (t = t.trim()) {
  93028. _context45.next = 5;
  93029. break;
  93030. }
  93031. throw new te({
  93032. code: "INVALID_PARAM",
  93033. message: "cloudPath不可为空"
  93034. });
  93035. case 5:
  93036. if (!/:\/\//.test(t)) {
  93037. _context45.next = 7;
  93038. break;
  93039. }
  93040. throw new te({
  93041. code: "INVALID_PARAM",
  93042. message: "cloudPath不合法"
  93043. });
  93044. case 7:
  93045. _context45.next = 9;
  93046. return Mt({
  93047. path: "/".concat(t.replace(/^\//, ""), "?post_url")
  93048. }, this.config);
  93049. case 9:
  93050. r = _context45.sent;
  93051. i = r.file_id;
  93052. o = r.upload_url;
  93053. a = r.form_data;
  93054. c = a && a.reduce(function (e, t) {
  93055. return e[t.key] = t.value, e;
  93056. }, {});
  93057. return _context45.abrupt("return", this.uploadFileToOSS({
  93058. url: o,
  93059. filePath: e,
  93060. fileType: n,
  93061. formData: c,
  93062. onUploadProgress: s
  93063. }).then(function () {
  93064. return {
  93065. fileID: i
  93066. };
  93067. }));
  93068. case 15:
  93069. case "end":
  93070. return _context45.stop();
  93071. }
  93072. }
  93073. }, _callee45, this);
  93074. }));
  93075. function uploadFile(_x43) {
  93076. return _uploadFile2.apply(this, arguments);
  93077. }
  93078. return uploadFile;
  93079. }()
  93080. }, {
  93081. key: "getTempFileURL",
  93082. value: function () {
  93083. var _getTempFileURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(_ref27) {
  93084. var _this17 = this;
  93085. var e;
  93086. return _regenerator.default.wrap(function _callee46$(_context46) {
  93087. while (1) {
  93088. switch (_context46.prev = _context46.next) {
  93089. case 0:
  93090. e = _ref27.fileList;
  93091. return _context46.abrupt("return", new Promise(function (t, n) {
  93092. (!e || e.length < 0) && t({
  93093. code: "INVALID_PARAM",
  93094. message: "fileList不能为空数组"
  93095. }), e.length > 50 && t({
  93096. code: "INVALID_PARAM",
  93097. message: "fileList数组长度不能超过50"
  93098. });
  93099. var s = [];
  93100. var _iterator5 = _createForOfIteratorHelper(e),
  93101. _step5;
  93102. try {
  93103. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  93104. var _n11 = _step5.value;
  93105. var _e18 = void 0;
  93106. "string" !== g(_n11) && t({
  93107. code: "INVALID_PARAM",
  93108. message: "fileList的元素必须是非空的字符串"
  93109. });
  93110. try {
  93111. _e18 = qt.call(_this17, _n11);
  93112. } catch (t) {
  93113. console.warn(t.errCode, t.errMsg), _e18 = _n11;
  93114. }
  93115. s.push({
  93116. file_id: _e18,
  93117. expire: 600
  93118. });
  93119. }
  93120. } catch (err) {
  93121. _iterator5.e(err);
  93122. } finally {
  93123. _iterator5.f();
  93124. }
  93125. Mt({
  93126. path: "/?download_url",
  93127. data: {
  93128. file_list: s
  93129. },
  93130. method: "POST"
  93131. }, _this17.config).then(function (e) {
  93132. var _e$file_list = e.file_list,
  93133. n = _e$file_list === void 0 ? [] : _e$file_list;
  93134. t({
  93135. fileList: n.map(function (e) {
  93136. return {
  93137. fileID: Ft.call(_this17, e.file_id),
  93138. tempFileURL: e.download_url
  93139. };
  93140. })
  93141. });
  93142. }).catch(function (e) {
  93143. return n(e);
  93144. });
  93145. }));
  93146. case 2:
  93147. case "end":
  93148. return _context46.stop();
  93149. }
  93150. }
  93151. }, _callee46);
  93152. }));
  93153. function getTempFileURL(_x44) {
  93154. return _getTempFileURL.apply(this, arguments);
  93155. }
  93156. return getTempFileURL;
  93157. }()
  93158. }, {
  93159. key: "connectWebSocket",
  93160. value: function () {
  93161. var _connectWebSocket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47(e) {
  93162. var t, n;
  93163. return _regenerator.default.wrap(function _callee47$(_context47) {
  93164. while (1) {
  93165. switch (_context47.prev = _context47.next) {
  93166. case 0:
  93167. t = e.name, n = e.query;
  93168. return _context47.abrupt("return", ne.connectSocket({
  93169. url: this._websocket.signedURL(t, n),
  93170. complete: function complete() {}
  93171. }));
  93172. case 2:
  93173. case "end":
  93174. return _context47.stop();
  93175. }
  93176. }
  93177. }, _callee47, this);
  93178. }));
  93179. function connectWebSocket(_x45) {
  93180. return _connectWebSocket.apply(this, arguments);
  93181. }
  93182. return connectWebSocket;
  93183. }()
  93184. }]);
  93185. return jt;
  93186. }();
  93187. var $t = {
  93188. init: function init(e) {
  93189. e.provider = "alipay";
  93190. var t = new jt(e);
  93191. return t.auth = function () {
  93192. return {
  93193. signInAnonymously: function signInAnonymously() {
  93194. return Promise.resolve();
  93195. },
  93196. getLoginState: function getLoginState() {
  93197. return Promise.resolve(!0);
  93198. }
  93199. };
  93200. }, t;
  93201. }
  93202. };
  93203. function Bt(_ref28) {
  93204. var e = _ref28.data;
  93205. var t;
  93206. t = he();
  93207. var n = JSON.parse(JSON.stringify(e || {}));
  93208. if (Object.assign(n, {
  93209. clientInfo: t
  93210. }), !n.uniIdToken) {
  93211. var _se3 = se(),
  93212. _e19 = _se3.token;
  93213. _e19 && (n.uniIdToken = _e19);
  93214. }
  93215. return n;
  93216. }
  93217. function Wt() {
  93218. return _Wt.apply(this, arguments);
  93219. }
  93220. function _Wt() {
  93221. _Wt = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee70() {
  93222. var _this30 = this;
  93223. var e,
  93224. _this$__dev__,
  93225. t,
  93226. n,
  93227. s,
  93228. r,
  93229. i,
  93230. o,
  93231. _args9 = arguments;
  93232. return _regenerator.default.wrap(function _callee70$(_context70) {
  93233. while (1) {
  93234. switch (_context70.prev = _context70.next) {
  93235. case 0:
  93236. e = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
  93237. _context70.next = 3;
  93238. return this.__dev__.initLocalNetwork();
  93239. case 3:
  93240. _this$__dev__ = this.__dev__, t = _this$__dev__.localAddress, n = _this$__dev__.localPort, s = {
  93241. aliyun: "aliyun",
  93242. tencent: "tcb",
  93243. alipay: "alipay",
  93244. dcloud: "dcloud"
  93245. }[this.config.provider], r = this.config.spaceId, i = "http://".concat(t, ":").concat(n, "/system/check-function"), o = "http://".concat(t, ":").concat(n, "/cloudfunctions/").concat(e.name);
  93246. return _context70.abrupt("return", new Promise(function (t, n) {
  93247. ne.request({
  93248. method: "POST",
  93249. url: i,
  93250. data: {
  93251. name: e.name,
  93252. platform: C,
  93253. provider: s,
  93254. spaceId: r
  93255. },
  93256. timeout: 3e3,
  93257. success: function success(e) {
  93258. t(e);
  93259. },
  93260. fail: function fail() {
  93261. t({
  93262. data: {
  93263. code: "NETWORK_ERROR",
  93264. message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。"
  93265. }
  93266. });
  93267. }
  93268. });
  93269. }).then(function () {
  93270. var _ref66 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  93271. e = _ref66.data;
  93272. var _ref67 = e || {},
  93273. t = _ref67.code,
  93274. n = _ref67.message;
  93275. return {
  93276. code: 0 === t ? 0 : t || "SYS_ERR",
  93277. message: n || "SYS_ERR"
  93278. };
  93279. }).then(function (_ref68) {
  93280. var t = _ref68.code,
  93281. n = _ref68.message;
  93282. if (0 !== t) {
  93283. switch (t) {
  93284. case "MODULE_ENCRYPTED":
  93285. console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e.name, "\uFF09\u4F9D\u8D56\u52A0\u5BC6\u516C\u5171\u6A21\u5757\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
  93286. break;
  93287. case "FUNCTION_ENCRYPTED":
  93288. console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e.name, "\uFF09\u5DF2\u52A0\u5BC6\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
  93289. break;
  93290. case "ACTION_ENCRYPTED":
  93291. console.error(n || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
  93292. break;
  93293. case "NETWORK_ERROR":
  93294. console.error(n || "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下");
  93295. break;
  93296. case "SWITCH_TO_CLOUD":
  93297. break;
  93298. default:
  93299. {
  93300. var _e32 = "\u68C0\u6D4B\u672C\u5730\u8C03\u8BD5\u670D\u52A1\u51FA\u73B0\u9519\u8BEF\uFF1A".concat(n, "\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u73AF\u5883\u6216\u91CD\u542F\u5BA2\u6237\u7AEF\u518D\u8BD5");
  93301. throw console.error(_e32), new Error(_e32);
  93302. }
  93303. }
  93304. return _this30._callCloudFunction(e);
  93305. }
  93306. return new Promise(function (t, n) {
  93307. var r = Bt.call(_this30, {
  93308. data: e.data
  93309. });
  93310. ne.request({
  93311. method: "POST",
  93312. url: o,
  93313. data: {
  93314. provider: s,
  93315. platform: C,
  93316. param: r
  93317. },
  93318. timeout: e.timeout,
  93319. success: function success() {
  93320. var _ref69 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  93321. e = _ref69.statusCode,
  93322. s = _ref69.data;
  93323. return !e || e >= 400 ? n(new te({
  93324. code: s.code || "SYS_ERR",
  93325. message: s.message || "request:fail"
  93326. })) : t({
  93327. result: s
  93328. });
  93329. },
  93330. fail: function fail(e) {
  93331. n(new te({
  93332. code: e.code || e.errCode || "SYS_ERR",
  93333. message: e.message || e.errMsg || "request:fail"
  93334. }));
  93335. }
  93336. });
  93337. });
  93338. }));
  93339. case 5:
  93340. case "end":
  93341. return _context70.stop();
  93342. }
  93343. }
  93344. }, _callee70, this);
  93345. }));
  93346. return _Wt.apply(this, arguments);
  93347. }
  93348. var Ht = [{
  93349. rule: /fc_function_not_found|FUNCTION_NOT_FOUND/,
  93350. content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",
  93351. mode: "append"
  93352. }];
  93353. var Jt = /[\\^$.*+?()[\]{}|]/g,
  93354. zt = RegExp(Jt.source);
  93355. function Vt(e, t, n) {
  93356. return e.replace(new RegExp((s = t) && zt.test(s) ? s.replace(Jt, "\\$&") : s, "g"), n);
  93357. var s;
  93358. }
  93359. var Gt = {
  93360. NONE: "none",
  93361. REQUEST: "request",
  93362. RESPONSE: "response",
  93363. BOTH: "both"
  93364. },
  93365. Yt = "_globalUniCloudStatus",
  93366. Qt = "_globalUniCloudSecureNetworkCache__{spaceId}";
  93367. var Xt = /*#__PURE__*/function () {
  93368. function Xt() {
  93369. var _ref29 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  93370. e = _ref29.secretType,
  93371. t = _ref29.uniCloudIns;
  93372. (0, _classCallCheck2.default)(this, Xt);
  93373. this.clientType = "", this.secretType = e || Gt.NONE, this.uniCloudIns = t;
  93374. var _this$uniCloudIns$con = this.uniCloudIns.config,
  93375. n = _this$uniCloudIns$con.provider,
  93376. s = _this$uniCloudIns$con.spaceId;
  93377. var r;
  93378. this.provider = n, this.spaceId = s, this.scopedGlobalCache = (r = this.uniCloudIns, U(Qt.replace("{spaceId}", r.config.spaceId)));
  93379. }
  93380. (0, _createClass2.default)(Xt, [{
  93381. key: "getSystemInfo",
  93382. value: function getSystemInfo() {
  93383. return this._systemInfo || (this._systemInfo = ae()), this._systemInfo;
  93384. }
  93385. }, {
  93386. key: "appId",
  93387. get: function get() {
  93388. return this.getSystemInfo().appId;
  93389. }
  93390. }, {
  93391. key: "deviceId",
  93392. get: function get() {
  93393. return this.getSystemInfo().deviceId;
  93394. }
  93395. }, {
  93396. key: "encryptData",
  93397. value: function () {
  93398. var _encryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(e) {
  93399. return _regenerator.default.wrap(function _callee48$(_context48) {
  93400. while (1) {
  93401. switch (_context48.prev = _context48.next) {
  93402. case 0:
  93403. return _context48.abrupt("return", this.secretType === Gt.NONE ? e : this.platformEncryptData(e));
  93404. case 1:
  93405. case "end":
  93406. return _context48.stop();
  93407. }
  93408. }
  93409. }, _callee48, this);
  93410. }));
  93411. function encryptData(_x46) {
  93412. return _encryptData.apply(this, arguments);
  93413. }
  93414. return encryptData;
  93415. }()
  93416. }, {
  93417. key: "decryptResult",
  93418. value: function () {
  93419. var _decryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(e) {
  93420. var _ref30, t, n;
  93421. return _regenerator.default.wrap(function _callee49$(_context49) {
  93422. while (1) {
  93423. switch (_context49.prev = _context49.next) {
  93424. case 0:
  93425. if (!(this.secretType === Gt.NONE)) {
  93426. _context49.next = 2;
  93427. break;
  93428. }
  93429. return _context49.abrupt("return", e);
  93430. case 2:
  93431. _ref30 = e || {}, t = _ref30.errCode, n = _ref30.content;
  93432. return _context49.abrupt("return", t || !n ? e : this.secretType === Gt.REQUEST ? n : this.platformDecryptResult(e));
  93433. case 4:
  93434. case "end":
  93435. return _context49.stop();
  93436. }
  93437. }
  93438. }, _callee49, this);
  93439. }));
  93440. function decryptResult(_x47) {
  93441. return _decryptResult.apply(this, arguments);
  93442. }
  93443. return decryptResult;
  93444. }()
  93445. }, {
  93446. key: "wrapVerifyClientCallFunction",
  93447. value: function wrapVerifyClientCallFunction(e) {
  93448. var t = this;
  93449. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
  93450. var _ref32,
  93451. n,
  93452. _ref32$data,
  93453. s,
  93454. r,
  93455. _args50 = arguments;
  93456. return _regenerator.default.wrap(function _callee50$(_context50) {
  93457. while (1) {
  93458. switch (_context50.prev = _context50.next) {
  93459. case 0:
  93460. _ref32 = _args50.length > 0 && _args50[0] !== undefined ? _args50[0] : {}, n = _ref32.name, _ref32$data = _ref32.data, s = _ref32$data === void 0 ? {} : _ref32$data;
  93461. _context50.next = 3;
  93462. return t.prepare();
  93463. case 3:
  93464. _context50.next = 5;
  93465. return t.platformGetSignOption();
  93466. case 5:
  93467. (s = JSON.parse(JSON.stringify(s)))._uniCloudOptions = _context50.sent;
  93468. _context50.next = 8;
  93469. return e({
  93470. name: n,
  93471. data: s
  93472. });
  93473. case 8:
  93474. r = _context50.sent;
  93475. _context50.t0 = t.isClientKeyNotFound(r);
  93476. if (!_context50.t0) {
  93477. _context50.next = 19;
  93478. break;
  93479. }
  93480. _context50.next = 13;
  93481. return t.prepare({
  93482. forceUpdate: !0
  93483. });
  93484. case 13:
  93485. _context50.next = 15;
  93486. return t.platformGetSignOption();
  93487. case 15:
  93488. s._uniCloudOptions = _context50.sent;
  93489. _context50.next = 18;
  93490. return e({
  93491. name: n,
  93492. data: s
  93493. });
  93494. case 18:
  93495. r = _context50.sent;
  93496. case 19:
  93497. return _context50.abrupt("return", r);
  93498. case 20:
  93499. case "end":
  93500. return _context50.stop();
  93501. }
  93502. }
  93503. }, _callee50);
  93504. }));
  93505. }
  93506. }, {
  93507. key: "wrapEncryptDataCallFunction",
  93508. value: function wrapEncryptDataCallFunction(e) {
  93509. var t = this;
  93510. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
  93511. var _ref34,
  93512. n,
  93513. _ref34$data,
  93514. s,
  93515. r,
  93516. i,
  93517. _r5,
  93518. _args51 = arguments;
  93519. return _regenerator.default.wrap(function _callee51$(_context51) {
  93520. while (1) {
  93521. switch (_context51.prev = _context51.next) {
  93522. case 0:
  93523. _ref34 = _args51.length > 0 && _args51[0] !== undefined ? _args51[0] : {}, n = _ref34.name, _ref34$data = _ref34.data, s = _ref34$data === void 0 ? {} : _ref34$data;
  93524. _context51.next = 3;
  93525. return t.prepare();
  93526. case 3:
  93527. _context51.next = 5;
  93528. return t.encryptData(s);
  93529. case 5:
  93530. r = _context51.sent;
  93531. _context51.next = 8;
  93532. return e({
  93533. name: n,
  93534. data: r
  93535. });
  93536. case 8:
  93537. i = _context51.sent;
  93538. if (!t.isClientKeyNotFound(i)) {
  93539. _context51.next = 21;
  93540. break;
  93541. }
  93542. _context51.next = 12;
  93543. return t.prepare({
  93544. forceUpdate: !0
  93545. });
  93546. case 12:
  93547. _context51.next = 14;
  93548. return t.encryptData(s);
  93549. case 14:
  93550. _r5 = _context51.sent;
  93551. _context51.next = 17;
  93552. return t.platformGetSignOption();
  93553. case 17:
  93554. s._uniCloudOptions = _context51.sent;
  93555. _context51.next = 20;
  93556. return e({
  93557. name: n,
  93558. data: _r5
  93559. });
  93560. case 20:
  93561. i = _context51.sent;
  93562. case 21:
  93563. _context51.next = 23;
  93564. return t.decryptResult(i.result);
  93565. case 23:
  93566. i.result = _context51.sent;
  93567. return _context51.abrupt("return", i);
  93568. case 25:
  93569. case "end":
  93570. return _context51.stop();
  93571. }
  93572. }
  93573. }, _callee51);
  93574. }));
  93575. }
  93576. }]);
  93577. return Xt;
  93578. }();
  93579. /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
  93580. function Zt(e) {
  93581. return parseInt(e) === e;
  93582. }
  93583. function en(e) {
  93584. if (!Zt(e.length)) return !1;
  93585. for (var t = 0; t < e.length; t++) {
  93586. if (!Zt(e[t]) || e[t] < 0 || e[t] > 255) return !1;
  93587. }
  93588. return !0;
  93589. }
  93590. function tn(e, t) {
  93591. if (e.buffer && "Uint8Array" === e.name) return t && (e = e.slice ? e.slice() : Array.prototype.slice.call(e)), e;
  93592. if (Array.isArray(e)) {
  93593. if (!en(e)) throw new Error("Array contains invalid value: " + e);
  93594. return new Uint8Array(e);
  93595. }
  93596. if (Zt(e.length) && en(e)) return new Uint8Array(e);
  93597. throw new Error("unsupported array-like object");
  93598. }
  93599. function nn(e) {
  93600. return new Uint8Array(e);
  93601. }
  93602. function sn(e, t, n, s, r) {
  93603. null == s && null == r || (e = e.slice ? e.slice(s, r) : Array.prototype.slice.call(e, s, r)), t.set(e, n);
  93604. }
  93605. var rn,
  93606. on = {
  93607. toBytes: function toBytes(e) {
  93608. var t = [],
  93609. n = 0;
  93610. for (e = encodeURI(e); n < e.length;) {
  93611. var s = e.charCodeAt(n++);
  93612. 37 === s ? (t.push(parseInt(e.substr(n, 2), 16)), n += 2) : t.push(s);
  93613. }
  93614. return tn(t);
  93615. },
  93616. fromBytes: function fromBytes(e) {
  93617. for (var t = [], n = 0; n < e.length;) {
  93618. var s = e[n];
  93619. s < 128 ? (t.push(String.fromCharCode(s)), n++) : s > 191 && s < 224 ? (t.push(String.fromCharCode((31 & s) << 6 | 63 & e[n + 1])), n += 2) : (t.push(String.fromCharCode((15 & s) << 12 | (63 & e[n + 1]) << 6 | 63 & e[n + 2])), n += 3);
  93620. }
  93621. return t.join("");
  93622. }
  93623. },
  93624. an = (rn = "0123456789abcdef", {
  93625. toBytes: function toBytes(e) {
  93626. for (var t = [], n = 0; n < e.length; n += 2) {
  93627. t.push(parseInt(e.substr(n, 2), 16));
  93628. }
  93629. return t;
  93630. },
  93631. fromBytes: function fromBytes(e) {
  93632. for (var t = [], n = 0; n < e.length; n++) {
  93633. var s = e[n];
  93634. t.push(rn[(240 & s) >> 4] + rn[15 & s]);
  93635. }
  93636. return t.join("");
  93637. }
  93638. }),
  93639. cn = {
  93640. 16: 10,
  93641. 24: 12,
  93642. 32: 14
  93643. },
  93644. un = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145],
  93645. hn = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22],
  93646. ln = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125],
  93647. dn = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986],
  93648. pn = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766],
  93649. fn = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126],
  93650. gn = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436],
  93651. mn = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890],
  93652. yn = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935],
  93653. _n = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600],
  93654. wn = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480],
  93655. vn = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795],
  93656. In = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855],
  93657. Sn = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150],
  93658. Tn = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
  93659. function bn(e) {
  93660. for (var t = [], n = 0; n < e.length; n += 4) {
  93661. t.push(e[n] << 24 | e[n + 1] << 16 | e[n + 2] << 8 | e[n + 3]);
  93662. }
  93663. return t;
  93664. }
  93665. var En = /*#__PURE__*/function () {
  93666. function En(e) {
  93667. (0, _classCallCheck2.default)(this, En);
  93668. if (!(this instanceof En)) throw Error("AES must be instanitated with `new`");
  93669. Object.defineProperty(this, "key", {
  93670. value: tn(e, !0)
  93671. }), this._prepare();
  93672. }
  93673. (0, _createClass2.default)(En, [{
  93674. key: "_prepare",
  93675. value: function _prepare() {
  93676. var e = cn[this.key.length];
  93677. if (null == e) throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
  93678. this._Ke = [], this._Kd = [];
  93679. for (var t = 0; t <= e; t++) {
  93680. this._Ke.push([0, 0, 0, 0]), this._Kd.push([0, 0, 0, 0]);
  93681. }
  93682. var n,
  93683. s = 4 * (e + 1),
  93684. r = this.key.length / 4,
  93685. i = bn(this.key);
  93686. for (t = 0; t < r; t++) {
  93687. n = t >> 2, this._Ke[n][t % 4] = i[t], this._Kd[e - n][t % 4] = i[t];
  93688. }
  93689. for (var o, a = 0, c = r; c < s;) {
  93690. if (o = i[r - 1], i[0] ^= hn[o >> 16 & 255] << 24 ^ hn[o >> 8 & 255] << 16 ^ hn[255 & o] << 8 ^ hn[o >> 24 & 255] ^ un[a] << 24, a += 1, 8 != r) for (t = 1; t < r; t++) {
  93691. i[t] ^= i[t - 1];
  93692. } else {
  93693. for (t = 1; t < r / 2; t++) {
  93694. i[t] ^= i[t - 1];
  93695. }
  93696. o = i[r / 2 - 1], i[r / 2] ^= hn[255 & o] ^ hn[o >> 8 & 255] << 8 ^ hn[o >> 16 & 255] << 16 ^ hn[o >> 24 & 255] << 24;
  93697. for (t = r / 2 + 1; t < r; t++) {
  93698. i[t] ^= i[t - 1];
  93699. }
  93700. }
  93701. for (t = 0; t < r && c < s;) {
  93702. u = c >> 2, h = c % 4, this._Ke[u][h] = i[t], this._Kd[e - u][h] = i[t++], c++;
  93703. }
  93704. }
  93705. for (var u = 1; u < e; u++) {
  93706. for (var h = 0; h < 4; h++) {
  93707. o = this._Kd[u][h], this._Kd[u][h] = vn[o >> 24 & 255] ^ In[o >> 16 & 255] ^ Sn[o >> 8 & 255] ^ Tn[255 & o];
  93708. }
  93709. }
  93710. }
  93711. }, {
  93712. key: "encrypt",
  93713. value: function encrypt(e) {
  93714. if (16 != e.length) throw new Error("invalid plaintext size (must be 16 bytes)");
  93715. for (var t = this._Ke.length - 1, n = [0, 0, 0, 0], s = bn(e), r = 0; r < 4; r++) {
  93716. s[r] ^= this._Ke[0][r];
  93717. }
  93718. for (var i = 1; i < t; i++) {
  93719. for (r = 0; r < 4; r++) {
  93720. n[r] = dn[s[r] >> 24 & 255] ^ pn[s[(r + 1) % 4] >> 16 & 255] ^ fn[s[(r + 2) % 4] >> 8 & 255] ^ gn[255 & s[(r + 3) % 4]] ^ this._Ke[i][r];
  93721. }
  93722. s = n.slice();
  93723. }
  93724. var o,
  93725. a = nn(16);
  93726. for (r = 0; r < 4; r++) {
  93727. o = this._Ke[t][r], a[4 * r] = 255 & (hn[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (hn[s[(r + 1) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (hn[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (hn[255 & s[(r + 3) % 4]] ^ o);
  93728. }
  93729. return a;
  93730. }
  93731. }, {
  93732. key: "decrypt",
  93733. value: function decrypt(e) {
  93734. if (16 != e.length) throw new Error("invalid ciphertext size (must be 16 bytes)");
  93735. for (var t = this._Kd.length - 1, n = [0, 0, 0, 0], s = bn(e), r = 0; r < 4; r++) {
  93736. s[r] ^= this._Kd[0][r];
  93737. }
  93738. for (var i = 1; i < t; i++) {
  93739. for (r = 0; r < 4; r++) {
  93740. n[r] = mn[s[r] >> 24 & 255] ^ yn[s[(r + 3) % 4] >> 16 & 255] ^ _n[s[(r + 2) % 4] >> 8 & 255] ^ wn[255 & s[(r + 1) % 4]] ^ this._Kd[i][r];
  93741. }
  93742. s = n.slice();
  93743. }
  93744. var o,
  93745. a = nn(16);
  93746. for (r = 0; r < 4; r++) {
  93747. o = this._Kd[t][r], a[4 * r] = 255 & (ln[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (ln[s[(r + 3) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (ln[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (ln[255 & s[(r + 1) % 4]] ^ o);
  93748. }
  93749. return a;
  93750. }
  93751. }]);
  93752. return En;
  93753. }();
  93754. var kn = /*#__PURE__*/function () {
  93755. function kn(e) {
  93756. (0, _classCallCheck2.default)(this, kn);
  93757. if (!(this instanceof kn)) throw Error("AES must be instanitated with `new`");
  93758. this.description = "Electronic Code Block", this.name = "ecb", this._aes = new En(e);
  93759. }
  93760. (0, _createClass2.default)(kn, [{
  93761. key: "encrypt",
  93762. value: function encrypt(e) {
  93763. if ((e = tn(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
  93764. for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
  93765. sn(e, n, 0, s, s + 16), sn(n = this._aes.encrypt(n), t, s);
  93766. }
  93767. return t;
  93768. }
  93769. }, {
  93770. key: "decrypt",
  93771. value: function decrypt(e) {
  93772. if ((e = tn(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
  93773. for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
  93774. sn(e, n, 0, s, s + 16), sn(n = this._aes.decrypt(n), t, s);
  93775. }
  93776. return t;
  93777. }
  93778. }]);
  93779. return kn;
  93780. }();
  93781. var Pn = /*#__PURE__*/function () {
  93782. function Pn(e, t) {
  93783. (0, _classCallCheck2.default)(this, Pn);
  93784. if (!(this instanceof Pn)) throw Error("AES must be instanitated with `new`");
  93785. if (this.description = "Cipher Block Chaining", this.name = "cbc", t) {
  93786. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
  93787. } else t = nn(16);
  93788. this._lastCipherblock = tn(t, !0), this._aes = new En(e);
  93789. }
  93790. (0, _createClass2.default)(Pn, [{
  93791. key: "encrypt",
  93792. value: function encrypt(e) {
  93793. if ((e = tn(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
  93794. for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
  93795. sn(e, n, 0, s, s + 16);
  93796. for (var r = 0; r < 16; r++) {
  93797. n[r] ^= this._lastCipherblock[r];
  93798. }
  93799. this._lastCipherblock = this._aes.encrypt(n), sn(this._lastCipherblock, t, s);
  93800. }
  93801. return t;
  93802. }
  93803. }, {
  93804. key: "decrypt",
  93805. value: function decrypt(e) {
  93806. if ((e = tn(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
  93807. for (var t = nn(e.length), n = nn(16), s = 0; s < e.length; s += 16) {
  93808. sn(e, n, 0, s, s + 16), n = this._aes.decrypt(n);
  93809. for (var r = 0; r < 16; r++) {
  93810. t[s + r] = n[r] ^ this._lastCipherblock[r];
  93811. }
  93812. sn(e, this._lastCipherblock, 0, s, s + 16);
  93813. }
  93814. return t;
  93815. }
  93816. }]);
  93817. return Pn;
  93818. }();
  93819. var Cn = /*#__PURE__*/function () {
  93820. function Cn(e, t, n) {
  93821. (0, _classCallCheck2.default)(this, Cn);
  93822. if (!(this instanceof Cn)) throw Error("AES must be instanitated with `new`");
  93823. if (this.description = "Cipher Feedback", this.name = "cfb", t) {
  93824. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 size)");
  93825. } else t = nn(16);
  93826. n || (n = 1), this.segmentSize = n, this._shiftRegister = tn(t, !0), this._aes = new En(e);
  93827. }
  93828. (0, _createClass2.default)(Cn, [{
  93829. key: "encrypt",
  93830. value: function encrypt(e) {
  93831. if (e.length % this.segmentSize != 0) throw new Error("invalid plaintext size (must be segmentSize bytes)");
  93832. for (var t, n = tn(e, !0), s = 0; s < n.length; s += this.segmentSize) {
  93833. t = this._aes.encrypt(this._shiftRegister);
  93834. for (var r = 0; r < this.segmentSize; r++) {
  93835. n[s + r] ^= t[r];
  93836. }
  93837. sn(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), sn(n, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
  93838. }
  93839. return n;
  93840. }
  93841. }, {
  93842. key: "decrypt",
  93843. value: function decrypt(e) {
  93844. if (e.length % this.segmentSize != 0) throw new Error("invalid ciphertext size (must be segmentSize bytes)");
  93845. for (var t, n = tn(e, !0), s = 0; s < n.length; s += this.segmentSize) {
  93846. t = this._aes.encrypt(this._shiftRegister);
  93847. for (var r = 0; r < this.segmentSize; r++) {
  93848. n[s + r] ^= t[r];
  93849. }
  93850. sn(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), sn(e, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
  93851. }
  93852. return n;
  93853. }
  93854. }]);
  93855. return Cn;
  93856. }();
  93857. var An = /*#__PURE__*/function () {
  93858. function An(e, t) {
  93859. (0, _classCallCheck2.default)(this, An);
  93860. if (!(this instanceof An)) throw Error("AES must be instanitated with `new`");
  93861. if (this.description = "Output Feedback", this.name = "ofb", t) {
  93862. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
  93863. } else t = nn(16);
  93864. this._lastPrecipher = tn(t, !0), this._lastPrecipherIndex = 16, this._aes = new En(e);
  93865. }
  93866. (0, _createClass2.default)(An, [{
  93867. key: "encrypt",
  93868. value: function encrypt(e) {
  93869. for (var t = tn(e, !0), n = 0; n < t.length; n++) {
  93870. 16 === this._lastPrecipherIndex && (this._lastPrecipher = this._aes.encrypt(this._lastPrecipher), this._lastPrecipherIndex = 0), t[n] ^= this._lastPrecipher[this._lastPrecipherIndex++];
  93871. }
  93872. return t;
  93873. }
  93874. }, {
  93875. key: "decrypt",
  93876. value: function decrypt(e) {
  93877. return this.encrypt(e);
  93878. }
  93879. }]);
  93880. return An;
  93881. }();
  93882. var On = /*#__PURE__*/function () {
  93883. function On(e) {
  93884. (0, _classCallCheck2.default)(this, On);
  93885. if (!(this instanceof On)) throw Error("Counter must be instanitated with `new`");
  93886. 0 === e || e || (e = 1), "number" == typeof e ? (this._counter = nn(16), this.setValue(e)) : this.setBytes(e);
  93887. }
  93888. (0, _createClass2.default)(On, [{
  93889. key: "setValue",
  93890. value: function setValue(e) {
  93891. if ("number" != typeof e || parseInt(e) != e) throw new Error("invalid counter value (must be an integer)");
  93892. if (e > Number.MAX_SAFE_INTEGER) throw new Error("integer value out of safe range");
  93893. for (var t = 15; t >= 0; --t) {
  93894. this._counter[t] = e % 256, e = parseInt(e / 256);
  93895. }
  93896. }
  93897. }, {
  93898. key: "setBytes",
  93899. value: function setBytes(e) {
  93900. if (16 != (e = tn(e, !0)).length) throw new Error("invalid counter bytes size (must be 16 bytes)");
  93901. this._counter = e;
  93902. }
  93903. }, {
  93904. key: "increment",
  93905. value: function increment() {
  93906. for (var e = 15; e >= 0; e--) {
  93907. if (255 !== this._counter[e]) {
  93908. this._counter[e]++;
  93909. break;
  93910. }
  93911. this._counter[e] = 0;
  93912. }
  93913. }
  93914. }]);
  93915. return On;
  93916. }();
  93917. var xn = /*#__PURE__*/function () {
  93918. function xn(e, t) {
  93919. (0, _classCallCheck2.default)(this, xn);
  93920. if (!(this instanceof xn)) throw Error("AES must be instanitated with `new`");
  93921. this.description = "Counter", this.name = "ctr", t instanceof On || (t = new On(t)), this._counter = t, this._remainingCounter = null, this._remainingCounterIndex = 16, this._aes = new En(e);
  93922. }
  93923. (0, _createClass2.default)(xn, [{
  93924. key: "encrypt",
  93925. value: function encrypt(e) {
  93926. for (var t = tn(e, !0), n = 0; n < t.length; n++) {
  93927. 16 === this._remainingCounterIndex && (this._remainingCounter = this._aes.encrypt(this._counter._counter), this._remainingCounterIndex = 0, this._counter.increment()), t[n] ^= this._remainingCounter[this._remainingCounterIndex++];
  93928. }
  93929. return t;
  93930. }
  93931. }, {
  93932. key: "decrypt",
  93933. value: function decrypt(e) {
  93934. return this.encrypt(e);
  93935. }
  93936. }]);
  93937. return xn;
  93938. }();
  93939. var Nn = {
  93940. AES: En,
  93941. Counter: On,
  93942. ModeOfOperation: {
  93943. ecb: kn,
  93944. cbc: Pn,
  93945. cfb: Cn,
  93946. ofb: An,
  93947. ctr: xn
  93948. },
  93949. utils: {
  93950. hex: an,
  93951. utf8: on
  93952. },
  93953. padding: {
  93954. pkcs7: {
  93955. pad: function pad(e) {
  93956. var t = 16 - (e = tn(e, !0)).length % 16,
  93957. n = nn(e.length + t);
  93958. sn(e, n);
  93959. for (var s = e.length; s < n.length; s++) {
  93960. n[s] = t;
  93961. }
  93962. return n;
  93963. },
  93964. strip: function strip(e) {
  93965. if ((e = tn(e, !0)).length < 16) throw new Error("PKCS#7 invalid length");
  93966. var t = e[e.length - 1];
  93967. if (t > 16) throw new Error("PKCS#7 padding byte out of range");
  93968. for (var n = e.length - t, s = 0; s < t; s++) {
  93969. if (e[n + s] !== t) throw new Error("PKCS#7 invalid padding byte");
  93970. }
  93971. var r = nn(n);
  93972. return sn(e, r, 0, 0, n), r;
  93973. }
  93974. }
  93975. },
  93976. _arrayTest: {
  93977. coerceArray: tn,
  93978. createArray: nn,
  93979. copyArray: sn
  93980. }
  93981. };
  93982. function Rn(e, t, n) {
  93983. var s = new Uint8Array(uni.base64ToArrayBuffer(t)),
  93984. r = Nn.utils.utf8.toBytes(n),
  93985. i = Nn.utils.utf8.toBytes(e),
  93986. o = new Nn.ModeOfOperation.cbc(s, r),
  93987. a = Nn.padding.pkcs7.pad(i),
  93988. c = o.encrypt(a);
  93989. return uni.arrayBufferToBase64(c);
  93990. }
  93991. var Ln = "uni-secure-network",
  93992. Un = {
  93993. SYSTEM_ERROR: {
  93994. code: 2e4,
  93995. message: "System error"
  93996. },
  93997. APP_INFO_INVALID: {
  93998. code: 20101,
  93999. message: "Invalid client"
  94000. },
  94001. GET_ENCRYPT_KEY_FAILED: {
  94002. code: 20102,
  94003. message: "Get encrypt key failed"
  94004. }
  94005. },
  94006. Dn = {
  94007. 10001: "Secure network is not supported on current playground or unimpsdk",
  94008. 10003: "Config missing in current app. If the problem pesist, please contact DCloud.",
  94009. 10009: "Encrypt payload failed",
  94010. 10010: "Decrypt response failed"
  94011. };
  94012. function Mn(e) {
  94013. var _ref35 = e || {},
  94014. t = _ref35.errSubject,
  94015. n = _ref35.subject,
  94016. s = _ref35.errCode,
  94017. r = _ref35.errMsg,
  94018. i = _ref35.code,
  94019. o = _ref35.message,
  94020. a = _ref35.cause;
  94021. return new te({
  94022. subject: t || n || Ln,
  94023. code: s || i || Un.SYSTEM_ERROR.code,
  94024. message: r || o,
  94025. cause: a
  94026. });
  94027. }
  94028. var qn,
  94029. Fn,
  94030. Kn = null;
  94031. var jn = /*#__PURE__*/function (_Xt) {
  94032. (0, _inherits2.default)(jn, _Xt);
  94033. var _super8 = _createSuper(jn);
  94034. function jn(e) {
  94035. var _this18;
  94036. (0, _classCallCheck2.default)(this, jn);
  94037. _this18 = _super8.call(this, e), _this18.clientType = "mp-weixin", _this18.userEncryptKey = null;
  94038. return _this18;
  94039. }
  94040. (0, _createClass2.default)(jn, [{
  94041. key: "isLogin",
  94042. value: function isLogin() {
  94043. return !!this.scopedGlobalCache.mpWeixinCode || !!this.scopedGlobalCache.mpWeixinOpenid;
  94044. }
  94045. }, {
  94046. key: "prepare",
  94047. value: function () {
  94048. var _prepare2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52() {
  94049. return _regenerator.default.wrap(function _callee52$(_context52) {
  94050. while (1) {
  94051. switch (_context52.prev = _context52.next) {
  94052. case 0:
  94053. if (this.isLogin()) {
  94054. _context52.next = 7;
  94055. break;
  94056. }
  94057. if (this.scopedGlobalCache.initPromise) {
  94058. _context52.next = 3;
  94059. break;
  94060. }
  94061. throw new Error("`uniCloud.initSecureNetworkByWeixin` has not yet been called");
  94062. case 3:
  94063. _context52.next = 5;
  94064. return this.scopedGlobalCache.initPromise;
  94065. case 5:
  94066. if (this.isLogin()) {
  94067. _context52.next = 7;
  94068. break;
  94069. }
  94070. throw new Error("uniCloud.initSecureNetworkByWeixin` has not yet been called or successfully excuted");
  94071. case 7:
  94072. case "end":
  94073. return _context52.stop();
  94074. }
  94075. }
  94076. }, _callee52, this);
  94077. }));
  94078. function prepare() {
  94079. return _prepare2.apply(this, arguments);
  94080. }
  94081. return prepare;
  94082. }()
  94083. }, {
  94084. key: "getUserEncryptKey",
  94085. value: function () {
  94086. var _getUserEncryptKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
  94087. var _this19 = this;
  94088. var e;
  94089. return _regenerator.default.wrap(function _callee53$(_context53) {
  94090. while (1) {
  94091. switch (_context53.prev = _context53.next) {
  94092. case 0:
  94093. if (!this.userEncryptKey) {
  94094. _context53.next = 2;
  94095. break;
  94096. }
  94097. return _context53.abrupt("return", this.userEncryptKey);
  94098. case 2:
  94099. if (!(Kn && Kn.expireTime)) {
  94100. _context53.next = 6;
  94101. break;
  94102. }
  94103. e = Date.now();
  94104. if (!(Kn.expireTime - e > 0)) {
  94105. _context53.next = 6;
  94106. break;
  94107. }
  94108. return _context53.abrupt("return", (this.userEncryptKey = Kn, this.userEncryptKey));
  94109. case 6:
  94110. return _context53.abrupt("return", new Promise(function (e, t) {
  94111. uni.getUserCryptoManager().getLatestUserKey({
  94112. success: function success(t) {
  94113. Kn = t, _this19.userEncryptKey = t, e(_this19.userEncryptKey);
  94114. },
  94115. fail: function fail(e) {
  94116. t(Mn(_objectSpread(_objectSpread({}, Un.GET_ENCRYPT_KEY_FAILED), {}, {
  94117. cause: e
  94118. })));
  94119. }
  94120. });
  94121. }));
  94122. case 7:
  94123. case "end":
  94124. return _context53.stop();
  94125. }
  94126. }
  94127. }, _callee53, this);
  94128. }));
  94129. function getUserEncryptKey() {
  94130. return _getUserEncryptKey.apply(this, arguments);
  94131. }
  94132. return getUserEncryptKey;
  94133. }()
  94134. }, {
  94135. key: "getWxAppId",
  94136. value: function getWxAppId() {
  94137. return wx.getAccountInfoSync().miniProgram.appId;
  94138. }
  94139. }, {
  94140. key: "platformGetSignOption",
  94141. value: function () {
  94142. var _platformGetSignOption = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54() {
  94143. var _yield$this$getUserEn, e, t, n;
  94144. return _regenerator.default.wrap(function _callee54$(_context54) {
  94145. while (1) {
  94146. switch (_context54.prev = _context54.next) {
  94147. case 0:
  94148. _context54.next = 2;
  94149. return this.getUserEncryptKey();
  94150. case 2:
  94151. _yield$this$getUserEn = _context54.sent;
  94152. e = _yield$this$getUserEn.encryptKey;
  94153. t = _yield$this$getUserEn.iv;
  94154. n = _yield$this$getUserEn.version;
  94155. return _context54.abrupt("return", {
  94156. verifyClientSign: Rn(JSON.stringify({
  94157. data: JSON.stringify({}),
  94158. appId: this.appId,
  94159. deviceId: this.deviceId,
  94160. wxAppId: this.getWxAppId(),
  94161. simulator: "devtools" === ae().platform,
  94162. timestamp: Date.now()
  94163. }), e, t),
  94164. encryptKeyId: n,
  94165. mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
  94166. mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
  94167. });
  94168. case 7:
  94169. case "end":
  94170. return _context54.stop();
  94171. }
  94172. }
  94173. }, _callee54, this);
  94174. }));
  94175. function platformGetSignOption() {
  94176. return _platformGetSignOption.apply(this, arguments);
  94177. }
  94178. return platformGetSignOption;
  94179. }()
  94180. }, {
  94181. key: "platformEncryptData",
  94182. value: function () {
  94183. var _platformEncryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55(e) {
  94184. var _yield$this$getUserEn2, t, n, s, r;
  94185. return _regenerator.default.wrap(function _callee55$(_context55) {
  94186. while (1) {
  94187. switch (_context55.prev = _context55.next) {
  94188. case 0:
  94189. _context55.next = 2;
  94190. return this.getUserEncryptKey();
  94191. case 2:
  94192. _yield$this$getUserEn2 = _context55.sent;
  94193. t = _yield$this$getUserEn2.encryptKey;
  94194. n = _yield$this$getUserEn2.iv;
  94195. s = _yield$this$getUserEn2.version;
  94196. r = {
  94197. secretType: this.secretType,
  94198. encryptKeyId: s,
  94199. mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
  94200. mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
  94201. };
  94202. return _context55.abrupt("return", this.secretType === Gt.RESPONSE ? {
  94203. content: e,
  94204. _uniCloudOptions: r
  94205. } : {
  94206. content: Rn(JSON.stringify({
  94207. data: JSON.stringify(e),
  94208. appId: this.appId,
  94209. deviceId: this.deviceId,
  94210. wxAppId: this.getWxAppId(),
  94211. simulator: "devtools" === ae().platform,
  94212. timestamp: Date.now()
  94213. }), t, n),
  94214. _uniCloudOptions: r
  94215. });
  94216. case 8:
  94217. case "end":
  94218. return _context55.stop();
  94219. }
  94220. }
  94221. }, _callee55, this);
  94222. }));
  94223. function platformEncryptData(_x48) {
  94224. return _platformEncryptData.apply(this, arguments);
  94225. }
  94226. return platformEncryptData;
  94227. }()
  94228. }, {
  94229. key: "platformDecryptResult",
  94230. value: function () {
  94231. var _platformDecryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(e) {
  94232. var t, _yield$this$getUserEn3, n, s;
  94233. return _regenerator.default.wrap(function _callee56$(_context56) {
  94234. while (1) {
  94235. switch (_context56.prev = _context56.next) {
  94236. case 0:
  94237. t = e.content;
  94238. _context56.next = 3;
  94239. return this.getUserEncryptKey();
  94240. case 3:
  94241. _yield$this$getUserEn3 = _context56.sent;
  94242. n = _yield$this$getUserEn3.encryptKey;
  94243. s = _yield$this$getUserEn3.iv;
  94244. return _context56.abrupt("return", JSON.parse(function (e, t, n) {
  94245. var s = new Uint8Array(uni.base64ToArrayBuffer(e)),
  94246. r = new Uint8Array(uni.base64ToArrayBuffer(t)),
  94247. i = Nn.utils.utf8.toBytes(n),
  94248. o = new Nn.ModeOfOperation.cbc(r, i),
  94249. a = Nn.padding.pkcs7.strip(o.decrypt(s));
  94250. return Nn.utils.utf8.fromBytes(a);
  94251. }(t, n, s)));
  94252. case 7:
  94253. case "end":
  94254. return _context56.stop();
  94255. }
  94256. }
  94257. }, _callee56, this);
  94258. }));
  94259. function platformDecryptResult(_x49) {
  94260. return _platformDecryptResult.apply(this, arguments);
  94261. }
  94262. return platformDecryptResult;
  94263. }()
  94264. }, {
  94265. key: "isClientKeyNotFound",
  94266. value: function isClientKeyNotFound() {
  94267. return !1;
  94268. }
  94269. }]);
  94270. return jn;
  94271. }(Xt);
  94272. function $n(e) {
  94273. var t = ["hasClientKey", "encryptGetClientKeyPayload", "setClientKey", "encrypt", "decrypt"],
  94274. n = {};
  94275. var _loop = function _loop(_s14) {
  94276. var r = t[_s14];
  94277. n[r] = function () {
  94278. for (var _len2 = arguments.length, t = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  94279. t[_key2] = arguments[_key2];
  94280. }
  94281. return new Promise(function (n, s) {
  94282. "function" == typeof e[r] ? e[r].apply(e, t.concat([function () {
  94283. var _ref36 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  94284. e = _ref36.type,
  94285. t = _ref36.data,
  94286. r = _ref36.errCode,
  94287. i = _ref36.errMsg,
  94288. o = _ref36.errSubject,
  94289. a = _ref36.message;
  94290. "success" === e ? n(t) : s(Mn({
  94291. errCode: r,
  94292. errMsg: Dn[r] || i || a,
  94293. errSubject: o
  94294. }));
  94295. }])) : s(Mn({
  94296. message: "请检查manifest.json内是否开启安全网络模块,另外注意标准基座不支持安全网络模块"
  94297. }));
  94298. });
  94299. };
  94300. };
  94301. for (var _s14 = 0; _s14 < t.length; _s14++) {
  94302. _loop(_s14);
  94303. }
  94304. return n;
  94305. }
  94306. var Bn = /*#__PURE__*/function (_Xt2) {
  94307. (0, _inherits2.default)(Bn, _Xt2);
  94308. var _super9 = _createSuper(Bn);
  94309. function Bn(e) {
  94310. var _this20;
  94311. (0, _classCallCheck2.default)(this, Bn);
  94312. _this20 = _super9.call(this, e), _this20.clientType = "app", _this20.appUtils = _objectSpread({}, $n(uni.requireNativePlugin("plus"))), _this20.systemInfo = qn || (qn = ae());
  94313. return _this20;
  94314. }
  94315. (0, _createClass2.default)(Bn, [{
  94316. key: "hasClientKey",
  94317. value: function () {
  94318. var _hasClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57() {
  94319. return _regenerator.default.wrap(function _callee57$(_context57) {
  94320. while (1) {
  94321. switch (_context57.prev = _context57.next) {
  94322. case 0:
  94323. _context57.next = 2;
  94324. return this.appUtils.hasClientKey({
  94325. provider: this.provider,
  94326. spaceId: this.spaceId
  94327. });
  94328. case 2:
  94329. this._hasClientKey = _context57.sent;
  94330. return _context57.abrupt("return", this._hasClientKey);
  94331. case 4:
  94332. case "end":
  94333. return _context57.stop();
  94334. }
  94335. }
  94336. }, _callee57, this);
  94337. }));
  94338. function hasClientKey() {
  94339. return _hasClientKey.apply(this, arguments);
  94340. }
  94341. return hasClientKey;
  94342. }()
  94343. }, {
  94344. key: "getAppClientKey",
  94345. value: function () {
  94346. var _getAppClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58() {
  94347. var _yield$this$appUtils$, e, t, n, s, r;
  94348. return _regenerator.default.wrap(function _callee58$(_context58) {
  94349. while (1) {
  94350. switch (_context58.prev = _context58.next) {
  94351. case 0:
  94352. _context58.next = 2;
  94353. return this.appUtils.encryptGetClientKeyPayload({
  94354. data: JSON.stringify({})
  94355. });
  94356. case 2:
  94357. _yield$this$appUtils$ = _context58.sent;
  94358. e = _yield$this$appUtils$.data;
  94359. t = _yield$this$appUtils$.key;
  94360. _context58.next = 7;
  94361. return this.uniCloudIns.callFunction({
  94362. name: "DCloud-clientDB",
  94363. data: {
  94364. redirectTo: "encryption",
  94365. action: "getAppClientKey",
  94366. data: e,
  94367. key: t
  94368. }
  94369. });
  94370. case 7:
  94371. _context58.t0 = _context58.sent.result;
  94372. if (_context58.t0) {
  94373. _context58.next = 10;
  94374. break;
  94375. }
  94376. _context58.t0 = {};
  94377. case 10:
  94378. n = _context58.t0;
  94379. if (!(0 !== n.errCode)) {
  94380. _context58.next = 13;
  94381. break;
  94382. }
  94383. throw function (e) {
  94384. return new te({
  94385. subject: e.errSubject || Ln,
  94386. code: e.errCode || e.code || Un.SYSTEM_ERROR.code,
  94387. message: e.errMsg || e.message
  94388. });
  94389. }(n);
  94390. case 13:
  94391. s = n.clientKey, r = n.key;
  94392. _context58.next = 16;
  94393. return this.appUtils.setClientKey({
  94394. provider: this.provider,
  94395. spaceId: this.spaceId,
  94396. clientKey: s,
  94397. key: r
  94398. });
  94399. case 16:
  94400. case "end":
  94401. return _context58.stop();
  94402. }
  94403. }
  94404. }, _callee58, this);
  94405. }));
  94406. function getAppClientKey() {
  94407. return _getAppClientKey.apply(this, arguments);
  94408. }
  94409. return getAppClientKey;
  94410. }()
  94411. }, {
  94412. key: "ensureClientKey",
  94413. value: function () {
  94414. var _ensureClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59() {
  94415. var _this21 = this;
  94416. var _ref37,
  94417. _ref37$forceUpdate,
  94418. e,
  94419. _args59 = arguments;
  94420. return _regenerator.default.wrap(function _callee59$(_context59) {
  94421. while (1) {
  94422. switch (_context59.prev = _context59.next) {
  94423. case 0:
  94424. _ref37 = _args59.length > 0 && _args59[0] !== undefined ? _args59[0] : {}, _ref37$forceUpdate = _ref37.forceUpdate, e = _ref37$forceUpdate === void 0 ? !1 : _ref37$forceUpdate;
  94425. _context59.t1 = !0;
  94426. _context59.next = 4;
  94427. return this.hasClientKey();
  94428. case 4:
  94429. _context59.t2 = _context59.sent;
  94430. _context59.t0 = _context59.t1 !== _context59.t2;
  94431. if (_context59.t0) {
  94432. _context59.next = 8;
  94433. break;
  94434. }
  94435. _context59.t0 = e;
  94436. case 8:
  94437. if (!_context59.t0) {
  94438. _context59.next = 10;
  94439. break;
  94440. }
  94441. return _context59.abrupt("return", (e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus === d || !e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus !== f || (this.scopedGlobalCache.initPromise = this.getAppClientKey(), this.scopedGlobalCache.initPromise.then(function (e) {
  94442. _this21.scopedGlobalCache.initStatus = p;
  94443. }).catch(function (e) {
  94444. throw _this21.scopedGlobalCache.initStatus = f, e;
  94445. }), this.scopedGlobalCache.initStatus = d), this.scopedGlobalCache.initPromise));
  94446. case 10:
  94447. case "end":
  94448. return _context59.stop();
  94449. }
  94450. }
  94451. }, _callee59, this);
  94452. }));
  94453. function ensureClientKey() {
  94454. return _ensureClientKey.apply(this, arguments);
  94455. }
  94456. return ensureClientKey;
  94457. }()
  94458. }, {
  94459. key: "prepare",
  94460. value: function () {
  94461. var _prepare3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
  94462. var _ref38,
  94463. _ref38$forceUpdate,
  94464. e,
  94465. _args60 = arguments;
  94466. return _regenerator.default.wrap(function _callee60$(_context60) {
  94467. while (1) {
  94468. switch (_context60.prev = _context60.next) {
  94469. case 0:
  94470. _ref38 = _args60.length > 0 && _args60[0] !== undefined ? _args60[0] : {}, _ref38$forceUpdate = _ref38.forceUpdate, e = _ref38$forceUpdate === void 0 ? !1 : _ref38$forceUpdate;
  94471. _context60.next = 3;
  94472. return this.ensureClientKey({
  94473. forceUpdate: e
  94474. });
  94475. case 3:
  94476. case "end":
  94477. return _context60.stop();
  94478. }
  94479. }
  94480. }, _callee60, this);
  94481. }));
  94482. function prepare() {
  94483. return _prepare3.apply(this, arguments);
  94484. }
  94485. return prepare;
  94486. }()
  94487. }, {
  94488. key: "platformGetSignOption",
  94489. value: function () {
  94490. var _platformGetSignOption2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61() {
  94491. var _yield$this$appUtils$2, e, t;
  94492. return _regenerator.default.wrap(function _callee61$(_context61) {
  94493. while (1) {
  94494. switch (_context61.prev = _context61.next) {
  94495. case 0:
  94496. _context61.next = 2;
  94497. return this.appUtils.encrypt({
  94498. provider: this.provider,
  94499. spaceId: this.spaceId,
  94500. data: JSON.stringify({})
  94501. });
  94502. case 2:
  94503. _yield$this$appUtils$2 = _context61.sent;
  94504. e = _yield$this$appUtils$2.data;
  94505. t = _yield$this$appUtils$2.key;
  94506. return _context61.abrupt("return", {
  94507. verifyClientSign: e,
  94508. encryptKeyId: t
  94509. });
  94510. case 6:
  94511. case "end":
  94512. return _context61.stop();
  94513. }
  94514. }
  94515. }, _callee61, this);
  94516. }));
  94517. function platformGetSignOption() {
  94518. return _platformGetSignOption2.apply(this, arguments);
  94519. }
  94520. return platformGetSignOption;
  94521. }()
  94522. }, {
  94523. key: "platformEncryptData",
  94524. value: function () {
  94525. var _platformEncryptData2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62(e) {
  94526. var _yield$this$appUtils$3, t, n, s;
  94527. return _regenerator.default.wrap(function _callee62$(_context62) {
  94528. while (1) {
  94529. switch (_context62.prev = _context62.next) {
  94530. case 0:
  94531. _context62.next = 2;
  94532. return this.appUtils.encrypt({
  94533. provider: this.provider,
  94534. spaceId: this.spaceId,
  94535. data: JSON.stringify(e)
  94536. });
  94537. case 2:
  94538. _yield$this$appUtils$3 = _context62.sent;
  94539. t = _yield$this$appUtils$3.data;
  94540. n = _yield$this$appUtils$3.key;
  94541. s = {
  94542. secretType: this.secretType,
  94543. encryptKeyId: n
  94544. };
  94545. return _context62.abrupt("return", this.secretType === Gt.RESPONSE ? {
  94546. content: e,
  94547. _uniCloudOptions: s
  94548. } : {
  94549. content: t,
  94550. _uniCloudOptions: s
  94551. });
  94552. case 7:
  94553. case "end":
  94554. return _context62.stop();
  94555. }
  94556. }
  94557. }, _callee62, this);
  94558. }));
  94559. function platformEncryptData(_x50) {
  94560. return _platformEncryptData2.apply(this, arguments);
  94561. }
  94562. return platformEncryptData;
  94563. }()
  94564. }, {
  94565. key: "platformDecryptResult",
  94566. value: function () {
  94567. var _platformDecryptResult2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63(e) {
  94568. var t, _e$_uniCloudOptions, n, s, r;
  94569. return _regenerator.default.wrap(function _callee63$(_context63) {
  94570. while (1) {
  94571. switch (_context63.prev = _context63.next) {
  94572. case 0:
  94573. t = e.content;
  94574. _e$_uniCloudOptions = e._uniCloudOptions;
  94575. n = _e$_uniCloudOptions === void 0 ? {} : _e$_uniCloudOptions;
  94576. s = n.encryptKeyId;
  94577. _context63.next = 6;
  94578. return this.appUtils.decrypt({
  94579. provider: this.provider,
  94580. spaceId: this.spaceId,
  94581. data: t,
  94582. key: s
  94583. });
  94584. case 6:
  94585. r = _context63.sent;
  94586. return _context63.abrupt("return", JSON.parse(r.data));
  94587. case 8:
  94588. case "end":
  94589. return _context63.stop();
  94590. }
  94591. }
  94592. }, _callee63, this);
  94593. }));
  94594. function platformDecryptResult(_x51) {
  94595. return _platformDecryptResult2.apply(this, arguments);
  94596. }
  94597. return platformDecryptResult;
  94598. }()
  94599. }, {
  94600. key: "isClientKeyNotFound",
  94601. value: function isClientKeyNotFound() {
  94602. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  94603. var t = e.result || {};
  94604. return 70009 === t.errCode && t.errSubject === Ln;
  94605. }
  94606. }]);
  94607. return Bn;
  94608. }(Xt);
  94609. function Wn() {
  94610. var _ref39 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  94611. e = _ref39.secretType;
  94612. return e === Gt.REQUEST || e === Gt.RESPONSE || e === Gt.BOTH;
  94613. }
  94614. function Hn() {
  94615. var _ref40 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  94616. e = _ref40.name,
  94617. _ref40$data = _ref40.data,
  94618. t = _ref40$data === void 0 ? {} : _ref40$data;
  94619. return "app" === C && "DCloud-clientDB" === e && "encryption" === t.redirectTo && "getAppClientKey" === t.action;
  94620. }
  94621. function Jn() {
  94622. var _ref41 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  94623. e = _ref41.provider,
  94624. t = _ref41.spaceId,
  94625. n = _ref41.functionName;
  94626. var _ae = ae(),
  94627. s = _ae.appId,
  94628. r = _ae.uniPlatform,
  94629. i = _ae.osName;
  94630. var o = r;
  94631. "app" === r && (o = i);
  94632. var a = function () {
  94633. var _ref42 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  94634. e = _ref42.provider,
  94635. t = _ref42.spaceId;
  94636. var n = P;
  94637. if (!n) return {};
  94638. e = function (e) {
  94639. return "tencent" === e ? "tcb" : e;
  94640. }(e);
  94641. var s = n.find(function (n) {
  94642. return n.provider === e && n.spaceId === t;
  94643. });
  94644. return s && s.config;
  94645. }({
  94646. provider: e,
  94647. spaceId: t
  94648. });
  94649. if (!a || !a.accessControl || !a.accessControl.enable) return !1;
  94650. var c = a.accessControl.function || {},
  94651. u = Object.keys(c);
  94652. if (0 === u.length) return !0;
  94653. var h = function (e, t) {
  94654. var n, s, r;
  94655. for (var _i2 = 0; _i2 < e.length; _i2++) {
  94656. var _o2 = e[_i2];
  94657. _o2 !== t ? "*" !== _o2 ? _o2.split(",").map(function (e) {
  94658. return e.trim();
  94659. }).indexOf(t) > -1 && (s = _o2) : r = _o2 : n = _o2;
  94660. }
  94661. return n || s || r;
  94662. }(u, n);
  94663. if (!h) return !1;
  94664. if ((c[h] || []).find(function () {
  94665. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  94666. return e.appId === s && (e.platform || "").toLowerCase() === o.toLowerCase();
  94667. })) return !0;
  94668. throw console.error("\u6B64\u5E94\u7528[appId: ".concat(s, ", platform: ").concat(o, "]\u4E0D\u5728\u4E91\u7AEF\u914D\u7F6E\u7684\u5141\u8BB8\u8BBF\u95EE\u7684\u5E94\u7528\u5217\u8868\u5185\uFF0C\u53C2\u8003\uFF1Ahttps://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client")), Mn(Un.APP_INFO_INVALID);
  94669. }
  94670. function zn(_ref43) {
  94671. var e = _ref43.functionName,
  94672. t = _ref43.result,
  94673. n = _ref43.logPvd;
  94674. if (b && this.__dev__.debugLog && t && t.requestId) {
  94675. var _s15 = JSON.stringify({
  94676. spaceId: this.config.spaceId,
  94677. functionName: e,
  94678. requestId: t.requestId
  94679. });
  94680. console.log("[".concat(n, "-request]").concat(_s15, "[/").concat(n, "-request]"));
  94681. }
  94682. }
  94683. function Vn(e) {
  94684. var t = e.callFunction,
  94685. n = function n(_n12) {
  94686. var _this22 = this;
  94687. var s = _n12.name;
  94688. _n12.data = Bt.call(e, {
  94689. data: _n12.data
  94690. });
  94691. var r = {
  94692. aliyun: "aliyun",
  94693. tencent: "tcb",
  94694. tcb: "tcb",
  94695. alipay: "alipay",
  94696. dcloud: "dcloud"
  94697. }[this.config.provider],
  94698. i = Wn(_n12),
  94699. o = Hn(_n12),
  94700. a = i || o;
  94701. return t.call(this, _n12).then(function (e) {
  94702. return e.errCode = 0, !a && zn.call(_this22, {
  94703. functionName: s,
  94704. result: e,
  94705. logPvd: r
  94706. }), Promise.resolve(e);
  94707. }, function (e) {
  94708. return !a && zn.call(_this22, {
  94709. functionName: s,
  94710. result: e,
  94711. logPvd: r
  94712. }), e && e.message && (e.message = function () {
  94713. var _ref44 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  94714. _ref44$message = _ref44.message,
  94715. e = _ref44$message === void 0 ? "" : _ref44$message,
  94716. _ref44$extraInfo = _ref44.extraInfo,
  94717. t = _ref44$extraInfo === void 0 ? {} : _ref44$extraInfo,
  94718. _ref44$formatter = _ref44.formatter,
  94719. n = _ref44$formatter === void 0 ? [] : _ref44$formatter;
  94720. for (var _s16 = 0; _s16 < n.length; _s16++) {
  94721. var _n$_s = n[_s16],
  94722. _r6 = _n$_s.rule,
  94723. _i3 = _n$_s.content,
  94724. _o3 = _n$_s.mode,
  94725. _a2 = e.match(_r6);
  94726. if (!_a2) continue;
  94727. var _c2 = _i3;
  94728. for (var _e20 = 1; _e20 < _a2.length; _e20++) {
  94729. _c2 = Vt(_c2, "{$".concat(_e20, "}"), _a2[_e20]);
  94730. }
  94731. for (var _e21 in t) {
  94732. _c2 = Vt(_c2, "{".concat(_e21, "}"), t[_e21]);
  94733. }
  94734. return "replace" === _o3 ? _c2 : e + _c2;
  94735. }
  94736. return e;
  94737. }({
  94738. message: "[".concat(_n12.name, "]: ").concat(e.message),
  94739. formatter: Ht,
  94740. extraInfo: {
  94741. functionName: s
  94742. }
  94743. })), Promise.reject(e);
  94744. });
  94745. };
  94746. e.callFunction = function (t) {
  94747. var _e$config = e.config,
  94748. s = _e$config.provider,
  94749. r = _e$config.spaceId,
  94750. i = t.name;
  94751. var o, a;
  94752. if (t.data = t.data || {}, b && e.__dev__.debugInfo && !e.__dev__.debugInfo.forceRemote && O ? (e._callCloudFunction || (e._callCloudFunction = n, e._callLocalFunction = Wt), o = Wt) : o = n, o = o.bind(e), Hn(t)) a = n.call(e, t);else if (function (_ref45) {
  94753. var e = _ref45.name,
  94754. _ref45$data = _ref45.data,
  94755. t = _ref45$data === void 0 ? {} : _ref45$data;
  94756. return "mp-weixin" === C && "uni-id-co" === e && "secureNetworkHandshakeByWeixin" === t.method;
  94757. }(t)) a = o.call(e, t);else if (Wn(t)) {
  94758. a = new Fn({
  94759. secretType: t.secretType,
  94760. uniCloudIns: e
  94761. }).wrapEncryptDataCallFunction(n.bind(e))(t);
  94762. } else if (Jn({
  94763. provider: s,
  94764. spaceId: r,
  94765. functionName: i
  94766. })) {
  94767. a = new Fn({
  94768. secretType: t.secretType,
  94769. uniCloudIns: e
  94770. }).wrapVerifyClientCallFunction(n.bind(e))(t);
  94771. } else a = o(t);
  94772. return Object.defineProperty(a, "result", {
  94773. get: function get() {
  94774. return console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {};
  94775. }
  94776. }), a.then(function (e) {
  94777. return "undefined" != typeof UTSJSONObject && (e.result = new UTSJSONObject(e.result)), e;
  94778. });
  94779. };
  94780. }
  94781. Fn = "mp-weixin" !== C && "app" !== C ? /*#__PURE__*/function () {
  94782. function _class2() {
  94783. (0, _classCallCheck2.default)(this, _class2);
  94784. throw Mn({
  94785. message: "Platform ".concat(C, " is not supported by secure network")
  94786. });
  94787. }
  94788. return (0, _createClass2.default)(_class2);
  94789. }() : k ? "mp-weixin" === C ? jn : Bn : /*#__PURE__*/function () {
  94790. function _class3() {
  94791. (0, _classCallCheck2.default)(this, _class3);
  94792. throw Mn({
  94793. message: "Platform ".concat(C, " is not enabled, please check whether secure network module is enabled in your manifest.json")
  94794. });
  94795. }
  94796. return (0, _createClass2.default)(_class3);
  94797. }();
  94798. var Gn = Symbol("CLIENT_DB_INTERNAL");
  94799. function Yn(e, t) {
  94800. return e.then = "DoNotReturnProxyWithAFunctionNamedThen", e._internalType = Gn, e.inspect = null, e.__ob__ = void 0, new Proxy(e, {
  94801. get: function get(e, n, s) {
  94802. if ("_uniClient" === n) return null;
  94803. if ("symbol" == (0, _typeof2.default)(n)) return e[n];
  94804. if (n in e || "string" != typeof n) {
  94805. var _t12 = e[n];
  94806. return "function" == typeof _t12 ? _t12.bind(e) : _t12;
  94807. }
  94808. return t.get(e, n, s);
  94809. }
  94810. });
  94811. }
  94812. function Qn(e) {
  94813. return {
  94814. on: function on(t, n) {
  94815. e[t] = e[t] || [], e[t].indexOf(n) > -1 || e[t].push(n);
  94816. },
  94817. off: function off(t, n) {
  94818. e[t] = e[t] || [];
  94819. var s = e[t].indexOf(n);
  94820. -1 !== s && e[t].splice(s, 1);
  94821. }
  94822. };
  94823. }
  94824. var Xn = ["db.Geo", "db.command", "command.aggregate"];
  94825. function Zn(e, t) {
  94826. return Xn.indexOf("".concat(e, ".").concat(t)) > -1;
  94827. }
  94828. function es(e) {
  94829. switch (g(e)) {
  94830. case "array":
  94831. return e.map(function (e) {
  94832. return es(e);
  94833. });
  94834. case "object":
  94835. return e._internalType === Gn || Object.keys(e).forEach(function (t) {
  94836. e[t] = es(e[t]);
  94837. }), e;
  94838. case "regexp":
  94839. return {
  94840. $regexp: {
  94841. source: e.source,
  94842. flags: e.flags
  94843. }
  94844. };
  94845. case "date":
  94846. return {
  94847. $date: e.toISOString()
  94848. };
  94849. default:
  94850. return e;
  94851. }
  94852. }
  94853. function ts(e) {
  94854. return e && e.content && e.content.$method;
  94855. }
  94856. var ns = /*#__PURE__*/function () {
  94857. function ns(e, t, n) {
  94858. (0, _classCallCheck2.default)(this, ns);
  94859. this.content = e, this.prevStage = t || null, this.udb = null, this._database = n;
  94860. }
  94861. (0, _createClass2.default)(ns, [{
  94862. key: "toJSON",
  94863. value: function toJSON() {
  94864. var e = this;
  94865. var t = [e.content];
  94866. for (; e.prevStage;) {
  94867. e = e.prevStage, t.push(e.content);
  94868. }
  94869. return {
  94870. $db: t.reverse().map(function (e) {
  94871. return {
  94872. $method: e.$method,
  94873. $param: es(e.$param)
  94874. };
  94875. })
  94876. };
  94877. }
  94878. }, {
  94879. key: "toString",
  94880. value: function toString() {
  94881. return JSON.stringify(this.toJSON());
  94882. }
  94883. }, {
  94884. key: "getAction",
  94885. value: function getAction() {
  94886. var e = this.toJSON().$db.find(function (e) {
  94887. return "action" === e.$method;
  94888. });
  94889. return e && e.$param && e.$param[0];
  94890. }
  94891. }, {
  94892. key: "getCommand",
  94893. value: function getCommand() {
  94894. return {
  94895. $db: this.toJSON().$db.filter(function (e) {
  94896. return "action" !== e.$method;
  94897. })
  94898. };
  94899. }
  94900. }, {
  94901. key: "isAggregate",
  94902. get: function get() {
  94903. var e = this;
  94904. for (; e;) {
  94905. var t = ts(e),
  94906. _n13 = ts(e.prevStage);
  94907. if ("aggregate" === t && "collection" === _n13 || "pipeline" === t) return !0;
  94908. e = e.prevStage;
  94909. }
  94910. return !1;
  94911. }
  94912. }, {
  94913. key: "isCommand",
  94914. get: function get() {
  94915. var e = this;
  94916. for (; e;) {
  94917. if ("command" === ts(e)) return !0;
  94918. e = e.prevStage;
  94919. }
  94920. return !1;
  94921. }
  94922. }, {
  94923. key: "isAggregateCommand",
  94924. get: function get() {
  94925. var e = this;
  94926. for (; e;) {
  94927. var t = ts(e),
  94928. _n14 = ts(e.prevStage);
  94929. if ("aggregate" === t && "command" === _n14) return !0;
  94930. e = e.prevStage;
  94931. }
  94932. return !1;
  94933. }
  94934. }, {
  94935. key: "getNextStageFn",
  94936. value: function getNextStageFn(e) {
  94937. var t = this;
  94938. return function () {
  94939. return ss({
  94940. $method: e,
  94941. $param: es(Array.from(arguments))
  94942. }, t, t._database);
  94943. };
  94944. }
  94945. }, {
  94946. key: "count",
  94947. get: function get() {
  94948. return this.isAggregate ? this.getNextStageFn("count") : function () {
  94949. return this._send("count", Array.from(arguments));
  94950. };
  94951. }
  94952. }, {
  94953. key: "remove",
  94954. get: function get() {
  94955. return this.isCommand ? this.getNextStageFn("remove") : function () {
  94956. return this._send("remove", Array.from(arguments));
  94957. };
  94958. }
  94959. }, {
  94960. key: "get",
  94961. value: function get() {
  94962. return this._send("get", Array.from(arguments));
  94963. }
  94964. }, {
  94965. key: "add",
  94966. get: function get() {
  94967. return this.isCommand ? this.getNextStageFn("add") : function () {
  94968. return this._send("add", Array.from(arguments));
  94969. };
  94970. }
  94971. }, {
  94972. key: "update",
  94973. value: function update() {
  94974. return this._send("update", Array.from(arguments));
  94975. }
  94976. }, {
  94977. key: "end",
  94978. value: function end() {
  94979. return this._send("end", Array.from(arguments));
  94980. }
  94981. }, {
  94982. key: "set",
  94983. get: function get() {
  94984. return this.isCommand ? this.getNextStageFn("set") : function () {
  94985. throw new Error("JQL禁止使用set方法");
  94986. };
  94987. }
  94988. }, {
  94989. key: "_send",
  94990. value: function _send(e, t) {
  94991. var n = this.getAction(),
  94992. s = this.getCommand();
  94993. if (s.$db.push({
  94994. $method: e,
  94995. $param: es(t)
  94996. }), b) {
  94997. var _e22 = s.$db.find(function (e) {
  94998. return "collection" === e.$method;
  94999. }),
  95000. _t13 = _e22 && _e22.$param;
  95001. _t13 && 1 === _t13.length && "string" == typeof _e22.$param[0] && _e22.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
  95002. }
  95003. return this._database._callCloudFunction({
  95004. action: n,
  95005. command: s
  95006. });
  95007. }
  95008. }]);
  95009. return ns;
  95010. }();
  95011. function ss(e, t, n) {
  95012. return Yn(new ns(e, t, n), {
  95013. get: function get(e, t) {
  95014. var s = "db";
  95015. return e && e.content && (s = e.content.$method), Zn(s, t) ? ss({
  95016. $method: t
  95017. }, e, n) : function () {
  95018. return ss({
  95019. $method: t,
  95020. $param: es(Array.from(arguments))
  95021. }, e, n);
  95022. };
  95023. }
  95024. });
  95025. }
  95026. function rs(_ref46) {
  95027. var e = _ref46.path,
  95028. t = _ref46.method;
  95029. return /*#__PURE__*/function () {
  95030. function _class4() {
  95031. (0, _classCallCheck2.default)(this, _class4);
  95032. this.param = Array.from(arguments);
  95033. }
  95034. (0, _createClass2.default)(_class4, [{
  95035. key: "toJSON",
  95036. value: function toJSON() {
  95037. return {
  95038. $newDb: [].concat((0, _toConsumableArray2.default)(e.map(function (e) {
  95039. return {
  95040. $method: e
  95041. };
  95042. })), [{
  95043. $method: t,
  95044. $param: this.param
  95045. }])
  95046. };
  95047. }
  95048. }, {
  95049. key: "toString",
  95050. value: function toString() {
  95051. return JSON.stringify(this.toJSON());
  95052. }
  95053. }]);
  95054. return _class4;
  95055. }();
  95056. }
  95057. var is = /*#__PURE__*/function () {
  95058. function is() {
  95059. var _ref47 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  95060. _ref47$uniClient = _ref47.uniClient,
  95061. e = _ref47$uniClient === void 0 ? {} : _ref47$uniClient,
  95062. _ref47$isJQL = _ref47.isJQL,
  95063. t = _ref47$isJQL === void 0 ? !1 : _ref47$isJQL;
  95064. (0, _classCallCheck2.default)(this, is);
  95065. this._uniClient = e, this._authCallBacks = {}, this._dbCallBacks = {}, e._isDefault && (this._dbCallBacks = U("_globalUniCloudDatabaseCallback")), t || (this.auth = Qn(this._authCallBacks)), this._isJQL = t, Object.assign(this, Qn(this._dbCallBacks)), this.env = Yn({}, {
  95066. get: function get(e, t) {
  95067. return {
  95068. $env: t
  95069. };
  95070. }
  95071. }), this.Geo = Yn({}, {
  95072. get: function get(e, t) {
  95073. return rs({
  95074. path: ["Geo"],
  95075. method: t
  95076. });
  95077. }
  95078. }), this.serverDate = rs({
  95079. path: [],
  95080. method: "serverDate"
  95081. }), this.RegExp = rs({
  95082. path: [],
  95083. method: "RegExp"
  95084. });
  95085. }
  95086. (0, _createClass2.default)(is, [{
  95087. key: "getCloudEnv",
  95088. value: function getCloudEnv(e) {
  95089. if ("string" != typeof e || !e.trim()) throw new Error("getCloudEnv参数错误");
  95090. return {
  95091. $env: e.replace("$cloudEnv_", "")
  95092. };
  95093. }
  95094. }, {
  95095. key: "_callback",
  95096. value: function _callback(e, t) {
  95097. var n = this._dbCallBacks;
  95098. n[e] && n[e].forEach(function (e) {
  95099. e.apply(void 0, (0, _toConsumableArray2.default)(t));
  95100. });
  95101. }
  95102. }, {
  95103. key: "_callbackAuth",
  95104. value: function _callbackAuth(e, t) {
  95105. var n = this._authCallBacks;
  95106. n[e] && n[e].forEach(function (e) {
  95107. e.apply(void 0, (0, _toConsumableArray2.default)(t));
  95108. });
  95109. }
  95110. }, {
  95111. key: "multiSend",
  95112. value: function multiSend() {
  95113. var e = Array.from(arguments),
  95114. t = e.map(function (e) {
  95115. var t = e.getAction(),
  95116. n = e.getCommand();
  95117. if ("getTemp" !== n.$db[n.$db.length - 1].$method) throw new Error("multiSend只支持子命令内使用getTemp");
  95118. return {
  95119. action: t,
  95120. command: n
  95121. };
  95122. });
  95123. return this._callCloudFunction({
  95124. multiCommand: t,
  95125. queryList: e
  95126. });
  95127. }
  95128. }]);
  95129. return is;
  95130. }();
  95131. function os(e) {
  95132. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  95133. return Yn(new e(t), {
  95134. get: function get(e, t) {
  95135. return Zn("db", t) ? ss({
  95136. $method: t
  95137. }, null, e) : function () {
  95138. return ss({
  95139. $method: t,
  95140. $param: es(Array.from(arguments))
  95141. }, null, e);
  95142. };
  95143. }
  95144. });
  95145. }
  95146. var as = /*#__PURE__*/function (_is) {
  95147. (0, _inherits2.default)(as, _is);
  95148. var _super10 = _createSuper(as);
  95149. function as() {
  95150. (0, _classCallCheck2.default)(this, as);
  95151. return _super10.apply(this, arguments);
  95152. }
  95153. (0, _createClass2.default)(as, [{
  95154. key: "_parseResult",
  95155. value: function _parseResult(e) {
  95156. return this._isJQL ? e.result : e;
  95157. }
  95158. }, {
  95159. key: "_callCloudFunction",
  95160. value: function _callCloudFunction(_ref48) {
  95161. var _this23 = this;
  95162. var e = _ref48.action,
  95163. t = _ref48.command,
  95164. n = _ref48.multiCommand,
  95165. s = _ref48.queryList;
  95166. function r(e, t) {
  95167. if (n && s) for (var _n15 = 0; _n15 < s.length; _n15++) {
  95168. var _r7 = s[_n15];
  95169. _r7.udb && "function" == typeof _r7.udb.setResult && (t ? _r7.udb.setResult(t) : _r7.udb.setResult(e.result.dataList[_n15]));
  95170. }
  95171. }
  95172. var i = this,
  95173. o = this._isJQL ? "databaseForJQL" : "database";
  95174. function a(e) {
  95175. return i._callback("error", [e]), j($(o, "fail"), e).then(function () {
  95176. return j($(o, "complete"), e);
  95177. }).then(function () {
  95178. return r(null, e), Y(H.RESPONSE, {
  95179. type: J.CLIENT_DB,
  95180. content: e
  95181. }), Promise.reject(e);
  95182. });
  95183. }
  95184. var c = j($(o, "invoke")),
  95185. u = this._uniClient;
  95186. return c.then(function () {
  95187. return u.callFunction({
  95188. name: "DCloud-clientDB",
  95189. type: l.CLIENT_DB,
  95190. data: {
  95191. action: e,
  95192. command: t,
  95193. multiCommand: n
  95194. }
  95195. });
  95196. }).then(function (e) {
  95197. var _e$result = e.result,
  95198. t = _e$result.code,
  95199. n = _e$result.message,
  95200. s = _e$result.token,
  95201. c = _e$result.tokenExpired,
  95202. _e$result$systemInfo = _e$result.systemInfo,
  95203. u = _e$result$systemInfo === void 0 ? [] : _e$result$systemInfo;
  95204. if (u) for (var _e23 = 0; _e23 < u.length; _e23++) {
  95205. var _u$_e = u[_e23],
  95206. _t14 = _u$_e.level,
  95207. _n16 = _u$_e.message,
  95208. _s17 = _u$_e.detail;
  95209. var _r8 = "[System Info]" + _n16;
  95210. _s17 && (_r8 = "".concat(_r8, "\n\u8BE6\u7EC6\u4FE1\u606F\uFF1A").concat(_s17)), (console["app" === C && "warn" === _t14 ? "error" : _t14] || console.log)(_r8);
  95211. }
  95212. if (t) {
  95213. return a(new te({
  95214. code: t,
  95215. message: n,
  95216. requestId: e.requestId
  95217. }));
  95218. }
  95219. e.result.errCode = e.result.errCode || e.result.code, e.result.errMsg = e.result.errMsg || e.result.message, s && c && (re({
  95220. token: s,
  95221. tokenExpired: c
  95222. }), _this23._callbackAuth("refreshToken", [{
  95223. token: s,
  95224. tokenExpired: c
  95225. }]), _this23._callback("refreshToken", [{
  95226. token: s,
  95227. tokenExpired: c
  95228. }]), Y(H.REFRESH_TOKEN, {
  95229. token: s,
  95230. tokenExpired: c
  95231. }));
  95232. var h = [{
  95233. prop: "affectedDocs",
  95234. tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"
  95235. }, {
  95236. prop: "code",
  95237. tips: "code不再推荐使用,请使用errCode替代"
  95238. }, {
  95239. prop: "message",
  95240. tips: "message不再推荐使用,请使用errMsg替代"
  95241. }];
  95242. var _loop2 = function _loop2(_t15) {
  95243. var _h$_t = h[_t15],
  95244. n = _h$_t.prop,
  95245. s = _h$_t.tips;
  95246. if (n in e.result) {
  95247. var _t16 = e.result[n];
  95248. Object.defineProperty(e.result, n, {
  95249. get: function get() {
  95250. return console.warn(s), _t16;
  95251. }
  95252. });
  95253. }
  95254. };
  95255. for (var _t15 = 0; _t15 < h.length; _t15++) {
  95256. _loop2(_t15);
  95257. }
  95258. return function (e) {
  95259. return j($(o, "success"), e).then(function () {
  95260. return j($(o, "complete"), e);
  95261. }).then(function () {
  95262. r(e, null);
  95263. var t = i._parseResult(e);
  95264. return Y(H.RESPONSE, {
  95265. type: J.CLIENT_DB,
  95266. content: t
  95267. }), Promise.resolve(t);
  95268. });
  95269. }(e);
  95270. }, function (e) {
  95271. /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
  95272. return a(new te({
  95273. code: e.code || "SYSTEM_ERROR",
  95274. message: e.message,
  95275. requestId: e.requestId
  95276. }));
  95277. });
  95278. }
  95279. }]);
  95280. return as;
  95281. }(is);
  95282. var cs = "token无效,跳转登录页面",
  95283. us = "token过期,跳转登录页面",
  95284. hs = {
  95285. TOKEN_INVALID_TOKEN_EXPIRED: us,
  95286. TOKEN_INVALID_INVALID_CLIENTID: cs,
  95287. TOKEN_INVALID: cs,
  95288. TOKEN_INVALID_WRONG_TOKEN: cs,
  95289. TOKEN_INVALID_ANONYMOUS_USER: cs
  95290. },
  95291. ls = {
  95292. "uni-id-token-expired": us,
  95293. "uni-id-check-token-failed": cs,
  95294. "uni-id-token-not-exist": cs,
  95295. "uni-id-check-device-feature-failed": cs
  95296. };
  95297. function ds(e, t) {
  95298. var n = "";
  95299. return n = e ? "".concat(e, "/").concat(t) : t, n.replace(/^\//, "");
  95300. }
  95301. function ps() {
  95302. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  95303. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  95304. var n = [],
  95305. s = [];
  95306. return e.forEach(function (e) {
  95307. !0 === e.needLogin ? n.push(ds(t, e.path)) : !1 === e.needLogin && s.push(ds(t, e.path));
  95308. }), {
  95309. needLoginPage: n,
  95310. notNeedLoginPage: s
  95311. };
  95312. }
  95313. function fs(e) {
  95314. return e.split("?")[0].replace(/^\//, "");
  95315. }
  95316. function gs() {
  95317. return function (e) {
  95318. var t = e && e.$page && e.$page.fullPath || "";
  95319. return t ? ("/" !== t.charAt(0) && (t = "/" + t), t) : t;
  95320. }(function () {
  95321. var e = getCurrentPages();
  95322. return e[e.length - 1];
  95323. }());
  95324. }
  95325. function ms() {
  95326. return fs(gs());
  95327. }
  95328. function ys() {
  95329. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  95330. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  95331. if (!e) return !1;
  95332. if (!(t && t.list && t.list.length)) return !1;
  95333. var n = t.list,
  95334. s = fs(e);
  95335. return n.some(function (e) {
  95336. return e.pagePath === s;
  95337. });
  95338. }
  95339. var _s = !!_pages.default.uniIdRouter;
  95340. var _ref49 = function () {
  95341. var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _pages.default,
  95342. _ref8$pages = _ref8.pages,
  95343. t = _ref8$pages === void 0 ? [] : _ref8$pages,
  95344. _ref8$subPackages = _ref8.subPackages,
  95345. n = _ref8$subPackages === void 0 ? [] : _ref8$subPackages,
  95346. _ref8$uniIdRouter = _ref8.uniIdRouter,
  95347. s = _ref8$uniIdRouter === void 0 ? {} : _ref8$uniIdRouter,
  95348. _ref8$tabBar = _ref8.tabBar,
  95349. r = _ref8$tabBar === void 0 ? {} : _ref8$tabBar;
  95350. var i = s.loginPage,
  95351. _s$needLogin = s.needLogin,
  95352. o = _s$needLogin === void 0 ? [] : _s$needLogin,
  95353. _s$resToLogin = s.resToLogin,
  95354. a = _s$resToLogin === void 0 ? !0 : _s$resToLogin,
  95355. _ps = ps(t),
  95356. c = _ps.needLoginPage,
  95357. u = _ps.notNeedLoginPage,
  95358. _ref9 = function () {
  95359. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  95360. var t = [],
  95361. n = [];
  95362. return e.forEach(function (e) {
  95363. var s = e.root,
  95364. _e$pages = e.pages,
  95365. r = _e$pages === void 0 ? [] : _e$pages,
  95366. _ps2 = ps(r, s),
  95367. i = _ps2.needLoginPage,
  95368. o = _ps2.notNeedLoginPage;
  95369. t.push.apply(t, (0, _toConsumableArray2.default)(i)), n.push.apply(n, (0, _toConsumableArray2.default)(o));
  95370. }), {
  95371. needLoginPage: t,
  95372. notNeedLoginPage: n
  95373. };
  95374. }(n),
  95375. h = _ref9.needLoginPage,
  95376. l = _ref9.notNeedLoginPage;
  95377. return {
  95378. loginPage: i,
  95379. routerNeedLogin: o,
  95380. resToLogin: a,
  95381. needLoginPage: [].concat((0, _toConsumableArray2.default)(c), (0, _toConsumableArray2.default)(h)),
  95382. notNeedLoginPage: [].concat((0, _toConsumableArray2.default)(u), (0, _toConsumableArray2.default)(l)),
  95383. loginPageInTabBar: ys(i, r)
  95384. };
  95385. }(),
  95386. ws = _ref49.loginPage,
  95387. vs = _ref49.routerNeedLogin,
  95388. Is = _ref49.resToLogin,
  95389. Ss = _ref49.needLoginPage,
  95390. Ts = _ref49.notNeedLoginPage,
  95391. bs = _ref49.loginPageInTabBar;
  95392. if (Ss.indexOf(ws) > -1) throw new Error("Login page [".concat(ws, "] should not be \"needLogin\", please check your pages.json"));
  95393. function Es(e) {
  95394. var t = ms();
  95395. if ("/" === e.charAt(0)) return e;
  95396. var _e$split = e.split("?"),
  95397. _e$split2 = (0, _slicedToArray2.default)(_e$split, 2),
  95398. n = _e$split2[0],
  95399. s = _e$split2[1],
  95400. r = n.replace(/^\//, "").split("/"),
  95401. i = t.split("/");
  95402. i.pop();
  95403. for (var _e24 = 0; _e24 < r.length; _e24++) {
  95404. var _t17 = r[_e24];
  95405. ".." === _t17 ? i.pop() : "." !== _t17 && i.push(_t17);
  95406. }
  95407. return "" === i[0] && i.shift(), "/" + i.join("/") + (s ? "?" + s : "");
  95408. }
  95409. function ks(e) {
  95410. var t = fs(Es(e));
  95411. return !(Ts.indexOf(t) > -1) && (Ss.indexOf(t) > -1 || vs.some(function (t) {
  95412. return function (e, t) {
  95413. return new RegExp(t).test(e);
  95414. }(e, t);
  95415. }));
  95416. }
  95417. function Ps(_ref31) {
  95418. var e = _ref31.redirect;
  95419. var t = fs(e),
  95420. n = fs(ws);
  95421. return ms() !== n && t !== n;
  95422. }
  95423. function Cs() {
  95424. var _ref33 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  95425. e = _ref33.api,
  95426. t = _ref33.redirect;
  95427. if (!t || !Ps({
  95428. redirect: t
  95429. })) return;
  95430. var n = function (e, t) {
  95431. return "/" !== e.charAt(0) && (e = "/" + e), t ? e.indexOf("?") > -1 ? e + "&uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e + "?uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e;
  95432. }(ws, t);
  95433. bs ? "navigateTo" !== e && "redirectTo" !== e || (e = "switchTab") : "switchTab" === e && (e = "navigateTo");
  95434. var s = {
  95435. navigateTo: uni.navigateTo,
  95436. redirectTo: uni.redirectTo,
  95437. switchTab: uni.switchTab,
  95438. reLaunch: uni.reLaunch
  95439. };
  95440. setTimeout(function () {
  95441. s[e]({
  95442. url: n
  95443. });
  95444. }, 0);
  95445. }
  95446. function As() {
  95447. var _ref50 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  95448. e = _ref50.url;
  95449. var t = {
  95450. abortLoginPageJump: !1,
  95451. autoToLoginPage: !1
  95452. },
  95453. n = function () {
  95454. var _se4 = se(),
  95455. e = _se4.token,
  95456. t = _se4.tokenExpired;
  95457. var n;
  95458. if (e) {
  95459. if (t < Date.now()) {
  95460. var _e25 = "uni-id-token-expired";
  95461. n = {
  95462. errCode: _e25,
  95463. errMsg: ls[_e25]
  95464. };
  95465. }
  95466. } else {
  95467. var _e26 = "uni-id-check-token-failed";
  95468. n = {
  95469. errCode: _e26,
  95470. errMsg: ls[_e26]
  95471. };
  95472. }
  95473. return n;
  95474. }();
  95475. if (ks(e) && n) {
  95476. n.uniIdRedirectUrl = e;
  95477. if (z(H.NEED_LOGIN).length > 0) return setTimeout(function () {
  95478. Y(H.NEED_LOGIN, n);
  95479. }, 0), t.abortLoginPageJump = !0, t;
  95480. t.autoToLoginPage = !0;
  95481. }
  95482. return t;
  95483. }
  95484. function Os() {
  95485. !function () {
  95486. var e = gs(),
  95487. _As = As({
  95488. url: e
  95489. }),
  95490. t = _As.abortLoginPageJump,
  95491. n = _As.autoToLoginPage;
  95492. t || n && Cs({
  95493. api: "redirectTo",
  95494. redirect: e
  95495. });
  95496. }();
  95497. var e = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
  95498. var _loop3 = function _loop3(_t18) {
  95499. var n = e[_t18];
  95500. uni.addInterceptor(n, {
  95501. invoke: function invoke(e) {
  95502. var _As2 = As({
  95503. url: e.url
  95504. }),
  95505. t = _As2.abortLoginPageJump,
  95506. s = _As2.autoToLoginPage;
  95507. return t ? e : s ? (Cs({
  95508. api: n,
  95509. redirect: Es(e.url)
  95510. }), !1) : e;
  95511. }
  95512. });
  95513. };
  95514. for (var _t18 = 0; _t18 < e.length; _t18++) {
  95515. _loop3(_t18);
  95516. }
  95517. }
  95518. function xs() {
  95519. this.onResponse(function (e) {
  95520. var t = e.type,
  95521. n = e.content;
  95522. var s = !1;
  95523. switch (t) {
  95524. case "cloudobject":
  95525. s = function (e) {
  95526. if ("object" != (0, _typeof2.default)(e)) return !1;
  95527. var _ref51 = e || {},
  95528. t = _ref51.errCode;
  95529. return t in ls;
  95530. }(n);
  95531. break;
  95532. case "clientdb":
  95533. s = function (e) {
  95534. if ("object" != (0, _typeof2.default)(e)) return !1;
  95535. var _ref52 = e || {},
  95536. t = _ref52.errCode;
  95537. return t in hs;
  95538. }(n);
  95539. }
  95540. s && function () {
  95541. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  95542. var t = z(H.NEED_LOGIN);
  95543. Z().then(function () {
  95544. var n = gs();
  95545. if (n && Ps({
  95546. redirect: n
  95547. })) return t.length > 0 ? Y(H.NEED_LOGIN, Object.assign({
  95548. uniIdRedirectUrl: n
  95549. }, e)) : void (ws && Cs({
  95550. api: "navigateTo",
  95551. redirect: n
  95552. }));
  95553. });
  95554. }(n);
  95555. });
  95556. }
  95557. function Ns(e) {
  95558. !function (e) {
  95559. e.onResponse = function (e) {
  95560. V(H.RESPONSE, e);
  95561. }, e.offResponse = function (e) {
  95562. G(H.RESPONSE, e);
  95563. };
  95564. }(e), function (e) {
  95565. e.onNeedLogin = function (e) {
  95566. V(H.NEED_LOGIN, e);
  95567. }, e.offNeedLogin = function (e) {
  95568. G(H.NEED_LOGIN, e);
  95569. }, _s && (U(Yt).needLoginInit || (U(Yt).needLoginInit = !0, Z().then(function () {
  95570. Os.call(e);
  95571. }), Is && xs.call(e)));
  95572. }(e), function (e) {
  95573. e.onRefreshToken = function (e) {
  95574. V(H.REFRESH_TOKEN, e);
  95575. }, e.offRefreshToken = function (e) {
  95576. G(H.REFRESH_TOKEN, e);
  95577. };
  95578. }(e);
  95579. }
  95580. var Rs;
  95581. var Ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  95582. Us = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  95583. function Ds() {
  95584. var e = se().token || "",
  95585. t = e.split(".");
  95586. if (!e || 3 !== t.length) return {
  95587. uid: null,
  95588. role: [],
  95589. permission: [],
  95590. tokenExpired: 0
  95591. };
  95592. var n;
  95593. try {
  95594. n = JSON.parse((s = t[1], decodeURIComponent(Rs(s).split("").map(function (e) {
  95595. return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
  95596. }).join(""))));
  95597. } catch (e) {
  95598. throw new Error("获取当前用户信息出错,详细错误信息为:" + e.message);
  95599. }
  95600. var s;
  95601. return n.tokenExpired = 1e3 * n.exp, delete n.exp, delete n.iat, n;
  95602. }
  95603. Rs = "function" != typeof atob ? function (e) {
  95604. if (e = String(e).replace(/[\t\n\f\r ]+/g, ""), !Us.test(e)) throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  95605. var t;
  95606. e += "==".slice(2 - (3 & e.length));
  95607. for (var n, s, r = "", i = 0; i < e.length;) {
  95608. t = Ls.indexOf(e.charAt(i++)) << 18 | Ls.indexOf(e.charAt(i++)) << 12 | (n = Ls.indexOf(e.charAt(i++))) << 6 | (s = Ls.indexOf(e.charAt(i++))), r += 64 === n ? String.fromCharCode(t >> 16 & 255) : 64 === s ? String.fromCharCode(t >> 16 & 255, t >> 8 & 255) : String.fromCharCode(t >> 16 & 255, t >> 8 & 255, 255 & t);
  95609. }
  95610. return r;
  95611. } : atob;
  95612. var Ms = n(function (e, t) {
  95613. Object.defineProperty(t, "__esModule", {
  95614. value: !0
  95615. });
  95616. var n = "chooseAndUploadFile:ok",
  95617. s = "chooseAndUploadFile:fail";
  95618. function r(e, t) {
  95619. return e.tempFiles.forEach(function (e, n) {
  95620. e.name || (e.name = e.path.substring(e.path.lastIndexOf("/") + 1)), t && (e.fileType = t), e.cloudPath = Date.now() + "_" + n + e.name.substring(e.name.lastIndexOf("."));
  95621. }), e.tempFilePaths || (e.tempFilePaths = e.tempFiles.map(function (e) {
  95622. return e.path;
  95623. })), e;
  95624. }
  95625. function i(e, t, _ref53) {
  95626. var s = _ref53.onChooseFile,
  95627. r = _ref53.onUploadProgress;
  95628. return t.then(function (e) {
  95629. if (s) {
  95630. var _t19 = s(e);
  95631. if (void 0 !== _t19) return Promise.resolve(_t19).then(function (t) {
  95632. return void 0 === t ? e : t;
  95633. });
  95634. }
  95635. return e;
  95636. }).then(function (t) {
  95637. return !1 === t ? {
  95638. errMsg: n,
  95639. tempFilePaths: [],
  95640. tempFiles: []
  95641. } : function (e, t) {
  95642. var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
  95643. var r = arguments.length > 3 ? arguments[3] : undefined;
  95644. (t = Object.assign({}, t)).errMsg = n;
  95645. var i = t.tempFiles,
  95646. o = i.length;
  95647. var a = 0;
  95648. return new Promise(function (n) {
  95649. for (; a < s;) {
  95650. c();
  95651. }
  95652. function c() {
  95653. var s = a++;
  95654. if (s >= o) return void (!i.find(function (e) {
  95655. return !e.url && !e.errMsg;
  95656. }) && n(t));
  95657. var u = i[s];
  95658. e.uploadFile({
  95659. provider: u.provider,
  95660. filePath: u.path,
  95661. cloudPath: u.cloudPath,
  95662. fileType: u.fileType,
  95663. cloudPathAsRealPath: u.cloudPathAsRealPath,
  95664. onUploadProgress: function onUploadProgress(e) {
  95665. e.index = s, e.tempFile = u, e.tempFilePath = u.path, r && r(e);
  95666. }
  95667. }).then(function (e) {
  95668. u.url = e.fileID, s < o && c();
  95669. }).catch(function (e) {
  95670. u.errMsg = e.errMsg || e.message, s < o && c();
  95671. });
  95672. }
  95673. });
  95674. }(e, t, 5, r);
  95675. });
  95676. }
  95677. t.initChooseAndUploadFile = function (e) {
  95678. return function () {
  95679. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  95680. type: "all"
  95681. };
  95682. return "image" === t.type ? i(e, function (e) {
  95683. var t = e.count,
  95684. n = e.sizeType,
  95685. _e$sourceType = e.sourceType,
  95686. i = _e$sourceType === void 0 ? ["album", "camera"] : _e$sourceType,
  95687. o = e.extension;
  95688. return new Promise(function (e, a) {
  95689. uni.chooseImage({
  95690. count: t,
  95691. sizeType: n,
  95692. sourceType: i,
  95693. extension: o,
  95694. success: function success(t) {
  95695. e(r(t, "image"));
  95696. },
  95697. fail: function fail(e) {
  95698. a({
  95699. errMsg: e.errMsg.replace("chooseImage:fail", s)
  95700. });
  95701. }
  95702. });
  95703. });
  95704. }(t), t) : "video" === t.type ? i(e, function (e) {
  95705. var t = e.camera,
  95706. n = e.compressed,
  95707. i = e.maxDuration,
  95708. _e$sourceType2 = e.sourceType,
  95709. o = _e$sourceType2 === void 0 ? ["album", "camera"] : _e$sourceType2,
  95710. a = e.extension;
  95711. return new Promise(function (e, c) {
  95712. uni.chooseVideo({
  95713. camera: t,
  95714. compressed: n,
  95715. maxDuration: i,
  95716. sourceType: o,
  95717. extension: a,
  95718. success: function success(t) {
  95719. var n = t.tempFilePath,
  95720. s = t.duration,
  95721. i = t.size,
  95722. o = t.height,
  95723. a = t.width;
  95724. e(r({
  95725. errMsg: "chooseVideo:ok",
  95726. tempFilePaths: [n],
  95727. tempFiles: [{
  95728. name: t.tempFile && t.tempFile.name || "",
  95729. path: n,
  95730. size: i,
  95731. type: t.tempFile && t.tempFile.type || "",
  95732. width: a,
  95733. height: o,
  95734. duration: s,
  95735. fileType: "video",
  95736. cloudPath: ""
  95737. }]
  95738. }, "video"));
  95739. },
  95740. fail: function fail(e) {
  95741. c({
  95742. errMsg: e.errMsg.replace("chooseVideo:fail", s)
  95743. });
  95744. }
  95745. });
  95746. });
  95747. }(t), t) : i(e, function (e) {
  95748. var t = e.count,
  95749. n = e.extension;
  95750. return new Promise(function (e, i) {
  95751. var o = uni.chooseFile;
  95752. if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o = wx.chooseMessageFile), "function" != typeof o) return i({
  95753. errMsg: s + " 请指定 type 类型,该平台仅支持选择 image 或 video。"
  95754. });
  95755. o({
  95756. type: "all",
  95757. count: t,
  95758. extension: n,
  95759. success: function success(t) {
  95760. e(r(t));
  95761. },
  95762. fail: function fail(e) {
  95763. i({
  95764. errMsg: e.errMsg.replace("chooseFile:fail", s)
  95765. });
  95766. }
  95767. });
  95768. });
  95769. }(t), t);
  95770. };
  95771. };
  95772. }),
  95773. qs = t(Ms);
  95774. var Fs = {
  95775. auto: "auto",
  95776. onready: "onready",
  95777. manual: "manual"
  95778. };
  95779. function Ks(e) {
  95780. return {
  95781. props: {
  95782. localdata: {
  95783. type: Array,
  95784. default: function _default() {
  95785. return [];
  95786. }
  95787. },
  95788. options: {
  95789. type: [Object, Array],
  95790. default: function _default() {
  95791. return {};
  95792. }
  95793. },
  95794. spaceInfo: {
  95795. type: Object,
  95796. default: function _default() {
  95797. return {};
  95798. }
  95799. },
  95800. collection: {
  95801. type: [String, Array],
  95802. default: ""
  95803. },
  95804. action: {
  95805. type: String,
  95806. default: ""
  95807. },
  95808. field: {
  95809. type: String,
  95810. default: ""
  95811. },
  95812. orderby: {
  95813. type: String,
  95814. default: ""
  95815. },
  95816. where: {
  95817. type: [String, Object],
  95818. default: ""
  95819. },
  95820. pageData: {
  95821. type: String,
  95822. default: "add"
  95823. },
  95824. pageCurrent: {
  95825. type: Number,
  95826. default: 1
  95827. },
  95828. pageSize: {
  95829. type: Number,
  95830. default: 20
  95831. },
  95832. getcount: {
  95833. type: [Boolean, String],
  95834. default: !1
  95835. },
  95836. gettree: {
  95837. type: [Boolean, String],
  95838. default: !1
  95839. },
  95840. gettreepath: {
  95841. type: [Boolean, String],
  95842. default: !1
  95843. },
  95844. startwith: {
  95845. type: String,
  95846. default: ""
  95847. },
  95848. limitlevel: {
  95849. type: Number,
  95850. default: 10
  95851. },
  95852. groupby: {
  95853. type: String,
  95854. default: ""
  95855. },
  95856. groupField: {
  95857. type: String,
  95858. default: ""
  95859. },
  95860. distinct: {
  95861. type: [Boolean, String],
  95862. default: !1
  95863. },
  95864. foreignKey: {
  95865. type: String,
  95866. default: ""
  95867. },
  95868. loadtime: {
  95869. type: String,
  95870. default: "auto"
  95871. },
  95872. manual: {
  95873. type: Boolean,
  95874. default: !1
  95875. }
  95876. },
  95877. data: function data() {
  95878. return {
  95879. mixinDatacomLoading: !1,
  95880. mixinDatacomHasMore: !1,
  95881. mixinDatacomResData: [],
  95882. mixinDatacomErrorMessage: "",
  95883. mixinDatacomPage: {},
  95884. mixinDatacomError: null
  95885. };
  95886. },
  95887. created: function created() {
  95888. var _this24 = this;
  95889. this.mixinDatacomPage = {
  95890. current: this.pageCurrent,
  95891. size: this.pageSize,
  95892. count: 0
  95893. }, this.$watch(function () {
  95894. var e = [];
  95895. return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach(function (t) {
  95896. e.push(_this24[t]);
  95897. }), e;
  95898. }, function (e, t) {
  95899. if (_this24.loadtime === Fs.manual) return;
  95900. var n = !1;
  95901. var s = [];
  95902. for (var _r9 = 2; _r9 < e.length; _r9++) {
  95903. e[_r9] !== t[_r9] && (s.push(e[_r9]), n = !0);
  95904. }
  95905. e[0] !== t[0] && (_this24.mixinDatacomPage.current = _this24.pageCurrent), _this24.mixinDatacomPage.size = _this24.pageSize, _this24.onMixinDatacomPropsChange(n, s);
  95906. });
  95907. },
  95908. methods: {
  95909. onMixinDatacomPropsChange: function onMixinDatacomPropsChange(e, t) {},
  95910. mixinDatacomEasyGet: function mixinDatacomEasyGet() {
  95911. var _this25 = this;
  95912. var _ref54 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  95913. _ref54$getone = _ref54.getone,
  95914. e = _ref54$getone === void 0 ? !1 : _ref54$getone,
  95915. t = _ref54.success,
  95916. n = _ref54.fail;
  95917. this.mixinDatacomLoading || (this.mixinDatacomLoading = !0, this.mixinDatacomErrorMessage = "", this.mixinDatacomError = null, this.mixinDatacomGet().then(function (n) {
  95918. _this25.mixinDatacomLoading = !1;
  95919. var _n$result = n.result,
  95920. s = _n$result.data,
  95921. r = _n$result.count;
  95922. _this25.getcount && (_this25.mixinDatacomPage.count = r), _this25.mixinDatacomHasMore = s.length < _this25.pageSize;
  95923. var i = e ? s.length ? s[0] : void 0 : s;
  95924. _this25.mixinDatacomResData = i, t && t(i);
  95925. }).catch(function (e) {
  95926. _this25.mixinDatacomLoading = !1, _this25.mixinDatacomErrorMessage = e, _this25.mixinDatacomError = e, n && n(e);
  95927. }));
  95928. },
  95929. mixinDatacomGet: function mixinDatacomGet() {
  95930. var _n17;
  95931. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  95932. var n;
  95933. t = t || {}, n = "undefined" != typeof __uniX && __uniX ? e.databaseForJQL(this.spaceInfo) : e.database(this.spaceInfo);
  95934. var s = t.action || this.action;
  95935. s && (n = n.action(s));
  95936. var r = t.collection || this.collection;
  95937. n = Array.isArray(r) ? (_n17 = n).collection.apply(_n17, (0, _toConsumableArray2.default)(r)) : n.collection(r);
  95938. var i = t.where || this.where;
  95939. i && Object.keys(i).length && (n = n.where(i));
  95940. var o = t.field || this.field;
  95941. o && (n = n.field(o));
  95942. var a = t.foreignKey || this.foreignKey;
  95943. a && (n = n.foreignKey(a));
  95944. var c = t.groupby || this.groupby;
  95945. c && (n = n.groupBy(c));
  95946. var u = t.groupField || this.groupField;
  95947. u && (n = n.groupField(u));
  95948. !0 === (void 0 !== t.distinct ? t.distinct : this.distinct) && (n = n.distinct());
  95949. var h = t.orderby || this.orderby;
  95950. h && (n = n.orderBy(h));
  95951. var l = void 0 !== t.pageCurrent ? t.pageCurrent : this.mixinDatacomPage.current,
  95952. d = void 0 !== t.pageSize ? t.pageSize : this.mixinDatacomPage.size,
  95953. p = void 0 !== t.getcount ? t.getcount : this.getcount,
  95954. f = void 0 !== t.gettree ? t.gettree : this.gettree,
  95955. g = void 0 !== t.gettreepath ? t.gettreepath : this.gettreepath,
  95956. m = {
  95957. getCount: p
  95958. },
  95959. y = {
  95960. limitLevel: void 0 !== t.limitlevel ? t.limitlevel : this.limitlevel,
  95961. startWith: void 0 !== t.startwith ? t.startwith : this.startwith
  95962. };
  95963. return f && (m.getTree = y), g && (m.getTreePath = y), n = n.skip(d * (l - 1)).limit(d).get(m), n;
  95964. }
  95965. }
  95966. };
  95967. }
  95968. function js(e) {
  95969. return function (t) {
  95970. var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  95971. n = function (e) {
  95972. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  95973. return e.customUI = t.customUI || e.customUI, e.parseSystemError = t.parseSystemError || e.parseSystemError, Object.assign(e.loadingOptions, t.loadingOptions), Object.assign(e.errorOptions, t.errorOptions), "object" == (0, _typeof2.default)(t.secretMethods) && (e.secretMethods = t.secretMethods), e;
  95974. }({
  95975. customUI: !1,
  95976. loadingOptions: {
  95977. title: "加载中...",
  95978. mask: !0
  95979. },
  95980. errorOptions: {
  95981. type: "modal",
  95982. retry: !1
  95983. }
  95984. }, n);
  95985. var _n18 = n,
  95986. s = _n18.customUI,
  95987. r = _n18.loadingOptions,
  95988. i = _n18.errorOptions,
  95989. o = _n18.parseSystemError,
  95990. a = !s;
  95991. return new Proxy({}, {
  95992. get: function get(s, c) {
  95993. switch (c) {
  95994. case "toString":
  95995. return "[object UniCloudObject]";
  95996. case "toJSON":
  95997. return {};
  95998. }
  95999. return function () {
  96000. var _ref55 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  96001. e = _ref55.fn,
  96002. t = _ref55.interceptorName,
  96003. n = _ref55.getCallbackArgs;
  96004. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64() {
  96005. var _len3,
  96006. s,
  96007. _key3,
  96008. r,
  96009. i,
  96010. o,
  96011. _args = arguments;
  96012. return _regenerator.default.wrap(function _callee64$(_context64) {
  96013. while (1) {
  96014. switch (_context64.prev = _context64.next) {
  96015. case 0:
  96016. for (_len3 = _args.length, s = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  96017. s[_key3] = _args[_key3];
  96018. }
  96019. r = n ? n({
  96020. params: s
  96021. }) : {};
  96022. _context64.prev = 2;
  96023. _context64.next = 5;
  96024. return j($(t, "invoke"), _objectSpread({}, r));
  96025. case 5:
  96026. _context64.next = 7;
  96027. return e.apply(void 0, s);
  96028. case 7:
  96029. i = _context64.sent;
  96030. _context64.next = 10;
  96031. return j($(t, "success"), _objectSpread(_objectSpread({}, r), {}, {
  96032. result: i
  96033. }));
  96034. case 10:
  96035. return _context64.abrupt("return", i);
  96036. case 13:
  96037. _context64.prev = 13;
  96038. _context64.t0 = _context64["catch"](2);
  96039. o = _context64.t0;
  96040. _context64.next = 18;
  96041. return j($(t, "fail"), _objectSpread(_objectSpread({}, r), {}, {
  96042. error: o
  96043. }));
  96044. case 18:
  96045. throw o;
  96046. case 19:
  96047. _context64.prev = 19;
  96048. _context64.next = 22;
  96049. return j($(t, "complete"), o ? _objectSpread(_objectSpread({}, r), {}, {
  96050. error: o
  96051. }) : _objectSpread(_objectSpread({}, r), {}, {
  96052. result: i
  96053. }));
  96054. case 22:
  96055. return _context64.finish(19);
  96056. case 23:
  96057. case "end":
  96058. return _context64.stop();
  96059. }
  96060. }
  96061. }, _callee64, null, [[2, 13, 19, 23]]);
  96062. }));
  96063. }({
  96064. fn: function () {
  96065. var _s18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66() {
  96066. var h,
  96067. _len4,
  96068. u,
  96069. _key4,
  96070. d,
  96071. p,
  96072. _ref57,
  96073. f,
  96074. g,
  96075. m,
  96076. y,
  96077. _e27,
  96078. _yield,
  96079. _t20,
  96080. _n19,
  96081. _args4 = arguments;
  96082. return _regenerator.default.wrap(function _callee66$(_context66) {
  96083. while (1) {
  96084. switch (_context66.prev = _context66.next) {
  96085. case 0:
  96086. a && uni.showLoading({
  96087. title: r.title,
  96088. mask: r.mask
  96089. });
  96090. for (_len4 = _args4.length, u = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  96091. u[_key4] = _args4[_key4];
  96092. }
  96093. d = {
  96094. name: t,
  96095. type: l.OBJECT,
  96096. data: {
  96097. method: c,
  96098. params: u
  96099. }
  96100. };
  96101. "object" == (0, _typeof2.default)(n.secretMethods) && function (e, t) {
  96102. var n = t.data.method,
  96103. s = e.secretMethods || {},
  96104. r = s[n] || s["*"];
  96105. r && (t.secretType = r);
  96106. }(n, d);
  96107. p = !1;
  96108. _context66.prev = 5;
  96109. _context66.next = 8;
  96110. return e.callFunction(d);
  96111. case 8:
  96112. h = _context66.sent;
  96113. _context66.next = 14;
  96114. break;
  96115. case 11:
  96116. _context66.prev = 11;
  96117. _context66.t0 = _context66["catch"](5);
  96118. p = !0, h = {
  96119. result: new te(_context66.t0)
  96120. };
  96121. case 14:
  96122. _ref57 = h.result || {}, f = _ref57.errSubject, g = _ref57.errCode, m = _ref57.errMsg, y = _ref57.newToken;
  96123. if (!(a && uni.hideLoading(), y && y.token && y.tokenExpired && (re(y), Y(H.REFRESH_TOKEN, _objectSpread({}, y))), g)) {
  96124. _context66.next = 39;
  96125. break;
  96126. }
  96127. _e27 = m;
  96128. if (!(p && o)) {
  96129. _context66.next = 24;
  96130. break;
  96131. }
  96132. _context66.next = 20;
  96133. return o({
  96134. objectName: t,
  96135. methodName: c,
  96136. params: u,
  96137. errSubject: f,
  96138. errCode: g,
  96139. errMsg: m
  96140. });
  96141. case 20:
  96142. _context66.t1 = _context66.sent.errMsg;
  96143. if (_context66.t1) {
  96144. _context66.next = 23;
  96145. break;
  96146. }
  96147. _context66.t1 = m;
  96148. case 23:
  96149. _e27 = _context66.t1;
  96150. case 24:
  96151. if (!a) {
  96152. _context66.next = 37;
  96153. break;
  96154. }
  96155. if (!("toast" === i.type)) {
  96156. _context66.next = 29;
  96157. break;
  96158. }
  96159. uni.showToast({
  96160. title: _e27,
  96161. icon: "none"
  96162. });
  96163. _context66.next = 37;
  96164. break;
  96165. case 29:
  96166. if (!("modal" !== i.type)) {
  96167. _context66.next = 31;
  96168. break;
  96169. }
  96170. throw new Error("Invalid errorOptions.type: ".concat(i.type));
  96171. case 31:
  96172. _context66.next = 33;
  96173. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65() {
  96174. var _ref59,
  96175. e,
  96176. t,
  96177. n,
  96178. s,
  96179. r,
  96180. _args2 = arguments;
  96181. return _regenerator.default.wrap(function _callee65$(_context65) {
  96182. while (1) {
  96183. switch (_context65.prev = _context65.next) {
  96184. case 0:
  96185. _ref59 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, e = _ref59.title, t = _ref59.content, n = _ref59.showCancel, s = _ref59.cancelText, r = _ref59.confirmText;
  96186. return _context65.abrupt("return", new Promise(function (i, o) {
  96187. uni.showModal({
  96188. title: e,
  96189. content: t,
  96190. showCancel: n,
  96191. cancelText: s,
  96192. confirmText: r,
  96193. success: function success(e) {
  96194. i(e);
  96195. },
  96196. fail: function fail() {
  96197. i({
  96198. confirm: !1,
  96199. cancel: !0
  96200. });
  96201. }
  96202. });
  96203. }));
  96204. case 2:
  96205. case "end":
  96206. return _context65.stop();
  96207. }
  96208. }
  96209. }, _callee65);
  96210. }))({
  96211. title: "提示",
  96212. content: _e27,
  96213. showCancel: i.retry,
  96214. cancelText: "取消",
  96215. confirmText: i.retry ? "重试" : "确定"
  96216. });
  96217. case 33:
  96218. _yield = _context66.sent;
  96219. _t20 = _yield.confirm;
  96220. if (!(i.retry && _t20)) {
  96221. _context66.next = 37;
  96222. break;
  96223. }
  96224. return _context66.abrupt("return", s.apply(void 0, u));
  96225. case 37:
  96226. _n19 = new te({
  96227. subject: f,
  96228. code: g,
  96229. message: m,
  96230. requestId: h.requestId
  96231. });
  96232. throw _n19.detail = h.result, Y(H.RESPONSE, {
  96233. type: J.CLOUD_OBJECT,
  96234. content: _n19
  96235. }), _n19;
  96236. case 39:
  96237. return _context66.abrupt("return", (Y(H.RESPONSE, {
  96238. type: J.CLOUD_OBJECT,
  96239. content: h.result
  96240. }), h.result));
  96241. case 40:
  96242. case "end":
  96243. return _context66.stop();
  96244. }
  96245. }
  96246. }, _callee66, null, [[5, 11]]);
  96247. }));
  96248. function s() {
  96249. return _s18.apply(this, arguments);
  96250. }
  96251. return s;
  96252. }(),
  96253. interceptorName: "callObject",
  96254. getCallbackArgs: function getCallbackArgs() {
  96255. var _ref60 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  96256. e = _ref60.params;
  96257. return {
  96258. objectName: t,
  96259. methodName: c,
  96260. params: e
  96261. };
  96262. }
  96263. });
  96264. }
  96265. });
  96266. };
  96267. }
  96268. function $s(e) {
  96269. return U(Qt.replace("{spaceId}", e.config.spaceId));
  96270. }
  96271. function Bs() {
  96272. return _Bs.apply(this, arguments);
  96273. }
  96274. function _Bs() {
  96275. _Bs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee71() {
  96276. var _ref70,
  96277. e,
  96278. _ref70$callLoginByWei,
  96279. t,
  96280. n,
  96281. s,
  96282. r,
  96283. _args10 = arguments;
  96284. return _regenerator.default.wrap(function _callee71$(_context71) {
  96285. while (1) {
  96286. switch (_context71.prev = _context71.next) {
  96287. case 0:
  96288. _ref70 = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {}, e = _ref70.openid, _ref70$callLoginByWei = _ref70.callLoginByWeixin, t = _ref70$callLoginByWei === void 0 ? !1 : _ref70$callLoginByWei;
  96289. n = $s(this);
  96290. if (!("mp-weixin" !== C)) {
  96291. _context71.next = 4;
  96292. break;
  96293. }
  96294. throw new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `".concat(C, "`"));
  96295. case 4:
  96296. if (!(e && t)) {
  96297. _context71.next = 6;
  96298. break;
  96299. }
  96300. throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");
  96301. case 6:
  96302. if (!e) {
  96303. _context71.next = 8;
  96304. break;
  96305. }
  96306. return _context71.abrupt("return", (n.mpWeixinOpenid = e, {}));
  96307. case 8:
  96308. _context71.next = 10;
  96309. return new Promise(function (e, t) {
  96310. uni.login({
  96311. success: function success(t) {
  96312. e(t.code);
  96313. },
  96314. fail: function fail(e) {
  96315. t(new Error(e.errMsg));
  96316. }
  96317. });
  96318. });
  96319. case 10:
  96320. s = _context71.sent;
  96321. r = this.importObject("uni-id-co", {
  96322. customUI: !0
  96323. });
  96324. _context71.next = 14;
  96325. return r.secureNetworkHandshakeByWeixin({
  96326. code: s,
  96327. callLoginByWeixin: t
  96328. });
  96329. case 14:
  96330. n.mpWeixinCode = s;
  96331. return _context71.abrupt("return", {
  96332. code: s
  96333. });
  96334. case 16:
  96335. case "end":
  96336. return _context71.stop();
  96337. }
  96338. }
  96339. }, _callee71, this);
  96340. }));
  96341. return _Bs.apply(this, arguments);
  96342. }
  96343. function Ws(_x52) {
  96344. return _Ws.apply(this, arguments);
  96345. }
  96346. function _Ws() {
  96347. _Ws = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee72(e) {
  96348. var t;
  96349. return _regenerator.default.wrap(function _callee72$(_context72) {
  96350. while (1) {
  96351. switch (_context72.prev = _context72.next) {
  96352. case 0:
  96353. t = $s(this);
  96354. return _context72.abrupt("return", (t.initPromise || (t.initPromise = Bs.call(this, e).then(function (e) {
  96355. return e;
  96356. }).catch(function (e) {
  96357. throw delete t.initPromise, e;
  96358. })), t.initPromise));
  96359. case 2:
  96360. case "end":
  96361. return _context72.stop();
  96362. }
  96363. }
  96364. }, _callee72, this);
  96365. }));
  96366. return _Ws.apply(this, arguments);
  96367. }
  96368. function Hs(e) {
  96369. return function () {
  96370. var _ref61 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  96371. t = _ref61.openid,
  96372. _ref61$callLoginByWei = _ref61.callLoginByWeixin,
  96373. n = _ref61$callLoginByWei === void 0 ? !1 : _ref61$callLoginByWei;
  96374. return Ws.call(e, {
  96375. openid: t,
  96376. callLoginByWeixin: n
  96377. });
  96378. };
  96379. }
  96380. function Js(e) {
  96381. !function (e) {
  96382. ue = e;
  96383. }(e);
  96384. }
  96385. function zs(e) {
  96386. var t = {
  96387. getSystemInfo: uni.getSystemInfo,
  96388. getPushClientId: uni.getPushClientId
  96389. };
  96390. return function (n) {
  96391. return new Promise(function (s, r) {
  96392. t[e](_objectSpread(_objectSpread({}, n), {}, {
  96393. success: function success(e) {
  96394. s(e);
  96395. },
  96396. fail: function fail(e) {
  96397. r(e);
  96398. }
  96399. }));
  96400. });
  96401. };
  96402. }
  96403. var Vs = /*#__PURE__*/function (_S) {
  96404. (0, _inherits2.default)(Vs, _S);
  96405. var _super11 = _createSuper(Vs);
  96406. function Vs() {
  96407. var _this26;
  96408. (0, _classCallCheck2.default)(this, Vs);
  96409. _this26 = _super11.call(this), _this26._uniPushMessageCallback = _this26._receivePushMessage.bind((0, _assertThisInitialized2.default)(_this26)), _this26._currentMessageId = -1, _this26._payloadQueue = [];
  96410. return _this26;
  96411. }
  96412. (0, _createClass2.default)(Vs, [{
  96413. key: "init",
  96414. value: function init() {
  96415. var _this27 = this;
  96416. return Promise.all([zs("getSystemInfo")(), zs("getPushClientId")()]).then(function () {
  96417. var _ref62 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [],
  96418. _ref63 = (0, _slicedToArray2.default)(_ref62, 2),
  96419. _ref63$ = _ref63[0];
  96420. _ref63$ = _ref63$ === void 0 ? {} : _ref63$;
  96421. var e = _ref63$.appId,
  96422. _ref63$2 = _ref63[1];
  96423. _ref63$2 = _ref63$2 === void 0 ? {} : _ref63$2;
  96424. var t = _ref63$2.cid;
  96425. if (!e) throw new Error("Invalid appId, please check the manifest.json file");
  96426. if (!t) throw new Error("Invalid push client id");
  96427. _this27._appId = e, _this27._pushClientId = t, _this27._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), _this27.emit("open"), _this27._initMessageListener();
  96428. }, function (e) {
  96429. throw _this27.emit("error", e), _this27.close(), e;
  96430. });
  96431. }
  96432. }, {
  96433. key: "open",
  96434. value: function () {
  96435. var _open = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee67() {
  96436. return _regenerator.default.wrap(function _callee67$(_context67) {
  96437. while (1) {
  96438. switch (_context67.prev = _context67.next) {
  96439. case 0:
  96440. return _context67.abrupt("return", this.init());
  96441. case 1:
  96442. case "end":
  96443. return _context67.stop();
  96444. }
  96445. }
  96446. }, _callee67, this);
  96447. }));
  96448. function open() {
  96449. return _open.apply(this, arguments);
  96450. }
  96451. return open;
  96452. }()
  96453. }, {
  96454. key: "_isUniCloudSSE",
  96455. value: function _isUniCloudSSE(e) {
  96456. if ("receive" !== e.type) return !1;
  96457. var t = e && e.data && e.data.payload;
  96458. return !(!t || "UNI_CLOUD_SSE" !== t.channel || t.seqId !== this._seqId);
  96459. }
  96460. }, {
  96461. key: "_receivePushMessage",
  96462. value: function _receivePushMessage(e) {
  96463. if (!this._isUniCloudSSE(e)) return;
  96464. var t = e && e.data && e.data.payload,
  96465. n = t.action,
  96466. s = t.messageId,
  96467. r = t.message;
  96468. this._payloadQueue.push({
  96469. action: n,
  96470. messageId: s,
  96471. message: r
  96472. }), this._consumMessage();
  96473. }
  96474. }, {
  96475. key: "_consumMessage",
  96476. value: function _consumMessage() {
  96477. var _this28 = this;
  96478. for (;;) {
  96479. var _e28 = this._payloadQueue.find(function (e) {
  96480. return e.messageId === _this28._currentMessageId + 1;
  96481. });
  96482. if (!_e28) break;
  96483. this._currentMessageId++, this._parseMessagePayload(_e28);
  96484. }
  96485. }
  96486. }, {
  96487. key: "_parseMessagePayload",
  96488. value: function _parseMessagePayload(e) {
  96489. var t = e.action,
  96490. n = e.messageId,
  96491. s = e.message;
  96492. "end" === t ? this._end({
  96493. messageId: n,
  96494. message: s
  96495. }) : "message" === t && this._appendMessage({
  96496. messageId: n,
  96497. message: s
  96498. });
  96499. }
  96500. }, {
  96501. key: "_appendMessage",
  96502. value: function _appendMessage() {
  96503. var _ref64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  96504. e = _ref64.messageId,
  96505. t = _ref64.message;
  96506. this.emit("message", t);
  96507. }
  96508. }, {
  96509. key: "_end",
  96510. value: function _end() {
  96511. var _ref65 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  96512. e = _ref65.messageId,
  96513. t = _ref65.message;
  96514. this.emit("end", t), this.close();
  96515. }
  96516. }, {
  96517. key: "_initMessageListener",
  96518. value: function _initMessageListener() {
  96519. uni.onPushMessage(this._uniPushMessageCallback);
  96520. }
  96521. }, {
  96522. key: "_destroy",
  96523. value: function _destroy() {
  96524. uni.offPushMessage(this._uniPushMessageCallback);
  96525. }
  96526. }, {
  96527. key: "toJSON",
  96528. value: function toJSON() {
  96529. return {
  96530. appId: this._appId,
  96531. pushClientId: this._pushClientId,
  96532. seqId: this._seqId
  96533. };
  96534. }
  96535. }, {
  96536. key: "close",
  96537. value: function close() {
  96538. this._destroy(), this.emit("close");
  96539. }
  96540. }]);
  96541. return Vs;
  96542. }(S);
  96543. function Gs(_x53) {
  96544. return _Gs.apply(this, arguments);
  96545. }
  96546. function _Gs() {
  96547. _Gs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee73(e) {
  96548. var _ae2, _e33, _t22, t, _t$debugInfo, n, s, _yield$At2, r, i, o;
  96549. return _regenerator.default.wrap(function _callee73$(_context73) {
  96550. while (1) {
  96551. switch (_context73.prev = _context73.next) {
  96552. case 0:
  96553. if (b) {
  96554. _context73.next = 2;
  96555. break;
  96556. }
  96557. return _context73.abrupt("return", Promise.resolve());
  96558. case 2:
  96559. if ("app" === C) {
  96560. _ae2 = ae(), _e33 = _ae2.osName, _t22 = _ae2.osVersion;
  96561. "ios" === _e33 && function (e) {
  96562. if (!e || "string" != typeof e) return 0;
  96563. var t = e.match(/^(\d+)./);
  96564. return t && t[1] ? parseInt(t[1]) : 0;
  96565. }(_t22) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发期间需要,发行后不需要)");
  96566. }
  96567. t = e.__dev__;
  96568. if (t.debugInfo) {
  96569. _context73.next = 6;
  96570. break;
  96571. }
  96572. return _context73.abrupt("return");
  96573. case 6:
  96574. _t$debugInfo = t.debugInfo;
  96575. n = _t$debugInfo.address;
  96576. s = _t$debugInfo.servePort;
  96577. _context73.next = 11;
  96578. return At(n, s);
  96579. case 11:
  96580. _yield$At2 = _context73.sent;
  96581. r = _yield$At2.address;
  96582. if (!r) {
  96583. _context73.next = 15;
  96584. break;
  96585. }
  96586. return _context73.abrupt("return", (t.localAddress = r, void (t.localPort = s)));
  96587. case 15:
  96588. i = console["app" === C ? "error" : "warn"];
  96589. o = "";
  96590. if (!("remote" === t.debugInfo.initialLaunchType ? (t.debugInfo.forceRemote = !0, o = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", "web" === C && (o += "\n- 部分浏览器开启节流模式之后访问本地地址受限,请检查是否启用了节流模式"), 0 === C.indexOf("mp-") && (o += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t.debugInfo.forceRemote)) {
  96591. _context73.next = 19;
  96592. break;
  96593. }
  96594. throw new Error(o);
  96595. case 19:
  96596. i(o);
  96597. case 20:
  96598. case "end":
  96599. return _context73.stop();
  96600. }
  96601. }
  96602. }, _callee73);
  96603. }));
  96604. return _Gs.apply(this, arguments);
  96605. }
  96606. function Ys(e) {
  96607. e._initPromiseHub || (e._initPromiseHub = new I({
  96608. createPromise: function createPromise() {
  96609. var t = Promise.resolve();
  96610. var n;
  96611. n = 1, t = new Promise(function (e) {
  96612. setTimeout(function () {
  96613. e();
  96614. }, n);
  96615. });
  96616. var s = e.auth();
  96617. return t.then(function () {
  96618. return s.getLoginState();
  96619. }).then(function (e) {
  96620. return e ? Promise.resolve() : s.signInAnonymously();
  96621. });
  96622. }
  96623. }));
  96624. }
  96625. var Qs = {
  96626. tcb: Pt,
  96627. tencent: Pt,
  96628. aliyun: pe,
  96629. private: Nt,
  96630. dcloud: Nt,
  96631. alipay: $t
  96632. };
  96633. var Xs = new ( /*#__PURE__*/function () {
  96634. function _class5() {
  96635. (0, _classCallCheck2.default)(this, _class5);
  96636. }
  96637. (0, _createClass2.default)(_class5, [{
  96638. key: "init",
  96639. value: function init(e) {
  96640. var t = {};
  96641. var n = Qs[e.provider];
  96642. if (!n) throw new Error("未提供正确的provider参数");
  96643. t = n.init(e), b && function (e) {
  96644. if (!b) return;
  96645. var t = {};
  96646. e.__dev__ = t, t.debugLog = b && ("web" === C && navigator.userAgent.indexOf("HBuilderX") > 0 || "app" === C || "mp-harmony" === C);
  96647. var n = A;
  96648. n && !n.code && (t.debugInfo = n);
  96649. var s = new I({
  96650. createPromise: function createPromise() {
  96651. return Gs(e);
  96652. }
  96653. });
  96654. t.initLocalNetwork = function () {
  96655. return s.exec();
  96656. };
  96657. }(t), Ys(t), Vn(t), function (e) {
  96658. var t = e.uploadFile;
  96659. e.uploadFile = function (e) {
  96660. return t.call(this, e);
  96661. };
  96662. }(t), function (e) {
  96663. e.database = function (t) {
  96664. if (t && Object.keys(t).length > 0) return e.init(t).database();
  96665. if (this._database) return this._database;
  96666. var n = os(as, {
  96667. uniClient: e
  96668. });
  96669. return this._database = n, n;
  96670. }, e.databaseForJQL = function (t) {
  96671. if (t && Object.keys(t).length > 0) return e.init(t).databaseForJQL();
  96672. if (this._databaseForJQL) return this._databaseForJQL;
  96673. var n = os(as, {
  96674. uniClient: e,
  96675. isJQL: !0
  96676. });
  96677. return this._databaseForJQL = n, n;
  96678. };
  96679. }(t), function (e) {
  96680. e.getCurrentUserInfo = Ds, e.chooseAndUploadFile = qs.initChooseAndUploadFile(e), Object.assign(e, {
  96681. get mixinDatacom() {
  96682. return Ks(e);
  96683. }
  96684. }), e.SSEChannel = Vs, e.initSecureNetworkByWeixin = Hs(e), e.setCustomClientInfo = Js, e.importObject = js(e);
  96685. }(t);
  96686. return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach(function (e) {
  96687. if (!t[e]) return;
  96688. var n = t[e];
  96689. t[e] = function () {
  96690. return n.apply(t, Array.from(arguments));
  96691. }, t[e] = function (e, t) {
  96692. return function (n) {
  96693. var _this29 = this;
  96694. var s = !1;
  96695. if ("callFunction" === t) {
  96696. var _e29 = n && n.type || l.DEFAULT;
  96697. s = _e29 !== l.DEFAULT;
  96698. }
  96699. var r = "callFunction" === t && !s,
  96700. i = this._initPromiseHub.exec();
  96701. n = n || {};
  96702. var _ee2 = ee(n),
  96703. o = _ee2.success,
  96704. a = _ee2.fail,
  96705. c = _ee2.complete,
  96706. u = i.then(function () {
  96707. return s ? Promise.resolve() : j($(t, "invoke"), n);
  96708. }).then(function () {
  96709. return e.call(_this29, n);
  96710. }).then(function (e) {
  96711. return s ? Promise.resolve(e) : j($(t, "success"), e).then(function () {
  96712. return j($(t, "complete"), e);
  96713. }).then(function () {
  96714. return r && Y(H.RESPONSE, {
  96715. type: J.CLOUD_FUNCTION,
  96716. content: e
  96717. }), Promise.resolve(e);
  96718. });
  96719. }, function (e) {
  96720. return s ? Promise.reject(e) : j($(t, "fail"), e).then(function () {
  96721. return j($(t, "complete"), e);
  96722. }).then(function () {
  96723. return Y(H.RESPONSE, {
  96724. type: J.CLOUD_FUNCTION,
  96725. content: e
  96726. }), Promise.reject(e);
  96727. });
  96728. });
  96729. if (!(o || a || c)) return u;
  96730. u.then(function (e) {
  96731. o && o(e), c && c(e), r && Y(H.RESPONSE, {
  96732. type: J.CLOUD_FUNCTION,
  96733. content: e
  96734. });
  96735. }, function (e) {
  96736. a && a(e), c && c(e), r && Y(H.RESPONSE, {
  96737. type: J.CLOUD_FUNCTION,
  96738. content: e
  96739. });
  96740. });
  96741. };
  96742. }(t[e], e).bind(t);
  96743. }), t.init = this.init, t;
  96744. }
  96745. }]);
  96746. return _class5;
  96747. }())();
  96748. exports.uniCloud = Xs;
  96749. (function () {
  96750. var e = O;
  96751. var t = {};
  96752. if (e && 1 === e.length) t = e[0], exports.uniCloud = Xs = Xs.init(t), Xs._isDefault = !0;else {
  96753. var _t21 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
  96754. var _n20;
  96755. _n20 = e && e.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : x ? "应用未关联服务空间,请在uniCloud目录右键关联服务空间" : "uni-app cli项目内使用uniCloud需要使用HBuilderX的运行菜单运行项目,且需要在uniCloud目录关联服务空间", _t21.forEach(function (e) {
  96756. Xs[e] = function () {
  96757. return console.error(_n20), Promise.reject(new te({
  96758. code: "SYS_ERR",
  96759. message: _n20
  96760. }));
  96761. };
  96762. });
  96763. }
  96764. if (Object.assign(Xs, {
  96765. get mixinDatacom() {
  96766. return Ks(Xs);
  96767. }
  96768. }), Ns(Xs), Xs.addInterceptor = F, Xs.removeInterceptor = K, Xs.interceptObject = B, b && "web" === C && (window.uniCloud = Xs), "app" === C && (uni.__uniCloud = Xs), "app" === C || "web" === C) {
  96769. var _e30 = D();
  96770. _e30.uniCloud = Xs, _e30.UniCloudError = te;
  96771. }
  96772. })();
  96773. var Zs = Xs;
  96774. exports.default = Zs;
  96775. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  96776. /***/ }),
  96777. /* 987 */
  96778. /*!**********************************************************************!*\
  96779. !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
  96780. \**********************************************************************/
  96781. /*! no static exports found */
  96782. /***/ (function(module, exports) {
  96783. function _assertThisInitialized(self) {
  96784. if (self === void 0) {
  96785. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  96786. }
  96787. return self;
  96788. }
  96789. module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96790. /***/ }),
  96791. /* 988 */
  96792. /*!*********************************************************!*\
  96793. !*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
  96794. \*********************************************************/
  96795. /*! no static exports found */
  96796. /***/ (function(module, exports, __webpack_require__) {
  96797. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  96798. function _inherits(subClass, superClass) {
  96799. if (typeof superClass !== "function" && superClass !== null) {
  96800. throw new TypeError("Super expression must either be null or a function");
  96801. }
  96802. subClass.prototype = Object.create(superClass && superClass.prototype, {
  96803. constructor: {
  96804. value: subClass,
  96805. writable: true,
  96806. configurable: true
  96807. }
  96808. });
  96809. Object.defineProperty(subClass, "prototype", {
  96810. writable: false
  96811. });
  96812. if (superClass) setPrototypeOf(subClass, superClass);
  96813. }
  96814. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96815. /***/ }),
  96816. /* 989 */
  96817. /*!**************************************************************************!*\
  96818. !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
  96819. \**************************************************************************/
  96820. /*! no static exports found */
  96821. /***/ (function(module, exports, __webpack_require__) {
  96822. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  96823. var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ 987);
  96824. function _possibleConstructorReturn(self, call) {
  96825. if (call && (_typeof(call) === "object" || typeof call === "function")) {
  96826. return call;
  96827. } else if (call !== void 0) {
  96828. throw new TypeError("Derived constructors may only return object or undefined");
  96829. }
  96830. return assertThisInitialized(self);
  96831. }
  96832. module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96833. /***/ }),
  96834. /* 990 */
  96835. /*!***************************************************************!*\
  96836. !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
  96837. \***************************************************************/
  96838. /*! no static exports found */
  96839. /***/ (function(module, exports) {
  96840. function _getPrototypeOf(o) {
  96841. module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
  96842. return o.__proto__ || Object.getPrototypeOf(o);
  96843. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96844. return _getPrototypeOf(o);
  96845. }
  96846. module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96847. /***/ }),
  96848. /* 991 */
  96849. /*!****************************************************************!*\
  96850. !*** ./node_modules/@babel/runtime/helpers/wrapNativeSuper.js ***!
  96851. \****************************************************************/
  96852. /*! no static exports found */
  96853. /***/ (function(module, exports, __webpack_require__) {
  96854. var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ 990);
  96855. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  96856. var isNativeFunction = __webpack_require__(/*! ./isNativeFunction.js */ 992);
  96857. var construct = __webpack_require__(/*! ./construct.js */ 15);
  96858. function _wrapNativeSuper(Class) {
  96859. var _cache = typeof Map === "function" ? new Map() : undefined;
  96860. module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
  96861. if (Class === null || !isNativeFunction(Class)) return Class;
  96862. if (typeof Class !== "function") {
  96863. throw new TypeError("Super expression must either be null or a function");
  96864. }
  96865. if (typeof _cache !== "undefined") {
  96866. if (_cache.has(Class)) return _cache.get(Class);
  96867. _cache.set(Class, Wrapper);
  96868. }
  96869. function Wrapper() {
  96870. return construct(Class, arguments, getPrototypeOf(this).constructor);
  96871. }
  96872. Wrapper.prototype = Object.create(Class.prototype, {
  96873. constructor: {
  96874. value: Wrapper,
  96875. enumerable: false,
  96876. writable: true,
  96877. configurable: true
  96878. }
  96879. });
  96880. return setPrototypeOf(Wrapper, Class);
  96881. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96882. return _wrapNativeSuper(Class);
  96883. }
  96884. module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96885. /***/ }),
  96886. /* 992 */
  96887. /*!*****************************************************************!*\
  96888. !*** ./node_modules/@babel/runtime/helpers/isNativeFunction.js ***!
  96889. \*****************************************************************/
  96890. /*! no static exports found */
  96891. /***/ (function(module, exports) {
  96892. function _isNativeFunction(fn) {
  96893. try {
  96894. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  96895. } catch (e) {
  96896. return typeof fn === "function";
  96897. }
  96898. }
  96899. module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
  96900. /***/ }),
  96901. /* 993 */
  96902. /*!*******************************************************************!*\
  96903. !*** E:/git/2021项目/v3-H5/pages.json?{"type":"origin-pages-json"} ***!
  96904. \*******************************************************************/
  96905. /*! no static exports found */
  96906. /***/ (function(module, exports, __webpack_require__) {
  96907. "use strict";
  96908. Object.defineProperty(exports, "__esModule", {
  96909. value: true
  96910. });
  96911. exports.default = void 0;
  96912. var _default = {
  96913. "pages": [{
  96914. "path": "pages/views/home/home",
  96915. "style": {
  96916. "navigationBarTitleText": "实验室安全智慧化管控系统",
  96917. "navigationBarTextStyle": "white",
  96918. "navigationBarBackgroundColor": "#0183FA"
  96919. }
  96920. }, {
  96921. "path": "pages/views/teacherPage/laboratoryList",
  96922. "style": {
  96923. "navigationBarTitleText": "实验室安全智慧化管控系统",
  96924. "navigationBarTextStyle": "white",
  96925. "navigationBarBackgroundColor": "#0183FA"
  96926. }
  96927. }, {
  96928. "path": "pages/views/information/information",
  96929. "style": {
  96930. "navigationBarTitleText": "消息"
  96931. }
  96932. }, {
  96933. "path": "pages/views/information/informationInfo",
  96934. "style": {
  96935. "navigationBarTitleText": "消息详情"
  96936. }
  96937. }, {
  96938. "path": "pages/views/mine/mine",
  96939. "style": {
  96940. "navigationBarTitleText": "我的",
  96941. "navigationBarTextStyle": "white",
  96942. "navigationBarBackgroundColor": "#0183FA"
  96943. }
  96944. }, {
  96945. "path": "pages/views/login/login",
  96946. "style": {
  96947. "navigationBarTitleText": "",
  96948. "navigationBarTextStyle": "white",
  96949. "navigationStyle": "custom"
  96950. }
  96951. }, {
  96952. "path": "pages/views/login/ssoLogin",
  96953. "style": {
  96954. "navigationBarTitleText": "统一身份认证",
  96955. "navigationBarTextStyle": "white",
  96956. "navigationBarBackgroundColor": "#0183FA"
  96957. }
  96958. }, {
  96959. "path": "pages/views/login/ssoLoginH5",
  96960. "style": {
  96961. "navigationBarTitleText": "统一身份认证",
  96962. "navigationBarTextStyle": "white",
  96963. "navigationBarBackgroundColor": "#0183FA"
  96964. }
  96965. }, {
  96966. "path": "pages/views/login/ssoCertification",
  96967. "style": {
  96968. "navigationBarTitleText": "身份认证",
  96969. "navigationBarTextStyle": "white",
  96970. "navigationBarBackgroundColor": "#0183FA"
  96971. }
  96972. }, {
  96973. "path": "pages/views/scanCodePage",
  96974. "style": {
  96975. "navigationBarTitleText": "",
  96976. "navigationBarTextStyle": "white",
  96977. "navigationStyle": "custom"
  96978. }
  96979. }, {
  96980. "path": "pages/views/saoCode/saoCode",
  96981. "style": {
  96982. "navigationBarTitleText": "",
  96983. "navigationBarTextStyle": "white",
  96984. "navigationBarBackgroundColor": "#0183FA"
  96985. }
  96986. }, {
  96987. "path": "pages/views/saoCode/chemicalsInstructionsVideo",
  96988. "style": {
  96989. "navigationBarTitleText": "操作教程",
  96990. "navigationBarTextStyle": "white",
  96991. "navigationBarBackgroundColor": "#0183FA"
  96992. }
  96993. }, {
  96994. "path": "pages/views/pages_patrolInspector/courseQRcode",
  96995. "style": {
  96996. "navigationBarTitleText": "课程详情",
  96997. "navigationBarTextStyle": "white",
  96998. "navigationBarBackgroundColor": "#0183FA"
  96999. }
  97000. }, {
  97001. "path": "pages/views/pages_patrolInspector/chemicalCabinetQRcode",
  97002. "style": {
  97003. "navigationBarTitleText": "化学品柜详情",
  97004. "navigationBarTextStyle": "white",
  97005. "navigationBarBackgroundColor": "#0183FA"
  97006. }
  97007. }, {
  97008. "path": "pages/views/pages_patrolInspector/chemicalDetail",
  97009. "style": {
  97010. "navigationBarTitleText": "化学品详情",
  97011. "navigationBarTextStyle": "white",
  97012. "navigationBarBackgroundColor": "#0183FA"
  97013. }
  97014. }, {
  97015. "path": "pages/views/demo/index",
  97016. "style": {
  97017. "navigationBarTitleText": "测试页面",
  97018. "navigationBarTextStyle": "white",
  97019. "navigationBarBackgroundColor": "#0183FA"
  97020. }
  97021. }, {
  97022. "path": "pages/views/demo/mqttDemo",
  97023. "style": {
  97024. "navigationBarTitleText": "mqtt测试",
  97025. "navigationBarTextStyle": "white",
  97026. "navigationBarBackgroundColor": "#0183FA"
  97027. }
  97028. }, {
  97029. "path": "pages/views/videoPlayer",
  97030. "style": {
  97031. "navigationBarTitleText": "",
  97032. "navigationBarTextStyle": "white",
  97033. "navigationStyle": "custom"
  97034. }
  97035. }],
  97036. "subPackages": [{
  97037. "root": "devTools/page",
  97038. "name": "devToolsPage",
  97039. "pages": [{
  97040. "path": "index",
  97041. "style": {
  97042. "navigationStyle": "custom"
  97043. }
  97044. }]
  97045. }, {
  97046. "root": "pages_basics",
  97047. "name": "basics",
  97048. "pages": [{
  97049. "path": "views/forgotPassword/forgotPassword",
  97050. "style": {
  97051. "navigationBarTitleText": "忘记密码",
  97052. "navigationBarTextStyle": "white",
  97053. "navigationBarBackgroundColor": "#0183FA"
  97054. }
  97055. }, {
  97056. "path": "views/editPassword/editPassword",
  97057. "style": {
  97058. "navigationBarTitleText": "修改密码",
  97059. "navigationBarTextStyle": "white",
  97060. "navigationBarBackgroundColor": "#0183FA"
  97061. }
  97062. }, {
  97063. "path": "views/completeInformation/completeInformation",
  97064. "style": {
  97065. "navigationBarTitleText": "完善个人信息",
  97066. "navigationBarTextStyle": "white",
  97067. "navigationBarBackgroundColor": "#0183FA"
  97068. }
  97069. }, {
  97070. "path": "views/avatar",
  97071. "style": {
  97072. "navigationBarTitleText": "身份验证"
  97073. }
  97074. }, {
  97075. "path": "views/faceImage",
  97076. "style": {
  97077. "navigationBarTitleText": "身份验证"
  97078. }
  97079. }, {
  97080. "path": "views/signature/signature",
  97081. "style": {
  97082. "navigationBarTitleText": "电子签名"
  97083. }
  97084. }, {
  97085. "path": "views/signature/signatureImg",
  97086. "style": {
  97087. "navigationBarTitleText": "电子签名"
  97088. }
  97089. }, {
  97090. "path": "views/photoInspection",
  97091. "style": {
  97092. "navigationBarTitleText": "离开检查"
  97093. }
  97094. }, {
  97095. "path": "views/earlyWarningManage/earlyWarningDetail",
  97096. "style": {
  97097. "navigationBarTitleText": "预案预警信息"
  97098. }
  97099. }, {
  97100. "path": "views/earlyWarningManage/earlyWarningList",
  97101. "style": {
  97102. "navigationBarTitleText": "预警记录"
  97103. }
  97104. }, {
  97105. "path": "views/earlyWarningManage/videoMonitoring",
  97106. "style": {
  97107. "navigationBarTitleText": "监控信息"
  97108. }
  97109. }, {
  97110. "path": "views/earlyWarningManage/warningVideo",
  97111. "style": {
  97112. "navigationBarTitleText": "报警抓拍"
  97113. }
  97114. }, {
  97115. "path": "views/record/index",
  97116. "style": {
  97117. "navigationBarTitleText": "进出记录"
  97118. }
  97119. }, {
  97120. "path": "views/record/infoPage",
  97121. "style": {
  97122. "navigationBarTitleText": "进出详情"
  97123. }
  97124. }, {
  97125. "path": "views/gradingControl/gradingControl",
  97126. "style": {
  97127. "navigationBarTitleText": "管控工作"
  97128. }
  97129. }, {
  97130. "path": "views/gradingControl/gradingControlFinish",
  97131. "style": {
  97132. "navigationBarTitleText": "分级管控"
  97133. }
  97134. }, {
  97135. "path": "views/gradingControl/gradingControlAdd",
  97136. "style": {
  97137. "navigationBarTitleText": "分级管控"
  97138. }
  97139. }, {
  97140. "path": "views/gradingControl/gradingControlDetail",
  97141. "style": {
  97142. "navigationBarTitleText": "分级管控"
  97143. }
  97144. }]
  97145. }, {
  97146. "root": "pages_student",
  97147. "name": "student",
  97148. "pages": [{
  97149. "path": "views/accessApplication/accessApplication",
  97150. "style": {
  97151. "navigationBarTitleText": "安全准入"
  97152. }
  97153. }, {
  97154. "path": "views/accessApplication/applicationDetails",
  97155. "style": {
  97156. "navigationBarTitleText": ""
  97157. }
  97158. }, {
  97159. "path": "views/accessApplication/chooseALaboratory",
  97160. "style": {
  97161. "navigationBarTitleText": "安全准入"
  97162. }
  97163. }, {
  97164. "path": "views/accessApplication/newApplication",
  97165. "style": {
  97166. "navigationBarTitleText": "准入申请"
  97167. }
  97168. }, {
  97169. "path": "views/accessApplication/safeAccess",
  97170. "style": {
  97171. "navigationBarTitleText": "我的准入"
  97172. }
  97173. }, {
  97174. "path": "views/myRecord/index",
  97175. "style": {
  97176. "navigationBarTitleText": "进出记录"
  97177. }
  97178. }, {
  97179. "path": "views/myRecord/infoPage",
  97180. "style": {
  97181. "navigationBarTitleText": "进出详情"
  97182. }
  97183. }]
  97184. }, {
  97185. "root": "pages_manage",
  97186. "name": "manage",
  97187. "pages": [{
  97188. "path": "views/accessControl/empowerOpen",
  97189. "style": {
  97190. "navigationBarTitleText": "授权开门"
  97191. }
  97192. }, {
  97193. "path": "views/accessControl/remoteOpen",
  97194. "style": {
  97195. "navigationBarTitleText": "远程开门"
  97196. }
  97197. }, {
  97198. "path": "views/accessControl/authorizationRecord",
  97199. "style": {
  97200. "navigationBarTitleText": "授权记录"
  97201. }
  97202. }, {
  97203. "path": "views/accessControl/searchSub",
  97204. "style": {
  97205. "navigationBarTitleText": "实验室"
  97206. }
  97207. }, {
  97208. "path": "views/accessQualification/accessQualification",
  97209. "style": {
  97210. "navigationBarTitleText": "准入审核"
  97211. }
  97212. }, {
  97213. "path": "views/accessQualification/accessQualificationInfo",
  97214. "style": {
  97215. "navigationBarTitleText": ""
  97216. }
  97217. }, {
  97218. "path": "views/accessQualification/approve",
  97219. "style": {
  97220. "navigationBarTitleText": "审核未通过"
  97221. }
  97222. }, {
  97223. "path": "views/emergencyEvacuationSubList",
  97224. "style": {
  97225. "navigationBarTitleText": "应急处置"
  97226. }
  97227. }, {
  97228. "path": "views/emergencyEvacuationBig",
  97229. "style": {
  97230. "navigationBarTitleText": "应急处置"
  97231. }
  97232. }, {
  97233. "path": "views/emergencyEvacuationBigFullScreen",
  97234. "style": {
  97235. "navigationBarTitleText": "应急处置",
  97236. "pageOrientation": "landscape"
  97237. }
  97238. }, {
  97239. "path": "views/laboratory/safetyCardScan",
  97240. "style": {
  97241. "navigationBarTitleText": "实验室"
  97242. }
  97243. }, {
  97244. "path": "views/laboratory/videoPlayer",
  97245. "style": {
  97246. "navigationBarTitleText": "视频监控",
  97247. "enablePullDownRefresh": true
  97248. }
  97249. }]
  97250. }, {
  97251. "root": "pages_safetyCheck",
  97252. "name": "safetyCheck",
  97253. "pages": [{
  97254. "path": "views/demo/index",
  97255. "style": {
  97256. "navigationBarTitleText": "安全检查分包",
  97257. "navigationBarTextStyle": "white",
  97258. "navigationBarBackgroundColor": "#0183FA"
  97259. }
  97260. }]
  97261. }],
  97262. "globalStyle": {
  97263. "navigationBarTextStyle": "white",
  97264. "navigationBarBackgroundColor": "#0183FA"
  97265. }
  97266. };
  97267. exports.default = _default;
  97268. /***/ }),
  97269. /* 994 */
  97270. /*!******************************************************!*\
  97271. !*** E:/git/2021项目/v3-H5/pages.json?{"type":"stat"} ***!
  97272. \******************************************************/
  97273. /*! no static exports found */
  97274. /***/ (function(module, exports, __webpack_require__) {
  97275. "use strict";
  97276. Object.defineProperty(exports, "__esModule", {
  97277. value: true
  97278. });
  97279. exports.default = void 0;
  97280. var _default = {
  97281. "appid": "__UNI__4A158B4"
  97282. };
  97283. exports.default = _default;
  97284. /***/ }),
  97285. /* 995 */,
  97286. /* 996 */,
  97287. /* 997 */,
  97288. /* 998 */,
  97289. /* 999 */,
  97290. /* 1000 */,
  97291. /* 1001 */,
  97292. /* 1002 */,
  97293. /* 1003 */,
  97294. /* 1004 */,
  97295. /* 1005 */,
  97296. /* 1006 */,
  97297. /* 1007 */,
  97298. /* 1008 */,
  97299. /* 1009 */,
  97300. /* 1010 */,
  97301. /* 1011 */,
  97302. /* 1012 */,
  97303. /* 1013 */,
  97304. /* 1014 */,
  97305. /* 1015 */,
  97306. /* 1016 */,
  97307. /* 1017 */,
  97308. /* 1018 */,
  97309. /* 1019 */,
  97310. /* 1020 */,
  97311. /* 1021 */,
  97312. /* 1022 */,
  97313. /* 1023 */,
  97314. /* 1024 */,
  97315. /* 1025 */,
  97316. /* 1026 */,
  97317. /* 1027 */,
  97318. /* 1028 */,
  97319. /* 1029 */,
  97320. /* 1030 */
  97321. /*!****************************************************!*\
  97322. !*** E:/git/2021项目/v3-H5/component/system-info.js ***!
  97323. \****************************************************/
  97324. /*! no static exports found */
  97325. /***/ (function(module, exports, __webpack_require__) {
  97326. "use strict";
  97327. /* WEBPACK VAR INJECTION */(function(uni, wx) {
  97328. Object.defineProperty(exports, "__esModule", {
  97329. value: true
  97330. });
  97331. exports.systemInfo = void 0;
  97332. /**
  97333. * 此js文件管理关于当前设备的机型系统信息
  97334. */
  97335. var systemInfo = function systemInfo() {
  97336. /****************** 所有平台共有的系统信息 ********************/
  97337. // 设备系统信息
  97338. var systemInfomations = uni.getSystemInfoSync();
  97339. // 机型适配比例系数
  97340. var scaleFactor = 750 / systemInfomations.windowWidth;
  97341. // 当前机型-屏幕高度
  97342. var windowHeight = systemInfomations.windowHeight * scaleFactor; //rpx
  97343. // 当前机型-屏幕宽度
  97344. var windowWidth = systemInfomations.windowWidth * scaleFactor; //rpx
  97345. // 状态栏高度
  97346. var statusBarHeight = systemInfomations.statusBarHeight * scaleFactor; //rpx
  97347. // 导航栏高度 注意:此导航栏高度只针对微信小程序有效 其他平台如自定义导航栏请使用:状态栏高度+自定义文本高度
  97348. var navHeight = 0; //rpx
  97349. // console.log(windowHeight,'哈哈哈哈哈');
  97350. /****************** 微信小程序头部胶囊信息 ********************/
  97351. var menuButtonInfo = wx.getMenuButtonBoundingClientRect();
  97352. // 胶囊高度
  97353. var menuButtonHeight = menuButtonInfo.height * scaleFactor; //rpx
  97354. // 胶囊宽度
  97355. var menuButtonWidth = menuButtonInfo.width * scaleFactor; //rpx
  97356. // 胶囊上边界的坐标
  97357. var menuButtonTop = menuButtonInfo.top * scaleFactor; //rpx
  97358. // 胶囊右边界的坐标
  97359. var menuButtonRight = menuButtonInfo.right * scaleFactor; //rpx
  97360. // 胶囊下边界的坐标
  97361. var menuButtonBottom = menuButtonInfo.bottom * scaleFactor; //rpx
  97362. // 胶囊左边界的坐标
  97363. var menuButtonLeft = menuButtonInfo.left * scaleFactor; //rpx
  97364. // 微信小程序中导航栏高度 = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  97365. navHeight = menuButtonHeight + (menuButtonTop - statusBarHeight) * 2;
  97366. return {
  97367. scaleFactor: scaleFactor,
  97368. windowHeight: windowHeight,
  97369. windowWidth: windowWidth,
  97370. statusBarHeight: statusBarHeight,
  97371. menuButtonHeight: menuButtonHeight,
  97372. menuButtonWidth: menuButtonWidth,
  97373. menuButtonTop: menuButtonTop,
  97374. menuButtonRight: menuButtonRight,
  97375. menuButtonBottom: menuButtonBottom,
  97376. menuButtonLeft: menuButtonLeft,
  97377. navHeight: navHeight
  97378. };
  97379. };
  97380. exports.systemInfo = systemInfo;
  97381. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  97382. /***/ }),
  97383. /* 1031 */,
  97384. /* 1032 */,
  97385. /* 1033 */,
  97386. /* 1034 */,
  97387. /* 1035 */,
  97388. /* 1036 */,
  97389. /* 1037 */,
  97390. /* 1038 */,
  97391. /* 1039 */,
  97392. /* 1040 */,
  97393. /* 1041 */,
  97394. /* 1042 */,
  97395. /* 1043 */,
  97396. /* 1044 */,
  97397. /* 1045 */,
  97398. /* 1046 */,
  97399. /* 1047 */,
  97400. /* 1048 */,
  97401. /* 1049 */,
  97402. /* 1050 */,
  97403. /* 1051 */,
  97404. /* 1052 */,
  97405. /* 1053 */,
  97406. /* 1054 */,
  97407. /* 1055 */,
  97408. /* 1056 */,
  97409. /* 1057 */,
  97410. /* 1058 */,
  97411. /* 1059 */,
  97412. /* 1060 */,
  97413. /* 1061 */,
  97414. /* 1062 */,
  97415. /* 1063 */,
  97416. /* 1064 */,
  97417. /* 1065 */,
  97418. /* 1066 */,
  97419. /* 1067 */,
  97420. /* 1068 */,
  97421. /* 1069 */,
  97422. /* 1070 */,
  97423. /* 1071 */,
  97424. /* 1072 */,
  97425. /* 1073 */,
  97426. /* 1074 */,
  97427. /* 1075 */,
  97428. /* 1076 */,
  97429. /* 1077 */,
  97430. /* 1078 */,
  97431. /* 1079 */,
  97432. /* 1080 */,
  97433. /* 1081 */,
  97434. /* 1082 */,
  97435. /* 1083 */,
  97436. /* 1084 */,
  97437. /* 1085 */,
  97438. /* 1086 */,
  97439. /* 1087 */,
  97440. /* 1088 */,
  97441. /* 1089 */,
  97442. /* 1090 */,
  97443. /* 1091 */,
  97444. /* 1092 */,
  97445. /* 1093 */,
  97446. /* 1094 */,
  97447. /* 1095 */,
  97448. /* 1096 */,
  97449. /* 1097 */,
  97450. /* 1098 */,
  97451. /* 1099 */,
  97452. /* 1100 */,
  97453. /* 1101 */,
  97454. /* 1102 */,
  97455. /* 1103 */,
  97456. /* 1104 */,
  97457. /* 1105 */,
  97458. /* 1106 */,
  97459. /* 1107 */,
  97460. /* 1108 */,
  97461. /* 1109 */,
  97462. /* 1110 */,
  97463. /* 1111 */,
  97464. /* 1112 */,
  97465. /* 1113 */,
  97466. /* 1114 */,
  97467. /* 1115 */,
  97468. /* 1116 */,
  97469. /* 1117 */,
  97470. /* 1118 */,
  97471. /* 1119 */,
  97472. /* 1120 */,
  97473. /* 1121 */,
  97474. /* 1122 */,
  97475. /* 1123 */,
  97476. /* 1124 */,
  97477. /* 1125 */,
  97478. /* 1126 */,
  97479. /* 1127 */,
  97480. /* 1128 */,
  97481. /* 1129 */,
  97482. /* 1130 */,
  97483. /* 1131 */,
  97484. /* 1132 */,
  97485. /* 1133 */,
  97486. /* 1134 */,
  97487. /* 1135 */,
  97488. /* 1136 */,
  97489. /* 1137 */,
  97490. /* 1138 */,
  97491. /* 1139 */,
  97492. /* 1140 */,
  97493. /* 1141 */,
  97494. /* 1142 */,
  97495. /* 1143 */,
  97496. /* 1144 */,
  97497. /* 1145 */,
  97498. /* 1146 */,
  97499. /* 1147 */,
  97500. /* 1148 */,
  97501. /* 1149 */,
  97502. /* 1150 */,
  97503. /* 1151 */,
  97504. /* 1152 */,
  97505. /* 1153 */,
  97506. /* 1154 */,
  97507. /* 1155 */,
  97508. /* 1156 */,
  97509. /* 1157 */,
  97510. /* 1158 */,
  97511. /* 1159 */,
  97512. /* 1160 */,
  97513. /* 1161 */,
  97514. /* 1162 */,
  97515. /* 1163 */,
  97516. /* 1164 */,
  97517. /* 1165 */,
  97518. /* 1166 */,
  97519. /* 1167 */,
  97520. /* 1168 */,
  97521. /* 1169 */,
  97522. /* 1170 */,
  97523. /* 1171 */,
  97524. /* 1172 */,
  97525. /* 1173 */,
  97526. /* 1174 */,
  97527. /* 1175 */,
  97528. /* 1176 */,
  97529. /* 1177 */,
  97530. /* 1178 */,
  97531. /* 1179 */,
  97532. /* 1180 */,
  97533. /* 1181 */,
  97534. /* 1182 */,
  97535. /* 1183 */,
  97536. /* 1184 */,
  97537. /* 1185 */,
  97538. /* 1186 */,
  97539. /* 1187 */,
  97540. /* 1188 */,
  97541. /* 1189 */,
  97542. /* 1190 */,
  97543. /* 1191 */,
  97544. /* 1192 */,
  97545. /* 1193 */,
  97546. /* 1194 */,
  97547. /* 1195 */,
  97548. /* 1196 */,
  97549. /* 1197 */,
  97550. /* 1198 */,
  97551. /* 1199 */,
  97552. /* 1200 */,
  97553. /* 1201 */,
  97554. /* 1202 */,
  97555. /* 1203 */,
  97556. /* 1204 */,
  97557. /* 1205 */,
  97558. /* 1206 */,
  97559. /* 1207 */,
  97560. /* 1208 */,
  97561. /* 1209 */,
  97562. /* 1210 */,
  97563. /* 1211 */,
  97564. /* 1212 */,
  97565. /* 1213 */,
  97566. /* 1214 */,
  97567. /* 1215 */,
  97568. /* 1216 */,
  97569. /* 1217 */,
  97570. /* 1218 */,
  97571. /* 1219 */,
  97572. /* 1220 */,
  97573. /* 1221 */,
  97574. /* 1222 */,
  97575. /* 1223 */,
  97576. /* 1224 */,
  97577. /* 1225 */,
  97578. /* 1226 */,
  97579. /* 1227 */,
  97580. /* 1228 */,
  97581. /* 1229 */,
  97582. /* 1230 */,
  97583. /* 1231 */,
  97584. /* 1232 */,
  97585. /* 1233 */,
  97586. /* 1234 */,
  97587. /* 1235 */,
  97588. /* 1236 */,
  97589. /* 1237 */,
  97590. /* 1238 */,
  97591. /* 1239 */,
  97592. /* 1240 */,
  97593. /* 1241 */,
  97594. /* 1242 */,
  97595. /* 1243 */,
  97596. /* 1244 */,
  97597. /* 1245 */,
  97598. /* 1246 */,
  97599. /* 1247 */,
  97600. /* 1248 */
  97601. /*!********************************************************************************************!*\
  97602. !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js ***!
  97603. \********************************************************************************************/
  97604. /*! no static exports found */
  97605. /***/ (function(module, exports, __webpack_require__) {
  97606. "use strict";
  97607. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  97608. Object.defineProperty(exports, "__esModule", {
  97609. value: true
  97610. });
  97611. exports.default = void 0;
  97612. var _en = _interopRequireDefault(__webpack_require__(/*! ./en.json */ 1249));
  97613. var _zhHans = _interopRequireDefault(__webpack_require__(/*! ./zh-Hans.json */ 1250));
  97614. var _zhHant = _interopRequireDefault(__webpack_require__(/*! ./zh-Hant.json */ 1251));
  97615. var _default = {
  97616. en: _en.default,
  97617. 'zh-Hans': _zhHans.default,
  97618. 'zh-Hant': _zhHant.default
  97619. };
  97620. exports.default = _default;
  97621. /***/ }),
  97622. /* 1249 */
  97623. /*!*******************************************************************************************!*\
  97624. !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json ***!
  97625. \*******************************************************************************************/
  97626. /*! exports provided: uni-load-more.contentdown, uni-load-more.contentrefresh, uni-load-more.contentnomore, default */
  97627. /***/ (function(module) {
  97628. module.exports = JSON.parse("{\"uni-load-more.contentdown\":\"Pull up to show more\",\"uni-load-more.contentrefresh\":\"loading...\",\"uni-load-more.contentnomore\":\"No more data\"}");
  97629. /***/ }),
  97630. /* 1250 */
  97631. /*!************************************************************************************************!*\
  97632. !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json ***!
  97633. \************************************************************************************************/
  97634. /*! exports provided: uni-load-more.contentdown, uni-load-more.contentrefresh, uni-load-more.contentnomore, default */
  97635. /***/ (function(module) {
  97636. module.exports = JSON.parse("{\"uni-load-more.contentdown\":\"上拉显示更多\",\"uni-load-more.contentrefresh\":\"正在加载...\",\"uni-load-more.contentnomore\":\"没有更多数据了\"}");
  97637. /***/ }),
  97638. /* 1251 */
  97639. /*!************************************************************************************************!*\
  97640. !*** E:/git/2021项目/v3-H5/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json ***!
  97641. \************************************************************************************************/
  97642. /*! exports provided: uni-load-more.contentdown, uni-load-more.contentrefresh, uni-load-more.contentnomore, default */
  97643. /***/ (function(module) {
  97644. module.exports = JSON.parse("{\"uni-load-more.contentdown\":\"上拉顯示更多\",\"uni-load-more.contentrefresh\":\"正在加載...\",\"uni-load-more.contentnomore\":\"沒有更多數據了\"}");
  97645. /***/ }),
  97646. /* 1252 */,
  97647. /* 1253 */,
  97648. /* 1254 */,
  97649. /* 1255 */,
  97650. /* 1256 */,
  97651. /* 1257 */,
  97652. /* 1258 */,
  97653. /* 1259 */,
  97654. /* 1260 */,
  97655. /* 1261 */,
  97656. /* 1262 */,
  97657. /* 1263 */,
  97658. /* 1264 */,
  97659. /* 1265 */,
  97660. /* 1266 */,
  97661. /* 1267 */,
  97662. /* 1268 */,
  97663. /* 1269 */,
  97664. /* 1270 */,
  97665. /* 1271 */,
  97666. /* 1272 */,
  97667. /* 1273 */,
  97668. /* 1274 */,
  97669. /* 1275 */,
  97670. /* 1276 */,
  97671. /* 1277 */,
  97672. /* 1278 */,
  97673. /* 1279 */,
  97674. /* 1280 */,
  97675. /* 1281 */,
  97676. /* 1282 */,
  97677. /* 1283 */,
  97678. /* 1284 */,
  97679. /* 1285 */,
  97680. /* 1286 */,
  97681. /* 1287 */,
  97682. /* 1288 */,
  97683. /* 1289 */,
  97684. /* 1290 */,
  97685. /* 1291 */,
  97686. /* 1292 */,
  97687. /* 1293 */,
  97688. /* 1294 */,
  97689. /* 1295 */,
  97690. /* 1296 */,
  97691. /* 1297 */,
  97692. /* 1298 */,
  97693. /* 1299 */,
  97694. /* 1300 */,
  97695. /* 1301 */,
  97696. /* 1302 */,
  97697. /* 1303 */,
  97698. /* 1304 */,
  97699. /* 1305 */,
  97700. /* 1306 */,
  97701. /* 1307 */,
  97702. /* 1308 */,
  97703. /* 1309 */,
  97704. /* 1310 */,
  97705. /* 1311 */,
  97706. /* 1312 */,
  97707. /* 1313 */,
  97708. /* 1314 */,
  97709. /* 1315 */,
  97710. /* 1316 */,
  97711. /* 1317 */,
  97712. /* 1318 */,
  97713. /* 1319 */,
  97714. /* 1320 */,
  97715. /* 1321 */,
  97716. /* 1322 */,
  97717. /* 1323 */,
  97718. /* 1324 */,
  97719. /* 1325 */,
  97720. /* 1326 */,
  97721. /* 1327 */,
  97722. /* 1328 */,
  97723. /* 1329 */,
  97724. /* 1330 */,
  97725. /* 1331 */,
  97726. /* 1332 */,
  97727. /* 1333 */,
  97728. /* 1334 */,
  97729. /* 1335 */,
  97730. /* 1336 */,
  97731. /* 1337 */,
  97732. /* 1338 */,
  97733. /* 1339 */,
  97734. /* 1340 */,
  97735. /* 1341 */,
  97736. /* 1342 */,
  97737. /* 1343 */,
  97738. /* 1344 */,
  97739. /* 1345 */,
  97740. /* 1346 */,
  97741. /* 1347 */,
  97742. /* 1348 */,
  97743. /* 1349 */,
  97744. /* 1350 */,
  97745. /* 1351 */,
  97746. /* 1352 */,
  97747. /* 1353 */,
  97748. /* 1354 */,
  97749. /* 1355 */,
  97750. /* 1356 */,
  97751. /* 1357 */,
  97752. /* 1358 */,
  97753. /* 1359 */,
  97754. /* 1360 */,
  97755. /* 1361 */,
  97756. /* 1362 */,
  97757. /* 1363 */,
  97758. /* 1364 */,
  97759. /* 1365 */,
  97760. /* 1366 */,
  97761. /* 1367 */,
  97762. /* 1368 */,
  97763. /* 1369 */,
  97764. /* 1370 */,
  97765. /* 1371 */,
  97766. /* 1372 */,
  97767. /* 1373 */,
  97768. /* 1374 */,
  97769. /* 1375 */,
  97770. /* 1376 */,
  97771. /* 1377 */,
  97772. /* 1378 */,
  97773. /* 1379 */,
  97774. /* 1380 */,
  97775. /* 1381 */
  97776. /*!************************************************************************************!*\
  97777. !*** E:/git/2021项目/v3-H5/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js ***!
  97778. \************************************************************************************/
  97779. /*! no static exports found */
  97780. /***/ (function(module, exports, __webpack_require__) {
  97781. "use strict";
  97782. /*
  97783. * uCharts (R)
  97784. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台
  97785. * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved.
  97786. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  97787. * 复制使用请保留本段注释,感谢支持开源!
  97788. *
  97789. * uCharts (R) 官方网站
  97790. * https://www.uCharts.cn
  97791. *
  97792. * 开源地址:
  97793. * https://gitee.com/uCharts/uCharts
  97794. *
  97795. * uni-app插件市场地址:
  97796. * http://ext.dcloud.net.cn/plugin?id=271
  97797. *
  97798. */
  97799. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  97800. Object.defineProperty(exports, "__esModule", {
  97801. value: true
  97802. });
  97803. exports.default = void 0;
  97804. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  97805. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  97806. var config = {
  97807. version: 'v2.5.0-20230101',
  97808. yAxisWidth: 15,
  97809. xAxisHeight: 22,
  97810. padding: [10, 10, 10, 10],
  97811. rotate: false,
  97812. fontSize: 13,
  97813. fontColor: '#666666',
  97814. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  97815. color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  97816. linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', '#F78A85'],
  97817. pieChartLinePadding: 15,
  97818. pieChartTextPadding: 5,
  97819. titleFontSize: 20,
  97820. subtitleFontSize: 15,
  97821. radarLabelTextMargin: 13
  97822. };
  97823. var assign = function assign(target) {
  97824. for (var _len2 = arguments.length, varArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  97825. varArgs[_key2 - 1] = arguments[_key2];
  97826. }
  97827. if (target == null) {
  97828. throw new TypeError('[uCharts] Cannot convert undefined or null to object');
  97829. }
  97830. if (!varArgs || varArgs.length <= 0) {
  97831. return target;
  97832. }
  97833. // 深度合并对象
  97834. function deepAssign(obj1, obj2) {
  97835. for (var key in obj2) {
  97836. obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ? deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
  97837. }
  97838. return obj1;
  97839. }
  97840. varArgs.forEach(function (val) {
  97841. target = deepAssign(target, val);
  97842. });
  97843. return target;
  97844. };
  97845. var util = {
  97846. toFixed: function toFixed(num, limit) {
  97847. limit = limit || 2;
  97848. if (this.isFloat(num)) {
  97849. num = num.toFixed(limit);
  97850. }
  97851. return num;
  97852. },
  97853. isFloat: function isFloat(num) {
  97854. return num % 1 !== 0;
  97855. },
  97856. approximatelyEqual: function approximatelyEqual(num1, num2) {
  97857. return Math.abs(num1 - num2) < 1e-10;
  97858. },
  97859. isSameSign: function isSameSign(num1, num2) {
  97860. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  97861. },
  97862. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  97863. return this.isSameSign(p1.x, p2.x);
  97864. },
  97865. isCollision: function isCollision(obj1, obj2) {
  97866. obj1.end = {};
  97867. obj1.end.x = obj1.start.x + obj1.width;
  97868. obj1.end.y = obj1.start.y - obj1.height;
  97869. obj2.end = {};
  97870. obj2.end.x = obj2.start.x + obj2.width;
  97871. obj2.end.y = obj2.start.y - obj2.height;
  97872. var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2.start.y < obj1.end.y;
  97873. return !flag;
  97874. }
  97875. };
  97876. //兼容H5点击事件
  97877. function getH5Offset(e) {
  97878. e.mp = {
  97879. changedTouches: []
  97880. };
  97881. e.mp.changedTouches.push({
  97882. x: e.offsetX,
  97883. y: e.offsetY
  97884. });
  97885. return e;
  97886. }
  97887. // hex 转 rgba
  97888. function hexToRgb(hexValue, opc) {
  97889. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  97890. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  97891. return r + r + g + g + b + b;
  97892. });
  97893. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  97894. var r = parseInt(rgb[1], 16);
  97895. var g = parseInt(rgb[2], 16);
  97896. var b = parseInt(rgb[3], 16);
  97897. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  97898. }
  97899. function findRange(num, type, limit) {
  97900. if (isNaN(num)) {
  97901. throw new Error('[uCharts] series数据需为Number格式');
  97902. }
  97903. limit = limit || 10;
  97904. type = type ? type : 'upper';
  97905. var multiple = 1;
  97906. while (limit < 1) {
  97907. limit *= 10;
  97908. multiple *= 10;
  97909. }
  97910. if (type === 'upper') {
  97911. num = Math.ceil(num * multiple);
  97912. } else {
  97913. num = Math.floor(num * multiple);
  97914. }
  97915. while (num % limit !== 0) {
  97916. if (type === 'upper') {
  97917. if (num == num + 1) {
  97918. //修复数据值过大num++无效的bug by 向日葵 @xrk_jy
  97919. break;
  97920. }
  97921. num++;
  97922. } else {
  97923. num--;
  97924. }
  97925. }
  97926. return num / multiple;
  97927. }
  97928. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  97929. var seriesTemp = [];
  97930. for (var k = 0; k < dayArr.length; k++) {
  97931. var seriesItem = {
  97932. data: [],
  97933. name: nameArr[k],
  97934. color: colorArr[k]
  97935. };
  97936. for (var i = 0, len = kdata.length; i < len; i++) {
  97937. if (i < dayArr[k]) {
  97938. seriesItem.data.push(null);
  97939. continue;
  97940. }
  97941. var sum = 0;
  97942. for (var j = 0; j < dayArr[k]; j++) {
  97943. sum += kdata[i - j][1];
  97944. }
  97945. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  97946. }
  97947. seriesTemp.push(seriesItem);
  97948. }
  97949. return seriesTemp;
  97950. }
  97951. function calValidDistance(self, distance, chartData, config, opts) {
  97952. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  97953. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  97954. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  97955. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  97956. dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing;
  97957. }
  97958. var validDistance = distance;
  97959. if (distance >= 0) {
  97960. validDistance = 0;
  97961. self.uevent.trigger('scrollLeft');
  97962. self.scrollOption.position = 'left';
  97963. opts.xAxis.scrollPosition = 'left';
  97964. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  97965. validDistance = dataChartAreaWidth - dataChartWidth;
  97966. self.uevent.trigger('scrollRight');
  97967. self.scrollOption.position = 'right';
  97968. opts.xAxis.scrollPosition = 'right';
  97969. } else {
  97970. self.scrollOption.position = distance;
  97971. opts.xAxis.scrollPosition = distance;
  97972. }
  97973. return validDistance;
  97974. }
  97975. function isInAngleRange(angle, startAngle, endAngle) {
  97976. function adjust(angle) {
  97977. while (angle < 0) {
  97978. angle += 2 * Math.PI;
  97979. }
  97980. while (angle > 2 * Math.PI) {
  97981. angle -= 2 * Math.PI;
  97982. }
  97983. return angle;
  97984. }
  97985. angle = adjust(angle);
  97986. startAngle = adjust(startAngle);
  97987. endAngle = adjust(endAngle);
  97988. if (startAngle > endAngle) {
  97989. endAngle += 2 * Math.PI;
  97990. if (angle < startAngle) {
  97991. angle += 2 * Math.PI;
  97992. }
  97993. }
  97994. return angle >= startAngle && angle <= endAngle;
  97995. }
  97996. function createCurveControlPoints(points, i) {
  97997. function isNotMiddlePoint(points, i) {
  97998. if (points[i - 1] && points[i + 1]) {
  97999. return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y, points[i + 1].y);
  98000. } else {
  98001. return false;
  98002. }
  98003. }
  98004. function isNotMiddlePointX(points, i) {
  98005. if (points[i - 1] && points[i + 1]) {
  98006. return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x, points[i + 1].x);
  98007. } else {
  98008. return false;
  98009. }
  98010. }
  98011. var a = 0.2;
  98012. var b = 0.2;
  98013. var pAx = null;
  98014. var pAy = null;
  98015. var pBx = null;
  98016. var pBy = null;
  98017. if (i < 1) {
  98018. pAx = points[0].x + (points[1].x - points[0].x) * a;
  98019. pAy = points[0].y + (points[1].y - points[0].y) * a;
  98020. } else {
  98021. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  98022. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  98023. }
  98024. if (i > points.length - 3) {
  98025. var last = points.length - 1;
  98026. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  98027. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  98028. } else {
  98029. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  98030. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  98031. }
  98032. if (isNotMiddlePoint(points, i + 1)) {
  98033. pBy = points[i + 1].y;
  98034. }
  98035. if (isNotMiddlePoint(points, i)) {
  98036. pAy = points[i].y;
  98037. }
  98038. if (isNotMiddlePointX(points, i + 1)) {
  98039. pBx = points[i + 1].x;
  98040. }
  98041. if (isNotMiddlePointX(points, i)) {
  98042. pAx = points[i].x;
  98043. }
  98044. if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
  98045. pAy = points[i].y;
  98046. }
  98047. if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
  98048. pBy = points[i + 1].y;
  98049. }
  98050. if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
  98051. pAx = points[i].x;
  98052. }
  98053. if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
  98054. pBx = points[i + 1].x;
  98055. }
  98056. return {
  98057. ctrA: {
  98058. x: pAx,
  98059. y: pAy
  98060. },
  98061. ctrB: {
  98062. x: pBx,
  98063. y: pBy
  98064. }
  98065. };
  98066. }
  98067. function convertCoordinateOrigin(x, y, center) {
  98068. return {
  98069. x: center.x + x,
  98070. y: center.y - y
  98071. };
  98072. }
  98073. function avoidCollision(obj, target) {
  98074. if (target) {
  98075. // is collision test
  98076. while (util.isCollision(obj, target)) {
  98077. if (obj.start.x > 0) {
  98078. obj.start.y--;
  98079. } else if (obj.start.x < 0) {
  98080. obj.start.y++;
  98081. } else {
  98082. if (obj.start.y > 0) {
  98083. obj.start.y++;
  98084. } else {
  98085. obj.start.y--;
  98086. }
  98087. }
  98088. }
  98089. }
  98090. return obj;
  98091. }
  98092. function fixPieSeries(series, opts, config) {
  98093. var pieSeriesArr = [];
  98094. if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) {
  98095. opts._pieSeries_ = series;
  98096. var oldseries = series[0].data;
  98097. for (var i = 0; i < oldseries.length; i++) {
  98098. oldseries[i].formatter = series[0].formatter;
  98099. oldseries[i].data = oldseries[i].value;
  98100. pieSeriesArr.push(oldseries[i]);
  98101. }
  98102. opts.series = pieSeriesArr;
  98103. } else {
  98104. pieSeriesArr = series;
  98105. }
  98106. return pieSeriesArr;
  98107. }
  98108. function fillSeries(series, opts, config) {
  98109. var index = 0;
  98110. for (var i = 0; i < series.length; i++) {
  98111. var item = series[i];
  98112. if (!item.color) {
  98113. item.color = config.color[index];
  98114. index = (index + 1) % config.color.length;
  98115. }
  98116. if (!item.linearIndex) {
  98117. item.linearIndex = i;
  98118. }
  98119. if (!item.index) {
  98120. item.index = 0;
  98121. }
  98122. if (!item.type) {
  98123. item.type = opts.type;
  98124. }
  98125. if (typeof item.show == "undefined") {
  98126. item.show = true;
  98127. }
  98128. if (!item.type) {
  98129. item.type = opts.type;
  98130. }
  98131. if (!item.pointShape) {
  98132. item.pointShape = "circle";
  98133. }
  98134. if (!item.legendShape) {
  98135. switch (item.type) {
  98136. case 'line':
  98137. item.legendShape = "line";
  98138. break;
  98139. case 'column':
  98140. case 'bar':
  98141. item.legendShape = "rect";
  98142. break;
  98143. case 'area':
  98144. case 'mount':
  98145. item.legendShape = "triangle";
  98146. break;
  98147. default:
  98148. item.legendShape = "circle";
  98149. }
  98150. }
  98151. }
  98152. return series;
  98153. }
  98154. function fillCustomColor(linearType, customColor, series, config) {
  98155. var newcolor = customColor || [];
  98156. if (linearType == 'custom' && newcolor.length == 0) {
  98157. newcolor = config.linearColor;
  98158. }
  98159. if (linearType == 'custom' && newcolor.length < series.length) {
  98160. var chazhi = series.length - newcolor.length;
  98161. for (var i = 0; i < chazhi; i++) {
  98162. newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]);
  98163. }
  98164. }
  98165. return newcolor;
  98166. }
  98167. function getDataRange(minData, maxData) {
  98168. var limit = 0;
  98169. var range = maxData - minData;
  98170. if (range >= 10000) {
  98171. limit = 1000;
  98172. } else if (range >= 1000) {
  98173. limit = 100;
  98174. } else if (range >= 100) {
  98175. limit = 10;
  98176. } else if (range >= 10) {
  98177. limit = 5;
  98178. } else if (range >= 1) {
  98179. limit = 1;
  98180. } else if (range >= 0.1) {
  98181. limit = 0.1;
  98182. } else if (range >= 0.01) {
  98183. limit = 0.01;
  98184. } else if (range >= 0.001) {
  98185. limit = 0.001;
  98186. } else if (range >= 0.0001) {
  98187. limit = 0.0001;
  98188. } else if (range >= 0.00001) {
  98189. limit = 0.00001;
  98190. } else {
  98191. limit = 0.000001;
  98192. }
  98193. return {
  98194. minRange: findRange(minData, 'lower', limit),
  98195. maxRange: findRange(maxData, 'upper', limit)
  98196. };
  98197. }
  98198. function measureText(text, fontSize, context) {
  98199. var width = 0;
  98200. text = String(text);
  98201. if (context !== false && context !== undefined && context.setFontSize && context.measureText) {
  98202. context.setFontSize(fontSize);
  98203. return context.measureText(text).width;
  98204. } else {
  98205. var text = text.split('');
  98206. for (var i = 0; i < text.length; i++) {
  98207. var item = text[i];
  98208. if (/[a-zA-Z]/.test(item)) {
  98209. width += 7;
  98210. } else if (/[0-9]/.test(item)) {
  98211. width += 5.5;
  98212. } else if (/\./.test(item)) {
  98213. width += 2.7;
  98214. } else if (/-/.test(item)) {
  98215. width += 3.25;
  98216. } else if (/:/.test(item)) {
  98217. width += 2.5;
  98218. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  98219. width += 10;
  98220. } else if (/\(|\)/.test(item)) {
  98221. width += 3.73;
  98222. } else if (/\s/.test(item)) {
  98223. width += 2.5;
  98224. } else if (/%/.test(item)) {
  98225. width += 8;
  98226. } else {
  98227. width += 10;
  98228. }
  98229. }
  98230. return width * fontSize / 10;
  98231. }
  98232. }
  98233. function dataCombine(series) {
  98234. return series.reduce(function (a, b) {
  98235. return (a.data ? a.data : a).concat(b.data);
  98236. }, []);
  98237. }
  98238. function dataCombineStack(series, len) {
  98239. var sum = new Array(len);
  98240. for (var j = 0; j < sum.length; j++) {
  98241. sum[j] = 0;
  98242. }
  98243. for (var i = 0; i < series.length; i++) {
  98244. for (var j = 0; j < sum.length; j++) {
  98245. sum[j] += series[i].data[j];
  98246. }
  98247. }
  98248. return series.reduce(function (a, b) {
  98249. return (a.data ? a.data : a).concat(b.data).concat(sum);
  98250. }, []);
  98251. }
  98252. function getTouches(touches, opts, e) {
  98253. var x, y;
  98254. if (touches.clientX) {
  98255. if (opts.rotate) {
  98256. y = opts.height - touches.clientX * opts.pix;
  98257. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  98258. } else {
  98259. x = touches.clientX * opts.pix;
  98260. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  98261. }
  98262. } else {
  98263. if (opts.rotate) {
  98264. y = opts.height - touches.x * opts.pix;
  98265. x = touches.y * opts.pix;
  98266. } else {
  98267. x = touches.x * opts.pix;
  98268. y = touches.y * opts.pix;
  98269. }
  98270. }
  98271. return {
  98272. x: x,
  98273. y: y
  98274. };
  98275. }
  98276. function getSeriesDataItem(series, index, group) {
  98277. var data = [];
  98278. var newSeries = [];
  98279. var indexIsArr = index.constructor.toString().indexOf('Array') > -1;
  98280. if (indexIsArr) {
  98281. var tempSeries = filterSeries(series);
  98282. for (var i = 0; i < group.length; i++) {
  98283. newSeries.push(tempSeries[group[i]]);
  98284. }
  98285. } else {
  98286. newSeries = series;
  98287. }
  98288. ;
  98289. for (var _i = 0; _i < newSeries.length; _i++) {
  98290. var item = newSeries[_i];
  98291. var tmpindex = -1;
  98292. if (indexIsArr) {
  98293. tmpindex = index[_i];
  98294. } else {
  98295. tmpindex = index;
  98296. }
  98297. if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) {
  98298. var seriesItem = {};
  98299. seriesItem.color = item.color;
  98300. seriesItem.type = item.type;
  98301. seriesItem.style = item.style;
  98302. seriesItem.pointShape = item.pointShape;
  98303. seriesItem.disableLegend = item.disableLegend;
  98304. seriesItem.legendShape = item.legendShape;
  98305. seriesItem.name = item.name;
  98306. seriesItem.show = item.show;
  98307. seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex];
  98308. data.push(seriesItem);
  98309. }
  98310. }
  98311. return data;
  98312. }
  98313. function getMaxTextListLength(list, fontSize, context) {
  98314. var lengthList = list.map(function (item) {
  98315. return measureText(item, fontSize, context);
  98316. });
  98317. return Math.max.apply(null, lengthList);
  98318. }
  98319. function getRadarCoordinateSeries(length) {
  98320. var eachAngle = 2 * Math.PI / length;
  98321. var CoordinateSeries = [];
  98322. for (var i = 0; i < length; i++) {
  98323. CoordinateSeries.push(eachAngle * i);
  98324. }
  98325. return CoordinateSeries.map(function (item) {
  98326. return -1 * item + Math.PI / 2;
  98327. });
  98328. }
  98329. function getToolTipData(seriesData, opts, index, group, categories) {
  98330. var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
  98331. var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : [];
  98332. var points = {};
  98333. if (group.length > 0) {
  98334. var filterPoints = [];
  98335. for (var i = 0; i < group.length; i++) {
  98336. filterPoints.push(calPoints[group[i]]);
  98337. }
  98338. points = filterPoints[0][index[0]];
  98339. } else {
  98340. for (var _i2 = 0; _i2 < calPoints.length; _i2++) {
  98341. if (calPoints[_i2][index]) {
  98342. points = calPoints[_i2][index];
  98343. break;
  98344. }
  98345. }
  98346. }
  98347. ;
  98348. var textList = seriesData.map(function (item) {
  98349. var titleText = null;
  98350. if (opts.categories && opts.categories.length > 0) {
  98351. titleText = categories[index];
  98352. }
  98353. ;
  98354. return {
  98355. text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item.data,
  98356. color: item.color,
  98357. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  98358. };
  98359. });
  98360. var offset = {
  98361. x: Math.round(points.x),
  98362. y: Math.round(points.y)
  98363. };
  98364. return {
  98365. textList: textList,
  98366. offset: offset
  98367. };
  98368. }
  98369. function getMixToolTipData(seriesData, opts, index, categories) {
  98370. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  98371. var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2;
  98372. var textList = seriesData.map(function (item) {
  98373. return {
  98374. text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + item.data,
  98375. color: item.color,
  98376. disableLegend: item.disableLegend ? true : false,
  98377. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  98378. };
  98379. });
  98380. textList = textList.filter(function (item) {
  98381. if (item.disableLegend !== true) {
  98382. return item;
  98383. }
  98384. });
  98385. var offset = {
  98386. x: Math.round(points),
  98387. y: 0
  98388. };
  98389. return {
  98390. textList: textList,
  98391. offset: offset
  98392. };
  98393. }
  98394. function getCandleToolTipData(series, seriesData, opts, index, categories, extra) {
  98395. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  98396. var calPoints = opts.chartData.calPoints;
  98397. var upColor = extra.color.upFill;
  98398. var downColor = extra.color.downFill;
  98399. //颜色顺序为开盘,收盘,最低,最高
  98400. var color = [upColor, upColor, downColor, upColor];
  98401. var textList = [];
  98402. seriesData.map(function (item) {
  98403. if (index == 0) {
  98404. if (item.data[1] - item.data[0] < 0) {
  98405. color[1] = downColor;
  98406. } else {
  98407. color[1] = upColor;
  98408. }
  98409. } else {
  98410. if (item.data[0] < series[index - 1][1]) {
  98411. color[0] = downColor;
  98412. }
  98413. if (item.data[1] < item.data[0]) {
  98414. color[1] = downColor;
  98415. }
  98416. if (item.data[2] > series[index - 1][1]) {
  98417. color[2] = upColor;
  98418. }
  98419. if (item.data[3] < series[index - 1][1]) {
  98420. color[3] = downColor;
  98421. }
  98422. }
  98423. var text1 = {
  98424. text: '开盘:' + item.data[0],
  98425. color: color[0],
  98426. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  98427. };
  98428. var text2 = {
  98429. text: '收盘:' + item.data[1],
  98430. color: color[1],
  98431. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  98432. };
  98433. var text3 = {
  98434. text: '最低:' + item.data[2],
  98435. color: color[2],
  98436. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  98437. };
  98438. var text4 = {
  98439. text: '最高:' + item.data[3],
  98440. color: color[3],
  98441. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  98442. };
  98443. textList.push(text1, text2, text3, text4);
  98444. });
  98445. var validCalPoints = [];
  98446. var offset = {
  98447. x: 0,
  98448. y: 0
  98449. };
  98450. for (var i = 0; i < calPoints.length; i++) {
  98451. var points = calPoints[i];
  98452. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  98453. validCalPoints.push(points[index]);
  98454. }
  98455. }
  98456. offset.x = Math.round(validCalPoints[0][0].x);
  98457. return {
  98458. textList: textList,
  98459. offset: offset
  98460. };
  98461. }
  98462. function filterSeries(series) {
  98463. var tempSeries = [];
  98464. for (var i = 0; i < series.length; i++) {
  98465. if (series[i].show == true) {
  98466. tempSeries.push(series[i]);
  98467. }
  98468. }
  98469. return tempSeries;
  98470. }
  98471. function findCurrentIndex(currentPoints, calPoints, opts, config) {
  98472. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  98473. var current = {
  98474. index: -1,
  98475. group: []
  98476. };
  98477. var spacing = opts.chartData.eachSpacing / 2;
  98478. var xAxisPoints = [];
  98479. if (calPoints && calPoints.length > 0) {
  98480. if (!opts.categories) {
  98481. spacing = 0;
  98482. } else {
  98483. for (var i = 1; i < opts.chartData.xAxisPoints.length; i++) {
  98484. xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing);
  98485. }
  98486. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  98487. xAxisPoints = opts.chartData.xAxisPoints;
  98488. }
  98489. }
  98490. if (isInExactChartArea(currentPoints, opts, config)) {
  98491. if (!opts.categories) {
  98492. var timePoints = Array(calPoints.length);
  98493. for (var _i3 = 0; _i3 < calPoints.length; _i3++) {
  98494. timePoints[_i3] = Array(calPoints[_i3].length);
  98495. for (var j = 0; j < calPoints[_i3].length; j++) {
  98496. timePoints[_i3][j] = Math.abs(calPoints[_i3][j].x - currentPoints.x);
  98497. }
  98498. }
  98499. ;
  98500. var pointValue = Array(timePoints.length);
  98501. var pointIndex = Array(timePoints.length);
  98502. for (var _i4 = 0; _i4 < timePoints.length; _i4++) {
  98503. pointValue[_i4] = Math.min.apply(null, timePoints[_i4]);
  98504. pointIndex[_i4] = timePoints[_i4].indexOf(pointValue[_i4]);
  98505. }
  98506. var minValue = Math.min.apply(null, pointValue);
  98507. current.index = [];
  98508. for (var _i5 = 0; _i5 < pointValue.length; _i5++) {
  98509. if (pointValue[_i5] == minValue) {
  98510. current.group.push(_i5);
  98511. current.index.push(pointIndex[_i5]);
  98512. }
  98513. }
  98514. ;
  98515. } else {
  98516. xAxisPoints.forEach(function (item, index) {
  98517. if (currentPoints.x + offset + spacing > item) {
  98518. current.index = index;
  98519. }
  98520. });
  98521. }
  98522. }
  98523. }
  98524. return current;
  98525. }
  98526. function findBarChartCurrentIndex(currentPoints, calPoints, opts, config) {
  98527. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  98528. var current = {
  98529. index: -1,
  98530. group: []
  98531. };
  98532. var spacing = opts.chartData.eachSpacing / 2;
  98533. var yAxisPoints = opts.chartData.yAxisPoints;
  98534. if (calPoints && calPoints.length > 0) {
  98535. if (isInExactChartArea(currentPoints, opts, config)) {
  98536. yAxisPoints.forEach(function (item, index) {
  98537. if (currentPoints.y + offset + spacing > item) {
  98538. current.index = index;
  98539. }
  98540. });
  98541. }
  98542. }
  98543. return current;
  98544. }
  98545. function findLegendIndex(currentPoints, legendData, opts) {
  98546. var currentIndex = -1;
  98547. var gap = 0;
  98548. if (isInExactLegendArea(currentPoints, legendData.area)) {
  98549. var points = legendData.points;
  98550. var index = -1;
  98551. for (var i = 0, len = points.length; i < len; i++) {
  98552. var item = points[i];
  98553. for (var j = 0; j < item.length; j++) {
  98554. index += 1;
  98555. var area = item[j]['area'];
  98556. if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > area[1] - gap && currentPoints.y < area[3] + gap) {
  98557. currentIndex = index;
  98558. break;
  98559. }
  98560. }
  98561. }
  98562. return currentIndex;
  98563. }
  98564. return currentIndex;
  98565. }
  98566. function isInExactLegendArea(currentPoints, area) {
  98567. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && currentPoints.y < area.end.y;
  98568. }
  98569. function isInExactChartArea(currentPoints, opts, config) {
  98570. return currentPoints.x <= opts.width - opts.area[1] + 10 && currentPoints.x >= opts.area[3] - 10 && currentPoints.y >= opts.area[0] && currentPoints.y <= opts.height - opts.area[2];
  98571. }
  98572. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  98573. var eachAngleArea = 2 * Math.PI / count;
  98574. var currentIndex = -1;
  98575. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  98576. var fixAngle = function fixAngle(angle) {
  98577. if (angle < 0) {
  98578. angle += 2 * Math.PI;
  98579. }
  98580. if (angle > 2 * Math.PI) {
  98581. angle -= 2 * Math.PI;
  98582. }
  98583. return angle;
  98584. };
  98585. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  98586. angle = -1 * angle;
  98587. if (angle < 0) {
  98588. angle += 2 * Math.PI;
  98589. }
  98590. var angleList = radarData.angleList.map(function (item) {
  98591. item = fixAngle(-1 * item);
  98592. return item;
  98593. });
  98594. angleList.forEach(function (item, index) {
  98595. var rangeStart = fixAngle(item - eachAngleArea / 2);
  98596. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  98597. if (rangeEnd < rangeStart) {
  98598. rangeEnd += 2 * Math.PI;
  98599. }
  98600. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) {
  98601. currentIndex = index;
  98602. }
  98603. });
  98604. }
  98605. return currentIndex;
  98606. }
  98607. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  98608. var currentIndex = -1;
  98609. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  98610. var item = funnelData.series[i];
  98611. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  98612. currentIndex = i;
  98613. break;
  98614. }
  98615. }
  98616. return currentIndex;
  98617. }
  98618. function findWordChartCurrentIndex(currentPoints, wordData) {
  98619. var currentIndex = -1;
  98620. for (var i = 0, len = wordData.length; i < len; i++) {
  98621. var item = wordData[i];
  98622. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  98623. currentIndex = i;
  98624. break;
  98625. }
  98626. }
  98627. return currentIndex;
  98628. }
  98629. function findMapChartCurrentIndex(currentPoints, opts) {
  98630. var currentIndex = -1;
  98631. var cData = opts.chartData.mapData;
  98632. var data = opts.series;
  98633. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  98634. var poi = [tmp.x, tmp.y];
  98635. for (var i = 0, len = data.length; i < len; i++) {
  98636. var item = data[i].geometry.coordinates;
  98637. if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) {
  98638. currentIndex = i;
  98639. break;
  98640. }
  98641. }
  98642. return currentIndex;
  98643. }
  98644. function findRoseChartCurrentIndex(currentPoints, pieData, opts) {
  98645. var currentIndex = -1;
  98646. var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius);
  98647. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  98648. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  98649. angle = -angle;
  98650. if (opts.extra.rose && opts.extra.rose.offsetAngle) {
  98651. angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180;
  98652. }
  98653. for (var i = 0, len = series.length; i < len; i++) {
  98654. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math.PI)) {
  98655. currentIndex = i;
  98656. break;
  98657. }
  98658. }
  98659. }
  98660. return currentIndex;
  98661. }
  98662. function findPieChartCurrentIndex(currentPoints, pieData, opts) {
  98663. var currentIndex = -1;
  98664. var series = getPieDataPoints(pieData.series);
  98665. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  98666. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  98667. angle = -angle;
  98668. if (opts.extra.pie && opts.extra.pie.offsetAngle) {
  98669. angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180;
  98670. }
  98671. if (opts.extra.ring && opts.extra.ring.offsetAngle) {
  98672. angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180;
  98673. }
  98674. for (var i = 0, len = series.length; i < len; i++) {
  98675. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) {
  98676. currentIndex = i;
  98677. break;
  98678. }
  98679. }
  98680. }
  98681. return currentIndex;
  98682. }
  98683. function isInExactPieChartArea(currentPoints, center, radius) {
  98684. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  98685. }
  98686. function splitPoints(points, eachSeries) {
  98687. var newPoints = [];
  98688. var items = [];
  98689. points.forEach(function (item, index) {
  98690. if (eachSeries.connectNulls) {
  98691. if (item !== null) {
  98692. items.push(item);
  98693. }
  98694. } else {
  98695. if (item !== null) {
  98696. items.push(item);
  98697. } else {
  98698. if (items.length) {
  98699. newPoints.push(items);
  98700. }
  98701. items = [];
  98702. }
  98703. }
  98704. });
  98705. if (items.length) {
  98706. newPoints.push(items);
  98707. }
  98708. return newPoints;
  98709. }
  98710. function calLegendData(series, opts, config, chartData, context) {
  98711. var legendData = {
  98712. area: {
  98713. start: {
  98714. x: 0,
  98715. y: 0
  98716. },
  98717. end: {
  98718. x: 0,
  98719. y: 0
  98720. },
  98721. width: 0,
  98722. height: 0,
  98723. wholeWidth: 0,
  98724. wholeHeight: 0
  98725. },
  98726. points: [],
  98727. widthArr: [],
  98728. heightArr: []
  98729. };
  98730. if (opts.legend.show === false) {
  98731. chartData.legendData = legendData;
  98732. return legendData;
  98733. }
  98734. var padding = opts.legend.padding * opts.pix;
  98735. var margin = opts.legend.margin * opts.pix;
  98736. var fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize;
  98737. var shapeWidth = 15 * opts.pix;
  98738. var shapeRight = 5 * opts.pix;
  98739. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  98740. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  98741. var legendList = [];
  98742. var widthCount = 0;
  98743. var widthCountArr = [];
  98744. var currentRow = [];
  98745. for (var i = 0; i < series.length; i++) {
  98746. var item = series[i];
  98747. var legendText = item.legendText ? item.legendText : item.name;
  98748. var itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  98749. if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) {
  98750. legendList.push(currentRow);
  98751. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  98752. widthCount = itemWidth;
  98753. currentRow = [item];
  98754. } else {
  98755. widthCount += itemWidth;
  98756. currentRow.push(item);
  98757. }
  98758. }
  98759. if (currentRow.length) {
  98760. legendList.push(currentRow);
  98761. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  98762. legendData.widthArr = widthCountArr;
  98763. var legendWidth = Math.max.apply(null, widthCountArr);
  98764. switch (opts.legend.float) {
  98765. case 'left':
  98766. legendData.area.start.x = opts.area[3];
  98767. legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding;
  98768. break;
  98769. case 'right':
  98770. legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding;
  98771. legendData.area.end.x = opts.width - opts.area[1];
  98772. break;
  98773. default:
  98774. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  98775. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;
  98776. }
  98777. legendData.area.width = legendWidth + 2 * padding;
  98778. legendData.area.wholeWidth = legendWidth + 2 * padding;
  98779. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  98780. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  98781. legendData.points = legendList;
  98782. }
  98783. } else {
  98784. var len = series.length;
  98785. var maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding;
  98786. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  98787. legendData.area.height = maxLength * lineHeight + padding * 2;
  98788. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  98789. switch (opts.legend.float) {
  98790. case 'top':
  98791. legendData.area.start.y = opts.area[0] + margin;
  98792. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  98793. break;
  98794. case 'bottom':
  98795. legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height;
  98796. legendData.area.end.y = opts.height - opts.area[2] - margin;
  98797. break;
  98798. default:
  98799. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  98800. legendData.area.end.y = (opts.height + legendData.area.height) / 2;
  98801. }
  98802. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  98803. var _currentRow = [];
  98804. for (var _i6 = 0; _i6 < lineNum; _i6++) {
  98805. var temp = series.slice(_i6 * maxLength, _i6 * maxLength + maxLength);
  98806. _currentRow.push(temp);
  98807. }
  98808. legendData.points = _currentRow;
  98809. if (_currentRow.length) {
  98810. for (var _i7 = 0; _i7 < _currentRow.length; _i7++) {
  98811. var _item = _currentRow[_i7];
  98812. var maxWidth = 0;
  98813. for (var j = 0; j < _item.length; j++) {
  98814. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  98815. if (_itemWidth > maxWidth) {
  98816. maxWidth = _itemWidth;
  98817. }
  98818. }
  98819. legendData.widthArr.push(maxWidth);
  98820. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  98821. }
  98822. var _legendWidth = 0;
  98823. for (var _i8 = 0; _i8 < legendData.widthArr.length; _i8++) {
  98824. _legendWidth += legendData.widthArr[_i8];
  98825. }
  98826. legendData.area.width = _legendWidth - opts.legend.itemGap * opts.pix + 2 * padding;
  98827. legendData.area.wholeWidth = legendData.area.width + padding;
  98828. }
  98829. }
  98830. switch (opts.legend.position) {
  98831. case 'top':
  98832. legendData.area.start.y = opts.area[0] + margin;
  98833. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  98834. break;
  98835. case 'bottom':
  98836. legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin;
  98837. legendData.area.end.y = opts.height - opts.area[2] - margin;
  98838. break;
  98839. case 'left':
  98840. legendData.area.start.x = opts.area[3];
  98841. legendData.area.end.x = opts.area[3] + legendData.area.width;
  98842. break;
  98843. case 'right':
  98844. legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width;
  98845. legendData.area.end.x = opts.width - opts.area[1];
  98846. break;
  98847. }
  98848. chartData.legendData = legendData;
  98849. return legendData;
  98850. }
  98851. function calCategoriesData(categories, opts, config, eachSpacing, context) {
  98852. var result = {
  98853. angle: 0,
  98854. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  98855. };
  98856. var fontSize = opts.xAxis.fontSize * opts.pix;
  98857. var categoriesTextLenth = categories.map(function (item, index) {
  98858. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  98859. return measureText(String(xitem), fontSize, context);
  98860. });
  98861. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  98862. if (opts.xAxis.rotateLabel == true) {
  98863. result.angle = opts.xAxis.rotateAngle * Math.PI / 180;
  98864. var tempHeight = opts.xAxis.marginTop * opts.pix * 2 + Math.abs(maxTextLength * Math.sin(result.angle));
  98865. tempHeight = tempHeight < fontSize + opts.xAxis.marginTop * opts.pix * 2 ? tempHeight + opts.xAxis.marginTop * opts.pix * 2 : tempHeight;
  98866. result.xAxisHeight = tempHeight;
  98867. }
  98868. if (opts.enableScroll && opts.xAxis.scrollShow) {
  98869. result.xAxisHeight += 6 * opts.pix;
  98870. }
  98871. if (opts.xAxis.disabled) {
  98872. result.xAxisHeight = 0;
  98873. }
  98874. return result;
  98875. }
  98876. function getXAxisTextList(series, opts, config, stack) {
  98877. var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
  98878. var data;
  98879. if (stack == 'stack') {
  98880. data = dataCombineStack(series, opts.categories.length);
  98881. } else {
  98882. data = dataCombine(series);
  98883. }
  98884. var sorted = [];
  98885. // remove null from data
  98886. data = data.filter(function (item) {
  98887. //return item !== null;
  98888. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  98889. if (item.constructor.toString().indexOf('Array') > -1) {
  98890. return item !== null;
  98891. } else {
  98892. return item.value !== null;
  98893. }
  98894. } else {
  98895. return item !== null;
  98896. }
  98897. });
  98898. data.map(function (item) {
  98899. if ((0, _typeof2.default)(item) === 'object') {
  98900. if (item.constructor.toString().indexOf('Array') > -1) {
  98901. if (opts.type == 'candle') {
  98902. item.map(function (subitem) {
  98903. sorted.push(subitem);
  98904. });
  98905. } else {
  98906. sorted.push(item[0]);
  98907. }
  98908. } else {
  98909. sorted.push(item.value);
  98910. }
  98911. } else {
  98912. sorted.push(item);
  98913. }
  98914. });
  98915. var minData = 0;
  98916. var maxData = 0;
  98917. if (sorted.length > 0) {
  98918. minData = Math.min.apply(this, sorted);
  98919. maxData = Math.max.apply(this, sorted);
  98920. }
  98921. //为了兼容v1.9.0之前的项目
  98922. if (index > -1) {
  98923. if (typeof opts.xAxis.data[index].min === 'number') {
  98924. minData = Math.min(opts.xAxis.data[index].min, minData);
  98925. }
  98926. if (typeof opts.xAxis.data[index].max === 'number') {
  98927. maxData = Math.max(opts.xAxis.data[index].max, maxData);
  98928. }
  98929. } else {
  98930. if (typeof opts.xAxis.min === 'number') {
  98931. minData = Math.min(opts.xAxis.min, minData);
  98932. }
  98933. if (typeof opts.xAxis.max === 'number') {
  98934. maxData = Math.max(opts.xAxis.max, maxData);
  98935. }
  98936. }
  98937. if (minData === maxData) {
  98938. var rangeSpan = maxData || 10;
  98939. maxData += rangeSpan;
  98940. }
  98941. //var dataRange = getDataRange(minData, maxData);
  98942. var minRange = minData;
  98943. var maxRange = maxData;
  98944. var range = [];
  98945. var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
  98946. for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
  98947. range.push(minRange + eachRange * i);
  98948. }
  98949. return range;
  98950. }
  98951. function calXAxisData(series, opts, config, context) {
  98952. //堆叠图重算Y轴
  98953. var columnstyle = assign({}, {
  98954. type: ""
  98955. }, opts.extra.bar);
  98956. var result = {
  98957. angle: 0,
  98958. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  98959. };
  98960. result.ranges = getXAxisTextList(series, opts, config, columnstyle.type);
  98961. result.rangesFormat = result.ranges.map(function (item) {
  98962. //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2);
  98963. item = util.toFixed(item, 2);
  98964. return item;
  98965. });
  98966. var xAxisScaleValues = result.ranges.map(function (item) {
  98967. // 如果刻度值是浮点数,则保留两位小数
  98968. item = util.toFixed(item, 2);
  98969. // 若有自定义格式则调用自定义的格式化函数
  98970. //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item;
  98971. return item;
  98972. });
  98973. result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config));
  98974. // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
  98975. var eachSpacing = result.eachSpacing;
  98976. var textLength = xAxisScaleValues.map(function (item) {
  98977. return measureText(item, opts.xAxis.fontSize * opts.pix, context);
  98978. });
  98979. if (opts.xAxis.disabled === true) {
  98980. result.xAxisHeight = 0;
  98981. }
  98982. return result;
  98983. }
  98984. function getRadarDataPoints(angleList, center, radius, series, opts) {
  98985. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  98986. var radarOption = opts.extra.radar || {};
  98987. radarOption.max = radarOption.max || 0;
  98988. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  98989. var data = [];
  98990. var _loop2 = function _loop2(i) {
  98991. var each = series[i];
  98992. var listItem = {};
  98993. listItem.color = each.color;
  98994. listItem.legendShape = each.legendShape;
  98995. listItem.pointShape = each.pointShape;
  98996. listItem.data = [];
  98997. each.data.forEach(function (item, index) {
  98998. var tmp = {};
  98999. tmp.angle = angleList[index];
  99000. tmp.proportion = item / maxData;
  99001. tmp.value = item;
  99002. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center);
  99003. listItem.data.push(tmp);
  99004. });
  99005. data.push(listItem);
  99006. };
  99007. for (var i = 0; i < series.length; i++) {
  99008. _loop2(i);
  99009. }
  99010. return data;
  99011. }
  99012. function getPieDataPoints(series, radius) {
  99013. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  99014. var count = 0;
  99015. var _start_ = 0;
  99016. for (var i = 0; i < series.length; i++) {
  99017. var item = series[i];
  99018. item.data = item.data === null ? 0 : item.data;
  99019. count += item.data;
  99020. }
  99021. for (var _i9 = 0; _i9 < series.length; _i9++) {
  99022. var _item2 = series[_i9];
  99023. _item2.data = _item2.data === null ? 0 : _item2.data;
  99024. if (count === 0) {
  99025. _item2._proportion_ = 1 / series.length * process;
  99026. } else {
  99027. _item2._proportion_ = _item2.data / count * process;
  99028. }
  99029. _item2._radius_ = radius;
  99030. }
  99031. for (var _i10 = 0; _i10 < series.length; _i10++) {
  99032. var _item3 = series[_i10];
  99033. _item3._start_ = _start_;
  99034. _start_ += 2 * _item3._proportion_ * Math.PI;
  99035. }
  99036. return series;
  99037. }
  99038. function getFunnelDataPoints(series, radius, option, eachSpacing) {
  99039. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  99040. for (var i = 0; i < series.length; i++) {
  99041. if (option.type == 'funnel') {
  99042. series[i].radius = series[i].data / series[0].data * radius * process;
  99043. } else {
  99044. series[i].radius = eachSpacing * (series.length - i) / (eachSpacing * series.length) * radius * process;
  99045. }
  99046. series[i]._proportion_ = series[i].data / series[0].data;
  99047. }
  99048. // if(option.type !== 'pyramid'){
  99049. // series.reverse();
  99050. // }
  99051. return series;
  99052. }
  99053. function getRoseDataPoints(series, type, minRadius, radius) {
  99054. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  99055. var count = 0;
  99056. var _start_ = 0;
  99057. var dataArr = [];
  99058. for (var i = 0; i < series.length; i++) {
  99059. var item = series[i];
  99060. item.data = item.data === null ? 0 : item.data;
  99061. count += item.data;
  99062. dataArr.push(item.data);
  99063. }
  99064. var minData = Math.min.apply(null, dataArr);
  99065. var maxData = Math.max.apply(null, dataArr);
  99066. var radiusLength = radius - minRadius;
  99067. for (var _i11 = 0; _i11 < series.length; _i11++) {
  99068. var _item4 = series[_i11];
  99069. _item4.data = _item4.data === null ? 0 : _item4.data;
  99070. if (count === 0) {
  99071. _item4._proportion_ = 1 / series.length * process;
  99072. _item4._rose_proportion_ = 1 / series.length * process;
  99073. } else {
  99074. _item4._proportion_ = _item4.data / count * process;
  99075. if (type == 'area') {
  99076. _item4._rose_proportion_ = 1 / series.length * process;
  99077. } else {
  99078. _item4._rose_proportion_ = _item4.data / count * process;
  99079. }
  99080. }
  99081. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData)) || radius;
  99082. }
  99083. for (var _i12 = 0; _i12 < series.length; _i12++) {
  99084. var _item5 = series[_i12];
  99085. _item5._start_ = _start_;
  99086. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  99087. }
  99088. return series;
  99089. }
  99090. function getArcbarDataPoints(series, arcbarOption) {
  99091. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  99092. if (process == 1) {
  99093. process = 0.999999;
  99094. }
  99095. for (var i = 0; i < series.length; i++) {
  99096. var item = series[i];
  99097. item.data = item.data === null ? 0 : item.data;
  99098. var totalAngle = void 0;
  99099. if (arcbarOption.type == 'circle') {
  99100. totalAngle = 2;
  99101. } else {
  99102. if (arcbarOption.direction == 'ccw') {
  99103. if (arcbarOption.startAngle < arcbarOption.endAngle) {
  99104. totalAngle = 2 + arcbarOption.startAngle - arcbarOption.endAngle;
  99105. } else {
  99106. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  99107. }
  99108. } else {
  99109. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  99110. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  99111. } else {
  99112. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  99113. }
  99114. }
  99115. }
  99116. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  99117. if (arcbarOption.direction == 'ccw') {
  99118. item._proportion_ = arcbarOption.startAngle - totalAngle * item.data * process;
  99119. }
  99120. if (item._proportion_ >= 2) {
  99121. item._proportion_ = item._proportion_ % 2;
  99122. }
  99123. }
  99124. return series;
  99125. }
  99126. function getGaugeArcbarDataPoints(series, arcbarOption) {
  99127. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  99128. if (process == 1) {
  99129. process = 0.999999;
  99130. }
  99131. for (var i = 0; i < series.length; i++) {
  99132. var item = series[i];
  99133. item.data = item.data === null ? 0 : item.data;
  99134. var totalAngle = void 0;
  99135. if (arcbarOption.type == 'circle') {
  99136. totalAngle = 2;
  99137. } else {
  99138. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  99139. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  99140. } else {
  99141. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  99142. }
  99143. }
  99144. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  99145. if (item._proportion_ >= 2) {
  99146. item._proportion_ = item._proportion_ % 2;
  99147. }
  99148. }
  99149. return series;
  99150. }
  99151. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  99152. var totalAngle;
  99153. if (endAngle < startAngle) {
  99154. totalAngle = 2 + endAngle - startAngle;
  99155. } else {
  99156. totalAngle = startAngle - endAngle;
  99157. }
  99158. var tempStartAngle = startAngle;
  99159. for (var i = 0; i < categories.length; i++) {
  99160. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  99161. categories[i]._startAngle_ = tempStartAngle;
  99162. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  99163. if (categories[i]._endAngle_ >= 2) {
  99164. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  99165. }
  99166. tempStartAngle = categories[i]._endAngle_;
  99167. }
  99168. return categories;
  99169. }
  99170. function getGaugeDataPoints(series, categories, gaugeOption) {
  99171. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  99172. for (var i = 0; i < series.length; i++) {
  99173. var item = series[i];
  99174. item.data = item.data === null ? 0 : item.data;
  99175. if (gaugeOption.pointer.color == 'auto') {
  99176. for (var _i13 = 0; _i13 < categories.length; _i13++) {
  99177. if (item.data <= categories[_i13].value) {
  99178. item.color = categories[_i13].color;
  99179. break;
  99180. }
  99181. }
  99182. } else {
  99183. item.color = gaugeOption.pointer.color;
  99184. }
  99185. var totalAngle = void 0;
  99186. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  99187. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  99188. } else {
  99189. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  99190. }
  99191. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  99192. item._oldAngle_ = gaugeOption.oldAngle;
  99193. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  99194. item._oldAngle_ += 2;
  99195. }
  99196. if (item.data >= gaugeOption.oldData) {
  99197. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  99198. } else {
  99199. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  99200. }
  99201. if (item._proportion_ >= 2) {
  99202. item._proportion_ = item._proportion_ % 2;
  99203. }
  99204. }
  99205. return series;
  99206. }
  99207. function getPieTextMaxLength(series, config, context, opts) {
  99208. series = getPieDataPoints(series);
  99209. var maxLength = 0;
  99210. for (var i = 0; i < series.length; i++) {
  99211. var item = series[i];
  99212. var text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  99213. maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context));
  99214. }
  99215. return maxLength;
  99216. }
  99217. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  99218. return points.map(function (item) {
  99219. if (item === null) {
  99220. return null;
  99221. }
  99222. var seriesGap = 0;
  99223. var categoryGap = 0;
  99224. if (opts.type == 'mix') {
  99225. seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0;
  99226. categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0;
  99227. } else {
  99228. seriesGap = opts.extra.column.seriesGap * opts.pix || 0;
  99229. categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  99230. }
  99231. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  99232. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  99233. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  99234. if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) {
  99235. item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix);
  99236. }
  99237. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  99238. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  99239. }
  99240. if (item.width <= 0) {
  99241. item.width = 1;
  99242. }
  99243. item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  99244. return item;
  99245. });
  99246. }
  99247. function fixBarData(points, eachSpacing, columnLen, index, config, opts) {
  99248. return points.map(function (item) {
  99249. if (item === null) {
  99250. return null;
  99251. }
  99252. var seriesGap = 0;
  99253. var categoryGap = 0;
  99254. seriesGap = opts.extra.bar.seriesGap * opts.pix || 0;
  99255. categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  99256. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  99257. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  99258. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  99259. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  99260. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  99261. }
  99262. if (item.width <= 0) {
  99263. item.width = 1;
  99264. }
  99265. item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  99266. return item;
  99267. });
  99268. }
  99269. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  99270. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  99271. return points.map(function (item) {
  99272. if (item === null) {
  99273. return null;
  99274. }
  99275. item.width = eachSpacing - 2 * categoryGap;
  99276. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  99277. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  99278. }
  99279. if (index > 0) {
  99280. item.width -= border;
  99281. }
  99282. return item;
  99283. });
  99284. }
  99285. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  99286. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  99287. return points.map(function (item, indexn) {
  99288. if (item === null) {
  99289. return null;
  99290. }
  99291. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  99292. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  99293. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  99294. }
  99295. if (item.width <= 0) {
  99296. item.width = 1;
  99297. }
  99298. return item;
  99299. });
  99300. }
  99301. function fixBarStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  99302. var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  99303. return points.map(function (item, indexn) {
  99304. if (item === null) {
  99305. return null;
  99306. }
  99307. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  99308. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  99309. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  99310. }
  99311. if (item.width <= 0) {
  99312. item.width = 1;
  99313. }
  99314. return item;
  99315. });
  99316. }
  99317. function getXAxisPoints(categories, opts, config) {
  99318. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  99319. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  99320. if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  99321. dataCount -= 1;
  99322. }
  99323. var widthRatio = 0;
  99324. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  99325. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  99326. widthRatio = opts.extra.mount.widthRatio - 1;
  99327. dataCount += widthRatio;
  99328. }
  99329. var eachSpacing = spacingValid / dataCount;
  99330. var xAxisPoints = [];
  99331. var startX = opts.area[3];
  99332. var endX = opts.width - opts.area[1];
  99333. categories.forEach(function (item, index) {
  99334. xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing);
  99335. });
  99336. if (opts.xAxis.boundaryGap !== 'justify') {
  99337. if (opts.enableScroll === true) {
  99338. xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing);
  99339. } else {
  99340. xAxisPoints.push(endX);
  99341. }
  99342. }
  99343. return {
  99344. xAxisPoints: xAxisPoints,
  99345. startX: startX,
  99346. endX: endX,
  99347. eachSpacing: eachSpacing
  99348. };
  99349. }
  99350. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  99351. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  99352. var points = [];
  99353. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99354. data.forEach(function (item, index) {
  99355. if (item === null) {
  99356. points.push(null);
  99357. } else {
  99358. var cPoints = [];
  99359. item.forEach(function (items, indexs) {
  99360. var point = {};
  99361. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  99362. var value = items.value || items;
  99363. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99364. height *= process;
  99365. point.y = opts.height - Math.round(height) - opts.area[2];
  99366. cPoints.push(point);
  99367. });
  99368. points.push(cPoints);
  99369. }
  99370. });
  99371. return points;
  99372. }
  99373. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  99374. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  99375. var boundaryGap = 'center';
  99376. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  99377. boundaryGap = opts.xAxis.boundaryGap;
  99378. }
  99379. var points = [];
  99380. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99381. var validWidth = opts.width - opts.area[1] - opts.area[3];
  99382. data.forEach(function (item, index) {
  99383. if (item === null) {
  99384. points.push(null);
  99385. } else {
  99386. var point = {};
  99387. point.color = item.color;
  99388. point.x = xAxisPoints[index];
  99389. var value = item;
  99390. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99391. if (item.constructor.toString().indexOf('Array') > -1) {
  99392. var xranges, xminRange, xmaxRange;
  99393. xranges = [].concat(opts.chartData.xAxisData.ranges);
  99394. xminRange = xranges.shift();
  99395. xmaxRange = xranges.pop();
  99396. value = item[1];
  99397. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  99398. if (opts.type == 'bubble') {
  99399. point.r = item[2];
  99400. point.t = item[3];
  99401. }
  99402. } else {
  99403. value = item.value;
  99404. }
  99405. }
  99406. if (boundaryGap == 'center') {
  99407. point.x += eachSpacing / 2;
  99408. }
  99409. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99410. height *= process;
  99411. point.y = opts.height - height - opts.area[2];
  99412. points.push(point);
  99413. }
  99414. });
  99415. return points;
  99416. }
  99417. function getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process) {
  99418. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  99419. var boundaryGap = opts.xAxis.boundaryGap;
  99420. var points = [];
  99421. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99422. var validWidth = opts.width - opts.area[1] - opts.area[3];
  99423. data.forEach(function (item, index) {
  99424. if (item === null) {
  99425. points.push(null);
  99426. } else {
  99427. var point = {};
  99428. point.color = item.color;
  99429. if (lineOption.animation == 'vertical') {
  99430. point.x = xAxisPoints[index];
  99431. var value = item;
  99432. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99433. if (item.constructor.toString().indexOf('Array') > -1) {
  99434. var xranges, xminRange, xmaxRange;
  99435. xranges = [].concat(opts.chartData.xAxisData.ranges);
  99436. xminRange = xranges.shift();
  99437. xmaxRange = xranges.pop();
  99438. value = item[1];
  99439. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  99440. } else {
  99441. value = item.value;
  99442. }
  99443. }
  99444. if (boundaryGap == 'center') {
  99445. point.x += eachSpacing / 2;
  99446. }
  99447. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99448. height *= process;
  99449. point.y = opts.height - height - opts.area[2];
  99450. points.push(point);
  99451. } else {
  99452. point.x = xAxisPoints[0] + eachSpacing * index * process;
  99453. var value = item;
  99454. if (boundaryGap == 'center') {
  99455. point.x += eachSpacing / 2;
  99456. }
  99457. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99458. point.y = opts.height - height - opts.area[2];
  99459. points.push(point);
  99460. }
  99461. }
  99462. });
  99463. return points;
  99464. }
  99465. function getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process) {
  99466. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  99467. var points = [];
  99468. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99469. var validWidth = opts.width - opts.area[1] - opts.area[3];
  99470. data.forEach(function (item, index) {
  99471. if (item === null) {
  99472. points.push(null);
  99473. } else {
  99474. var point = {};
  99475. point.color = item.color;
  99476. point.x = xAxisPoints[index];
  99477. var value = item;
  99478. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99479. if (item.constructor.toString().indexOf('Array') > -1) {
  99480. var xranges, xminRange, xmaxRange;
  99481. xranges = [].concat(opts.chartData.xAxisData.ranges);
  99482. xminRange = xranges.shift();
  99483. xmaxRange = xranges.pop();
  99484. value = item[1];
  99485. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  99486. } else {
  99487. value = item.value;
  99488. }
  99489. }
  99490. point.x += eachSpacing / 2;
  99491. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  99492. point.y = opts.height - height - opts.area[2];
  99493. points.push(point);
  99494. }
  99495. });
  99496. return points;
  99497. }
  99498. function getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints) {
  99499. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  99500. var points = [];
  99501. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99502. var validWidth = opts.width - opts.area[1] - opts.area[3];
  99503. var mountWidth = eachSpacing * mountOption.widthRatio;
  99504. series.forEach(function (item, index) {
  99505. if (item === null) {
  99506. points.push(null);
  99507. } else {
  99508. var point = {};
  99509. point.color = item.color;
  99510. point.x = xAxisPoints[index];
  99511. point.x += eachSpacing / 2;
  99512. var value = item.data;
  99513. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  99514. point.y = opts.height - height - opts.area[2];
  99515. point.value = value;
  99516. point.width = mountWidth;
  99517. points.push(point);
  99518. }
  99519. });
  99520. return points;
  99521. }
  99522. function getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) {
  99523. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  99524. var points = [];
  99525. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99526. var validWidth = opts.width - opts.area[1] - opts.area[3];
  99527. data.forEach(function (item, index) {
  99528. if (item === null) {
  99529. points.push(null);
  99530. } else {
  99531. var point = {};
  99532. point.color = item.color;
  99533. point.y = yAxisPoints[index];
  99534. var value = item;
  99535. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99536. value = item.value;
  99537. }
  99538. var height = validWidth * (value - minRange) / (maxRange - minRange);
  99539. height *= process;
  99540. point.height = height;
  99541. point.value = value;
  99542. point.x = height + opts.area[3];
  99543. points.push(point);
  99544. }
  99545. });
  99546. return points;
  99547. }
  99548. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  99549. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  99550. var points = [];
  99551. var validHeight = opts.height - opts.area[0] - opts.area[2];
  99552. data.forEach(function (item, index) {
  99553. if (item === null) {
  99554. points.push(null);
  99555. } else {
  99556. var point = {};
  99557. point.color = item.color;
  99558. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  99559. if (seriesIndex > 0) {
  99560. var value = 0;
  99561. for (var i = 0; i <= seriesIndex; i++) {
  99562. value += stackSeries[i].data[index];
  99563. }
  99564. var value0 = value - item;
  99565. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99566. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  99567. } else {
  99568. var value = item;
  99569. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99570. value = item.value;
  99571. }
  99572. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99573. var height0 = 0;
  99574. }
  99575. var heightc = height0;
  99576. height *= process;
  99577. heightc *= process;
  99578. point.y = opts.height - Math.round(height) - opts.area[2];
  99579. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  99580. points.push(point);
  99581. }
  99582. });
  99583. return points;
  99584. }
  99585. function getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  99586. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  99587. var points = [];
  99588. var validHeight = opts.width - opts.area[1] - opts.area[3];
  99589. data.forEach(function (item, index) {
  99590. if (item === null) {
  99591. points.push(null);
  99592. } else {
  99593. var point = {};
  99594. point.color = item.color;
  99595. point.y = yAxisPoints[index];
  99596. if (seriesIndex > 0) {
  99597. var value = 0;
  99598. for (var i = 0; i <= seriesIndex; i++) {
  99599. value += stackSeries[i].data[index];
  99600. }
  99601. var value0 = value - item;
  99602. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99603. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  99604. } else {
  99605. var value = item;
  99606. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99607. value = item.value;
  99608. }
  99609. var height = validHeight * (value - minRange) / (maxRange - minRange);
  99610. var height0 = 0;
  99611. }
  99612. var heightc = height0;
  99613. height *= process;
  99614. heightc *= process;
  99615. point.height = height - heightc;
  99616. point.x = opts.area[3] + height;
  99617. point.x0 = opts.area[3] + heightc;
  99618. points.push(point);
  99619. }
  99620. });
  99621. return points;
  99622. }
  99623. function getYAxisTextList(series, opts, config, stack, yData) {
  99624. var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
  99625. var data;
  99626. if (stack == 'stack') {
  99627. data = dataCombineStack(series, opts.categories.length);
  99628. } else {
  99629. data = dataCombine(series);
  99630. }
  99631. var sorted = [];
  99632. // remove null from data
  99633. data = data.filter(function (item) {
  99634. //return item !== null;
  99635. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  99636. if (item.constructor.toString().indexOf('Array') > -1) {
  99637. return item !== null;
  99638. } else {
  99639. return item.value !== null;
  99640. }
  99641. } else {
  99642. return item !== null;
  99643. }
  99644. });
  99645. data.map(function (item) {
  99646. if ((0, _typeof2.default)(item) === 'object') {
  99647. if (item.constructor.toString().indexOf('Array') > -1) {
  99648. if (opts.type == 'candle') {
  99649. item.map(function (subitem) {
  99650. sorted.push(subitem);
  99651. });
  99652. } else {
  99653. sorted.push(item[1]);
  99654. }
  99655. } else {
  99656. sorted.push(item.value);
  99657. }
  99658. } else {
  99659. sorted.push(item);
  99660. }
  99661. });
  99662. var minData = yData.min || 0;
  99663. var maxData = yData.max || 0;
  99664. if (sorted.length > 0) {
  99665. minData = Math.min.apply(this, sorted);
  99666. maxData = Math.max.apply(this, sorted);
  99667. }
  99668. if (minData === maxData) {
  99669. if (maxData == 0) {
  99670. maxData = 10;
  99671. } else {
  99672. minData = 0;
  99673. }
  99674. }
  99675. var dataRange = getDataRange(minData, maxData);
  99676. var minRange = yData.min === undefined || yData.min === null ? dataRange.minRange : yData.min;
  99677. var maxRange = yData.max === undefined || yData.max === null ? dataRange.maxRange : yData.max;
  99678. var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
  99679. var range = [];
  99680. for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
  99681. range.push(minRange + eachRange * i);
  99682. }
  99683. return range.reverse();
  99684. }
  99685. function calYAxisData(series, opts, config, context) {
  99686. //堆叠图重算Y轴
  99687. var columnstyle = assign({}, {
  99688. type: ""
  99689. }, opts.extra.column);
  99690. //如果是多Y轴,重新计算
  99691. var YLength = opts.yAxis.data.length;
  99692. var newSeries = new Array(YLength);
  99693. if (YLength > 0) {
  99694. for (var i = 0; i < YLength; i++) {
  99695. newSeries[i] = [];
  99696. for (var j = 0; j < series.length; j++) {
  99697. if (series[j].index == i) {
  99698. newSeries[i].push(series[j]);
  99699. }
  99700. }
  99701. }
  99702. var rangesArr = new Array(YLength);
  99703. var rangesFormatArr = new Array(YLength);
  99704. var yAxisWidthArr = new Array(YLength);
  99705. var _loop3 = function _loop3(_i14) {
  99706. var yData = opts.yAxis.data[_i14];
  99707. //如果总开关不显示,强制每个Y轴为不显示
  99708. if (opts.yAxis.disabled == true) {
  99709. yData.disabled = true;
  99710. }
  99711. if (yData.type === 'categories') {
  99712. if (!yData.formatter) {
  99713. yData.formatter = function (val, index, opts) {
  99714. return val + (yData.unit || '');
  99715. };
  99716. }
  99717. yData.categories = yData.categories || opts.categories;
  99718. rangesArr[_i14] = yData.categories;
  99719. } else {
  99720. if (!yData.formatter) {
  99721. yData.formatter = function (val, index, opts) {
  99722. return util.toFixed(val, yData.tofix || 0) + (yData.unit || '');
  99723. };
  99724. }
  99725. rangesArr[_i14] = getYAxisTextList(newSeries[_i14], opts, config, columnstyle.type, yData, _i14);
  99726. }
  99727. var yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize;
  99728. yAxisWidthArr[_i14] = {
  99729. position: yData.position ? yData.position : 'left',
  99730. width: 0
  99731. };
  99732. rangesFormatArr[_i14] = rangesArr[_i14].map(function (items, index) {
  99733. items = yData.formatter(items, index, opts);
  99734. yAxisWidthArr[_i14].width = Math.max(yAxisWidthArr[_i14].width, measureText(items, yAxisFontSizes, context) + 5);
  99735. return items;
  99736. });
  99737. var calibration = yData.calibration ? 4 * opts.pix : 0;
  99738. yAxisWidthArr[_i14].width += calibration + 3 * opts.pix;
  99739. if (yData.disabled === true) {
  99740. yAxisWidthArr[_i14].width = 0;
  99741. }
  99742. };
  99743. for (var _i14 = 0; _i14 < YLength; _i14++) {
  99744. _loop3(_i14);
  99745. }
  99746. } else {
  99747. var rangesArr = new Array(1);
  99748. var rangesFormatArr = new Array(1);
  99749. var yAxisWidthArr = new Array(1);
  99750. if (opts.type === 'bar') {
  99751. rangesArr[0] = opts.categories;
  99752. if (!opts.yAxis.formatter) {
  99753. opts.yAxis.formatter = function (val, index, opts) {
  99754. return val + (opts.yAxis.unit || '');
  99755. };
  99756. }
  99757. } else {
  99758. if (!opts.yAxis.formatter) {
  99759. opts.yAxis.formatter = function (val, index, opts) {
  99760. return val.toFixed(opts.yAxis.tofix) + (opts.yAxis.unit || '');
  99761. };
  99762. }
  99763. rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {});
  99764. }
  99765. yAxisWidthArr[0] = {
  99766. position: 'left',
  99767. width: 0
  99768. };
  99769. var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize;
  99770. rangesFormatArr[0] = rangesArr[0].map(function (item, index) {
  99771. item = opts.yAxis.formatter(item, index, opts);
  99772. yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, context) + 5);
  99773. return item;
  99774. });
  99775. yAxisWidthArr[0].width += 3 * opts.pix;
  99776. if (opts.yAxis.disabled === true) {
  99777. yAxisWidthArr[0] = {
  99778. position: 'left',
  99779. width: 0
  99780. };
  99781. opts.yAxis.data[0] = {
  99782. disabled: true
  99783. };
  99784. } else {
  99785. opts.yAxis.data[0] = {
  99786. disabled: false,
  99787. position: 'left',
  99788. max: opts.yAxis.max,
  99789. min: opts.yAxis.min,
  99790. formatter: opts.yAxis.formatter
  99791. };
  99792. if (opts.type === 'bar') {
  99793. opts.yAxis.data[0].categories = opts.categories;
  99794. opts.yAxis.data[0].type = 'categories';
  99795. }
  99796. }
  99797. }
  99798. return {
  99799. rangesFormat: rangesFormatArr,
  99800. ranges: rangesArr,
  99801. yAxisWidth: yAxisWidthArr
  99802. };
  99803. }
  99804. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  99805. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  99806. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  99807. var minAxis = opts.area[0];
  99808. var items = [];
  99809. for (var i = 0; i < ranges.length; i++) {
  99810. var maxVal = Math.max.apply(this, ranges[i]);
  99811. var minVal = Math.min.apply(this, ranges[i]);
  99812. var item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
  99813. item = opts.yAxis.data && opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item, i, opts) : item.toFixed(0);
  99814. items.push(String(item));
  99815. }
  99816. return items;
  99817. }
  99818. function calMarkLineData(points, opts) {
  99819. var minRange, maxRange;
  99820. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  99821. for (var i = 0; i < points.length; i++) {
  99822. points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0;
  99823. var range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
  99824. minRange = range.pop();
  99825. maxRange = range.shift();
  99826. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  99827. points[i].y = opts.height - Math.round(height) - opts.area[2];
  99828. }
  99829. return points;
  99830. }
  99831. function contextRotate(context, opts) {
  99832. if (opts.rotateLock !== true) {
  99833. context.translate(opts.height, 0);
  99834. context.rotate(90 * Math.PI / 180);
  99835. } else if (opts._rotate_ !== true) {
  99836. context.translate(opts.height, 0);
  99837. context.rotate(90 * Math.PI / 180);
  99838. opts._rotate_ = true;
  99839. }
  99840. }
  99841. function drawPointShape(points, color, shape, context, opts) {
  99842. context.beginPath();
  99843. if (opts.dataPointShapeType == 'hollow') {
  99844. context.setStrokeStyle(color);
  99845. context.setFillStyle(opts.background);
  99846. context.setLineWidth(2 * opts.pix);
  99847. } else {
  99848. context.setStrokeStyle("#ffffff");
  99849. context.setFillStyle(color);
  99850. context.setLineWidth(1 * opts.pix);
  99851. }
  99852. if (shape === 'diamond') {
  99853. points.forEach(function (item, index) {
  99854. if (item !== null) {
  99855. context.moveTo(item.x, item.y - 4.5);
  99856. context.lineTo(item.x - 4.5, item.y);
  99857. context.lineTo(item.x, item.y + 4.5);
  99858. context.lineTo(item.x + 4.5, item.y);
  99859. context.lineTo(item.x, item.y - 4.5);
  99860. }
  99861. });
  99862. } else if (shape === 'circle') {
  99863. points.forEach(function (item, index) {
  99864. if (item !== null) {
  99865. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  99866. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  99867. }
  99868. });
  99869. } else if (shape === 'square') {
  99870. points.forEach(function (item, index) {
  99871. if (item !== null) {
  99872. context.moveTo(item.x - 3.5, item.y - 3.5);
  99873. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  99874. }
  99875. });
  99876. } else if (shape === 'triangle') {
  99877. points.forEach(function (item, index) {
  99878. if (item !== null) {
  99879. context.moveTo(item.x, item.y - 4.5);
  99880. context.lineTo(item.x - 4.5, item.y + 4.5);
  99881. context.lineTo(item.x + 4.5, item.y + 4.5);
  99882. context.lineTo(item.x, item.y - 4.5);
  99883. }
  99884. });
  99885. } else if (shape === 'none') {
  99886. return;
  99887. }
  99888. context.closePath();
  99889. context.fill();
  99890. context.stroke();
  99891. }
  99892. function drawActivePoint(points, color, shape, context, opts, option, seriesIndex) {
  99893. if (!opts.tooltip) {
  99894. return;
  99895. }
  99896. if (opts.tooltip.group.length > 0 && opts.tooltip.group.includes(seriesIndex) == false) {
  99897. return;
  99898. }
  99899. var pointIndex = typeof opts.tooltip.index === 'number' ? opts.tooltip.index : opts.tooltip.index[opts.tooltip.group.indexOf(seriesIndex)];
  99900. context.beginPath();
  99901. if (option.activeType == 'hollow') {
  99902. context.setStrokeStyle(color);
  99903. context.setFillStyle(opts.background);
  99904. context.setLineWidth(2 * opts.pix);
  99905. } else {
  99906. context.setStrokeStyle("#ffffff");
  99907. context.setFillStyle(color);
  99908. context.setLineWidth(1 * opts.pix);
  99909. }
  99910. if (shape === 'diamond') {
  99911. points.forEach(function (item, index) {
  99912. if (item !== null && pointIndex == index) {
  99913. context.moveTo(item.x, item.y - 4.5);
  99914. context.lineTo(item.x - 4.5, item.y);
  99915. context.lineTo(item.x, item.y + 4.5);
  99916. context.lineTo(item.x + 4.5, item.y);
  99917. context.lineTo(item.x, item.y - 4.5);
  99918. }
  99919. });
  99920. } else if (shape === 'circle') {
  99921. points.forEach(function (item, index) {
  99922. if (item !== null && pointIndex == index) {
  99923. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  99924. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  99925. }
  99926. });
  99927. } else if (shape === 'square') {
  99928. points.forEach(function (item, index) {
  99929. if (item !== null && pointIndex == index) {
  99930. context.moveTo(item.x - 3.5, item.y - 3.5);
  99931. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  99932. }
  99933. });
  99934. } else if (shape === 'triangle') {
  99935. points.forEach(function (item, index) {
  99936. if (item !== null && pointIndex == index) {
  99937. context.moveTo(item.x, item.y - 4.5);
  99938. context.lineTo(item.x - 4.5, item.y + 4.5);
  99939. context.lineTo(item.x + 4.5, item.y + 4.5);
  99940. context.lineTo(item.x, item.y - 4.5);
  99941. }
  99942. });
  99943. } else if (shape === 'none') {
  99944. return;
  99945. }
  99946. context.closePath();
  99947. context.fill();
  99948. context.stroke();
  99949. }
  99950. function drawRingTitle(opts, config, context, center) {
  99951. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  99952. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  99953. var title = opts.title.name || '';
  99954. var subtitle = opts.subtitle.name || '';
  99955. var titleFontColor = opts.title.color || opts.fontColor;
  99956. var subtitleFontColor = opts.subtitle.color || opts.fontColor;
  99957. var titleHeight = title ? titlefontSize : 0;
  99958. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  99959. var margin = 5;
  99960. if (subtitle) {
  99961. var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context);
  99962. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix;
  99963. var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix;
  99964. if (title) {
  99965. startY += (titleHeight * opts.pix + margin) / 2;
  99966. }
  99967. context.beginPath();
  99968. context.setFontSize(subtitlefontSize * opts.pix);
  99969. context.setFillStyle(subtitleFontColor);
  99970. context.fillText(subtitle, startX, startY);
  99971. context.closePath();
  99972. context.stroke();
  99973. }
  99974. if (title) {
  99975. var _textWidth = measureText(title, titlefontSize * opts.pix, context);
  99976. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  99977. var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix;
  99978. if (subtitle) {
  99979. _startY -= (subtitleHeight * opts.pix + margin) / 2;
  99980. }
  99981. context.beginPath();
  99982. context.setFontSize(titlefontSize * opts.pix);
  99983. context.setFillStyle(titleFontColor);
  99984. context.fillText(title, _startX, _startY);
  99985. context.closePath();
  99986. context.stroke();
  99987. }
  99988. }
  99989. function drawPointText(points, series, config, context, opts) {
  99990. // 绘制数据文案
  99991. var data = series.data;
  99992. var textOffset = series.textOffset ? series.textOffset : 0;
  99993. points.forEach(function (item, index) {
  99994. if (item !== null) {
  99995. context.beginPath();
  99996. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  99997. context.setFontSize(fontSize);
  99998. context.setFillStyle(series.textColor || opts.fontColor);
  99999. var value = data[index];
  100000. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  100001. if (data[index].constructor.toString().indexOf('Array') > -1) {
  100002. value = data[index][1];
  100003. } else {
  100004. value = data[index].value;
  100005. }
  100006. }
  100007. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  100008. context.setTextAlign('center');
  100009. context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
  100010. context.closePath();
  100011. context.stroke();
  100012. context.setTextAlign('left');
  100013. }
  100014. });
  100015. }
  100016. function drawColumePointText(points, series, config, context, opts) {
  100017. // 绘制数据文案
  100018. var data = series.data;
  100019. var textOffset = series.textOffset ? series.textOffset : 0;
  100020. var Position = opts.extra.column.labelPosition;
  100021. points.forEach(function (item, index) {
  100022. if (item !== null) {
  100023. context.beginPath();
  100024. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  100025. context.setFontSize(fontSize);
  100026. context.setFillStyle(series.textColor || opts.fontColor);
  100027. var value = data[index];
  100028. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  100029. if (data[index].constructor.toString().indexOf('Array') > -1) {
  100030. value = data[index][1];
  100031. } else {
  100032. value = data[index].value;
  100033. }
  100034. }
  100035. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  100036. context.setTextAlign('center');
  100037. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  100038. if (item.y > series.zeroPoints) {
  100039. startY = item.y + textOffset * opts.pix + fontSize;
  100040. }
  100041. if (Position == 'insideTop') {
  100042. startY = item.y + fontSize + textOffset * opts.pix;
  100043. if (item.y > series.zeroPoints) {
  100044. startY = item.y - textOffset * opts.pix - 4 * opts.pix;
  100045. }
  100046. }
  100047. if (Position == 'center') {
  100048. startY = item.y + textOffset * opts.pix + (opts.height - opts.area[2] - item.y + fontSize) / 2;
  100049. if (series.zeroPoints < opts.height - opts.area[2]) {
  100050. startY = item.y + textOffset * opts.pix + (series.zeroPoints - item.y + fontSize) / 2;
  100051. }
  100052. if (item.y > series.zeroPoints) {
  100053. startY = item.y - textOffset * opts.pix - (item.y - series.zeroPoints - fontSize) / 2;
  100054. }
  100055. if (opts.extra.column.type == 'stack') {
  100056. startY = item.y + textOffset * opts.pix + (item.y0 - item.y + fontSize) / 2;
  100057. }
  100058. }
  100059. if (Position == 'bottom') {
  100060. startY = opts.height - opts.area[2] + textOffset * opts.pix - 4 * opts.pix;
  100061. if (series.zeroPoints < opts.height - opts.area[2]) {
  100062. startY = series.zeroPoints + textOffset * opts.pix - 4 * opts.pix;
  100063. }
  100064. if (item.y > series.zeroPoints) {
  100065. startY = series.zeroPoints - textOffset * opts.pix + fontSize + 2 * opts.pix;
  100066. }
  100067. if (opts.extra.column.type == 'stack') {
  100068. startY = item.y0 + textOffset * opts.pix - 4 * opts.pix;
  100069. }
  100070. }
  100071. context.fillText(String(formatVal), item.x, startY);
  100072. context.closePath();
  100073. context.stroke();
  100074. context.setTextAlign('left');
  100075. }
  100076. });
  100077. }
  100078. function drawMountPointText(points, series, config, context, opts, zeroPoints) {
  100079. // 绘制数据文案
  100080. var data = series.data;
  100081. var textOffset = series.textOffset ? series.textOffset : 0;
  100082. var Position = opts.extra.mount.labelPosition;
  100083. points.forEach(function (item, index) {
  100084. if (item !== null) {
  100085. context.beginPath();
  100086. var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize;
  100087. context.setFontSize(fontSize);
  100088. context.setFillStyle(series[index].textColor || opts.fontColor);
  100089. var value = item.value;
  100090. var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : value;
  100091. context.setTextAlign('center');
  100092. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  100093. if (item.y > zeroPoints) {
  100094. startY = item.y + textOffset * opts.pix + fontSize;
  100095. }
  100096. context.fillText(String(formatVal), item.x, startY);
  100097. context.closePath();
  100098. context.stroke();
  100099. context.setTextAlign('left');
  100100. }
  100101. });
  100102. }
  100103. function drawBarPointText(points, series, config, context, opts) {
  100104. // 绘制数据文案
  100105. var data = series.data;
  100106. var textOffset = series.textOffset ? series.textOffset : 0;
  100107. points.forEach(function (item, index) {
  100108. if (item !== null) {
  100109. context.beginPath();
  100110. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  100111. context.setFontSize(fontSize);
  100112. context.setFillStyle(series.textColor || opts.fontColor);
  100113. var value = data[index];
  100114. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  100115. value = data[index].value;
  100116. }
  100117. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  100118. context.setTextAlign('left');
  100119. context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3);
  100120. context.closePath();
  100121. context.stroke();
  100122. }
  100123. });
  100124. }
  100125. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  100126. radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix;
  100127. radius = radius < 10 ? 10 : radius;
  100128. var totalAngle;
  100129. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  100130. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  100131. } else {
  100132. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  100133. }
  100134. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  100135. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  100136. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  100137. var nowAngle = gaugeOption.startAngle;
  100138. var nowNumber = gaugeOption.startNumber;
  100139. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  100140. var pos = {
  100141. x: radius * Math.cos(nowAngle * Math.PI),
  100142. y: radius * Math.sin(nowAngle * Math.PI)
  100143. };
  100144. var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber;
  100145. pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2;
  100146. pos.y += centerPosition.y;
  100147. var startX = pos.x;
  100148. var startY = pos.y;
  100149. context.beginPath();
  100150. context.setFontSize(config.fontSize);
  100151. context.setFillStyle(gaugeOption.labelColor || opts.fontColor);
  100152. context.fillText(labelText, startX, startY + config.fontSize / 2);
  100153. context.closePath();
  100154. context.stroke();
  100155. nowAngle += splitAngle;
  100156. if (nowAngle >= 2) {
  100157. nowAngle = nowAngle % 2;
  100158. }
  100159. nowNumber += splitNumber;
  100160. }
  100161. }
  100162. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  100163. var radarOption = opts.extra.radar || {};
  100164. angleList.forEach(function (angle, index) {
  100165. if (radarOption.labelPointShow === true && opts.categories[index] !== '') {
  100166. var posPoint = {
  100167. x: radius * Math.cos(angle),
  100168. y: radius * Math.sin(angle)
  100169. };
  100170. var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition);
  100171. context.setFillStyle(radarOption.labelPointColor);
  100172. context.beginPath();
  100173. context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, false);
  100174. context.closePath();
  100175. context.fill();
  100176. }
  100177. if (radarOption.labelShow === true) {
  100178. var pos = {
  100179. x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle),
  100180. y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle)
  100181. };
  100182. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  100183. var startX = posRelativeCanvas.x;
  100184. var startY = posRelativeCanvas.y;
  100185. if (util.approximatelyEqual(pos.x, 0)) {
  100186. startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2;
  100187. } else if (pos.x < 0) {
  100188. startX -= measureText(opts.categories[index] || '', config.fontSize, context);
  100189. }
  100190. context.beginPath();
  100191. context.setFontSize(config.fontSize);
  100192. context.setFillStyle(radarOption.labelColor || opts.fontColor);
  100193. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  100194. context.closePath();
  100195. context.stroke();
  100196. }
  100197. });
  100198. }
  100199. function drawPieText(series, opts, config, context, radius, center) {
  100200. var lineRadius = config.pieChartLinePadding;
  100201. var textObjectCollection = [];
  100202. var lastTextObject = null;
  100203. var seriesConvert = series.map(function (item, index) {
  100204. var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  100205. text = item.labelText ? item.labelText : text;
  100206. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  100207. if (item._rose_proportion_) {
  100208. arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2);
  100209. }
  100210. var color = item.color;
  100211. var radius = item._radius_;
  100212. return {
  100213. arc: arc,
  100214. text: text,
  100215. color: color,
  100216. radius: radius,
  100217. textColor: item.textColor,
  100218. textSize: item.textSize,
  100219. labelShow: item.labelShow
  100220. };
  100221. });
  100222. for (var i = 0; i < seriesConvert.length; i++) {
  100223. var item = seriesConvert[i];
  100224. // line end
  100225. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  100226. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  100227. // line start
  100228. var orginX2 = Math.cos(item.arc) * item.radius;
  100229. var orginY2 = Math.sin(item.arc) * item.radius;
  100230. // text start
  100231. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  100232. var orginY3 = orginY1;
  100233. var textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context);
  100234. var startY = orginY3;
  100235. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  100236. x: orginX3
  100237. })) {
  100238. if (orginX3 > 0) {
  100239. startY = Math.min(orginY3, lastTextObject.start.y);
  100240. } else if (orginX1 < 0) {
  100241. startY = Math.max(orginY3, lastTextObject.start.y);
  100242. } else {
  100243. if (orginY3 > 0) {
  100244. startY = Math.max(orginY3, lastTextObject.start.y);
  100245. } else {
  100246. startY = Math.min(orginY3, lastTextObject.start.y);
  100247. }
  100248. }
  100249. }
  100250. if (orginX3 < 0) {
  100251. orginX3 -= textWidth;
  100252. }
  100253. var textObject = {
  100254. lineStart: {
  100255. x: orginX2,
  100256. y: orginY2
  100257. },
  100258. lineEnd: {
  100259. x: orginX1,
  100260. y: orginY1
  100261. },
  100262. start: {
  100263. x: orginX3,
  100264. y: startY
  100265. },
  100266. width: textWidth,
  100267. height: config.fontSize,
  100268. text: item.text,
  100269. color: item.color,
  100270. textColor: item.textColor,
  100271. textSize: item.textSize
  100272. };
  100273. lastTextObject = avoidCollision(textObject, lastTextObject);
  100274. textObjectCollection.push(lastTextObject);
  100275. }
  100276. for (var _i15 = 0; _i15 < textObjectCollection.length; _i15++) {
  100277. if (seriesConvert[_i15].labelShow === false) {
  100278. continue;
  100279. }
  100280. var _item6 = textObjectCollection[_i15];
  100281. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  100282. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  100283. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  100284. context.setLineWidth(1 * opts.pix);
  100285. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  100286. context.beginPath();
  100287. context.setStrokeStyle(_item6.color);
  100288. context.setFillStyle(_item6.color);
  100289. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  100290. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  100291. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  100292. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  100293. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  100294. context.stroke();
  100295. context.closePath();
  100296. context.beginPath();
  100297. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  100298. context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI);
  100299. context.closePath();
  100300. context.fill();
  100301. context.beginPath();
  100302. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  100303. context.setFillStyle(_item6.textColor || opts.fontColor);
  100304. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  100305. context.closePath();
  100306. context.stroke();
  100307. context.closePath();
  100308. }
  100309. }
  100310. function drawToolTipSplitLine(offsetX, opts, config, context) {
  100311. var toolTipOption = opts.extra.tooltip || {};
  100312. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  100313. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  100314. var startY = opts.area[0];
  100315. var endY = opts.height - opts.area[2];
  100316. if (toolTipOption.gridType == 'dash') {
  100317. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  100318. }
  100319. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  100320. context.setLineWidth(1 * opts.pix);
  100321. context.beginPath();
  100322. context.moveTo(offsetX, startY);
  100323. context.lineTo(offsetX, endY);
  100324. context.stroke();
  100325. context.setLineDash([]);
  100326. if (toolTipOption.xAxisLabel) {
  100327. var labelText = opts.categories[opts.tooltip.index];
  100328. context.setFontSize(config.fontSize);
  100329. var textWidth = measureText(labelText, config.fontSize, context);
  100330. var textX = offsetX - 0.5 * textWidth;
  100331. var textY = endY + 2 * opts.pix;
  100332. context.beginPath();
  100333. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  100334. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  100335. context.setLineWidth(1 * opts.pix);
  100336. context.rect(textX - toolTipOption.boxPadding * opts.pix, textY, textWidth + 2 * toolTipOption.boxPadding * opts.pix, config.fontSize + 2 * toolTipOption.boxPadding * opts.pix);
  100337. context.closePath();
  100338. context.stroke();
  100339. context.fill();
  100340. context.beginPath();
  100341. context.setFontSize(config.fontSize);
  100342. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  100343. context.fillText(String(labelText), textX, textY + toolTipOption.boxPadding * opts.pix + config.fontSize);
  100344. context.closePath();
  100345. context.stroke();
  100346. }
  100347. }
  100348. function drawMarkLine(opts, config, context) {
  100349. var markLineOption = assign({}, {
  100350. type: 'solid',
  100351. dashLength: 4,
  100352. data: []
  100353. }, opts.extra.markLine);
  100354. var startX = opts.area[3];
  100355. var endX = opts.width - opts.area[1];
  100356. var points = calMarkLineData(markLineOption.data, opts);
  100357. for (var i = 0; i < points.length; i++) {
  100358. var item = assign({}, {
  100359. lineColor: '#DE4A42',
  100360. showLabel: false,
  100361. labelFontSize: 13,
  100362. labelPadding: 6,
  100363. labelFontColor: '#666666',
  100364. labelBgColor: '#DFE8FF',
  100365. labelBgOpacity: 0.8,
  100366. labelAlign: 'left',
  100367. labelOffsetX: 0,
  100368. labelOffsetY: 0
  100369. }, points[i]);
  100370. if (markLineOption.type == 'dash') {
  100371. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  100372. }
  100373. context.setStrokeStyle(item.lineColor);
  100374. context.setLineWidth(1 * opts.pix);
  100375. context.beginPath();
  100376. context.moveTo(startX, item.y);
  100377. context.lineTo(endX, item.y);
  100378. context.stroke();
  100379. context.setLineDash([]);
  100380. if (item.showLabel) {
  100381. var fontSize = item.labelFontSize * opts.pix;
  100382. var labelText = item.labelText ? item.labelText : item.value;
  100383. context.setFontSize(fontSize);
  100384. var textWidth = measureText(labelText, fontSize, context);
  100385. var bgWidth = textWidth + item.labelPadding * opts.pix * 2;
  100386. var bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1];
  100387. bgStartX += item.labelOffsetX;
  100388. var bgStartY = item.y - 0.5 * fontSize - item.labelPadding * opts.pix;
  100389. bgStartY += item.labelOffsetY;
  100390. var textX = bgStartX + item.labelPadding * opts.pix;
  100391. var textY = item.y;
  100392. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  100393. context.setStrokeStyle(item.labelBgColor);
  100394. context.setLineWidth(1 * opts.pix);
  100395. context.beginPath();
  100396. context.rect(bgStartX, bgStartY, bgWidth, fontSize + 2 * item.labelPadding * opts.pix);
  100397. context.closePath();
  100398. context.stroke();
  100399. context.fill();
  100400. context.setFontSize(fontSize);
  100401. context.setTextAlign('left');
  100402. context.setFillStyle(item.labelFontColor);
  100403. context.fillText(String(labelText), textX, bgStartY + fontSize + item.labelPadding * opts.pix / 2);
  100404. context.stroke();
  100405. context.setTextAlign('left');
  100406. }
  100407. }
  100408. }
  100409. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  100410. var toolTipOption = assign({}, {
  100411. gridType: 'solid',
  100412. dashLength: 4
  100413. }, opts.extra.tooltip);
  100414. var startX = opts.area[3];
  100415. var endX = opts.width - opts.area[1];
  100416. if (toolTipOption.gridType == 'dash') {
  100417. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  100418. }
  100419. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  100420. context.setLineWidth(1 * opts.pix);
  100421. context.beginPath();
  100422. context.moveTo(startX, opts.tooltip.offset.y);
  100423. context.lineTo(endX, opts.tooltip.offset.y);
  100424. context.stroke();
  100425. context.setLineDash([]);
  100426. if (toolTipOption.yAxisLabel) {
  100427. var boxPadding = toolTipOption.boxPadding * opts.pix;
  100428. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  100429. var widthArr = opts.chartData.yAxisData.yAxisWidth;
  100430. var tStartLeft = opts.area[3];
  100431. var tStartRight = opts.width - opts.area[1];
  100432. for (var i = 0; i < labelText.length; i++) {
  100433. context.setFontSize(toolTipOption.fontSize * opts.pix);
  100434. var textWidth = measureText(labelText[i], toolTipOption.fontSize * opts.pix, context);
  100435. var bgStartX = void 0,
  100436. bgEndX = void 0,
  100437. bgWidth = void 0;
  100438. if (widthArr[i].position == 'left') {
  100439. bgStartX = tStartLeft - (textWidth + boxPadding * 2) - 2 * opts.pix;
  100440. bgEndX = Math.max(bgStartX, bgStartX + textWidth + boxPadding * 2);
  100441. } else {
  100442. bgStartX = tStartRight + 2 * opts.pix;
  100443. bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + boxPadding * 2);
  100444. }
  100445. bgWidth = bgEndX - bgStartX;
  100446. var textX = bgStartX + (bgWidth - textWidth) / 2;
  100447. var textY = opts.tooltip.offset.y;
  100448. context.beginPath();
  100449. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  100450. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  100451. context.setLineWidth(1 * opts.pix);
  100452. context.rect(bgStartX, textY - 0.5 * config.fontSize - boxPadding, bgWidth, config.fontSize + 2 * boxPadding);
  100453. context.closePath();
  100454. context.stroke();
  100455. context.fill();
  100456. context.beginPath();
  100457. context.setFontSize(config.fontSize);
  100458. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  100459. context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
  100460. context.closePath();
  100461. context.stroke();
  100462. if (widthArr[i].position == 'left') {
  100463. tStartLeft -= widthArr[i].width + opts.yAxis.padding * opts.pix;
  100464. } else {
  100465. tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix;
  100466. }
  100467. }
  100468. }
  100469. }
  100470. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  100471. var toolTipOption = assign({}, {
  100472. activeBgColor: '#000000',
  100473. activeBgOpacity: 0.08,
  100474. activeWidth: eachSpacing
  100475. }, opts.extra.column);
  100476. toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth;
  100477. var startY = opts.area[0];
  100478. var endY = opts.height - opts.area[2];
  100479. context.beginPath();
  100480. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  100481. context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY);
  100482. context.closePath();
  100483. context.fill();
  100484. context.setFillStyle("#FFFFFF");
  100485. }
  100486. function drawBarToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  100487. var toolTipOption = assign({}, {
  100488. activeBgColor: '#000000',
  100489. activeBgOpacity: 0.08
  100490. }, opts.extra.bar);
  100491. var startX = opts.area[3];
  100492. var endX = opts.width - opts.area[1];
  100493. context.beginPath();
  100494. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  100495. context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing);
  100496. context.closePath();
  100497. context.fill();
  100498. context.setFillStyle("#FFFFFF");
  100499. }
  100500. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  100501. var toolTipOption = assign({}, {
  100502. showBox: true,
  100503. showArrow: true,
  100504. showCategory: false,
  100505. bgColor: '#000000',
  100506. bgOpacity: 0.7,
  100507. borderColor: '#000000',
  100508. borderWidth: 0,
  100509. borderRadius: 0,
  100510. borderOpacity: 0.7,
  100511. boxPadding: 3,
  100512. fontColor: '#FFFFFF',
  100513. fontSize: 13,
  100514. lineHeight: 20,
  100515. legendShow: true,
  100516. legendShape: 'auto',
  100517. splitLine: true
  100518. }, opts.extra.tooltip);
  100519. if (toolTipOption.showCategory == true && opts.categories) {
  100520. textList.unshift({
  100521. text: opts.categories[opts.tooltip.index],
  100522. color: null
  100523. });
  100524. }
  100525. var fontSize = toolTipOption.fontSize * opts.pix;
  100526. var lineHeight = toolTipOption.lineHeight * opts.pix;
  100527. var boxPadding = toolTipOption.boxPadding * opts.pix;
  100528. var legendWidth = fontSize;
  100529. var legendMarginRight = 5 * opts.pix;
  100530. if (toolTipOption.legendShow == false) {
  100531. legendWidth = 0;
  100532. legendMarginRight = 0;
  100533. }
  100534. var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0;
  100535. var isOverRightBorder = false;
  100536. if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  100537. if (toolTipOption.splitLine == true) {
  100538. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  100539. }
  100540. }
  100541. offset = assign({
  100542. x: 0,
  100543. y: 0
  100544. }, offset);
  100545. offset.y -= 8 * opts.pix;
  100546. var textWidth = textList.map(function (item) {
  100547. return measureText(item.text, fontSize, context);
  100548. });
  100549. var toolTipWidth = legendWidth + legendMarginRight + 4 * boxPadding + Math.max.apply(null, textWidth);
  100550. var toolTipHeight = 2 * boxPadding + textList.length * lineHeight;
  100551. if (toolTipOption.showBox == false) {
  100552. return;
  100553. }
  100554. // if beyond the right border
  100555. if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) {
  100556. isOverRightBorder = true;
  100557. }
  100558. if (toolTipHeight + offset.y > opts.height) {
  100559. offset.y = opts.height - toolTipHeight;
  100560. }
  100561. // draw background rect
  100562. context.beginPath();
  100563. context.setFillStyle(hexToRgb(toolTipOption.bgColor, toolTipOption.bgOpacity));
  100564. context.setLineWidth(toolTipOption.borderWidth * opts.pix);
  100565. context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity));
  100566. var radius = toolTipOption.borderRadius;
  100567. if (isOverRightBorder) {
  100568. // 增加左侧仍然超出的判断
  100569. if (toolTipWidth + arrowWidth > opts.width) {
  100570. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  100571. }
  100572. if (toolTipWidth > offset.x) {
  100573. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  100574. }
  100575. if (toolTipOption.showArrow) {
  100576. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  100577. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  100578. }
  100579. context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  100580. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  100581. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  100582. context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  100583. if (toolTipOption.showArrow) {
  100584. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  100585. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  100586. }
  100587. } else {
  100588. if (toolTipOption.showArrow) {
  100589. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  100590. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  100591. }
  100592. context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  100593. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  100594. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  100595. context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  100596. if (toolTipOption.showArrow) {
  100597. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  100598. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  100599. }
  100600. }
  100601. context.closePath();
  100602. context.fill();
  100603. if (toolTipOption.borderWidth > 0) {
  100604. context.stroke();
  100605. }
  100606. // draw legend
  100607. if (toolTipOption.legendShow) {
  100608. textList.forEach(function (item, index) {
  100609. if (item.color !== null) {
  100610. context.beginPath();
  100611. context.setFillStyle(item.color);
  100612. var startX = offset.x + arrowWidth + 2 * boxPadding;
  100613. var startY = offset.y + (lineHeight - fontSize) / 2 + lineHeight * index + boxPadding + 1;
  100614. if (isOverRightBorder) {
  100615. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding;
  100616. }
  100617. switch (item.legendShape) {
  100618. case 'line':
  100619. context.moveTo(startX, startY + 0.5 * legendWidth - 2 * opts.pix);
  100620. context.fillRect(startX, startY + 0.5 * legendWidth - 2 * opts.pix, legendWidth, 4 * opts.pix);
  100621. break;
  100622. case 'triangle':
  100623. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  100624. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  100625. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  100626. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  100627. break;
  100628. case 'diamond':
  100629. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  100630. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth);
  100631. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  100632. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth);
  100633. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  100634. break;
  100635. case 'circle':
  100636. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth);
  100637. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth, 5 * opts.pix, 0, 2 * Math.PI);
  100638. break;
  100639. case 'rect':
  100640. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  100641. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  100642. break;
  100643. case 'square':
  100644. context.moveTo(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  100645. context.fillRect(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  100646. break;
  100647. default:
  100648. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  100649. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  100650. }
  100651. context.closePath();
  100652. context.fill();
  100653. }
  100654. });
  100655. }
  100656. // draw text list
  100657. textList.forEach(function (item, index) {
  100658. var startX = offset.x + arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  100659. if (isOverRightBorder) {
  100660. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  100661. }
  100662. var startY = offset.y + lineHeight * index + (lineHeight - fontSize) / 2 - 1 + boxPadding + fontSize;
  100663. context.beginPath();
  100664. context.setFontSize(fontSize);
  100665. context.setTextBaseline('normal');
  100666. context.setFillStyle(toolTipOption.fontColor);
  100667. context.fillText(item.text, startX, startY);
  100668. context.closePath();
  100669. context.stroke();
  100670. });
  100671. }
  100672. function drawColumnDataPoints(series, opts, config, context) {
  100673. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  100674. var xAxisData = opts.chartData.xAxisData,
  100675. xAxisPoints = xAxisData.xAxisPoints,
  100676. eachSpacing = xAxisData.eachSpacing;
  100677. var columnOption = assign({}, {
  100678. type: 'group',
  100679. width: eachSpacing / 2,
  100680. meterBorder: 4,
  100681. meterFillColor: '#FFFFFF',
  100682. barBorderCircle: false,
  100683. barBorderRadius: [],
  100684. seriesGap: 2,
  100685. linearType: 'none',
  100686. linearOpacity: 1,
  100687. customColor: [],
  100688. colorStop: 0,
  100689. labelPosition: 'outside'
  100690. }, opts.extra.column);
  100691. var calPoints = [];
  100692. context.save();
  100693. var leftNum = -2;
  100694. var rightNum = xAxisPoints.length + 2;
  100695. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  100696. context.translate(opts._scrollDistance_, 0);
  100697. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  100698. rightNum = leftNum + opts.xAxis.itemCount + 4;
  100699. }
  100700. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  100701. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  100702. }
  100703. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  100704. series.forEach(function (eachSeries, seriesIndex) {
  100705. var ranges, minRange, maxRange;
  100706. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  100707. minRange = ranges.pop();
  100708. maxRange = ranges.shift();
  100709. // 计算0轴坐标
  100710. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  100711. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  100712. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  100713. eachSeries.zeroPoints = zeroPoints;
  100714. var data = eachSeries.data;
  100715. switch (columnOption.type) {
  100716. case 'group':
  100717. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process);
  100718. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  100719. calPoints.push(tooltipPoints);
  100720. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  100721. for (var i = 0; i < points.length; i++) {
  100722. var item = points[i];
  100723. //fix issues/I27B1N yyoinge & Joeshu
  100724. if (item !== null && i > leftNum && i < rightNum) {
  100725. var startX = item.x - item.width / 2;
  100726. var height = opts.height - item.y - opts.area[2];
  100727. context.beginPath();
  100728. var fillColor = item.color || eachSeries.color;
  100729. var strokeColor = item.color || eachSeries.color;
  100730. if (columnOption.linearType !== 'none') {
  100731. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  100732. //透明渐变
  100733. if (columnOption.linearType == 'opacity') {
  100734. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  100735. grd.addColorStop(1, hexToRgb(fillColor, 1));
  100736. } else {
  100737. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  100738. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  100739. grd.addColorStop(1, hexToRgb(fillColor, 1));
  100740. }
  100741. fillColor = grd;
  100742. }
  100743. // 圆角边框
  100744. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  100745. var left = startX;
  100746. var top = item.y > zeroPoints ? zeroPoints : item.y;
  100747. var width = item.width;
  100748. var _height = Math.abs(zeroPoints - item.y);
  100749. if (columnOption.barBorderCircle) {
  100750. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  100751. }
  100752. if (item.y > zeroPoints) {
  100753. columnOption.barBorderRadius = [0, 0, width / 2, width / 2];
  100754. }
  100755. var _columnOption$barBord = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  100756. r0 = _columnOption$barBord[0],
  100757. r1 = _columnOption$barBord[1],
  100758. r2 = _columnOption$barBord[2],
  100759. r3 = _columnOption$barBord[3];
  100760. var minRadius = Math.min(width / 2, _height / 2);
  100761. r0 = r0 > minRadius ? minRadius : r0;
  100762. r1 = r1 > minRadius ? minRadius : r1;
  100763. r2 = r2 > minRadius ? minRadius : r2;
  100764. r3 = r3 > minRadius ? minRadius : r3;
  100765. r0 = r0 < 0 ? 0 : r0;
  100766. r1 = r1 < 0 ? 0 : r1;
  100767. r2 = r2 < 0 ? 0 : r2;
  100768. r3 = r3 < 0 ? 0 : r3;
  100769. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  100770. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  100771. context.arc(left + width - r2, top + _height - r2, r2, 0, Math.PI / 2);
  100772. context.arc(left + r3, top + _height - r3, r3, Math.PI / 2, Math.PI);
  100773. } else {
  100774. context.moveTo(startX, item.y);
  100775. context.lineTo(startX + item.width, item.y);
  100776. context.lineTo(startX + item.width, zeroPoints);
  100777. context.lineTo(startX, zeroPoints);
  100778. context.lineTo(startX, item.y);
  100779. context.setLineWidth(1);
  100780. context.setStrokeStyle(strokeColor);
  100781. }
  100782. context.setFillStyle(fillColor);
  100783. context.closePath();
  100784. //context.stroke();
  100785. context.fill();
  100786. }
  100787. }
  100788. ;
  100789. break;
  100790. case 'stack':
  100791. // 绘制堆叠数据图
  100792. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  100793. calPoints.push(points);
  100794. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  100795. for (var _i16 = 0; _i16 < points.length; _i16++) {
  100796. var _item7 = points[_i16];
  100797. if (_item7 !== null && _i16 > leftNum && _i16 < rightNum) {
  100798. context.beginPath();
  100799. var fillColor = _item7.color || eachSeries.color;
  100800. var startX = _item7.x - _item7.width / 2 + 1;
  100801. var height = opts.height - _item7.y - opts.area[2];
  100802. var height0 = opts.height - _item7.y0 - opts.area[2];
  100803. if (seriesIndex > 0) {
  100804. height -= height0;
  100805. }
  100806. context.setFillStyle(fillColor);
  100807. context.moveTo(startX, _item7.y);
  100808. context.fillRect(startX, _item7.y, _item7.width, height);
  100809. context.closePath();
  100810. context.fill();
  100811. }
  100812. }
  100813. ;
  100814. break;
  100815. case 'meter':
  100816. // 绘制温度计数据图
  100817. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  100818. calPoints.push(points);
  100819. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meterBorder);
  100820. for (var _i17 = 0; _i17 < points.length; _i17++) {
  100821. var _item8 = points[_i17];
  100822. if (_item8 !== null && _i17 > leftNum && _i17 < rightNum) {
  100823. //画背景颜色
  100824. context.beginPath();
  100825. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  100826. context.setStrokeStyle(eachSeries.color);
  100827. context.setLineWidth(columnOption.meterBorder * opts.pix);
  100828. }
  100829. if (seriesIndex == 0) {
  100830. context.setFillStyle(columnOption.meterFillColor);
  100831. } else {
  100832. context.setFillStyle(_item8.color || eachSeries.color);
  100833. }
  100834. var startX = _item8.x - _item8.width / 2;
  100835. var height = opts.height - _item8.y - opts.area[2];
  100836. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  100837. var _left = startX;
  100838. var _top = _item8.y;
  100839. var _width = _item8.width;
  100840. var _height2 = zeroPoints - _item8.y;
  100841. if (columnOption.barBorderCircle) {
  100842. columnOption.barBorderRadius = [_width / 2, _width / 2, 0, 0];
  100843. }
  100844. var _columnOption$barBord2 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  100845. _r = _columnOption$barBord2[0],
  100846. _r2 = _columnOption$barBord2[1],
  100847. _r3 = _columnOption$barBord2[2],
  100848. _r4 = _columnOption$barBord2[3];
  100849. var _minRadius = Math.min(_width / 2, _height2 / 2);
  100850. _r = _r > _minRadius ? _minRadius : _r;
  100851. _r2 = _r2 > _minRadius ? _minRadius : _r2;
  100852. _r3 = _r3 > _minRadius ? _minRadius : _r3;
  100853. _r4 = _r4 > _minRadius ? _minRadius : _r4;
  100854. _r = _r < 0 ? 0 : _r;
  100855. _r2 = _r2 < 0 ? 0 : _r2;
  100856. _r3 = _r3 < 0 ? 0 : _r3;
  100857. _r4 = _r4 < 0 ? 0 : _r4;
  100858. context.arc(_left + _r, _top + _r, _r, -Math.PI, -Math.PI / 2);
  100859. context.arc(_left + _width - _r2, _top + _r2, _r2, -Math.PI / 2, 0);
  100860. context.arc(_left + _width - _r3, _top + _height2 - _r3, _r3, 0, Math.PI / 2);
  100861. context.arc(_left + _r4, _top + _height2 - _r4, _r4, Math.PI / 2, Math.PI);
  100862. context.fill();
  100863. } else {
  100864. context.moveTo(startX, _item8.y);
  100865. context.lineTo(startX + _item8.width, _item8.y);
  100866. context.lineTo(startX + _item8.width, zeroPoints);
  100867. context.lineTo(startX, zeroPoints);
  100868. context.lineTo(startX, _item8.y);
  100869. context.fill();
  100870. }
  100871. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  100872. context.closePath();
  100873. context.stroke();
  100874. }
  100875. }
  100876. }
  100877. break;
  100878. }
  100879. });
  100880. if (opts.dataLabel !== false && process === 1) {
  100881. series.forEach(function (eachSeries, seriesIndex) {
  100882. var ranges, minRange, maxRange;
  100883. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  100884. minRange = ranges.pop();
  100885. maxRange = ranges.shift();
  100886. var data = eachSeries.data;
  100887. switch (columnOption.type) {
  100888. case 'group':
  100889. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  100890. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  100891. drawColumePointText(points, eachSeries, config, context, opts);
  100892. break;
  100893. case 'stack':
  100894. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  100895. drawColumePointText(points, eachSeries, config, context, opts);
  100896. break;
  100897. case 'meter':
  100898. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  100899. drawColumePointText(points, eachSeries, config, context, opts);
  100900. break;
  100901. }
  100902. });
  100903. }
  100904. context.restore();
  100905. return {
  100906. xAxisPoints: xAxisPoints,
  100907. calPoints: calPoints,
  100908. eachSpacing: eachSpacing
  100909. };
  100910. }
  100911. function drawMountDataPoints(series, opts, config, context) {
  100912. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  100913. var xAxisData = opts.chartData.xAxisData,
  100914. xAxisPoints = xAxisData.xAxisPoints,
  100915. eachSpacing = xAxisData.eachSpacing;
  100916. var mountOption = assign({}, {
  100917. type: 'mount',
  100918. widthRatio: 1,
  100919. borderWidth: 1,
  100920. barBorderCircle: false,
  100921. barBorderRadius: [],
  100922. linearType: 'none',
  100923. linearOpacity: 1,
  100924. customColor: [],
  100925. colorStop: 0
  100926. }, opts.extra.mount);
  100927. mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio;
  100928. mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio;
  100929. var calPoints = [];
  100930. context.save();
  100931. var leftNum = -2;
  100932. var rightNum = xAxisPoints.length + 2;
  100933. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  100934. context.translate(opts._scrollDistance_, 0);
  100935. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  100936. rightNum = leftNum + opts.xAxis.itemCount + 4;
  100937. }
  100938. mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config);
  100939. var ranges, minRange, maxRange;
  100940. ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  100941. minRange = ranges.pop();
  100942. maxRange = ranges.shift();
  100943. // 计算0轴坐标
  100944. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  100945. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  100946. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  100947. var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  100948. switch (mountOption.type) {
  100949. case 'bar':
  100950. for (var i = 0; i < points.length; i++) {
  100951. var item = points[i];
  100952. if (item !== null && i > leftNum && i < rightNum) {
  100953. var startX = item.x - eachSpacing * mountOption.widthRatio / 2;
  100954. var height = opts.height - item.y - opts.area[2];
  100955. context.beginPath();
  100956. var fillColor = item.color || series[i].color;
  100957. var strokeColor = item.color || series[i].color;
  100958. if (mountOption.linearType !== 'none') {
  100959. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  100960. //透明渐变
  100961. if (mountOption.linearType == 'opacity') {
  100962. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  100963. grd.addColorStop(1, hexToRgb(fillColor, 1));
  100964. } else {
  100965. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  100966. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  100967. grd.addColorStop(1, hexToRgb(fillColor, 1));
  100968. }
  100969. fillColor = grd;
  100970. }
  100971. // 圆角边框
  100972. if (mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4 || mountOption.barBorderCircle === true) {
  100973. var left = startX;
  100974. var top = item.y > zeroPoints ? zeroPoints : item.y;
  100975. var width = item.width;
  100976. var _height3 = Math.abs(zeroPoints - item.y);
  100977. if (mountOption.barBorderCircle) {
  100978. mountOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  100979. }
  100980. if (item.y > zeroPoints) {
  100981. mountOption.barBorderRadius = [0, 0, width / 2, width / 2];
  100982. }
  100983. var _mountOption$barBorde = (0, _slicedToArray2.default)(mountOption.barBorderRadius, 4),
  100984. r0 = _mountOption$barBorde[0],
  100985. r1 = _mountOption$barBorde[1],
  100986. r2 = _mountOption$barBorde[2],
  100987. r3 = _mountOption$barBorde[3];
  100988. var minRadius = Math.min(width / 2, _height3 / 2);
  100989. r0 = r0 > minRadius ? minRadius : r0;
  100990. r1 = r1 > minRadius ? minRadius : r1;
  100991. r2 = r2 > minRadius ? minRadius : r2;
  100992. r3 = r3 > minRadius ? minRadius : r3;
  100993. r0 = r0 < 0 ? 0 : r0;
  100994. r1 = r1 < 0 ? 0 : r1;
  100995. r2 = r2 < 0 ? 0 : r2;
  100996. r3 = r3 < 0 ? 0 : r3;
  100997. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  100998. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  100999. context.arc(left + width - r2, top + _height3 - r2, r2, 0, Math.PI / 2);
  101000. context.arc(left + r3, top + _height3 - r3, r3, Math.PI / 2, Math.PI);
  101001. } else {
  101002. context.moveTo(startX, item.y);
  101003. context.lineTo(startX + item.width, item.y);
  101004. context.lineTo(startX + item.width, zeroPoints);
  101005. context.lineTo(startX, zeroPoints);
  101006. context.lineTo(startX, item.y);
  101007. }
  101008. context.setStrokeStyle(strokeColor);
  101009. context.setFillStyle(fillColor);
  101010. if (mountOption.borderWidth > 0) {
  101011. context.setLineWidth(mountOption.borderWidth * opts.pix);
  101012. context.closePath();
  101013. context.stroke();
  101014. }
  101015. context.fill();
  101016. }
  101017. }
  101018. ;
  101019. break;
  101020. case 'triangle':
  101021. for (var _i18 = 0; _i18 < points.length; _i18++) {
  101022. var _item9 = points[_i18];
  101023. if (_item9 !== null && _i18 > leftNum && _i18 < rightNum) {
  101024. var startX = _item9.x - eachSpacing * mountOption.widthRatio / 2;
  101025. var height = opts.height - _item9.y - opts.area[2];
  101026. context.beginPath();
  101027. var fillColor = _item9.color || series[_i18].color;
  101028. var strokeColor = _item9.color || series[_i18].color;
  101029. if (mountOption.linearType !== 'none') {
  101030. var grd = context.createLinearGradient(startX, _item9.y, startX, zeroPoints);
  101031. //透明渐变
  101032. if (mountOption.linearType == 'opacity') {
  101033. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  101034. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101035. } else {
  101036. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  101037. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  101038. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101039. }
  101040. fillColor = grd;
  101041. }
  101042. context.moveTo(startX, zeroPoints);
  101043. context.lineTo(_item9.x, _item9.y);
  101044. context.lineTo(startX + _item9.width, zeroPoints);
  101045. context.setStrokeStyle(strokeColor);
  101046. context.setFillStyle(fillColor);
  101047. if (mountOption.borderWidth > 0) {
  101048. context.setLineWidth(mountOption.borderWidth * opts.pix);
  101049. context.stroke();
  101050. }
  101051. context.fill();
  101052. }
  101053. }
  101054. ;
  101055. break;
  101056. case 'mount':
  101057. for (var _i19 = 0; _i19 < points.length; _i19++) {
  101058. var _item10 = points[_i19];
  101059. if (_item10 !== null && _i19 > leftNum && _i19 < rightNum) {
  101060. var startX = _item10.x - eachSpacing * mountOption.widthRatio / 2;
  101061. var height = opts.height - _item10.y - opts.area[2];
  101062. context.beginPath();
  101063. var fillColor = _item10.color || series[_i19].color;
  101064. var strokeColor = _item10.color || series[_i19].color;
  101065. if (mountOption.linearType !== 'none') {
  101066. var grd = context.createLinearGradient(startX, _item10.y, startX, zeroPoints);
  101067. //透明渐变
  101068. if (mountOption.linearType == 'opacity') {
  101069. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  101070. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101071. } else {
  101072. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  101073. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  101074. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101075. }
  101076. fillColor = grd;
  101077. }
  101078. context.moveTo(startX, zeroPoints);
  101079. context.bezierCurveTo(_item10.x - _item10.width / 4, zeroPoints, _item10.x - _item10.width / 4, _item10.y, _item10.x, _item10.y);
  101080. context.bezierCurveTo(_item10.x + _item10.width / 4, _item10.y, _item10.x + _item10.width / 4, zeroPoints, startX + _item10.width, zeroPoints);
  101081. context.setStrokeStyle(strokeColor);
  101082. context.setFillStyle(fillColor);
  101083. if (mountOption.borderWidth > 0) {
  101084. context.setLineWidth(mountOption.borderWidth * opts.pix);
  101085. context.stroke();
  101086. }
  101087. context.fill();
  101088. }
  101089. }
  101090. ;
  101091. break;
  101092. case 'sharp':
  101093. for (var _i20 = 0; _i20 < points.length; _i20++) {
  101094. var _item11 = points[_i20];
  101095. if (_item11 !== null && _i20 > leftNum && _i20 < rightNum) {
  101096. var startX = _item11.x - eachSpacing * mountOption.widthRatio / 2;
  101097. var height = opts.height - _item11.y - opts.area[2];
  101098. context.beginPath();
  101099. var fillColor = _item11.color || series[_i20].color;
  101100. var strokeColor = _item11.color || series[_i20].color;
  101101. if (mountOption.linearType !== 'none') {
  101102. var grd = context.createLinearGradient(startX, _item11.y, startX, zeroPoints);
  101103. //透明渐变
  101104. if (mountOption.linearType == 'opacity') {
  101105. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  101106. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101107. } else {
  101108. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  101109. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  101110. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101111. }
  101112. fillColor = grd;
  101113. }
  101114. context.moveTo(startX, zeroPoints);
  101115. context.quadraticCurveTo(_item11.x - 0, zeroPoints - height / 4, _item11.x, _item11.y);
  101116. context.quadraticCurveTo(_item11.x + 0, zeroPoints - height / 4, startX + _item11.width, zeroPoints);
  101117. context.setStrokeStyle(strokeColor);
  101118. context.setFillStyle(fillColor);
  101119. if (mountOption.borderWidth > 0) {
  101120. context.setLineWidth(mountOption.borderWidth * opts.pix);
  101121. context.stroke();
  101122. }
  101123. context.fill();
  101124. }
  101125. }
  101126. ;
  101127. break;
  101128. }
  101129. if (opts.dataLabel !== false && process === 1) {
  101130. var _ranges, _minRange, _maxRange;
  101131. _ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  101132. _minRange = _ranges.pop();
  101133. _maxRange = _ranges.shift();
  101134. var points = getMountDataPoints(series, _minRange, _maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  101135. drawMountPointText(points, series, config, context, opts, zeroPoints);
  101136. }
  101137. context.restore();
  101138. return {
  101139. xAxisPoints: xAxisPoints,
  101140. calPoints: points,
  101141. eachSpacing: eachSpacing
  101142. };
  101143. }
  101144. function drawBarDataPoints(series, opts, config, context) {
  101145. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  101146. var yAxisPoints = [];
  101147. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length;
  101148. for (var i = 0; i < opts.categories.length; i++) {
  101149. yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i);
  101150. }
  101151. var columnOption = assign({}, {
  101152. type: 'group',
  101153. width: eachSpacing / 2,
  101154. meterBorder: 4,
  101155. meterFillColor: '#FFFFFF',
  101156. barBorderCircle: false,
  101157. barBorderRadius: [],
  101158. seriesGap: 2,
  101159. linearType: 'none',
  101160. linearOpacity: 1,
  101161. customColor: [],
  101162. colorStop: 0
  101163. }, opts.extra.bar);
  101164. var calPoints = [];
  101165. context.save();
  101166. var leftNum = -2;
  101167. var rightNum = yAxisPoints.length + 2;
  101168. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  101169. drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing);
  101170. }
  101171. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  101172. series.forEach(function (eachSeries, seriesIndex) {
  101173. var ranges, minRange, maxRange;
  101174. ranges = [].concat(opts.chartData.xAxisData.ranges);
  101175. maxRange = ranges.pop();
  101176. minRange = ranges.shift();
  101177. var data = eachSeries.data;
  101178. switch (columnOption.type) {
  101179. case 'group':
  101180. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  101181. var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  101182. calPoints.push(tooltipPoints);
  101183. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  101184. for (var _i21 = 0; _i21 < points.length; _i21++) {
  101185. var item = points[_i21];
  101186. //fix issues/I27B1N yyoinge & Joeshu
  101187. if (item !== null && _i21 > leftNum && _i21 < rightNum) {
  101188. //var startX = item.x - item.width / 2;
  101189. var startX = opts.area[3];
  101190. var startY = item.y - item.width / 2;
  101191. var height = item.height;
  101192. context.beginPath();
  101193. var fillColor = item.color || eachSeries.color;
  101194. var strokeColor = item.color || eachSeries.color;
  101195. if (columnOption.linearType !== 'none') {
  101196. var grd = context.createLinearGradient(startX, item.y, item.x, item.y);
  101197. //透明渐变
  101198. if (columnOption.linearType == 'opacity') {
  101199. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  101200. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101201. } else {
  101202. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  101203. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  101204. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101205. }
  101206. fillColor = grd;
  101207. }
  101208. // 圆角边框
  101209. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  101210. var left = startX;
  101211. var width = item.width;
  101212. var top = item.y - item.width / 2;
  101213. var _height4 = item.height;
  101214. if (columnOption.barBorderCircle) {
  101215. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  101216. }
  101217. var _columnOption$barBord3 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  101218. r0 = _columnOption$barBord3[0],
  101219. r1 = _columnOption$barBord3[1],
  101220. r2 = _columnOption$barBord3[2],
  101221. r3 = _columnOption$barBord3[3];
  101222. var minRadius = Math.min(width / 2, _height4 / 2);
  101223. r0 = r0 > minRadius ? minRadius : r0;
  101224. r1 = r1 > minRadius ? minRadius : r1;
  101225. r2 = r2 > minRadius ? minRadius : r2;
  101226. r3 = r3 > minRadius ? minRadius : r3;
  101227. r0 = r0 < 0 ? 0 : r0;
  101228. r1 = r1 < 0 ? 0 : r1;
  101229. r2 = r2 < 0 ? 0 : r2;
  101230. r3 = r3 < 0 ? 0 : r3;
  101231. context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2);
  101232. context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0);
  101233. context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2);
  101234. context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI);
  101235. } else {
  101236. context.moveTo(startX, startY);
  101237. context.lineTo(item.x, startY);
  101238. context.lineTo(item.x, startY + item.width);
  101239. context.lineTo(startX, startY + item.width);
  101240. context.lineTo(startX, startY);
  101241. context.setLineWidth(1);
  101242. context.setStrokeStyle(strokeColor);
  101243. }
  101244. context.setFillStyle(fillColor);
  101245. context.closePath();
  101246. //context.stroke();
  101247. context.fill();
  101248. }
  101249. }
  101250. ;
  101251. break;
  101252. case 'stack':
  101253. // 绘制堆叠数据图
  101254. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  101255. calPoints.push(points);
  101256. points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  101257. for (var _i22 = 0; _i22 < points.length; _i22++) {
  101258. var _item12 = points[_i22];
  101259. if (_item12 !== null && _i22 > leftNum && _i22 < rightNum) {
  101260. context.beginPath();
  101261. var fillColor = _item12.color || eachSeries.color;
  101262. var startX = _item12.x0;
  101263. context.setFillStyle(fillColor);
  101264. context.moveTo(startX, _item12.y - _item12.width / 2);
  101265. context.fillRect(startX, _item12.y - _item12.width / 2, _item12.height, _item12.width);
  101266. context.closePath();
  101267. context.fill();
  101268. }
  101269. }
  101270. ;
  101271. break;
  101272. }
  101273. });
  101274. if (opts.dataLabel !== false && process === 1) {
  101275. series.forEach(function (eachSeries, seriesIndex) {
  101276. var ranges, minRange, maxRange;
  101277. ranges = [].concat(opts.chartData.xAxisData.ranges);
  101278. maxRange = ranges.pop();
  101279. minRange = ranges.shift();
  101280. var data = eachSeries.data;
  101281. switch (columnOption.type) {
  101282. case 'group':
  101283. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  101284. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  101285. drawBarPointText(points, eachSeries, config, context, opts);
  101286. break;
  101287. case 'stack':
  101288. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  101289. drawBarPointText(points, eachSeries, config, context, opts);
  101290. break;
  101291. }
  101292. });
  101293. }
  101294. return {
  101295. yAxisPoints: yAxisPoints,
  101296. calPoints: calPoints,
  101297. eachSpacing: eachSpacing
  101298. };
  101299. }
  101300. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  101301. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  101302. var candleOption = assign({}, {
  101303. color: {},
  101304. average: {}
  101305. }, opts.extra.candle);
  101306. candleOption.color = assign({}, {
  101307. upLine: '#f04864',
  101308. upFill: '#f04864',
  101309. downLine: '#2fc25b',
  101310. downFill: '#2fc25b'
  101311. }, candleOption.color);
  101312. candleOption.average = assign({}, {
  101313. show: false,
  101314. name: [],
  101315. day: [],
  101316. color: config.color
  101317. }, candleOption.average);
  101318. opts.extra.candle = candleOption;
  101319. var xAxisData = opts.chartData.xAxisData,
  101320. xAxisPoints = xAxisData.xAxisPoints,
  101321. eachSpacing = xAxisData.eachSpacing;
  101322. var calPoints = [];
  101323. context.save();
  101324. var leftNum = -2;
  101325. var rightNum = xAxisPoints.length + 2;
  101326. var leftSpace = 0;
  101327. var rightSpace = opts.width + eachSpacing;
  101328. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  101329. context.translate(opts._scrollDistance_, 0);
  101330. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  101331. rightNum = leftNum + opts.xAxis.itemCount + 4;
  101332. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  101333. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  101334. }
  101335. //画均线
  101336. if (candleOption.average.show || seriesMA) {
  101337. //Merge pull request !12 from 邱贵翔
  101338. seriesMA.forEach(function (eachSeries, seriesIndex) {
  101339. var ranges, minRange, maxRange;
  101340. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101341. minRange = ranges.pop();
  101342. maxRange = ranges.shift();
  101343. var data = eachSeries.data;
  101344. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101345. var splitPointList = splitPoints(points, eachSeries);
  101346. for (var i = 0; i < splitPointList.length; i++) {
  101347. var _points = splitPointList[i];
  101348. context.beginPath();
  101349. context.setStrokeStyle(eachSeries.color);
  101350. context.setLineWidth(1);
  101351. if (_points.length === 1) {
  101352. context.moveTo(_points[0].x, _points[0].y);
  101353. context.arc(_points[0].x, _points[0].y, 1, 0, 2 * Math.PI);
  101354. } else {
  101355. context.moveTo(_points[0].x, _points[0].y);
  101356. var startPoint = 0;
  101357. for (var j = 0; j < _points.length; j++) {
  101358. var item = _points[j];
  101359. if (startPoint == 0 && item.x > leftSpace) {
  101360. context.moveTo(item.x, item.y);
  101361. startPoint = 1;
  101362. }
  101363. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  101364. var ctrlPoint = createCurveControlPoints(_points, j - 1);
  101365. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  101366. }
  101367. }
  101368. context.moveTo(_points[0].x, _points[0].y);
  101369. }
  101370. context.closePath();
  101371. context.stroke();
  101372. }
  101373. });
  101374. }
  101375. //画K线
  101376. series.forEach(function (eachSeries, seriesIndex) {
  101377. var ranges, minRange, maxRange;
  101378. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101379. minRange = ranges.pop();
  101380. maxRange = ranges.shift();
  101381. var data = eachSeries.data;
  101382. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101383. calPoints.push(points);
  101384. var splitPointList = splitPoints(points, eachSeries);
  101385. for (var i = 0; i < splitPointList[0].length; i++) {
  101386. if (i > leftNum && i < rightNum) {
  101387. var item = splitPointList[0][i];
  101388. context.beginPath();
  101389. //如果上涨
  101390. if (data[i][1] - data[i][0] > 0) {
  101391. context.setStrokeStyle(candleOption.color.upLine);
  101392. context.setFillStyle(candleOption.color.upFill);
  101393. context.setLineWidth(1 * opts.pix);
  101394. context.moveTo(item[3].x, item[3].y); //顶点
  101395. context.lineTo(item[1].x, item[1].y); //收盘中间点
  101396. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  101397. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  101398. context.lineTo(item[0].x, item[0].y); //开盘中间点
  101399. context.lineTo(item[2].x, item[2].y); //底点
  101400. context.lineTo(item[0].x, item[0].y); //开盘中间点
  101401. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  101402. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  101403. context.lineTo(item[1].x, item[1].y); //收盘中间点
  101404. context.moveTo(item[3].x, item[3].y); //顶点
  101405. } else {
  101406. context.setStrokeStyle(candleOption.color.downLine);
  101407. context.setFillStyle(candleOption.color.downFill);
  101408. context.setLineWidth(1 * opts.pix);
  101409. context.moveTo(item[3].x, item[3].y); //顶点
  101410. context.lineTo(item[0].x, item[0].y); //开盘中间点
  101411. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  101412. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  101413. context.lineTo(item[1].x, item[1].y); //收盘中间点
  101414. context.lineTo(item[2].x, item[2].y); //底点
  101415. context.lineTo(item[1].x, item[1].y); //收盘中间点
  101416. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  101417. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  101418. context.lineTo(item[0].x, item[0].y); //开盘中间点
  101419. context.moveTo(item[3].x, item[3].y); //顶点
  101420. }
  101421. context.closePath();
  101422. context.fill();
  101423. context.stroke();
  101424. }
  101425. }
  101426. });
  101427. context.restore();
  101428. return {
  101429. xAxisPoints: xAxisPoints,
  101430. calPoints: calPoints,
  101431. eachSpacing: eachSpacing
  101432. };
  101433. }
  101434. function drawAreaDataPoints(series, opts, config, context) {
  101435. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  101436. var areaOption = assign({}, {
  101437. type: 'straight',
  101438. opacity: 0.2,
  101439. addLine: false,
  101440. width: 2,
  101441. gradient: false,
  101442. activeType: 'none'
  101443. }, opts.extra.area);
  101444. var xAxisData = opts.chartData.xAxisData,
  101445. xAxisPoints = xAxisData.xAxisPoints,
  101446. eachSpacing = xAxisData.eachSpacing;
  101447. var endY = opts.height - opts.area[2];
  101448. var calPoints = [];
  101449. context.save();
  101450. var leftSpace = 0;
  101451. var rightSpace = opts.width + eachSpacing;
  101452. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  101453. context.translate(opts._scrollDistance_, 0);
  101454. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  101455. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  101456. }
  101457. series.forEach(function (eachSeries, seriesIndex) {
  101458. var ranges, minRange, maxRange;
  101459. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101460. minRange = ranges.pop();
  101461. maxRange = ranges.shift();
  101462. var data = eachSeries.data;
  101463. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101464. calPoints.push(points);
  101465. var splitPointList = splitPoints(points, eachSeries);
  101466. for (var i = 0; i < splitPointList.length; i++) {
  101467. var _points2 = splitPointList[i];
  101468. // 绘制区域数
  101469. context.beginPath();
  101470. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  101471. if (areaOption.gradient) {
  101472. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  101473. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  101474. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  101475. context.setFillStyle(gradient);
  101476. } else {
  101477. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  101478. }
  101479. context.setLineWidth(areaOption.width * opts.pix);
  101480. if (_points2.length > 1) {
  101481. var firstPoint = _points2[0];
  101482. var lastPoint = _points2[_points2.length - 1];
  101483. context.moveTo(firstPoint.x, firstPoint.y);
  101484. var startPoint = 0;
  101485. if (areaOption.type === 'curve') {
  101486. for (var j = 0; j < _points2.length; j++) {
  101487. var item = _points2[j];
  101488. if (startPoint == 0 && item.x > leftSpace) {
  101489. context.moveTo(item.x, item.y);
  101490. startPoint = 1;
  101491. }
  101492. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  101493. var ctrlPoint = createCurveControlPoints(_points2, j - 1);
  101494. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  101495. }
  101496. }
  101497. ;
  101498. }
  101499. if (areaOption.type === 'straight') {
  101500. for (var _j = 0; _j < _points2.length; _j++) {
  101501. var _item13 = _points2[_j];
  101502. if (startPoint == 0 && _item13.x > leftSpace) {
  101503. context.moveTo(_item13.x, _item13.y);
  101504. startPoint = 1;
  101505. }
  101506. if (_j > 0 && _item13.x > leftSpace && _item13.x < rightSpace) {
  101507. context.lineTo(_item13.x, _item13.y);
  101508. }
  101509. }
  101510. ;
  101511. }
  101512. if (areaOption.type === 'step') {
  101513. for (var _j2 = 0; _j2 < _points2.length; _j2++) {
  101514. var _item14 = _points2[_j2];
  101515. if (startPoint == 0 && _item14.x > leftSpace) {
  101516. context.moveTo(_item14.x, _item14.y);
  101517. startPoint = 1;
  101518. }
  101519. if (_j2 > 0 && _item14.x > leftSpace && _item14.x < rightSpace) {
  101520. context.lineTo(_item14.x, _points2[_j2 - 1].y);
  101521. context.lineTo(_item14.x, _item14.y);
  101522. }
  101523. }
  101524. ;
  101525. }
  101526. context.lineTo(lastPoint.x, endY);
  101527. context.lineTo(firstPoint.x, endY);
  101528. context.lineTo(firstPoint.x, firstPoint.y);
  101529. } else {
  101530. var _item15 = _points2[0];
  101531. context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
  101532. // context.lineTo(item.x + eachSpacing / 2, item.y);
  101533. // context.lineTo(item.x + eachSpacing / 2, endY);
  101534. // context.lineTo(item.x - eachSpacing / 2, endY);
  101535. // context.moveTo(item.x - eachSpacing / 2, item.y);
  101536. }
  101537. context.closePath();
  101538. context.fill();
  101539. //画连线
  101540. if (areaOption.addLine) {
  101541. if (eachSeries.lineType == 'dash') {
  101542. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  101543. dashLength *= opts.pix;
  101544. context.setLineDash([dashLength, dashLength]);
  101545. }
  101546. context.beginPath();
  101547. context.setStrokeStyle(eachSeries.color);
  101548. context.setLineWidth(areaOption.width * opts.pix);
  101549. if (_points2.length === 1) {
  101550. context.moveTo(_points2[0].x, _points2[0].y);
  101551. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  101552. } else {
  101553. context.moveTo(_points2[0].x, _points2[0].y);
  101554. var _startPoint = 0;
  101555. if (areaOption.type === 'curve') {
  101556. for (var _j3 = 0; _j3 < _points2.length; _j3++) {
  101557. var _item16 = _points2[_j3];
  101558. if (_startPoint == 0 && _item16.x > leftSpace) {
  101559. context.moveTo(_item16.x, _item16.y);
  101560. _startPoint = 1;
  101561. }
  101562. if (_j3 > 0 && _item16.x > leftSpace && _item16.x < rightSpace) {
  101563. var _ctrlPoint = createCurveControlPoints(_points2, _j3 - 1);
  101564. context.bezierCurveTo(_ctrlPoint.ctrA.x, _ctrlPoint.ctrA.y, _ctrlPoint.ctrB.x, _ctrlPoint.ctrB.y, _item16.x, _item16.y);
  101565. }
  101566. }
  101567. ;
  101568. }
  101569. if (areaOption.type === 'straight') {
  101570. for (var _j4 = 0; _j4 < _points2.length; _j4++) {
  101571. var _item17 = _points2[_j4];
  101572. if (_startPoint == 0 && _item17.x > leftSpace) {
  101573. context.moveTo(_item17.x, _item17.y);
  101574. _startPoint = 1;
  101575. }
  101576. if (_j4 > 0 && _item17.x > leftSpace && _item17.x < rightSpace) {
  101577. context.lineTo(_item17.x, _item17.y);
  101578. }
  101579. }
  101580. ;
  101581. }
  101582. if (areaOption.type === 'step') {
  101583. for (var _j5 = 0; _j5 < _points2.length; _j5++) {
  101584. var _item18 = _points2[_j5];
  101585. if (_startPoint == 0 && _item18.x > leftSpace) {
  101586. context.moveTo(_item18.x, _item18.y);
  101587. _startPoint = 1;
  101588. }
  101589. if (_j5 > 0 && _item18.x > leftSpace && _item18.x < rightSpace) {
  101590. context.lineTo(_item18.x, _points2[_j5 - 1].y);
  101591. context.lineTo(_item18.x, _item18.y);
  101592. }
  101593. }
  101594. ;
  101595. }
  101596. context.moveTo(_points2[0].x, _points2[0].y);
  101597. }
  101598. context.stroke();
  101599. context.setLineDash([]);
  101600. }
  101601. }
  101602. //画点
  101603. if (opts.dataPointShape !== false) {
  101604. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  101605. }
  101606. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, areaOption, seriesIndex);
  101607. });
  101608. if (opts.dataLabel !== false && process === 1) {
  101609. series.forEach(function (eachSeries, seriesIndex) {
  101610. var ranges, minRange, maxRange;
  101611. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101612. minRange = ranges.pop();
  101613. maxRange = ranges.shift();
  101614. var data = eachSeries.data;
  101615. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101616. drawPointText(points, eachSeries, config, context, opts);
  101617. });
  101618. }
  101619. context.restore();
  101620. return {
  101621. xAxisPoints: xAxisPoints,
  101622. calPoints: calPoints,
  101623. eachSpacing: eachSpacing
  101624. };
  101625. }
  101626. function drawScatterDataPoints(series, opts, config, context) {
  101627. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  101628. var scatterOption = assign({}, {
  101629. type: 'circle'
  101630. }, opts.extra.scatter);
  101631. var xAxisData = opts.chartData.xAxisData,
  101632. xAxisPoints = xAxisData.xAxisPoints,
  101633. eachSpacing = xAxisData.eachSpacing;
  101634. var calPoints = [];
  101635. context.save();
  101636. var leftSpace = 0;
  101637. var rightSpace = opts.width + eachSpacing;
  101638. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  101639. context.translate(opts._scrollDistance_, 0);
  101640. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  101641. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  101642. }
  101643. series.forEach(function (eachSeries, seriesIndex) {
  101644. var ranges, minRange, maxRange;
  101645. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101646. minRange = ranges.pop();
  101647. maxRange = ranges.shift();
  101648. var data = eachSeries.data;
  101649. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101650. context.beginPath();
  101651. context.setStrokeStyle(eachSeries.color);
  101652. context.setFillStyle(eachSeries.color);
  101653. context.setLineWidth(1 * opts.pix);
  101654. var shape = eachSeries.pointShape;
  101655. if (shape === 'diamond') {
  101656. points.forEach(function (item, index) {
  101657. if (item !== null) {
  101658. context.moveTo(item.x, item.y - 4.5);
  101659. context.lineTo(item.x - 4.5, item.y);
  101660. context.lineTo(item.x, item.y + 4.5);
  101661. context.lineTo(item.x + 4.5, item.y);
  101662. context.lineTo(item.x, item.y - 4.5);
  101663. }
  101664. });
  101665. } else if (shape === 'circle') {
  101666. points.forEach(function (item, index) {
  101667. if (item !== null) {
  101668. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  101669. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  101670. }
  101671. });
  101672. } else if (shape === 'square') {
  101673. points.forEach(function (item, index) {
  101674. if (item !== null) {
  101675. context.moveTo(item.x - 3.5, item.y - 3.5);
  101676. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  101677. }
  101678. });
  101679. } else if (shape === 'triangle') {
  101680. points.forEach(function (item, index) {
  101681. if (item !== null) {
  101682. context.moveTo(item.x, item.y - 4.5);
  101683. context.lineTo(item.x - 4.5, item.y + 4.5);
  101684. context.lineTo(item.x + 4.5, item.y + 4.5);
  101685. context.lineTo(item.x, item.y - 4.5);
  101686. }
  101687. });
  101688. } else if (shape === 'triangle') {
  101689. return;
  101690. }
  101691. context.closePath();
  101692. context.fill();
  101693. context.stroke();
  101694. });
  101695. if (opts.dataLabel !== false && process === 1) {
  101696. series.forEach(function (eachSeries, seriesIndex) {
  101697. var ranges, minRange, maxRange;
  101698. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101699. minRange = ranges.pop();
  101700. maxRange = ranges.shift();
  101701. var data = eachSeries.data;
  101702. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101703. drawPointText(points, eachSeries, config, context, opts);
  101704. });
  101705. }
  101706. context.restore();
  101707. return {
  101708. xAxisPoints: xAxisPoints,
  101709. calPoints: calPoints,
  101710. eachSpacing: eachSpacing
  101711. };
  101712. }
  101713. function drawBubbleDataPoints(series, opts, config, context) {
  101714. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  101715. var bubbleOption = assign({}, {
  101716. opacity: 1,
  101717. border: 2
  101718. }, opts.extra.bubble);
  101719. var xAxisData = opts.chartData.xAxisData,
  101720. xAxisPoints = xAxisData.xAxisPoints,
  101721. eachSpacing = xAxisData.eachSpacing;
  101722. var calPoints = [];
  101723. context.save();
  101724. var leftSpace = 0;
  101725. var rightSpace = opts.width + eachSpacing;
  101726. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  101727. context.translate(opts._scrollDistance_, 0);
  101728. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  101729. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  101730. }
  101731. series.forEach(function (eachSeries, seriesIndex) {
  101732. var ranges, minRange, maxRange;
  101733. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101734. minRange = ranges.pop();
  101735. maxRange = ranges.shift();
  101736. var data = eachSeries.data;
  101737. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101738. context.beginPath();
  101739. context.setStrokeStyle(eachSeries.color);
  101740. context.setLineWidth(bubbleOption.border * opts.pix);
  101741. context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity));
  101742. points.forEach(function (item, index) {
  101743. context.moveTo(item.x + item.r, item.y);
  101744. context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false);
  101745. });
  101746. context.closePath();
  101747. context.fill();
  101748. context.stroke();
  101749. if (opts.dataLabel !== false && process === 1) {
  101750. points.forEach(function (item, index) {
  101751. context.beginPath();
  101752. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  101753. context.setFontSize(fontSize);
  101754. context.setFillStyle(eachSeries.textColor || "#FFFFFF");
  101755. context.setTextAlign('center');
  101756. context.fillText(String(item.t), item.x, item.y + fontSize / 2);
  101757. context.closePath();
  101758. context.stroke();
  101759. context.setTextAlign('left');
  101760. });
  101761. }
  101762. });
  101763. context.restore();
  101764. return {
  101765. xAxisPoints: xAxisPoints,
  101766. calPoints: calPoints,
  101767. eachSpacing: eachSpacing
  101768. };
  101769. }
  101770. function drawLineDataPoints(series, opts, config, context) {
  101771. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  101772. var lineOption = assign({}, {
  101773. type: 'straight',
  101774. width: 2,
  101775. activeType: 'none',
  101776. linearType: 'none',
  101777. onShadow: false,
  101778. animation: 'vertical'
  101779. }, opts.extra.line);
  101780. lineOption.width *= opts.pix;
  101781. var xAxisData = opts.chartData.xAxisData,
  101782. xAxisPoints = xAxisData.xAxisPoints,
  101783. eachSpacing = xAxisData.eachSpacing;
  101784. var calPoints = [];
  101785. context.save();
  101786. var leftSpace = 0;
  101787. var rightSpace = opts.width + eachSpacing;
  101788. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  101789. context.translate(opts._scrollDistance_, 0);
  101790. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  101791. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  101792. }
  101793. series.forEach(function (eachSeries, seriesIndex) {
  101794. // 这段很神奇的代码用于解决ios16的setStrokeStyle失效的bug
  101795. context.beginPath();
  101796. context.setStrokeStyle(eachSeries.color);
  101797. context.moveTo(-10000, -10000);
  101798. context.lineTo(-10001, -10001);
  101799. context.stroke();
  101800. var ranges, minRange, maxRange;
  101801. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101802. minRange = ranges.pop();
  101803. maxRange = ranges.shift();
  101804. var data = eachSeries.data;
  101805. var points = getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process);
  101806. calPoints.push(points);
  101807. var splitPointList = splitPoints(points, eachSeries);
  101808. if (eachSeries.lineType == 'dash') {
  101809. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  101810. dashLength *= opts.pix;
  101811. context.setLineDash([dashLength, dashLength]);
  101812. }
  101813. context.beginPath();
  101814. var strokeColor = eachSeries.color;
  101815. if (lineOption.linearType !== 'none' && eachSeries.linearColor && eachSeries.linearColor.length > 0) {
  101816. var grd = context.createLinearGradient(opts.chartData.xAxisData.startX, opts.height / 2, opts.chartData.xAxisData.endX, opts.height / 2);
  101817. for (var i = 0; i < eachSeries.linearColor.length; i++) {
  101818. grd.addColorStop(eachSeries.linearColor[i][0], hexToRgb(eachSeries.linearColor[i][1], 1));
  101819. }
  101820. strokeColor = grd;
  101821. }
  101822. context.setStrokeStyle(strokeColor);
  101823. if (lineOption.onShadow == true && eachSeries.setShadow && eachSeries.setShadow.length > 0) {
  101824. context.setShadow(eachSeries.setShadow[0], eachSeries.setShadow[1], eachSeries.setShadow[2], eachSeries.setShadow[3]);
  101825. } else {
  101826. context.setShadow(0, 0, 0, 'rgba(0,0,0,0)');
  101827. }
  101828. context.setLineWidth(lineOption.width);
  101829. splitPointList.forEach(function (points, index) {
  101830. if (points.length === 1) {
  101831. context.moveTo(points[0].x, points[0].y);
  101832. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  101833. } else {
  101834. context.moveTo(points[0].x, points[0].y);
  101835. var startPoint = 0;
  101836. if (lineOption.type === 'curve') {
  101837. for (var j = 0; j < points.length; j++) {
  101838. var item = points[j];
  101839. if (startPoint == 0 && item.x > leftSpace) {
  101840. context.moveTo(item.x, item.y);
  101841. startPoint = 1;
  101842. }
  101843. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  101844. var ctrlPoint = createCurveControlPoints(points, j - 1);
  101845. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  101846. }
  101847. }
  101848. ;
  101849. }
  101850. if (lineOption.type === 'straight') {
  101851. for (var _j6 = 0; _j6 < points.length; _j6++) {
  101852. var _item19 = points[_j6];
  101853. if (startPoint == 0 && _item19.x > leftSpace) {
  101854. context.moveTo(_item19.x, _item19.y);
  101855. startPoint = 1;
  101856. }
  101857. if (_j6 > 0 && _item19.x > leftSpace && _item19.x < rightSpace) {
  101858. context.lineTo(_item19.x, _item19.y);
  101859. }
  101860. }
  101861. ;
  101862. }
  101863. if (lineOption.type === 'step') {
  101864. for (var _j7 = 0; _j7 < points.length; _j7++) {
  101865. var _item20 = points[_j7];
  101866. if (startPoint == 0 && _item20.x > leftSpace) {
  101867. context.moveTo(_item20.x, _item20.y);
  101868. startPoint = 1;
  101869. }
  101870. if (_j7 > 0 && _item20.x > leftSpace && _item20.x < rightSpace) {
  101871. context.lineTo(_item20.x, points[_j7 - 1].y);
  101872. context.lineTo(_item20.x, _item20.y);
  101873. }
  101874. }
  101875. ;
  101876. }
  101877. context.moveTo(points[0].x, points[0].y);
  101878. }
  101879. });
  101880. context.stroke();
  101881. context.setLineDash([]);
  101882. if (opts.dataPointShape !== false) {
  101883. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  101884. }
  101885. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, lineOption);
  101886. });
  101887. if (opts.dataLabel !== false && process === 1) {
  101888. series.forEach(function (eachSeries, seriesIndex) {
  101889. var ranges, minRange, maxRange;
  101890. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101891. minRange = ranges.pop();
  101892. maxRange = ranges.shift();
  101893. var data = eachSeries.data;
  101894. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101895. drawPointText(points, eachSeries, config, context, opts);
  101896. });
  101897. }
  101898. context.restore();
  101899. return {
  101900. xAxisPoints: xAxisPoints,
  101901. calPoints: calPoints,
  101902. eachSpacing: eachSpacing
  101903. };
  101904. }
  101905. function drawMixDataPoints(series, opts, config, context) {
  101906. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  101907. var xAxisData = opts.chartData.xAxisData,
  101908. xAxisPoints = xAxisData.xAxisPoints,
  101909. eachSpacing = xAxisData.eachSpacing;
  101910. var columnOption = assign({}, {
  101911. width: eachSpacing / 2,
  101912. barBorderCircle: false,
  101913. barBorderRadius: [],
  101914. seriesGap: 2,
  101915. linearType: 'none',
  101916. linearOpacity: 1,
  101917. customColor: [],
  101918. colorStop: 0
  101919. }, opts.extra.mix.column);
  101920. var areaOption = assign({}, {
  101921. opacity: 0.2,
  101922. gradient: false
  101923. }, opts.extra.mix.area);
  101924. var lineOption = assign({}, {
  101925. width: 2
  101926. }, opts.extra.mix.line);
  101927. var endY = opts.height - opts.area[2];
  101928. var calPoints = [];
  101929. var columnIndex = 0;
  101930. var columnLength = 0;
  101931. series.forEach(function (eachSeries, seriesIndex) {
  101932. if (eachSeries.type == 'column') {
  101933. columnLength += 1;
  101934. }
  101935. });
  101936. context.save();
  101937. var leftNum = -2;
  101938. var rightNum = xAxisPoints.length + 2;
  101939. var leftSpace = 0;
  101940. var rightSpace = opts.width + eachSpacing;
  101941. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  101942. context.translate(opts._scrollDistance_, 0);
  101943. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  101944. rightNum = leftNum + opts.xAxis.itemCount + 4;
  101945. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  101946. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  101947. }
  101948. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  101949. series.forEach(function (eachSeries, seriesIndex) {
  101950. var ranges, minRange, maxRange;
  101951. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  101952. minRange = ranges.pop();
  101953. maxRange = ranges.shift();
  101954. var data = eachSeries.data;
  101955. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  101956. calPoints.push(points);
  101957. // 绘制柱状数据图
  101958. if (eachSeries.type == 'column') {
  101959. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  101960. for (var i = 0; i < points.length; i++) {
  101961. var item = points[i];
  101962. if (item !== null && i > leftNum && i < rightNum) {
  101963. var startX = item.x - item.width / 2;
  101964. var height = opts.height - item.y - opts.area[2];
  101965. context.beginPath();
  101966. var fillColor = item.color || eachSeries.color;
  101967. var strokeColor = item.color || eachSeries.color;
  101968. if (columnOption.linearType !== 'none') {
  101969. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  101970. //透明渐变
  101971. if (columnOption.linearType == 'opacity') {
  101972. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  101973. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101974. } else {
  101975. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  101976. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  101977. grd.addColorStop(1, hexToRgb(fillColor, 1));
  101978. }
  101979. fillColor = grd;
  101980. }
  101981. // 圆角边框
  101982. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle) {
  101983. var left = startX;
  101984. var top = item.y;
  101985. var width = item.width;
  101986. var _height5 = opts.height - opts.area[2] - item.y;
  101987. if (columnOption.barBorderCircle) {
  101988. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  101989. }
  101990. var _columnOption$barBord4 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  101991. r0 = _columnOption$barBord4[0],
  101992. r1 = _columnOption$barBord4[1],
  101993. r2 = _columnOption$barBord4[2],
  101994. r3 = _columnOption$barBord4[3];
  101995. var minRadius = Math.min(width / 2, _height5 / 2);
  101996. r0 = r0 > minRadius ? minRadius : r0;
  101997. r1 = r1 > minRadius ? minRadius : r1;
  101998. r2 = r2 > minRadius ? minRadius : r2;
  101999. r3 = r3 > minRadius ? minRadius : r3;
  102000. r0 = r0 < 0 ? 0 : r0;
  102001. r1 = r1 < 0 ? 0 : r1;
  102002. r2 = r2 < 0 ? 0 : r2;
  102003. r3 = r3 < 0 ? 0 : r3;
  102004. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  102005. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  102006. context.arc(left + width - r2, top + _height5 - r2, r2, 0, Math.PI / 2);
  102007. context.arc(left + r3, top + _height5 - r3, r3, Math.PI / 2, Math.PI);
  102008. } else {
  102009. context.moveTo(startX, item.y);
  102010. context.lineTo(startX + item.width, item.y);
  102011. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  102012. context.lineTo(startX, opts.height - opts.area[2]);
  102013. context.lineTo(startX, item.y);
  102014. context.setLineWidth(1);
  102015. context.setStrokeStyle(strokeColor);
  102016. }
  102017. context.setFillStyle(fillColor);
  102018. context.closePath();
  102019. context.fill();
  102020. }
  102021. }
  102022. columnIndex += 1;
  102023. }
  102024. //绘制区域图数据
  102025. if (eachSeries.type == 'area') {
  102026. var _splitPointList = splitPoints(points, eachSeries);
  102027. for (var _i23 = 0; _i23 < _splitPointList.length; _i23++) {
  102028. var _points3 = _splitPointList[_i23];
  102029. // 绘制区域数据
  102030. context.beginPath();
  102031. context.setStrokeStyle(eachSeries.color);
  102032. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  102033. if (areaOption.gradient) {
  102034. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  102035. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  102036. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  102037. context.setFillStyle(gradient);
  102038. } else {
  102039. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  102040. }
  102041. context.setLineWidth(2 * opts.pix);
  102042. if (_points3.length > 1) {
  102043. var firstPoint = _points3[0];
  102044. var lastPoint = _points3[_points3.length - 1];
  102045. context.moveTo(firstPoint.x, firstPoint.y);
  102046. var startPoint = 0;
  102047. if (eachSeries.style === 'curve') {
  102048. for (var j = 0; j < _points3.length; j++) {
  102049. var _item21 = _points3[j];
  102050. if (startPoint == 0 && _item21.x > leftSpace) {
  102051. context.moveTo(_item21.x, _item21.y);
  102052. startPoint = 1;
  102053. }
  102054. if (j > 0 && _item21.x > leftSpace && _item21.x < rightSpace) {
  102055. var ctrlPoint = createCurveControlPoints(_points3, j - 1);
  102056. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item21.x, _item21.y);
  102057. }
  102058. }
  102059. ;
  102060. } else {
  102061. for (var _j8 = 0; _j8 < _points3.length; _j8++) {
  102062. var _item22 = _points3[_j8];
  102063. if (startPoint == 0 && _item22.x > leftSpace) {
  102064. context.moveTo(_item22.x, _item22.y);
  102065. startPoint = 1;
  102066. }
  102067. if (_j8 > 0 && _item22.x > leftSpace && _item22.x < rightSpace) {
  102068. context.lineTo(_item22.x, _item22.y);
  102069. }
  102070. }
  102071. ;
  102072. }
  102073. context.lineTo(lastPoint.x, endY);
  102074. context.lineTo(firstPoint.x, endY);
  102075. context.lineTo(firstPoint.x, firstPoint.y);
  102076. } else {
  102077. var _item23 = _points3[0];
  102078. context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
  102079. // context.lineTo(item.x + eachSpacing / 2, item.y);
  102080. // context.lineTo(item.x + eachSpacing / 2, endY);
  102081. // context.lineTo(item.x - eachSpacing / 2, endY);
  102082. // context.moveTo(item.x - eachSpacing / 2, item.y);
  102083. }
  102084. context.closePath();
  102085. context.fill();
  102086. }
  102087. }
  102088. // 绘制折线数据图
  102089. if (eachSeries.type == 'line') {
  102090. var splitPointList = splitPoints(points, eachSeries);
  102091. splitPointList.forEach(function (points, index) {
  102092. if (eachSeries.lineType == 'dash') {
  102093. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  102094. dashLength *= opts.pix;
  102095. context.setLineDash([dashLength, dashLength]);
  102096. }
  102097. context.beginPath();
  102098. context.setStrokeStyle(eachSeries.color);
  102099. context.setLineWidth(lineOption.width * opts.pix);
  102100. if (points.length === 1) {
  102101. context.moveTo(points[0].x, points[0].y);
  102102. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  102103. } else {
  102104. context.moveTo(points[0].x, points[0].y);
  102105. var _startPoint2 = 0;
  102106. if (eachSeries.style == 'curve') {
  102107. for (var _j9 = 0; _j9 < points.length; _j9++) {
  102108. var _item24 = points[_j9];
  102109. if (_startPoint2 == 0 && _item24.x > leftSpace) {
  102110. context.moveTo(_item24.x, _item24.y);
  102111. _startPoint2 = 1;
  102112. }
  102113. if (_j9 > 0 && _item24.x > leftSpace && _item24.x < rightSpace) {
  102114. var ctrlPoint = createCurveControlPoints(points, _j9 - 1);
  102115. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item24.x, _item24.y);
  102116. }
  102117. }
  102118. } else {
  102119. for (var _j10 = 0; _j10 < points.length; _j10++) {
  102120. var _item25 = points[_j10];
  102121. if (_startPoint2 == 0 && _item25.x > leftSpace) {
  102122. context.moveTo(_item25.x, _item25.y);
  102123. _startPoint2 = 1;
  102124. }
  102125. if (_j10 > 0 && _item25.x > leftSpace && _item25.x < rightSpace) {
  102126. context.lineTo(_item25.x, _item25.y);
  102127. }
  102128. }
  102129. }
  102130. context.moveTo(points[0].x, points[0].y);
  102131. }
  102132. context.stroke();
  102133. context.setLineDash([]);
  102134. });
  102135. }
  102136. // 绘制点数据图
  102137. if (eachSeries.type == 'point') {
  102138. eachSeries.addPoint = true;
  102139. }
  102140. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  102141. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  102142. }
  102143. });
  102144. if (opts.dataLabel !== false && process === 1) {
  102145. var columnIndex = 0;
  102146. series.forEach(function (eachSeries, seriesIndex) {
  102147. var ranges, minRange, maxRange;
  102148. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  102149. minRange = ranges.pop();
  102150. maxRange = ranges.shift();
  102151. var data = eachSeries.data;
  102152. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  102153. if (eachSeries.type !== 'column') {
  102154. drawPointText(points, eachSeries, config, context, opts);
  102155. } else {
  102156. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  102157. drawPointText(points, eachSeries, config, context, opts);
  102158. columnIndex += 1;
  102159. }
  102160. });
  102161. }
  102162. context.restore();
  102163. return {
  102164. xAxisPoints: xAxisPoints,
  102165. calPoints: calPoints,
  102166. eachSpacing: eachSpacing
  102167. };
  102168. }
  102169. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  102170. var toolTipOption = opts.extra.tooltip || {};
  102171. if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'mount' || opts.type == 'candle' || opts.type == 'mix')) {
  102172. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  102173. }
  102174. context.save();
  102175. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  102176. context.translate(opts._scrollDistance_, 0);
  102177. }
  102178. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  102179. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  102180. }
  102181. context.restore();
  102182. }
  102183. function drawXAxis(categories, opts, config, context) {
  102184. var xAxisData = opts.chartData.xAxisData,
  102185. xAxisPoints = xAxisData.xAxisPoints,
  102186. startX = xAxisData.startX,
  102187. endX = xAxisData.endX,
  102188. eachSpacing = xAxisData.eachSpacing;
  102189. var boundaryGap = 'center';
  102190. if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  102191. boundaryGap = opts.xAxis.boundaryGap;
  102192. }
  102193. var startY = opts.height - opts.area[2];
  102194. var endY = opts.area[0];
  102195. //绘制滚动条
  102196. if (opts.enableScroll && opts.xAxis.scrollShow) {
  102197. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  102198. var scrollScreenWidth = endX - startX;
  102199. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  102200. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  102201. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  102202. scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing;
  102203. }
  102204. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  102205. var scrollLeft = 0;
  102206. if (opts._scrollDistance_) {
  102207. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  102208. }
  102209. context.beginPath();
  102210. context.setLineCap('round');
  102211. context.setLineWidth(6 * opts.pix);
  102212. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  102213. context.moveTo(startX, scrollY);
  102214. context.lineTo(endX, scrollY);
  102215. context.stroke();
  102216. context.closePath();
  102217. context.beginPath();
  102218. context.setLineCap('round');
  102219. context.setLineWidth(6 * opts.pix);
  102220. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  102221. context.moveTo(startX + scrollLeft, scrollY);
  102222. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  102223. context.stroke();
  102224. context.closePath();
  102225. context.setLineCap('butt');
  102226. }
  102227. context.save();
  102228. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  102229. context.translate(opts._scrollDistance_, 0);
  102230. }
  102231. //绘制X轴刻度线
  102232. if (opts.xAxis.calibration === true) {
  102233. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  102234. context.setLineCap('butt');
  102235. context.setLineWidth(1 * opts.pix);
  102236. xAxisPoints.forEach(function (item, index) {
  102237. if (index > 0) {
  102238. context.beginPath();
  102239. context.moveTo(item - eachSpacing / 2, startY);
  102240. context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix);
  102241. context.closePath();
  102242. context.stroke();
  102243. }
  102244. });
  102245. }
  102246. //绘制X轴网格
  102247. if (opts.xAxis.disableGrid !== true) {
  102248. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  102249. context.setLineCap('butt');
  102250. context.setLineWidth(1 * opts.pix);
  102251. if (opts.xAxis.gridType == 'dash') {
  102252. context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]);
  102253. }
  102254. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  102255. xAxisPoints.forEach(function (item, index) {
  102256. if (index % opts.xAxis.gridEval == 0) {
  102257. context.beginPath();
  102258. context.moveTo(item, startY);
  102259. context.lineTo(item, endY);
  102260. context.stroke();
  102261. }
  102262. });
  102263. context.setLineDash([]);
  102264. }
  102265. //绘制X轴文案
  102266. if (opts.xAxis.disabled !== true) {
  102267. // 对X轴列表做抽稀处理
  102268. //默认全部显示X轴标签
  102269. var maxXAxisListLength = categories.length;
  102270. //如果设置了X轴单屏数量
  102271. if (opts.xAxis.labelCount) {
  102272. //如果设置X轴密度
  102273. if (opts.xAxis.itemCount) {
  102274. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  102275. } else {
  102276. maxXAxisListLength = opts.xAxis.labelCount;
  102277. }
  102278. maxXAxisListLength -= 1;
  102279. }
  102280. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  102281. var newCategories = [];
  102282. var cgLength = categories.length;
  102283. for (var i = 0; i < cgLength; i++) {
  102284. if (i % ratio !== 0) {
  102285. newCategories.push("");
  102286. } else {
  102287. newCategories.push(categories[i]);
  102288. }
  102289. }
  102290. newCategories[cgLength - 1] = categories[cgLength - 1];
  102291. var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
  102292. if (config._xAxisTextAngle_ === 0) {
  102293. newCategories.forEach(function (item, index) {
  102294. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  102295. var offset = -measureText(String(xitem), xAxisFontSize, context) / 2;
  102296. if (boundaryGap == 'center') {
  102297. offset += eachSpacing / 2;
  102298. }
  102299. var scrollHeight = 0;
  102300. if (opts.xAxis.scrollShow) {
  102301. scrollHeight = 6 * opts.pix;
  102302. }
  102303. // 如果在主视图区域内
  102304. var _scrollDistance_ = opts._scrollDistance_ || 0;
  102305. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  102306. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  102307. context.beginPath();
  102308. context.setFontSize(xAxisFontSize);
  102309. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  102310. context.fillText(String(xitem), xAxisPoints[index] + offset, startY + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.fontSize) * opts.pix / 2 + opts.xAxis.fontSize * opts.pix);
  102311. context.closePath();
  102312. context.stroke();
  102313. }
  102314. });
  102315. } else {
  102316. newCategories.forEach(function (item, index) {
  102317. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item;
  102318. // 如果在主视图区域内
  102319. var _scrollDistance_ = opts._scrollDistance_ || 0;
  102320. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  102321. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  102322. context.save();
  102323. context.beginPath();
  102324. context.setFontSize(xAxisFontSize);
  102325. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  102326. var textWidth = measureText(String(xitem), xAxisFontSize, context);
  102327. var offsetX = xAxisPoints[index];
  102328. if (boundaryGap == 'center') {
  102329. offsetX = xAxisPoints[index] + eachSpacing / 2;
  102330. }
  102331. var scrollHeight = 0;
  102332. if (opts.xAxis.scrollShow) {
  102333. scrollHeight = 6 * opts.pix;
  102334. }
  102335. var offsetY = startY + opts.xAxis.marginTop * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config._xAxisTextAngle_));
  102336. if (opts.xAxis.rotateAngle < 0) {
  102337. offsetX -= xAxisFontSize / 2;
  102338. textWidth = 0;
  102339. } else {
  102340. offsetX += xAxisFontSize / 2;
  102341. textWidth = -textWidth;
  102342. }
  102343. context.translate(offsetX, offsetY);
  102344. context.rotate(-1 * config._xAxisTextAngle_);
  102345. context.fillText(String(xitem), textWidth, 0);
  102346. context.closePath();
  102347. context.stroke();
  102348. context.restore();
  102349. }
  102350. });
  102351. }
  102352. }
  102353. context.restore();
  102354. //画X轴标题
  102355. if (opts.xAxis.title) {
  102356. context.beginPath();
  102357. context.setFontSize(opts.xAxis.titleFontSize * opts.pix);
  102358. context.setFillStyle(opts.xAxis.titleFontColor);
  102359. context.fillText(String(opts.xAxis.title), opts.width - opts.area[1] + opts.xAxis.titleOffsetX * opts.pix, opts.height - opts.area[2] + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.titleFontSize) * opts.pix / 2 + (opts.xAxis.titleFontSize + opts.xAxis.titleOffsetY) * opts.pix);
  102360. context.closePath();
  102361. context.stroke();
  102362. }
  102363. //绘制X轴轴线
  102364. if (opts.xAxis.axisLine) {
  102365. context.beginPath();
  102366. context.setStrokeStyle(opts.xAxis.axisLineColor);
  102367. context.setLineWidth(1 * opts.pix);
  102368. context.moveTo(startX, opts.height - opts.area[2]);
  102369. context.lineTo(endX, opts.height - opts.area[2]);
  102370. context.stroke();
  102371. }
  102372. }
  102373. function drawYAxisGrid(categories, opts, config, context) {
  102374. if (opts.yAxis.disableGrid === true) {
  102375. return;
  102376. }
  102377. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  102378. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  102379. var startX = opts.area[3];
  102380. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  102381. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  102382. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  102383. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  102384. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  102385. TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing;
  102386. }
  102387. var endX = startX + TotalWidth;
  102388. var points = [];
  102389. var startY = 1;
  102390. if (opts.xAxis.axisLine === false) {
  102391. startY = 0;
  102392. }
  102393. for (var i = startY; i < opts.yAxis.splitNumber + 1; i++) {
  102394. points.push(opts.height - opts.area[2] - eachSpacing * i);
  102395. }
  102396. context.save();
  102397. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  102398. context.translate(opts._scrollDistance_, 0);
  102399. }
  102400. if (opts.yAxis.gridType == 'dash') {
  102401. context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]);
  102402. }
  102403. context.setStrokeStyle(opts.yAxis.gridColor);
  102404. context.setLineWidth(1 * opts.pix);
  102405. points.forEach(function (item, index) {
  102406. context.beginPath();
  102407. context.moveTo(startX, item);
  102408. context.lineTo(endX, item);
  102409. context.stroke();
  102410. });
  102411. context.setLineDash([]);
  102412. context.restore();
  102413. }
  102414. function drawYAxis(series, opts, config, context) {
  102415. if (opts.yAxis.disabled === true) {
  102416. return;
  102417. }
  102418. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  102419. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  102420. var startX = opts.area[3];
  102421. var endX = opts.width - opts.area[1];
  102422. var endY = opts.height - opts.area[2];
  102423. // set YAxis background
  102424. context.beginPath();
  102425. context.setFillStyle(opts.background);
  102426. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') {
  102427. context.fillRect(0, 0, startX, endY + 2 * opts.pix);
  102428. }
  102429. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') {
  102430. context.fillRect(endX, 0, opts.width, endY + 2 * opts.pix);
  102431. }
  102432. context.closePath();
  102433. context.stroke();
  102434. var tStartLeft = opts.area[3];
  102435. var tStartRight = opts.width - opts.area[1];
  102436. var tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2;
  102437. if (opts.yAxis.data) {
  102438. var _loop4 = function _loop4(i) {
  102439. var yData = opts.yAxis.data[i];
  102440. points = [];
  102441. if (yData.type === 'categories') {
  102442. for (var _i24 = 0; _i24 <= yData.categories.length; _i24++) {
  102443. points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData.categories.length * _i24);
  102444. }
  102445. } else {
  102446. for (var _i25 = 0; _i25 <= opts.yAxis.splitNumber; _i25++) {
  102447. points.push(opts.area[0] + eachSpacing * _i25);
  102448. }
  102449. }
  102450. if (yData.disabled !== true) {
  102451. var rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
  102452. var yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize;
  102453. var yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
  102454. var textAlign = yData.textAlign || "right";
  102455. //画Y轴刻度及文案
  102456. rangesFormat.forEach(function (item, index) {
  102457. var pos = points[index];
  102458. context.beginPath();
  102459. context.setFontSize(yAxisFontSize);
  102460. context.setLineWidth(1 * opts.pix);
  102461. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  102462. context.setFillStyle(yData.fontColor || opts.fontColor);
  102463. var tmpstrat = 0;
  102464. var gapwidth = 4 * opts.pix;
  102465. if (yAxisWidth.position == 'left') {
  102466. //画刻度线
  102467. if (yData.calibration == true) {
  102468. context.moveTo(tStartLeft, pos);
  102469. context.lineTo(tStartLeft - 3 * opts.pix, pos);
  102470. gapwidth += 3 * opts.pix;
  102471. }
  102472. //画文字
  102473. switch (textAlign) {
  102474. case "left":
  102475. context.setTextAlign('left');
  102476. tmpstrat = tStartLeft - yAxisWidth.width;
  102477. break;
  102478. case "right":
  102479. context.setTextAlign('right');
  102480. tmpstrat = tStartLeft - gapwidth;
  102481. break;
  102482. default:
  102483. context.setTextAlign('center');
  102484. tmpstrat = tStartLeft - yAxisWidth.width / 2;
  102485. }
  102486. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  102487. } else if (yAxisWidth.position == 'right') {
  102488. //画刻度线
  102489. if (yData.calibration == true) {
  102490. context.moveTo(tStartRight, pos);
  102491. context.lineTo(tStartRight + 3 * opts.pix, pos);
  102492. gapwidth += 3 * opts.pix;
  102493. }
  102494. switch (textAlign) {
  102495. case "left":
  102496. context.setTextAlign('left');
  102497. tmpstrat = tStartRight + gapwidth;
  102498. break;
  102499. case "right":
  102500. context.setTextAlign('right');
  102501. tmpstrat = tStartRight + yAxisWidth.width;
  102502. break;
  102503. default:
  102504. context.setTextAlign('center');
  102505. tmpstrat = tStartRight + yAxisWidth.width / 2;
  102506. }
  102507. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  102508. } else if (yAxisWidth.position == 'center') {
  102509. //画刻度线
  102510. if (yData.calibration == true) {
  102511. context.moveTo(tStartCenter, pos);
  102512. context.lineTo(tStartCenter - 3 * opts.pix, pos);
  102513. gapwidth += 3 * opts.pix;
  102514. }
  102515. //画文字
  102516. switch (textAlign) {
  102517. case "left":
  102518. context.setTextAlign('left');
  102519. tmpstrat = tStartCenter - yAxisWidth.width;
  102520. break;
  102521. case "right":
  102522. context.setTextAlign('right');
  102523. tmpstrat = tStartCenter - gapwidth;
  102524. break;
  102525. default:
  102526. context.setTextAlign('center');
  102527. tmpstrat = tStartCenter - yAxisWidth.width / 2;
  102528. }
  102529. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  102530. }
  102531. context.closePath();
  102532. context.stroke();
  102533. context.setTextAlign('left');
  102534. });
  102535. //画Y轴轴线
  102536. if (yData.axisLine !== false) {
  102537. context.beginPath();
  102538. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  102539. context.setLineWidth(1 * opts.pix);
  102540. if (yAxisWidth.position == 'left') {
  102541. context.moveTo(tStartLeft, opts.height - opts.area[2]);
  102542. context.lineTo(tStartLeft, opts.area[0]);
  102543. } else if (yAxisWidth.position == 'right') {
  102544. context.moveTo(tStartRight, opts.height - opts.area[2]);
  102545. context.lineTo(tStartRight, opts.area[0]);
  102546. } else if (yAxisWidth.position == 'center') {
  102547. context.moveTo(tStartCenter, opts.height - opts.area[2]);
  102548. context.lineTo(tStartCenter, opts.area[0]);
  102549. }
  102550. context.stroke();
  102551. }
  102552. //画Y轴标题
  102553. if (opts.yAxis.showTitle) {
  102554. var titleFontSize = yData.titleFontSize * opts.pix || config.fontSize;
  102555. var title = yData.title;
  102556. context.beginPath();
  102557. context.setFontSize(titleFontSize);
  102558. context.setFillStyle(yData.titleFontColor || opts.fontColor);
  102559. if (yAxisWidth.position == 'left') {
  102560. context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  102561. } else if (yAxisWidth.position == 'right') {
  102562. context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  102563. } else if (yAxisWidth.position == 'center') {
  102564. context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  102565. }
  102566. context.closePath();
  102567. context.stroke();
  102568. }
  102569. if (yAxisWidth.position == 'left') {
  102570. tStartLeft -= yAxisWidth.width + opts.yAxis.padding * opts.pix;
  102571. } else {
  102572. tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix;
  102573. }
  102574. }
  102575. };
  102576. for (var i = 0; i < opts.yAxis.data.length; i++) {
  102577. var points;
  102578. _loop4(i);
  102579. }
  102580. }
  102581. }
  102582. function drawLegend(series, opts, config, context, chartData) {
  102583. if (opts.legend.show === false) {
  102584. return;
  102585. }
  102586. var legendData = chartData.legendData;
  102587. var legendList = legendData.points;
  102588. var legendArea = legendData.area;
  102589. var padding = opts.legend.padding * opts.pix;
  102590. var fontSize = opts.legend.fontSize * opts.pix;
  102591. var shapeWidth = 15 * opts.pix;
  102592. var shapeRight = 5 * opts.pix;
  102593. var itemGap = opts.legend.itemGap * opts.pix;
  102594. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  102595. //画背景及边框
  102596. context.beginPath();
  102597. context.setLineWidth(opts.legend.borderWidth * opts.pix);
  102598. context.setStrokeStyle(opts.legend.borderColor);
  102599. context.setFillStyle(opts.legend.backgroundColor);
  102600. context.moveTo(legendArea.start.x, legendArea.start.y);
  102601. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  102602. context.closePath();
  102603. context.fill();
  102604. context.stroke();
  102605. legendList.forEach(function (itemList, listIndex) {
  102606. var width = 0;
  102607. var height = 0;
  102608. width = legendData.widthArr[listIndex];
  102609. height = legendData.heightArr[listIndex];
  102610. var startX = 0;
  102611. var startY = 0;
  102612. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  102613. switch (opts.legend.float) {
  102614. case 'left':
  102615. startX = legendArea.start.x + padding;
  102616. break;
  102617. case 'right':
  102618. startX = legendArea.start.x + legendArea.width - width;
  102619. break;
  102620. default:
  102621. startX = legendArea.start.x + (legendArea.width - width) / 2;
  102622. }
  102623. startY = legendArea.start.y + padding + listIndex * lineHeight;
  102624. } else {
  102625. if (listIndex == 0) {
  102626. width = 0;
  102627. } else {
  102628. width = legendData.widthArr[listIndex - 1];
  102629. }
  102630. startX = legendArea.start.x + padding + width;
  102631. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  102632. }
  102633. context.setFontSize(config.fontSize);
  102634. for (var i = 0; i < itemList.length; i++) {
  102635. var item = itemList[i];
  102636. item.area = [0, 0, 0, 0];
  102637. item.area[0] = startX;
  102638. item.area[1] = startY;
  102639. item.area[3] = startY + lineHeight;
  102640. context.beginPath();
  102641. context.setLineWidth(1 * opts.pix);
  102642. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  102643. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  102644. switch (item.legendShape) {
  102645. case 'line':
  102646. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix);
  102647. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts.pix);
  102648. break;
  102649. case 'triangle':
  102650. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  102651. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  102652. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  102653. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  102654. break;
  102655. case 'diamond':
  102656. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  102657. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight);
  102658. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  102659. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight);
  102660. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  102661. break;
  102662. case 'circle':
  102663. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight);
  102664. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math.PI);
  102665. break;
  102666. case 'rect':
  102667. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  102668. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  102669. break;
  102670. case 'square':
  102671. context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  102672. context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  102673. break;
  102674. case 'none':
  102675. break;
  102676. default:
  102677. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  102678. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  102679. }
  102680. context.closePath();
  102681. context.fill();
  102682. context.stroke();
  102683. startX += shapeWidth + shapeRight;
  102684. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  102685. var legendText = item.legendText ? item.legendText : item.name;
  102686. context.beginPath();
  102687. context.setFontSize(fontSize);
  102688. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  102689. context.fillText(legendText, startX, startY + fontTrans);
  102690. context.closePath();
  102691. context.stroke();
  102692. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  102693. startX += measureText(legendText, fontSize, context) + itemGap;
  102694. item.area[2] = startX;
  102695. } else {
  102696. item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;
  102697. ;
  102698. startX -= shapeWidth + shapeRight;
  102699. startY += lineHeight;
  102700. }
  102701. }
  102702. });
  102703. }
  102704. function drawPieDataPoints(series, opts, config, context) {
  102705. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  102706. var pieOption = assign({}, {
  102707. activeOpacity: 0.5,
  102708. activeRadius: 10,
  102709. offsetAngle: 0,
  102710. labelWidth: 15,
  102711. ringWidth: 30,
  102712. customRadius: 0,
  102713. border: false,
  102714. borderWidth: 2,
  102715. borderColor: '#FFFFFF',
  102716. centerColor: '#FFFFFF',
  102717. linearType: 'none',
  102718. customColor: []
  102719. }, opts.type == "pie" ? opts.extra.pie : opts.extra.ring);
  102720. var centerPosition = {
  102721. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  102722. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  102723. };
  102724. if (config.pieChartLinePadding == 0) {
  102725. config.pieChartLinePadding = pieOption.activeRadius * opts.pix;
  102726. }
  102727. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
  102728. radius = radius < 10 ? 10 : radius;
  102729. if (pieOption.customRadius > 0) {
  102730. radius = pieOption.customRadius * opts.pix;
  102731. }
  102732. series = getPieDataPoints(series, radius, process);
  102733. var activeRadius = pieOption.activeRadius * opts.pix;
  102734. pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config);
  102735. series = series.map(function (eachSeries) {
  102736. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  102737. return eachSeries;
  102738. });
  102739. series.forEach(function (eachSeries, seriesIndex) {
  102740. if (opts.tooltip) {
  102741. if (opts.tooltip.index == seriesIndex) {
  102742. context.beginPath();
  102743. context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5));
  102744. context.moveTo(centerPosition.x, centerPosition.y);
  102745. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  102746. context.closePath();
  102747. context.fill();
  102748. }
  102749. }
  102750. context.beginPath();
  102751. context.setLineWidth(pieOption.borderWidth * opts.pix);
  102752. context.lineJoin = "round";
  102753. context.setStrokeStyle(pieOption.borderColor);
  102754. var fillcolor = eachSeries.color;
  102755. if (pieOption.linearType == 'custom') {
  102756. var grd;
  102757. if (context.createCircularGradient) {
  102758. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  102759. } else {
  102760. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  102761. }
  102762. grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1));
  102763. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  102764. fillcolor = grd;
  102765. }
  102766. context.setFillStyle(fillcolor);
  102767. context.moveTo(centerPosition.x, centerPosition.y);
  102768. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  102769. context.closePath();
  102770. context.fill();
  102771. if (pieOption.border == true) {
  102772. context.stroke();
  102773. }
  102774. });
  102775. if (opts.type === 'ring') {
  102776. var innerPieWidth = radius * 0.6;
  102777. if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) {
  102778. innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix);
  102779. }
  102780. context.beginPath();
  102781. context.setFillStyle(pieOption.centerColor);
  102782. context.moveTo(centerPosition.x, centerPosition.y);
  102783. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  102784. context.closePath();
  102785. context.fill();
  102786. }
  102787. if (opts.dataLabel !== false && process === 1) {
  102788. drawPieText(series, opts, config, context, radius, centerPosition);
  102789. }
  102790. if (process === 1 && opts.type === 'ring') {
  102791. drawRingTitle(opts, config, context, centerPosition);
  102792. }
  102793. return {
  102794. center: centerPosition,
  102795. radius: radius,
  102796. series: series
  102797. };
  102798. }
  102799. function drawRoseDataPoints(series, opts, config, context) {
  102800. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  102801. var roseOption = assign({}, {
  102802. type: 'area',
  102803. activeOpacity: 0.5,
  102804. activeRadius: 10,
  102805. offsetAngle: 0,
  102806. labelWidth: 15,
  102807. border: false,
  102808. borderWidth: 2,
  102809. borderColor: '#FFFFFF',
  102810. linearType: 'none',
  102811. customColor: []
  102812. }, opts.extra.rose);
  102813. if (config.pieChartLinePadding == 0) {
  102814. config.pieChartLinePadding = roseOption.activeRadius * opts.pix;
  102815. }
  102816. var centerPosition = {
  102817. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  102818. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  102819. };
  102820. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
  102821. radius = radius < 10 ? 10 : radius;
  102822. var minRadius = roseOption.minRadius || radius * 0.5;
  102823. if (radius < minRadius) {
  102824. radius = minRadius + 10;
  102825. }
  102826. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  102827. var activeRadius = roseOption.activeRadius * opts.pix;
  102828. roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config);
  102829. series = series.map(function (eachSeries) {
  102830. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  102831. return eachSeries;
  102832. });
  102833. series.forEach(function (eachSeries, seriesIndex) {
  102834. if (opts.tooltip) {
  102835. if (opts.tooltip.index == seriesIndex) {
  102836. context.beginPath();
  102837. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  102838. context.moveTo(centerPosition.x, centerPosition.y);
  102839. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  102840. context.closePath();
  102841. context.fill();
  102842. }
  102843. }
  102844. context.beginPath();
  102845. context.setLineWidth(roseOption.borderWidth * opts.pix);
  102846. context.lineJoin = "round";
  102847. context.setStrokeStyle(roseOption.borderColor);
  102848. var fillcolor = eachSeries.color;
  102849. if (roseOption.linearType == 'custom') {
  102850. var grd;
  102851. if (context.createCircularGradient) {
  102852. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  102853. } else {
  102854. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  102855. }
  102856. grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1));
  102857. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  102858. fillcolor = grd;
  102859. }
  102860. context.setFillStyle(fillcolor);
  102861. context.moveTo(centerPosition.x, centerPosition.y);
  102862. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  102863. context.closePath();
  102864. context.fill();
  102865. if (roseOption.border == true) {
  102866. context.stroke();
  102867. }
  102868. });
  102869. if (opts.dataLabel !== false && process === 1) {
  102870. drawPieText(series, opts, config, context, radius, centerPosition);
  102871. }
  102872. return {
  102873. center: centerPosition,
  102874. radius: radius,
  102875. series: series
  102876. };
  102877. }
  102878. function drawArcbarDataPoints(series, opts, config, context) {
  102879. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  102880. var arcbarOption = assign({}, {
  102881. startAngle: 0.75,
  102882. endAngle: 0.25,
  102883. type: 'default',
  102884. direction: 'cw',
  102885. lineCap: 'round',
  102886. width: 12,
  102887. gap: 2,
  102888. linearType: 'none',
  102889. customColor: []
  102890. }, opts.extra.arcbar);
  102891. series = getArcbarDataPoints(series, arcbarOption, process);
  102892. var centerPosition;
  102893. if (arcbarOption.centerX || arcbarOption.centerY) {
  102894. centerPosition = {
  102895. x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2,
  102896. y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2
  102897. };
  102898. } else {
  102899. centerPosition = {
  102900. x: opts.width / 2,
  102901. y: opts.height / 2
  102902. };
  102903. }
  102904. var radius;
  102905. if (arcbarOption.radius) {
  102906. radius = arcbarOption.radius;
  102907. } else {
  102908. radius = Math.min(centerPosition.x, centerPosition.y);
  102909. radius -= 5 * opts.pix;
  102910. radius -= arcbarOption.width / 2;
  102911. }
  102912. radius = radius < 10 ? 10 : radius;
  102913. arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config);
  102914. for (var i = 0; i < series.length; i++) {
  102915. var eachSeries = series[i];
  102916. //背景颜色
  102917. context.setLineWidth(arcbarOption.width * opts.pix);
  102918. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  102919. context.setLineCap(arcbarOption.lineCap);
  102920. context.beginPath();
  102921. if (arcbarOption.type == 'default') {
  102922. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, arcbarOption.direction == 'ccw');
  102923. } else {
  102924. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, 0, 2 * Math.PI, arcbarOption.direction == 'ccw');
  102925. }
  102926. context.stroke();
  102927. //进度条
  102928. var fillColor = eachSeries.color;
  102929. if (arcbarOption.linearType == 'custom') {
  102930. var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + radius, centerPosition.y);
  102931. grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1));
  102932. grd.addColorStop(0, hexToRgb(eachSeries.color, 1));
  102933. fillColor = grd;
  102934. }
  102935. context.setLineWidth(arcbarOption.width * opts.pix);
  102936. context.setStrokeStyle(fillColor);
  102937. context.setLineCap(arcbarOption.lineCap);
  102938. context.beginPath();
  102939. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, arcbarOption.direction == 'ccw');
  102940. context.stroke();
  102941. }
  102942. drawRingTitle(opts, config, context, centerPosition);
  102943. return {
  102944. center: centerPosition,
  102945. radius: radius,
  102946. series: series
  102947. };
  102948. }
  102949. function drawGaugeDataPoints(categories, series, opts, config, context) {
  102950. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  102951. var gaugeOption = assign({}, {
  102952. type: 'default',
  102953. startAngle: 0.75,
  102954. endAngle: 0.25,
  102955. width: 15,
  102956. labelOffset: 13,
  102957. splitLine: {
  102958. fixRadius: 0,
  102959. splitNumber: 10,
  102960. width: 15,
  102961. color: '#FFFFFF',
  102962. childNumber: 5,
  102963. childWidth: 5
  102964. },
  102965. pointer: {
  102966. width: 15,
  102967. color: 'auto'
  102968. }
  102969. }, opts.extra.gauge);
  102970. if (gaugeOption.oldAngle == undefined) {
  102971. gaugeOption.oldAngle = gaugeOption.startAngle;
  102972. }
  102973. if (gaugeOption.oldData == undefined) {
  102974. gaugeOption.oldData = 0;
  102975. }
  102976. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  102977. var centerPosition = {
  102978. x: opts.width / 2,
  102979. y: opts.height / 2
  102980. };
  102981. var radius = Math.min(centerPosition.x, centerPosition.y);
  102982. radius -= 5 * opts.pix;
  102983. radius -= gaugeOption.width / 2;
  102984. radius = radius < 10 ? 10 : radius;
  102985. var innerRadius = radius - gaugeOption.width;
  102986. var totalAngle = 0;
  102987. //判断仪表盘的样式:default百度样式,progress新样式
  102988. if (gaugeOption.type == 'progress') {
  102989. //## 第一步画中心圆形背景和进度条背景
  102990. //中心圆形背景
  102991. var pieRadius = radius - gaugeOption.width * 3;
  102992. context.beginPath();
  102993. var gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, centerPosition.y + pieRadius);
  102994. //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
  102995. gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
  102996. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  102997. context.setFillStyle(gradient);
  102998. context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false);
  102999. context.fill();
  103000. //画进度条背景
  103001. context.setLineWidth(gaugeOption.width);
  103002. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  103003. context.setLineCap('round');
  103004. context.beginPath();
  103005. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption.endAngle * Math.PI, false);
  103006. context.stroke();
  103007. //## 第二步画刻度线
  103008. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  103009. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  103010. } else {
  103011. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  103012. }
  103013. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  103014. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  103015. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  103016. var endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  103017. context.save();
  103018. context.translate(centerPosition.x, centerPosition.y);
  103019. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  103020. var len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
  103021. var proc = series[0].data * process;
  103022. for (var i = 0; i < len; i++) {
  103023. context.beginPath();
  103024. //刻度线随进度变色
  103025. if (proc > i / len) {
  103026. context.setStrokeStyle(hexToRgb(series[0].color, 1));
  103027. } else {
  103028. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  103029. }
  103030. context.setLineWidth(3 * opts.pix);
  103031. context.moveTo(startX, 0);
  103032. context.lineTo(endX, 0);
  103033. context.stroke();
  103034. context.rotate(childAngle * Math.PI);
  103035. }
  103036. context.restore();
  103037. //## 第三步画进度条
  103038. series = getGaugeArcbarDataPoints(series, gaugeOption, process);
  103039. context.setLineWidth(gaugeOption.width);
  103040. context.setStrokeStyle(series[0].color);
  103041. context.setLineCap('round');
  103042. context.beginPath();
  103043. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0]._proportion_ * Math.PI, false);
  103044. context.stroke();
  103045. //## 第四步画指针
  103046. var pointerRadius = radius - gaugeOption.width * 2.5;
  103047. context.save();
  103048. context.translate(centerPosition.x, centerPosition.y);
  103049. context.rotate((series[0]._proportion_ - 1) * Math.PI);
  103050. context.beginPath();
  103051. context.setLineWidth(gaugeOption.width / 3);
  103052. var gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6);
  103053. gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
  103054. gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
  103055. gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
  103056. context.setStrokeStyle(gradient3);
  103057. context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false);
  103058. context.stroke();
  103059. context.beginPath();
  103060. context.setLineWidth(1);
  103061. context.setStrokeStyle(series[0].color);
  103062. context.setFillStyle(series[0].color);
  103063. context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  103064. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0);
  103065. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4);
  103066. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  103067. context.stroke();
  103068. context.fill();
  103069. context.restore();
  103070. //default百度样式
  103071. } else {
  103072. //画背景
  103073. context.setLineWidth(gaugeOption.width);
  103074. context.setLineCap('butt');
  103075. for (var _i26 = 0; _i26 < categories.length; _i26++) {
  103076. var eachCategories = categories[_i26];
  103077. context.beginPath();
  103078. context.setStrokeStyle(eachCategories.color);
  103079. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ * Math.PI, false);
  103080. context.stroke();
  103081. }
  103082. context.save();
  103083. //画刻度线
  103084. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  103085. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  103086. } else {
  103087. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  103088. }
  103089. var _splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  103090. var _childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  103091. var _startX2 = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  103092. var _endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  103093. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  103094. context.translate(centerPosition.x, centerPosition.y);
  103095. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  103096. for (var _i27 = 0; _i27 < gaugeOption.splitLine.splitNumber + 1; _i27++) {
  103097. context.beginPath();
  103098. context.setStrokeStyle(gaugeOption.splitLine.color);
  103099. context.setLineWidth(2 * opts.pix);
  103100. context.moveTo(_startX2, 0);
  103101. context.lineTo(_endX, 0);
  103102. context.stroke();
  103103. context.rotate(_splitAngle * Math.PI);
  103104. }
  103105. context.restore();
  103106. context.save();
  103107. context.translate(centerPosition.x, centerPosition.y);
  103108. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  103109. for (var _i28 = 0; _i28 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i28++) {
  103110. context.beginPath();
  103111. context.setStrokeStyle(gaugeOption.splitLine.color);
  103112. context.setLineWidth(1 * opts.pix);
  103113. context.moveTo(_startX2, 0);
  103114. context.lineTo(childendX, 0);
  103115. context.stroke();
  103116. context.rotate(_childAngle * Math.PI);
  103117. }
  103118. context.restore();
  103119. //画指针
  103120. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  103121. for (var _i29 = 0; _i29 < series.length; _i29++) {
  103122. var eachSeries = series[_i29];
  103123. context.save();
  103124. context.translate(centerPosition.x, centerPosition.y);
  103125. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  103126. context.beginPath();
  103127. context.setFillStyle(eachSeries.color);
  103128. context.moveTo(gaugeOption.pointer.width, 0);
  103129. context.lineTo(0, -gaugeOption.pointer.width / 2);
  103130. context.lineTo(-innerRadius, 0);
  103131. context.lineTo(0, gaugeOption.pointer.width / 2);
  103132. context.lineTo(gaugeOption.pointer.width, 0);
  103133. context.closePath();
  103134. context.fill();
  103135. context.beginPath();
  103136. context.setFillStyle('#FFFFFF');
  103137. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  103138. context.fill();
  103139. context.restore();
  103140. }
  103141. if (opts.dataLabel !== false) {
  103142. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  103143. }
  103144. }
  103145. //画仪表盘标题,副标题
  103146. drawRingTitle(opts, config, context, centerPosition);
  103147. if (process === 1 && opts.type === 'gauge') {
  103148. opts.extra.gauge.oldAngle = series[0]._proportion_;
  103149. opts.extra.gauge.oldData = series[0].data;
  103150. }
  103151. return {
  103152. center: centerPosition,
  103153. radius: radius,
  103154. innerRadius: innerRadius,
  103155. categories: categories,
  103156. totalAngle: totalAngle
  103157. };
  103158. }
  103159. function drawRadarDataPoints(series, opts, config, context) {
  103160. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  103161. var radarOption = assign({}, {
  103162. gridColor: '#cccccc',
  103163. gridType: 'radar',
  103164. gridEval: 1,
  103165. axisLabel: false,
  103166. axisLabelTofix: 0,
  103167. labelShow: true,
  103168. labelColor: '#666666',
  103169. labelPointShow: false,
  103170. labelPointRadius: 3,
  103171. labelPointColor: '#cccccc',
  103172. opacity: 0.2,
  103173. gridCount: 3,
  103174. border: false,
  103175. borderWidth: 2,
  103176. linearType: 'none',
  103177. customColor: []
  103178. }, opts.extra.radar);
  103179. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  103180. var centerPosition = {
  103181. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  103182. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  103183. };
  103184. var xr = (opts.width - opts.area[1] - opts.area[3]) / 2;
  103185. var yr = (opts.height - opts.area[0] - opts.area[2]) / 2;
  103186. var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config.radarLabelTextMargin), yr - config.radarLabelTextMargin);
  103187. radius -= config.radarLabelTextMargin * opts.pix;
  103188. radius = radius < 10 ? 10 : radius;
  103189. radius = radarOption.radius ? radarOption.radius : radius;
  103190. // 画分割线
  103191. context.beginPath();
  103192. context.setLineWidth(1 * opts.pix);
  103193. context.setStrokeStyle(radarOption.gridColor);
  103194. coordinateAngle.forEach(function (angle, index) {
  103195. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  103196. context.moveTo(centerPosition.x, centerPosition.y);
  103197. if (index % radarOption.gridEval == 0) {
  103198. context.lineTo(pos.x, pos.y);
  103199. }
  103200. });
  103201. context.stroke();
  103202. context.closePath();
  103203. // 画背景网格
  103204. var _loop = function _loop(i) {
  103205. var startPos = {};
  103206. context.beginPath();
  103207. context.setLineWidth(1 * opts.pix);
  103208. context.setStrokeStyle(radarOption.gridColor);
  103209. if (radarOption.gridType == 'radar') {
  103210. coordinateAngle.forEach(function (angle, index) {
  103211. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius / radarOption.gridCount * i * Math.sin(angle), centerPosition);
  103212. if (index === 0) {
  103213. startPos = pos;
  103214. context.moveTo(pos.x, pos.y);
  103215. } else {
  103216. context.lineTo(pos.x, pos.y);
  103217. }
  103218. });
  103219. context.lineTo(startPos.x, startPos.y);
  103220. } else {
  103221. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / radarOption.gridCount * i * Math.sin(1.5), centerPosition);
  103222. context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false);
  103223. }
  103224. context.stroke();
  103225. context.closePath();
  103226. };
  103227. for (var i = 1; i <= radarOption.gridCount; i++) {
  103228. _loop(i);
  103229. }
  103230. radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config);
  103231. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  103232. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  103233. // 绘制区域数据
  103234. context.beginPath();
  103235. context.setLineWidth(radarOption.borderWidth * opts.pix);
  103236. context.setStrokeStyle(eachSeries.color);
  103237. var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity);
  103238. if (radarOption.linearType == 'custom') {
  103239. var grd;
  103240. if (context.createCircularGradient) {
  103241. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius);
  103242. } else {
  103243. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, radius);
  103244. }
  103245. grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption.opacity));
  103246. grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity));
  103247. fillcolor = grd;
  103248. }
  103249. context.setFillStyle(fillcolor);
  103250. eachSeries.data.forEach(function (item, index) {
  103251. if (index === 0) {
  103252. context.moveTo(item.position.x, item.position.y);
  103253. } else {
  103254. context.lineTo(item.position.x, item.position.y);
  103255. }
  103256. });
  103257. context.closePath();
  103258. context.fill();
  103259. if (radarOption.border === true) {
  103260. context.stroke();
  103261. }
  103262. context.closePath();
  103263. if (opts.dataPointShape !== false) {
  103264. var points = eachSeries.data.map(function (item) {
  103265. return item.position;
  103266. });
  103267. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  103268. }
  103269. });
  103270. // 画刻度值
  103271. if (radarOption.axisLabel === true) {
  103272. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  103273. var stepLength = radius / radarOption.gridCount;
  103274. var fontSize = opts.fontSize * opts.pix;
  103275. context.setFontSize(fontSize);
  103276. context.setFillStyle(opts.fontColor);
  103277. context.setTextAlign('left');
  103278. for (var i = 0; i < radarOption.gridCount + 1; i++) {
  103279. var label = i * maxData / radarOption.gridCount;
  103280. label = label.toFixed(radarOption.axisLabelTofix);
  103281. context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + fontSize / 2);
  103282. }
  103283. }
  103284. // draw label text
  103285. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  103286. // draw dataLabel
  103287. if (opts.dataLabel !== false && process === 1) {
  103288. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  103289. context.beginPath();
  103290. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  103291. context.setFontSize(fontSize);
  103292. context.setFillStyle(eachSeries.textColor || opts.fontColor);
  103293. eachSeries.data.forEach(function (item, index) {
  103294. //如果是中心点垂直的上下点位
  103295. if (Math.abs(item.position.x - centerPosition.x) < 2) {
  103296. //如果在上面
  103297. if (item.position.y < centerPosition.y) {
  103298. context.setTextAlign('center');
  103299. context.fillText(item.value, item.position.x, item.position.y - 4);
  103300. } else {
  103301. context.setTextAlign('center');
  103302. context.fillText(item.value, item.position.x, item.position.y + fontSize + 2);
  103303. }
  103304. } else {
  103305. //如果在左侧
  103306. if (item.position.x < centerPosition.x) {
  103307. context.setTextAlign('right');
  103308. context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / 2 - 2);
  103309. } else {
  103310. context.setTextAlign('left');
  103311. context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / 2 - 2);
  103312. }
  103313. }
  103314. });
  103315. context.closePath();
  103316. context.stroke();
  103317. });
  103318. context.setTextAlign('left');
  103319. }
  103320. return {
  103321. center: centerPosition,
  103322. radius: radius,
  103323. angleList: coordinateAngle
  103324. };
  103325. }
  103326. // 经纬度转墨卡托
  103327. function lonlat2mercator(longitude, latitude) {
  103328. var mercator = Array(2);
  103329. var x = longitude * 20037508.34 / 180;
  103330. var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180);
  103331. y = y * 20037508.34 / 180;
  103332. mercator[0] = x;
  103333. mercator[1] = y;
  103334. return mercator;
  103335. }
  103336. // 墨卡托转经纬度
  103337. function mercator2lonlat(longitude, latitude) {
  103338. var lonlat = Array(2);
  103339. var x = longitude / 20037508.34 * 180;
  103340. var y = latitude / 20037508.34 * 180;
  103341. y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
  103342. lonlat[0] = x;
  103343. lonlat[1] = y;
  103344. return lonlat;
  103345. }
  103346. function getBoundingBox(data) {
  103347. var bounds = {},
  103348. coords;
  103349. bounds.xMin = 180;
  103350. bounds.xMax = 0;
  103351. bounds.yMin = 90;
  103352. bounds.yMax = 0;
  103353. for (var i = 0; i < data.length; i++) {
  103354. var coorda = data[i].geometry.coordinates;
  103355. for (var k = 0; k < coorda.length; k++) {
  103356. coords = coorda[k];
  103357. if (coords.length == 1) {
  103358. coords = coords[0];
  103359. }
  103360. for (var j = 0; j < coords.length; j++) {
  103361. var longitude = coords[j][0];
  103362. var latitude = coords[j][1];
  103363. var point = {
  103364. x: longitude,
  103365. y: latitude
  103366. };
  103367. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  103368. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  103369. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  103370. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  103371. }
  103372. }
  103373. }
  103374. return bounds;
  103375. }
  103376. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  103377. return {
  103378. x: (longitude - bounds.xMin) * scale + xoffset,
  103379. y: (bounds.yMax - latitude) * scale + yoffset
  103380. };
  103381. }
  103382. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  103383. return {
  103384. x: (pointX - xoffset) / scale + bounds.xMin,
  103385. y: bounds.yMax - (pointY - yoffset) / scale
  103386. };
  103387. }
  103388. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  103389. if (s_poi[1] == e_poi[1]) {
  103390. return false;
  103391. }
  103392. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {
  103393. return false;
  103394. }
  103395. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {
  103396. return false;
  103397. }
  103398. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {
  103399. return false;
  103400. }
  103401. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
  103402. return false;
  103403. }
  103404. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
  103405. return false;
  103406. }
  103407. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  103408. if (xseg < poi[0]) {
  103409. return false;
  103410. } else {
  103411. return true;
  103412. }
  103413. }
  103414. function isPoiWithinPoly(poi, poly, mercator) {
  103415. var sinsc = 0;
  103416. for (var i = 0; i < poly.length; i++) {
  103417. var epoly = poly[i][0];
  103418. if (poly.length == 1) {
  103419. epoly = poly[i][0];
  103420. }
  103421. for (var j = 0; j < epoly.length - 1; j++) {
  103422. var s_poi = epoly[j];
  103423. var e_poi = epoly[j + 1];
  103424. if (mercator) {
  103425. s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]);
  103426. e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]);
  103427. }
  103428. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  103429. sinsc += 1;
  103430. }
  103431. }
  103432. }
  103433. if (sinsc % 2 == 1) {
  103434. return true;
  103435. } else {
  103436. return false;
  103437. }
  103438. }
  103439. function drawMapDataPoints(series, opts, config, context) {
  103440. var mapOption = assign({}, {
  103441. border: true,
  103442. mercator: false,
  103443. borderWidth: 1,
  103444. active: true,
  103445. borderColor: '#666666',
  103446. fillOpacity: 0.6,
  103447. activeBorderColor: '#f04864',
  103448. activeFillColor: '#facc14',
  103449. activeFillOpacity: 1
  103450. }, opts.extra.map);
  103451. var coords, point;
  103452. var data = series;
  103453. var bounds = getBoundingBox(data);
  103454. if (mapOption.mercator) {
  103455. var max = lonlat2mercator(bounds.xMax, bounds.yMax);
  103456. var min = lonlat2mercator(bounds.xMin, bounds.yMin);
  103457. bounds.xMax = max[0];
  103458. bounds.yMax = max[1];
  103459. bounds.xMin = min[0];
  103460. bounds.yMin = min[1];
  103461. }
  103462. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  103463. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  103464. var scale = xScale < yScale ? xScale : yScale;
  103465. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  103466. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  103467. for (var i = 0; i < data.length; i++) {
  103468. context.beginPath();
  103469. context.setLineWidth(mapOption.borderWidth * opts.pix);
  103470. context.setStrokeStyle(mapOption.borderColor);
  103471. context.setFillStyle(hexToRgb(series[i].color, series[i].fillOpacity || mapOption.fillOpacity));
  103472. if (mapOption.active == true && opts.tooltip) {
  103473. if (opts.tooltip.index == i) {
  103474. context.setStrokeStyle(mapOption.activeBorderColor);
  103475. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  103476. }
  103477. }
  103478. var coorda = data[i].geometry.coordinates;
  103479. for (var k = 0; k < coorda.length; k++) {
  103480. coords = coorda[k];
  103481. if (coords.length == 1) {
  103482. coords = coords[0];
  103483. }
  103484. for (var j = 0; j < coords.length; j++) {
  103485. var gaosi = Array(2);
  103486. if (mapOption.mercator) {
  103487. gaosi = lonlat2mercator(coords[j][0], coords[j][1]);
  103488. } else {
  103489. gaosi = coords[j];
  103490. }
  103491. point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset);
  103492. if (j === 0) {
  103493. context.beginPath();
  103494. context.moveTo(point.x, point.y);
  103495. } else {
  103496. context.lineTo(point.x, point.y);
  103497. }
  103498. }
  103499. context.fill();
  103500. if (mapOption.border == true) {
  103501. context.stroke();
  103502. }
  103503. }
  103504. }
  103505. if (opts.dataLabel == true) {
  103506. for (var i = 0; i < data.length; i++) {
  103507. var centerPoint = data[i].properties.centroid;
  103508. if (centerPoint) {
  103509. if (mapOption.mercator) {
  103510. centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]);
  103511. }
  103512. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  103513. var fontSize = data[i].textSize * opts.pix || config.fontSize;
  103514. var fontColor = data[i].textColor || opts.fontColor;
  103515. if (mapOption.active && mapOption.activeTextColor && opts.tooltip && opts.tooltip.index == i) {
  103516. fontColor = mapOption.activeTextColor;
  103517. }
  103518. var text = data[i].properties.name;
  103519. context.beginPath();
  103520. context.setFontSize(fontSize);
  103521. context.setFillStyle(fontColor);
  103522. context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2);
  103523. context.closePath();
  103524. context.stroke();
  103525. }
  103526. }
  103527. }
  103528. opts.chartData.mapData = {
  103529. bounds: bounds,
  103530. scale: scale,
  103531. xoffset: xoffset,
  103532. yoffset: yoffset,
  103533. mercator: mapOption.mercator
  103534. };
  103535. drawToolTipBridge(opts, config, context, 1);
  103536. context.draw();
  103537. }
  103538. function normalInt(min, max, iter) {
  103539. iter = iter == 0 ? 1 : iter;
  103540. var arr = [];
  103541. for (var i = 0; i < iter; i++) {
  103542. arr[i] = Math.random();
  103543. }
  103544. ;
  103545. return Math.floor(arr.reduce(function (i, j) {
  103546. return i + j;
  103547. }) / iter * (max - min)) + min;
  103548. }
  103549. ;
  103550. function collisionNew(area, points, width, height) {
  103551. var isIn = false;
  103552. for (var i = 0; i < points.length; i++) {
  103553. if (points[i].area) {
  103554. if (area[3] < points[i].area[1] || area[0] > points[i].area[2] || area[1] > points[i].area[3] || area[2] < points[i].area[0]) {
  103555. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  103556. isIn = true;
  103557. break;
  103558. } else {
  103559. isIn = false;
  103560. }
  103561. } else {
  103562. isIn = true;
  103563. break;
  103564. }
  103565. }
  103566. }
  103567. return isIn;
  103568. }
  103569. ;
  103570. function getWordCloudPoint(opts, type, context) {
  103571. var points = opts.series;
  103572. switch (type) {
  103573. case 'normal':
  103574. for (var i = 0; i < points.length; i++) {
  103575. var text = points[i].name;
  103576. var tHeight = points[i].textSize * opts.pix;
  103577. var tWidth = measureText(text, tHeight, context);
  103578. var x = void 0,
  103579. y = void 0;
  103580. var area = void 0;
  103581. var breaknum = 0;
  103582. while (true) {
  103583. breaknum++;
  103584. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  103585. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  103586. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
  103587. var isCollision = collisionNew(area, points, opts.width, opts.height);
  103588. if (!isCollision) break;
  103589. if (breaknum == 1000) {
  103590. area = [-100, -100, -100, -100];
  103591. break;
  103592. }
  103593. }
  103594. ;
  103595. points[i].area = area;
  103596. }
  103597. break;
  103598. case 'vertical':
  103599. var Spin = function Spin() {
  103600. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  103601. if (Math.random() > 0.7) {
  103602. return true;
  103603. } else {
  103604. return false;
  103605. }
  103606. ;
  103607. };
  103608. ;
  103609. for (var _i30 = 0; _i30 < points.length; _i30++) {
  103610. var _text = points[_i30].name;
  103611. var _tHeight = points[_i30].textSize * opts.pix;
  103612. var _tWidth = measureText(_text, _tHeight, context);
  103613. var isSpin = Spin();
  103614. var _x = void 0,
  103615. _y = void 0,
  103616. _area = void 0,
  103617. areav = void 0;
  103618. var _breaknum = 0;
  103619. while (true) {
  103620. _breaknum++;
  103621. var _isCollision = void 0;
  103622. if (isSpin) {
  103623. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  103624. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  103625. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  103626. areav = [opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) - 5, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) - 5, opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) + _tHeight, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) + _tWidth + 5];
  103627. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  103628. } else {
  103629. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  103630. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  103631. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  103632. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  103633. }
  103634. if (!_isCollision) break;
  103635. if (_breaknum == 1000) {
  103636. _area = [-1000, -1000, -1000, -1000];
  103637. break;
  103638. }
  103639. }
  103640. ;
  103641. if (isSpin) {
  103642. points[_i30].area = areav;
  103643. points[_i30].areav = _area;
  103644. } else {
  103645. points[_i30].area = _area;
  103646. }
  103647. points[_i30].rotate = isSpin;
  103648. }
  103649. ;
  103650. break;
  103651. }
  103652. return points;
  103653. }
  103654. function drawWordCloudDataPoints(series, opts, config, context) {
  103655. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  103656. var wordOption = assign({}, {
  103657. type: 'normal',
  103658. autoColors: true
  103659. }, opts.extra.word);
  103660. if (!opts.chartData.wordCloudData) {
  103661. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context);
  103662. }
  103663. context.beginPath();
  103664. context.setFillStyle(opts.background);
  103665. context.rect(0, 0, opts.width, opts.height);
  103666. context.fill();
  103667. context.save();
  103668. var points = opts.chartData.wordCloudData;
  103669. context.translate(opts.width / 2, opts.height / 2);
  103670. for (var i = 0; i < points.length; i++) {
  103671. context.save();
  103672. if (points[i].rotate) {
  103673. context.rotate(90 * Math.PI / 180);
  103674. }
  103675. var text = points[i].name;
  103676. var tHeight = points[i].textSize * opts.pix;
  103677. var tWidth = measureText(text, tHeight, context);
  103678. context.beginPath();
  103679. context.setStrokeStyle(points[i].color);
  103680. context.setFillStyle(points[i].color);
  103681. context.setFontSize(tHeight);
  103682. if (points[i].rotate) {
  103683. if (points[i].areav[0] > 0) {
  103684. if (opts.tooltip) {
  103685. if (opts.tooltip.index == i) {
  103686. context.strokeText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  103687. } else {
  103688. context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  103689. }
  103690. } else {
  103691. context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  103692. }
  103693. }
  103694. } else {
  103695. if (points[i].area[0] > 0) {
  103696. if (opts.tooltip) {
  103697. if (opts.tooltip.index == i) {
  103698. context.strokeText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  103699. } else {
  103700. context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  103701. }
  103702. } else {
  103703. context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  103704. }
  103705. }
  103706. }
  103707. context.stroke();
  103708. context.restore();
  103709. }
  103710. context.restore();
  103711. }
  103712. function drawFunnelDataPoints(series, opts, config, context) {
  103713. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  103714. var funnelOption = assign({}, {
  103715. type: 'funnel',
  103716. activeWidth: 10,
  103717. activeOpacity: 0.3,
  103718. border: false,
  103719. borderWidth: 2,
  103720. borderColor: '#FFFFFF',
  103721. fillOpacity: 1,
  103722. minSize: 0,
  103723. labelAlign: 'right',
  103724. linearType: 'none',
  103725. customColor: []
  103726. }, opts.extra.funnel);
  103727. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  103728. var centerPosition = {
  103729. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  103730. y: opts.height - opts.area[2]
  103731. };
  103732. var activeWidth = funnelOption.activeWidth * opts.pix;
  103733. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  103734. var seriesNew = getFunnelDataPoints(series, radius, funnelOption, eachSpacing, process);
  103735. context.save();
  103736. context.translate(centerPosition.x, centerPosition.y);
  103737. funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config);
  103738. if (funnelOption.type == 'pyramid') {
  103739. for (var i = 0; i < seriesNew.length; i++) {
  103740. if (i == seriesNew.length - 1) {
  103741. if (opts.tooltip) {
  103742. if (opts.tooltip.index == i) {
  103743. context.beginPath();
  103744. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  103745. context.moveTo(-activeWidth, -eachSpacing);
  103746. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  103747. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  103748. context.lineTo(activeWidth, -eachSpacing);
  103749. context.lineTo(-activeWidth, -eachSpacing);
  103750. context.closePath();
  103751. context.fill();
  103752. }
  103753. }
  103754. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  103755. context.beginPath();
  103756. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  103757. context.setStrokeStyle(funnelOption.borderColor);
  103758. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  103759. if (funnelOption.linearType == 'custom') {
  103760. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  103761. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  103762. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  103763. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  103764. fillColor = grd;
  103765. }
  103766. context.setFillStyle(fillColor);
  103767. context.moveTo(0, -eachSpacing);
  103768. context.lineTo(-seriesNew[i].radius, 0);
  103769. context.lineTo(seriesNew[i].radius, 0);
  103770. context.lineTo(0, -eachSpacing);
  103771. context.closePath();
  103772. context.fill();
  103773. if (funnelOption.border == true) {
  103774. context.stroke();
  103775. }
  103776. } else {
  103777. if (opts.tooltip) {
  103778. if (opts.tooltip.index == i) {
  103779. context.beginPath();
  103780. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  103781. context.moveTo(0, 0);
  103782. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  103783. context.lineTo(-seriesNew[i + 1].radius - activeWidth, -eachSpacing);
  103784. context.lineTo(seriesNew[i + 1].radius + activeWidth, -eachSpacing);
  103785. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  103786. context.lineTo(0, 0);
  103787. context.closePath();
  103788. context.fill();
  103789. }
  103790. }
  103791. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  103792. context.beginPath();
  103793. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  103794. context.setStrokeStyle(funnelOption.borderColor);
  103795. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  103796. if (funnelOption.linearType == 'custom') {
  103797. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  103798. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  103799. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  103800. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  103801. fillColor = grd;
  103802. }
  103803. context.setFillStyle(fillColor);
  103804. context.moveTo(0, 0);
  103805. context.lineTo(-seriesNew[i].radius, 0);
  103806. context.lineTo(-seriesNew[i + 1].radius, -eachSpacing);
  103807. context.lineTo(seriesNew[i + 1].radius, -eachSpacing);
  103808. context.lineTo(seriesNew[i].radius, 0);
  103809. context.lineTo(0, 0);
  103810. context.closePath();
  103811. context.fill();
  103812. if (funnelOption.border == true) {
  103813. context.stroke();
  103814. }
  103815. }
  103816. context.translate(0, -eachSpacing);
  103817. }
  103818. } else {
  103819. context.translate(0, -(seriesNew.length - 1) * eachSpacing);
  103820. for (var _i31 = 0; _i31 < seriesNew.length; _i31++) {
  103821. if (_i31 == seriesNew.length - 1) {
  103822. if (opts.tooltip) {
  103823. if (opts.tooltip.index == _i31) {
  103824. context.beginPath();
  103825. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  103826. context.moveTo(-activeWidth - funnelOption.minSize / 2, 0);
  103827. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  103828. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  103829. context.lineTo(activeWidth + funnelOption.minSize / 2, 0);
  103830. context.lineTo(-activeWidth - funnelOption.minSize / 2, 0);
  103831. context.closePath();
  103832. context.fill();
  103833. }
  103834. }
  103835. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing, centerPosition.x + seriesNew[_i31].radius, centerPosition.y];
  103836. context.beginPath();
  103837. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  103838. context.setStrokeStyle(funnelOption.borderColor);
  103839. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  103840. if (funnelOption.linearType == 'custom') {
  103841. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  103842. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  103843. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  103844. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  103845. fillColor = grd;
  103846. }
  103847. context.setFillStyle(fillColor);
  103848. context.moveTo(0, 0);
  103849. context.lineTo(-funnelOption.minSize / 2, 0);
  103850. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  103851. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  103852. context.lineTo(funnelOption.minSize / 2, 0);
  103853. context.lineTo(0, 0);
  103854. context.closePath();
  103855. context.fill();
  103856. if (funnelOption.border == true) {
  103857. context.stroke();
  103858. }
  103859. } else {
  103860. if (opts.tooltip) {
  103861. if (opts.tooltip.index == _i31) {
  103862. context.beginPath();
  103863. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  103864. context.moveTo(0, 0);
  103865. context.lineTo(-seriesNew[_i31 + 1].radius - activeWidth, 0);
  103866. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  103867. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  103868. context.lineTo(seriesNew[_i31 + 1].radius + activeWidth, 0);
  103869. context.lineTo(0, 0);
  103870. context.closePath();
  103871. context.fill();
  103872. }
  103873. }
  103874. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31), centerPosition.x + seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31 - 1)];
  103875. context.beginPath();
  103876. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  103877. context.setStrokeStyle(funnelOption.borderColor);
  103878. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  103879. if (funnelOption.linearType == 'custom') {
  103880. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  103881. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  103882. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  103883. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  103884. fillColor = grd;
  103885. }
  103886. context.setFillStyle(fillColor);
  103887. context.moveTo(0, 0);
  103888. context.lineTo(-seriesNew[_i31 + 1].radius, 0);
  103889. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  103890. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  103891. context.lineTo(seriesNew[_i31 + 1].radius, 0);
  103892. context.lineTo(0, 0);
  103893. context.closePath();
  103894. context.fill();
  103895. if (funnelOption.border == true) {
  103896. context.stroke();
  103897. }
  103898. }
  103899. context.translate(0, eachSpacing);
  103900. }
  103901. }
  103902. context.restore();
  103903. if (opts.dataLabel !== false && process === 1) {
  103904. drawFunnelText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  103905. }
  103906. if (process === 1) {
  103907. drawFunnelCenterText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  103908. }
  103909. return {
  103910. center: centerPosition,
  103911. radius: radius,
  103912. series: seriesNew
  103913. };
  103914. }
  103915. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  103916. for (var i = 0; i < series.length; i++) {
  103917. var item = series[i];
  103918. if (item.labelShow === false) {
  103919. continue;
  103920. }
  103921. var startX = void 0,
  103922. endX = void 0,
  103923. startY = void 0,
  103924. fontSize = void 0;
  103925. var text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%';
  103926. text = item.labelText ? item.labelText : text;
  103927. if (labelAlign == 'right') {
  103928. if (i == series.length - 1) {
  103929. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  103930. } else {
  103931. startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2;
  103932. }
  103933. endX = startX + activeWidth * 2;
  103934. startY = item.funnelArea[1] + eachSpacing / 2;
  103935. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  103936. context.setLineWidth(1 * opts.pix);
  103937. context.setStrokeStyle(item.color);
  103938. context.setFillStyle(item.color);
  103939. context.beginPath();
  103940. context.moveTo(startX, startY);
  103941. context.lineTo(endX, startY);
  103942. context.stroke();
  103943. context.closePath();
  103944. context.beginPath();
  103945. context.moveTo(endX, startY);
  103946. context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI);
  103947. context.closePath();
  103948. context.fill();
  103949. context.beginPath();
  103950. context.setFontSize(fontSize);
  103951. context.setFillStyle(item.textColor || opts.fontColor);
  103952. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  103953. context.closePath();
  103954. context.stroke();
  103955. context.closePath();
  103956. }
  103957. if (labelAlign == 'left') {
  103958. if (i == series.length - 1) {
  103959. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  103960. } else {
  103961. startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2;
  103962. }
  103963. endX = startX - activeWidth * 2;
  103964. startY = item.funnelArea[1] + eachSpacing / 2;
  103965. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  103966. context.setLineWidth(1 * opts.pix);
  103967. context.setStrokeStyle(item.color);
  103968. context.setFillStyle(item.color);
  103969. context.beginPath();
  103970. context.moveTo(startX, startY);
  103971. context.lineTo(endX, startY);
  103972. context.stroke();
  103973. context.closePath();
  103974. context.beginPath();
  103975. context.moveTo(endX, startY);
  103976. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  103977. context.closePath();
  103978. context.fill();
  103979. context.beginPath();
  103980. context.setFontSize(fontSize);
  103981. context.setFillStyle(item.textColor || opts.fontColor);
  103982. context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2);
  103983. context.closePath();
  103984. context.stroke();
  103985. context.closePath();
  103986. }
  103987. }
  103988. }
  103989. function drawFunnelCenterText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  103990. for (var i = 0; i < series.length; i++) {
  103991. var item = series[i];
  103992. var startY = void 0,
  103993. fontSize = void 0;
  103994. if (item.centerText) {
  103995. startY = item.funnelArea[1] + eachSpacing / 2;
  103996. fontSize = item.centerTextSize * opts.pix || opts.fontSize * opts.pix;
  103997. context.beginPath();
  103998. context.setFontSize(fontSize);
  103999. context.setFillStyle(item.centerTextColor || "#FFFFFF");
  104000. context.fillText(item.centerText, centerPosition.x - measureText(item.centerText, fontSize, context) / 2, startY + fontSize / 2 - 2);
  104001. context.closePath();
  104002. context.stroke();
  104003. context.closePath();
  104004. }
  104005. }
  104006. }
  104007. function drawCanvas(opts, context) {
  104008. context.save();
  104009. context.translate(0, 0.5);
  104010. context.restore();
  104011. context.draw();
  104012. }
  104013. var Timing = {
  104014. easeIn: function easeIn(pos) {
  104015. return Math.pow(pos, 3);
  104016. },
  104017. easeOut: function easeOut(pos) {
  104018. return Math.pow(pos - 1, 3) + 1;
  104019. },
  104020. easeInOut: function easeInOut(pos) {
  104021. if ((pos /= 0.5) < 1) {
  104022. return 0.5 * Math.pow(pos, 3);
  104023. } else {
  104024. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  104025. }
  104026. },
  104027. linear: function linear(pos) {
  104028. return pos;
  104029. }
  104030. };
  104031. function Animation(opts) {
  104032. this.isStop = false;
  104033. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  104034. opts.timing = opts.timing || 'easeInOut';
  104035. var delay = 17;
  104036. function createAnimationFrame() {
  104037. if (typeof setTimeout !== 'undefined') {
  104038. return function (step, delay) {
  104039. setTimeout(function () {
  104040. var timeStamp = +new Date();
  104041. step(timeStamp);
  104042. }, delay);
  104043. };
  104044. } else if (typeof requestAnimationFrame !== 'undefined') {
  104045. return requestAnimationFrame;
  104046. } else {
  104047. return function (step) {
  104048. step(null);
  104049. };
  104050. }
  104051. }
  104052. ;
  104053. var animationFrame = createAnimationFrame();
  104054. var startTimeStamp = null;
  104055. var _step = function step(timestamp) {
  104056. if (timestamp === null || this.isStop === true) {
  104057. opts.onProcess && opts.onProcess(1);
  104058. opts.onAnimationFinish && opts.onAnimationFinish();
  104059. return;
  104060. }
  104061. if (startTimeStamp === null) {
  104062. startTimeStamp = timestamp;
  104063. }
  104064. if (timestamp - startTimeStamp < opts.duration) {
  104065. var process = (timestamp - startTimeStamp) / opts.duration;
  104066. var timingFunction = Timing[opts.timing];
  104067. process = timingFunction(process);
  104068. opts.onProcess && opts.onProcess(process);
  104069. animationFrame(_step, delay);
  104070. } else {
  104071. opts.onProcess && opts.onProcess(1);
  104072. opts.onAnimationFinish && opts.onAnimationFinish();
  104073. }
  104074. };
  104075. _step = _step.bind(this);
  104076. animationFrame(_step, delay);
  104077. }
  104078. Animation.prototype.stop = function () {
  104079. this.isStop = true;
  104080. };
  104081. function drawCharts(type, opts, config, context) {
  104082. var _this2 = this;
  104083. var _this = this;
  104084. var series = opts.series;
  104085. //兼容ECharts饼图类数据格式
  104086. if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') {
  104087. series = fixPieSeries(series, opts, config);
  104088. }
  104089. var categories = opts.categories;
  104090. if (type === 'mount') {
  104091. categories = [];
  104092. for (var j = 0; j < series.length; j++) {
  104093. if (series[j].show !== false) categories.push(series[j].name);
  104094. }
  104095. opts.categories = categories;
  104096. }
  104097. series = fillSeries(series, opts, config);
  104098. var duration = opts.animation ? opts.duration : 0;
  104099. _this.animationInstance && _this.animationInstance.stop();
  104100. var seriesMA = null;
  104101. if (type == 'candle') {
  104102. var average = assign({}, opts.extra.candle.average);
  104103. if (average.show) {
  104104. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  104105. seriesMA = fillSeries(seriesMA, opts, config);
  104106. opts.seriesMA = seriesMA;
  104107. } else if (opts.seriesMA) {
  104108. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  104109. } else {
  104110. seriesMA = series;
  104111. }
  104112. } else {
  104113. seriesMA = series;
  104114. }
  104115. /* 过滤掉show=false的series */
  104116. opts._series_ = series = filterSeries(series);
  104117. //重新计算图表区域
  104118. opts.area = new Array(4);
  104119. //复位绘图区域
  104120. for (var _j11 = 0; _j11 < 4; _j11++) {
  104121. opts.area[_j11] = opts.padding[_j11] * opts.pix;
  104122. }
  104123. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  104124. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context),
  104125. legendHeight = _calLegendData.area.wholeHeight,
  104126. legendWidth = _calLegendData.area.wholeWidth;
  104127. switch (opts.legend.position) {
  104128. case 'top':
  104129. opts.area[0] += legendHeight;
  104130. break;
  104131. case 'bottom':
  104132. opts.area[2] += legendHeight;
  104133. break;
  104134. case 'left':
  104135. opts.area[3] += legendWidth;
  104136. break;
  104137. case 'right':
  104138. opts.area[1] += legendWidth;
  104139. break;
  104140. }
  104141. var _calYAxisData = {},
  104142. yAxisWidth = 0;
  104143. if (opts.type === 'line' || opts.type === 'column' || opts.type === 'mount' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  104144. _calYAxisData = calYAxisData(series, opts, config, context);
  104145. yAxisWidth = _calYAxisData.yAxisWidth;
  104146. //如果显示Y轴标题
  104147. if (opts.yAxis.showTitle) {
  104148. var maxTitleHeight = 0;
  104149. for (var i = 0; i < opts.yAxis.data.length; i++) {
  104150. maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i].titleFontSize * opts.pix : config.fontSize);
  104151. }
  104152. opts.area[0] += maxTitleHeight;
  104153. }
  104154. var rightIndex = 0,
  104155. leftIndex = 0;
  104156. //计算主绘图区域左右位置
  104157. for (var _i32 = 0; _i32 < yAxisWidth.length; _i32++) {
  104158. if (yAxisWidth[_i32].position == 'left') {
  104159. if (leftIndex > 0) {
  104160. opts.area[3] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  104161. } else {
  104162. opts.area[3] += yAxisWidth[_i32].width;
  104163. }
  104164. leftIndex += 1;
  104165. } else if (yAxisWidth[_i32].position == 'right') {
  104166. if (rightIndex > 0) {
  104167. opts.area[1] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  104168. } else {
  104169. opts.area[1] += yAxisWidth[_i32].width;
  104170. }
  104171. rightIndex += 1;
  104172. }
  104173. }
  104174. } else {
  104175. config.yAxisWidth = yAxisWidth;
  104176. }
  104177. opts.chartData.yAxisData = _calYAxisData;
  104178. if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== 'bar') {
  104179. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  104180. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  104181. xAxisHeight = _calCategoriesData.xAxisHeight,
  104182. angle = _calCategoriesData.angle;
  104183. config.xAxisHeight = xAxisHeight;
  104184. config._xAxisTextAngle_ = angle;
  104185. opts.area[2] += xAxisHeight;
  104186. opts.chartData.categoriesData = _calCategoriesData;
  104187. } else {
  104188. if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  104189. opts.chartData.xAxisData = calXAxisData(series, opts, config, context);
  104190. categories = opts.chartData.xAxisData.rangesFormat;
  104191. var _calCategoriesData2 = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  104192. _xAxisHeight = _calCategoriesData2.xAxisHeight,
  104193. _angle = _calCategoriesData2.angle;
  104194. config.xAxisHeight = _xAxisHeight;
  104195. config._xAxisTextAngle_ = _angle;
  104196. opts.area[2] += _xAxisHeight;
  104197. opts.chartData.categoriesData = _calCategoriesData2;
  104198. } else {
  104199. opts.chartData.xAxisData = {
  104200. xAxisPoints: []
  104201. };
  104202. }
  104203. }
  104204. //计算右对齐偏移距离
  104205. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  104206. var offsetLeft = 0,
  104207. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  104208. startX = opts.chartData.xAxisData.startX,
  104209. endX = opts.chartData.xAxisData.endX,
  104210. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  104211. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  104212. var screenWidth = endX - startX;
  104213. offsetLeft = screenWidth - totalWidth;
  104214. _this.scrollOption.currentOffset = offsetLeft;
  104215. _this.scrollOption.startTouchX = offsetLeft;
  104216. _this.scrollOption.distance = 0;
  104217. _this.scrollOption.lastMoveTime = 0;
  104218. opts._scrollDistance_ = offsetLeft;
  104219. }
  104220. if (type === 'pie' || type === 'ring' || type === 'rose') {
  104221. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts);
  104222. }
  104223. switch (type) {
  104224. case 'word':
  104225. this.animationInstance = new Animation({
  104226. timing: opts.timing,
  104227. duration: duration,
  104228. onProcess: function onProcess(process) {
  104229. context.clearRect(0, 0, opts.width, opts.height);
  104230. if (opts.rotate) {
  104231. contextRotate(context, opts);
  104232. }
  104233. drawWordCloudDataPoints(series, opts, config, context, process);
  104234. drawCanvas(opts, context);
  104235. },
  104236. onAnimationFinish: function onAnimationFinish() {
  104237. _this.uevent.trigger('renderComplete');
  104238. }
  104239. });
  104240. break;
  104241. case 'map':
  104242. context.clearRect(0, 0, opts.width, opts.height);
  104243. drawMapDataPoints(series, opts, config, context);
  104244. setTimeout(function () {
  104245. _this2.uevent.trigger('renderComplete');
  104246. }, 50);
  104247. break;
  104248. case 'funnel':
  104249. this.animationInstance = new Animation({
  104250. timing: opts.timing,
  104251. duration: duration,
  104252. onProcess: function onProcess(process) {
  104253. context.clearRect(0, 0, opts.width, opts.height);
  104254. if (opts.rotate) {
  104255. contextRotate(context, opts);
  104256. }
  104257. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  104258. drawLegend(opts.series, opts, config, context, opts.chartData);
  104259. drawToolTipBridge(opts, config, context, process);
  104260. drawCanvas(opts, context);
  104261. },
  104262. onAnimationFinish: function onAnimationFinish() {
  104263. _this.uevent.trigger('renderComplete');
  104264. }
  104265. });
  104266. break;
  104267. case 'line':
  104268. this.animationInstance = new Animation({
  104269. timing: opts.timing,
  104270. duration: duration,
  104271. onProcess: function onProcess(process) {
  104272. context.clearRect(0, 0, opts.width, opts.height);
  104273. if (opts.rotate) {
  104274. contextRotate(context, opts);
  104275. }
  104276. drawYAxisGrid(categories, opts, config, context);
  104277. drawXAxis(categories, opts, config, context);
  104278. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  104279. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  104280. calPoints = _drawLineDataPoints.calPoints,
  104281. eachSpacing = _drawLineDataPoints.eachSpacing;
  104282. opts.chartData.xAxisPoints = xAxisPoints;
  104283. opts.chartData.calPoints = calPoints;
  104284. opts.chartData.eachSpacing = eachSpacing;
  104285. drawYAxis(series, opts, config, context);
  104286. if (opts.enableMarkLine !== false && process === 1) {
  104287. drawMarkLine(opts, config, context);
  104288. }
  104289. drawLegend(opts.series, opts, config, context, opts.chartData);
  104290. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104291. drawCanvas(opts, context);
  104292. },
  104293. onAnimationFinish: function onAnimationFinish() {
  104294. _this.uevent.trigger('renderComplete');
  104295. }
  104296. });
  104297. break;
  104298. case 'scatter':
  104299. this.animationInstance = new Animation({
  104300. timing: opts.timing,
  104301. duration: duration,
  104302. onProcess: function onProcess(process) {
  104303. context.clearRect(0, 0, opts.width, opts.height);
  104304. if (opts.rotate) {
  104305. contextRotate(context, opts);
  104306. }
  104307. drawYAxisGrid(categories, opts, config, context);
  104308. drawXAxis(categories, opts, config, context);
  104309. var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, process),
  104310. xAxisPoints = _drawScatterDataPoints.xAxisPoints,
  104311. calPoints = _drawScatterDataPoints.calPoints,
  104312. eachSpacing = _drawScatterDataPoints.eachSpacing;
  104313. opts.chartData.xAxisPoints = xAxisPoints;
  104314. opts.chartData.calPoints = calPoints;
  104315. opts.chartData.eachSpacing = eachSpacing;
  104316. drawYAxis(series, opts, config, context);
  104317. if (opts.enableMarkLine !== false && process === 1) {
  104318. drawMarkLine(opts, config, context);
  104319. }
  104320. drawLegend(opts.series, opts, config, context, opts.chartData);
  104321. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104322. drawCanvas(opts, context);
  104323. },
  104324. onAnimationFinish: function onAnimationFinish() {
  104325. _this.uevent.trigger('renderComplete');
  104326. }
  104327. });
  104328. break;
  104329. case 'bubble':
  104330. this.animationInstance = new Animation({
  104331. timing: opts.timing,
  104332. duration: duration,
  104333. onProcess: function onProcess(process) {
  104334. context.clearRect(0, 0, opts.width, opts.height);
  104335. if (opts.rotate) {
  104336. contextRotate(context, opts);
  104337. }
  104338. drawYAxisGrid(categories, opts, config, context);
  104339. drawXAxis(categories, opts, config, context);
  104340. var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, process),
  104341. xAxisPoints = _drawBubbleDataPoints.xAxisPoints,
  104342. calPoints = _drawBubbleDataPoints.calPoints,
  104343. eachSpacing = _drawBubbleDataPoints.eachSpacing;
  104344. opts.chartData.xAxisPoints = xAxisPoints;
  104345. opts.chartData.calPoints = calPoints;
  104346. opts.chartData.eachSpacing = eachSpacing;
  104347. drawYAxis(series, opts, config, context);
  104348. if (opts.enableMarkLine !== false && process === 1) {
  104349. drawMarkLine(opts, config, context);
  104350. }
  104351. drawLegend(opts.series, opts, config, context, opts.chartData);
  104352. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104353. drawCanvas(opts, context);
  104354. },
  104355. onAnimationFinish: function onAnimationFinish() {
  104356. _this.uevent.trigger('renderComplete');
  104357. }
  104358. });
  104359. break;
  104360. case 'mix':
  104361. this.animationInstance = new Animation({
  104362. timing: opts.timing,
  104363. duration: duration,
  104364. onProcess: function onProcess(process) {
  104365. context.clearRect(0, 0, opts.width, opts.height);
  104366. if (opts.rotate) {
  104367. contextRotate(context, opts);
  104368. }
  104369. drawYAxisGrid(categories, opts, config, context);
  104370. drawXAxis(categories, opts, config, context);
  104371. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  104372. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  104373. calPoints = _drawMixDataPoints.calPoints,
  104374. eachSpacing = _drawMixDataPoints.eachSpacing;
  104375. opts.chartData.xAxisPoints = xAxisPoints;
  104376. opts.chartData.calPoints = calPoints;
  104377. opts.chartData.eachSpacing = eachSpacing;
  104378. drawYAxis(series, opts, config, context);
  104379. if (opts.enableMarkLine !== false && process === 1) {
  104380. drawMarkLine(opts, config, context);
  104381. }
  104382. drawLegend(opts.series, opts, config, context, opts.chartData);
  104383. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104384. drawCanvas(opts, context);
  104385. },
  104386. onAnimationFinish: function onAnimationFinish() {
  104387. _this.uevent.trigger('renderComplete');
  104388. }
  104389. });
  104390. break;
  104391. case 'column':
  104392. this.animationInstance = new Animation({
  104393. timing: opts.timing,
  104394. duration: duration,
  104395. onProcess: function onProcess(process) {
  104396. context.clearRect(0, 0, opts.width, opts.height);
  104397. if (opts.rotate) {
  104398. contextRotate(context, opts);
  104399. }
  104400. drawYAxisGrid(categories, opts, config, context);
  104401. drawXAxis(categories, opts, config, context);
  104402. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  104403. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  104404. calPoints = _drawColumnDataPoints.calPoints,
  104405. eachSpacing = _drawColumnDataPoints.eachSpacing;
  104406. opts.chartData.xAxisPoints = xAxisPoints;
  104407. opts.chartData.calPoints = calPoints;
  104408. opts.chartData.eachSpacing = eachSpacing;
  104409. drawYAxis(series, opts, config, context);
  104410. if (opts.enableMarkLine !== false && process === 1) {
  104411. drawMarkLine(opts, config, context);
  104412. }
  104413. drawLegend(opts.series, opts, config, context, opts.chartData);
  104414. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104415. drawCanvas(opts, context);
  104416. },
  104417. onAnimationFinish: function onAnimationFinish() {
  104418. _this.uevent.trigger('renderComplete');
  104419. }
  104420. });
  104421. break;
  104422. case 'mount':
  104423. this.animationInstance = new Animation({
  104424. timing: opts.timing,
  104425. duration: duration,
  104426. onProcess: function onProcess(process) {
  104427. context.clearRect(0, 0, opts.width, opts.height);
  104428. if (opts.rotate) {
  104429. contextRotate(context, opts);
  104430. }
  104431. drawYAxisGrid(categories, opts, config, context);
  104432. drawXAxis(categories, opts, config, context);
  104433. var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process),
  104434. xAxisPoints = _drawMountDataPoints.xAxisPoints,
  104435. calPoints = _drawMountDataPoints.calPoints,
  104436. eachSpacing = _drawMountDataPoints.eachSpacing;
  104437. opts.chartData.xAxisPoints = xAxisPoints;
  104438. opts.chartData.calPoints = calPoints;
  104439. opts.chartData.eachSpacing = eachSpacing;
  104440. drawYAxis(series, opts, config, context);
  104441. if (opts.enableMarkLine !== false && process === 1) {
  104442. drawMarkLine(opts, config, context);
  104443. }
  104444. drawLegend(opts.series, opts, config, context, opts.chartData);
  104445. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104446. drawCanvas(opts, context);
  104447. },
  104448. onAnimationFinish: function onAnimationFinish() {
  104449. _this.uevent.trigger('renderComplete');
  104450. }
  104451. });
  104452. break;
  104453. case 'bar':
  104454. this.animationInstance = new Animation({
  104455. timing: opts.timing,
  104456. duration: duration,
  104457. onProcess: function onProcess(process) {
  104458. context.clearRect(0, 0, opts.width, opts.height);
  104459. if (opts.rotate) {
  104460. contextRotate(context, opts);
  104461. }
  104462. drawXAxis(categories, opts, config, context);
  104463. var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process),
  104464. yAxisPoints = _drawBarDataPoints.yAxisPoints,
  104465. calPoints = _drawBarDataPoints.calPoints,
  104466. eachSpacing = _drawBarDataPoints.eachSpacing;
  104467. opts.chartData.yAxisPoints = yAxisPoints;
  104468. opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints;
  104469. opts.chartData.calPoints = calPoints;
  104470. opts.chartData.eachSpacing = eachSpacing;
  104471. drawYAxis(series, opts, config, context);
  104472. if (opts.enableMarkLine !== false && process === 1) {
  104473. drawMarkLine(opts, config, context);
  104474. }
  104475. drawLegend(opts.series, opts, config, context, opts.chartData);
  104476. drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints);
  104477. drawCanvas(opts, context);
  104478. },
  104479. onAnimationFinish: function onAnimationFinish() {
  104480. _this.uevent.trigger('renderComplete');
  104481. }
  104482. });
  104483. break;
  104484. case 'area':
  104485. this.animationInstance = new Animation({
  104486. timing: opts.timing,
  104487. duration: duration,
  104488. onProcess: function onProcess(process) {
  104489. context.clearRect(0, 0, opts.width, opts.height);
  104490. if (opts.rotate) {
  104491. contextRotate(context, opts);
  104492. }
  104493. drawYAxisGrid(categories, opts, config, context);
  104494. drawXAxis(categories, opts, config, context);
  104495. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  104496. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  104497. calPoints = _drawAreaDataPoints.calPoints,
  104498. eachSpacing = _drawAreaDataPoints.eachSpacing;
  104499. opts.chartData.xAxisPoints = xAxisPoints;
  104500. opts.chartData.calPoints = calPoints;
  104501. opts.chartData.eachSpacing = eachSpacing;
  104502. drawYAxis(series, opts, config, context);
  104503. if (opts.enableMarkLine !== false && process === 1) {
  104504. drawMarkLine(opts, config, context);
  104505. }
  104506. drawLegend(opts.series, opts, config, context, opts.chartData);
  104507. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104508. drawCanvas(opts, context);
  104509. },
  104510. onAnimationFinish: function onAnimationFinish() {
  104511. _this.uevent.trigger('renderComplete');
  104512. }
  104513. });
  104514. break;
  104515. case 'ring':
  104516. this.animationInstance = new Animation({
  104517. timing: opts.timing,
  104518. duration: duration,
  104519. onProcess: function onProcess(process) {
  104520. context.clearRect(0, 0, opts.width, opts.height);
  104521. if (opts.rotate) {
  104522. contextRotate(context, opts);
  104523. }
  104524. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  104525. drawLegend(opts.series, opts, config, context, opts.chartData);
  104526. drawToolTipBridge(opts, config, context, process);
  104527. drawCanvas(opts, context);
  104528. },
  104529. onAnimationFinish: function onAnimationFinish() {
  104530. _this.uevent.trigger('renderComplete');
  104531. }
  104532. });
  104533. break;
  104534. case 'pie':
  104535. this.animationInstance = new Animation({
  104536. timing: opts.timing,
  104537. duration: duration,
  104538. onProcess: function onProcess(process) {
  104539. context.clearRect(0, 0, opts.width, opts.height);
  104540. if (opts.rotate) {
  104541. contextRotate(context, opts);
  104542. }
  104543. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  104544. drawLegend(opts.series, opts, config, context, opts.chartData);
  104545. drawToolTipBridge(opts, config, context, process);
  104546. drawCanvas(opts, context);
  104547. },
  104548. onAnimationFinish: function onAnimationFinish() {
  104549. _this.uevent.trigger('renderComplete');
  104550. }
  104551. });
  104552. break;
  104553. case 'rose':
  104554. this.animationInstance = new Animation({
  104555. timing: opts.timing,
  104556. duration: duration,
  104557. onProcess: function onProcess(process) {
  104558. context.clearRect(0, 0, opts.width, opts.height);
  104559. if (opts.rotate) {
  104560. contextRotate(context, opts);
  104561. }
  104562. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  104563. drawLegend(opts.series, opts, config, context, opts.chartData);
  104564. drawToolTipBridge(opts, config, context, process);
  104565. drawCanvas(opts, context);
  104566. },
  104567. onAnimationFinish: function onAnimationFinish() {
  104568. _this.uevent.trigger('renderComplete');
  104569. }
  104570. });
  104571. break;
  104572. case 'radar':
  104573. this.animationInstance = new Animation({
  104574. timing: opts.timing,
  104575. duration: duration,
  104576. onProcess: function onProcess(process) {
  104577. context.clearRect(0, 0, opts.width, opts.height);
  104578. if (opts.rotate) {
  104579. contextRotate(context, opts);
  104580. }
  104581. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  104582. drawLegend(opts.series, opts, config, context, opts.chartData);
  104583. drawToolTipBridge(opts, config, context, process);
  104584. drawCanvas(opts, context);
  104585. },
  104586. onAnimationFinish: function onAnimationFinish() {
  104587. _this.uevent.trigger('renderComplete');
  104588. }
  104589. });
  104590. break;
  104591. case 'arcbar':
  104592. this.animationInstance = new Animation({
  104593. timing: opts.timing,
  104594. duration: duration,
  104595. onProcess: function onProcess(process) {
  104596. context.clearRect(0, 0, opts.width, opts.height);
  104597. if (opts.rotate) {
  104598. contextRotate(context, opts);
  104599. }
  104600. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  104601. drawCanvas(opts, context);
  104602. },
  104603. onAnimationFinish: function onAnimationFinish() {
  104604. _this.uevent.trigger('renderComplete');
  104605. }
  104606. });
  104607. break;
  104608. case 'gauge':
  104609. this.animationInstance = new Animation({
  104610. timing: opts.timing,
  104611. duration: duration,
  104612. onProcess: function onProcess(process) {
  104613. context.clearRect(0, 0, opts.width, opts.height);
  104614. if (opts.rotate) {
  104615. contextRotate(context, opts);
  104616. }
  104617. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  104618. drawCanvas(opts, context);
  104619. },
  104620. onAnimationFinish: function onAnimationFinish() {
  104621. _this.uevent.trigger('renderComplete');
  104622. }
  104623. });
  104624. break;
  104625. case 'candle':
  104626. this.animationInstance = new Animation({
  104627. timing: opts.timing,
  104628. duration: duration,
  104629. onProcess: function onProcess(process) {
  104630. context.clearRect(0, 0, opts.width, opts.height);
  104631. if (opts.rotate) {
  104632. contextRotate(context, opts);
  104633. }
  104634. drawYAxisGrid(categories, opts, config, context);
  104635. drawXAxis(categories, opts, config, context);
  104636. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  104637. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  104638. calPoints = _drawCandleDataPoints.calPoints,
  104639. eachSpacing = _drawCandleDataPoints.eachSpacing;
  104640. opts.chartData.xAxisPoints = xAxisPoints;
  104641. opts.chartData.calPoints = calPoints;
  104642. opts.chartData.eachSpacing = eachSpacing;
  104643. drawYAxis(series, opts, config, context);
  104644. if (opts.enableMarkLine !== false && process === 1) {
  104645. drawMarkLine(opts, config, context);
  104646. }
  104647. if (seriesMA) {
  104648. drawLegend(seriesMA, opts, config, context, opts.chartData);
  104649. } else {
  104650. drawLegend(opts.series, opts, config, context, opts.chartData);
  104651. }
  104652. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  104653. drawCanvas(opts, context);
  104654. },
  104655. onAnimationFinish: function onAnimationFinish() {
  104656. _this.uevent.trigger('renderComplete');
  104657. }
  104658. });
  104659. break;
  104660. }
  104661. }
  104662. function uChartsEvent() {
  104663. this.events = {};
  104664. }
  104665. uChartsEvent.prototype.addEventListener = function (type, listener) {
  104666. this.events[type] = this.events[type] || [];
  104667. this.events[type].push(listener);
  104668. };
  104669. uChartsEvent.prototype.delEventListener = function (type) {
  104670. this.events[type] = [];
  104671. };
  104672. uChartsEvent.prototype.trigger = function () {
  104673. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  104674. args[_key] = arguments[_key];
  104675. }
  104676. var type = args[0];
  104677. var params = args.slice(1);
  104678. if (!!this.events[type]) {
  104679. this.events[type].forEach(function (listener) {
  104680. try {
  104681. listener.apply(null, params);
  104682. } catch (e) {
  104683. //console.log('[uCharts] '+e);
  104684. }
  104685. });
  104686. }
  104687. };
  104688. var uCharts = function uCharts(opts) {
  104689. opts.pix = opts.pixelRatio ? opts.pixelRatio : 1;
  104690. opts.fontSize = opts.fontSize ? opts.fontSize : 13;
  104691. opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor;
  104692. if (opts.background == "" || opts.background == "none") {
  104693. opts.background = "#FFFFFF";
  104694. }
  104695. opts.title = assign({}, opts.title);
  104696. opts.subtitle = assign({}, opts.subtitle);
  104697. opts.duration = opts.duration ? opts.duration : 1000;
  104698. opts.yAxis = assign({}, {
  104699. data: [],
  104700. showTitle: false,
  104701. disabled: false,
  104702. disableGrid: false,
  104703. gridSet: 'number',
  104704. splitNumber: 5,
  104705. gridType: 'solid',
  104706. dashLength: 4 * opts.pix,
  104707. gridColor: '#cccccc',
  104708. padding: 10,
  104709. fontColor: '#666666'
  104710. }, opts.yAxis);
  104711. opts.xAxis = assign({}, {
  104712. rotateLabel: false,
  104713. rotateAngle: 45,
  104714. disabled: false,
  104715. disableGrid: false,
  104716. splitNumber: 5,
  104717. calibration: false,
  104718. fontColor: '#666666',
  104719. fontSize: 13,
  104720. lineHeight: 20,
  104721. marginTop: 0,
  104722. gridType: 'solid',
  104723. dashLength: 4,
  104724. scrollAlign: 'left',
  104725. boundaryGap: 'center',
  104726. axisLine: true,
  104727. axisLineColor: '#cccccc',
  104728. titleFontSize: 13,
  104729. titleOffsetY: 0,
  104730. titleOffsetX: 0,
  104731. titleFontColor: '#666666'
  104732. }, opts.xAxis);
  104733. opts.xAxis.scrollPosition = opts.xAxis.scrollAlign;
  104734. opts.legend = assign({}, {
  104735. show: true,
  104736. position: 'bottom',
  104737. float: 'center',
  104738. backgroundColor: 'rgba(0,0,0,0)',
  104739. borderColor: 'rgba(0,0,0,0)',
  104740. borderWidth: 0,
  104741. padding: 5,
  104742. margin: 5,
  104743. itemGap: 10,
  104744. fontSize: opts.fontSize,
  104745. lineHeight: opts.fontSize,
  104746. fontColor: opts.fontColor,
  104747. formatter: {},
  104748. hiddenColor: '#CECECE'
  104749. }, opts.legend);
  104750. opts.extra = assign({
  104751. tooltip: {
  104752. legendShape: 'auto'
  104753. }
  104754. }, opts.extra);
  104755. opts.rotate = opts.rotate ? true : false;
  104756. opts.animation = opts.animation ? true : false;
  104757. opts.rotate = opts.rotate ? true : false;
  104758. opts.canvas2d = opts.canvas2d ? true : false;
  104759. var config$$1 = assign({}, config);
  104760. config$$1.color = opts.color ? opts.color : config$$1.color;
  104761. if (opts.type == 'pie') {
  104762. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  104763. }
  104764. if (opts.type == 'ring') {
  104765. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  104766. }
  104767. if (opts.type == 'rose') {
  104768. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  104769. }
  104770. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix;
  104771. //屏幕旋转
  104772. config$$1.rotate = opts.rotate;
  104773. if (opts.rotate) {
  104774. var tempWidth = opts.width;
  104775. var tempHeight = opts.height;
  104776. opts.width = tempHeight;
  104777. opts.height = tempWidth;
  104778. }
  104779. //适配高分屏
  104780. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  104781. config$$1.yAxisWidth = config.yAxisWidth * opts.pix;
  104782. config$$1.fontSize = opts.fontSize * opts.pix;
  104783. config$$1.titleFontSize = config.titleFontSize * opts.pix;
  104784. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix;
  104785. if (!opts.context) {
  104786. throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!');
  104787. }
  104788. this.context = opts.context;
  104789. if (!this.context.setTextAlign) {
  104790. this.context.setStrokeStyle = function (e) {
  104791. return this.strokeStyle = e;
  104792. };
  104793. this.context.setLineWidth = function (e) {
  104794. return this.lineWidth = e;
  104795. };
  104796. this.context.setLineCap = function (e) {
  104797. return this.lineCap = e;
  104798. };
  104799. this.context.setFontSize = function (e) {
  104800. return this.font = e + "px sans-serif";
  104801. };
  104802. this.context.setFillStyle = function (e) {
  104803. return this.fillStyle = e;
  104804. };
  104805. this.context.setTextAlign = function (e) {
  104806. return this.textAlign = e;
  104807. };
  104808. this.context.setTextBaseline = function (e) {
  104809. return this.textBaseline = e;
  104810. };
  104811. this.context.setShadow = function (offsetX, offsetY, blur, color) {
  104812. this.shadowColor = color;
  104813. this.shadowOffsetX = offsetX;
  104814. this.shadowOffsetY = offsetY;
  104815. this.shadowBlur = blur;
  104816. };
  104817. this.context.draw = function () {};
  104818. }
  104819. //兼容NVUEsetLineDash
  104820. if (!this.context.setLineDash) {
  104821. this.context.setLineDash = function (e) {};
  104822. }
  104823. opts.chartData = {};
  104824. this.uevent = new uChartsEvent();
  104825. this.scrollOption = {
  104826. currentOffset: 0,
  104827. startTouchX: 0,
  104828. distance: 0,
  104829. lastMoveTime: 0
  104830. };
  104831. this.opts = opts;
  104832. this.config = config$$1;
  104833. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  104834. };
  104835. uCharts.prototype.updateData = function () {
  104836. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  104837. this.opts = assign({}, this.opts, data);
  104838. this.opts.updateData = true;
  104839. var scrollPosition = data.scrollPosition || 'current';
  104840. switch (scrollPosition) {
  104841. case 'current':
  104842. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  104843. break;
  104844. case 'left':
  104845. this.opts._scrollDistance_ = 0;
  104846. this.scrollOption = {
  104847. currentOffset: 0,
  104848. startTouchX: 0,
  104849. distance: 0,
  104850. lastMoveTime: 0
  104851. };
  104852. break;
  104853. case 'right':
  104854. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  104855. yAxisWidth = _calYAxisData.yAxisWidth;
  104856. this.config.yAxisWidth = yAxisWidth;
  104857. var offsetLeft = 0;
  104858. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  104859. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  104860. startX = _getXAxisPoints0.startX,
  104861. endX = _getXAxisPoints0.endX,
  104862. eachSpacing = _getXAxisPoints0.eachSpacing;
  104863. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  104864. var screenWidth = endX - startX;
  104865. offsetLeft = screenWidth - totalWidth;
  104866. this.scrollOption = {
  104867. currentOffset: offsetLeft,
  104868. startTouchX: offsetLeft,
  104869. distance: 0,
  104870. lastMoveTime: 0
  104871. };
  104872. this.opts._scrollDistance_ = offsetLeft;
  104873. break;
  104874. }
  104875. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  104876. };
  104877. uCharts.prototype.zoom = function () {
  104878. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  104879. if (this.opts.enableScroll !== true) {
  104880. console.log('[uCharts] 请启用滚动条后使用');
  104881. return;
  104882. }
  104883. //当前屏幕中间点
  104884. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(this.opts.xAxis.itemCount / 2);
  104885. this.opts.animation = false;
  104886. this.opts.xAxis.itemCount = val.itemCount;
  104887. //重新计算x轴偏移距离
  104888. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  104889. yAxisWidth = _calYAxisData.yAxisWidth;
  104890. this.config.yAxisWidth = yAxisWidth;
  104891. var offsetLeft = 0;
  104892. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  104893. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  104894. startX = _getXAxisPoints0.startX,
  104895. endX = _getXAxisPoints0.endX,
  104896. eachSpacing = _getXAxisPoints0.eachSpacing;
  104897. var centerLeft = eachSpacing * centerPoint;
  104898. var screenWidth = endX - startX;
  104899. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  104900. offsetLeft = screenWidth / 2 - centerLeft;
  104901. if (offsetLeft > 0) {
  104902. offsetLeft = 0;
  104903. }
  104904. if (offsetLeft < MaxLeft) {
  104905. offsetLeft = MaxLeft;
  104906. }
  104907. this.scrollOption = {
  104908. currentOffset: offsetLeft,
  104909. startTouchX: 0,
  104910. distance: 0,
  104911. lastMoveTime: 0
  104912. };
  104913. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  104914. this.opts._scrollDistance_ = offsetLeft;
  104915. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  104916. };
  104917. uCharts.prototype.dobuleZoom = function (e) {
  104918. if (this.opts.enableScroll !== true) {
  104919. console.log('[uCharts] 请启用滚动条后使用');
  104920. return;
  104921. }
  104922. var tcs = e.changedTouches;
  104923. if (tcs.length < 2) {
  104924. return;
  104925. }
  104926. for (var i = 0; i < tcs.length; i++) {
  104927. tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX;
  104928. tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY;
  104929. }
  104930. var ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)];
  104931. var xlength = Math.abs(ntcs[0].x - ntcs[1].x);
  104932. // 记录初始的两指之间的数据
  104933. if (!this.scrollOption.moveCount) {
  104934. var cts0 = {
  104935. changedTouches: [{
  104936. x: tcs[0].x,
  104937. y: this.opts.area[0] / this.opts.pix + 2
  104938. }]
  104939. };
  104940. var cts1 = {
  104941. changedTouches: [{
  104942. x: tcs[1].x,
  104943. y: this.opts.area[0] / this.opts.pix + 2
  104944. }]
  104945. };
  104946. if (this.opts.rotate) {
  104947. cts0 = {
  104948. changedTouches: [{
  104949. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  104950. y: tcs[0].y
  104951. }]
  104952. };
  104953. cts1 = {
  104954. changedTouches: [{
  104955. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  104956. y: tcs[1].y
  104957. }]
  104958. };
  104959. }
  104960. var moveCurrent1 = this.getCurrentDataIndex(cts0).index;
  104961. var moveCurrent2 = this.getCurrentDataIndex(cts1).index;
  104962. var moveCount = Math.abs(moveCurrent1 - moveCurrent2);
  104963. this.scrollOption.moveCount = moveCount;
  104964. this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2);
  104965. this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2);
  104966. return;
  104967. }
  104968. var currentEachSpacing = xlength / this.scrollOption.moveCount;
  104969. var itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing;
  104970. itemCount = itemCount <= 2 ? 2 : itemCount;
  104971. itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount;
  104972. this.opts.animation = false;
  104973. this.opts.xAxis.itemCount = itemCount;
  104974. // 重新计算滚动条偏移距离
  104975. var offsetLeft = 0;
  104976. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  104977. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  104978. startX = _getXAxisPoints0.startX,
  104979. endX = _getXAxisPoints0.endX,
  104980. eachSpacing = _getXAxisPoints0.eachSpacing;
  104981. var currentLeft = eachSpacing * this.scrollOption.moveCurrent1;
  104982. var screenWidth = endX - startX;
  104983. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  104984. offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing;
  104985. if (offsetLeft > 0) {
  104986. offsetLeft = 0;
  104987. }
  104988. if (offsetLeft < MaxLeft) {
  104989. offsetLeft = MaxLeft;
  104990. }
  104991. this.scrollOption.currentOffset = offsetLeft;
  104992. this.scrollOption.startTouchX = 0;
  104993. this.scrollOption.distance = 0;
  104994. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  104995. this.opts._scrollDistance_ = offsetLeft;
  104996. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  104997. };
  104998. uCharts.prototype.stopAnimation = function () {
  104999. this.animationInstance && this.animationInstance.stop();
  105000. };
  105001. uCharts.prototype.addEventListener = function (type, listener) {
  105002. this.uevent.addEventListener(type, listener);
  105003. };
  105004. uCharts.prototype.delEventListener = function (type) {
  105005. this.uevent.delEventListener(type);
  105006. };
  105007. uCharts.prototype.getCurrentDataIndex = function (e) {
  105008. var touches = null;
  105009. if (e.changedTouches) {
  105010. touches = e.changedTouches[0];
  105011. } else {
  105012. touches = e.mp.changedTouches[0];
  105013. }
  105014. if (touches) {
  105015. var _touches$ = getTouches(touches, this.opts, e);
  105016. if (this.opts.type === 'pie' || this.opts.type === 'ring') {
  105017. return findPieChartCurrentIndex({
  105018. x: _touches$.x,
  105019. y: _touches$.y
  105020. }, this.opts.chartData.pieData, this.opts);
  105021. } else if (this.opts.type === 'rose') {
  105022. return findRoseChartCurrentIndex({
  105023. x: _touches$.x,
  105024. y: _touches$.y
  105025. }, this.opts.chartData.pieData, this.opts);
  105026. } else if (this.opts.type === 'radar') {
  105027. return findRadarChartCurrentIndex({
  105028. x: _touches$.x,
  105029. y: _touches$.y
  105030. }, this.opts.chartData.radarData, this.opts.categories.length);
  105031. } else if (this.opts.type === 'funnel') {
  105032. return findFunnelChartCurrentIndex({
  105033. x: _touches$.x,
  105034. y: _touches$.y
  105035. }, this.opts.chartData.funnelData);
  105036. } else if (this.opts.type === 'map') {
  105037. return findMapChartCurrentIndex({
  105038. x: _touches$.x,
  105039. y: _touches$.y
  105040. }, this.opts);
  105041. } else if (this.opts.type === 'word') {
  105042. return findWordChartCurrentIndex({
  105043. x: _touches$.x,
  105044. y: _touches$.y
  105045. }, this.opts.chartData.wordCloudData);
  105046. } else if (this.opts.type === 'bar') {
  105047. return findBarChartCurrentIndex({
  105048. x: _touches$.x,
  105049. y: _touches$.y
  105050. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  105051. } else {
  105052. return findCurrentIndex({
  105053. x: _touches$.x,
  105054. y: _touches$.y
  105055. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  105056. }
  105057. }
  105058. return -1;
  105059. };
  105060. uCharts.prototype.getLegendDataIndex = function (e) {
  105061. var touches = null;
  105062. if (e.changedTouches) {
  105063. touches = e.changedTouches[0];
  105064. } else {
  105065. touches = e.mp.changedTouches[0];
  105066. }
  105067. if (touches) {
  105068. var _touches$ = getTouches(touches, this.opts, e);
  105069. return findLegendIndex({
  105070. x: _touches$.x,
  105071. y: _touches$.y
  105072. }, this.opts.chartData.legendData);
  105073. }
  105074. return -1;
  105075. };
  105076. uCharts.prototype.touchLegend = function (e) {
  105077. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  105078. var touches = null;
  105079. if (e.changedTouches) {
  105080. touches = e.changedTouches[0];
  105081. } else {
  105082. touches = e.mp.changedTouches[0];
  105083. }
  105084. if (touches) {
  105085. var _touches$ = getTouches(touches, this.opts, e);
  105086. var index = this.getLegendDataIndex(e);
  105087. if (index >= 0) {
  105088. if (this.opts.type == 'candle') {
  105089. this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show;
  105090. } else {
  105091. this.opts.series[index].show = !this.opts.series[index].show;
  105092. }
  105093. this.opts.animation = option.animation ? true : false;
  105094. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  105095. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  105096. }
  105097. }
  105098. };
  105099. uCharts.prototype.showToolTip = function (e) {
  105100. var _this3 = this;
  105101. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  105102. var touches = null;
  105103. if (e.changedTouches) {
  105104. touches = e.changedTouches[0];
  105105. } else {
  105106. touches = e.mp.changedTouches[0];
  105107. }
  105108. if (!touches) {
  105109. console.log("[uCharts] 未获取到event坐标信息");
  105110. }
  105111. var _touches$ = getTouches(touches, this.opts, e);
  105112. var currentOffset = this.scrollOption.currentOffset;
  105113. var opts = assign({}, this.opts, {
  105114. _scrollDistance_: currentOffset,
  105115. animation: false
  105116. });
  105117. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === 'scatter' || this.opts.type === 'bubble') {
  105118. var current = this.getCurrentDataIndex(e);
  105119. var index = option.index == undefined ? current.index : option.index;
  105120. if (index > -1 || index.length > 0) {
  105121. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  105122. if (seriesData.length !== 0) {
  105123. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  105124. textList = _getToolTipData.textList,
  105125. offset = _getToolTipData.offset;
  105126. offset.y = _touches$.y;
  105127. opts.tooltip = {
  105128. textList: option.textList !== undefined ? option.textList : textList,
  105129. offset: option.offset !== undefined ? option.offset : offset,
  105130. option: option,
  105131. index: index,
  105132. group: current.group
  105133. };
  105134. }
  105135. }
  105136. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105137. }
  105138. if (this.opts.type === 'mount') {
  105139. var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index;
  105140. if (index > -1) {
  105141. var opts = assign({}, this.opts, {
  105142. animation: false
  105143. });
  105144. var seriesData = assign({}, opts._series_[index]);
  105145. var textList = [{
  105146. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  105147. color: seriesData.color,
  105148. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  105149. }];
  105150. var offset = {
  105151. x: opts.chartData.calPoints[index].x,
  105152. y: _touches$.y
  105153. };
  105154. opts.tooltip = {
  105155. textList: option.textList ? option.textList : textList,
  105156. offset: option.offset !== undefined ? option.offset : offset,
  105157. option: option,
  105158. index: index
  105159. };
  105160. }
  105161. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105162. }
  105163. if (this.opts.type === 'bar') {
  105164. var current = this.getCurrentDataIndex(e);
  105165. var index = option.index == undefined ? current.index : option.index;
  105166. if (index > -1 || index.length > 0) {
  105167. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  105168. if (seriesData.length !== 0) {
  105169. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  105170. textList = _getToolTipData.textList,
  105171. offset = _getToolTipData.offset;
  105172. offset.x = _touches$.x;
  105173. opts.tooltip = {
  105174. textList: option.textList !== undefined ? option.textList : textList,
  105175. offset: option.offset !== undefined ? option.offset : offset,
  105176. option: option,
  105177. index: index
  105178. };
  105179. }
  105180. }
  105181. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105182. }
  105183. if (this.opts.type === 'mix') {
  105184. var current = this.getCurrentDataIndex(e);
  105185. var index = option.index == undefined ? current.index : option.index;
  105186. if (index > -1) {
  105187. var currentOffset = this.scrollOption.currentOffset;
  105188. var opts = assign({}, this.opts, {
  105189. _scrollDistance_: currentOffset,
  105190. animation: false
  105191. });
  105192. var seriesData = getSeriesDataItem(this.opts.series, index);
  105193. if (seriesData.length !== 0) {
  105194. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, option),
  105195. textList = _getMixToolTipData.textList,
  105196. offset = _getMixToolTipData.offset;
  105197. offset.y = _touches$.y;
  105198. opts.tooltip = {
  105199. textList: option.textList ? option.textList : textList,
  105200. offset: option.offset !== undefined ? option.offset : offset,
  105201. option: option,
  105202. index: index
  105203. };
  105204. }
  105205. }
  105206. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105207. }
  105208. if (this.opts.type === 'candle') {
  105209. var current = this.getCurrentDataIndex(e);
  105210. var index = option.index == undefined ? current.index : option.index;
  105211. if (index > -1) {
  105212. var currentOffset = this.scrollOption.currentOffset;
  105213. var opts = assign({}, this.opts, {
  105214. _scrollDistance_: currentOffset,
  105215. animation: false
  105216. });
  105217. var seriesData = getSeriesDataItem(this.opts.series, index);
  105218. if (seriesData.length !== 0) {
  105219. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, this.opts.categories, this.opts.extra.candle, option),
  105220. textList = _getToolTipData.textList,
  105221. offset = _getToolTipData.offset;
  105222. offset.y = _touches$.y;
  105223. opts.tooltip = {
  105224. textList: option.textList ? option.textList : textList,
  105225. offset: option.offset !== undefined ? option.offset : offset,
  105226. option: option,
  105227. index: index
  105228. };
  105229. }
  105230. }
  105231. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105232. }
  105233. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  105234. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  105235. if (index > -1) {
  105236. var opts = assign({}, this.opts, {
  105237. animation: false
  105238. });
  105239. var seriesData = assign({}, opts._series_[index]);
  105240. var textList = [{
  105241. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  105242. color: seriesData.color,
  105243. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  105244. }];
  105245. var offset = {
  105246. x: _touches$.x,
  105247. y: _touches$.y
  105248. };
  105249. opts.tooltip = {
  105250. textList: option.textList ? option.textList : textList,
  105251. offset: option.offset !== undefined ? option.offset : offset,
  105252. option: option,
  105253. index: index
  105254. };
  105255. }
  105256. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105257. }
  105258. if (this.opts.type === 'map') {
  105259. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  105260. if (index > -1) {
  105261. var opts = assign({}, this.opts, {
  105262. animation: false
  105263. });
  105264. var seriesData = assign({}, this.opts.series[index]);
  105265. seriesData.name = seriesData.properties.name;
  105266. var textList = [{
  105267. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  105268. color: seriesData.color,
  105269. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  105270. }];
  105271. var offset = {
  105272. x: _touches$.x,
  105273. y: _touches$.y
  105274. };
  105275. opts.tooltip = {
  105276. textList: option.textList ? option.textList : textList,
  105277. offset: option.offset !== undefined ? option.offset : offset,
  105278. option: option,
  105279. index: index
  105280. };
  105281. }
  105282. opts.updateData = false;
  105283. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105284. }
  105285. if (this.opts.type === 'word') {
  105286. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  105287. if (index > -1) {
  105288. var opts = assign({}, this.opts, {
  105289. animation: false
  105290. });
  105291. var seriesData = assign({}, this.opts.series[index]);
  105292. var textList = [{
  105293. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  105294. color: seriesData.color,
  105295. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  105296. }];
  105297. var offset = {
  105298. x: _touches$.x,
  105299. y: _touches$.y
  105300. };
  105301. opts.tooltip = {
  105302. textList: option.textList ? option.textList : textList,
  105303. offset: option.offset !== undefined ? option.offset : offset,
  105304. option: option,
  105305. index: index
  105306. };
  105307. }
  105308. opts.updateData = false;
  105309. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105310. }
  105311. if (this.opts.type === 'radar') {
  105312. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  105313. if (index > -1) {
  105314. var opts = assign({}, this.opts, {
  105315. animation: false
  105316. });
  105317. var seriesData = getSeriesDataItem(this.opts.series, index);
  105318. if (seriesData.length !== 0) {
  105319. var textList = seriesData.map(function (item) {
  105320. return {
  105321. text: option.formatter ? option.formatter(item, _this3.opts.categories[index], index, _this3.opts) : item.name + ': ' + item.data,
  105322. color: item.color,
  105323. legendShape: _this3.opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : _this3.opts.extra.tooltip.legendShape
  105324. };
  105325. });
  105326. var offset = {
  105327. x: _touches$.x,
  105328. y: _touches$.y
  105329. };
  105330. opts.tooltip = {
  105331. textList: option.textList ? option.textList : textList,
  105332. offset: option.offset !== undefined ? option.offset : offset,
  105333. option: option,
  105334. index: index
  105335. };
  105336. }
  105337. }
  105338. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105339. }
  105340. };
  105341. uCharts.prototype.translate = function (distance) {
  105342. this.scrollOption = {
  105343. currentOffset: distance,
  105344. startTouchX: distance,
  105345. distance: 0,
  105346. lastMoveTime: 0
  105347. };
  105348. var opts = assign({}, this.opts, {
  105349. _scrollDistance_: distance,
  105350. animation: false
  105351. });
  105352. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  105353. };
  105354. uCharts.prototype.scrollStart = function (e) {
  105355. var touches = null;
  105356. if (e.changedTouches) {
  105357. touches = e.changedTouches[0];
  105358. } else {
  105359. touches = e.mp.changedTouches[0];
  105360. }
  105361. var _touches$ = getTouches(touches, this.opts, e);
  105362. if (touches && this.opts.enableScroll === true) {
  105363. this.scrollOption.startTouchX = _touches$.x;
  105364. }
  105365. };
  105366. uCharts.prototype.scroll = function (e) {
  105367. if (this.scrollOption.lastMoveTime === 0) {
  105368. this.scrollOption.lastMoveTime = Date.now();
  105369. }
  105370. var Limit = this.opts.touchMoveLimit || 60;
  105371. var currMoveTime = Date.now();
  105372. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  105373. if (duration < Math.floor(1000 / Limit)) return;
  105374. if (this.scrollOption.startTouchX == 0) return;
  105375. this.scrollOption.lastMoveTime = currMoveTime;
  105376. var touches = null;
  105377. if (e.changedTouches) {
  105378. touches = e.changedTouches[0];
  105379. } else {
  105380. touches = e.mp.changedTouches[0];
  105381. }
  105382. if (touches && this.opts.enableScroll === true) {
  105383. var _touches$ = getTouches(touches, this.opts, e);
  105384. var _distance;
  105385. _distance = _touches$.x - this.scrollOption.startTouchX;
  105386. var currentOffset = this.scrollOption.currentOffset;
  105387. var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  105388. this.scrollOption.distance = _distance = validDistance - currentOffset;
  105389. var opts = assign({}, this.opts, {
  105390. _scrollDistance_: currentOffset + _distance,
  105391. animation: false
  105392. });
  105393. this.opts = opts;
  105394. drawCharts.call(this, opts.type, opts, this.config, this.context);
  105395. return currentOffset + _distance;
  105396. }
  105397. };
  105398. uCharts.prototype.scrollEnd = function (e) {
  105399. if (this.opts.enableScroll === true) {
  105400. var _scrollOption = this.scrollOption,
  105401. currentOffset = _scrollOption.currentOffset,
  105402. distance = _scrollOption.distance;
  105403. this.scrollOption.currentOffset = currentOffset + distance;
  105404. this.scrollOption.distance = 0;
  105405. this.scrollOption.moveCount = 0;
  105406. }
  105407. };
  105408. var _default = uCharts;
  105409. exports.default = _default;
  105410. /***/ }),
  105411. /* 1382 */
  105412. /*!******************************************************************************************!*\
  105413. !*** E:/git/2021项目/v3-H5/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js ***!
  105414. \******************************************************************************************/
  105415. /*! no static exports found */
  105416. /***/ (function(module, exports, __webpack_require__) {
  105417. "use strict";
  105418. Object.defineProperty(exports, "__esModule", {
  105419. value: true
  105420. });
  105421. exports.default = void 0;
  105422. /*
  105423. * uCharts®
  105424. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
  105425. * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
  105426. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  105427. * 复制使用请保留本段注释,感谢支持开源!
  105428. *
  105429. * uCharts®官方网站
  105430. * https://www.uCharts.cn
  105431. *
  105432. * 开源地址:
  105433. * https://gitee.com/uCharts/uCharts
  105434. *
  105435. * uni-app插件市场地址:
  105436. * http://ext.dcloud.net.cn/plugin?id=271
  105437. *
  105438. */
  105439. // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
  105440. var color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
  105441. //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
  105442. var formatDateTime = function formatDateTime(timeStamp, returnType) {
  105443. var date = new Date();
  105444. date.setTime(timeStamp * 1000);
  105445. var y = date.getFullYear();
  105446. var m = date.getMonth() + 1;
  105447. m = m < 10 ? '0' + m : m;
  105448. var d = date.getDate();
  105449. d = d < 10 ? '0' + d : d;
  105450. var h = date.getHours();
  105451. h = h < 10 ? '0' + h : h;
  105452. var minute = date.getMinutes();
  105453. var second = date.getSeconds();
  105454. minute = minute < 10 ? '0' + minute : minute;
  105455. second = second < 10 ? '0' + second : second;
  105456. if (returnType == 'full') {
  105457. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  105458. }
  105459. if (returnType == 'y-m-d') {
  105460. return y + '-' + m + '-' + d;
  105461. }
  105462. if (returnType == 'h:m') {
  105463. return h + ':' + minute;
  105464. }
  105465. if (returnType == 'h:m:s') {
  105466. return h + ':' + minute + ':' + second;
  105467. }
  105468. return [y, m, d, h, minute, second];
  105469. };
  105470. var cfu = {
  105471. //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
  105472. "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
  105473. "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
  105474. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
  105475. //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
  105476. "categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
  105477. //instance为实例变量承载属性,不要删除
  105478. "instance": {},
  105479. //option为opts及eopts承载属性,不要删除
  105480. "option": {},
  105481. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  105482. "formatter": {
  105483. "yAxisDemo1": function yAxisDemo1(val, index, opts) {
  105484. return val + '元';
  105485. },
  105486. "yAxisDemo2": function yAxisDemo2(val, index, opts) {
  105487. return val.toFixed(2);
  105488. },
  105489. "xAxisDemo1": function xAxisDemo1(val, index, opts) {
  105490. return val + '年';
  105491. },
  105492. "xAxisDemo2": function xAxisDemo2(val, index, opts) {
  105493. return formatDateTime(val, 'h:m');
  105494. },
  105495. "seriesDemo1": function seriesDemo1(val, index, series, opts) {
  105496. return val + '元';
  105497. },
  105498. "tooltipDemo1": function tooltipDemo1(item, category, index, opts) {
  105499. if (index == 0) {
  105500. return '随便用' + item.data + '年';
  105501. } else {
  105502. return '其他我没改' + item.data + '天';
  105503. }
  105504. },
  105505. "pieDemo": function pieDemo(val, index, series, opts) {
  105506. if (index !== undefined) {
  105507. return series[index].name + ':' + series[index].data + '元';
  105508. }
  105509. }
  105510. },
  105511. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  105512. "demotype": {
  105513. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  105514. "type": "line",
  105515. "color": color,
  105516. "padding": [15, 10, 0, 15],
  105517. "xAxis": {
  105518. "disableGrid": true
  105519. },
  105520. "yAxis": {
  105521. "gridType": "dash",
  105522. "dashLength": 2
  105523. },
  105524. "legend": {},
  105525. "extra": {
  105526. "line": {
  105527. "type": "curve",
  105528. "width": 2
  105529. }
  105530. }
  105531. },
  105532. //下面是自定义配置,请添加项目所需的通用配置
  105533. "pie": {
  105534. "type": "pie",
  105535. "color": color,
  105536. "padding": [5, 5, 5, 5],
  105537. "extra": {
  105538. "pie": {
  105539. "activeOpacity": 0.5,
  105540. "activeRadius": 10,
  105541. "offsetAngle": 0,
  105542. "labelWidth": 15,
  105543. "border": true,
  105544. "borderWidth": 3,
  105545. "borderColor": "#FFFFFF"
  105546. }
  105547. }
  105548. },
  105549. "ring": {
  105550. "type": "ring",
  105551. "color": color,
  105552. "padding": [5, 5, 5, 5],
  105553. "rotate": false,
  105554. "dataLabel": true,
  105555. "legend": {
  105556. "show": true,
  105557. "position": "right",
  105558. "lineHeight": 25
  105559. },
  105560. "title": {
  105561. "name": "收益率",
  105562. "fontSize": 15,
  105563. "color": "#666666"
  105564. },
  105565. "subtitle": {
  105566. "name": "70%",
  105567. "fontSize": 25,
  105568. "color": "#7cb5ec"
  105569. },
  105570. "extra": {
  105571. "ring": {
  105572. "ringWidth": 30,
  105573. "activeOpacity": 0.5,
  105574. "activeRadius": 10,
  105575. "offsetAngle": 0,
  105576. "labelWidth": 15,
  105577. "border": true,
  105578. "borderWidth": 3,
  105579. "borderColor": "#FFFFFF"
  105580. }
  105581. }
  105582. },
  105583. "rose": {
  105584. "type": "rose",
  105585. "color": color,
  105586. "padding": [5, 5, 5, 5],
  105587. "legend": {
  105588. "show": true,
  105589. "position": "left",
  105590. "lineHeight": 25
  105591. },
  105592. "extra": {
  105593. "rose": {
  105594. "type": "area",
  105595. "minRadius": 50,
  105596. "activeOpacity": 0.5,
  105597. "activeRadius": 10,
  105598. "offsetAngle": 0,
  105599. "labelWidth": 15,
  105600. "border": false,
  105601. "borderWidth": 2,
  105602. "borderColor": "#FFFFFF"
  105603. }
  105604. }
  105605. },
  105606. "word": {
  105607. "type": "word",
  105608. "color": color,
  105609. "extra": {
  105610. "word": {
  105611. "type": "normal",
  105612. "autoColors": false
  105613. }
  105614. }
  105615. },
  105616. "funnel": {
  105617. "type": "funnel",
  105618. "color": color,
  105619. "padding": [15, 15, 0, 15],
  105620. "extra": {
  105621. "funnel": {
  105622. "activeOpacity": 0.3,
  105623. "activeWidth": 10,
  105624. "border": true,
  105625. "borderWidth": 2,
  105626. "borderColor": "#FFFFFF",
  105627. "fillOpacity": 1,
  105628. "labelAlign": "right"
  105629. }
  105630. }
  105631. },
  105632. "map": {
  105633. "type": "map",
  105634. "color": color,
  105635. "padding": [0, 0, 0, 0],
  105636. "dataLabel": true,
  105637. "extra": {
  105638. "map": {
  105639. "border": true,
  105640. "borderWidth": 1,
  105641. "borderColor": "#666666",
  105642. "fillOpacity": 0.6,
  105643. "activeBorderColor": "#F04864",
  105644. "activeFillColor": "#FACC14",
  105645. "activeFillOpacity": 1
  105646. }
  105647. }
  105648. },
  105649. "arcbar": {
  105650. "type": "arcbar",
  105651. "color": color,
  105652. "title": {
  105653. "name": "百分比",
  105654. "fontSize": 25,
  105655. "color": "#00FF00"
  105656. },
  105657. "subtitle": {
  105658. "name": "默认标题",
  105659. "fontSize": 15,
  105660. "color": "#666666"
  105661. },
  105662. "extra": {
  105663. "arcbar": {
  105664. "type": "default",
  105665. "width": 12,
  105666. "backgroundColor": "#E9E9E9",
  105667. "startAngle": 0.75,
  105668. "endAngle": 0.25,
  105669. "gap": 2
  105670. }
  105671. }
  105672. },
  105673. "line": {
  105674. "type": "line",
  105675. "color": color,
  105676. "padding": [15, 10, 0, 15],
  105677. "xAxis": {
  105678. "disableGrid": true
  105679. },
  105680. "yAxis": {
  105681. "gridType": "dash",
  105682. "dashLength": 2
  105683. },
  105684. "legend": {},
  105685. "extra": {
  105686. "line": {
  105687. "type": "straight",
  105688. "width": 2,
  105689. "activeType": "hollow"
  105690. }
  105691. }
  105692. },
  105693. "tline": {
  105694. "type": "line",
  105695. "color": color,
  105696. "padding": [15, 10, 0, 15],
  105697. "xAxis": {
  105698. "disableGrid": false,
  105699. "boundaryGap": "justify"
  105700. },
  105701. "yAxis": {
  105702. "gridType": "dash",
  105703. "dashLength": 2,
  105704. "data": [{
  105705. "min": 0,
  105706. "max": 80
  105707. }]
  105708. },
  105709. "legend": {},
  105710. "extra": {
  105711. "line": {
  105712. "type": "curve",
  105713. "width": 2,
  105714. "activeType": "hollow"
  105715. }
  105716. }
  105717. },
  105718. "tarea": {
  105719. "type": "area",
  105720. "color": color,
  105721. "padding": [15, 10, 0, 15],
  105722. "xAxis": {
  105723. "disableGrid": true,
  105724. "boundaryGap": "justify"
  105725. },
  105726. "yAxis": {
  105727. "gridType": "dash",
  105728. "dashLength": 2,
  105729. "data": [{
  105730. "min": 0,
  105731. "max": 80
  105732. }]
  105733. },
  105734. "legend": {},
  105735. "extra": {
  105736. "area": {
  105737. "type": "curve",
  105738. "opacity": 0.2,
  105739. "addLine": true,
  105740. "width": 2,
  105741. "gradient": true,
  105742. "activeType": "hollow"
  105743. }
  105744. }
  105745. },
  105746. "column": {
  105747. "type": "column",
  105748. "color": color,
  105749. "padding": [15, 15, 0, 5],
  105750. "xAxis": {
  105751. "disableGrid": true
  105752. },
  105753. "yAxis": {
  105754. "data": [{
  105755. "min": 0
  105756. }]
  105757. },
  105758. "legend": {},
  105759. "extra": {
  105760. "column": {
  105761. "type": "group",
  105762. "width": 30,
  105763. "activeBgColor": "#000000",
  105764. "activeBgOpacity": 0.08
  105765. }
  105766. }
  105767. },
  105768. "mount": {
  105769. "type": "mount",
  105770. "color": color,
  105771. "padding": [15, 15, 0, 5],
  105772. "xAxis": {
  105773. "disableGrid": true
  105774. },
  105775. "yAxis": {
  105776. "data": [{
  105777. "min": 0
  105778. }]
  105779. },
  105780. "legend": {},
  105781. "extra": {
  105782. "mount": {
  105783. "type": "mount",
  105784. "widthRatio": 1.5
  105785. }
  105786. }
  105787. },
  105788. "bar": {
  105789. "type": "bar",
  105790. "color": color,
  105791. "padding": [15, 30, 0, 5],
  105792. "xAxis": {
  105793. "boundaryGap": "justify",
  105794. "disableGrid": false,
  105795. "min": 0,
  105796. "axisLine": false
  105797. },
  105798. "yAxis": {},
  105799. "legend": {},
  105800. "extra": {
  105801. "bar": {
  105802. "type": "group",
  105803. "width": 30,
  105804. "meterBorde": 1,
  105805. "meterFillColor": "#FFFFFF",
  105806. "activeBgColor": "#000000",
  105807. "activeBgOpacity": 0.08
  105808. }
  105809. }
  105810. },
  105811. "area": {
  105812. "type": "area",
  105813. "color": color,
  105814. "padding": [15, 15, 0, 15],
  105815. "xAxis": {
  105816. "disableGrid": true
  105817. },
  105818. "yAxis": {
  105819. "gridType": "dash",
  105820. "dashLength": 2
  105821. },
  105822. "legend": {},
  105823. "extra": {
  105824. "area": {
  105825. "type": "straight",
  105826. "opacity": 0.2,
  105827. "addLine": true,
  105828. "width": 2,
  105829. "gradient": false,
  105830. "activeType": "hollow"
  105831. }
  105832. }
  105833. },
  105834. "radar": {
  105835. "type": "radar",
  105836. "color": color,
  105837. "padding": [5, 5, 5, 5],
  105838. "dataLabel": false,
  105839. "legend": {
  105840. "show": true,
  105841. "position": "right",
  105842. "lineHeight": 25
  105843. },
  105844. "extra": {
  105845. "radar": {
  105846. "gridType": "radar",
  105847. "gridColor": "#CCCCCC",
  105848. "gridCount": 3,
  105849. "opacity": 0.2,
  105850. "max": 200,
  105851. "labelShow": true
  105852. }
  105853. }
  105854. },
  105855. "gauge": {
  105856. "type": "gauge",
  105857. "color": color,
  105858. "title": {
  105859. "name": "66Km/H",
  105860. "fontSize": 25,
  105861. "color": "#2fc25b",
  105862. "offsetY": 50
  105863. },
  105864. "subtitle": {
  105865. "name": "实时速度",
  105866. "fontSize": 15,
  105867. "color": "#1890ff",
  105868. "offsetY": -50
  105869. },
  105870. "extra": {
  105871. "gauge": {
  105872. "type": "default",
  105873. "width": 30,
  105874. "labelColor": "#666666",
  105875. "startAngle": 0.75,
  105876. "endAngle": 0.25,
  105877. "startNumber": 0,
  105878. "endNumber": 100,
  105879. "labelFormat": "",
  105880. "splitLine": {
  105881. "fixRadius": 0,
  105882. "splitNumber": 10,
  105883. "width": 30,
  105884. "color": "#FFFFFF",
  105885. "childNumber": 5,
  105886. "childWidth": 12
  105887. },
  105888. "pointer": {
  105889. "width": 24,
  105890. "color": "auto"
  105891. }
  105892. }
  105893. }
  105894. },
  105895. "candle": {
  105896. "type": "candle",
  105897. "color": color,
  105898. "padding": [15, 15, 0, 15],
  105899. "enableScroll": true,
  105900. "enableMarkLine": true,
  105901. "dataLabel": false,
  105902. "xAxis": {
  105903. "labelCount": 4,
  105904. "itemCount": 40,
  105905. "disableGrid": true,
  105906. "gridColor": "#CCCCCC",
  105907. "gridType": "solid",
  105908. "dashLength": 4,
  105909. "scrollShow": true,
  105910. "scrollAlign": "left",
  105911. "scrollColor": "#A6A6A6",
  105912. "scrollBackgroundColor": "#EFEBEF"
  105913. },
  105914. "yAxis": {},
  105915. "legend": {},
  105916. "extra": {
  105917. "candle": {
  105918. "color": {
  105919. "upLine": "#f04864",
  105920. "upFill": "#f04864",
  105921. "downLine": "#2fc25b",
  105922. "downFill": "#2fc25b"
  105923. },
  105924. "average": {
  105925. "show": true,
  105926. "name": ["MA5", "MA10", "MA30"],
  105927. "day": [5, 10, 20],
  105928. "color": ["#1890ff", "#2fc25b", "#facc14"]
  105929. }
  105930. },
  105931. "markLine": {
  105932. "type": "dash",
  105933. "dashLength": 5,
  105934. "data": [{
  105935. "value": 2150,
  105936. "lineColor": "#f04864",
  105937. "showLabel": true
  105938. }, {
  105939. "value": 2350,
  105940. "lineColor": "#f04864",
  105941. "showLabel": true
  105942. }]
  105943. }
  105944. }
  105945. },
  105946. "mix": {
  105947. "type": "mix",
  105948. "color": color,
  105949. "padding": [15, 15, 0, 15],
  105950. "xAxis": {
  105951. "disableGrid": true
  105952. },
  105953. "yAxis": {
  105954. "disabled": false,
  105955. "disableGrid": false,
  105956. "splitNumber": 5,
  105957. "gridType": "dash",
  105958. "dashLength": 4,
  105959. "gridColor": "#CCCCCC",
  105960. "padding": 10,
  105961. "showTitle": true,
  105962. "data": []
  105963. },
  105964. "legend": {},
  105965. "extra": {
  105966. "mix": {
  105967. "column": {
  105968. "width": 20
  105969. }
  105970. }
  105971. }
  105972. },
  105973. "scatter": {
  105974. "type": "scatter",
  105975. "color": color,
  105976. "padding": [15, 15, 0, 15],
  105977. "dataLabel": false,
  105978. "xAxis": {
  105979. "disableGrid": false,
  105980. "gridType": "dash",
  105981. "splitNumber": 5,
  105982. "boundaryGap": "justify",
  105983. "min": 0
  105984. },
  105985. "yAxis": {
  105986. "disableGrid": false,
  105987. "gridType": "dash"
  105988. },
  105989. "legend": {},
  105990. "extra": {
  105991. "scatter": {}
  105992. }
  105993. },
  105994. "bubble": {
  105995. "type": "bubble",
  105996. "color": color,
  105997. "padding": [15, 15, 0, 15],
  105998. "xAxis": {
  105999. "disableGrid": false,
  106000. "gridType": "dash",
  106001. "splitNumber": 5,
  106002. "boundaryGap": "justify",
  106003. "min": 0,
  106004. "max": 250
  106005. },
  106006. "yAxis": {
  106007. "disableGrid": false,
  106008. "gridType": "dash",
  106009. "data": [{
  106010. "min": 0,
  106011. "max": 150
  106012. }]
  106013. },
  106014. "legend": {},
  106015. "extra": {
  106016. "bubble": {
  106017. "border": 2,
  106018. "opacity": 0.5
  106019. }
  106020. }
  106021. }
  106022. };
  106023. var _default = cfu;
  106024. exports.default = _default;
  106025. /***/ }),
  106026. /* 1383 */,
  106027. /* 1384 */,
  106028. /* 1385 */,
  106029. /* 1386 */,
  106030. /* 1387 */,
  106031. /* 1388 */,
  106032. /* 1389 */,
  106033. /* 1390 */,
  106034. /* 1391 */,
  106035. /* 1392 */,
  106036. /* 1393 */,
  106037. /* 1394 */,
  106038. /* 1395 */,
  106039. /* 1396 */,
  106040. /* 1397 */,
  106041. /* 1398 */,
  106042. /* 1399 */,
  106043. /* 1400 */,
  106044. /* 1401 */,
  106045. /* 1402 */,
  106046. /* 1403 */,
  106047. /* 1404 */,
  106048. /* 1405 */,
  106049. /* 1406 */,
  106050. /* 1407 */,
  106051. /* 1408 */,
  106052. /* 1409 */,
  106053. /* 1410 */,
  106054. /* 1411 */,
  106055. /* 1412 */,
  106056. /* 1413 */,
  106057. /* 1414 */,
  106058. /* 1415 */,
  106059. /* 1416 */,
  106060. /* 1417 */,
  106061. /* 1418 */
  106062. /*!**********************************************************************************!*\
  106063. !*** E:/git/2021项目/v3-H5/uni_modules/zb-table/components/zb-table/js/summary.js ***!
  106064. \**********************************************************************************/
  106065. /*! no static exports found */
  106066. /***/ (function(module, exports, __webpack_require__) {
  106067. "use strict";
  106068. Object.defineProperty(exports, "__esModule", {
  106069. value: true
  106070. });
  106071. exports.default = void 0;
  106072. var _default2 = {
  106073. props: {
  106074. scrollbarSize: {
  106075. type: Number,
  106076. default: 0
  106077. },
  106078. fixedLeftColumns: {
  106079. type: Array,
  106080. default: function _default() {
  106081. return [];
  106082. }
  106083. },
  106084. data: {
  106085. type: Array,
  106086. default: function _default() {
  106087. return [];
  106088. }
  106089. },
  106090. transColumns: {
  106091. type: Array,
  106092. default: function _default() {
  106093. return [];
  106094. }
  106095. },
  106096. border: {
  106097. type: Boolean,
  106098. default: false
  106099. },
  106100. showSummary: {
  106101. type: Boolean,
  106102. default: false
  106103. },
  106104. summaryMethod: {
  106105. type: Function
  106106. },
  106107. sumText: {
  106108. type: String,
  106109. default: '合计'
  106110. },
  106111. headerFooterTableLeft: {
  106112. type: Number,
  106113. default: 0
  106114. },
  106115. handleFooterTableScrollLeft: Function
  106116. },
  106117. data: function data() {
  106118. return {
  106119. sums: []
  106120. };
  106121. },
  106122. watch: {
  106123. 'data': {
  106124. deep: true,
  106125. immediate: true,
  106126. handler: function handler(newValue, oldValue) {
  106127. var _this = this;
  106128. var sums = [];
  106129. if (this.summaryMethod) {
  106130. sums = this.summaryMethod({
  106131. columns: this.transColumns,
  106132. data: this.data
  106133. });
  106134. } else {
  106135. this.transColumns.forEach(function (column, index) {
  106136. if (index === 0) {
  106137. sums[index] = _this.sumText;
  106138. return;
  106139. }
  106140. var values = _this.data.map(function (item) {
  106141. return Number(item[column.name]);
  106142. });
  106143. var precisions = [];
  106144. var notNumber = true;
  106145. values.forEach(function (value) {
  106146. if (!isNaN(value)) {
  106147. notNumber = false;
  106148. var decimal = ('' + value).split('.')[1];
  106149. precisions.push(decimal ? decimal.length : 0);
  106150. }
  106151. });
  106152. var precision = Math.max.apply(null, precisions);
  106153. if (!notNumber) {
  106154. sums[index] = values.reduce(function (prev, curr) {
  106155. var value = Number(curr);
  106156. if (!isNaN(value)) {
  106157. return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  106158. } else {
  106159. return prev;
  106160. }
  106161. }, 0);
  106162. } else {
  106163. sums[index] = '';
  106164. }
  106165. });
  106166. }
  106167. this.sums = sums;
  106168. }
  106169. }
  106170. }
  106171. };
  106172. exports.default = _default2;
  106173. /***/ })
  106174. ]]);
  106175. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map